Split backend to backend api.
This commit is contained in:
parent
4bd244f4e5
commit
a13719f008
116 changed files with 1029 additions and 815 deletions
|
|
@ -0,0 +1,529 @@
|
|||
/*
|
||||
* 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.opt.metamodel;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import org.eobjects.metamodel.DataContext;
|
||||
import org.eobjects.metamodel.schema.Column;
|
||||
import org.eobjects.metamodel.schema.Relationship;
|
||||
import org.eobjects.metamodel.schema.Table;
|
||||
|
||||
import net.forwardfire.vasc.backend.VascBackend;
|
||||
import net.forwardfire.vasc.backend.VascBackendControllerLocal;
|
||||
import net.forwardfire.vasc.backend.metamodel.MetaModelDataContextProvider;
|
||||
import net.forwardfire.vasc.backend.metamodel.MetaModelVascBackend;
|
||||
import net.forwardfire.vasc.core.VascController;
|
||||
import net.forwardfire.vasc.core.VascEntry;
|
||||
import net.forwardfire.vasc.core.VascEntryAccessType;
|
||||
import net.forwardfire.vasc.core.VascEntryControllerLocal;
|
||||
import net.forwardfire.vasc.core.VascEntryField;
|
||||
import net.forwardfire.vasc.core.VascEntryFieldLocal;
|
||||
import net.forwardfire.vasc.core.VascEntryGroupLocal;
|
||||
import net.forwardfire.vasc.core.VascEntryLinkType;
|
||||
import net.forwardfire.vasc.core.VascEntryLocal;
|
||||
import net.forwardfire.vasc.impl.DefaultVascEntry;
|
||||
import net.forwardfire.vasc.impl.DefaultVascEntryField;
|
||||
import net.forwardfire.vasc.impl.DefaultVascEntryLink;
|
||||
import net.forwardfire.vasc.impl.ui.VascSelectItemModelEntry;
|
||||
|
||||
/**
|
||||
* MetaModelSchemaAutoEntry
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 May 2, 2012
|
||||
*/
|
||||
public class MetaModelSchemaAutoEntry {
|
||||
|
||||
private Logger logger = null;
|
||||
private VascController vascController = null;
|
||||
private MetaModelDataContextProvider dataContextProvider = null;
|
||||
private List<String> tables = null;
|
||||
private String tableInclude = null;
|
||||
private String tableExclude = null;
|
||||
private String entryPrefix = null;
|
||||
private String vascGroupId = null;
|
||||
private String veLinkPostfix = "_velink";
|
||||
private String veListPostfix = "_velist";
|
||||
|
||||
private Map<String,VascEntryLocal> resultEntries = null;
|
||||
private Map<String,VascEntryGroupLocal> resultEntryGroups = null;
|
||||
private Map<String,MetaModelVascBackend> resultBackends = null;
|
||||
|
||||
public MetaModelSchemaAutoEntry() {
|
||||
logger = Logger.getLogger(MetaModelSchemaAutoEntry.class.getName());
|
||||
tables = new ArrayList<String>();
|
||||
resultEntries = new HashMap<String,VascEntryLocal>();
|
||||
resultEntryGroups = new HashMap<String,VascEntryGroupLocal>();
|
||||
resultBackends = new HashMap<String,MetaModelVascBackend>();
|
||||
}
|
||||
|
||||
public void autoFillResult(VascController vascController) {
|
||||
if (getDataContextProvider()==null) {
|
||||
throw new NullPointerException("Can't auto create entries with null dataContextProvider.");
|
||||
}
|
||||
if (getEntryPrefix()==null) {
|
||||
throw new NullPointerException("Can't auto create with null entryPrefix.");
|
||||
}
|
||||
this.vascController=vascController;
|
||||
|
||||
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;
|
||||
}
|
||||
if (getTableExclude()!=null && table.matches(getTableExclude())) {
|
||||
logger.finer("Excluding table: "+table+" from exclude rule.");
|
||||
continue;
|
||||
}
|
||||
createMetaEntry(ds,getEntryPrefix()+"_"+table,table);
|
||||
}
|
||||
}
|
||||
|
||||
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;
|
||||
if (tableName==null) {
|
||||
metaTable = ds.getDefaultSchema().getTable(0);
|
||||
} else {
|
||||
metaTable = ds.getDefaultSchema().getTableByName(tableName);
|
||||
}
|
||||
Column[] keys = metaTable.getPrimaryKeys();
|
||||
Column[] cols = metaTable.getColumns();
|
||||
if (cols.length==0) {
|
||||
return; // vasc needs at least one column
|
||||
}
|
||||
|
||||
MetaModelVascBackend backend = new MetaModelVascBackend();
|
||||
backend.setId(id+"_backend");
|
||||
backend.setDataContextProvider(getDataContextProvider());
|
||||
backend.setTable(metaTable.getName());
|
||||
if (keys.length>0) {
|
||||
backend.setTableId(keys[0].getName());
|
||||
} else {
|
||||
backend.setTableId(cols[0].getName());
|
||||
//TODO backend.setRequestReadOnly(true);
|
||||
}
|
||||
|
||||
DefaultVascEntry ve = new DefaultVascEntry();
|
||||
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);
|
||||
} else {
|
||||
logger.finer("Creating List entry for: "+rs.getPrimaryColumns()[0].getName()+" of table: "+rs.getPrimaryTable().getName());
|
||||
createListEntry(rs,ve,metaTable);
|
||||
}
|
||||
}
|
||||
|
||||
resultBackends.put(backend.getId(),backend);
|
||||
resultEntries.put(ve.getId(),ve);
|
||||
}
|
||||
|
||||
private void createLinkEntry(Relationship rs2,VascEntryLocal ve,Table metaTable) {
|
||||
String id = getEntryPrefix()+"_"+rs2.getForeignTable().getName()+getVeLinkPostfix();
|
||||
MetaModelVascBackend backendLink = new MetaModelVascBackend();
|
||||
backendLink.setId(id+"_backend");
|
||||
backendLink.setDataContextProvider(getDataContextProvider());
|
||||
backendLink.setTable(rs2.getForeignTable().getName());
|
||||
|
||||
Column[] keys = rs2.getForeignTable().getPrimaryKeys();
|
||||
Column[] cols = rs2.getForeignTable().getColumns();
|
||||
if (cols.length==0) {
|
||||
return;
|
||||
}
|
||||
if (keys.length>0) {
|
||||
backendLink.setTableId(keys[0].getName());
|
||||
} else {
|
||||
backendLink.setTableId(cols[0].getName());
|
||||
}
|
||||
|
||||
DefaultVascEntry veLink = new DefaultVascEntry();
|
||||
veLink.setId(id);
|
||||
veLink.setBackendId(id+"_backend");
|
||||
veLink.setPrimaryKeyFieldId(backendLink.getTableId());
|
||||
veLink.setVascGroupId(getVascGroupId());
|
||||
veLink.setAccessType(VascEntryAccessType.ENTRY_LINK);
|
||||
createFields(veLink,cols);
|
||||
|
||||
if (resultBackends.containsKey(backendLink.getId())==false) {
|
||||
resultBackends.put(backendLink.getId(),backendLink);
|
||||
resultEntries.put(veLink.getId(),veLink);
|
||||
}
|
||||
|
||||
for (Relationship rs:rs2.getForeignTable().getRelationships()) {
|
||||
logger.finer("Found relation FT: "+rs.getForeignTable().getName()+" PT: "+rs.getPrimaryTable().getName());
|
||||
if (rs2.getForeignTable().getName().equals(rs.getForeignTable().getName())==false) {
|
||||
//logger.info("Creating Link entry for: "+rs.getForeignColumns()[0].getName()+" of table: "+rs.getForeignTable().getName());
|
||||
//createLinkEntry(rs,veLink,rs2.getForeignTable());
|
||||
} else {
|
||||
logger.fine("Creating List entry for: "+rs.getPrimaryColumns()[0].getName()+" of table: "+rs.getPrimaryTable().getName());
|
||||
createListEntry(rs,veLink,rs2.getForeignTable());
|
||||
}
|
||||
}
|
||||
|
||||
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 = getEntryPrefix()+"_"+rs.getPrimaryTable().getName()+getVeListPostfix();
|
||||
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();
|
||||
if (cols.length==0) {
|
||||
return;
|
||||
}
|
||||
if (keys.length>0) {
|
||||
backendList.setTableId(keys[0].getName());
|
||||
} else {
|
||||
backendList.setTableId(cols[0].getName());
|
||||
}
|
||||
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());
|
||||
if (veList.getDisplayNameFieldId()==null) {
|
||||
itemModel.setDisplayFieldId(veList.getPrimaryKeyFieldId()); // display can be null see createFields(), in vasc display is not null but defaulted on primary id.
|
||||
} else {
|
||||
itemModel.setDisplayFieldId(veList.getDisplayNameFieldId());
|
||||
}
|
||||
|
||||
vef.getVascEntryFieldType().setDataObject(itemModel);
|
||||
|
||||
}
|
||||
|
||||
private void createFields(VascEntryLocal ve,Column[] cols) {
|
||||
for (Column c:cols) {
|
||||
String name = c.getName().toLowerCase();
|
||||
DefaultVascEntryField vef = new DefaultVascEntryField();
|
||||
vef.setId(c.getName());
|
||||
vef.setVascEntryFieldType(getVascController().getVascEntryFieldTypeController().getVascEntryFieldTypeByClass(c.getType().getJavaEquivalentClass()));
|
||||
|
||||
if (vef.getId().equals(ve.getPrimaryKeyFieldId())) {
|
||||
vef.setEditReadOnly(true);
|
||||
vef.setCreate(false);
|
||||
}
|
||||
|
||||
if (vef.getVascEntryFieldType()==null || "TextField".equals(vef.getVascEntryFieldType().getId())) {
|
||||
if (name.contains("desc") || name.contains("text") || name.contains("comment") || name.contains("memo") ) {
|
||||
vef.setVascEntryFieldType(getVascController().getVascEntryFieldTypeController().getVascEntryFieldTypeById("TextAreaField"));
|
||||
}
|
||||
if (name.contains("active")) {
|
||||
vef.setDefaultValue("true");
|
||||
vef.setVascEntryFieldType(getVascController().getVascEntryFieldTypeController().getVascEntryFieldTypeById("BooleanField"));
|
||||
} /* todo
|
||||
if (c.getName().toLowerCase().contains("email")) {
|
||||
vef.setVascEntryFieldType(getVascController().getVascEntryFieldTypeController().getVascEntryFieldTypeById("EmailField"));
|
||||
}
|
||||
if (c.getName().toLowerCase().contains("url")) {
|
||||
vef.setVascEntryFieldType(getVascController().getVascEntryFieldTypeController().getVascEntryFieldTypeById("URLField"));
|
||||
} */
|
||||
}
|
||||
|
||||
if (vef.getVascEntryFieldType()!=null && vef.getVascEntryFieldType().getAutoDetectClass()==Date.class) {
|
||||
vef.setDefaultValue("now()");
|
||||
if (name.contains("create") || name.contains("modified")) {
|
||||
vef.setEdit(false);
|
||||
vef.setCreate(false);
|
||||
}
|
||||
if (name.contains("update")) {
|
||||
vef.setCreate(false);
|
||||
}
|
||||
}
|
||||
|
||||
ve.addVascEntryField(vef);
|
||||
if (ve.getDisplayNameFieldId()==null && c.getName().equals(ve.getPrimaryKeyFieldId())==false && c.getType().getJavaEquivalentClass()==String.class) {
|
||||
ve.setDisplayNameFieldId(c.getName());
|
||||
}
|
||||
}
|
||||
|
||||
// Disable lists when id contains;
|
||||
for (VascEntryField vef:ve.getVascEntryFields()) {
|
||||
String id = vef.getId().toLowerCase();
|
||||
if (ve.getDisplayNameFieldId()!=null && ve.getDisplayNameFieldId().equals(vef.getId())) {
|
||||
continue;
|
||||
}
|
||||
if (ve.getPrimaryKeyFieldId()!=null && ve.getPrimaryKeyFieldId().equals(vef.getId())) {
|
||||
continue;
|
||||
}
|
||||
if (vef.getList()!=null && vef.getList()==false) {
|
||||
continue;
|
||||
}
|
||||
if ( id.contains("email") |
|
||||
id.contains("phone") |
|
||||
id.contains("data") |
|
||||
id.contains("value") |
|
||||
id.contains("create") |
|
||||
id.contains("update") |
|
||||
id.contains("delete") |
|
||||
id.contains("classname") |
|
||||
id.contains("description")
|
||||
) {
|
||||
vef.setList(false);
|
||||
}
|
||||
}
|
||||
|
||||
// Some auto detection on fields so default imported list view looks oke on 8++ columns.
|
||||
if (ve.getVascEntryFields().size()>10) {
|
||||
List<String> vefListIds = new ArrayList<String>(20);
|
||||
int max = 0;
|
||||
for (VascEntryField vef:ve.getVascEntryFields()) {
|
||||
if (ve.getDisplayNameFieldId()!=null && ve.getDisplayNameFieldId().equals(vef.getId())) {
|
||||
continue;
|
||||
}
|
||||
if (ve.getPrimaryKeyFieldId()!=null && ve.getPrimaryKeyFieldId().equals(vef.getId())) {
|
||||
continue;
|
||||
}
|
||||
if (vef.getList()!=null && vef.getList()==false) {
|
||||
continue;
|
||||
}
|
||||
vefListIds.add(vef.getId());
|
||||
max++;
|
||||
if (max>8) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
for (String key:vefListIds) {
|
||||
VascEntryField vef = ve.getVascEntryFieldById(key);
|
||||
vef.setList(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the dataContextProvider
|
||||
*/
|
||||
public MetaModelDataContextProvider getDataContextProvider() {
|
||||
return dataContextProvider;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param dataContextProvider the dataContextProvider to set
|
||||
*/
|
||||
public void setDataContextProvider(MetaModelDataContextProvider dataContextProvider) {
|
||||
this.dataContextProvider = dataContextProvider;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the tableInclude
|
||||
*/
|
||||
public String getTableInclude() {
|
||||
return tableInclude;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param tableInclude the tableInclude to set
|
||||
*/
|
||||
public void setTableInclude(String tableInclude) {
|
||||
this.tableInclude = tableInclude;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the tableExclude
|
||||
*/
|
||||
public String getTableExclude() {
|
||||
return tableExclude;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param tableExclude the tableExclude to set
|
||||
*/
|
||||
public void setTableExclude(String tableExclude) {
|
||||
this.tableExclude = tableExclude;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the entryPrefix
|
||||
*/
|
||||
public String getEntryPrefix() {
|
||||
return entryPrefix;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param entryPrefix the entryPrefix to set
|
||||
*/
|
||||
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 List<VascEntryLocal> getResultEntries() {
|
||||
List<VascEntryLocal> result = new ArrayList<VascEntryLocal>(resultEntries.values());
|
||||
Collections.sort(result, new Comparator<VascEntryLocal>() {
|
||||
@Override
|
||||
public int compare(VascEntryLocal o1, VascEntryLocal o2) {
|
||||
return o1.getId().compareTo(o2.getId());
|
||||
}
|
||||
});
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the resultEntryGroups
|
||||
*/
|
||||
public List<VascEntryGroupLocal> getResultEntryGroups() {
|
||||
List<VascEntryGroupLocal> result = new ArrayList<VascEntryGroupLocal>(resultEntryGroups.values());
|
||||
Collections.sort(result, new Comparator<VascEntryGroupLocal>() {
|
||||
@Override
|
||||
public int compare(VascEntryGroupLocal o1, VascEntryGroupLocal o2) {
|
||||
return o1.getId().compareTo(o2.getId());
|
||||
}
|
||||
});
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the resultBackends
|
||||
*/
|
||||
public List<MetaModelVascBackend> getResultBackends() {
|
||||
List<MetaModelVascBackend> result = new ArrayList<MetaModelVascBackend>(resultBackends.values());
|
||||
Collections.sort(result, new Comparator<MetaModelVascBackend>() {
|
||||
@Override
|
||||
public int compare(MetaModelVascBackend o1, MetaModelVascBackend o2) {
|
||||
return o1.getId().compareTo(o2.getId());
|
||||
}
|
||||
});
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the tables
|
||||
*/
|
||||
public List<String> getTables() {
|
||||
return tables;
|
||||
}
|
||||
|
||||
public void addTable(String table) {
|
||||
tables.add(table);
|
||||
}
|
||||
public void removeTable(String table) {
|
||||
tables.remove(table);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the veLinkPostfix
|
||||
*/
|
||||
public String getVeLinkPostfix() {
|
||||
return veLinkPostfix;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param veLinkPostfix the veLinkPostfix to set
|
||||
*/
|
||||
public void setVeLinkPostfix(String veLinkPostfix) {
|
||||
this.veLinkPostfix = veLinkPostfix;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the veListPostfix
|
||||
*/
|
||||
public String getVeListPostfix() {
|
||||
return veListPostfix;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param veListPostfix the veListPostfix to set
|
||||
*/
|
||||
public void setVeListPostfix(String veListPostfix) {
|
||||
this.veListPostfix = veListPostfix;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,57 @@
|
|||
/*
|
||||
* 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.opt.metamodel.x4o;
|
||||
|
||||
import net.forwardfire.vasc.core.VascController;
|
||||
import net.forwardfire.vasc.impl.x4o.VascDriver;
|
||||
import net.forwardfire.vasc.opt.metamodel.MetaModelSchemaAutoEntry;
|
||||
|
||||
import org.x4o.xml.element.AbstractElementConfigurator;
|
||||
import org.x4o.xml.element.Element;
|
||||
import org.x4o.xml.element.ElementConfiguratorException;
|
||||
|
||||
/**
|
||||
* SchemaAutoEntryElementConfigurator runs the autoCreateEntries method the MetaModelSchemaAutoEntry bean.
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 May 12, 2012
|
||||
*/
|
||||
public class SchemaAutoEntryElementConfigurator extends AbstractElementConfigurator {
|
||||
|
||||
/**
|
||||
* @see org.x4o.xml.element.AbstractElementConfigurator#doConfigEndTag(org.x4o.xml.element.Element)
|
||||
*/
|
||||
public void doConfigElement(Element element) throws ElementConfiguratorException {
|
||||
|
||||
if (element.getElementObject()==null) {
|
||||
throw new ElementConfiguratorException(this,"ElementObject is null");
|
||||
}
|
||||
if ((element.getElementObject() instanceof MetaModelSchemaAutoEntry)==false) {
|
||||
throw new ElementConfiguratorException(this,"ElementObject is not MetaModelSchemaAutoEntry object.");
|
||||
}
|
||||
MetaModelSchemaAutoEntry autoEntry = (MetaModelSchemaAutoEntry)element.getElementObject();
|
||||
VascController vascController = VascDriver.getVascController(element.getLanguageSession());
|
||||
autoEntry.autoFillResult(vascController);
|
||||
autoEntry.autoAddResultToController();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<modules version="1.0"
|
||||
xmlns="http://language.x4o.org/xml/ns/modules"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://language.x4o.org/xml/ns/modules http://language.x4o.org/xml/ns/modules-1.0.xsd"
|
||||
>
|
||||
<language version="1.0">
|
||||
<eld-resource>vasc-opt-metamodel.eld</eld-resource>
|
||||
</language>
|
||||
</modules>
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<root:module
|
||||
xmlns="http://eld.x4o.org/xml/ns/eld-lang"
|
||||
xmlns:root="http://eld.x4o.org/xml/ns/eld-root"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://eld.x4o.org/xml/ns/eld-root http://eld.x4o.org/xml/ns/eld-root-1.0.xsd"
|
||||
providerHost="vasc.forwardfire.net"
|
||||
providerName="Vasc Opt MetaModel"
|
||||
id="vasc-opt-metamodel"
|
||||
>
|
||||
<description>Provides Dynamic MetaModel vasc entries.</description>
|
||||
<namespace uri="http://vasc.forwardfire.net/xml/ns/vasc-opt-metamodel"
|
||||
schemaUri="http://vasc.forwardfire.net/xml/ns/vasc-opt-metamodel-1.0.xsd"
|
||||
schemaResource="vasc-opt-metamodel-1.0.xsd"
|
||||
schemaPrefix="omm"
|
||||
name="Vasc Opt MetaModel"
|
||||
id="ns-vasc-opt-omm"
|
||||
>
|
||||
<description>Provides backend and data context provider support.</description>
|
||||
<element tag="schemaAutoEntry" objectClass="net.forwardfire.vasc.opt.metamodel.MetaModelSchemaAutoEntry">
|
||||
<configurator id="schemaAutoEntry-SchemaAutoEntryElementConfigurator" bean.class="net.forwardfire.vasc.opt.metamodel.x4o.SchemaAutoEntryElementConfigurator" configAction="true"/>
|
||||
</element>
|
||||
</namespace>
|
||||
</root:module>
|
||||
Loading…
Add table
Add a link
Reference in a new issue