Split backend to backend api.
This commit is contained in:
parent
4bd244f4e5
commit
a13719f008
116 changed files with 1029 additions and 815 deletions
17
vasc-opt/.project
Normal file
17
vasc-opt/.project
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>vasc-opt</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.m2e.core.maven2Builder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.m2e.core.maven2Nature</nature>
|
||||
</natures>
|
||||
</projectDescription>
|
||||
17
vasc-opt/pom.xml
Normal file
17
vasc-opt/pom.xml
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>net.forwardfire.vasc</groupId>
|
||||
<artifactId>vasc</artifactId>
|
||||
<version>0.4.2-SNAPSHOT</version>
|
||||
</parent>
|
||||
<artifactId>vasc-opt</artifactId>
|
||||
<groupId>net.forwardfire.vasc.opt</groupId>
|
||||
<packaging>pom</packaging>
|
||||
<name>vasc-opt</name>
|
||||
<description>vasc-opt module for optional modules.</description>
|
||||
<modules>
|
||||
<module>vasc-opt-metamodel</module>
|
||||
<module>vasc-opt-editor</module>
|
||||
</modules>
|
||||
</project>
|
||||
23
vasc-opt/vasc-opt-editor/.project
Normal file
23
vasc-opt/vasc-opt-editor/.project
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>vasc-opt-editor</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.m2e.core.maven2Builder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||
<nature>org.eclipse.m2e.core.maven2Nature</nature>
|
||||
</natures>
|
||||
</projectDescription>
|
||||
18
vasc-opt/vasc-opt-editor/pom.xml
Normal file
18
vasc-opt/vasc-opt-editor/pom.xml
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>net.forwardfire.vasc.opt</groupId>
|
||||
<artifactId>vasc-opt</artifactId>
|
||||
<version>0.4.2-SNAPSHOT</version>
|
||||
</parent>
|
||||
<artifactId>vasc-opt-editor</artifactId>
|
||||
<name>vasc-opt-editor</name>
|
||||
<description>vasc-opt-editor</description>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>net.forwardfire.vasc</groupId>
|
||||
<artifactId>vasc-core</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
|
|
@ -0,0 +1,178 @@
|
|||
package net.forwardfire.vasc.opt.editor;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.forwardfire.vasc.backend.AbstractVascBackend;
|
||||
import net.forwardfire.vasc.backend.VascBackendException;
|
||||
import net.forwardfire.vasc.backend.VascBackendState;
|
||||
import net.forwardfire.vasc.backend.VascEntryFieldValue;
|
||||
import net.forwardfire.vasc.backend.VascEntryRecordCreator;
|
||||
import net.forwardfire.vasc.backend.data.BeanVascEntryFieldValue;
|
||||
import net.forwardfire.vasc.backend.data.BeanVascEntryRecordCreator;
|
||||
import net.forwardfire.vasc.core.VascController;
|
||||
import net.forwardfire.vasc.core.VascEntry;
|
||||
import net.forwardfire.vasc.core.VascEntryControllerLocal;
|
||||
import net.forwardfire.vasc.core.VascEntryField;
|
||||
import net.forwardfire.vasc.core.VascEntryFieldLocal;
|
||||
import net.forwardfire.vasc.core.VascEntryFieldSet;
|
||||
import net.forwardfire.vasc.core.VascEntryFieldSetLocal;
|
||||
import net.forwardfire.vasc.core.VascEntryLinkLocal;
|
||||
import net.forwardfire.vasc.core.VascEntryListOption;
|
||||
import net.forwardfire.vasc.core.VascEntryListOptionLocal;
|
||||
import net.forwardfire.vasc.core.VascEntryLocal;
|
||||
import net.forwardfire.vasc.core.VascEntryLink;
|
||||
import net.forwardfire.vasc.impl.DefaultVascEntry;
|
||||
import net.forwardfire.vasc.impl.DefaultVascEntryField;
|
||||
import net.forwardfire.vasc.impl.DefaultVascEntryFieldSet;
|
||||
import net.forwardfire.vasc.impl.DefaultVascEntryLink;
|
||||
|
||||
public class VirtualVascBackend extends AbstractVascBackend {
|
||||
|
||||
private VascController vascController = null;
|
||||
private String vascType = "entry";
|
||||
private String entryId = null;
|
||||
|
||||
public List<Object> execute(VascBackendState state) throws VascBackendException {
|
||||
List<Object> result = new ArrayList<Object>(100);
|
||||
entryId = (String)state.getDataParameter("entry_id");
|
||||
if ("entry".equals(vascType)) {
|
||||
for (String id:vascController.getVascEntryController().getVascEntryIds()) {
|
||||
result.add(vascController.getVascEntryController().getVascEntryById(id));
|
||||
}
|
||||
} else if ("field".equals(vascType)) {
|
||||
if (entryId!=null) {
|
||||
VascEntry ve = vascController.getVascEntryController().getVascEntryById(entryId);
|
||||
result.addAll(ve.getVascEntryFields());
|
||||
}
|
||||
} else if ("fieldset".equals(vascType)) {
|
||||
if (entryId!=null) {
|
||||
VascEntry ve = vascController.getVascEntryController().getVascEntryById(entryId);
|
||||
result.addAll(ve.getVascEntryFieldSets());
|
||||
}
|
||||
} else if ("linkentries".equals(vascType)) {
|
||||
if (entryId!=null) {
|
||||
VascEntry ve = vascController.getVascEntryController().getVascEntryById(entryId);
|
||||
result.addAll(ve.getVascEntryLinks());
|
||||
}
|
||||
} else if ("listoptions".equals(vascType)) {
|
||||
if (entryId!=null) {
|
||||
VascEntry ve = vascController.getVascEntryController().getVascEntryById(entryId);
|
||||
result.addAll(ve.getVascEntryListOptions());
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public void persist(Object object) throws VascBackendException {
|
||||
edit(object,false,true);
|
||||
}
|
||||
|
||||
public Object merge(Object object) throws VascBackendException {
|
||||
return edit(object,true,true);
|
||||
}
|
||||
|
||||
public void delete(Object object) throws VascBackendException {
|
||||
edit(object,true,false);
|
||||
}
|
||||
|
||||
public Object edit(Object object,boolean removeReal,boolean addEdit) throws VascBackendException {
|
||||
|
||||
if (object instanceof VascEntry) {
|
||||
entryId = ((VascEntry)object).getId();
|
||||
}
|
||||
VascEntryLocal veReal = (VascEntryLocal)((VascEntryControllerLocal)vascController.getVascEntryController()).getMasterVascEntryById(entryId);
|
||||
|
||||
if ("entry".equals(vascType)) {
|
||||
|
||||
} else if ("field".equals(vascType)) {
|
||||
VascEntryFieldLocal vef = (VascEntryFieldLocal)object;
|
||||
if (removeReal) {
|
||||
VascEntryField vefReal = veReal.getVascEntryFieldById(vef.getId());
|
||||
veReal.removeVascEntryField((VascEntryFieldLocal)vefReal);
|
||||
}
|
||||
if (addEdit) {
|
||||
veReal.addVascEntryField(vef);
|
||||
}
|
||||
} else if ("fieldset".equals(vascType)) {
|
||||
VascEntryFieldSetLocal vefs = (VascEntryFieldSetLocal)object;
|
||||
if (removeReal) {
|
||||
VascEntryFieldSet vefsReal = veReal.getVascEntryFieldSetById(vefs.getId());
|
||||
veReal.removeVascEntryFieldSet((VascEntryFieldSetLocal)vefsReal);
|
||||
}
|
||||
if (addEdit) {
|
||||
veReal.addVascEntryFieldSet(vefs);
|
||||
}
|
||||
} else if ("linkentries".equals(vascType)) {
|
||||
VascEntryLinkLocal vefs = (VascEntryLinkLocal)object;
|
||||
if (removeReal) {
|
||||
VascEntryLink vefsReal = veReal.getVascEntryLinkById(vefs.getId());
|
||||
veReal.removeVascEntryLink((VascEntryLinkLocal)vefsReal);
|
||||
}
|
||||
if (addEdit) {
|
||||
veReal.addVascEntryLink(vefs);
|
||||
}
|
||||
} else if ("listoptions".equals(vascType)) {
|
||||
VascEntryListOptionLocal vef = (VascEntryListOptionLocal)object;
|
||||
if (removeReal) {
|
||||
VascEntryListOption vefReal = veReal.getVascEntryListOptionById(vef.getId());
|
||||
veReal.removeVascEntryListOption((VascEntryListOptionLocal)vefReal);
|
||||
}
|
||||
if (addEdit) {
|
||||
veReal.addVascEntryListOption(vef);
|
||||
}
|
||||
}
|
||||
return object;
|
||||
}
|
||||
|
||||
|
||||
public VascEntryFieldValue provideVascEntryFieldValue() {
|
||||
return new BeanVascEntryFieldValue();
|
||||
}
|
||||
|
||||
public VascEntryRecordCreator provideVascEntryRecordCreator() {
|
||||
if ("entry".equals(vascType)) {
|
||||
return new BeanVascEntryRecordCreator(DefaultVascEntry.class);
|
||||
} else if ("field".equals(vascType)) {
|
||||
return new BeanVascEntryRecordCreator(DefaultVascEntryField.class);
|
||||
} else if ("fieldset".equals(vascType)) {
|
||||
return new BeanVascEntryRecordCreator(DefaultVascEntryFieldSet.class);
|
||||
} else if ("linkentries".equals(vascType)) {
|
||||
return new BeanVascEntryRecordCreator(DefaultVascEntryLink.class);
|
||||
} else if ("listoptions".equals(vascType)) {
|
||||
return new BeanVascEntryRecordCreator(DefaultVascEntryField.class);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the vascController
|
||||
*/
|
||||
public VascController getVascController() {
|
||||
return vascController;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param vascController the vascController to set
|
||||
*/
|
||||
public void setVascController(VascController vascController) {
|
||||
this.vascController = vascController;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the vascType
|
||||
*/
|
||||
public String getVascType() {
|
||||
return vascType;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param vascType the vascType to set
|
||||
*/
|
||||
public void setVascType(String vascType) {
|
||||
this.vascType = vascType;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
/**
|
||||
*
|
||||
*/
|
||||
/**
|
||||
* @author willemc
|
||||
*
|
||||
*/
|
||||
package net.forwardfire.vasc.opt.editor;
|
||||
|
|
@ -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-editor.eld</eld-resource>
|
||||
</language>
|
||||
</modules>
|
||||
|
|
@ -0,0 +1,27 @@
|
|||
<?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 Editor"
|
||||
id="vasc-opt-editor"
|
||||
>
|
||||
<description>Provides Vasc entry editing entries.</description>
|
||||
<namespace uri="http://vasc.forwardfire.net/xml/ns/vasc-opt-editor"
|
||||
schemaUri="http://vasc.forwardfire.net/xml/ns/vasc-opt-editor-1.0.xsd"
|
||||
schemaResource="vasc-opt-editor-1.0.xsd"
|
||||
schemaPrefix="oe"
|
||||
name="Vasc Opt Editor"
|
||||
id="ns-vasc-opt-oe"
|
||||
>
|
||||
<description>Provides vasc entie editing support.</description>
|
||||
|
||||
<element tag="virtualVascBackend" objectClass="net.forwardfire.vasc.opt.editor.VirtualVascBackend">
|
||||
<configurator id="virtualVascBackend-VascBackendElementConfigurator" bean.class="net.forwardfire.vasc.impl.x4o.VascBackendElementConfigurator" configAction="true"/>
|
||||
<elementParent tag="root" uri="http://vasc.forwardfire.net/xml/ns/vasc-root"/>
|
||||
</element>
|
||||
|
||||
</namespace>
|
||||
</root:module>
|
||||
|
|
@ -0,0 +1,147 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<tree:root
|
||||
xmlns:tree="http://vasc.forwardfire.net/xml/ns/vasc-root"
|
||||
xmlns:v="http://vasc.forwardfire.net/xml/ns/vasc-lang"
|
||||
xmlns:oe="http://vasc.forwardfire.net/xml/ns/vasc-opt-editor"
|
||||
>
|
||||
<oe:virtualVascBackend id="VascEntryBackend" vascController="${vascController}" vascType="entry"/>
|
||||
<v:entry id="VascEntry" backendId="VascEntryBackend">
|
||||
<v:field id="id"/>
|
||||
<v:field id="backendId" list="false"/>
|
||||
<v:field id="name" list="false"/>
|
||||
<v:field id="helpId" list="false"/>
|
||||
<v:field id="image" list="false"/>
|
||||
|
||||
<v:field id="listDescription" list="false"/>
|
||||
<v:field id="listImage" list="false"/>
|
||||
<v:field id="editDescription" list="false"/>
|
||||
<v:field id="editImage" list="false"/>
|
||||
<v:field id="deleteDescription" list="false"/>
|
||||
<v:field id="deleteImage" list="false"/>
|
||||
<v:field id="createDescription" list="false"/>
|
||||
<v:field id="createImage" list="false"/>
|
||||
|
||||
<v:field id="primaryKeyFieldId" list="false"/>
|
||||
<v:field id="displayNameFieldId" list="false"/>
|
||||
|
||||
<v:field id="vascDisplayOnly" list="false" vascEntryFieldType="BooleanField"/>
|
||||
<v:field id="vascAdminList" list="false" vascEntryFieldType="BooleanField"/>
|
||||
<v:field id="vascAdminEdit" list="false" vascEntryFieldType="BooleanField"/>
|
||||
<v:field id="vascAdminCreate" list="false" vascEntryFieldType="BooleanField"/>
|
||||
<v:field id="vascAdminDelete" list="false" vascEntryFieldType="BooleanField"/>
|
||||
|
||||
<v:link id="VascEntryField" vascEntryId="VascEntryFieldLink">
|
||||
<v:linkCreateFieldValue valueFieldId="vascEntry"/>
|
||||
<v:linkParameter name="entry_id" valueFieldId="id"/>
|
||||
</v:link>
|
||||
<v:link id="VascEntryFieldSet" vascEntryId="VascEntryFieldSetLink">
|
||||
<v:linkParameter name="entry_id" valueFieldId="id"/>
|
||||
</v:link>
|
||||
<v:link id="VascLinkEntry" vascEntryId="VascLinkEntryLink">
|
||||
<v:linkCreateFieldValue valueFieldId="vascEntry"/>
|
||||
<v:linkParameter name="entry_id" valueFieldId="id"/>
|
||||
</v:link>
|
||||
<v:link id="VascListOption" vascEntryId="VascListOptionLink">
|
||||
<v:linkCreateFieldValue valueFieldId="vascEntry"/>
|
||||
<v:linkParameter name="entry_id" valueFieldId="id"/>
|
||||
</v:link>
|
||||
</v:entry>
|
||||
|
||||
<oe:virtualVascBackend id="VascEntryFieldLinkBackend" vascController="${vascController}" vascType="field" />
|
||||
<v:entry id="VascEntryFieldLink" backendId="VascEntryFieldLinkBackend">
|
||||
<v:field id="id"/>
|
||||
<v:field id="backendName" list="false"/>
|
||||
<v:field id="displayName" list="false"/>
|
||||
|
||||
<v:field id="vascEntryFieldType" list="false" editReadOnly="true"/>
|
||||
<v:field id="vascEntryFieldValue" list="false" editReadOnly="true"/>
|
||||
|
||||
<v:field id="name"/>
|
||||
<v:field id="description" list="false"/>
|
||||
<v:field id="helpId" list="false"/>
|
||||
<v:field id="image" list="false"/>
|
||||
<v:field id="order" vascEntryFieldType="IntegerField"/>
|
||||
<v:field id="defaultValue"/>
|
||||
|
||||
<v:field id="sizeList" list="false" vascEntryFieldType="IntegerField"/>
|
||||
<v:field id="sizeEdit" list="false" vascEntryFieldType="IntegerField"/>
|
||||
<v:field id="styleList" list="false"/>
|
||||
<v:field id="styleEdit" list="false"/>
|
||||
|
||||
<v:field id="choices" list="false"/>
|
||||
<v:field id="choicesAsRadio" list="false" vascEntryFieldType="BooleanField"/>
|
||||
|
||||
<v:field id="view" list="false" vascEntryFieldType="BooleanField"/>
|
||||
<v:field id="optional" list="false" vascEntryFieldType="BooleanField"/>
|
||||
<v:field id="create" list="false" vascEntryFieldType="BooleanField"/>
|
||||
<v:field id="edit" list="false" vascEntryFieldType="BooleanField"/>
|
||||
<v:field id="editReadOnly" list="false" vascEntryFieldType="BooleanField"/>
|
||||
<v:field id="editBlank" list="false" vascEntryFieldType="BooleanField"/>
|
||||
<v:field id="list" list="false" vascEntryFieldType="BooleanField"/>
|
||||
|
||||
<v:field id="rolesCreate" list="false"/>
|
||||
<v:field id="rolesEdit" list="false"/>
|
||||
<v:field id="rolesEditReadOnly" list="false"/>
|
||||
<v:field id="rolesList" list="false"/>
|
||||
|
||||
<v:field id="sortable" list="false" vascEntryFieldType="BooleanField"/>
|
||||
<v:field id="sumable" list="false" vascEntryFieldType="BooleanField"/>
|
||||
<v:field id="graphable" list="false" vascEntryFieldType="BooleanField"/>
|
||||
|
||||
<!-- private List<VascValidator> vascValidators = null; -->
|
||||
</v:entry>
|
||||
|
||||
|
||||
<oe:virtualVascBackend id="VascEntryFieldSetLinkBackend" vascController="${vascController}" vascType="fieldset" />
|
||||
<v:entry id="VascEntryFieldSetLink" backendId="VascEntryFieldSetLinkBackend">
|
||||
<v:field id="id"/>
|
||||
<v:field id="name"/>
|
||||
<v:field id="description" list="false"/>
|
||||
|
||||
<v:field id="helpId" list="false"/>
|
||||
<v:field id="image" list="false"/>
|
||||
|
||||
<v:field id="styleList" list="false"/>
|
||||
<v:field id="styleEdit" list="false"/>
|
||||
<v:field id="collapsed" list="false" vascEntryFieldType="BooleanField"/>
|
||||
<v:field id="optional" list="false" vascEntryFieldType="BooleanField"/>
|
||||
|
||||
<!-- private List<String> vascEntryFieldIds = null; -->
|
||||
</v:entry>
|
||||
|
||||
<oe:virtualVascBackend id="VascLinkEntryLinkBackend" vascController="${vascController}" vascType="linkentries" />
|
||||
<v:entry id="VascLinkEntryLink" backendId="VascLinkEntryLinkBackend">
|
||||
<v:field id="id"/>
|
||||
<v:field id="vascEntryId"/>
|
||||
<v:field id="vascEntryLinkType" list="false" vascEntryFieldType="ListField">
|
||||
<v:vascSelectItemModelEnum enumClass="net.forwardfire.vasc.core.VascEntryLinkType"/>
|
||||
</v:field>
|
||||
|
||||
<v:field id="doActionId" list="false"/>
|
||||
<v:field id="name" list="false"/>
|
||||
|
||||
<!--
|
||||
private Map<String,String> entryParameterFieldIds = new HashMap<String,String>(3);
|
||||
private Map<String,String> entryCreateFieldValues = new HashMap<String,String>(3);
|
||||
-->
|
||||
</v:entry>
|
||||
|
||||
|
||||
<oe:virtualVascBackend id="VascListOptionLinkBackend" vascController="${vascController}" vascType="listoptions" />
|
||||
<v:entry id="VascListOptionLink" backendId="VascListOptionLinkBackend">
|
||||
<v:field id="id"/>
|
||||
<v:field id="name"/>
|
||||
<v:field id="description" list="false"/>
|
||||
|
||||
<v:field id="helpId" list="false"/>
|
||||
<v:field id="image" list="false"/>
|
||||
|
||||
<v:field id="styleList" list="false"/>
|
||||
<v:field id="styleEdit" list="false"/>
|
||||
<v:field id="collapsed" list="false" vascEntryFieldType="BooleanField"/>
|
||||
<v:field id="optional" list="false" vascEntryFieldType="BooleanField"/>
|
||||
|
||||
<!-- private List<String> vascEntryFieldIds = null; -->
|
||||
</v:entry>
|
||||
|
||||
</tree:root>
|
||||
23
vasc-opt/vasc-opt-metamodel/.project
Normal file
23
vasc-opt/vasc-opt-metamodel/.project
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>vasc-opt-metamodel</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.m2e.core.maven2Builder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||
<nature>org.eclipse.m2e.core.maven2Nature</nature>
|
||||
</natures>
|
||||
</projectDescription>
|
||||
23
vasc-opt/vasc-opt-metamodel/pom.xml
Normal file
23
vasc-opt/vasc-opt-metamodel/pom.xml
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>net.forwardfire.vasc.opt</groupId>
|
||||
<artifactId>vasc-opt</artifactId>
|
||||
<version>0.4.2-SNAPSHOT</version>
|
||||
</parent>
|
||||
<artifactId>vasc-opt-metamodel</artifactId>
|
||||
<name>vasc-opt-metamodel</name>
|
||||
<description>vasc-opt-metamodel</description>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>net.forwardfire.vasc</groupId>
|
||||
<artifactId>vasc-core</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.forwardfire.vasc.backend</groupId>
|
||||
<artifactId>vasc-backend-metamodel</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
|
|
@ -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