diff --git a/src/site/apt/features.apt b/src/site/apt/features.apt
index dc9e8d1..208f5d6 100644
--- a/src/site/apt/features.apt
+++ b/src/site/apt/features.apt
@@ -58,8 +58,8 @@ zie tables statline.cbs.nl voor bs asielverzoeken nl
- Extjs
- Swing
- WS
- - SWT via SwingWT
- - JSF (met utr plugin)
+ - SWT
+ - JSF
@@ -167,34 +167,6 @@ public class BlogPost {
-
- vasc
-
- admin=true
- backend=extjs
- path=/js/extjs/*
-
-
- vasc
- /vasc/*
-
-
-
-EmployeeDataSource dataSource = new EmployeeDataSource();
-dataSource.setJdbcTemplate(new JdbcTemplate(employeeDataSource()));
- FilteringPaginator filteringPaginator = new FilteringPaginator(dataSource, EmployeeReportObject.class);
- JsfCrudAdapter adapter = new JsfCrudAdapter(filteringPaginator, (CrudController)empCrud().getController()){
- public Serializable getEntity() {
- Object object = ((Row)getModel().getRowData()).getObject();
- EmployeeReportObject employeeReportObject = (EmployeeReportObject) object;
- Employee employee = new Employee();
- employee.setId(employeeReportObject.getId());
- return employee;
- }
- };
-
- return adapter;
-
EVt;
@@ -223,46 +195,8 @@ EVt;
-@SuppressWarnings({ "unchecked", "serial" })
-@Bean(scope = DefaultScopes.SESSION)
-public JsfCrudAdapter empRecordCrud() {
- EmployeeDataSource dataSource = new EmployeeDataSource();
- dataSource.setJdbcTemplate(new JdbcTemplate(employeeDataSource()));
- FilteringPaginator filteringPaginator = new FilteringPaginator(dataSource, EmployeeReportObject.class);
- JsfCrudAdapter adapter = new JsfCrudAdapter(filteringPaginator, (CrudController)empCrud().getController()){
- public Serializable getEntity() {
- Object object = ((Row)getModel().getRowData()).getObject();
- EmployeeReportObject employeeReportObject = (EmployeeReportObject) object;
- Employee employee = new Employee();
- employee.setId(employeeReportObject.getId());
- return employee;
- }
- };
-
- return adapter;
-}
-
-
-
-
-
-
-
-
-
-
-
-
-
- tables = null;
private String tableInclude = null;
private String tableExclude = null;
private String entryPrefix = null;
+ private String vascGroupId = null;
+
+ private Map resultEntries = null;
+ private Map resultEntryGroups = null;
+ private Map resultBackends = null;
public MetaModelSchemaAutoEntry() {
logger = Logger.getLogger(MetaModelSchemaAutoEntry.class.getName());
+ tables = new ArrayList();
+ resultEntries = new HashMap();
+ resultEntryGroups = new HashMap();
+ resultBackends = new HashMap();
}
- public void autoCreateEntries(VascController vascController) {
+ public void autoFillResult(VascController vascController) {
if (getDataContextProvider()==null) {
throw new NullPointerException("Can't auto create entries with null dataContextProvider.");
}
@@ -72,6 +90,10 @@ public class MetaModelSchemaAutoEntry {
DataContext ds = getDataContextProvider().getDataContext();
for (String table:ds.getDefaultSchema().getTableNames()) {
+ if (tables.isEmpty()==false && tables.contains(table)==false) {
+ logger.finer("Excluding table: "+table+" because not in table list.");
+ continue;
+ }
if (getTableInclude()!=null && table.matches(getTableInclude())==false) {
logger.finer("Excluding table: "+table+" from include rule.");
continue;
@@ -84,10 +106,22 @@ public class MetaModelSchemaAutoEntry {
}
}
+ public void autoAddResultToController() {
+ for (VascBackend backend:resultBackends.values()) {
+ ((VascBackendControllerLocal)getVascController().getVascBackendController()).addVascBackend(backend);
+ }
+ for (VascEntryLocal ve:resultEntries.values()) {
+ ((VascEntryControllerLocal)getVascController().getVascEntryController()).addVascEntry(ve);
+ }
+ for (VascEntryGroupLocal veg:resultEntryGroups.values()) {
+ ((VascEntryControllerLocal)getVascController().getVascEntryController()).addVascEntryGroup(veg);
+ }
+ }
+
private VascController getVascController() {
return vascController;
}
-
+
private void createMetaEntry(DataContext ds,String id,String tableName) {
logger.fine("Creating entry id: "+id+" of table: "+tableName);
Table metaTable = null;
@@ -117,28 +151,28 @@ public class MetaModelSchemaAutoEntry {
ve.setId(id);
ve.setBackendId(id+"_backend");
ve.setPrimaryKeyFieldId(backend.getTableId());
+ ve.setVascGroupId(getVascGroupId());
createFields(ve,cols);
for (Relationship rs:metaTable.getRelationships()) {
logger.finer("Found relation FT: "+rs.getForeignTable().getName()+" PT: "+rs.getPrimaryTable().getName());
if (tableName.equals(rs.getForeignTable().getName())==false) {
logger.finer("Creating Link entry for: "+rs.getForeignColumns()[0].getName()+" of table: "+rs.getForeignTable().getName());
- createLinkEntry(rs,ve,metaTable,id+"_"+rs.getForeignTable().getName()+"_"+rs.getForeignColumns()[0].getName()+"_link");
+ createLinkEntry(rs,ve,metaTable);
+ //createLinkEntry(rs,ve,metaTable,id+"_"+rs.getForeignTable().getName()+"_"+rs.getForeignColumns()[0].getName()+"_link");
} else {
logger.finer("Creating List entry for: "+rs.getPrimaryColumns()[0].getName()+" of table: "+rs.getPrimaryTable().getName());
- createListEntry(rs,ve,metaTable,id+"_"+rs.getPrimaryTable().getName()+"_"+rs.getPrimaryColumns()[0].getName()+"_list");
+ createListEntry(rs,ve,metaTable);
+ //createListEntry(rs,ve,metaTable,id+"_"+rs.getPrimaryTable().getName()+"_"+rs.getPrimaryColumns()[0].getName()+"_list");
}
}
- try {
- ((VascBackendControllerLocal)getVascController().getVascBackendController()).addVascBackend(backend);
- ((VascEntryControllerLocal)getVascController().getVascEntryController()).addVascEntry(ve);
- } catch (Exception ee) {
- ee.printStackTrace();
- }
+ resultBackends.put(backend.getId(),backend);
+ resultEntries.put(ve.getId(),ve);
}
- private void createLinkEntry(Relationship rs2,VascEntryLocal ve,Table metaTable,String id) {
+ private void createLinkEntry(Relationship rs2,VascEntryLocal ve,Table metaTable) {
+ String id = getEntryPrefix()+"_"+metaTable.getName()+"_link";
MetaModelVascBackend backendLink = new MetaModelVascBackend();
backendLink.setId(id+"_backend");
backendLink.setDataContextProvider(getDataContextProvider());
@@ -159,6 +193,8 @@ public class MetaModelSchemaAutoEntry {
veLink.setId(id);
veLink.setBackendId(id+"_backend");
veLink.setPrimaryKeyFieldId(backendLink.getTableId());
+ veLink.setVascGroupId(getVascGroupId());
+ veLink.setAccessType(VascEntryAccessType.ENTRY_LIST);
createFields(veLink,cols);
for (Relationship rs:rs2.getForeignTable().getRelationships()) {
@@ -168,32 +204,31 @@ public class MetaModelSchemaAutoEntry {
//createLinkEntry(rs,ve,rs2.getForeignTable(),id+"_"+rs.getForeignTable().getName()+"_"+rs.getForeignColumns()[0].getName()+"_link");
} else {
logger.fine("Creating List entry for: "+rs.getPrimaryColumns()[0].getName()+" of table: "+rs.getPrimaryTable().getName());
- createListEntry(rs,veLink,rs2.getForeignTable(),id+"_"+rs.getPrimaryTable().getName()+"_"+rs.getPrimaryColumns()[0].getName()+"_list");
+ createListEntry(rs,veLink,rs2.getForeignTable());
+ //createListEntry(rs,veLink,rs2.getForeignTable(),id+"_"+rs.getPrimaryTable().getName()+"_"+rs.getPrimaryColumns()[0].getName()+"_list");
}
}
- try {
- ((VascBackendControllerLocal)getVascController().getVascBackendController()).addVascBackend(backendLink);
- ((VascEntryControllerLocal)getVascController().getVascEntryController()).addVascEntry(veLink);
-
- DefaultVascEntryLink vle = new DefaultVascEntryLink();
- vle.setId(id+"Link");
- vle.setVascLinkEntryType(VascEntryLinkType.DEFAULT_TYPE);
- vle.setVascEntryId(id);
- vle.addEntryParameterFieldId(rs2.getForeignColumns()[0].getName(), rs2.getPrimaryColumns()[0].getName());
-
- ve.addVascEntryLink(vle);
-
- } catch (Exception e) {
- e.printStackTrace();
+ if (resultBackends.containsKey(backendLink.getId())==false) {
+ resultBackends.put(backendLink.getId(),backendLink);
+ resultEntries.put(veLink.getId(),veLink);
}
+
+ DefaultVascEntryLink vle = new DefaultVascEntryLink();
+ vle.setId(id+"Link");
+ vle.setVascEntryLinkType(VascEntryLinkType.DEFAULT_TYPE);
+ vle.setVascEntryId(id);
+ vle.addEntryParameterFieldId(rs2.getForeignColumns()[0].getName(), rs2.getPrimaryColumns()[0].getName());
+
+ ve.addVascEntryLink(vle);
}
- private void createListEntry(Relationship rs,VascEntry ve,Table metaTable,String id) {
- MetaModelVascBackend backendLink = new MetaModelVascBackend();
- backendLink.setId(id+"_backend");
- backendLink.setDataContextProvider(getDataContextProvider());
- backendLink.setTable(rs.getPrimaryTable().getName());
+ private void createListEntry(Relationship rs,VascEntry ve,Table metaTable) {
+ String id = getEntryPrefix()+"_"+metaTable.getName()+"_list";
+ MetaModelVascBackend backendList = new MetaModelVascBackend();
+ backendList.setId(id+"_backend");
+ backendList.setDataContextProvider(getDataContextProvider());
+ backendList.setTable(rs.getPrimaryTable().getName());
Column[] keys = rs.getPrimaryTable().getPrimaryKeys();
Column[] cols = rs.getPrimaryTable().getColumns();
@@ -201,33 +236,35 @@ public class MetaModelSchemaAutoEntry {
return;
}
if (keys.length>0) {
- backendLink.setTableId(keys[0].getName());
+ backendList.setTableId(keys[0].getName());
} else {
- backendLink.setTableId(cols[0].getName());
+ backendList.setTableId(cols[0].getName());
}
- DefaultVascEntry veLink = new DefaultVascEntry();
- veLink.setId(id);
- veLink.setBackendId(id+"_backend");
- veLink.setPrimaryKeyFieldId(backendLink.getTableId());
- createFields(veLink,cols);
- try {
- VascEntryFieldLocal vef = (VascEntryFieldLocal)ve.getVascEntryFieldById(rs.getForeignColumns()[0].getName());
- if (vef==null) {
- logger.warning("Could not find: "+rs.getForeignColumns()[0].getName()+" in ve: "+ve.getId());
- return;
- }
- vef.setVascEntryFieldType(getVascController().getVascEntryFieldTypeController().getVascEntryFieldTypeById("ListField"));
-
- VascSelectItemModelEntry itemModel = new VascSelectItemModelEntry();
- itemModel.setEntryId(veLink.getId());
- itemModel.setDisplayFieldId(veLink.getDisplayNameFieldId());
- vef.getVascEntryFieldType().setDataObject(itemModel);
-
- ((VascBackendControllerLocal)getVascController().getVascBackendController()).addVascBackend(backendLink);
- ((VascEntryControllerLocal)getVascController().getVascEntryController()).addVascEntry(veLink);
- } catch (Exception e) {
- e.printStackTrace();
+ DefaultVascEntry veList = new DefaultVascEntry();
+ veList.setId(id);
+ veList.setBackendId(id+"_backend");
+ veList.setPrimaryKeyFieldId(backendList.getTableId());
+ veList.setVascGroupId(getVascGroupId());
+ veList.setAccessType(VascEntryAccessType.ENTRY_LIST);
+ createFields(veList,cols);
+
+ if (resultBackends.containsKey(backendList.getId())==false) {
+ resultBackends.put(backendList.getId(),backendList);
+ resultEntries.put(veList.getId(),veList);
}
+
+ VascEntryFieldLocal vef = (VascEntryFieldLocal)ve.getVascEntryFieldById(rs.getForeignColumns()[0].getName());
+ if (vef==null) {
+ logger.warning("Could not find: "+rs.getForeignColumns()[0].getName()+" in ve: "+ve.getId());
+ return;
+ }
+ vef.setVascEntryFieldType(getVascController().getVascEntryFieldTypeController().getVascEntryFieldTypeById("ListField"));
+
+ VascSelectItemModelEntry itemModel = new VascSelectItemModelEntry();
+ itemModel.setEntryId(veList.getId());
+ itemModel.setDisplayFieldId(veList.getDisplayNameFieldId());
+ vef.getVascEntryFieldType().setDataObject(itemModel);
+
}
private void createFields(VascEntryLocal ve,Column[] cols) {
@@ -317,4 +354,53 @@ public class MetaModelSchemaAutoEntry {
public void setEntryPrefix(String entryPrefix) {
this.entryPrefix = entryPrefix;
}
+
+ /**
+ * @return the vascGroupId
+ */
+ public String getVascGroupId() {
+ return vascGroupId;
+ }
+
+ /**
+ * @param vascGroupId the vascGroupId to set
+ */
+ public void setVascGroupId(String vascGroupId) {
+ this.vascGroupId = vascGroupId;
+ }
+
+ /**
+ * @return the resultEntries
+ */
+ public Collection getResultEntries() {
+ return resultEntries.values();
+ }
+
+ /**
+ * @return the resultEntryGroups
+ */
+ public Collection getResultEntryGroups() {
+ return resultEntryGroups.values();
+ }
+
+ /**
+ * @return the resultBackends
+ */
+ public Collection getResultBackends() {
+ return resultBackends.values();
+ }
+
+ /**
+ * @return the tables
+ */
+ public List getTables() {
+ return tables;
+ }
+
+ public void addTable(String table) {
+ tables.add(table);
+ }
+ public void removeTable(String table) {
+ tables.remove(table);
+ }
}
diff --git a/vasc-backend/vasc-backend-metamodel/src/main/java/net/forwardfire/vasc/backend/metamodel/x4o/SchemaAutoEntryElementConfigurator.java b/vasc-backend/vasc-backend-metamodel/src/main/java/net/forwardfire/vasc/backend/metamodel/x4o/SchemaAutoEntryElementConfigurator.java
index e8541a6..9dd4ede 100644
--- a/vasc-backend/vasc-backend-metamodel/src/main/java/net/forwardfire/vasc/backend/metamodel/x4o/SchemaAutoEntryElementConfigurator.java
+++ b/vasc-backend/vasc-backend-metamodel/src/main/java/net/forwardfire/vasc/backend/metamodel/x4o/SchemaAutoEntryElementConfigurator.java
@@ -51,6 +51,7 @@ public class SchemaAutoEntryElementConfigurator extends AbstractElementConfigura
}
MetaModelSchemaAutoEntry autoEntry = (MetaModelSchemaAutoEntry)element.getElementObject();
VascController vascController = VascParser.getVascController(element.getElementLanguage());
- autoEntry.autoCreateEntries(vascController);
+ autoEntry.autoFillResult(vascController);
+ autoEntry.autoAddResultToController();
}
}
diff --git a/vasc-core-ejb3-client/src/main/java/net/forwardfire/vasc/ejb3/VascServiceRemoteBackend.java b/vasc-core-ejb3-client/src/main/java/net/forwardfire/vasc/ejb3/VascServiceRemoteBackend.java
new file mode 100644
index 0000000..7f5b80c
--- /dev/null
+++ b/vasc-core-ejb3-client/src/main/java/net/forwardfire/vasc/ejb3/VascServiceRemoteBackend.java
@@ -0,0 +1,227 @@
+/*
+ * Copyright 2007-2012 forwardfire.net All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification, are permitted provided
+ * that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright notice, this list of conditions and the
+ * following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
+ * the following disclaimer in the documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
+ * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
+ * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+package net.forwardfire.vasc.ejb3;
+
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.ObjectOutputStream;
+import java.util.List;
+import java.util.Map;
+
+import net.forwardfire.vasc.backend.VascBackend;
+import net.forwardfire.vasc.backend.VascBackendState;
+import net.forwardfire.vasc.core.VascEntry;
+import net.forwardfire.vasc.core.VascEntryField;
+import net.forwardfire.vasc.core.VascEntryFieldLocal;
+import net.forwardfire.vasc.core.VascEntryLocal;
+import net.forwardfire.vasc.core.VascException;
+import net.forwardfire.vasc.core.entry.VascEntryFieldValue;
+import net.forwardfire.vasc.core.entry.VascEntryRecordCreator;
+
+/**
+ * VascServiceRemoteBackend wraps VascBasckend to the ejb3 context.
+ *
+ * @author Willem Cazander
+ * @version 1.0 18 Nov 2012
+ */
+public class VascServiceRemoteBackend implements VascBackend {
+
+ private String backendId = null;
+ private VascServiceManager vascManager = null;
+
+ public VascServiceRemoteBackend(VascServiceManager vascManager,String backendId) {
+ if (vascManager==null) {
+ throw new NullPointerException("Can't be remote backend on null VascServiceManager.");
+ }
+ if (backendId==null) {
+ throw new NullPointerException("Can't be remote backend on null backendId.");
+ }
+ this.vascManager=vascManager;
+ this.backendId=backendId;
+
+ }
+
+ public void startBackend() {
+ }
+ public void stopBackend() {
+ }
+
+ public String getId() {
+ return backendId;
+ }
+
+ public void setId(String id) {
+ // we cant change id
+ }
+
+ public void delete(Object object) throws VascException {
+ Object[] args = new Object[1];
+ args[0]=object;
+ vascManager.invokeBackendMethod(backendId, "delete", args);
+ }
+
+ public long doRecordMoveDownById(VascBackendState state,Object primaryId) throws VascException {
+ Object[] args = new Object[2];
+ args[0]=state;
+ args[1]=primaryId;
+ Object result = vascManager.invokeBackendMethod(backendId, "doRecordMoveDownById", args);
+ return (Long)result;
+ }
+
+ public long doRecordMoveUpById(VascBackendState state, Object primaryId) throws VascException {
+ Object[] args = new Object[2];
+ args[0]=state;
+ args[1]=primaryId;
+ Object result = vascManager.invokeBackendMethod(backendId, "doRecordMoveUpById", args);
+ return (Long)result;
+ }
+
+ @SuppressWarnings("unchecked")
+ public List