2
0
Fork 0

basic slit in multi module project

This commit is contained in:
willem.cazander 2010-09-19 22:02:18 +02:00
parent f79378dacb
commit d6d77072d9
198 changed files with 25404 additions and 0 deletions

10
vasc-core/.classpath Normal file
View file

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" output="target/classes" path="src/main/java"/>
<classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources"/>
<classpathentry kind="src" output="target/test-classes" path="src/test/java"/>
<classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
<classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER"/>
<classpathentry kind="output" path="target/classes"/>
</classpath>

23
vasc-core/.project Normal file
View file

@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>vasc-core</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.maven.ide.eclipse.maven2Builder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.maven.ide.eclipse.maven2Nature</nature>
</natures>
</projectDescription>

View file

@ -0,0 +1,6 @@
#Mon Aug 30 22:00:13 CEST 2010
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
org.eclipse.jdt.core.compiler.compliance=1.5
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
org.eclipse.jdt.core.compiler.source=1.5

View file

@ -0,0 +1,9 @@
#Mon Aug 30 22:00:12 CEST 2010
activeProfiles=
eclipse.preferences.version=1
fullBuildGoals=process-test-resources
includeModules=false
resolveWorkspaceProjects=true
resourceFilterGoals=process-resources resources\:testResources
skipCompilerPlugin=true
version=1

35
vasc-core/pom.xml Normal file
View file

@ -0,0 +1,35 @@
<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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<artifactId>vasc-base</artifactId>
<groupId>com.idcanet.vasc</groupId>
<version>0.3-SNAPSHOT</version>
</parent>
<groupId>com.idcanet.vasc</groupId>
<artifactId>vasc-core</artifactId>
<version>0.3-SNAPSHOT</version>
<dependencies>
<dependency>
<groupId>com.idcanet.x4o</groupId>
<artifactId>x4o-core</artifactId>
<version>${x4o-core.version}</version>
</dependency>
<dependency>
<groupId>com.idcanet.xtes</groupId>
<artifactId>xtes-xpql</artifactId>
<version>${xtes-xpql.version}</version>
</dependency>
<dependency>
<groupId>javax.persistence</groupId>
<artifactId>persistence-api</artifactId>
<version>1.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-validator</artifactId>
<version>3.1.0.CR1</version>
<scope>provided</scope>
</dependency>
</dependencies>
</project>

View file

@ -0,0 +1,134 @@
/*
* Copyright 2004-2007 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. 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 IDCA 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 IDCA 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.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.core;
import java.util.Map;
/**
*
* @author Willem Cazander
* @version 1.0 Aug 2, 2007
*/
abstract public class AbstractVascBackend implements VascBackend {
private String id = null;
/**
* @see com.idcanet.vasc.core.VascBackend#getId()
*/
public String getId() {
return id;
}
/**
* @see com.idcanet.vasc.core.VascBackend#setId(java.lang.String)
*/
public void setId(String id) {
if (id==null) {
throw new IllegalArgumentException("id may not be null");
}
this.id=id;
}
/**
* @see com.idcanet.vasc.core.VascBackend#isPageable()
*/
public boolean isPageable() {
return false;
}
/**
* @see com.idcanet.vasc.core.VascBackend#fetchTotalExecuteSize(VascBackendState state)
*/
public long fetchTotalExecuteSize(VascBackendState state) {
return 0;
}
/**
* @see com.idcanet.vasc.core.VascBackend#isSearchable()
*/
public boolean isSearchable() {
return false;
}
/**
* @see com.idcanet.vasc.core.VascBackend#isSortable()
*/
public boolean isSortable() {
return false;
}
/**
* @see com.idcanet.vasc.core.VascBackend#isRecordMoveable()
*/
public boolean isRecordMoveable() {
return false;
}
/**
* @see com.idcanet.vasc.core.VascBackend#doRecordMoveDownById(java.lang.Object)
*/
public long doRecordMoveDownById(VascBackendState state,Object primaryId) throws VascException {
return 0l;
}
/**
* @see com.idcanet.vasc.core.VascBackend#doRecordMoveUpById(java.lang.Object)
*/
public long doRecordMoveUpById(VascBackendState state,Object primaryId) throws VascException {
return 0l;
}
/**
* @see com.idcanet.vasc.core.VascBackend#executePageSummary()
*/
public Map<String, Object> executePageSummary() {
return null;
}
/**
* @see com.idcanet.vasc.core.VascBackend#executeTotalSummary()
*/
public Map<String, Object> executeTotalSummary() {
return null;
}
/**
* @see com.idcanet.vasc.core.VascBackend#isPageSummary()
*/
public boolean isPageSummary() {
return false;
}
/**
* @see com.idcanet.vasc.core.VascBackend#isTotalSummary()
*/
public boolean isTotalSummary() {
return false;
}
}

View file

@ -0,0 +1,184 @@
/*
* Copyright 2004-2007 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. 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 IDCA 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 IDCA 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.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.core;
import java.util.List;
import java.util.Map;
import com.idcanet.vasc.core.entry.VascEntryFieldValue;
import com.idcanet.vasc.core.entry.VascEntryRecordCreator;
/**
*
* @author Willem Cazander
* @version 1.0 Apr 1, 2009
*/
abstract public class AbstractVascBackendProxy implements VascBackend {
protected VascBackend backend = null;
public AbstractVascBackendProxy(VascBackend backend) {
if (backend==null) {
throw new NullPointerException("backend object mey not be null.");
}
this.backend=backend;
}
/**
* @see com.idcanet.vasc.core.VascBackend#fetchTotalExecuteSize(VascBackendState state)
*/
public long fetchTotalExecuteSize(VascBackendState state) {
return backend.fetchTotalExecuteSize(state);
}
/**
* @see com.idcanet.vasc.core.VascBackend#isSortable()
*/
public boolean isSortable() {
return backend.isSortable();
}
/**
* @throws Exception
* @see com.idcanet.vasc.core.VascBackend#execute(VascBackendState state)
*/
public List<Object> execute(VascBackendState state) throws VascException {
return backend.execute(state);
}
/**
* @see com.idcanet.vasc.core.VascBackend#delete(java.lang.Object)
*/
public void delete(Object object) throws VascException {
backend.delete(object);
}
/**
* @see com.idcanet.vasc.core.VascBackend#isPageable()
*/
public boolean isPageable() {
return backend.isPageable();
}
/**
* @see com.idcanet.vasc.core.VascBackend#isSearchable()
*/
public boolean isSearchable() {
return backend.isSearchable();
}
/**
* @see com.idcanet.vasc.core.VascBackend#merge(java.lang.Object)
*/
public Object merge(Object object) throws VascException {
return backend.merge(object);
}
/**
* @see com.idcanet.vasc.core.VascBackend#persist(java.lang.Object)
*/
public void persist(Object object) throws VascException {
backend.persist(object);
}
/**
* @see com.idcanet.vasc.core.VascBackend#provideVascEntryFieldValue(com.idcanet.vasc.core.VascEntryField)
*/
public VascEntryFieldValue provideVascEntryFieldValue(VascEntryField field) {
return backend.provideVascEntryFieldValue(field);
}
/**
* @see com.idcanet.vasc.core.VascBackend#provideVascEntryRecordCreator(com.idcanet.vasc.core.VascEntry)
*/
public VascEntryRecordCreator provideVascEntryRecordCreator(VascEntry vascEntry) {
return backend.provideVascEntryRecordCreator(vascEntry);
}
/**
* @see com.idcanet.vasc.core.VascBackend#getId()
*/
public String getId() {
return backend.getId();
}
/**
* @see com.idcanet.vasc.core.VascBackend#setId(java.lang.String)
*/
public void setId(String id) {
backend.setId(id);
}
/**
* @see com.idcanet.vasc.core.VascBackend#doRecordMoveDownById(VascBackendState state,java.lang.Object)
*/
public long doRecordMoveDownById(VascBackendState state,Object primaryId) throws VascException {
return backend.doRecordMoveDownById(state,primaryId);
}
/**
* @see com.idcanet.vasc.core.VascBackend#doRecordMoveUpById(VascBackendState state,java.lang.Object)
*/
public long doRecordMoveUpById(VascBackendState state,Object primaryId) throws VascException {
return backend.doRecordMoveUpById(state,primaryId);
}
/**
* @see com.idcanet.vasc.core.VascBackend#isRecordMoveable()
*/
public boolean isRecordMoveable() {
return backend.isRecordMoveable();
}
/**
* @see com.idcanet.vasc.core.VascBackend#executePageSummary()
*/
public Map<String, Object> executePageSummary() {
return backend.executePageSummary();
}
/**
* @see com.idcanet.vasc.core.VascBackend#executeTotalSummary()
*/
public Map<String, Object> executeTotalSummary() {
return backend.executeTotalSummary();
}
/**
* @see com.idcanet.vasc.core.VascBackend#isPageSummary()
*/
public boolean isPageSummary() {
return backend.isPageSummary();
}
/**
* @see com.idcanet.vasc.core.VascBackend#isTotalSummary()
*/
public boolean isTotalSummary() {
return backend.isTotalSummary();
}
}

View file

@ -0,0 +1,149 @@
/*
* Copyright 2004-2007 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. 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 IDCA 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 IDCA 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.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.core;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;
/**
*
* @author Willem Cazander
* @version 1.0 May 26, 2009
*/
abstract public class AbstractVascBackendState implements VascBackendState {
private static final long serialVersionUID = 1L;
protected Map<String,Object> parameters = null;
private int pageIndex = 0;
private int pageSize = 0;
private int pageSizeMax = 0;
private String sortField = null;
private String searchString = null;
private boolean ascending = true;
//private long pagesTotalRecords = 0;
public AbstractVascBackendState() {
parameters = new HashMap<String,Object>(10);
}
public void setDataParameter(String key,Object data) {
parameters.put(key,data);
}
public Object getDataParameter(String key) {
return parameters.get(key);
}
public Set<String> getDataParameterKeys() {
return parameters.keySet();
}
/**
* @see com.idcanet.vasc.core.VascBackend#getPageIndex()
*/
public int getPageIndex() {
return pageIndex;
}
/**
* @see com.idcanet.vasc.core.VascBackend#setPageIndex(int)
*/
public void setPageIndex(int pageIndex) {
this.pageIndex=pageIndex;
}
/**
* @see com.idcanet.vasc.core.VascBackend#getPageSize()
*/
public int getPageSize() {
return pageSize;
}
/**
* @see com.idcanet.vasc.core.VascBackend#setPageSize(int)
*/
public void setPageSize(int pageSize) {
this.pageSize=pageSize;
}
/**
* @see com.idcanet.vasc.core.VascBackend#getSearchString()
*/
public String getSearchString() {
return searchString;
}
/**
* @see com.idcanet.vasc.core.VascBackend#setSearchString(java.lang.String)
*/
public void setSearchString(String searchString) {
this.searchString=searchString;
}
/**
* @see com.idcanet.vasc.core.VascBackend#isSortAscending()
*/
public boolean isSortAscending() {
return ascending;
}
/**
* @see com.idcanet.vasc.core.VascBackend#setSortAscending(boolean)
*/
public void setSortAscending(boolean ascending) {
this.ascending=ascending;
}
/**
* @see com.idcanet.vasc.core.VascBackend#getSortField()
*/
public String getSortField() {
return sortField;
}
/**
* @see com.idcanet.vasc.core.VascBackend#setSortField(java.lang.String)
*/
public void setSortField(String sortField) {
this.sortField=sortField;
}
/**
* @return the pageSizeMax
*/
public int getPageSizeMax() {
return pageSizeMax;
}
/**
* @param pageSizeMax the pageSizeMax to set
*/
public void setPageSizeMax(int pageSizeMax) {
this.pageSizeMax = pageSizeMax;
}
}

View file

@ -0,0 +1,217 @@
/*
* Copyright 2004-2007 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. 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 IDCA 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 IDCA 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.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.core;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import com.idcanet.vasc.core.ui.VascUIComponent;
import com.idcanet.vasc.core.ui.VascValueModel;
import com.idcanet.vasc.validators.VascValidator;
/**
*
* @author Willem Cazander
* @version 1.0 Aug 2, 2007
*/
abstract public class AbstractVascEntryFieldType implements VascEntryFieldType {
private static final long serialVersionUID = 1L;
protected String id = null;
protected Class<?> autoDetectClass = null;
protected List<VascValidator> vascValidators = null;
protected Map<String,String> properties = null;
protected Object dataObject = null;
protected String uiComponentId = null;
protected String inputMask = null;
public AbstractVascEntryFieldType() {
vascValidators = new ArrayList<VascValidator>(4);
properties = new HashMap<String,String>();
}
/**
* @see java.lang.Object#clone()
*/
@Override
abstract public VascEntryFieldType clone() throws CloneNotSupportedException;
/**
* @see com.idcanet.vasc.core.VascEntryFieldType#getId()
*/
public String getId() {
return id;
}
/**
* @see com.idcanet.vasc.core.VascEntryFieldType#setId(java.lang.String)
*/
public void setId(String id) {
this.id=id;
}
/**
* @see com.idcanet.vasc.core.VascEntryFieldType#getProperty(java.lang.String)
*/
public String getProperty(String name) {
return properties.get(name);
}
/**
* @see com.idcanet.vasc.core.VascEntryFieldType#setProperty(java.lang.String, java.lang.String)
*/
public void setProperty(String name, String value) {
properties.put(name, value);
}
/**
* @see com.idcanet.vasc.core.VascEntryFieldType#getPropertyNames()
*/
public List<String> getPropertyNames() {
return new ArrayList<String>(properties.keySet());
}
/**
* @return the dataObject
*/
public Object getDataObject() {
return dataObject;
}
/**
* @param dataObject the dataObject to set
*/
public void setDataObject(Object dataObject) {
this.dataObject = dataObject;
}
/**
* @see com.idcanet.vasc.core.VascEntryFieldType#getVascValidators()
*/
public List<VascValidator> getVascValidators() {
return vascValidators;
}
/**
* @see com.idcanet.vasc.core.VascEntryFieldType#addVascValidator(com.idcanet.vasc.validators.VascValidator)
*/
public void addVascValidator(VascValidator vascValidator) {
vascValidators.add(vascValidator);
}
/**
* @see com.idcanet.vasc.core.VascEntryFieldType#removeVascValidator(com.idcanet.vasc.validators.VascValidator)
*/
public void removeVascValidator(VascValidator vascValidator) {
vascValidators.remove(vascValidator);
}
/**
* @see com.idcanet.vasc.core.VascEntryFieldType#getAutoDetectClass()
*/
public Class<?> getAutoDetectClass() {
return autoDetectClass;
}
/**
* @see com.idcanet.vasc.core.VascEntryFieldType#setAutoDetectClass(java.lang.Class)
*/
public void setAutoDetectClass(Class<?> autoDetectClass) {
this.autoDetectClass=autoDetectClass;
}
/**
* @see com.idcanet.vasc.core.VascEntryFieldType#getInputMask()
*/
public String getInputMask() {
return inputMask;
}
/**
* @see com.idcanet.vasc.core.VascEntryFieldType#setInputMask(java.lang.String)
*/
public void setInputMask(String inputMask) {
this.inputMask=inputMask;
}
/**
* @see com.idcanet.vasc.core.VascEntryFieldType#getUIComponentId()
*/
public String getUIComponentId() {
return uiComponentId;
}
/**
* @see com.idcanet.vasc.core.VascEntryFieldType#setUIComponentId(java.lang.String)
*/
public void setUIComponentId(String uiComponentId) {
this.uiComponentId=uiComponentId;
}
/**
* @see com.idcanet.vasc.core.VascEntryFieldType#getUIComponentCount()
*/
public int getUIComponentCount(VascEntryField entryField) throws VascException {
return 1;
}
/**
* @see com.idcanet.vasc.core.VascEntryFieldType#provideEditorUIComponent(int)
*/
public VascUIComponent provideEditorUIComponent(int index,VascEntryField entryField) throws VascException {
ClassLoader cl = Thread.currentThread().getContextClassLoader();
if (cl == null) {
cl = entryField.getClass().getClassLoader(); // fallback
}
String compId = getUIComponentId();
if (compId==null) {
compId = VascUIComponent.VASC_TEXT;
}
return entryField.getVascEntry().getVascFrontendData().getVascUIComponent(compId);
}
/**
* @see com.idcanet.vasc.core.VascEntryFieldType#provideLabelUIComponent(int)
*/
public VascUIComponent provideLabelUIComponent(int index,VascEntryField entryField) throws VascException {
return entryField.getVascEntry().getVascFrontendData().getVascUIComponent(VascUIComponent.VASC_LABEL);
}
/**
* @see com.idcanet.vasc.core.VascEntryFieldType#provideEditorVascValueModel()
*/
public VascValueModel provideEditorVascValueModel(int index,VascEntryField entryField) throws VascException {
if (index>0) {
throw new IllegalArgumentException("You have to override provideEditorVascValueModel if multi editor support is needed");
}
VascValueModel model = new VascValueModel();
return model;
}
}

View file

@ -0,0 +1,142 @@
/**
*
*/
package com.idcanet.vasc.core;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* Holds all default state values
*
* @author Willem Cazander
* @version 1.0 Dec 15, 2009
*/
abstract public class AbstractVascEntryState implements VascEntryState {
private static final long serialVersionUID = 1L;
private List<Object> entryDataList = null;
private Object entryDataObject = null;
private Long totalBackendRecords = null;
private VascBackendState vascBackendState = null;
private VascEntryState state = null;
private Map<Integer,Boolean> multiActionSelection = null;
private boolean isEditCreate = false;
private VascBackend vascBackend = null;
private VascEntry vascEntry = null;
public AbstractVascEntryState() {
entryDataList = new ArrayList<Object>(0);
multiActionSelection = new HashMap<Integer,Boolean>(200);
}
/**
* @return the entryDataList
*/
public List<Object> getEntryDataList() {
return entryDataList;
}
/**
* @param entryDataList the entryDataList to set
*/
public void setEntryDataList(List<Object> entryDataList) {
this.entryDataList = entryDataList;
}
/**
* @return the entryDataObject
*/
public Object getEntryDataObject() {
return entryDataObject;
}
/**
* @param entryDataObject the entryDataObject to set
*/
public void setEntryDataObject(Object entryDataObject) {
this.entryDataObject = entryDataObject;
}
/**
* @return the vascBackendState
*/
public VascBackendState getVascBackendState() {
return vascBackendState;
}
/**
* @param vascBackendState the vascBackendState to set
*/
public void setVascBackendState(VascBackendState vascBackendState) {
this.vascBackendState = vascBackendState;
}
/**
* @return the totalBackendRecords
*/
public Long getTotalBackendRecords() {
return totalBackendRecords;
}
/**
* @param totalBackendRecords the totalBackendRecords to set
*/
public void setTotalBackendRecords(Long totalBackendRecords) {
this.totalBackendRecords = totalBackendRecords;
}
public void setParent(VascEntryState state) {
this.state=state;
}
public VascEntryState getParent() {
return state;
}
public void setMultiActionSelection(Map<Integer,Boolean> multiActionSelection) {
this.multiActionSelection=multiActionSelection;
}
public Map<Integer,Boolean> getMultiActionSelection() {
return multiActionSelection;
}
/**
* @return the vascBackend
*/
public VascBackend getVascBackend() {
return vascBackend;
}
/**
* @param vascBackend the vascBackend to set
*/
public void setVascBackend(VascBackend vascBackend) {
this.vascBackend = vascBackend;
}
/**
* @return the isEditCreate
*/
public boolean isEditCreate() {
return isEditCreate;
}
/**
* @param isEditCreate the isEditCreate to set
*/
public void setEditCreate(boolean isEditCreate) {
this.isEditCreate = isEditCreate;
}
public void setVascEntry(VascEntry vascEntry) {
this.vascEntry=vascEntry;
}
public VascEntry getVascEntry() {
return vascEntry;
}
}

View file

@ -0,0 +1,82 @@
/*
* Copyright 2004-2007 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. 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 IDCA 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 IDCA 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.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.core;
/**
*
* @author Willem Cazander
* @version 1.0 Aug 2, 2007
*/
abstract public class AbstractVascFrontend implements VascFrontend {
private String id = null;
protected VascEntry entry = null;
protected String i18n(String key,Object...params) {
return entry.getVascFrontendData().getVascEntryResourceResolver().getTextValue(key,params);
}
protected Object i18nImage(String key) {
return entry.getVascFrontendData().getVascEntryResourceImageResolver().getImageValue(entry,key);
}
public VascEntry getVascEntry() {
return entry;
}
abstract protected void addUiComponents();
/**
* @see com.idcanet.vasc.core.VascFrontend#initEntry(com.idcanet.vasc.core.VascEntry)
*/
public void initEntry(VascEntry entry) throws Exception {
if (entry.getVascFrontendData().getVascFrontend()==null) {
entry.getVascFrontendData().setVascFrontend(this);
} else {
if (entry.getVascFrontendData().getVascFrontend()!=this) {
throw new IllegalArgumentException("VascEntry has already a differtent VascFrontend attected");
}
}
this.entry=entry;
addUiComponents();
}
/**
* @see com.idcanet.vasc.core.VascFrontend#getId()
*/
public String getId() {
return id;
}
/**
* @see com.idcanet.vasc.core.VascFrontend#setId(java.lang.String)
*/
public void setId(String id) {
this.id=id;
}
}

View file

@ -0,0 +1,114 @@
/*
* Copyright 2004-2007 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. 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 IDCA 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 IDCA 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.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.core;
import java.util.List;
import java.util.Map;
import com.idcanet.vasc.core.entry.VascEntryFieldValue;
import com.idcanet.vasc.core.entry.VascEntryRecordCreator;
/**
*
* @author Willem Cazander
* @version 1.0 Mar 21, 2007
*/
public interface VascBackend {
public String getId();
public void setId(String id);
public List<Object> execute(VascBackendState state) throws VascException;
public void persist(Object object) throws VascException;
public Object merge(Object object) throws VascException;
public void delete(Object object) throws VascException;
/**
* Creates a new Field acces obj the the given field entry.
* note: Do not use inline class here because it needs to be seriabable and the backend is not seriabbzle.
* @param field
* @return
*/
public VascEntryFieldValue provideVascEntryFieldValue(VascEntryField field);
/**
* Creates a new RecordCreater obj the the given entry.
* note: Do not use inline class here because it needs to be seriabable and the backend is not seriabbzle.
* @param vascEntry
* @return
*/
public VascEntryRecordCreator provideVascEntryRecordCreator(VascEntry vascEntry);
/**
* Defines if the backend supports sorting
* @return
*/
public boolean isSortable();
/**
* Defines if the backend supports pageing
* @return
*/
public boolean isPageable();
/**
* Returns the total amount of records.
* @return
*/
public long fetchTotalExecuteSize(VascBackendState state);
/**
* Defines if the backend supports pageing
* @return
*/
public boolean isSearchable();
/**
* Defines if the backend supports moveing an record up or down.
* @return
*/
public boolean isRecordMoveable();
public long doRecordMoveUpById(VascBackendState state,Object primaryId) throws VascException;
public long doRecordMoveDownById(VascBackendState state,Object primaryId) throws VascException;
public boolean isPageSummary();
public Map<String,Object> executePageSummary();
public boolean isTotalSummary();
public Map<String,Object> executeTotalSummary();
/*
public boolean hasSettings();
public Map<String,String> getSettings();
public void putSetting(String key,String value);
*/
}

View file

@ -0,0 +1,38 @@
/*
* Copyright 2004-2007 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. 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 IDCA 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 IDCA 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.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.core;
/**
*
* @author Willem Cazander
* @version 1.0 Sep 4, 2008
*/
public interface VascBackendController {
public VascBackend getVascBackendById(String id);
}

View file

@ -0,0 +1,38 @@
/*
* Copyright 2004-2007 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. 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 IDCA 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 IDCA 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.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.core;
/**
*
* @author Willem Cazander
* @version 1.0 Nov 17, 2008
*/
public interface VascBackendControllerLocal extends VascBackendController {
public void addVascBackend(VascBackend backend);
}

View file

@ -0,0 +1,54 @@
/*
* Copyright 2004-2007 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. 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 IDCA 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 IDCA 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.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.core;
/**
* Can filter the data
*
* @author Willem Cazander
* @version 1.0 Apr 28, 2009
*/
public interface VascBackendFilter {
/**
* Inits the filter
*/
public void initFilter(VascEntry entry);
/**
* Only filters 1 object.
*/
public Object filterObject(Object object);
/**
* Force impl to have public clone methode
* @return
* @throws CloneNotSupportedException
*/
public VascBackendFilter clone() throws CloneNotSupportedException;
}

View file

@ -0,0 +1,48 @@
/*
* Copyright 2004-2007 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. 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 IDCA 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 IDCA 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.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.core;
import java.io.Serializable;
/**
* Small class to wrap page number and the selected page number.
* note: this can be removed when JSF has the combined EL.
*
* @author Willem Cazander
* @version 1.0 Apr 25, 2006
*/
public class VascBackendPageNumber implements Serializable {
private static final long serialVersionUID = 1L;
private Integer pageNumber = null;
private Boolean selected = false;
public VascBackendPageNumber(Integer pageNumber) { this.pageNumber=pageNumber; }
public Integer getPageNumber() { return pageNumber; }
public Boolean getSelected() { return selected; }
public Boolean getNotSelected() { return !selected; }
public void setSelected(Boolean selected) { this.selected=selected; }
}

View file

@ -0,0 +1,60 @@
/*
* Copyright 2004-2007 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. 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 IDCA 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 IDCA 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.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.core;
import java.io.Serializable;
import java.util.Set;
/**
* Holds all the data the backend needs to know to execute its work.
*
* @author Willem Cazander
* @version 1.0 May 26, 2009
*/
public interface VascBackendState extends Serializable {
public void setDataParameter(String key,Object data);
public Object getDataParameter(String key);
public Set<String> getDataParameterKeys();
public String getSortField();
public void setSortField(String name);
public boolean isSortAscending();
public void setSortAscending(boolean ascending);
public void setPageSize(int size);
public int getPageSize();
public void setPageSizeMax(int size);
public int getPageSizeMax();
public void setPageIndex(int index);
public int getPageIndex();
public void setSearchString(String searchString);
public String getSearchString();
}

View file

@ -0,0 +1,67 @@
/*
* Copyright 2004-2007 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. 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 IDCA 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 IDCA 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.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.core;
/**
* Resolvs all the resolvers.
* These resolved often point to an external locations.
*
* @author Willem Cazander
* @version 1.0 Sep 11, 2008
*/
public interface VascController {
/**
* @return Returns the VascBackendController
*/
public VascBackendController getVascBackendController();
/**
*
* @return Returns the VascEntryController
*/
public VascEntryController getVascEntryController();
/**
*
* @return Returns the VascEntryFieldController
*/
public VascEntryFieldTypeController getVascEntryFieldTypeController();
/**
*
* @return Returns the VascEventChannelController
*/
public VascEventChannelController getVascEventChannelController();
/**
*
* @return Returns the VascUserRoleController
*/
public VascUserRoleController getVascUserRoleController();
}

View file

@ -0,0 +1,420 @@
/*
* Copyright 2004-2007 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. 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 IDCA 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 IDCA 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.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.core;
import java.io.Serializable;
import java.util.List;
import com.idcanet.vasc.core.actions.ColumnVascAction;
import com.idcanet.vasc.core.actions.GlobalVascAction;
import com.idcanet.vasc.core.actions.RowVascAction;
import com.idcanet.vasc.core.entry.VascEntryBackendEventListener;
import com.idcanet.vasc.core.entry.VascEntryFieldEventChannel;
import com.idcanet.vasc.core.entry.VascEntryFrontendEventListener;
/**
* The main vasc entry
*
*
* @author Willem Cazander
* @version 1.0 Mar 21, 2007
*/
public interface VascEntry extends Cloneable,Serializable {
/**
* @return the id
*/
public String getId();
/**
* @param id the id to set
*/
public void setId(String id);
/**
* @return the name
*/
public String getName();
/**
* @param name the name to set
*/
public void setName(String name);
/**
* @return the helpId
*/
public String getHelpId();
/**
* @param helpId the helpId to set
*/
public void setHelpId(String helpId);
/**
* @return the image
*/
public String getImage();
/**
* @param image the image to set
*/
public void setImage(String image);
/**
* @return the listDescription
*/
public String getListDescription();
/**
* @param listDescription the listDescription to set
*/
public void setListDescription(String listDescription);
/**
* @return the listImage
*/
public String getListImage();
/**
* @param listImage the listImage to set
*/
public void setListImage(String listImage);
/**
* @return the editDescription
*/
public String getEditDescription();
/**
* @param editDescription the editDescription to set
*/
public void setEditDescription(String editDescription);
/**
* @return the editImage
*/
public String getEditImage();
/**
* @param editImage the editImage to set
*/
public void setEditImage(String editImage);
/**
* @return the deleteDescription
*/
public String getDeleteDescription();
/**
* @param deleteDescription the deleteDescription to set
*/
public void setDeleteDescription(String deleteDescription);
/**
* @return the deleteImage
*/
public String getDeleteImage();
/**
* @param deleteImage the deleteImage to set
*/
public void setDeleteImage(String deleteImage);
/**
* @return the createDescription
*/
public String getCreateDescription();
/**
* @param createDescription the createDescription to set
*/
public void setCreateDescription(String createDescription);
/**
* @return the createImage
*/
public String getCreateImage();
/**
* @param createImage the createImage to set
*/
public void setCreateImage(String createImage);
/**
* @return the primaryKeyField
*/
public String getPrimaryKeyFieldId();
/**
* @param primaryKeyField the primaryKeyField to set
*/
public void setPrimaryKeyFieldId(String primaryKeyField);
/**
* @return the displayNameField
*/
public String getDisplayNameFieldId();
/**
* @param displayNameField the displayNameField to set
*/
public void setDisplayNameFieldId(String displayNameField);
/**
* @return the vascAdminList
*/
public boolean isVascAdminList();
/**
* @param vascAdminList the vascAdminList to set
*/
public void setVascAdminList(boolean vascAdminList);
/**
* @return the vascAdminEdit
*/
public boolean isVascAdminEdit();
/**
* @param vascAdminEdit the vascAdminEdit to set
*/
public void setVascAdminEdit(boolean vascAdminEdit);
/**
* @return the vascAdminCreate
*/
public boolean isVascAdminCreate();
/**
* @param vascAdminCreate the vascAdminCreate to set
*/
public void setVascAdminCreate(boolean vascAdminCreate);
/**
* @return the vascAdminDelete
*/
public boolean isVascAdminDelete();
/**
* @param vascAdminDelete the vascAdminDelete to set
*/
public void setVascAdminDelete(boolean vascAdminDelete);
/**
* @return the vascFields
*/
public List<VascEntryField> getVascEntryFields();
/**
* @param vascField the vascField to add
*/
public void addVascEntryField(VascEntryField vascField);
/**
* @param vascField the vascField to remove
*/
public void removeVascEntryField(VascEntryField vascField);
/**
* @return the vascField
*/
public VascEntryField getVascEntryFieldById(String id);
/**
* @return the rowActions
*/
public List<RowVascAction> getRowActions();
/**
* @return the RowVascAction
*/
public RowVascAction getRowActionById(String actionId);
/**
* @param rowAction the rowAction to add
*/
public void addRowAction(RowVascAction rowAction);
/**
* @param rowAction the rowAction to remove
*/
public void removeRowAction(RowVascAction rowAction);
/**
* @return the columnActions
*/
public List<ColumnVascAction> getColumnActions();
/**
* @return the ColumnVascAction
*/
public ColumnVascAction getColumnActionById(String actionId);
/**
* @param columnAction the columnAction to add
*/
public void addColumnAction(ColumnVascAction columnAction);
/**
* @param columnAction the columnAction to remove
*/
public void removeColumnAction(ColumnVascAction columnAction);
/**
* @return the globalActions
*/
public List<GlobalVascAction> getGlobalActions();
/**
* @return the GlobalVascAction
*/
public GlobalVascAction getGlobalActionById(String actionId);
/**
* @param globalAction the globalAction to add
*/
public void addGlobalAction(GlobalVascAction globalAction);
/**
* @param globalAction the globalAction to remove
*/
public void removeGlobalAction(GlobalVascAction globalAction);
/**
* @return the vascEntryFieldSets
*/
public List<VascEntryFieldSet> getVascEntryFieldSets();
/**
* @return the VascEntryFieldSet
*/
public VascEntryFieldSet getVascEntryFieldSetById(String actionId);
/**
* @param vascEntryFieldSet the vascEntryFieldSet to add
*/
public void addVascEntryFieldSet(VascEntryFieldSet vascEntryFieldSet);
/**
* @param vascEntryFieldSet the vascEntryFieldSet to remove
*/
public void removeVascEntryFieldSet(VascEntryFieldSet vascEntryFieldSet);
/**
* @return the vascLinkEntries
*/
public List<VascLinkEntry> getVascLinkEntries();
/**
* @return the VascLinkEntry
*/
public VascLinkEntry getVascLinkEntryById(String actionId);
/**
* @param vascLinkEntry the vascLinkEntry to add
*/
public void addVascLinkEntry(VascLinkEntry vascLinkEntry);
/**
* @param vascLinkEntry the vascLinkEntry to remover
*/
public void removeVascLinkEntry(VascLinkEntry vascLinkEntry);
public Object getEntryParameter(String key);
public void setEntryParameter(String key,Object value);
public List<String> getEntryParameterKeys();
public VascFrontendData getVascFrontendData();
public void setVascFrontendData(VascFrontendData vascFrontendData);
public String getBackendId();
public void setBackendId(String backendId);
/**
* @return the vascDisplayOnly
*/
public boolean isVascDisplayOnly();
/**
* @param vascDisplayOnly the vascDisplayOnly to set
*/
public void setVascDisplayOnly(boolean vascDisplayOnly);
/**
* @return the vascEntryFieldEventChannel
*/
public VascEntryFieldEventChannel getVascEntryFieldEventChannel();
/**
* @param vascEntryFieldEventChannel the vascEntryFieldEventChannel to set
*/
public void setVascEntryFieldEventChannel(VascEntryFieldEventChannel vascEntryFieldEventChannel);
/**
* Added an VascEntryBackendEventListener
* @param listener The class of the event listener.
*/
public void addVascEntryBackendEventListener(Class<VascEntryBackendEventListener> listener);
/**
* Returns the list of VascEntryBackendEventListener
* @return
*/
public List<Class<VascEntryBackendEventListener>> getVascEntryBackendEventListeners();
/**
* Added an VascEntryFrontendEventListener
* @param listener The class of the event listener.
*/
public void addVascEntryFrontendEventListener(Class<VascEntryFrontendEventListener> listener);
/**
* Returns the list of VascEntryFrontendEventListener
* @return
*/
public List<Class<VascEntryFrontendEventListener>> getVascEntryFrontendEventListeners();
public void addListOption(VascEntryField listOption);
public List<VascEntryField> getListOptions();
public void addVascBackendFilter(VascBackendFilter filter);
public List<VascBackendFilter> getVascBackendFilters();
/**
* Force impl to have public clone methode
* @return
* @throws CloneNotSupportedException
*/
public VascEntry clone() throws CloneNotSupportedException;
}

View file

@ -0,0 +1,44 @@
/*
* Copyright 2004-2007 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. 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 IDCA 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 IDCA 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.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.core;
import java.util.List;
/**
*
* @author Willem Cazander
* @version 1.0 Sep 4, 2008
*/
public interface VascEntryController {
public VascEntry getVascEntryById(String id);
public List<String> getVascEntryIds();
public List<String> getVascEntryAdminIds();
}

View file

@ -0,0 +1,40 @@
/*
* Copyright 2004-2007 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. 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 IDCA 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 IDCA 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.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.core;
/**
* The local interface which is not used in controllers.
* But is needed to be able to add entry in a safe way.
*
* @author Willem Cazander
* @version 1.0 Nov 16, 2008
*/
public interface VascEntryControllerLocal extends VascEntryController {
public void addVascEntry(VascEntry entry,VascController vascController) throws VascException;
}

View file

@ -0,0 +1,387 @@
/*
* Copyright 2004-2007 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. 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 IDCA 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 IDCA 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.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.core;
import java.io.Serializable;
import java.util.List;
import com.idcanet.vasc.core.entry.VascEntryFieldValue;
import com.idcanet.vasc.validators.VascValidator;
/**
* Defines an VascEntryField
*
*
*
* @author Willem Cazander
* @version 1.0 Mar 21, 2007
*/
public interface VascEntryField extends Cloneable,Serializable {
/**
* @return the VascEntry
*/
public VascEntry getVascEntry();
/**
* @param entry the VascEntry to set
*/
public void setVascEntry(VascEntry entry);
/**
* @return the id
*/
public String getId();
/**
* @param id the id to set
*/
public void setId(String id);
/**
* @return the vascEntryFieldType
*/
public VascEntryFieldType getVascEntryFieldType();
/**
* @param vascEntryFieldType the vascEntryFieldType to set
*/
public void setVascEntryFieldType(VascEntryFieldType vascEntryFieldType);
/**
* @return the backendName
*/
public String getBackendName();
/**
* @param backendName the backendName to set
*/
public void setBackendName(String backendName);
/**
* @return the vascEntryFieldValue
*/
public VascEntryFieldValue getVascEntryFieldValue();
/**
* @param vascEntryFieldValue the vascEntryFieldValue to set
*/
public void setVascEntryFieldValue(VascEntryFieldValue vascEntryFieldValue);
/**
* @return the vascValidators
*/
public List<VascValidator> getVascValidators();
/**
* @param vascValidator the vascValidator to add
*/
public void addVascValidator(VascValidator vascValidator);
/**
* @param vascValidator the vascValidator to remove
*/
public void removeVascValidator(VascValidator vascValidator);
/**
* @return the name
*/
public String getName();
/**
* @param name the name to set
*/
public void setName(String name);
/**
* @return the description
*/
public String getDescription();
/**
* @param description the description to set
*/
public void setDescription(String description);
/**
* @return the helpId
*/
public String getHelpId();
/**
* @param helpId the helpId to set
*/
public void setHelpId(String helpId);
/**
* @return the image
*/
public String getImage();
/**
* @param image the image to set
*/
public void setImage(String image);
/**
* @return the defaultValue
*/
public Object getDefaultValue();
/**
* @param defaultValue the defaultValue to set
*/
public void setDefaultValue(Object defaultValue);
/**
* @return the sizeList
*/
public Integer getSizeList();
/**
* @param sizeList the sizeList to set
*/
public void setSizeList(Integer sizeList);
/**
* @return the sizeEdit
*/
public Integer getSizeEdit();
/**
* @param sizeEdit the sizeEdit to set
*/
public void setSizeEdit(Integer sizeEdit);
/**
* @return the styleList
*/
public String getStyleList();
/**
* @param styleList the styleList to set
*/
public void setStyleList(String styleList);
/**
* @return the styleEdit
*/
public String getStyleEdit();
/**
* @param styleEdit the styleEdit to set
*/
public void setStyleEdit(String styleEdit);
/**
* @return the choices
*/
public String getChoices();
/**
* @param choices the choices to set
*/
public void setChoices(String choices);
/**
* @return the view
*/
public Boolean getView();
/**
* @param view the view to set
*/
public void setView(Boolean view);
/**
* @return the optional
*/
public Boolean getOptional();
/**
* @param optional the optional to set
*/
public void setOptional(Boolean optional);
/**
* @return the create
*/
public Boolean getCreate();
/**
* @param create the create to set
*/
public void setCreate(Boolean create);
/**
* @return the edit
*/
public Boolean getEdit();
/**
* @param edit the edit to set
*/
public void setEdit(Boolean edit);
/**
* @return the editReadOnly
*/
public Boolean getEditReadOnly();
/**
* @param editReadOnly the editReadOnly to set
*/
public void setEditReadOnly(Boolean editReadOnly);
/**
* @return the list
*/
public Boolean getList();
/**
* @param list the list to set
*/
public void setList(Boolean list);
/**
* @return the rolesCreate
*/
public String getRolesCreate();
/**
* @param rolesCreate the rolesCreate to set
*/
public void setRolesCreate(String rolesCreate);
/**
* @return the rolesEdit
*/
public String getRolesEdit();
/**
* @param rolesEdit the rolesEdit to set
*/
public void setRolesEdit(String rolesEdit);
/**
* @return the rolesEditReadOnly
*/
public String getRolesEditReadOnly();
/**
* @param rolesEditReadOnly the rolesEditReadOnly to set
*/
public void setRolesEditReadOnly(String rolesEditReadOnly);
/**
* @return the rolesList
*/
public String getRolesList();
/**
* @param rolesList the rolesList to set
*/
public void setRolesList(String rolesList);
/**
* @return the choicesAsRadio
*/
public Boolean getChoicesAsRadio();
/**
* @param choicesAsRadio the choicesAsRadio to set
*/
public void setChoicesAsRadio(Boolean choicesAsRadio);
/**
* @return the editBlank
*/
public Boolean getEditBlank();
/**
* @param editBlank the editBlank to set
*/
public void setEditBlank(Boolean editBlank);
/**
* @return the displayName
*/
public String getDisplayName();
/**
* @param displayName the displayName to set
*/
public void setDisplayName(String displayName);
/**
* @return the orderIndex
*/
public Integer getOrderIndex();
/**
* @param orderIndex the orderIndex to set
*/
public void setOrderIndex(Integer orderIndex);
/**
* @return the sortable
*/
public Boolean getSortable();
/**
* @param sortable the sortable to set
*/
public void setSortable(Boolean sortable);
/**
* @return the sumable
*/
public Boolean getSumable();
/**
* @param sumable the sumable to set
*/
public void setSumable(Boolean sumable);
/**
* @return the graphable
*/
public Boolean getGraphable();
/**
* @param graphable the graphable to set
*/
public void setGraphable(Boolean graphable);
/**
* Force impl to have public clone methode
* @return
* @throws CloneNotSupportedException
*/
public VascEntryField clone() throws CloneNotSupportedException;
}

View file

@ -0,0 +1,154 @@
/*
* Copyright 2004-2007 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. 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 IDCA 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 IDCA 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.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.core;
import java.util.List;
/**
* Orgenisess Fields
*
*
*
* @author Willem Cazander
* @version 1.0 Sep 56, 2008
*/
public interface VascEntryFieldSet extends Cloneable {
/**
* @return the id
*/
public String getId();
/**
* @param id the id to set
*/
public void setId(String id);
/**
* @return the name
*/
public String getName();
/**
* @param name the name to set
*/
public void setName(String name);
/**
* @return the description
*/
public String getDescription();
/**
* @param description the description to set
*/
public void setDescription(String description);
/**
* @return the helpId
*/
public String getHelpId();
/**
* @param helpId the helpId to set
*/
public void setHelpId(String helpId);
/**
* @return the image
*/
public String getImage();
/**
* @param image the image to set
*/
public void setImage(String image);
/**
* @return the styleList
*/
public String getStyleList();
/**
* @param styleList the styleList to set
*/
public void setStyleList(String styleList);
/**
* @return the styleEdit
*/
public String getStyleEdit();
/**
* @param styleEdit the styleEdit to set
*/
public void setStyleEdit(String styleEdit);
/**
* @return the collapsed
*/
public boolean isCollapsed();
/**
* @param collapsed the collapsed to set
*/
public void setCollapsed(boolean collapsed);
/**
* @return the optional
*/
public boolean isOptional();
/**
* @param optional the optional to set
*/
public void setOptional(boolean optional);
/**
* @return the vascEntryFieldIds
*/
public List<String> getVascEntryFieldIds();
/**
* Add and VascEntryFieldId
* @param vascEntryFieldIds the vascEntryFieldIds to add
*/
public void addVascEntryFieldId(String vascEntryFieldId);
/**
* Removes and VascEntryFieldId
* @param vascEntryFieldIds the vascEntryFieldIds to remove
*/
public void removeVascEntryFieldId(String vascEntryFieldId);
/**
* Force impl to have public clone methode
* @return
* @throws CloneNotSupportedException
*/
public VascEntryFieldSet clone() throws CloneNotSupportedException;
}

View file

@ -0,0 +1,78 @@
/*
* Copyright 2004-2007 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. 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 IDCA 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 IDCA 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.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.core;
import java.io.Serializable;
import java.util.List;
import com.idcanet.vasc.core.ui.VascUIComponent;
import com.idcanet.vasc.core.ui.VascValueModel;
import com.idcanet.vasc.validators.VascValidator;
/**
*
* @author Willem Cazander
* @version 1.0 Mar 21, 2007
*/
public interface VascEntryFieldType extends Serializable {
public String getId();
public void setId(String id);
public String getUIComponentId();
public void setUIComponentId(String uiComponentId);
public String getInputMask();
public void setInputMask(String inputMask);
public Class<?> getAutoDetectClass();
public void setAutoDetectClass(Class<?> classObject);
public void addVascValidator(VascValidator vascValidator);
public void removeVascValidator(VascValidator vascValidator);
public List<VascValidator> getVascValidators();
public void setProperty(String name,String value);
public String getProperty(String name);
public List<String> getPropertyNames();
public void setDataObject(Object data);
public Object getDataObject();
public int getUIComponentCount(VascEntryField entryField) throws VascException;
public VascUIComponent provideLabelUIComponent(int index,VascEntryField entryField) throws VascException;
public VascUIComponent provideEditorUIComponent(int index,VascEntryField entryField) throws VascException;
public VascValueModel provideEditorVascValueModel(int index,VascEntryField entryField) throws VascException;
/**
* Force impl to have public clone methode
* @return
* @throws CloneNotSupportedException
*/
public VascEntryFieldType clone() throws CloneNotSupportedException;
}

View file

@ -0,0 +1,42 @@
/*
* Copyright 2004-2007 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. 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 IDCA 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 IDCA 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.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.core;
import java.util.List;
/**
*
* @author Willem Cazander
* @version 1.0 Sep 4, 2008
*/
public interface VascEntryFieldTypeController {
public VascEntryFieldType getVascEntryFieldTypeById(String id);
public List<String> getVascEntryFieldTypeIds();
}

View file

@ -0,0 +1,38 @@
/*
* Copyright 2004-2007 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. 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 IDCA 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 IDCA 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.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.core;
/**
*
* @author Willem Cazander
* @version 1.0 Dec 19, 2008
*/
public interface VascEntryFieldTypeControllerLocal extends VascEntryFieldTypeController {
public void addVascEntryFieldType(VascEntryFieldType vascEntryFieldType);
}

View file

@ -0,0 +1,38 @@
/*
* Copyright 2004-2007 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. 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 IDCA 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 IDCA 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.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.core;
/**
*
* @author Willem Cazander
* @version 1.0 Sep 9, 2008
*/
public interface VascEntryFinalizer {
public VascEntry finalizeVascEntry(VascEntry entry,VascController vascController) throws VascException;
}

View file

@ -0,0 +1,117 @@
/*
* Copyright 2004-2007 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. 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 IDCA 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 IDCA 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.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.core;
import java.io.Serializable;
import java.util.List;
import java.util.Map;
/**
* Holds all the data for state.
* So we can jump forward or back to a state.
*
* @author Willem Cazander
* @version 1.0 Dec 15, 2009
*/
public interface VascEntryState extends Serializable {
/**
* @return the entryDataList
*/
public List<Object> getEntryDataList();
/**
* @param entryDataList the entryDataList to set
*/
public void setEntryDataList(List<Object> entryDataList);
/**
* @return the entryDataObject
*/
public Object getEntryDataObject();
/**
* @param entryDataObject the entryDataObject to set
*/
public void setEntryDataObject(Object entryDataObject);
/**
* @return the vascBackendState
*/
public VascBackendState getVascBackendState();
/**
* @param vascBackendState the vascBackendState to set
*/
public void setVascBackendState(VascBackendState vascBackendState);
/**
* @return the totalBackendRecords
*/
public Long getTotalBackendRecords();
/**
* @param totalBackendRecords the totalBackendRecords to set
*/
public void setTotalBackendRecords(Long totalBackendRecords);
/**
* @param state The previous state we come from.
*/
public void setParent(VascEntryState state);
/**
* @return The previous state we come from.
*/
public VascEntryState getParent();
public void setMultiActionSelection(Map<Integer,Boolean> multiActionSelection);
public Map<Integer,Boolean> getMultiActionSelection();
public void setVascEntry(VascEntry vascEntry);
public VascEntry getVascEntry();
/**
* @return the vascBackend
*/
public VascBackend getVascBackend();
/**
* @param vascBackend the vascBackend to set
*/
public void setVascBackend(VascBackend vascBackend);
/**
* @return the isEditCreate
*/
public boolean isEditCreate();
/**
* @param isEditCreate the isEditCreate to set
*/
public void setEditCreate(boolean isEditCreate);
}

View file

@ -0,0 +1,38 @@
/*
* Copyright 2004-2007 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. 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 IDCA 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 IDCA 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.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.core;
/**
*
* @author Willem Cazander
* @version 1.0 Oct 27, 2008
*/
public interface VascEventChannelController {
public void publishEntryEvent(String entryId);
}

View file

@ -0,0 +1,38 @@
/*
* Copyright 2004-2007 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. 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 IDCA 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 IDCA 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.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.core;
/**
*
* @author Willem Cazander
* @version 1.0 Dec 19, 2008
*/
public interface VascEventChannelControllerLocal extends VascEventChannelController {
}

View file

@ -0,0 +1,50 @@
/*
* Copyright 2004-2007 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. 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 IDCA 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 IDCA 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.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.core;
/**
*
* @author Willem Cazander
* @version 1.0 Sep 18, 2008
*/
@SuppressWarnings("serial")
public class VascException extends Exception {
public VascException() {
}
public VascException(String message) {
super(message);
}
public VascException(Exception e) {
super(e);
}
}

View file

@ -0,0 +1,52 @@
/*
* Copyright 2004-2007 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. 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 IDCA 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 IDCA 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.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.core;
import com.idcanet.vasc.core.entry.VascEntryExporter;
/**
*
* @author Willem Cazander
* @version 1.0 Mar 21, 2007
*/
public interface VascFrontend {
public void setId(String name);
public String getId();
public void initEntry(VascEntry entry) throws Exception;
public void renderView() throws Exception;
public void renderEdit() throws Exception;
public void renderDelete() throws Exception;
public void renderExport(VascEntryExporter exporter) throws Exception;
}

View file

@ -0,0 +1,109 @@
/*
* Copyright 2004-2007 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. 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 IDCA 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 IDCA 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.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.core;
import java.util.List;
import com.idcanet.vasc.core.entry.VascEntryFieldValidatorService;
import com.idcanet.vasc.core.entry.VascEntryFrontendEventListener;
import com.idcanet.vasc.core.entry.VascEntryResourceImageResolver;
import com.idcanet.vasc.core.entry.VascEntryResourceResolver;
import com.idcanet.vasc.core.ui.VascUIComponent;
/**
*
* @author Willem Cazander
* @version 1.0 Mar 21, 2007
*/
public interface VascFrontendData {
/**
* @return the vascFrontend
*/
public VascFrontend getVascFrontend();
/**
* @param vascFrontend the vascFrontend to set
*/
public void setVascFrontend(VascFrontend vascFrontend);
/**
* @return the VascFrontendHelper
*/
public VascFrontendHelper getVascFrontendHelper();
/**
* @param vascFrontendHelper The VascFrontendHelper to set.
*/
public void setVascFrontendHelper(VascFrontendHelper vascFrontendHelper);
/**
* @return the vascEntryResourceResolver
*/
public VascEntryResourceResolver getVascEntryResourceResolver();
/**
* @param vascEntryResourceResolver the vascEntryResourceResolver to set
*/
public void setVascEntryResourceResolver(VascEntryResourceResolver vascEntryResourceResolver);
public void putVascUIComponent(String rendererId,String uiComponentClass);
public VascUIComponent getVascUIComponent(String rendererId) throws VascException;
public String getVascUIComponentClass(String rendererId);
public void setVascController(VascController vascController);
public VascController getVascController();
public void addFieldVascUIComponents(VascEntryField field,VascUIComponent uiComponent,Object editor);
public VascUIComponent getFieldVascUIComponent(VascEntryField field);
public Object getFieldRealRenderer(VascEntryField field);
public void clearFieldRenderObjects();
/**
* @return the vascEntryResourceImageResolver
*/
public VascEntryResourceImageResolver getVascEntryResourceImageResolver();
/**
* @param vascEntryResourceImageResolver the vascEntryResourceImageResolver to set
*/
public void setVascEntryResourceImageResolver(VascEntryResourceImageResolver vascEntryResourceImageResolver);
public void addVascValidatorService(VascEntryFieldValidatorService validatorService);
public List<VascEntryFieldValidatorService> getVascValidatorServices();
public VascEntryState getVascEntryState();
public void setVascEntryState(VascEntryState state);
public void initFrontendListeners(VascEntry entry) throws InstantiationException, IllegalAccessException;
public void addVascEntryFrontendEventListener(VascEntryFrontendEventListener listener);
public List<VascEntryFrontendEventListener> getVascEntryFrontendEventListener(VascEntryFrontendEventListener.VascFrontendEventType type);
}

View file

@ -0,0 +1,40 @@
/*
* Copyright 2004-2007 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. 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 IDCA 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 IDCA 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.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.core;
import java.util.EventListener;
/**
*
* @author Willem Cazander
* @version 1.0 Aug 12, 2007
*/
public interface VascFrontendExceptionHandler extends EventListener {
public void handleException(Exception e,VascFrontend vascFrontend,VascEntry entry);
}

View file

@ -0,0 +1,90 @@
/*
* Copyright 2004-2007 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. 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 IDCA 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 IDCA 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.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.core;
import java.util.List;
import com.idcanet.vasc.core.actions.GlobalVascAction;
import com.idcanet.vasc.core.actions.RowVascAction;
import com.idcanet.vasc.core.entry.VascEntryFrontendEventListener.VascFrontendEventType;
/**
*
* @author Willem Cazander
* @version 1.0 Apr 28, 2007
*/
public interface VascFrontendHelper {
public boolean renderView(VascEntryField field);
public boolean renderList(VascEntryField field);
public boolean renderEdit(VascEntryField field);
public boolean renderEditReadOnly(VascEntryField field);
public boolean renderCreate(VascEntryField field);
public boolean renderGlobalVascAction(GlobalVascAction action);
public boolean renderRowVascAction(RowVascAction action);
public Integer getTotalColumnsWidth(VascEntry entry);
public List<VascLinkEntry> getVascLinkEntryByType(VascEntry entry,VascLinkEntryType type);
/**
* Returns the total amount of pages
* @return
*/
public List<VascBackendPageNumber> getVascBackendPageNumbers(VascEntry entry);
public void refreshData(VascEntry entry);
public Object createObject(VascEntry entry);
public void deleteObject(VascEntry entry);
public Object mergeObject(VascEntry entry);
public List<String> validateObjectField(VascEntryField field);
public boolean validateAndSetErrorText(VascEntry entry);
public void headerOptionsCreatedFillData(VascEntry entry);
public void editReadOnlyUIComponents(VascEntry entry);
public void handleException(VascEntry entry,Exception exception);
public void fireVascEvent(VascEntry entry,VascFrontendEventType type,Object data);
public void sortAction(VascEntry entry,VascEntryField field);
public void searchAction(VascEntry entry,String searchString);
public void pageAction(VascEntry entry,Integer page);
public void moveAction(VascEntry entry,Object object,boolean moveUp);
public List<RowVascAction> getMultiRowActions(VascEntry entry);
}

View file

@ -0,0 +1,90 @@
/*
* Copyright 2004-2007 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. 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 IDCA 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 IDCA 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.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.core;
import java.io.Serializable;
import java.util.List;
/**
*
* @author Willem Cazander
* @version 1.0 Sep 7, 2008
*/
public interface VascLinkEntry extends Cloneable,Serializable {
public String getId();
public void setId(String id);
public String getVascEntryId();
public void setVascEntryId(String vascEntryId);
public String getEntryParameterFieldId(String parameterName);
public void addEntryParameterFieldId(String parameterName,String valueFieldId);
public List<String> getEntryParameterFieldIdKeys();
public String getEntryCreateFieldValue(String valueFieldId);
public void addEntryCreateFieldValue(String valueFieldId,String selectedFieldId);
public List<String> getEntryCreateFieldValueKeys();
/**
* @return the vascLinkEntryType
*/
public VascLinkEntryType getVascLinkEntryType();
/**
* @param vascLinkEntryType the vascLinkEntryType to set
*/
public void setVascLinkEntryType(VascLinkEntryType vascLinkEntryType);
/**
* @return the doActionId
*/
public String getDoActionId();
/**
* @param doActionId the doActionId to set
*/
public void setDoActionId(String doActionId);
/**
* @return the name
*/
public String getName();
/**
* @param name the name to set
*/
public void setName(String name);
/**
* Force impl to have public clone methode
* @return
* @throws CloneNotSupportedException
*/
public VascLinkEntry clone() throws CloneNotSupportedException;
}

View file

@ -0,0 +1,44 @@
/*
* Copyright 2004-2007 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. 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 IDCA 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 IDCA 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.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.core;
import java.io.Serializable;
/**
* The type of a VascLinkEntry
*
* @author Willem Cazander
* @version 1.0 Mrt 16, 2010
*/
public enum VascLinkEntryType implements Serializable {
EDIT_INLINE,
EDIT_TAB,
LIST;
public static VascLinkEntryType DEFAULT_TYPE = VascLinkEntryType.EDIT_TAB;
}

View file

@ -0,0 +1,46 @@
/*
* Copyright 2004-2007 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. 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 IDCA 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 IDCA 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.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.core;
import java.util.List;
/**
*
* @author Willem Cazander
* @version 1.0 Nov 19, 2008
*/
public interface VascUserRoleController {
public Long getUserId();
public String getUserName();
public List<String> getUserRoles();
public boolean hasRole(String roles);
}

View file

@ -0,0 +1,135 @@
/*
* Copyright 2004-2007 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. 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 IDCA 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 IDCA 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.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.core.actions;
/**
*
* @author Willem Cazander
* @version 1.0 Mar 30, 2007
*/
abstract public class AbstractVascAction implements VascAction {
private static final long serialVersionUID = 1L;
private String id = null;
private String name = null;
private String description = null;
private String image = null;
private String helpId = null;
public AbstractVascAction() {
setId(getActionId());
}
abstract protected String getActionId();
public VascAction clone() throws CloneNotSupportedException {
VascAction action;
try {
action = this.getClass().newInstance();
} catch (Exception e) {
throw new CloneNotSupportedException("Could not create action from myClass: "+e.getMessage());
}
action.setId(id);
action.setName(name);
action.setDescription(description);
action.setImage(image);
action.setHelpId(helpId);
return action;
}
/**
* @see com.idcanet.vasc.core.actions.VascAction#getId()
*/
public String getId() {
return id;
}
/**
* @see com.idcanet.vasc.core.actions.VascAction#setId(java.lang.String)
*/
public void setId(String id) {
this.id=id;
}
/**
* @return the name
*/
public String getName() {
return name;
}
/**
* @param name the name to set
*/
public void setName(String name) {
this.name = name;
}
/**
* @return the description
*/
public String getDescription() {
return description;
}
/**
* @param description description toolTip to set
*/
public void setDescription(String description) {
this.description = description;
}
/**
* @return the helpId
*/
public String getHelpId() {
return helpId;
}
/**
* @param helpId the helpId to set
*/
public void setHelpId(String helpId) {
this.helpId = helpId;
}
/**
* @return the image
*/
public String getImage() {
return image;
}
/**
* @param image the image to set
*/
public void setImage(String image) {
this.image = image;
}
}

View file

@ -0,0 +1,40 @@
/*
* Copyright 2004-2007 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. 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 IDCA 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 IDCA 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.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.core.actions;
import com.idcanet.vasc.core.VascEntry;
import com.idcanet.vasc.core.VascEntryField;
/**
*
* @author Willem Cazander
* @version 1.0 Mar 21, 2007
*/
public interface ColumnVascAction extends VascAction {
public void doColumnAction(VascEntry table,VascEntryField column) throws Exception;
}

View file

@ -0,0 +1,39 @@
/*
* Copyright 2004-2007 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. 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 IDCA 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 IDCA 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.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.core.actions;
import com.idcanet.vasc.core.VascEntry;
/**
*
* @author Willem Cazander
* @version 1.0 Mar 21, 2007
*/
public interface GlobalVascAction extends VascAction {
public void doGlobalAction(VascEntry vascEntry) throws Exception;
}

View file

@ -0,0 +1,41 @@
/*
* Copyright 2004-2007 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. 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 IDCA 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 IDCA 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.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.core.actions;
import com.idcanet.vasc.core.VascEntry;
/**
*
* @author Willem Cazander
* @version 1.0 Mar 21, 2007
*/
public interface RowVascAction extends VascAction {
public boolean isMultiRowAction();
public void doRowAction(VascEntry vascEntry,Object rowObject) throws Exception;
}

View file

@ -0,0 +1,64 @@
/*
* Copyright 2004-2007 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. 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 IDCA 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 IDCA 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.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.core.actions;
import java.io.Serializable;
/**
*
* @author Willem Cazander
* @version 1.0 Mar 21, 2007
*/
public interface VascAction extends Cloneable,Serializable {
public String getId();
public void setId(String id);
public String getName();
public void setName(String name);
public String getDescription();
public void setDescription(String description);
public String getImage();
public void setImage(String image);
public String getHelpId();
public void setHelpId(String helpId);
/**
* Force impl to have public clone methode
* @return
* @throws CloneNotSupportedException
*/
public VascAction clone() throws CloneNotSupportedException;
}

View file

@ -0,0 +1,62 @@
/*
* Copyright 2004-2007 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. 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 IDCA 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 IDCA 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.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.core.entry;
import java.io.Serializable;
import com.idcanet.vasc.core.VascEntry;
/**
*
* @author Willem Cazander
* @version 1.0 Jul 05, 2010
*/
public interface VascEntryBackendEventListener extends Serializable {
public enum VascBackendEventType {
EXECUTE,
PERSIST,
MERGE,
DELETE,
PROVIDE_FIELD_VALUE,
PROVIDE_RECORD_CREATOR,
TOTAL_EXECUTE_SIZE,
MOVE_DOWN,
MOVE_UP
}
public VascBackendEventType getEventType();
/**
* Is executed when the type of event is fired.
* @param entry
* @param type
* @param data
*/
public void vascEvent(VascEntry entry,Object data);
}

View file

@ -0,0 +1,49 @@
/*
* Copyright 2004-2007 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. 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 IDCA 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 IDCA 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.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.core.entry;
import java.io.OutputStream;
import java.io.Serializable;
import com.idcanet.vasc.core.VascEntry;
import com.idcanet.vasc.core.VascException;
/**
*
* @author Willem Cazander
* @version 1.0 May 19, 2007
*/
public interface VascEntryExporter extends Serializable {
public void doExport(OutputStream out,VascEntry vascEntry) throws VascException;
public String getMineType();
public String getType();
}

View file

@ -0,0 +1,43 @@
/*
* Copyright 2004-2007 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. 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 IDCA 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 IDCA 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.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.core.entry;
import java.io.Serializable;
/**
*
* @author Willem Cazander
* @version 1.0 Sep 04, 2008
*/
public interface VascEntryFieldEventChannel extends Serializable {
public void setChannel(String channel);
public String getChannel();
}

View file

@ -0,0 +1,44 @@
/*
* Copyright 2004-2007 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. 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 IDCA 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 IDCA 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.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.core.entry;
import java.util.List;
import com.idcanet.vasc.core.VascEntryField;
import com.idcanet.vasc.core.VascException;
/**
* Executes validation on a field.
*
* @author Willem Cazander
* @version 1.0 May 13, 2009
*/
public interface VascEntryFieldValidatorService {
public List<String> validateObjectField(VascEntryField field, Object selectedRecord,Object objectValue) throws VascException;
}

View file

@ -0,0 +1,46 @@
/*
* Copyright 2004-2007 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. 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 IDCA 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 IDCA 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.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.core.entry;
import java.io.Serializable;
import com.idcanet.vasc.core.VascEntryField;
import com.idcanet.vasc.core.VascException;
/**
*
* @author Willem Cazander
* @version 1.0 Mar 21, 2007
*/
public interface VascEntryFieldValue extends Serializable {
public Object getValue(VascEntryField field,Object record) throws VascException;
public String getDisplayValue(VascEntryField field,Object record) throws VascException;
public void setValue(VascEntryField field,Object record,Object value) throws VascException;
}

View file

@ -0,0 +1,68 @@
/*
* Copyright 2004-2007 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. 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 IDCA 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 IDCA 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.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.core.entry;
import java.io.Serializable;
import com.idcanet.vasc.core.VascEntry;
/**
*
* @author Willem Cazander
* @version 1.0 Aug 02, 2007
*/
public interface VascEntryFrontendEventListener extends Serializable {
public enum VascFrontendEventType {
EXCEPTION,
DATA_CREATE,
DATA_READ,
DATA_SELECT,
DATA_PRE_UPDATE,
DATA_POST_UPDATE,
DATA_DELETE,
DATA_LIST_UPDATE,
DATA_SORT,
DATA_PAGE,
DATA_SEARCH,
OPTION_UPDATE,
}
public VascFrontendEventType[] getEventTypes();
/**
* Is executed when the type of event is fired.
* @param entry
* @param type
* @param data
*/
public void vascEvent(VascEntry entry,Object data);
}

View file

@ -0,0 +1,44 @@
/*
* Copyright 2004-2007 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. 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 IDCA 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 IDCA 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.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.core.entry;
import java.io.Serializable;
import com.idcanet.vasc.core.VascEntry;
/**
*
* @author Willem Cazander
* @version 1.0 Mar 21, 2007
*/
public interface VascEntryRecordCreator extends Serializable {
public Object newRecord(VascEntry entry) throws Exception;
public Class<?> getObjectClass();
}

View file

@ -0,0 +1,41 @@
/*
* Copyright 2004-2007 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. 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 IDCA 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 IDCA 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.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.core.entry;
import com.idcanet.vasc.core.VascEntry;
/**
*
* @author Willem Cazander
* @version 1.0 May 13, 2009
*/
public interface VascEntryResourceImageResolver {
public Object getImageValue(VascEntry entry,String key);
}

View file

@ -0,0 +1,39 @@
/*
* Copyright 2004-2007 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. 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 IDCA 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 IDCA 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.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.core.entry;
/**
*
* @author Willem Cazander
* @version 1.0 Mar 21, 2007
*/
public interface VascEntryResourceResolver {
public String getTextValue(String key,Object...params);
}

View file

@ -0,0 +1,81 @@
/*
* Copyright 2004-2007 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. 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 IDCA 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 IDCA 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.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.core.ui;
import com.idcanet.vasc.core.VascEntryField;
import com.idcanet.vasc.core.VascException;
/**
*
* @author Willem Cazander
* @version 1.0 Aug 12, 2007
*/
public class VascColumnValueModelListener implements VascValueModelListener {
private VascEntryField vascEntryField = null;
private Object bean = null;
public VascColumnValueModelListener() {
}
public VascColumnValueModelListener(VascEntryField vascEntryField,Object bean) {
setVascEntryField(vascEntryField);
setBean(bean);
}
public void valueUpdate(VascValueModel model) throws VascException {
vascEntryField.getVascEntryFieldValue().setValue(vascEntryField, bean, model.getValue());
}
/**
* @return the vascEntryField
*/
public VascEntryField getVascEntryField() {
return vascEntryField;
}
/**
* @param vascEntryField the vascEntryField to set
*/
public void setVascEntryField(VascEntryField vascEntryField) {
this.vascEntryField = vascEntryField;
}
/**
* @return the bean
*/
public Object getBean() {
return bean;
}
/**
* @param bean the bean to set
*/
public void setBean(Object bean) {
this.bean = bean;
}
}

View file

@ -0,0 +1,67 @@
/*
* Copyright 2004-2007 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. 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 IDCA 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 IDCA 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.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.core.ui;
import com.idcanet.vasc.core.VascEntryField;
import com.idcanet.vasc.core.VascException;
/**
*
* @author Willem Cazander
* @version 1.0 May 21, 2009
*/
public class VascOptionValueModelListener implements VascValueModelListener {
private VascEntryField vascEntryField = null;
public VascOptionValueModelListener() {
}
public VascOptionValueModelListener(VascEntryField vascEntryField) {
setVascEntryField(vascEntryField);
}
public void valueUpdate(VascValueModel model) throws VascException {
String key = vascEntryField.getBackendName();
Object value = model.getValue();
vascEntryField.getVascEntry().setEntryParameter(key, value);
}
/**
* @return the vascEntryField
*/
public VascEntryField getVascEntryField() {
return vascEntryField;
}
/**
* @param vascEntryField the vascEntryField to set
*/
public void setVascEntryField(VascEntryField vascEntryField) {
this.vascEntryField = vascEntryField;
}
}

View file

@ -0,0 +1,109 @@
/*
* Copyright 2004-2007 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. 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 IDCA 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 IDCA 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.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.core.ui;
/**
*
* @author Willem Cazander
* @version 1.0 Aug 12, 2007
*/
public class VascSelectItem {
private String label = null;
private Object value = null;
private String keyValue = null;
private boolean disabled = false;
public VascSelectItem() {
}
public VascSelectItem(String label,Object value) {
setLabel(label);
setValue(value);
}
public VascSelectItem(String label,Object value,String keyValue) {
setLabel(label);
setValue(value);
setKeyValue(keyValue);
}
/**
* @return the label
*/
public String getLabel() {
return label;
}
/**
* @param label the label to set
*/
public void setLabel(String label) {
this.label = label;
}
/**
* @return the value
*/
public Object getValue() {
return value;
}
/**
* @param value the value to set
*/
public void setValue(Object value) {
this.value = value;
}
/**
* @return the keyValue
*/
public String getKeyValue() {
return keyValue;
}
/**
* @param keyValue the keyValue to set
*/
public void setKeyValue(String keyValue) {
this.keyValue = keyValue;
}
/**
* @return the disabled
*/
public boolean isDisabled() {
return disabled;
}
/**
* @param disabled the disabled to set
*/
public void setDisabled(boolean disabled) {
this.disabled = disabled;
}
}

View file

@ -0,0 +1,69 @@
/*
* Copyright 2004-2007 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. 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 IDCA 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 IDCA 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.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.core.ui;
import java.io.Serializable;
import java.util.List;
import com.idcanet.vasc.core.VascEntry;
import com.idcanet.vasc.core.VascException;
/**
*
* @author Willem Cazander
* @version 1.0 Aug 12, 2007
*/
public interface VascSelectItemModel extends Serializable {
/**
* Creates an SelectItem list.
* @param entry
* @return
* @throws VascException
*/
public List<VascSelectItem> getVascSelectItems(VascEntry entry) throws VascException;
/**
* @return the nullLabel
*/
public String getNullLabel();
/**
* @param nullLabel the nullLabel to set
*/
public void setNullLabel(String nullLabel);
/**
* @return the nullKeyValue
*/
public String getNullKeyValue();
/**
* @param nullKeyValue the nullKeyValue to set
*/
public void setNullKeyValue(String nullKeyValue);
}

View file

@ -0,0 +1,37 @@
/*
* Copyright 2004-2007 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. 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 IDCA 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 IDCA 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.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.core.ui;
/**
*
* @author Willem Cazander
* @version 1.0 Nov 19, 2008
*/
public interface VascUIActionComponent extends VascUIComponent {
}

View file

@ -0,0 +1,37 @@
/*
* Copyright 2004-2007 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. 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 IDCA 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 IDCA 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.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.core.ui;
/**
*
* @author Willem Cazander
* @version 1.0 Nov 19, 2008
*/
public interface VascUIActionComponentListener {
}

View file

@ -0,0 +1,64 @@
/*
* Copyright 2004-2007 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. 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 IDCA 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 IDCA 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.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.core.ui;
import com.idcanet.vasc.core.VascEntry;
import com.idcanet.vasc.core.VascEntryField;
import com.idcanet.vasc.core.VascException;
/**
*
* @author Willem Cazander
* @version 1.0 Aug 12, 2007
*/
public interface VascUIComponent {
// required ui components
static public final String VASC_LABEL = "VascLabel";
static public final String VASC_TEXT = "VascText";
static public final String VASC_LIST = "VascList";
static public final String VASC_BUTTON = "VascButton";
// optional ui Components
static public final String VASC_TEXTAREA = "VascTextArea";
static public final String VASC_BOOLEAN = "VascBoolean";
static public final String VASC_DATE = "VascDate";
static public final String VASC_COLOR = "VascColor";
static public final String[] requiredUIComponents = {VASC_LABEL,VASC_TEXT,VASC_LIST,VASC_BUTTON};
public Object createComponent(VascEntry entry,VascEntryField entryField,VascValueModel model,Object gui) throws VascException;
public void setErrorText(String text);
public String getErrorText();
public void setDisabled(boolean disabled);
public boolean isDisabled();
public void setRendered(boolean rendered);
public boolean isRendered();
}

View file

@ -0,0 +1,81 @@
/*
* Copyright 2004-2007 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. 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 IDCA 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 IDCA 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.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.core.ui;
import java.util.ArrayList;
import java.util.List;
import com.idcanet.vasc.core.VascException;
/**
*
* @author Willem Cazander
* @version 1.0 Aug 12, 2007
*/
public class VascValueModel {
private Object value = null;
private List<VascValueModelListener> listeners = null;
private VascValueModel parentModel = null;
public VascValueModel() {
listeners = new ArrayList<VascValueModelListener>(2);
}
public VascValueModel(VascValueModel parentModel) {
this();
this.parentModel=parentModel;
}
public Object getValue() throws VascException {
if (parentModel!=null) {
return parentModel.getValue();
}
return value;
}
public void setValue(Object value) throws VascException {
if (parentModel!=null) {
parentModel.setValue(value);
} else {
this.value = value;
}
fireListeners();
}
public void addListener(VascValueModelListener l) {
listeners.add(l);
}
public void removeListener(VascValueModelListener l) {
listeners.remove(l);
}
private void fireListeners() throws VascException {
for (VascValueModelListener l:listeners) {
l.valueUpdate(this);
}
}
}

View file

@ -0,0 +1,43 @@
/*
* Copyright 2004-2007 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. 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 IDCA 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 IDCA 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.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.core.ui;
import java.util.EventListener;
import com.idcanet.vasc.core.VascException;
/**
*
* @author Willem Cazander
* @version 1.0 Aug 12, 2007
*/
public interface VascValueModelListener extends EventListener {
public void valueUpdate(VascValueModel model) throws VascException;
}

View file

@ -0,0 +1,436 @@
/*
* Copyright 2004-2007 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. 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 IDCA 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 IDCA 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.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.impl;
import java.util.Collections;
import java.util.Comparator;
import com.idcanet.vasc.core.VascBackend;
import com.idcanet.vasc.core.VascController;
import com.idcanet.vasc.core.VascEntry;
import com.idcanet.vasc.core.VascEntryField;
import com.idcanet.vasc.core.VascEntryFieldSet;
import com.idcanet.vasc.core.VascEntryFieldType;
import com.idcanet.vasc.core.VascEntryFinalizer;
import com.idcanet.vasc.core.VascException;
import com.idcanet.vasc.core.VascLinkEntry;
import com.idcanet.vasc.core.VascLinkEntryType;
import com.idcanet.vasc.core.actions.VascAction;
/**
* Checks for minimal needed stuff
* and fills up the rest.
*
*
* @author Willem Cazander
* @version 1.0 Sep 14, 2008
*/
public class DefaultVascBackedEntryFinalizer implements VascEntryFinalizer {
/**
* @see com.idcanet.vasc.core.VascEntryFinalizer#finalizeVascEntry(com.idcanet.vasc.core.VascEntry)
*/
public VascEntry finalizeVascEntry(VascEntry entry,VascController vascController) throws VascException {
// First Check if we all have ids
String id = entry.getId();
if (id==null) {
throw new IllegalArgumentException("The VascEntry need an id.");
}
if (entry.getBackendId()==null) {
throw new IllegalArgumentException("The VascEntry need an backendId in entryId: "+id);
}
if (entry.getVascEntryFields().size()==0) {
throw new IllegalArgumentException("We need at least one VascEntryField in entryId: "+id);
}
for (VascEntryField vef:entry.getVascEntryFields()) {
if (vef.getId()==null) {
throw new IllegalArgumentException("All VascEntryField need an id in entryId: "+id);
}
}
for (VascEntryField vef:entry.getListOptions()) {
if (vef.getId()==null) {
throw new IllegalArgumentException("All listOption VascEntryField to have an id in entryId: "+id);
}
}
// Check if backendId is valid
VascBackend back = vascController.getVascBackendController().getVascBackendById( entry.getBackendId() );
if (back==null) {
throw new IllegalArgumentException("The VascEntry backendId is not found in backends: '"+entry.getBackendId()+"' in entryId: "+id);
}
// Fill up all not field i18n keys
// entry fields
if (entry.getName()==null) {
entry.setName("vasc.entry."+id+".name");
}
if (entry.getImage()==null) {
entry.setImage("vasc.entry."+id+".image");
}
if (entry.getHelpId()==null) {
entry.setHelpId("vasc.entry."+id+".helpId");
}
if (entry.getListDescription()==null) {
entry.setListDescription("vasc.entry."+id+".listDescription");
}
if (entry.getListImage()==null) {
entry.setListImage("vasc.entry."+id+".listImage");
}
if (entry.getEditDescription()==null) {
entry.setEditDescription("vasc.entry."+id+".editDescription");
}
if (entry.getEditImage()==null) {
entry.setEditImage("vasc.entry."+id+".editImage");
}
if (entry.getDeleteDescription()==null) {
entry.setDeleteDescription("vasc.entry."+id+".deleteDescription");
}
if (entry.getDeleteImage()==null) {
entry.setDeleteImage("vasc.entry."+id+".deleteImage");
}
if (entry.getCreateDescription()==null) {
entry.setCreateDescription("vasc.entry."+id+".createDescription");
}
if (entry.getCreateImage()==null) {
entry.setCreateImage("vasc.entry."+id+".createImage");
}
// boolean view helper
if (entry.isVascDisplayOnly()) {
entry.setVascAdminCreate(false);
entry.setVascAdminDelete(false);
entry.setVascAdminEdit(false);
}
// optional field sets
for (VascEntryFieldSet s:entry.getVascEntryFieldSets()) {
// check id
String sid = s.getId();
if (sid==null) {
throw new IllegalArgumentException("All VascEntryFieldSet need an id in entryId: "+id);
}
// check if refenced ids are avalible
for (String fid:s.getVascEntryFieldIds()) {
if (entry.getVascEntryFieldById(fid)==null) {
throw new IllegalArgumentException("VascEntryFieldSet "+sid+" has non excisting field id: "+fid+" in entryId: "+id);
}
}
// fill up properties
if (s.getName()==null) {
s.setName("vasc.entry."+id+"."+sid+".name");
}
if (s.getDescription()==null) {
s.setDescription("vasc.entry."+id+"."+sid+".description");
}
if (s.getImage()==null) {
s.setImage("vasc.entry."+id+"."+sid+".image");
}
if (s.getHelpId()==null) {
s.setHelpId("vasc.entry."+id+"."+sid+".helpId");
}
if (s.getStyleEdit()==null) {
s.setStyleEdit("vasc.entry."+id+"."+sid+".styleEdit");
}
if (s.getStyleList()==null) {
s.setStyleList("vasc.entry."+id+"."+sid+".styleEdit");
}
}
// Set defaults field Id for key ad display
if (entry.getPrimaryKeyFieldId()==null) {
entry.setPrimaryKeyFieldId(entry.getVascEntryFields().get(0).getId());
}
if (entry.getDisplayNameFieldId()==null) {
entry.setDisplayNameFieldId(entry.getVascEntryFields().get(0).getId());
}
// Check fields
int orderIndex = 0;
for (VascEntryField vef:entry.getVascEntryFields()) {
String vid = vef.getId();
// set manual stuff
if (vef.getBackendName()==null) {
vef.setBackendName(vid);
}
if (vef.getVascEntry()==null) {
vef.setVascEntry(entry);
}
//System.out.println("Field: "+vef.getId()+" order: "+vef.getOrderIndex()+" else: "+orderIndex);
if (vef.getOrderIndex()==null) {
vef.setOrderIndex(orderIndex);
}
orderIndex = orderIndex+100;
// fill up properties
if (vef.getName()==null) {
vef.setName("vasc.entry."+id+"."+vid+".name");
}
if (vef.getDescription()==null) {
vef.setDescription("vasc.entry."+id+"."+vid+".description");
}
if (vef.getImage()==null) {
vef.setImage("vasc.entry."+id+"."+vid+".image");
}
if (vef.getHelpId()==null) {
vef.setHelpId("vasc.entry."+id+"."+vid+".helpId");
}
if (vef.getStyleEdit()==null) {
vef.setStyleEdit("vasc.entry."+id+"."+vid+".styleEdit");
}
if (vef.getStyleList()==null) {
vef.setStyleList("vasc.entry."+id+"."+vid+".styleEdit");
}
//if (vef.getDefaultValue()==null) {
// vef.setDefaultValue("vasc.entry."+id+"."+vid+".defaultValue");
//}
if (vef.getView()==null) {
vef.setView(true);
}
if (vef.getList()==null) {
vef.setList(true);
}
if (vef.getCreate()==null) {
vef.setCreate(true);
}
if (vef.getEdit()==null) {
vef.setEdit(true);
}
if (vef.getEditReadOnly()==null) {
vef.setEditReadOnly(false);
}
if (vef.getVascEntryFieldValue()==null) {
VascBackend back2 = vascController.getVascBackendController().getVascBackendById( entry.getBackendId() );
vef.setVascEntryFieldValue(back2.provideVascEntryFieldValue(vef));
}
if (vef.getVascEntryFieldType()==null) {
Object defValue = vef.getDefaultValue();
if (defValue != null) {
for (String typeId: vascController.getVascEntryFieldTypeController().getVascEntryFieldTypeIds()) {
VascEntryFieldType type = vascController.getVascEntryFieldTypeController().getVascEntryFieldTypeById(typeId);
if (type.getAutoDetectClass()!=null) {
if (type.getAutoDetectClass().isAssignableFrom(defValue.getClass())) {
vef.setVascEntryFieldType(type);
break;
}
}
}
}
if (vef.getVascEntryFieldType()==null) {
vef.setVascEntryFieldType(vascController.getVascEntryFieldTypeController().getVascEntryFieldTypeById("TextField"));
}
//vef.setStyleList("vasc.entry."+id+"."+vid+".styleEdit");
}
//for (VascValidator vv:vef.getVascValidators()) {
//}
}
class OrderIndexComparator implements Comparator<VascEntryField> {
public int compare(VascEntryField v1, VascEntryField v2) {
return v1.getOrderIndex().compareTo(v2.getOrderIndex());
}
}
Collections.sort(entry.getVascEntryFields(),new OrderIndexComparator());
// place primary key in front
int index = 0;
for (VascEntryField vef:entry.getVascEntryFields()) {
if (entry.getPrimaryKeyFieldId().equals(vef.getId())) {
break;
}
index++;
}
if (index==entry.getVascEntryFields().size()) {
// no primarry key found selecting the first field.
index=0;
}
VascEntryField idField = entry.getVascEntryFields().remove(index);
entry.getVascEntryFields().add(0, idField);
// Check if link entries excists
for (VascLinkEntry vle:entry.getVascLinkEntries()) {
// check id
String vid = vle.getId();
if (vid==null) {
throw new IllegalArgumentException("All VascLinkEntry need an id in entryId: "+id);
}
if (vle.getVascEntryId()==null) {
throw new IllegalArgumentException("All VascLinkEntry need an vascEntryId: "+id);
}
if (vle.getVascLinkEntryType()==null) {
vle.setVascLinkEntryType(VascLinkEntryType.DEFAULT_TYPE);
}
if (vle.getName()==null) {
vle.setName("vasc.entry."+vle.getVascEntryId()+".name");
}
}
for (VascEntryField vef:entry.getListOptions()) {
String vid = vef.getId();
// set manual stuff
if (vef.getBackendName()==null) {
vef.setBackendName(vid);
}
if (vef.getVascEntry()==null) {
vef.setVascEntry(entry);
}
if (vef.getOrderIndex()==null) {
vef.setOrderIndex(orderIndex);
}
orderIndex = orderIndex+100;
// fill up properties
if (vef.getName()==null) {
vef.setName("vasc.entry."+id+"."+vid+".name");
}
if (vef.getDescription()==null) {
vef.setDescription("vasc.entry."+id+"."+vid+".description");
}
if (vef.getImage()==null) {
vef.setImage("vasc.entry."+id+"."+vid+".image");
}
if (vef.getHelpId()==null) {
vef.setHelpId("vasc.entry."+id+"."+vid+".helpId");
}
if (vef.getStyleEdit()==null) {
vef.setStyleEdit("vasc.entry."+id+"."+vid+".styleEdit");
}
if (vef.getStyleList()==null) {
vef.setStyleList("vasc.entry."+id+"."+vid+".styleEdit");
}
//if (vef.getDefaultValue()==null) {
// vef.setDefaultValue("vasc.entry."+id+"."+vid+".defaultValue");
//}
if (vef.getView()==null) {
vef.setView(true);
}
if (vef.getList()==null) {
vef.setList(true);
}
if (vef.getCreate()==null) {
vef.setCreate(true);
}
if (vef.getEdit()==null) {
vef.setEdit(true);
}
if (vef.getEditReadOnly()==null) {
vef.setEditReadOnly(false);
}
if (vef.getVascEntryFieldValue()==null) {
//VascBackend back2 = vascController.getVascBackendControllerResolver().getVascBackendController().getVascBackendById( entry.getBackendId() );
//vef.setVascEntryFieldValue(back2.provideVascEntryFieldValue(vef));
}
}
for (VascAction action:entry.getGlobalActions()) {
String aid = action.getId();
if (aid==null) {
throw new IllegalArgumentException("Action has no id: "+action+" in entryId: "+id);
}
if (action.getName()==null) {
action.setName("vasc.action."+aid+".name");
}
if (action.getDescription()==null) {
action.setDescription("vasc.action."+aid+".description");
}
if (action.getImage()==null) {
action.setImage("vasc.action."+aid+".image");
}
if (action.getHelpId()==null) {
action.setHelpId("vasc.action."+aid+".helpId");
}
}
for (VascAction action:entry.getRowActions()) {
String aid = action.getId();
if (aid==null) {
throw new IllegalArgumentException("Action has no id: "+action+" in entryId: "+id);
}
if (action.getName()==null) {
action.setName("vasc.action."+aid+".name");
}
if (action.getDescription()==null) {
action.setDescription("vasc.action."+aid+".description");
}
if (action.getImage()==null) {
action.setImage("vasc.action."+aid+".image");
}
if (action.getHelpId()==null) {
action.setHelpId("vasc.action."+aid+".helpId");
}
}
for (VascAction action:entry.getColumnActions()) {
String aid = action.getId();
if (aid==null) {
throw new IllegalArgumentException("Action has no id: "+action+" in entryId: "+id);
}
if (action.getName()==null) {
action.setName("vasc.action."+aid+".name");
}
if (action.getDescription()==null) {
action.setDescription("vasc.action."+aid+".description");
}
if (action.getImage()==null) {
action.setImage("vasc.action."+aid+".image");
}
if (action.getHelpId()==null) {
action.setHelpId("vasc.action."+aid+".helpId");
}
}
return entry;
}
}

View file

@ -0,0 +1,69 @@
/*
* Copyright 2004-2007 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. 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 IDCA 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 IDCA 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.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.impl;
import java.util.HashMap;
import java.util.Map;
import com.idcanet.vasc.core.VascBackend;
import com.idcanet.vasc.core.VascBackendControllerLocal;
/**
*
*
* @author Willem Cazander
* @version 1.0 Sep 18, 2008
*/
public class DefaultVascBackendController implements VascBackendControllerLocal {
private Map<String,VascBackend> backends = null;
public DefaultVascBackendController() {
backends = new HashMap<String,VascBackend>(7);
}
/**
* @see com.idcanet.vasc.core.VascBackendController#getVascBackendById(java.lang.String)
*/
public VascBackend getVascBackendById(String id) {
return backends.get(id);
}
/**
* Local
*/
public void addVascBackend(VascBackend backend) {
if (backend==null) {
throw new NullPointerException("backend must not be null.");
}
if (backend.getId()==null) {
throw new IllegalArgumentException("The backend must have an id.");
}
backends.put(backend.getId(), backend);
}
}

View file

@ -0,0 +1,39 @@
/*
* Copyright 2004-2007 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. 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 IDCA 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 IDCA 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.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.impl;
import com.idcanet.vasc.core.AbstractVascBackendState;
/**
*
*
* @author Willem Cazander
* @version 1.0 May 26, 2009
*/
public class DefaultVascBackendState extends AbstractVascBackendState {
private static final long serialVersionUID = 1L;
}

View file

@ -0,0 +1,119 @@
/*
* Copyright 2004-2007 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. 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 IDCA 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 IDCA 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.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.impl;
import com.idcanet.vasc.core.VascBackendController;
import com.idcanet.vasc.core.VascController;
import com.idcanet.vasc.core.VascEntryController;
import com.idcanet.vasc.core.VascEntryFieldTypeController;
import com.idcanet.vasc.core.VascEventChannelController;
import com.idcanet.vasc.core.VascUserRoleController;
/**
*
*
* @author Willem Cazander
* @version 1.0 Sep 11, 2008
*/
public class DefaultVascController implements VascController {
private VascBackendController vascBackendController = null;
private VascEntryController vascEntryController = null;
private VascEntryFieldTypeController vascEntryFieldTypeController = null;
private VascEventChannelController vascEventChannelController = null;
private VascUserRoleController vascUserRoleController = null;
/**
* @return the vascEventChannelController
*/
public VascEventChannelController getVascEventChannelController() {
return vascEventChannelController;
}
/**
* @param vascEventChannelController the vascEventChannelController to set
*/
public void setVascEventChannelController(VascEventChannelController vascEventChannelController) {
this.vascEventChannelController = vascEventChannelController;
}
/**
* @return the vascBackendController
*/
public VascBackendController getVascBackendController() {
return vascBackendController;
}
/**
* @param vascBackendController the vascBackendController to set
*/
public void setVascBackendController(VascBackendController vascBackendController) {
this.vascBackendController = vascBackendController;
}
/**
* @return the vascEntryController
*/
public VascEntryController getVascEntryController() {
return vascEntryController;
}
/**
* @param vascEntryController the vascEntryController to set
*/
public void setVascEntryController(VascEntryController vascEntryController) {
this.vascEntryController = vascEntryController;
}
/**
* @return the vascEntryFieldController
*/
public VascEntryFieldTypeController getVascEntryFieldTypeController() {
return vascEntryFieldTypeController;
}
/**
* @param vascEntryFieldController the vascEntryFieldController to set
*/
public void setVascEntryFieldTypeController(VascEntryFieldTypeController vascEntryFieldTypeController) {
this.vascEntryFieldTypeController = vascEntryFieldTypeController;
}
/**
* @return the vascUserRoleController
*/
public VascUserRoleController getVascUserRoleController() {
return vascUserRoleController;
}
/**
* @param vascUserRoleController the vascUserRoleController to set
*/
public void setVascUserRoleController(VascUserRoleController vascUserRoleController) {
this.vascUserRoleController = vascUserRoleController;
}
}

View file

@ -0,0 +1,770 @@
/*
* Copyright 2004-2007 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. 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 IDCA 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 IDCA 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.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.impl;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import com.idcanet.vasc.core.VascBackendFilter;
import com.idcanet.vasc.core.VascEntry;
import com.idcanet.vasc.core.VascEntryField;
import com.idcanet.vasc.core.VascEntryFieldSet;
import com.idcanet.vasc.core.VascFrontendData;
import com.idcanet.vasc.core.VascLinkEntry;
import com.idcanet.vasc.core.actions.ColumnVascAction;
import com.idcanet.vasc.core.actions.GlobalVascAction;
import com.idcanet.vasc.core.actions.RowVascAction;
import com.idcanet.vasc.core.actions.VascAction;
import com.idcanet.vasc.core.entry.VascEntryBackendEventListener;
import com.idcanet.vasc.core.entry.VascEntryFieldEventChannel;
import com.idcanet.vasc.core.entry.VascEntryFrontendEventListener;
/**
* VascEntry
*
* @author Willem Cazander
* @version 1.0 Mar 21, 2007
*/
public class DefaultVascEntry implements VascEntry {
private static final long serialVersionUID = 1L;
private String id = null;
private String name = null;
private String helpId = null;
private String image = null;
private String listDescription = null;
private String listImage = null;
private String editDescription = null;
private String editImage = null;
private String deleteDescription = null;
private String deleteImage = null;
private String createDescription = null;
private String createImage = null;
private String primaryKeyFieldId = null;
private String displayNameFieldId = null;
private boolean vascDisplayOnly = false;
private boolean vascAdminList = true;
private boolean vascAdminEdit = true;
private boolean vascAdminCreate = true;
private boolean vascAdminDelete = true;
private List<VascEntryField> vascFields = null;
private List<RowVascAction> rowActions = null;
private List<ColumnVascAction> columnActions = null;
private List<GlobalVascAction> globalActions = null;
private List<VascEntryFieldSet> vascEntryFieldSets = null;
private List<VascLinkEntry> vascLinkEntries = null;
private Map<String,Object> entryParameters = null;
private VascEntryFieldEventChannel vascEntryFieldEventChannel = null;
private List<Class<VascEntryFrontendEventListener>> eventEntryFrontendEventListeners = null;
private List<Class<VascEntryBackendEventListener>> eventEntryBackendEventListeners = null;
private List<VascEntryField> listOptions = null;
private List<VascBackendFilter> backendFilters = null;
private String backendId = null;
private VascFrontendData vascFrontendData = null;
/**
* Te constructor
*/
public DefaultVascEntry() {
vascFields = new ArrayList<VascEntryField>(20);
rowActions = new ArrayList<RowVascAction>(10);
columnActions = new ArrayList<ColumnVascAction>(10);
globalActions = new ArrayList<GlobalVascAction>(10);
vascEntryFieldSets = new ArrayList<VascEntryFieldSet>(10);
vascLinkEntries = new ArrayList<VascLinkEntry>(10);
entryParameters = new HashMap<String,Object>(10);
eventEntryFrontendEventListeners = new ArrayList<Class<VascEntryFrontendEventListener>>(10);
eventEntryBackendEventListeners = new ArrayList<Class<VascEntryBackendEventListener>>(10);
listOptions = new ArrayList<VascEntryField>(5);
backendFilters = new ArrayList<VascBackendFilter>(3);
}
/**
* @see java.lang.Object#clone()
*/
@Override
public VascEntry clone() throws CloneNotSupportedException {
DefaultVascEntry result = new DefaultVascEntry();
result.id=id;
result.name=name;
result.helpId=helpId;
result.image=image;
result.listDescription=listDescription;
result.listImage=listImage;
result.editDescription=editDescription;
result.editImage=editImage;
result.deleteDescription=deleteDescription;
result.deleteImage=deleteImage;
result.createDescription=createDescription;
result.createImage=createImage;
result.primaryKeyFieldId=primaryKeyFieldId;
result.displayNameFieldId=displayNameFieldId;
result.vascDisplayOnly=vascDisplayOnly;
result.vascAdminList=vascAdminList;
result.vascAdminCreate=vascAdminCreate;
result.vascAdminEdit=vascAdminEdit;
result.vascAdminDelete=vascAdminDelete;
result.backendId=backendId;
result.vascEntryFieldEventChannel=vascEntryFieldEventChannel;
result.eventEntryFrontendEventListeners.addAll(eventEntryFrontendEventListeners);
result.eventEntryBackendEventListeners.addAll(eventEntryBackendEventListeners);
// skipping 'vascFrontendData' because it should always be null when cloning happens.
for (VascEntryField f:vascFields) {
VascEntryField ff = f.clone();
ff.setVascEntry(result); // mmm remove this ?
result.vascFields.add(ff);
}
for (VascAction a:rowActions) {
result.rowActions.add((RowVascAction)a.clone());
}
for (VascAction a:columnActions) {
result.columnActions.add((ColumnVascAction)a.clone());
}
for (VascAction a:globalActions) {
result.globalActions.add((GlobalVascAction)a.clone());
}
for (VascEntryFieldSet s:vascEntryFieldSets) {
result.vascEntryFieldSets.add(s.clone());
}
for (VascLinkEntry l:vascLinkEntries) {
result.vascLinkEntries.add(l.clone());
}
for (VascEntryField listOption:listOptions) {
VascEntryField ff = listOption.clone();
ff.setVascEntry(result);
result.listOptions.add(ff);
}
for (VascBackendFilter f:backendFilters) {
VascBackendFilter ff = f.clone();
result.backendFilters.add(ff);
}
// no cloning of the values here ?
for (String key:entryParameters.keySet()) {
Object value = entryParameters.get(key);
result.setEntryParameter(key, value);
}
return result;
}
/**
* @return the id
*/
public String getId() {
return id;
}
/**
* @param id the id to set
*/
public void setId(String id) {
this.id = id;
}
/**
* @return the name
*/
public String getName() {
return name;
}
/**
* @param name the name to set
*/
public void setName(String name) {
this.name = name;
}
/**
* @return the helpId
*/
public String getHelpId() {
return helpId;
}
/**
* @param helpId the helpId to set
*/
public void setHelpId(String helpId) {
this.helpId = helpId;
}
/**
* @return the image
*/
public String getImage() {
return image;
}
/**
* @param image the image to set
*/
public void setImage(String image) {
this.image = image;
}
/**
* @return the listDescription
*/
public String getListDescription() {
return listDescription;
}
/**
* @param listDescription the listDescription to set
*/
public void setListDescription(String listDescription) {
this.listDescription = listDescription;
}
/**
* @return the listImage
*/
public String getListImage() {
return listImage;
}
/**
* @param listImage the listImage to set
*/
public void setListImage(String listImage) {
this.listImage = listImage;
}
/**
* @return the editDescription
*/
public String getEditDescription() {
return editDescription;
}
/**
* @param editDescription the editDescription to set
*/
public void setEditDescription(String editDescription) {
this.editDescription = editDescription;
}
/**
* @return the editImage
*/
public String getEditImage() {
return editImage;
}
/**
* @param editImage the editImage to set
*/
public void setEditImage(String editImage) {
this.editImage = editImage;
}
/**
* @return the deleteDescription
*/
public String getDeleteDescription() {
return deleteDescription;
}
/**
* @param deleteDescription the deleteDescription to set
*/
public void setDeleteDescription(String deleteDescription) {
this.deleteDescription = deleteDescription;
}
/**
* @return the deleteImage
*/
public String getDeleteImage() {
return deleteImage;
}
/**
* @param deleteImage the deleteImage to set
*/
public void setDeleteImage(String deleteImage) {
this.deleteImage = deleteImage;
}
/**
* @return the createDescription
*/
public String getCreateDescription() {
return createDescription;
}
/**
* @param createDescription the createDescription to set
*/
public void setCreateDescription(String createDescription) {
this.createDescription = createDescription;
}
/**
* @return the createImage
*/
public String getCreateImage() {
return createImage;
}
/**
* @param createImage the createImage to set
*/
public void setCreateImage(String createImage) {
this.createImage = createImage;
}
/**
* @return the primaryKeyFieldId
*/
public String getPrimaryKeyFieldId() {
return primaryKeyFieldId;
}
/**
* @param primaryKeyFieldId the primaryKeyFieldId to set
*/
public void setPrimaryKeyFieldId(String primaryKeyFieldId) {
this.primaryKeyFieldId = primaryKeyFieldId;
}
/**
* @return the displayNameFieldId
*/
public String getDisplayNameFieldId() {
return displayNameFieldId;
}
/**
* @param displayNameFieldId the displayNameFieldId to set
*/
public void setDisplayNameFieldId(String displayNameFieldId) {
this.displayNameFieldId = displayNameFieldId;
}
/**
* @return the vascAdminList
*/
public boolean isVascAdminList() {
return vascAdminList;
}
/**
* @param vascAdminList the vascAdminList to set
*/
public void setVascAdminList(boolean vascAdminList) {
this.vascAdminList = vascAdminList;
}
/**
* @return the vascAdminEdit
*/
public boolean isVascAdminEdit() {
return vascAdminEdit;
}
/**
* @param vascAdminEdit the vascAdminEdit to set
*/
public void setVascAdminEdit(boolean vascAdminEdit) {
this.vascAdminEdit = vascAdminEdit;
}
/**
* @return the vascAdminCreate
*/
public boolean isVascAdminCreate() {
return vascAdminCreate;
}
/**
* @param vascAdminCreate the vascAdminCreate to set
*/
public void setVascAdminCreate(boolean vascAdminCreate) {
this.vascAdminCreate = vascAdminCreate;
}
/**
* @return the vascAdminDelete
*/
public boolean isVascAdminDelete() {
return vascAdminDelete;
}
/**
* @param vascAdminDelete the vascAdminDelete to set
*/
public void setVascAdminDelete(boolean vascAdminDelete) {
this.vascAdminDelete = vascAdminDelete;
}
/**
* @return the vascFields
*/
public List<VascEntryField> getVascEntryFields() {
return vascFields;
}
/**
* @param vascField the vascFields to add
*/
public void addVascEntryField(VascEntryField vascField) {
vascFields.add(vascField);
}
/**
* @param vascField the vascFields to remove
*/
public void removeVascEntryField(VascEntryField vascField) {
vascFields.remove(vascField);
}
/**
* @see com.idcanet.vasc.core.VascEntry#getVascEntryFieldById(java.lang.String)
*/
public VascEntryField getVascEntryFieldById(String id) {
for (VascEntryField v:vascFields) {
if (v.getId().equals(id)) {
return v;
}
}
return null;
}
/**
* @return the rowActions
*/
public List<RowVascAction> getRowActions() {
return rowActions;
}
/**
* @return the RowVascAction
*/
public RowVascAction getRowActionById(String actionId) {
for (RowVascAction a:rowActions) {
if (a.getId().equals(actionId)) {
return a;
}
}
return null;
}
/**
* @param rowAction the rowAction to add
*/
public void addRowAction(RowVascAction rowAction) {
rowActions.add(rowAction);
}
/**
* @param rowAction the rowAction to remove
*/
public void removeRowAction(RowVascAction rowAction) {
rowActions.remove(rowAction);
}
/**
* @return the columnActions
*/
public List<ColumnVascAction> getColumnActions() {
return columnActions;
}
/**
* @return the ColumnVascAction
*/
public ColumnVascAction getColumnActionById(String actionId) {
for (ColumnVascAction a:columnActions) {
if (a.getId().equals(actionId)) {
return a;
}
}
return null;
}
/**
* @param columnAction the columnActions to add
*/
public void addColumnAction(ColumnVascAction columnAction) {
columnActions.add(columnAction);
}
/**
* @param columnAction the columnActions to remove
*/
public void removeColumnAction(ColumnVascAction columnAction) {
columnActions.remove(columnAction);
}
/**
* @return the globalActions
*/
public List<GlobalVascAction> getGlobalActions() {
return globalActions;
}
/**
* @return the GlobalVascAction
*/
public GlobalVascAction getGlobalActionById(String actionId) {
for (GlobalVascAction a:globalActions) {
if (a.getId().equals(actionId)) {
return a;
}
}
return null;
}
/**
* @param globalAction the globalAction to add
*/
public void addGlobalAction(GlobalVascAction globalAction) {
globalActions.add(globalAction);
}
/**
* @param globalAction the globalAction to remove
*/
public void removeGlobalAction(GlobalVascAction globalAction) {
globalActions.remove(globalAction);
}
/**
* @return the vascEntryFieldSets
*/
public List<VascEntryFieldSet> getVascEntryFieldSets() {
return vascEntryFieldSets;
}
/**
* @return the VascEntryFieldSet
*/
public VascEntryFieldSet getVascEntryFieldSetById(String fieldSetId) {
for (VascEntryFieldSet a:vascEntryFieldSets) {
if (a.getId().equals(fieldSetId)) {
return a;
}
}
return null;
}
/**
* @param vascEntryFieldSet the vascEntryFieldSet to add
*/
public void addVascEntryFieldSet(VascEntryFieldSet vascEntryFieldSet) {
vascEntryFieldSets.add(vascEntryFieldSet);
}
/**
* @param vascEntryFieldSet the vascEntryFieldSet to add
*/
public void removeVascEntryFieldSet(VascEntryFieldSet vascEntryFieldSet) {
vascEntryFieldSets.remove(vascEntryFieldSet);
}
/**
* @return the vascLinkEntries
*/
public List<VascLinkEntry> getVascLinkEntries() {
return vascLinkEntries;
}
/**
* @return the VascLinkEntry
*/
public VascLinkEntry getVascLinkEntryById(String linkId) {
for (VascLinkEntry a:vascLinkEntries) {
if (a.getId().equals(linkId)) {
return a;
}
}
return null;
}
/**
* @param vascLinkEntry the vascLinkEntry to set
*/
public void addVascLinkEntry(VascLinkEntry vascLinkEntry) {
vascLinkEntries.add(vascLinkEntry);
}
/**
* @param vascLinkEntry the vascLinkEntry to remove
*/
public void removeVascLinkEntry(VascLinkEntry vascLinkEntry) {
vascLinkEntries.remove(vascLinkEntry);
}
/**
* @see com.idcanet.vasc.core.VascEntry#getEntryParameter(java.lang.String)
*/
public Object getEntryParameter(String key) {
return entryParameters.get(key);
}
/**
* @see com.idcanet.vasc.core.VascEntry#getEntryParameterKeys()
*/
public List<String> getEntryParameterKeys() {
return new ArrayList<String>(entryParameters.keySet());
}
/**
* @see com.idcanet.vasc.core.VascEntry#setEntryParameter(java.lang.String, java.lang.Object)
*/
public void setEntryParameter(String key, Object value) {
entryParameters.put(key, value);
}
/**
* @return the vascFrontendData
*/
public VascFrontendData getVascFrontendData() {
return vascFrontendData;
}
/**
* @param vascFrontendData the vascFrontendData to set
*/
public void setVascFrontendData(VascFrontendData vascFrontendData) {
this.vascFrontendData = vascFrontendData;
}
/**
* @return the backendId
*/
public String getBackendId() {
return backendId;
}
/**
* @param backendId the backendId to set
*/
public void setBackendId(String backendId) {
this.backendId = backendId;
}
/**
* @return the vascDisplayOnly
*/
public boolean isVascDisplayOnly() {
return vascDisplayOnly;
}
/**
* @param vascDisplayOnly the vascDisplayOnly to set
*/
public void setVascDisplayOnly(boolean vascDisplayOnly) {
this.vascDisplayOnly = vascDisplayOnly;
}
/**
* @return the vascEntryFieldEventChannel
*/
public VascEntryFieldEventChannel getVascEntryFieldEventChannel() {
return vascEntryFieldEventChannel;
}
/**
* @param vascEntryFieldEventChannel the vascEntryFieldEventChannel to set
*/
public void setVascEntryFieldEventChannel(VascEntryFieldEventChannel vascEntryFieldEventChannel) {
this.vascEntryFieldEventChannel = vascEntryFieldEventChannel;
}
/**
* Added an VascEntryBackendEventListener
* @param listener The class of the event listener.
*/
public void addVascEntryBackendEventListener(Class<VascEntryBackendEventListener> listener) {
eventEntryBackendEventListeners.add(listener);
}
/**
* Returns the list of VascEntryBackendEventListener
* @return
*/
public List<Class<VascEntryBackendEventListener>> getVascEntryBackendEventListeners() {
return eventEntryBackendEventListeners;
}
/**
* Added an VascEntryFrontendEventListener
* @param listener The class of the event listener.
*/
public void addVascEntryFrontendEventListener(Class<VascEntryFrontendEventListener> listener) {
eventEntryFrontendEventListeners.add(listener);
}
/**
* Returns the list of VascEntryFrontendEventListener
* @return
*/
public List<Class<VascEntryFrontendEventListener>> getVascEntryFrontendEventListeners() {
return eventEntryFrontendEventListeners;
}
public void addListOption(VascEntryField listOption) {
if (listOption==null) {
throw new NullPointerException("can not add null listOption.");
}
listOptions.add(listOption);
}
public List<VascEntryField> getListOptions() {
return listOptions;
}
public void addVascBackendFilter(VascBackendFilter filter) {
backendFilters.add(filter);
}
public List<VascBackendFilter> getVascBackendFilters() {
return backendFilters;
}
}

View file

@ -0,0 +1,103 @@
/*
* Copyright 2004-2007 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. 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 IDCA 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 IDCA 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.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.impl;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import com.idcanet.vasc.core.VascController;
import com.idcanet.vasc.core.VascEntry;
import com.idcanet.vasc.core.VascEntryControllerLocal;
import com.idcanet.vasc.core.VascException;
/**
*
*
* @author Willem Cazander
* @version 1.0 Sep 18, 2008
*/
public class DefaultVascEntryController implements VascEntryControllerLocal {
private Map<String,VascEntry> entries = null;
public DefaultVascEntryController() {
entries = new HashMap<String,VascEntry>();
}
public void addVascEntry(VascEntry entry,VascController vascController) throws VascException {
DefaultVascBackedEntryFinalizer f = new DefaultVascBackedEntryFinalizer();
entry = f.finalizeVascEntry(entry,vascController);
entries.put(entry.getId(), entry);
}
/**
* @see com.idcanet.vasc.core.VascEntryController#getVascEntryById(java.lang.String)
*/
public VascEntry getVascEntryById(String id) {
VascEntry entry = entries.get(id);
if (entry==null) {
throw new NullPointerException("Could not find vasc entry with id: "+id);
}
try {
return entry.clone();
} catch (CloneNotSupportedException e) {
throw new NullPointerException("Could not clone entry: "+e.getMessage());
}
}
public VascEntry getRealVascEntryById(String id) {
VascEntry entry = entries.get(id);
return entry;
}
/**
* @see com.idcanet.vasc.core.VascEntryController#getVascEntryIds()
*/
public List<String> getVascEntryIds() {
List<String> result = new ArrayList<String>(entries.keySet());
Collections.sort(result); // lets do abc for consistance behauvior.
return result;
}
/**
* Retuns only the adminList table entries
*/
public List<String> getVascEntryAdminIds() {
List<String> adminIds = new ArrayList<String>(30);
for (VascEntry e:entries.values()) {
if (Boolean.TRUE.equals(e.isVascAdminList())) {
adminIds.add(e.getId());
}
}
Collections.sort(adminIds); // lets do abc for consistance behauvior.
return adminIds;
}
}

View file

@ -0,0 +1,614 @@
/*
* Copyright 2004-2007 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. 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 IDCA 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 IDCA 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.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.impl;
import java.util.ArrayList;
import java.util.List;
import com.idcanet.vasc.core.VascEntry;
import com.idcanet.vasc.core.VascEntryField;
import com.idcanet.vasc.core.VascEntryFieldType;
import com.idcanet.vasc.core.entry.VascEntryFieldValue;
import com.idcanet.vasc.validators.VascValidator;
/**
*
* @author Willem Cazander
* @version 1.0 Mar 21, 2007
*/
public class DefaultVascEntryField implements VascEntryField {
private static final long serialVersionUID = 1L;
private VascEntry vascEntry = null;
private String id = null;
private String backendName = null;
private String displayName = null;
private VascEntryFieldType vascEntryFieldType = null;
private VascEntryFieldValue vascEntryFieldValue = null;
private List<VascValidator> vascValidators = null;
private String name = null;
private String description = null;
private String helpId = null;
private String image = null;
private Integer orderIndex = null;
private Object defaultValue = null;
private Integer sizeList = null;
private Integer sizeEdit = null;
private String styleList = null;
private String styleEdit = null;
private String choices = null;
private Boolean choicesAsRadio = null;
/** Defines if this columns is used in interface list,create,edit **/
private Boolean view = null;
private Boolean optional = null;
/** Defines per view state of this field **/
private Boolean create = null;
private Boolean edit = null;
private Boolean editReadOnly = null;
private Boolean editBlank = null;
private Boolean list = null;
/** Defines the roles stuff if all up is true **/
private String rolesCreate = null;
private String rolesEdit = null;
private String rolesEditReadOnly = null;
private String rolesList = null;
private Boolean sortable = null;
private Boolean sumable = null;
private Boolean graphable = null;
public DefaultVascEntryField() {
vascValidators = new ArrayList<VascValidator>(5);
}
public DefaultVascEntryField(String id) {
this();
setId(id);
}
/**
* @see java.lang.Object#clone()
*/
@Override
public VascEntryField clone() throws CloneNotSupportedException {
DefaultVascEntryField result = new DefaultVascEntryField();
result.id=id;
result.backendName=backendName;
result.displayName=displayName;
result.vascEntryFieldType=vascEntryFieldType;
result.name=name;
result.description=description;
result.helpId=helpId;
result.image=image;
result.defaultValue=defaultValue;
result.orderIndex=orderIndex;
result.sizeList=sizeList;
result.sizeEdit=sizeEdit;
result.styleList=styleList;
result.styleEdit=styleEdit;
result.choices=choices;
result.choicesAsRadio=choicesAsRadio;
result.view=view;
result.optional=optional;
result.create=create;
result.edit=edit;
result.editReadOnly=editReadOnly;
result.editBlank=editBlank;
result.list=list;
result.rolesCreate=rolesCreate;
result.rolesEdit=rolesEdit;
result.rolesEditReadOnly=rolesEditReadOnly;
result.rolesList=rolesList;
result.sortable=sortable;
result.sumable=sumable;
result.graphable=graphable;
// this polls full backend..
//result.vascEntryFieldValue=vascEntryFieldValue;
for (VascValidator val:vascValidators) {
result.vascValidators.add(val.clone());
}
return result;
}
public VascEntry getVascEntry() {
return vascEntry;
}
public void setVascEntry(VascEntry vascEntry) {
this.vascEntry=vascEntry;
}
/**
* @return the id
*/
public String getId() {
return id;
}
/**
* @param id the id to set
*/
public void setId(String id) {
this.id = id;
}
/**
* @return the vascEntryFieldType
*/
public VascEntryFieldType getVascEntryFieldType() {
return vascEntryFieldType;
}
/**
* @param vascEntryFieldType the vascEntryFieldType to set
*/
public void setVascEntryFieldType(VascEntryFieldType vascEntryFieldType) {
this.vascEntryFieldType = vascEntryFieldType;
}
/**
* @return the backendName
*/
public String getBackendName() {
return backendName;
}
/**
* @param backendName the backendName to set
*/
public void setBackendName(String backendName) {
this.backendName = backendName;
}
/**
* @return the vascEntryFieldValue
*/
public VascEntryFieldValue getVascEntryFieldValue() {
return vascEntryFieldValue;
}
/**
* @param vascEntryFieldValue the vascEntryFieldValue to set
*/
public void setVascEntryFieldValue(VascEntryFieldValue vascEntryFieldValue) {
this.vascEntryFieldValue = vascEntryFieldValue;
}
/**
* @return the vascValidators
*/
public List<VascValidator> getVascValidators() {
return vascValidators;
}
/**
* @param vascValidators the vascValidators to add
*/
public void addVascValidator(VascValidator vascValidator) {
this.vascValidators.add(vascValidator);
}
/**
* @param vascValidators the vascValidators to remove
*/
public void removeVascValidator(VascValidator vascValidator) {
this.vascValidators.remove(vascValidator);
}
/**
* @return the name
*/
public String getName() {
return name;
}
/**
* @param name the name to set
*/
public void setName(String name) {
this.name = name;
}
/**
* @return the description
*/
public String getDescription() {
return description;
}
/**
* @param description the description to set
*/
public void setDescription(String description) {
this.description = description;
}
/**
* @return the helpId
*/
public String getHelpId() {
return helpId;
}
/**
* @param helpId the helpId to set
*/
public void setHelpId(String helpId) {
this.helpId = helpId;
}
/**
* @return the image
*/
public String getImage() {
return image;
}
/**
* @param image the image to set
*/
public void setImage(String image) {
this.image = image;
}
/**
* @return the defaultValue
*/
public Object getDefaultValue() {
return defaultValue;
}
/**
* @param defaultValue the defaultValue to set
*/
public void setDefaultValue(Object defaultValue) {
this.defaultValue = defaultValue;
}
/**
* @return the sizeList
*/
public Integer getSizeList() {
return sizeList;
}
/**
* @param sizeList the sizeList to set
*/
public void setSizeList(Integer sizeList) {
this.sizeList = sizeList;
}
/**
* @return the sizeEdit
*/
public Integer getSizeEdit() {
return sizeEdit;
}
/**
* @param sizeEdit the sizeEdit to set
*/
public void setSizeEdit(Integer sizeEdit) {
this.sizeEdit = sizeEdit;
}
/**
* @return the styleList
*/
public String getStyleList() {
return styleList;
}
/**
* @param styleList the styleList to set
*/
public void setStyleList(String styleList) {
this.styleList = styleList;
}
/**
* @return the styleEdit
*/
public String getStyleEdit() {
return styleEdit;
}
/**
* @param styleEdit the styleEdit to set
*/
public void setStyleEdit(String styleEdit) {
this.styleEdit = styleEdit;
}
/**
* @return the choices
*/
public String getChoices() {
return choices;
}
/**
* @param choices the choices to set
*/
public void setChoices(String choices) {
this.choices = choices;
}
/**
* @return the view
*/
public Boolean getView() {
return view;
}
/**
* @param view the view to set
*/
public void setView(Boolean view) {
this.view = view;
}
/**
* @return the optional
*/
public Boolean getOptional() {
return optional;
}
/**
* @param optional the optional to set
*/
public void setOptional(Boolean optional) {
this.optional = optional;
}
/**
* @return the create
*/
public Boolean getCreate() {
return create;
}
/**
* @param create the create to set
*/
public void setCreate(Boolean create) {
this.create = create;
}
/**
* @return the edit
*/
public Boolean getEdit() {
return edit;
}
/**
* @param edit the edit to set
*/
public void setEdit(Boolean edit) {
this.edit = edit;
}
/**
* @return the editReadOnly
*/
public Boolean getEditReadOnly() {
return editReadOnly;
}
/**
* @param editReadOnly the editReadOnly to set
*/
public void setEditReadOnly(Boolean editReadOnly) {
this.editReadOnly = editReadOnly;
}
/**
* @return the list
*/
public Boolean getList() {
return list;
}
/**
* @param list the list to set
*/
public void setList(Boolean list) {
this.list = list;
}
/**
* @return the rolesCreate
*/
public String getRolesCreate() {
return rolesCreate;
}
/**
* @param rolesCreate the rolesCreate to set
*/
public void setRolesCreate(String rolesCreate) {
this.rolesCreate = rolesCreate;
}
/**
* @return the rolesEdit
*/
public String getRolesEdit() {
return rolesEdit;
}
/**
* @param rolesEdit the rolesEdit to set
*/
public void setRolesEdit(String rolesEdit) {
this.rolesEdit = rolesEdit;
}
/**
* @return the rolesEditReadOnly
*/
public String getRolesEditReadOnly() {
return rolesEditReadOnly;
}
/**
* @param rolesEditReadOnly the rolesEditReadOnly to set
*/
public void setRolesEditReadOnly(String rolesEditReadOnly) {
this.rolesEditReadOnly = rolesEditReadOnly;
}
/**
* @return the rolesList
*/
public String getRolesList() {
return rolesList;
}
/**
* @param rolesList the rolesList to set
*/
public void setRolesList(String rolesList) {
this.rolesList = rolesList;
}
/**
* @return the choicesAsRadio
*/
public Boolean getChoicesAsRadio() {
return choicesAsRadio;
}
/**
* @param choicesAsRadio the choicesAsRadio to set
*/
public void setChoicesAsRadio(Boolean choicesAsRadio) {
this.choicesAsRadio = choicesAsRadio;
}
/**
* @return the editBlank
*/
public Boolean getEditBlank() {
return editBlank;
}
/**
* @param editBlank the editBlank to set
*/
public void setEditBlank(Boolean editBlank) {
this.editBlank = editBlank;
}
/**
* @return the displayName
*/
public String getDisplayName() {
return displayName;
}
/**
* @param displayName the displayName to set
*/
public void setDisplayName(String displayName) {
this.displayName = displayName;
}
/**
* @return the orderIndex
*/
public Integer getOrderIndex() {
return orderIndex;
}
/**
* @param orderIndex the orderIndex to set
*/
public void setOrderIndex(Integer orderIndex) {
this.orderIndex = orderIndex;
}
/**
* @return the sortable
*/
public Boolean getSortable() {
return sortable;
}
/**
* @param sortable the sortable to set
*/
public void setSortable(Boolean sortable) {
this.sortable = sortable;
}
/**
* @return the sumable
*/
public Boolean getSumable() {
return sumable;
}
/**
* @param sumable the sumable to set
*/
public void setSumable(Boolean sumable) {
this.sumable = sumable;
}
/**
* @return the graphable
*/
public Boolean getGraphable() {
return graphable;
}
/**
* @param graphable the graphable to set
*/
public void setGraphable(Boolean graphable) {
this.graphable = graphable;
}
}

View file

@ -0,0 +1,226 @@
/*
* Copyright 2004-2007 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. 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 IDCA 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 IDCA 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.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.impl;
import java.util.ArrayList;
import java.util.List;
import com.idcanet.vasc.core.VascEntryFieldSet;
/**
*
* @author Willem Cazander
* @version 1.0 Mar 21, 2007
*/
public class DefaultVascEntryFieldSet implements VascEntryFieldSet {
private String id = null;
private String name = null;
private String description = null;
private String helpId = null;
private String image = null;
private String styleList = null;
private String styleEdit = null;
private boolean collapsed = false;
private boolean optional = false;
private List<String> vascEntryFieldIds = null;
public DefaultVascEntryFieldSet() {
vascEntryFieldIds = new ArrayList<String>(10);
}
/**
* @see java.lang.Object#clone()
*/
@Override
public VascEntryFieldSet clone() throws CloneNotSupportedException {
DefaultVascEntryFieldSet result = new DefaultVascEntryFieldSet();
result.id=id;
result.name=name;
result.description=description;
result.helpId=helpId;
result.image=image;
result.styleList=styleList;
result.styleEdit=styleEdit;
result.collapsed=collapsed;
result.optional=optional;
result.vascEntryFieldIds.addAll(vascEntryFieldIds);
return result;
}
/**
* @return the id
*/
public String getId() {
return id;
}
/**
* @param id the id to set
*/
public void setId(String id) {
this.id = id;
}
/**
* @return the name
*/
public String getName() {
return name;
}
/**
* @param name the name to set
*/
public void setName(String name) {
this.name = name;
}
/**
* @return the description
*/
public String getDescription() {
return description;
}
/**
* @param description the description to set
*/
public void setDescription(String description) {
this.description = description;
}
/**
* @return the helpId
*/
public String getHelpId() {
return helpId;
}
/**
* @param helpId the helpId to set
*/
public void setHelpId(String helpId) {
this.helpId = helpId;
}
/**
* @return the image
*/
public String getImage() {
return image;
}
/**
* @param image the image to set
*/
public void setImage(String image) {
this.image = image;
}
/**
* @return the styleList
*/
public String getStyleList() {
return styleList;
}
/**
* @param styleList the styleList to set
*/
public void setStyleList(String styleList) {
this.styleList = styleList;
}
/**
* @return the styleEdit
*/
public String getStyleEdit() {
return styleEdit;
}
/**
* @param styleEdit the styleEdit to set
*/
public void setStyleEdit(String styleEdit) {
this.styleEdit = styleEdit;
}
/**
* @return the collapsed
*/
public boolean isCollapsed() {
return collapsed;
}
/**
* @param collapsed the collapsed to set
*/
public void setCollapsed(boolean collapsed) {
this.collapsed = collapsed;
}
/**
* @return the optional
*/
public boolean isOptional() {
return optional;
}
/**
* @param optional the optional to set
*/
public void setOptional(boolean optional) {
this.optional = optional;
}
/**
* @return the vascEntryFieldIds
*/
public List<String> getVascEntryFieldIds() {
return vascEntryFieldIds;
}
/**
* @param vascEntryFieldIds the vascEntryFieldIds to set
*/
public void addVascEntryFieldId(String vascEntryFieldId) {
vascEntryFieldIds.add(vascEntryFieldId);
}
/**
* @param vascEntryFieldIds the vascEntryFieldIds to set
*/
public void removeVascEntryFieldId(String vascEntryFieldId) {
vascEntryFieldIds.remove(vascEntryFieldId);
}
}

View file

@ -0,0 +1,16 @@
/**
*
*/
package com.idcanet.vasc.impl;
import com.idcanet.vasc.core.AbstractVascEntryState;
/**
* Holds all state values
*
* @author Willem Cazander
* @version 1.0 Dec 15, 2009
*/
public class DefaultVascEntryState extends AbstractVascEntryState {
private static final long serialVersionUID = 1L;
}

View file

@ -0,0 +1,114 @@
/*
* Copyright 2004-2007 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. 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 IDCA 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 IDCA 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.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.impl;
import java.util.Locale;
import java.util.ResourceBundle;
import com.idcanet.vasc.core.VascBackend;
import com.idcanet.vasc.core.VascBackendFilter;
import com.idcanet.vasc.core.VascController;
import com.idcanet.vasc.core.VascEntry;
import com.idcanet.vasc.core.VascException;
import com.idcanet.vasc.core.VascFrontendData;
import com.idcanet.vasc.impl.entry.DefaultVascEntryResourceResolver;
import com.idcanet.vasc.impl.entry.VascValidatorsValidatorService;
import com.idcanet.vasc.impl.type.DefaultVascEntryFieldTypeController;
/**
* Default Vasc Factory for creating some base object plumming for vasc useage.
*
* @author Willem Cazander
* @version 1.0 Dec 15, 2009
*/
public class DefaultVascFactory {
static public VascController getDefaultVascController(Long userId,String userName,String...roles) throws VascException {
// config full controller for local jvm use
DefaultVascController c = new DefaultVascController();
DefaultVascBackendController vascBackendController = new DefaultVascBackendController();
c.setVascBackendController(vascBackendController);
DefaultVascEntryController vascEntryController = new DefaultVascEntryController();
c.setVascEntryController(vascEntryController);
DefaultVascEntryFieldTypeController vascEntryFieldTypeController = new DefaultVascEntryFieldTypeController();
c.setVascEntryFieldTypeController(vascEntryFieldTypeController);
DefaultVascUserRoleController vascUserRoleController = new DefaultVascUserRoleController(userId,userName,roles);
c.setVascUserRoleController(vascUserRoleController);
return c;
}
static public VascFrontendData getDefaultVascFrontendData(String resourceBundle,Locale locale) {
ResourceBundle bundle = ResourceBundle.getBundle(resourceBundle, locale);
return getDefaultVascFrontendData(bundle);
}
static public VascFrontendData getDefaultVascFrontendData(ResourceBundle resourceBundle) {
DefaultVascFrontendData vascFrontendData = new DefaultVascFrontendData(); // controller is set by vasc
vascFrontendData.setVascEntryResourceResolver(new DefaultVascEntryResourceResolver(resourceBundle));
vascFrontendData.setVascFrontendHelper(new DefaultVascFrontendHelper());
//vascFrontendData.setVascEntryResourceImageResolver(new ImageResources());
vascFrontendData.setVascEntryState(new DefaultVascEntryState());
vascFrontendData.getVascEntryState().setVascBackendState(new DefaultVascBackendState());
vascFrontendData.getVascEntryState().getVascBackendState().setPageSize(100); // default page size is zero aka disabled
vascFrontendData.getVascEntryState().getVascBackendState().setPageSizeMax(1000); // max 1k records on screen.
vascFrontendData.addVascValidatorService(new VascValidatorsValidatorService()); // normal vasc validators
return vascFrontendData;
}
static public VascBackend getProxyVascBackend(VascEntry entry) {
// Get the real backend
VascBackend backend = entry.getVascFrontendData().getVascController().getVascBackendController().getVascBackendById(entry.getBackendId());
// logs all actions log logger
backend = new VascBackendProxyTimerLogger(backend,entry);
// only cached one result, checks for paramater differnce
backend = new VascBackendProxyCache(backend,entry);
for (VascBackendFilter filter:entry.getVascBackendFilters()) {
filter.initFilter(entry);
backend = new VascBackendProxyFilter(backend,entry,filter);
}
if (backend.isSearchable()==false) {
backend = new VascBackendProxySearch(backend,entry);
}
if (backend.isSortable()==false) {
backend = new VascBackendProxySort(backend,entry);
}
if (backend.isPageable()==false) {
backend = new VascBackendProxyPaged(backend,entry);
}
return backend;
}
}

View file

@ -0,0 +1,275 @@
/*
* Copyright 2004-2007 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. 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 IDCA 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 IDCA 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.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.impl;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import com.idcanet.vasc.core.VascController;
import com.idcanet.vasc.core.VascEntry;
import com.idcanet.vasc.core.VascEntryField;
import com.idcanet.vasc.core.VascEntryFinalizer;
import com.idcanet.vasc.core.VascEntryState;
import com.idcanet.vasc.core.VascException;
import com.idcanet.vasc.core.VascFrontend;
import com.idcanet.vasc.core.VascFrontendData;
import com.idcanet.vasc.core.VascFrontendHelper;
import com.idcanet.vasc.core.entry.VascEntryFieldValidatorService;
import com.idcanet.vasc.core.entry.VascEntryFrontendEventListener;
import com.idcanet.vasc.core.entry.VascEntryResourceImageResolver;
import com.idcanet.vasc.core.entry.VascEntryResourceResolver;
import com.idcanet.vasc.core.ui.VascUIComponent;
/**
*
* @author Willem Cazander
* @version 1.0 Mar 21, 2007
*/
public class DefaultVascFrontendData implements VascFrontendData {
private VascFrontend vascFrontend = null;
private VascEntryFinalizer vascEntryFinalizer = null;
private VascFrontendHelper vascFrontendHelper = null;
private VascEntryResourceResolver vascEntryResourceResolver = null;
private VascEntryResourceImageResolver vascEntryResourceImageResolver = null;
private Map<String,String> uiComponents = null;
private VascController vascController = null;
private Map<VascEntryFrontendEventListener.VascFrontendEventType,List<VascEntryFrontendEventListener>> vascEntryFrontendEventListeners = null;
private VascEntryState state = null;
private Map<VascEntryField,VascUIComponent> fieldComps = null;
private Map<VascEntryField,Object> fieldEditors = null;
private List<VascEntryFieldValidatorService> validatorServices = null;
public DefaultVascFrontendData() {
uiComponents = new HashMap<String,String>(8);
fieldComps = new HashMap<VascEntryField,VascUIComponent>(8);
fieldEditors = new HashMap<VascEntryField,Object>(8);
validatorServices = new ArrayList<VascEntryFieldValidatorService>(4);
vascEntryFrontendEventListeners = new HashMap<VascEntryFrontendEventListener.VascFrontendEventType,List<VascEntryFrontendEventListener>>(10);
}
/**
* @return the vascFrontend
*/
public VascFrontend getVascFrontend() {
return vascFrontend;
}
/**
* @param vascFrontend the vascFrontend to set
*/
public void setVascFrontend(VascFrontend vascFrontend) {
this.vascFrontend = vascFrontend;
}
/**
* @see com.idcanet.vasc.core.VascBackendData#getVascEntryFinalizer()
*/
public VascEntryFinalizer getVascEntryFinalizer() {
return vascEntryFinalizer;
}
/**
* @see com.idcanet.vasc.core.VascBackendData#setVascEntryFinalizer(com.idcanet.vasc.core.VascEntryFinalizer)
*/
public void setVascEntryFinalizer(VascEntryFinalizer vascEntryFinalizer) {
this.vascEntryFinalizer=vascEntryFinalizer;
}
/**
* @return the vascFrontendHelper
*/
public VascFrontendHelper getVascFrontendHelper() {
return vascFrontendHelper;
}
/**
* @param vascFrontendHelper the vascFrontendHelper to set
*/
public void setVascFrontendHelper(VascFrontendHelper vascFrontendHelper) {
this.vascFrontendHelper = vascFrontendHelper;
}
/**
* @return the vascEntryResourceResolver
*/
public VascEntryResourceResolver getVascEntryResourceResolver() {
return vascEntryResourceResolver;
}
/**
* @param vascEntryResourceResolver the vascEntryResourceResolver to set
*/
public void setVascEntryResourceResolver(VascEntryResourceResolver vascEntryResourceResolver) {
this.vascEntryResourceResolver = vascEntryResourceResolver;
}
public VascUIComponent getVascUIComponent(String rendererId) throws VascException {
ClassLoader cl = Thread.currentThread().getContextClassLoader();
if (cl == null) {
cl = rendererId.getClass().getClassLoader(); // fallback
}
String componentClass = getVascUIComponentClass(rendererId);
if (componentClass==null) {
// TODO: auto wire text <-> object converts
componentClass = getVascUIComponentClass(VascUIComponent.VASC_TEXT);
}
if (componentClass==null) {
throw new VascException("No component Class found for frontend UIComponent: "+rendererId);
}
try {
return (VascUIComponent)cl.loadClass(componentClass).newInstance();
} catch (Exception e) {
throw new VascException(e);
}
}
/**
* @see com.idcanet.vasc.core.VascFrontendData#getVascUIComponent(java.lang.String)
*/
public String getVascUIComponentClass(String rendererId) {
return uiComponents.get(rendererId);
}
/**
* @see com.idcanet.vasc.core.VascFrontendData#putVascUIComponent(java.lang.String, java.lang.String)
*/
public void putVascUIComponent(String rendererId, String uiComponentClass) {
uiComponents.put(rendererId, uiComponentClass);
}
/**
* @return the vascController
*/
public VascController getVascController() {
return vascController;
}
/**
* @param vascController the vascController to set
*/
public void setVascController(VascController vascController) {
this.vascController = vascController;
}
/**
* @see com.idcanet.vasc.core.VascFrontendData#addFieldVascUIComponents(com.idcanet.vasc.core.VascEntryField, com.idcanet.vasc.core.ui.VascUIComponent, java.lang.Object)
*/
public void addFieldVascUIComponents(VascEntryField field,VascUIComponent uiComponent, Object editor) {
fieldComps.put(field, uiComponent);
fieldEditors.put(field, editor);
}
public void clearFieldRenderObjects() {
fieldComps.clear();
fieldEditors.clear();
}
/**
* @see com.idcanet.vasc.core.VascFrontendData#getFieldRealRenderer(com.idcanet.vasc.core.VascEntryField)
*/
public Object getFieldRealRenderer(VascEntryField field) {
return fieldEditors.get(field);
}
/**
* @see com.idcanet.vasc.core.VascFrontendData#getFieldVascUIComponent(com.idcanet.vasc.core.VascEntryField)
*/
public VascUIComponent getFieldVascUIComponent(VascEntryField field) {
return fieldComps.get(field);
}
/**
* @return the vascEntryResourceImageResolver
*/
public VascEntryResourceImageResolver getVascEntryResourceImageResolver() {
return vascEntryResourceImageResolver;
}
/**
* @param vascEntryResourceImageResolver the vascEntryResourceImageResolver to set
*/
public void setVascEntryResourceImageResolver(VascEntryResourceImageResolver vascEntryResourceImageResolver) {
this.vascEntryResourceImageResolver = vascEntryResourceImageResolver;
}
/**
* @see com.idcanet.vasc.core.VascFrontendData#addVascValidatorService(com.idcanet.vasc.core.entry.VascEntryFieldValidatorService)
*/
public void addVascValidatorService(VascEntryFieldValidatorService validatorService) {
validatorServices.add(validatorService);
}
/**
* @see com.idcanet.vasc.core.VascFrontendData#getVascValidatorServices()
*/
public List<VascEntryFieldValidatorService> getVascValidatorServices() {
return validatorServices;
}
public VascEntryState getVascEntryState() {
return state;
}
public void setVascEntryState(VascEntryState state) {
this.state=state;
}
public void initFrontendListeners(VascEntry entry) throws InstantiationException, IllegalAccessException {
for (Class<VascEntryFrontendEventListener> clazz:entry.getVascEntryFrontendEventListeners()) {
VascEntryFrontendEventListener listener = clazz.newInstance();
addVascEntryFrontendEventListener(listener);
}
}
public void addVascEntryFrontendEventListener(VascEntryFrontendEventListener listener) {
for (VascEntryFrontendEventListener.VascFrontendEventType type:listener.getEventTypes()) {
List<VascEntryFrontendEventListener> list = vascEntryFrontendEventListeners.get(type);
if (list==null) {
list = new ArrayList<VascEntryFrontendEventListener>(10);
vascEntryFrontendEventListeners.put(type, list);
}
list.add(listener);
}
}
public List<VascEntryFrontendEventListener> getVascEntryFrontendEventListener(VascEntryFrontendEventListener.VascFrontendEventType type) {
List<VascEntryFrontendEventListener> list = vascEntryFrontendEventListeners.get(type);
if (list==null) {
return new ArrayList<VascEntryFrontendEventListener>(0);
}
return list;
}
}

View file

@ -0,0 +1,49 @@
/*
* Copyright 2004-2007 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. 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 IDCA 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 IDCA 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.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.impl;
import com.idcanet.vasc.core.VascController;
import com.idcanet.vasc.core.VascEntry;
import com.idcanet.vasc.core.VascEntryFinalizer;
import com.idcanet.vasc.core.VascException;
/**
*
* @author Willem Cazander
* @version 1.0 Sep 14, 2008
*/
public class DefaultVascFrontendEntryFinalizer implements VascEntryFinalizer {
/**
* @see com.idcanet.vasc.core.VascEntryFinalizer#finalizeVascEntry(com.idcanet.vasc.core.VascEntry)
*/
public VascEntry finalizeVascEntry(VascEntry entry,VascController vascController) throws VascException {
return entry;
}
}

View file

@ -0,0 +1,535 @@
/*
* Copyright 2004-2010 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. 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 IDCA 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 IDCA 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.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.impl;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.logging.Logger;
import com.idcanet.vasc.core.VascBackendFilter;
import com.idcanet.vasc.core.VascBackendPageNumber;
import com.idcanet.vasc.core.VascBackendState;
import com.idcanet.vasc.core.VascEntry;
import com.idcanet.vasc.core.VascEntryField;
import com.idcanet.vasc.core.VascException;
import com.idcanet.vasc.core.VascFrontendHelper;
import com.idcanet.vasc.core.VascLinkEntry;
import com.idcanet.vasc.core.VascLinkEntryType;
import com.idcanet.vasc.core.VascUserRoleController;
import com.idcanet.vasc.core.actions.GlobalVascAction;
import com.idcanet.vasc.core.actions.RowVascAction;
import com.idcanet.vasc.core.entry.VascEntryFieldValidatorService;
import com.idcanet.vasc.core.entry.VascEntryFrontendEventListener;
import com.idcanet.vasc.core.entry.VascEntryFrontendEventListener.VascFrontendEventType;
import com.idcanet.vasc.core.ui.VascUIComponent;
/**
*
* @author Willem Cazander
* @version 1.0 Apr 28, 2007
*/
public class DefaultVascFrontendHelper implements VascFrontendHelper {
private Logger logger = Logger.getLogger(DefaultVascFrontendHelper.class.getName());
/**
* @see com.idcanet.vasc.core.VascFrontendHelper#renderView(com.idcanet.vasc.core.VascEntryField)
*/
public boolean renderView(VascEntryField field) {
if (field.getView()==false) {
return false;
}
return true;
}
/**
* @see com.idcanet.vasc.core.VascFrontendHelper#renderCreate(com.idcanet.vasc.core.VascEntryField)
*/
public boolean renderCreate(VascEntryField field) {
if (renderView(field)==false) {
return false;
}
VascUserRoleController u = field.getVascEntry().getVascFrontendData().getVascController().getVascUserRoleController();
if (field.getRolesCreate()!=null && u.hasRole(field.getRolesCreate())) {
return true;
}
if (field.getCreate()) {
return true;
}
return false;
}
/**
* @see com.idcanet.vasc.core.VascFrontendHelper#renderEdit(com.idcanet.vasc.core.VascEntryField)
*/
public boolean renderEdit(VascEntryField field) {
if (renderView(field)==false) {
return false;
}
if (field.getVascEntry().getVascFrontendData().getVascEntryState().isEditCreate()) {
if (renderCreate(field)==false) {
return false;
}
}
VascUserRoleController u = field.getVascEntry().getVascFrontendData().getVascController().getVascUserRoleController();
if (field.getRolesEdit()!=null && u.hasRole(field.getRolesEdit())) {
return true;
}
if (field.getEdit()) {
return true;
}
return false;
}
/**
* @see com.idcanet.vasc.core.VascFrontendHelper#renderEditReadOnly(com.idcanet.vasc.core.VascEntryField)
*/
public boolean renderEditReadOnly(VascEntryField field) {
if (renderView(field)==false) {
return false;
}
VascUserRoleController u = field.getVascEntry().getVascFrontendData().getVascController().getVascUserRoleController();
if (field.getRolesEditReadOnly()!=null && u.hasRole(field.getRolesEditReadOnly())) {
return true;
}
if (field.getEditReadOnly()) {
return true;
}
return false;
}
/**
* @see com.idcanet.vasc.core.VascFrontendHelper#renderList(com.idcanet.vasc.core.VascEntryField)
*/
public boolean renderList(VascEntryField field) {
if (renderView(field)==false) {
return false;
}
VascUserRoleController u = field.getVascEntry().getVascFrontendData().getVascController().getVascUserRoleController();
if (field.getRolesList()!=null && u.hasRole(field.getRolesList())) {
return true;
}
if (field.getList()) {
return true;
}
return false;
}
/**
* @see com.idcanet.vasc.core.VascFrontendHelper#renderGlobalVascAction(com.idcanet.vasc.core.actions.GlobalVascAction)
*/
public boolean renderGlobalVascAction(GlobalVascAction action) {
return true;
}
/**
* @see com.idcanet.vasc.core.VascFrontendHelper#renderRowVascAction(com.idcanet.vasc.core.actions.RowVascAction)
*/
public boolean renderRowVascAction(RowVascAction action) {
return true;
}
/**
* @see com.idcanet.vasc.core.VascFrontendHelper#fireVascEvent(com.idcanet.vasc.core.entry.VascEntryEventListener.VascEventType, java.lang.Object)
*/
public void fireVascEvent(VascEntry entry,VascFrontendEventType type, Object data) {
List<VascEntryFrontendEventListener> list = entry.getVascFrontendData().getVascEntryFrontendEventListener(type);
for (VascEntryFrontendEventListener l:list) {
l.vascEvent(entry, data);
}
}
/**
* @see com.idcanet.vasc.core.VascFrontendHelper#getTotalColumnsWidth(com.idcanet.vasc.core.VascEntry)
*/
public Integer getTotalColumnsWidth(VascEntry entry) {
int result = 0;
for(VascEntryField c:entry.getVascEntryFields()) {
if(c.getSizeList()==null) {
logger.finer("Column no size: "+c.getName());
} else {
result+=c.getSizeList();
}
}
return result;
}
public List<VascLinkEntry> getVascLinkEntryByType(VascEntry entry,VascLinkEntryType type) {
List<VascLinkEntry> result = new ArrayList<VascLinkEntry>(10);
for (VascLinkEntry link:entry.getVascLinkEntries()) {
if (type==null) {
result.add(link);
continue;
}
if (type.equals(link.getVascLinkEntryType())) {
result.add(link);
}
}
return result;
}
/**
* Returns the total amount of pages
* @return
*/
public List<VascBackendPageNumber> getVascBackendPageNumbers(VascEntry entry) {
List<VascBackendPageNumber> result = new ArrayList<VascBackendPageNumber>(30);
VascBackendState state = entry.getVascFrontendData().getVascEntryState().getVascBackendState();
if (state.getPageSize()==0) {
return result; // paging disabled
}
Long total = entry.getVascFrontendData().getVascEntryState().getTotalBackendRecords();
if (total==null) {
return result; // no pages
}
int pages = new Long(total/state.getPageSize()).intValue();
for (int i=0;i<=pages;i++) {
VascBackendPageNumber pn = new VascBackendPageNumber(i);
if (state.getPageIndex()==i) {
pn.setSelected(true);
}
result.add(pn);
}
return result;
}
/**
* @see com.idcanet.vasc.core.VascFrontendHelper#handleException(com.idcanet.vasc.core.VascEntry,java.lang.Exception)
*/
public void handleException(VascEntry entry,Exception exception) {
fireVascEvent(entry,VascFrontendEventType.EXCEPTION , exception);
}
/**
* @see com.idcanet.vasc.core.VascFrontendHelper#initEditObject(com.idcanet.vasc.core.VascEntry)
*/
public Object createObject(VascEntry entry) {
try {
Object object = entry.getVascFrontendData().getVascEntryState().getVascBackend().provideVascEntryRecordCreator(entry.clone()).newRecord(entry);
if (object==null) {
throw new IllegalStateException("Can't work with null object for backend storage.");
}
for (VascEntryField field:entry.getVascEntryFields()) {
if (field.getDefaultValue()==null) {
continue; // no default value to set.
}
Object value = field.getVascEntryFieldValue().getValue(field, object);
if (value!=null) {
continue; // value is already set by backend creator.
}
Object defaultValue = field.getDefaultValue();
if (defaultValue instanceof String) {
String def = (String)defaultValue;
if (def.equals("now()")) { // TODO: add default string parsers
defaultValue = new Date();
}
}
logger.finer("Setting default value for: "+field.getName()+" def: "+defaultValue);
field.getVascEntryFieldValue().setValue(field, object, defaultValue);
}
fireVascEvent(entry,VascEntryFrontendEventListener.VascFrontendEventType.DATA_CREATE, object);
return object;
} catch (Exception e) {
handleException(entry,e);
return null; /// ?? ,,
}
}
protected int removeObjectFromDataList(VascEntry entry,Object object) {
int indexOld = entry.getVascFrontendData().getVascEntryState().getEntryDataList().indexOf(object);
if (entry.getVascFrontendData().getVascEntryState().getEntryDataList().remove(object)) {
return indexOld; // java worked well for use
}
// remove only work on (jpa)beans with an overrided equals method.
// we lets do the search ourselfs here because we should know the primary key value
try {
VascEntryField field = entry.getVascEntryFieldById(entry.getPrimaryKeyFieldId());
Object idObject = field.getVascEntryFieldValue().getValue(field, object);
// is only null when creating objects
if (idObject!=null) {
int index = 0;
for (Object o:entry.getVascFrontendData().getVascEntryState().getEntryDataList()) {
field = entry.getVascEntryFieldById(entry.getPrimaryKeyFieldId());
Object id = field.getVascEntryFieldValue().getValue(field, o);
if (idObject.equals(id)) {
break;
}
index++;
}
if (index<entry.getVascFrontendData().getVascEntryState().getEntryDataList().size()) {
entry.getVascFrontendData().getVascEntryState().getEntryDataList().remove(index);
return index;
}
}
} catch (VascException e) {
handleException(entry,e);
}
return 0; // make better (0=top of list)
}
/**
* @see com.idcanet.vasc.core.VascFrontendHelper#mergeObject(com.idcanet.vasc.core.VascEntry)
*/
public Object mergeObject(VascEntry entry) {
Object object = entry.getVascFrontendData().getVascEntryState().getEntryDataObject();
Object result = null;
try {
fireVascEvent(entry,VascEntryFrontendEventListener.VascFrontendEventType.DATA_PRE_UPDATE,object);
int index = removeObjectFromDataList(entry,object);
// merge object on backend
result = entry.getVascFrontendData().getVascEntryState().getVascBackend().merge(object);
// put object thrue the filters
for (VascBackendFilter filter:entry.getVascBackendFilters()) {
result = filter.filterObject(result);
}
// put object back in list
entry.getVascFrontendData().getVascEntryState().getEntryDataList().add(index, result);
entry.getVascFrontendData().getVascEntryState().setEntryDataObject(null);
fireVascEvent(entry,VascEntryFrontendEventListener.VascFrontendEventType.DATA_POST_UPDATE,result);
fireVascEvent(entry,VascEntryFrontendEventListener.VascFrontendEventType.DATA_LIST_UPDATE,result);
} catch (Exception e) {
handleException(entry,e);
}
return result;
}
/**
* Deletes the selected row object from the list and fires event.
* @param entry
* @param object
*/
public void deleteObject(VascEntry entry) {
Object object = entry.getVascFrontendData().getVascEntryState().getEntryDataObject();
try {
entry.getVascFrontendData().getVascEntryState().getVascBackend().delete(object);
} catch (Exception e) {
handleException(entry,e);
}
removeObjectFromDataList(entry,object);
entry.getVascFrontendData().getVascEntryState().setEntryDataObject(null);
fireVascEvent(entry,VascEntryFrontendEventListener.VascFrontendEventType.DATA_DELETE, object);
fireVascEvent(entry,VascEntryFrontendEventListener.VascFrontendEventType.DATA_LIST_UPDATE, object);
}
/**
* @see com.idcanet.vasc.core.VascFrontendHelper#refreshData(com.idcanet.vasc.core.VascEntry)
*/
public void refreshData(VascEntry entry) {
entry.getVascFrontendData().getVascEntryState().setEntryDataObject(null);
try {
// check and correct max page size
if (entry.getVascFrontendData().getVascEntryState().getVascBackendState().getPageSize()>entry.getVascFrontendData().getVascEntryState().getVascBackendState().getPageSizeMax()) {
entry.getVascFrontendData().getVascEntryState().getVascBackendState().setPageSize(entry.getVascFrontendData().getVascEntryState().getVascBackendState().getPageSizeMax());
}
for (String key:entry.getEntryParameterKeys()) {
Object value = entry.getEntryParameter(key);
entry.getVascFrontendData().getVascEntryState().getVascBackendState().setDataParameter(key, value);
}
entry.getVascFrontendData().getVascEntryState().setEntryDataList(entry.getVascFrontendData().getVascEntryState().getVascBackend().execute(entry.getVascFrontendData().getVascEntryState().getVascBackendState()));
// also update total every time
Long total = entry.getVascFrontendData().getVascEntryState().getVascBackend().fetchTotalExecuteSize(entry.getVascFrontendData().getVascEntryState().getVascBackendState());
entry.getVascFrontendData().getVascEntryState().setTotalBackendRecords(total);
} catch (Exception e) {
handleException(entry, e);
}
fireVascEvent(entry,VascEntryFrontendEventListener.VascFrontendEventType.DATA_READ, null);
fireVascEvent(entry,VascEntryFrontendEventListener.VascFrontendEventType.DATA_LIST_UPDATE, null);
}
public void headerOptionsCreatedFillData(VascEntry entry) {
entry.getVascFrontendData().getVascFrontendHelper().refreshData(entry);
}
/**
* @see com.idcanet.vasc.core.VascFrontendHelper#validateObjectField(com.idcanet.vasc.core.VascEntryField, java.lang.Object)
*/
public List<String> validateObjectField(VascEntryField field) {
if (field==null) {
throw new NullPointerException("Can't validate null field.");
}
VascEntry entry = field.getVascEntry();
if (entry.getVascFrontendData().getVascEntryState().getEntryDataObject()==null) {
throw new NullPointerException("Can't validate null entry object.");
}
List<String> error = new ArrayList<String>(3);
// skip non-create and non-edit fields
if (entry.getVascFrontendData().getVascFrontendHelper().renderCreate(field) == false &
entry.getVascFrontendData().getVascEntryState().isEditCreate()) {
return error;
}
if (entry.getVascFrontendData().getVascFrontendHelper().renderEditReadOnly(field) &
entry.getVascFrontendData().getVascEntryState().isEditCreate()==false) {
return error;
}
try {
Object objectSelected = entry.getVascFrontendData().getVascEntryState().getEntryDataObject();
Object objectValue = field.getVascEntryFieldValue().getValue(field, objectSelected);
for (VascEntryFieldValidatorService s:entry.getVascFrontendData().getVascValidatorServices()) {
error.addAll(s.validateObjectField(field, objectSelected, objectValue));
}
} catch (VascException e) {
handleException(entry, e);
}
return error;
}
/**
*
*/
public boolean validateAndSetErrorText(VascEntry entry) {
boolean hadError = false;
for (VascEntryField field:entry.getVascEntryFields()) {
VascUIComponent comp = entry.getVascFrontendData().getFieldVascUIComponent(field);
List<String> error = validateObjectField(field);
logger.info("Check field: "+field.getId()+" comp: "+comp+" Errors: "+error.size());
if (error.isEmpty()) {
if (comp!=null) {
comp.setErrorText(null);
}
continue;
}
if (comp==null) {
logger.warning("Field: "+field.getId()+" gives errors but no UI component to display.");
continue;
}
hadError=true;
StringBuffer buf = new StringBuffer(100);
for (String s:error) {
buf.append(s);
buf.append('\n');
}
comp.setErrorText(buf.toString());
}
return hadError;
}
public void editReadOnlyUIComponents(VascEntry entry) {
// reset edit read only
for (VascEntryField f:entry.getVascEntryFields()) {
if (entry.getVascFrontendData().getFieldVascUIComponent(f)==null) {
continue;
}
// TODO: move back to rendered when jsf fixes
if (entry.getVascFrontendData().getVascFrontendHelper().renderCreate(f) == false &
entry.getVascFrontendData().getVascEntryState().isEditCreate()) {
//entry.getVascFrontendData().getFieldVascUIComponent(f).setRendered(false);
entry.getVascFrontendData().getFieldVascUIComponent(f).setDisabled(true);
} else {
//entry.getVascFrontendData().getFieldVascUIComponent(f).setRendered(true);
entry.getVascFrontendData().getFieldVascUIComponent(f).setDisabled(false);
}
// only when editing set edit readonlys
if (entry.getVascFrontendData().getVascFrontendHelper().renderEditReadOnly(f) &
entry.getVascFrontendData().getVascEntryState().isEditCreate()==false) {
entry.getVascFrontendData().getFieldVascUIComponent(f).setDisabled(true);
} else {
if (entry.getVascFrontendData().getVascEntryState().isEditCreate()==false) { // todo: remove when jsf fixes
entry.getVascFrontendData().getFieldVascUIComponent(f).setDisabled(false);
}
}
}
}
public void sortAction(VascEntry entry,VascEntryField field) {
String curSort = entry.getVascFrontendData().getVascEntryState().getVascBackendState().getSortField();
if (field.getBackendName().equals(curSort)) {
entry.getVascFrontendData().getVascEntryState().getVascBackendState().setSortAscending(!entry.getVascFrontendData().getVascEntryState().getVascBackendState().isSortAscending());
}
String sortID = field.getBackendName();
entry.getVascFrontendData().getVascEntryState().getVascBackendState().setSortField(sortID);
entry.getVascFrontendData().getVascEntryState().getVascBackendState().setPageIndex(0);
fireVascEvent(entry,VascEntryFrontendEventListener.VascFrontendEventType.DATA_SORT, field);
refreshData(entry);
}
public void searchAction(VascEntry entry,String searchString) {
entry.getVascFrontendData().getVascEntryState().getVascBackendState().setSearchString(searchString);
entry.getVascFrontendData().getVascEntryState().getVascBackendState().setSortField(null);
entry.getVascFrontendData().getVascEntryState().getVascBackendState().setPageIndex(0);
fireVascEvent(entry,VascEntryFrontendEventListener.VascFrontendEventType.DATA_SEARCH, searchString);
refreshData(entry);
}
public void pageAction(VascEntry entry,Integer pageIndex) {
if (pageIndex<1) {
pageIndex = 0;
}
Long total = entry.getVascFrontendData().getVascEntryState().getTotalBackendRecords(); // note: total is only null when pageAction is done before first refresh, which should never happen anyway.
if (total!=null && pageIndex>(total/entry.getVascFrontendData().getVascEntryState().getVascBackendState().getPageSize())) {
pageIndex = new Long(total/entry.getVascFrontendData().getVascEntryState().getVascBackendState().getPageSize()).intValue();
}
entry.getVascFrontendData().getVascEntryState().getVascBackendState().setPageIndex(pageIndex);
fireVascEvent(entry,VascEntryFrontendEventListener.VascFrontendEventType.DATA_PAGE, pageIndex);
// lets load data;
refreshData(entry);
}
public void moveAction(VascEntry entry,Object record,boolean moveUp) {
if (entry.getVascFrontendData().getVascEntryState().getVascBackend().isRecordMoveable()) {
try {
VascEntryField p = entry.getVascEntryFieldById(entry.getPrimaryKeyFieldId());
Object primaryId = p.getVascEntryFieldValue().getValue(p, record);
if (moveUp) {
entry.getVascFrontendData().getVascEntryState().getVascBackend().doRecordMoveUpById(entry.getVascFrontendData().getVascEntryState().getVascBackendState(),primaryId);
} else {
entry.getVascFrontendData().getVascEntryState().getVascBackend().doRecordMoveDownById(entry.getVascFrontendData().getVascEntryState().getVascBackendState(),primaryId);
}
} catch (Exception e) {
handleException(entry, e);
}
// lets load data;
refreshData(entry);
}
}
public List<RowVascAction> getMultiRowActions(VascEntry entry) {
List<RowVascAction> result = new ArrayList<RowVascAction>(5);
for (RowVascAction a:entry.getRowActions()) {
if (a.isMultiRowAction()) {
result.add(a);
}
}
return result;
}
}

View file

@ -0,0 +1,161 @@
/*
* Copyright 2004-2008 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. 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 IDCA 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 IDCA 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.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.impl;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import com.idcanet.vasc.core.VascLinkEntry;
import com.idcanet.vasc.core.VascLinkEntryType;
/**
* The DefaultVascLinkEntry
*
* @author Willem Cazander
* @version 1.0 Oct 27, 2007
*/
public class DefaultVascLinkEntry implements VascLinkEntry {
private static final long serialVersionUID = 1L;
private String id = null;
private String vascEntryId = null;
private Map<String,String> entryParameterFieldIds = new HashMap<String,String>(3);
private Map<String,String> entryCreateFieldValues = new HashMap<String,String>(3);
private VascLinkEntryType vascLinkEntryType = null;
private String doActionId = null;
private String name = null;
/**
* @return the id
*/
public String getId() {
return id;
}
/**
* @param id the id to set
*/
public void setId(String id) {
this.id = id;
}
public String getEntryParameterFieldId(String parameterName) {
return entryParameterFieldIds.get(parameterName);
}
public void addEntryParameterFieldId(String parameterName,String valueFieldId) {
entryParameterFieldIds.put(parameterName, valueFieldId);
}
public List<String> getEntryParameterFieldIdKeys() {
return new ArrayList<String>(entryParameterFieldIds.keySet());
}
public String getEntryCreateFieldValue(String valueFieldId) {
return entryCreateFieldValues.get(valueFieldId);
}
public void addEntryCreateFieldValue(String valueFieldId,String selectedFieldId) {
entryCreateFieldValues.put(valueFieldId, selectedFieldId);
}
public List<String> getEntryCreateFieldValueKeys() {
return new ArrayList<String>(entryCreateFieldValues.keySet());
}
/**
* @return the vascEntryId
*/
public String getVascEntryId() {
return vascEntryId;
}
/**
* @param vascEntryId the vascEntryId to set
*/
public void setVascEntryId(String vascEntryId) {
this.vascEntryId = vascEntryId;
}
/**
* @return the vascLinkEntryType
*/
public VascLinkEntryType getVascLinkEntryType() {
return vascLinkEntryType;
}
/**
* @param vascLinkEntryType the vascLinkEntryType to set
*/
public void setVascLinkEntryType(VascLinkEntryType vascLinkEntryType) {
this.vascLinkEntryType = vascLinkEntryType;
}
/**
* @return the doActionId
*/
public String getDoActionId() {
return doActionId;
}
/**
* @param doActionId the doActionId to set
*/
public void setDoActionId(String doActionId) {
this.doActionId = doActionId;
}
/**
* @return the name
*/
public String getName() {
return name;
}
/**
* @param name the name to set
*/
public void setName(String name) {
this.name = name;
}
/**
* @see java.lang.Object#clone()
*/
@Override
public VascLinkEntry clone() throws CloneNotSupportedException {
DefaultVascLinkEntry result = new DefaultVascLinkEntry();
result.doActionId=doActionId;
result.vascLinkEntryType=vascLinkEntryType;
result.vascEntryId=vascEntryId;
result.entryParameterFieldIds=entryParameterFieldIds;
result.entryCreateFieldValues=entryCreateFieldValues;
result.id=id;
result.name=name;
return result;
}
}

View file

@ -0,0 +1,293 @@
/*
* Copyright 2004-2008 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. 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 IDCA 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 IDCA 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.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.impl;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import com.idcanet.vasc.core.VascBackend;
import com.idcanet.vasc.core.VascBackendState;
import com.idcanet.vasc.core.VascEntry;
import com.idcanet.vasc.core.VascEntryField;
import com.idcanet.vasc.core.VascException;
import com.idcanet.vasc.core.entry.VascEntryFieldValue;
import com.idcanet.vasc.core.ui.VascSelectItem;
import com.idcanet.vasc.core.ui.VascSelectItemModel;
/**
* The DefaultVascSelectItemModel
*
* @author Willem Cazander
* @version 1.0 Oct 27, 2007
*/
public class DefaultVascSelectItemModel implements VascSelectItemModel {
private static final long serialVersionUID = 1L;
private String entryId = null;
private String keyFieldId = null;
private String displayFieldId = null;
private String nullLabel = null;
private String nullKeyValue = null;
private Boolean returnKeyValue = null;
private Map<String,String> entryParameterFieldIds = new HashMap<String,String>(3);
private Boolean useParentFields = null;
/**
* @see com.idcanet.vasc.core.ui.VascSelectItemModel#getVascSelectItems(com.idcanet.vasc.core.VascEntry)
*/
public List<VascSelectItem> getVascSelectItems(VascEntry currentEntry) throws VascException {
List<VascSelectItem> result = new ArrayList<VascSelectItem>(100);
VascEntry entry = currentEntry.getVascFrontendData().getVascController().getVascEntryController().getVascEntryById(entryId);
if (keyFieldId==null) {
keyFieldId = entry.getPrimaryKeyFieldId();
}
VascEntryField key = entry.getVascEntryFieldById(keyFieldId);
if (displayFieldId==null) {
displayFieldId = entry.getDisplayNameFieldId();
}
VascEntryField dis = entry.getVascEntryFieldById(displayFieldId);
if (key==null) {
throw new VascException("Could not find: "+keyFieldId+" from: "+entry.getId());
}
if (dis==null) {
throw new VascException("Could not find: "+displayFieldId+" from: "+entry.getId());
}
// set frontend data for new clone, we need te get better lifecycle management for stats/entry/etc
entry.setVascFrontendData(currentEntry.getVascFrontendData());
VascBackend back = DefaultVascFactory.getProxyVascBackend(entry);
try {
if (nullLabel!=null) {
if (nullKeyValue==null) {
nullKeyValue = "null";
}
nullLabel = currentEntry.getVascFrontendData().getVascEntryResourceResolver().getTextValue(nullLabel);
VascSelectItem item = new VascSelectItem(nullLabel,null,nullKeyValue);
result.add(item);
}
// set def para
VascBackendState state = new DefaultVascBackendState();
for (String key2:entry.getEntryParameterKeys()) {
Object value = entry.getEntryParameter(key2);
//System.out.println("Copy paras name: "+key2+" value: "+value+" class: "+value.getClass().getName());
state.setDataParameter(key2, value);
}
// set list para
for (VascEntryField vef:entry.getListOptions()) {
Object def = vef.getDefaultValue();
if (def==null) {
continue;
}
String backendName = vef.getBackendName();
state.setDataParameter(backendName, def);
}
// set para from parent state entry
for (String paraName:entryParameterFieldIds.keySet()) {
VascEntry fieldEntry = currentEntry;
if (useParentFields!=null && useParentFields==true) {
if (currentEntry.getVascFrontendData().getVascEntryState().getParent()==null) {
throw new IllegalStateException("Requested to use parent state field values but no parent state found.");
}
fieldEntry = currentEntry.getVascFrontendData().getVascEntryState().getParent().getVascEntry();
}
String paraValueId = entryParameterFieldIds.get(paraName);
VascEntryField fieldOrg = fieldEntry.getVascEntryFieldById(paraValueId);
if (fieldOrg==null) {
//System.out.println("could not find field: "+paraValueId);
continue;
}
VascEntryField field = fieldOrg.clone();
field.getVascValidators().clear();
VascEntryFieldValue v = fieldEntry.getVascFrontendData().getVascEntryState().getVascBackend().provideVascEntryFieldValue(field);
Object record = fieldEntry.getVascFrontendData().getVascEntryState().getEntryDataObject();
if (record==null) {
//System.out.println("could not get selected records from state.");
continue;
}
Object value = v.getValue(fieldOrg, record);
//System.out.println("Set entry paras name: "+paraName+" value: "+value+" class: "+value.getClass().getName());
state.setDataParameter(paraName, value);
}
// TODO: FIX >>>>>>>>>>>>>>>>>>
if (key.getVascEntryFieldValue()==null) {
// TODO: fix this for better remote support
VascEntryField fieldClone = key.clone();
fieldClone.getVascValidators().clear();
VascEntryFieldValue v = currentEntry.getVascFrontendData().getVascEntryState().getVascBackend().provideVascEntryFieldValue(fieldClone);
key.setVascEntryFieldValue(v);
}
if (dis.getVascEntryFieldValue()==null) {
// TODO: fix this for better remote support
VascEntryField fieldClone = dis.clone();
fieldClone.getVascValidators().clear();
VascEntryFieldValue v = currentEntry.getVascFrontendData().getVascEntryState().getVascBackend().provideVascEntryFieldValue(fieldClone);
dis.setVascEntryFieldValue(v);
}
// execute
for (Object o:back.execute(state)) {
Object keyId = key.getVascEntryFieldValue().getValue(key, o);
String nameId = dis.getVascEntryFieldValue().getDisplayValue(dis, o);
if (returnKeyValue!=null && true==returnKeyValue) {
VascSelectItem item = new VascSelectItem(nameId,keyId,""+keyId);
result.add(item);
} else {
VascSelectItem item = new VascSelectItem(nameId,o,""+keyId);
result.add(item);
}
}
} catch (Exception e) {
throw new VascException(e);
}
return result;
}
/**
* @return the entryId
*/
public String getEntryId() {
return entryId;
}
/**
* @param entryId the entryId to set
*/
public void setEntryId(String entryId) {
this.entryId = entryId;
}
/**
* @return the keyFieldId
*/
public String getKeyFieldId() {
return keyFieldId;
}
/**
* @param keyFieldId the keyFieldId to set
*/
public void setKeyFieldId(String keyFieldId) {
this.keyFieldId = keyFieldId;
}
/**
* @return the displayFieldId
*/
public String getDisplayFieldId() {
return displayFieldId;
}
/**
* @param displayFieldId the displayFieldId to set
*/
public void setDisplayFieldId(String displayFieldId) {
this.displayFieldId = displayFieldId;
}
/**
* @return the nullLabel
*/
public String getNullLabel() {
return nullLabel;
}
/**
* @param nullLabel the nullLabel to set
*/
public void setNullLabel(String nullLabel) {
this.nullLabel = nullLabel;
}
/**
* @return the nullKeyValue
*/
public String getNullKeyValue() {
return nullKeyValue;
}
/**
* @param nullKeyValue the nullKeyValue to set
*/
public void setNullKeyValue(String nullKeyValue) {
this.nullKeyValue = nullKeyValue;
}
/**
* @return the returnKeyValue
*/
public Boolean getReturnKeyValue() {
return returnKeyValue;
}
/**
* @param returnKeyValue the returnKeyValue to set
*/
public void setReturnKeyValue(Boolean returnKeyValue) {
this.returnKeyValue = returnKeyValue;
}
public String getEntryParameterFieldId(String parameterName) {
return entryParameterFieldIds.get(parameterName);
}
public void addEntryParameterFieldId(String parameterName,String valueFieldId) {
entryParameterFieldIds.put(parameterName, valueFieldId);
}
public List<String> getEntryParameterFieldIdKeys() {
return new ArrayList<String>(entryParameterFieldIds.keySet());
}
/**
* @return the useParentFields
*/
public Boolean getUseParentFields() {
return useParentFields;
}
/**
* @param useParentFields the useParentFields to set
*/
public void setUseParentFields(Boolean useParentFields) {
this.useParentFields = useParentFields;
}
}

View file

@ -0,0 +1,106 @@
/*
* Copyright 2004-2007 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. 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 IDCA 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 IDCA 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.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.impl;
import java.util.ArrayList;
import java.util.List;
import com.idcanet.vasc.core.VascUserRoleController;
/**
* Simple default user controller for wrapping user info into vasc
*
*
* @author Willem Cazander
* @version 1.0 Mar 13, 2009
*/
public class DefaultVascUserRoleController implements VascUserRoleController {
private Long userId = null;
private String userName = null;
private List<String> userRoles = null;
public DefaultVascUserRoleController(Long userId,String userName) {
if (userId==null) {
throw new NullPointerException("userId may not be null.");
}
if (userName==null) {
throw new NullPointerException("userName may not be null");
}
this.userId=userId;
this.userName=userName;
userRoles = new ArrayList<String>(10);
}
public DefaultVascUserRoleController(Long userId,String userName,String...roles) {
this(userId,userName);
for (String role:roles) {
userRoles.add(role);
}
}
/**
* @see com.idcanet.vasc.core.VascUserRoleController#getUserId()
*/
public Long getUserId() {
return userId;
}
/**
* @see com.idcanet.vasc.core.VascUserRoleController#getUserName()
*/
public String getUserName() {
return userName;
}
/**
* @see com.idcanet.vasc.core.VascUserRoleController#getUserRoles()
*/
public List<String> getUserRoles() {
return userRoles;
}
/**
* @see com.idcanet.vasc.core.VascUserRoleController#hasRole(java.lang.String)
*/
public boolean hasRole(String roles) {
if (roles==null) {
return false;
}
// input: admin|superAdmin
// input: (admin|superAdmin)&login
String[] r = roles.split("|");
for (String rr:r) {
if (userRoles.contains(rr)) {
return true;
}
}
return false;
}
}

View file

@ -0,0 +1,103 @@
/*
* Copyright 2004-2008 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. 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 IDCA 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 IDCA 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.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.impl;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import com.idcanet.vasc.core.AbstractVascBackendProxy;
import com.idcanet.vasc.core.VascBackend;
import com.idcanet.vasc.core.VascBackendState;
import com.idcanet.vasc.core.VascEntry;
import com.idcanet.vasc.core.VascException;
/**
* Does simple caching for the data.
*
* @author Willem Cazander
* @version 1.0 Nov 19, 2009
*/
public class VascBackendProxyCache extends AbstractVascBackendProxy {
private Long records = null;
private List<Object> data = null;
private String dataSearchString = null;
private Map<String,Object> dataState = null;
public VascBackendProxyCache(VascBackend backend,VascEntry entry) {
super(backend);
dataState = new HashMap<String,Object>(10);
}
private boolean isStateChanged(VascBackendState state) {
boolean changed = false;
for (String key:state.getDataParameterKeys()) {
Object value = state.getDataParameter(key);
Object valueLast = dataState.get(key);
dataState.put(key, value);
if (value==null & valueLast==null) {
continue;
}
if (value==null & valueLast!=null) {
changed = true;
break;
}
if (value.equals(valueLast)==false) {
changed = true;
break;
}
}
if (state.getSearchString()!=null && state.getSearchString().equals(dataSearchString)==false) {
changed = true;
}
dataSearchString = state.getSearchString();
return changed;
}
/**
* @see com.idcanet.vasc.core.VascBackend#execute(VascBackendState state)
*/
@Override
public List<Object> execute(VascBackendState state) throws VascException {
boolean changed = isStateChanged(state);
if (data==null | changed) {
data = backend.execute(state);
}
return data;
}
@Override
public long fetchTotalExecuteSize(VascBackendState state) {
boolean changed = isStateChanged(state);
if (records==null | changed) {
records = backend.fetchTotalExecuteSize(state);
}
return records;
}
}

View file

@ -0,0 +1,80 @@
/*
* Copyright 2004-2008 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. 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 IDCA 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 IDCA 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.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.impl;
import java.util.ArrayList;
import java.util.List;
import com.idcanet.vasc.core.AbstractVascBackendProxy;
import com.idcanet.vasc.core.VascBackend;
import com.idcanet.vasc.core.VascBackendFilter;
import com.idcanet.vasc.core.VascBackendState;
import com.idcanet.vasc.core.VascEntry;
import com.idcanet.vasc.core.VascException;
/**
* Simple filter support
*
* @author Willem Cazander
* @version 1.0 Oct 27, 2007
*/
public class VascBackendProxyFilter extends AbstractVascBackendProxy {
private long records = 0;
private VascBackendFilter filter = null;
public VascBackendProxyFilter(VascBackend backend,VascEntry entry,VascBackendFilter filter) {
super(backend);
this.filter=filter;
}
/**
* @see com.idcanet.vasc.core.VascBackend#execute(VascBackendState state)
*/
@Override
public List<Object> execute(VascBackendState state) throws VascException {
List<Object> result = backend.execute(state);
if (filter==null) {
return result;
}
List<Object> search = new ArrayList<Object>(result.size()/2);
for (Object o:result) {
Object r = filter.filterObject(o);
if (r!=null) {
search.add(r);
}
}
records = search.size();
return search;
}
@Override
public long fetchTotalExecuteSize(VascBackendState state) {
return records;
}
}

View file

@ -0,0 +1,90 @@
/*
* Copyright 2004-2008 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. 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 IDCA 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 IDCA 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.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.impl;
import java.util.ArrayList;
import java.util.List;
import com.idcanet.vasc.core.AbstractVascBackendProxy;
import com.idcanet.vasc.core.VascBackend;
import com.idcanet.vasc.core.VascBackendState;
import com.idcanet.vasc.core.VascEntry;
import com.idcanet.vasc.core.VascException;
/**
* Simulates a real pages backend.
*
* @author Willem Cazander
* @version 1.0 Oct 27, 2007
*/
public class VascBackendProxyPaged extends AbstractVascBackendProxy {
private long records = 0;
public VascBackendProxyPaged(VascBackend backend,VascEntry entry) {
super(backend);
}
/**
* @see com.idcanet.vasc.core.VascBackend#isPageable()
*/
@Override
public boolean isPageable() {
return true;
}
/**
* @see com.idcanet.vasc.core.VascBackend#execute(VascBackendState state)
*/
@Override
public List<Object> execute(VascBackendState state) throws VascException {
List<Object> allData = backend.execute(state);
int pageSize = state.getPageSize();
if (pageSize==0) {
records = allData.size();
return allData;
}
List<Object> paged = new ArrayList<Object>(state.getPageSize());
int off = state.getPageIndex()*pageSize;
int offMax = off+state.getPageSize();
for (int i=off;i<offMax;i++) {
if (i>=allData.size()) {
break;
}
Object o = allData.get(i);
paged.add(o);
}
records = allData.size();
return paged;
}
@Override
public long fetchTotalExecuteSize(VascBackendState state) {
return records;
}
}

View file

@ -0,0 +1,125 @@
/*
* Copyright 2004-2008 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. 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 IDCA 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 IDCA 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.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.impl;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.util.Set;
import com.idcanet.vasc.core.AbstractVascBackendProxy;
import com.idcanet.vasc.core.VascBackend;
import com.idcanet.vasc.core.VascBackendState;
import com.idcanet.vasc.core.VascEntry;
import com.idcanet.vasc.core.VascException;
/**
* Simple text search
*
* @author Willem Cazander
* @version 1.0 Oct 27, 2007
*/
public class VascBackendProxySearch extends AbstractVascBackendProxy {
private long records = 0;
public VascBackendProxySearch(VascBackend backend,VascEntry entry) {
super(backend);
}
/**
* @see com.idcanet.vasc.core.VascBackend#isSearchable()
*/
@Override
public boolean isSearchable() {
return true;
}
/**
* @see com.idcanet.vasc.core.VascBackend#execute(VascBackendState state)
*/
@Override
public List<Object> execute(VascBackendState state) throws VascException {
List<Object> result = backend.execute(state);
if (state.getSearchString()==null) {
if (backend.isPageable()) {
records = backend.fetchTotalExecuteSize(state);
} else {
records = result.size();
}
return result;
}
String searchString = state.getSearchString().toLowerCase();
List<Object> search = new ArrayList<Object>(result.size()/4);
for (Object o:result) {
for (Method method:o.getClass().getMethods()) {
if (method.getName().startsWith("get")==false) { //a bit durty
continue;
}
if (method.getName().equals("getClass")) {
continue;
}
if (method.getReturnType().isAssignableFrom(Collection.class)) {
continue;
}
if (method.getReturnType().isAssignableFrom(List.class)) {
continue;
}
if (method.getReturnType().isAssignableFrom(Set.class)) {
continue;
}
if (method.getReturnType().isAssignableFrom(Map.class)) {
continue;
}
Object res;
try {
res = method.invoke(o,new Object[]{});
} catch (Exception e) {
throw new VascException(e);
}
if (res==null) {
continue;
}
String r = res.toString().toLowerCase();
if (r.contains(searchString)) {
search.add(o);
break;
}
}
}
records = search.size();
return search;
}
@Override
public long fetchTotalExecuteSize(VascBackendState state) {
return records;
}
}

View file

@ -0,0 +1,127 @@
/*
* Copyright 2004-2008 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. 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 IDCA 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 IDCA 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.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.impl;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import com.idcanet.vasc.core.AbstractVascBackendProxy;
import com.idcanet.vasc.core.VascBackend;
import com.idcanet.vasc.core.VascBackendState;
import com.idcanet.vasc.core.VascEntry;
import com.idcanet.vasc.core.VascEntryField;
import com.idcanet.vasc.core.VascException;
import com.idcanet.vasc.core.entry.VascEntryFieldValue;
/**
* Add an sortware sort an a backend
*
* @author Willem Cazander
* @version 1.0 Oct 27, 2007
*/
public class VascBackendProxySort extends AbstractVascBackendProxy {
private VascEntry entry = null;
public VascBackendProxySort(VascBackend backend,VascEntry entry) {
super(backend);
this.entry=entry;
}
// sort stuff
/**
* @see com.idcanet.vasc.core.VascBackend#execute(VascBackendState state)
*/
@SuppressWarnings("unchecked")
@Override
public List<Object> execute(final VascBackendState state) throws VascException {
List<Object> result = backend.execute(state);
if (state.getSortField()==null) {
return result;
}
try {
final VascEntryField field = entry.getVascEntryFieldById(state.getSortField());
final VascEntryFieldValue fieldValue = backend.provideVascEntryFieldValue(field.clone());
Collections.sort(result, new Comparator() {
public int compare(Object o1, Object o2) {
try {
Comparable c1 = null;
Comparable c2 = null;
if (field.getDisplayName()!=null) {
c1 = (Comparable)fieldValue.getDisplayValue(field, o1);
c2 = (Comparable)fieldValue.getDisplayValue(field, o2);
} else {
c1 = (Comparable)fieldValue.getValue(field, o1);
c2 = (Comparable)fieldValue.getValue(field, o2);
}
if (c1==null & c2==null) {
return 0;
}
if (c1==null) {
if (state.isSortAscending()) {
return 1;
} else {
return -1;
}
}
if (c2==null) {
if (state.isSortAscending()) {
return -1;
} else {
return 1;
}
}
if (c1 instanceof String & c2 instanceof String) {
c1 = ((String)c1).toLowerCase();
c2 = ((String)c2).toLowerCase();
}
if (state.isSortAscending()) {
return c1.compareTo(c2);
} else {
return c2.compareTo(c1);
}
} catch (VascException e) {
e.printStackTrace();
return 0;
}
}
});
} catch (CloneNotSupportedException e1) {
throw new VascException(e1);
} // TODO: check serialable stuff again
return result;
}
}

View file

@ -0,0 +1,163 @@
/*
* Copyright 2004-2008 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. 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 IDCA 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 IDCA 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.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.impl;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import com.idcanet.vasc.core.AbstractVascBackendProxy;
import com.idcanet.vasc.core.VascBackend;
import com.idcanet.vasc.core.VascBackendState;
import com.idcanet.vasc.core.VascEntry;
import com.idcanet.vasc.core.VascException;
/**
* Does simple caching for the data.
*
* @author Willem Cazander
* @version 1.0 Nov 19, 2009
*/
public class VascBackendProxyTimerLogger extends AbstractVascBackendProxy {
protected Logger logger = null;
protected Level logLevel = Level.INFO;
public VascBackendProxyTimerLogger(VascBackend backend,VascEntry entry) {
super(backend);
logger = Logger.getLogger(VascBackendProxyTimerLogger.class.getName());
}
/**
* @see com.idcanet.vasc.core.VascBackend#execute(VascBackendState state)
*/
@Override
public List<Object> execute(VascBackendState state) throws VascException {
long t1 = System.currentTimeMillis();
try {
return backend.execute(state);
} finally {
long t2 = System.currentTimeMillis();
logger.log(logLevel,"vasc-execute backend: "+getId()+" in "+(t2-t1)+" ms");
}
}
@Override
public long fetchTotalExecuteSize(VascBackendState state) {
long t1 = System.currentTimeMillis();
try {
return backend.fetchTotalExecuteSize(state);
} finally {
long t2 = System.currentTimeMillis();
logger.log(logLevel,"vasc-fetchTotalExecuteSize backend: "+getId()+" in "+(t2-t1)+" ms");
}
}
/**
* @see com.idcanet.vasc.core.AbstractVascBackendProxy#doRecordMoveDownById(com.idcanet.vasc.core.VascBackendState, java.lang.Object)
*/
@Override
public long doRecordMoveDownById(VascBackendState state, Object primaryId) throws VascException {
long t1 = System.currentTimeMillis();
try {
return backend.doRecordMoveDownById(state, primaryId);
} finally {
long t2 = System.currentTimeMillis();
logger.log(logLevel,"vasc-doRecordMoveDownById backend: "+getId()+" in "+(t2-t1)+" ms");
}
}
/**
* @see com.idcanet.vasc.core.AbstractVascBackendProxy#doRecordMoveUpById(com.idcanet.vasc.core.VascBackendState, java.lang.Object)
*/
@Override
public long doRecordMoveUpById(VascBackendState state, Object primaryId) throws VascException {
long t1 = System.currentTimeMillis();
try {
return backend.doRecordMoveUpById(state, primaryId);
} finally {
long t2 = System.currentTimeMillis();
logger.log(logLevel,"vasc-doRecordMoveUpById backend: "+getId()+" in "+(t2-t1)+" ms");
}
}
/**
* @see com.idcanet.vasc.core.AbstractVascBackendProxy#delete(java.lang.Object)
*/
@Override
public void delete(Object object) throws VascException {
long t1 = System.currentTimeMillis();
try {
backend.delete(object);
} finally {
long t2 = System.currentTimeMillis();
logger.log(logLevel,"vasc-delete backend: "+getId()+" in "+(t2-t1)+" ms");
}
}
/**
* @see com.idcanet.vasc.core.AbstractVascBackendProxy#merge(java.lang.Object)
*/
@Override
public Object merge(Object object) throws VascException {
long t1 = System.currentTimeMillis();
try {
return backend.merge(object);
} finally {
long t2 = System.currentTimeMillis();
logger.log(logLevel,"vasc-merge backend: "+getId()+" in "+(t2-t1)+" ms");
}
}
/**
* @see com.idcanet.vasc.core.AbstractVascBackendProxy#persist(java.lang.Object)
*/
@Override
public void persist(Object object) throws VascException {
long t1 = System.currentTimeMillis();
try {
backend.persist(object);
} finally {
long t2 = System.currentTimeMillis();
logger.log(logLevel,"vasc-persist backend: "+getId()+" in "+(t2-t1)+" ms");
}
}
/**
* @return the logLevel
*/
public Level getLogLevel() {
return logLevel;
}
/**
* @param logLevel the logLevel to set
*/
public void setLogLevel(Level logLevel) {
this.logLevel = logLevel;
}
}

View file

@ -0,0 +1,61 @@
/*
* Copyright 2004-2007 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. 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 IDCA 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 IDCA 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.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.impl.actions;
import com.idcanet.vasc.core.VascEntry;
import com.idcanet.vasc.core.actions.AbstractVascAction;
import com.idcanet.vasc.core.actions.RowVascAction;
/**
*
* @author Willem Cazander
* @version 1.0 Mar 30, 2007
*/
public class AddRowAction extends AbstractVascAction implements RowVascAction {
private static final long serialVersionUID = 1L;
static public final String ACTION_ID = "addRowAction";
protected String getActionId() {
return ACTION_ID;
}
public void doRowAction(VascEntry entry,Object rowObject) throws Exception {
entry.getVascFrontendData().getVascEntryState().setEditCreate(true);
Object object = entry.getVascFrontendData().getVascFrontendHelper().createObject(entry);
entry.getVascFrontendData().getVascEntryState().setEntryDataObject(object);
entry.getVascFrontendData().getVascFrontend().renderEdit();
}
/**
* @see com.idcanet.vasc.core.actions.RowVascAction#isMultiRowAction()
*/
public boolean isMultiRowAction() {
return false;
}
}

View file

@ -0,0 +1,94 @@
/*
* Copyright 2004-2007 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. 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 IDCA 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 IDCA 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.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.impl.actions;
import java.io.OutputStream;
import java.io.PrintWriter;
import com.idcanet.vasc.core.entry.VascEntryExporter;
import com.idcanet.vasc.core.VascEntry;
import com.idcanet.vasc.core.VascEntryField;
import com.idcanet.vasc.core.VascException;
import com.idcanet.vasc.core.actions.AbstractVascAction;
import com.idcanet.vasc.core.actions.GlobalVascAction;
/**
*
* @author Willem Cazander
* @version 1.0 Mar 30, 2007
*/
public class CSVExportGlobalAction extends AbstractVascAction implements GlobalVascAction,VascEntryExporter {
private static final long serialVersionUID = -3951608685719832654L;
static public final String ACTION_ID = "csvExportAction";
protected String getActionId() {
return ACTION_ID;
}
public void doGlobalAction(VascEntry entry) throws Exception {
entry.getVascFrontendData().getVascFrontend().renderExport(this);
}
public void doExport(OutputStream out,VascEntry entry) throws VascException {
PrintWriter p = new PrintWriter(out);
p.write("# csv\n");
for (VascEntryField c:entry.getVascEntryFields()) {
p.write(c.getId()+"\t");
}
p.write("\n");
int oldIndex = entry.getVascFrontendData().getVascEntryState().getVascBackendState().getPageIndex();
Long total = entry.getVascFrontendData().getVascEntryState().getTotalBackendRecords();
int pages = total.intValue()/entry.getVascFrontendData().getVascEntryState().getVascBackendState().getPageSize();
for (int page=0;page<=pages;page++) {
entry.getVascFrontendData().getVascEntryState().getVascBackendState().setPageIndex(page);
entry.getVascFrontendData().getVascFrontendHelper().refreshData(entry);
for (Object o:entry.getVascFrontendData().getVascEntryState().getEntryDataList()) {
for (VascEntryField c:entry.getVascEntryFields()) {
p.write(c.getVascEntryFieldValue().getDisplayValue(c, o)+"\t");
}
p.write("\n");
p.flush();
}
}
p.write("# end\n");
p.flush();
// restore old page size
entry.getVascFrontendData().getVascEntryState().getVascBackendState().setPageIndex(oldIndex);
}
public String getMineType() {
return "text/csv";
}
public String getType() {
return "csv";
}
}

View file

@ -0,0 +1,61 @@
/*
* Copyright 2004-2007 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. 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 IDCA 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 IDCA 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.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.impl.actions;
import com.idcanet.vasc.core.VascEntry;
import com.idcanet.vasc.core.actions.AbstractVascAction;
import com.idcanet.vasc.core.actions.RowVascAction;
/**
*
* @author Willem Cazander
* @version 1.0 Mar 30, 2007
*/
public class DeleteRowAction extends AbstractVascAction implements RowVascAction {
private static final long serialVersionUID = 1L;
static public final String ACTION_ID = "deleteRowAction";
protected String getActionId() {
return ACTION_ID;
}
public void doRowAction(VascEntry entry,Object rowObject) throws Exception {
if (rowObject==null) {
return; // nothing selected
}
entry.getVascFrontendData().getVascEntryState().setEntryDataObject(rowObject);
entry.getVascFrontendData().getVascFrontend().renderDelete();
}
/**
* @see com.idcanet.vasc.core.actions.RowVascAction#isMultiRowAction()
*/
public boolean isMultiRowAction() {
return true;
}
}

View file

@ -0,0 +1,66 @@
/*
* Copyright 2004-2007 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. 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 IDCA 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 IDCA 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.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.impl.actions;
import com.idcanet.vasc.core.VascEntry;
import com.idcanet.vasc.core.actions.AbstractVascAction;
import com.idcanet.vasc.core.actions.RowVascAction;
import com.idcanet.vasc.core.entry.VascEntryFrontendEventListener.VascFrontendEventType;
/**
*
* @author Willem Cazander
* @version 1.0 Mar 30, 2007
*/
public class EditRowAction extends AbstractVascAction implements RowVascAction {
private static final long serialVersionUID = 1L;
static public final String ACTION_ID = "editRowAction";
protected String getActionId() {
return ACTION_ID;
}
public void doRowAction(VascEntry entry,Object rowObject) throws Exception {
if (rowObject==null) {
return; // nothing selected
}
entry.getVascFrontendData().getVascEntryState().setEditCreate(false);
entry.getVascFrontendData().getVascFrontendHelper().fireVascEvent(entry, VascFrontendEventType.DATA_SELECT, rowObject);
entry.getVascFrontendData().getVascEntryState().setEntryDataObject(rowObject);
entry.getVascFrontendData().getVascFrontend().renderEdit();
}
/**
* @see com.idcanet.vasc.core.actions.RowVascAction#isMultiRowAction()
*/
public boolean isMultiRowAction() {
return false;
}
}

View file

@ -0,0 +1,51 @@
/*
* Copyright 2004-2007 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. 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 IDCA 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 IDCA 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.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.impl.actions;
import com.idcanet.vasc.core.VascEntry;
import com.idcanet.vasc.core.actions.AbstractVascAction;
import com.idcanet.vasc.core.actions.GlobalVascAction;
/**
*
* @author Willem Cazander
* @version 1.0 Apr 28, 2007
*/
public class RefreshDataGlobalAction extends AbstractVascAction implements GlobalVascAction {
private static final long serialVersionUID = 1L;
static public final String ACTION_ID = "refreshDataAction";
protected String getActionId() {
return ACTION_ID;
}
public void doGlobalAction(VascEntry entry) throws Exception {
entry.getVascFrontendData().getVascFrontendHelper().refreshData(entry); // this wil also fire the event
}
}

View file

@ -0,0 +1,93 @@
/*
* Copyright 2004-2007 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. 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 IDCA 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 IDCA 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.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.impl.actions;
import java.io.OutputStream;
import java.io.PrintWriter;
import com.idcanet.vasc.core.VascEntry;
import com.idcanet.vasc.core.VascEntryField;
import com.idcanet.vasc.core.VascException;
import com.idcanet.vasc.core.actions.AbstractVascAction;
import com.idcanet.vasc.core.actions.GlobalVascAction;
import com.idcanet.vasc.core.entry.VascEntryExporter;
/**
*
* @author Willem Cazander
* @version 1.0 Mar 30, 2007
*/
public class XMLExportGlobalAction extends AbstractVascAction implements GlobalVascAction,VascEntryExporter {
private static final long serialVersionUID = 3719424578585760828L;
static public final String ACTION_ID = "xmlExportAction";
protected String getActionId() {
return ACTION_ID;
}
public void doGlobalAction(VascEntry entry) throws Exception {
entry.getVascFrontendData().getVascFrontend().renderExport(this);
}
public void doExport(OutputStream out,VascEntry entry) throws VascException {
PrintWriter p = new PrintWriter(out);
p.write("<?xml version=\"1.0\"?>\n");
p.write("<data>\n");
int oldIndex = entry.getVascFrontendData().getVascEntryState().getVascBackendState().getPageIndex();
Long total = entry.getVascFrontendData().getVascEntryState().getTotalBackendRecords();
int pages = total.intValue()/entry.getVascFrontendData().getVascEntryState().getVascBackendState().getPageSize();
for (int page=0;page<=pages;page++) {
entry.getVascFrontendData().getVascEntryState().getVascBackendState().setPageIndex(page);
entry.getVascFrontendData().getVascFrontendHelper().refreshData(entry);
for (Object o:entry.getVascFrontendData().getVascEntryState().getEntryDataList()) {
p.write("\t<row>\n");
for (VascEntryField c:entry.getVascEntryFields()) {
p.write("\t\t<column name=\""+c.getId()+"\"><![CDATA[");
p.write(""+c.getVascEntryFieldValue().getDisplayValue(c, o));
p.write("]]></column>\n");
}
p.write("\t</row>\n");
p.flush();
}
}
p.write("</data>\n");
p.flush();
// restore old page size
entry.getVascFrontendData().getVascEntryState().getVascBackendState().setPageIndex(oldIndex);
}
public String getMineType() {
return "text/xml";
}
public String getType() {
return "xml";
}
}

View file

@ -0,0 +1,110 @@
/*
* Copyright 2004-2007 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. 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 IDCA 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 IDCA 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.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.impl.entry;
import com.idcanet.vasc.core.VascEntryField;
import com.idcanet.vasc.core.VascException;
import com.idcanet.vasc.core.entry.VascEntryFieldValue;
import com.idcanet.x4o.impl.DefaultElementObjectPropertyValue;
/**
*
* @author Willem Cazander
* @version 1.0 Mar 21, 2007
*/
public class BeanPropertyVascEntryFieldValue implements VascEntryFieldValue {
private static final long serialVersionUID = 1L;
private String property = null;
private DefaultElementObjectPropertyValue helper = null;
public BeanPropertyVascEntryFieldValue() {
helper = new DefaultElementObjectPropertyValue();
}
public BeanPropertyVascEntryFieldValue(String property) {
this();
setProperty(property);
}
/**
* @see com.idcanet.vasc.core.column.VascColumnValue#getValue(com.idcanet.vasc.core.column.VascTableColumn, java.lang.Object)
*/
public Object getValue(VascEntryField column,Object record) throws VascException {
if(getProperty()==null) {
return null;
}
if(getProperty().equals("")) {
return "";
}
try {
return helper.getProperty(record, getProperty());
} catch (Exception e) {
throw new VascException(e);
}
}
/**
* @see com.idcanet.vasc.core.entry.VascEntryFieldValue#getDisplayValue(com.idcanet.vasc.core.VascEntryField, java.lang.Object)
*/
public String getDisplayValue(VascEntryField field, Object record) throws VascException {
return ""+getValue(field,record); // not supported
}
/**
* @see com.idcanet.vasc.core.column.VascColumnValue#setValue(com.idcanet.vasc.core.column.VascTableColumn, java.lang.Object, java.lang.Object)
*/
public void setValue(VascEntryField column, Object record,Object value) throws VascException {
if(getProperty()==null) {
return;
}
if(getProperty().equals("")) {
return;
}
try {
helper.setProperty(record, getProperty(),value);
} catch (Exception e) {
throw new VascException(e);
}
}
/**
* @return the property
*/
public String getProperty() {
return property;
}
/**
* @param property the property to set
*/
public void setProperty(String property) {
this.property = property;
}
}

View file

@ -0,0 +1,59 @@
/*
* Copyright 2004-2007 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. 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 IDCA 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 IDCA 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.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.impl.entry;
import com.idcanet.vasc.core.VascEntry;
import com.idcanet.vasc.core.entry.VascEntryRecordCreator;
/**
*
* @author Willem Cazander
* @version 1.0 Mar 21, 2007
*/
public class BeanVascEntryRecordCreator implements VascEntryRecordCreator {
private static final long serialVersionUID = 1L;
private Class<?> objectClass = null;
public BeanVascEntryRecordCreator() {
}
public BeanVascEntryRecordCreator(Class<?> objectClass) {
setObjectClass(objectClass);
}
public Object newRecord(VascEntry entry) throws Exception {
return objectClass.newInstance();
}
public Class<?> getObjectClass() {
return objectClass;
}
public void setObjectClass(Class<?> objectClass) {
this.objectClass=objectClass;
}
}

View file

@ -0,0 +1,93 @@
/*
* Copyright 2004-2007 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. 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 IDCA 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 IDCA 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.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.impl.entry;
import java.text.MessageFormat;
import java.util.Locale;
import java.util.MissingResourceException;
import java.util.ResourceBundle;
import com.idcanet.vasc.core.entry.VascEntryResourceResolver;
/**
*
* @author Willem Cazander
* @version 1.0 Mar 21, 2007
*/
public class DefaultVascEntryResourceResolver implements VascEntryResourceResolver {
protected ResourceBundle resourceBundle = null;
public DefaultVascEntryResourceResolver() {
}
public DefaultVascEntryResourceResolver(ResourceBundle resourceBundle) {
setResourceBundle(resourceBundle);
}
public DefaultVascEntryResourceResolver(String baseName,Locale locale) {
this(ResourceBundle.getBundle(baseName, locale));
}
public String getTextValue(String text,Object...params) {
if (resourceBundle==null) {
return text;
}
if (text==null) {
throw new NullPointerException("Can't get null text key value.");
}
String textValue = null;
try {
textValue = resourceBundle.getString(text);
} catch (MissingResourceException mre) {
return text;
}
if (params.length>0) {
textValue = MessageFormat.format(textValue, params);
}
return textValue;
}
/**
* @return the resourceBundle
*/
public ResourceBundle getResourceBundle() {
return resourceBundle;
}
/**
* @param resourceBundle the resourceBundle to set
*/
public void setResourceBundle(ResourceBundle resourceBundle) {
if (resourceBundle==null) {
throw new NullPointerException("may not set resourceBundle to null.");
}
this.resourceBundle = resourceBundle;
}
}

View file

@ -0,0 +1,178 @@
/*
* Copyright 2004-2007 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. 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 IDCA 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 IDCA 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.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.impl.entry;
import java.io.Serializable;
import java.lang.annotation.Annotation;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.StringTokenizer;
import java.util.logging.Logger;
import org.hibernate.validator.ClassValidator;
import org.hibernate.validator.InvalidValue;
import org.hibernate.validator.MessageInterpolator;
import org.hibernate.validator.Validator;
import com.idcanet.vasc.core.VascEntry;
import com.idcanet.vasc.core.VascEntryField;
import com.idcanet.vasc.core.VascException;
import com.idcanet.vasc.core.entry.VascEntryFieldValidatorService;
/**
* Executes the hibernate field validators
*
* @author Willem Cazander
* @version 1.0 May 13, 2009
*/
public class HibernateValidatorService implements VascEntryFieldValidatorService {
private Logger logger = Logger.getLogger(HibernateValidatorService.class.getName());
@SuppressWarnings("unchecked")
public List<String> validateObjectField(VascEntryField field, Object selectedRecord,Object objectValue) throws VascException {
List<String> error = new ArrayList<String>(3);
try {
ClassValidator val = new ClassValidator(selectedRecord.getClass(),new VascHibernateMessage(field.getVascEntry()));
InvalidValue[] ival = val.getInvalidValues(selectedRecord);
logger.fine("Hiber Validating: "+ival.length);
String prop = field.getBackendName();
InvalidValue iv = findInvalidValueByProperty(ival,prop);
if(iv!=null) {
error.add(iv.getMessage());
}
} catch (Exception e) {
throw new VascException(e);
}
return error;
}
private InvalidValue findInvalidValueByProperty(InvalidValue[] ival,String property) {
for(InvalidValue iv:ival) {
if(iv.getPropertyName().equals(property)) {
return iv;
}
}
return null;
}
class VascHibernateMessage implements MessageInterpolator, Serializable {
private static final long serialVersionUID = -8241727232507976072L;
//private static final Logger log = Logger.getLogger(VascHibernateMessage.class.getName());
private Map<String, Object> annotationParameters = new HashMap<String, Object>();
private String annotationMessage;
private String interpolateMessage;
private VascEntry vascEntry;
public VascHibernateMessage(VascEntry vascEntry) {
this.vascEntry=vascEntry;
}
public void initialize(Annotation annotation, MessageInterpolator defaultInterpolator) {
Class<?> clazz = annotation.getClass();
for ( Method method : clazz.getMethods() ) {
try {
//FIXME remove non serilalization elements on writeObject?
if ( method.getReturnType() != void.class
&& method.getParameterTypes().length == 0
&& ! Modifier.isStatic( method.getModifiers() ) ) {
//cannot use an exclude list because the parameter name could match a method name
annotationParameters.put( method.getName(), method.invoke( annotation ) );
}
} catch (IllegalAccessException e) {
//really should not happen, but we degrade nicely
//log.warning( "Unable to access {}", StringHelper.qualify( clazz.toString(), method.getName() ) );
} catch (InvocationTargetException e) {
//really should not happen, but we degrade nicely
//log.warn( "Unable to access {}", StringHelper.qualify( clazz.toString(), method.getName() ) );
}
}
annotationMessage = (String) annotationParameters.get( "message" );
if (annotationMessage == null) {
throw new IllegalArgumentException( "Annotation " + clazz + " does not have an (accessible) message attribute");
}
//do not resolve the property eagerly to allow validator.apply to work wo interpolator
}
@SuppressWarnings("unchecked")
public String interpolate(String message, Validator validator, MessageInterpolator defaultInterpolator) {
if ( annotationMessage!=null && annotationMessage.equals( message ) ) {
//short cut
if (interpolateMessage == null) {
interpolateMessage = replace( annotationMessage );
}
return interpolateMessage;
} else {
//TODO keep them in a weak hash map, but this might not even be useful
return replace( message );
}
}
public String getAnnotationMessage() {
return annotationMessage;
}
private String replace(String message) {
StringTokenizer tokens = new StringTokenizer( message, "#{}", true );
StringBuilder buf = new StringBuilder( 30 );
boolean escaped = false;
boolean el = false;
while ( tokens.hasMoreTokens() ) {
String token = tokens.nextToken();
if ( !escaped && "#".equals( token ) ) {
el = true;
}
if ( !el && "{".equals( token ) ) {
escaped = true;
} else if ( escaped && "}".equals( token ) ) {
escaped = false;
} else if ( !escaped ) {
if ( "{".equals( token ) ) el = false;
buf.append( token );
} else {
Object variable = annotationParameters.get( token );
if ( variable != null ) {
buf.append( variable );
} else {
String string = vascEntry.getVascFrontendData().getVascEntryResourceResolver().getTextValue(token);
if ( string != null ) {
buf.append(replace(string));
}
}
}
}
return buf.toString();
}
}
}

View file

@ -0,0 +1,98 @@
/*
* Copyright 2004-2007 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. 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 IDCA 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 IDCA 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.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.impl.entry;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.List;
import java.util.logging.Logger;
import javax.persistence.Column;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import com.idcanet.vasc.core.VascEntryField;
import com.idcanet.vasc.core.VascException;
import com.idcanet.vasc.core.entry.VascEntryFieldValidatorService;
import com.idcanet.vasc.validators.VascObjectNotNullValidator;
import com.idcanet.vasc.validators.VascStringLengthValidator;
import com.idcanet.vasc.validators.VascValidator;
import com.idcanet.vasc.validators.VascValidatorMessages;
/**
* Scans for JPA annotations and wrap some items aroud in a vasc validator.
*
* @author Willem Cazander
* @version 1.0 May 13, 2009
*/
public class PersistanceValidatorService implements VascEntryFieldValidatorService {
private Logger logger = Logger.getLogger(PersistanceValidatorService.class.getName());
public List<String> validateObjectField(VascEntryField field, Object selectedRecord,Object objectValue) throws VascException {
List<String> error = new ArrayList<String>(3);
try {
List<VascValidator> vals = new ArrayList<VascValidator>(2);
String property = field.getBackendName();
for (Method method:selectedRecord.getClass().getMethods()) {
if (method.getName().equalsIgnoreCase("get"+property)==false) { //a bit durty
continue;
}
Column col = method.getAnnotation(Column.class);
if (col!=null) {
if (col.nullable()==false) {
Id idAnno = method.getAnnotation(Id.class);
GeneratedValue genAnno = method.getAnnotation(GeneratedValue.class);
if (idAnno!=null || genAnno!=null) {
continue; // don't add validator in JPA ID.
}
VascObjectNotNullValidator val = new VascObjectNotNullValidator();
vals.add(val);
}
// weird default 255 value
if (col.length()!=255) {
VascStringLengthValidator val = new VascStringLengthValidator();
val.setMaxLenght(col.length());
val.setNullable(col.nullable());
vals.add(val);
}
}
}
VascValidatorMessages m = new VascValidatorMessages();
for (VascValidator val:vals) {
logger.finer("Validating: "+val);
if (val.isObjectValid(objectValue)==false) {
error.add(m.getErrorMessage(field.getVascEntry(), val));
}
}
} catch (Exception e) {
throw new VascException(e);
}
return error;
}
}

View file

@ -0,0 +1,70 @@
/*
* Copyright 2004-2007 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. 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 IDCA 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 IDCA 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.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.impl.entry;
import java.util.ArrayList;
import java.util.List;
import java.util.logging.Logger;
import com.idcanet.vasc.core.VascEntryField;
import com.idcanet.vasc.core.VascException;
import com.idcanet.vasc.core.entry.VascEntryFieldValidatorService;
import com.idcanet.vasc.validators.VascValidator;
import com.idcanet.vasc.validators.VascValidatorMessages;
/**
* Executes the normal vasc validators for fields.
*
* @author Willem Cazander
* @version 1.0 May 13, 2009
*/
public class VascValidatorsValidatorService implements VascEntryFieldValidatorService {
private Logger logger = Logger.getLogger(VascValidatorsValidatorService.class.getName());
public List<String> validateObjectField(VascEntryField field, Object selectedRecord,Object objectValue) throws VascException {
List<String> error = new ArrayList<String>(3);
try {
VascValidatorMessages m = new VascValidatorMessages();
for (VascValidator val:field.getVascEntryFieldType().getVascValidators()) {
logger.finer("Validating: "+val);
if (val.isObjectValid(objectValue)==false) {
error.add(m.getErrorMessage(field.getVascEntry(), val));
}
}
for (VascValidator val:field.getVascValidators()) {
logger.finer("Validating: "+val);
if (val.isObjectValid(objectValue)==false) {
error.add(m.getErrorMessage(field.getVascEntry(), val));
}
}
} catch (Exception e) {
throw new VascException(e);
}
return error;
}
}

View file

@ -0,0 +1,57 @@
/*
* Copyright 2004-2007 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. 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 IDCA 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 IDCA 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.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.impl.type;
import com.idcanet.vasc.core.AbstractVascEntryFieldType;
import com.idcanet.vasc.core.VascEntryFieldType;
/**
* Only knows how to clone its self.
*
*
* @author Willem Cazander
* @version 1.0 Sep 8, 2008
*/
public class DefaultVascEntryFieldType extends AbstractVascEntryFieldType {
private static final long serialVersionUID = 1L;
@Override
public VascEntryFieldType clone() throws CloneNotSupportedException {
DefaultVascEntryFieldType clone = new DefaultVascEntryFieldType();
clone.id=id;
clone.autoDetectClass=autoDetectClass;
clone.uiComponentId=uiComponentId;
clone.inputMask=inputMask;
for (String key:properties.keySet()) {
clone.properties.put(key,properties.get(key));
}
// mmm
clone.vascValidators.addAll(vascValidators);
return clone;
}
}

View file

@ -0,0 +1,106 @@
/*
* Copyright 2004-2007 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. 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 IDCA 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 IDCA 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.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.impl.type;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import com.idcanet.vasc.core.VascEntryFieldType;
import com.idcanet.vasc.core.VascEntryFieldTypeControllerLocal;
import com.idcanet.vasc.core.VascException;
/**
*
* @author Willem Cazander
* @version 1.0 Sep 14, 2008
*/
public class DefaultVascEntryFieldTypeController implements VascEntryFieldTypeControllerLocal {
private Map<String,VascEntryFieldType> vascEntryFieldTypes = null;
public DefaultVascEntryFieldTypeController() throws VascException {
try {
FieldTypeParser parser = new FieldTypeParser();
parser.parseVascFieldTypes();
vascEntryFieldTypes = new HashMap<String,VascEntryFieldType>(35);
for(VascEntryFieldType v:parser.getTypes()) {
vascEntryFieldTypes.put(v.getId(),v);
}
} catch (Exception e) {
throw new VascException(e);
}
}
/**
*
*/
public void addVascEntryFieldType(VascEntryFieldType vascEntryFieldType) {
if (vascEntryFieldType==null) {
throw new NullPointerException("Can't add null vascEntryFieldType.");
}
vascEntryFieldTypes.put(vascEntryFieldType.getId(),vascEntryFieldType);
}
/**
* @see com.idcanet.vasc.core.VascEntryFieldTypeController#getVascEntryFieldTypeById(java.lang.String)
*/
public VascEntryFieldType getVascEntryFieldTypeById(String id) {
VascEntryFieldType result = vascEntryFieldTypes.get(id);
if (result==null) {
throw new IllegalArgumentException("Field not found: "+id);
}
try {
return result.clone();
} catch (CloneNotSupportedException e) {
throw new IllegalArgumentException("FieldType not clonable: "+e.getMessage());
}
}
public VascEntryFieldType getRealVascEntryFieldTypeById(String id) {
VascEntryFieldType result = vascEntryFieldTypes.get(id);
if (result==null) {
throw new IllegalArgumentException("Field not found: "+id);
}
return result;
}
/**
* @see com.idcanet.vasc.core.VascEntryFieldTypeController#getVascEntryFieldTypeIds()
*/
public List<String> getVascEntryFieldTypeIds() {
List<String> result = new ArrayList<String>(5);
result.addAll(vascEntryFieldTypes.keySet());
Collections.sort(result); // lets do abc for consistance behauvior.
return result;
}
}

View file

@ -0,0 +1,75 @@
/*
* Copyright 2004-2007 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. 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 IDCA 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 IDCA 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.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.impl.type;
import java.io.IOException;
import java.util.ArrayList;
import java.util.InvalidPropertiesFormatException;
import java.util.List;
import javax.xml.parsers.ParserConfigurationException;
import org.xml.sax.SAXException;
import com.idcanet.vasc.core.VascEntryFieldType;
import com.idcanet.x4o.core.X4OParser;
import com.idcanet.x4o.element.Element;
/**
*
*
* @author Willem Cazander
* @version 1.0 Sep 11, 2008
*/
public class FieldTypeParser extends X4OParser {
static public final String FIELD_TYPE_LANGUAGE = "fieldtype";
/**
*
* @param language
* @throws IOException
* @throws InvalidPropertiesFormatException
* @throws Exception
*/
public FieldTypeParser() throws InvalidPropertiesFormatException, IOException {
super(FIELD_TYPE_LANGUAGE);
}
public void parseVascFieldTypes() throws IOException, SecurityException, NullPointerException, ParserConfigurationException, SAXException {
parseResource("META-INF/fieldtypes.xml");
}
public List<VascEntryFieldType> getTypes() {
List<VascEntryFieldType> result = new ArrayList<VascEntryFieldType>(4);
for (Element e:getElementContext().getRootElement().getChilderen()) {
VascEntryFieldType a = (VascEntryFieldType)e.getElementObject();
result.add(a);
}
return result;
}
}

View file

@ -0,0 +1,215 @@
/*
* Copyright 2004-2007 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. 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 IDCA 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 IDCA 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.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.impl.type;
import java.util.List;
import com.idcanet.vasc.core.VascEntryField;
import com.idcanet.vasc.core.VascEntryFieldType;
import com.idcanet.vasc.core.VascException;
import com.idcanet.vasc.core.ui.VascValueModel;
/**
* Custem FieldType for multi text values.
*
* @author Willem Cazander
* @version 1.0 Nov 17, 2008
*/
public class MultiTextVascEntryFieldType extends DefaultVascEntryFieldType {
private static final long serialVersionUID = 1L;
@Override
public VascEntryFieldType clone() throws CloneNotSupportedException {
MultiTextVascEntryFieldType clone = new MultiTextVascEntryFieldType();
clone.id=id;
clone.autoDetectClass=autoDetectClass;
clone.uiComponentId=uiComponentId;
clone.inputMask=inputMask;
for (String key:properties.keySet()) {
clone.properties.put(key,properties.get(key));
}
// mmm
clone.vascValidators.addAll(vascValidators);
return clone;
}
/*
private Object getIndexValue(VascEntryField entryField,int index) throws VascException {
Object record = entryField.getVascEntry().getVascFrontendData().getVascEntryState().getEntryDataObject();
Object value = entryField.getVascEntryFieldValue().getValue(entryField, record);
if (value instanceof List<?>) {
return ((List<?>)value).get(index);
}
if (value instanceof String[]) {
if (index >= ((String[])value).length ) {
return "";
}
return ((String[])value)[index];
}
if (value instanceof String) {
return ((String)value);
}
throw new VascException("Unknown object type");
}
@SuppressWarnings("unchecked")
private void setIndexValue(VascEntryField entryField,int index,Object newValue) throws VascException {
Object record = entryField.getVascEntry().getVascFrontendData().getVascEntryState().getEntryDataObject();
Object value = entryField.getVascEntryFieldValue().getValue(entryField, record);
if (value instanceof List<?>) {
((List<Object>)value).set(index, newValue); // TODO: fix @SuppressWarnings here
return;
}
if (value instanceof String[]) {
if (index+1 > ((String[])value).length ) {
String[] n = new String[index+1];
for (int i=0;i<((String[])value).length;i++) {
n[i]= ((String[])value)[i];
}
value = n;
}
((String[])value)[index] = newValue.toString();
return;
}
if (value instanceof String) {
value = new String[] { (String)value };
return;
}
throw new VascException("Unknown object type: "+value);
}
*/
/**
* @see com.idcanet.vasc.core.AbstractVascEntryFieldType#getUIComponentCount(com.idcanet.vasc.core.VascEntryField)
*/
@Override
public int getUIComponentCount(VascEntryField entryField) throws VascException {
return 1;
/*
Object record = entryField.getVascEntry().getVascFrontendData().getVascEntryState().getEntryDataObject();
Object value = entryField.getVascEntryFieldValue().getValue(entryField, record);
if (value instanceof List<?>) {
return ((List<?>)value).size()+1;
}
if (value instanceof String[]) {
return ((String[])value).length+1;
}
if (value instanceof String) {
return 1+1;
}
throw new VascException("Unknown object type: "+value);
*/
}
/**
* @see com.idcanet.vasc.core.AbstractVascEntryFieldType#provideEditorVascValueModel(int, com.idcanet.vasc.core.VascEntryField)
*/
@Override
public VascValueModel provideEditorVascValueModel(final int index,final VascEntryField entryField) {
MultiVascValueModel model = new MultiVascValueModel();
return model;
/* note: not allowed to use inner classes in backend , that breaks remoting !!
VascValueModel model = new VascValueModel() {
public Object getValue() throws VascException {
Object value = getIndexValue(entryField,index);
return value;
}
public void setValue(Object value) throws VascException {
setIndexValue(entryField,index,value);
super.setValue(value);
}
};
return model;
*/
}
}
class MultiVascValueModel extends VascValueModel {
public Object getValue() throws VascException {
Object value = super.getValue();
//System.out.println("value: "+value+" type: "+value.getClass());
StringBuffer buf = new StringBuffer(100);
if (value instanceof List<?>) {
for (Object o:((List<?>)value)) {
buf.append(o);
buf.append("\n");
}
return buf.toString();
}
if (value instanceof String[]) {
for (Object o:((String[])value)) {
buf.append(o);
buf.append("\n");
}
return buf.toString();
}
if (value instanceof String) {
return (String)value;
}
return value;
}
@SuppressWarnings("unchecked")
public void setValue(Object editValueObj) throws VascException {
if (super.getValue()==null) {
super.setValue(editValueObj);
return;
}
if ((editValueObj instanceof String)==false) {
throw new VascException("Can only handle string stuff.");
}
String editValue = (String)editValueObj;
String[] editList = editValue.split(",|\t|\n");
Object value = super.getValue();
if (value instanceof List<?>) {
((List<?>)value).clear();
for (String o:editList) {
((List<String>)value).add(o);
}
super.setValue(value);
return;
}
if (value instanceof String[]) {
super.setValue(value);
return;
}
// solo String type
super.setValue(value);
}
}

View file

@ -0,0 +1,446 @@
/*
* Copyright 2004-2008 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. 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 IDCA 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 IDCA 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.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.impl.x4o;
import java.io.IOException;
import java.io.StringReader;
import java.lang.reflect.Method;
import java.util.Calendar;
import java.util.Collection;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.Properties;
import java.util.Set;
import com.idcanet.vasc.annotations.VascAnnotationParser;
import com.idcanet.vasc.annotations.VascChoices;
import com.idcanet.vasc.annotations.VascChoicesSelectItemModel;
import com.idcanet.vasc.annotations.VascEventListener;
import com.idcanet.vasc.core.VascController;
import com.idcanet.vasc.core.VascEntry;
import com.idcanet.vasc.core.VascEntryField;
import com.idcanet.vasc.core.VascEntryFieldType;
import com.idcanet.vasc.core.entry.VascEntryBackendEventListener;
import com.idcanet.vasc.core.entry.VascEntryFrontendEventListener;
import com.idcanet.vasc.impl.DefaultVascEntryField;
import com.idcanet.vasc.validators.VascValidator;
import com.idcanet.vasc.validators.VascValidatorClassParser;
import com.idcanet.x4o.core.X4OParser;
import com.idcanet.x4o.element.AbstractElement;
import com.idcanet.x4o.element.ElementException;
/**
* Parses the xml element for auto adding field or defaults of fields.
*
* @author Willem Cazander
* @version 1.0 Mar 24, 2009
*/
public class AnnotationParserElement extends AbstractElement {
/**
* @see com.idcanet.x4o.element.AbstractElement#doElementRun()
*/
@Override
public void doElementRun() throws ElementException {
String className = getAttributes().get("className");
String addFields = getAttributes().get("addFields");
Object parentObject = getParent().getElementObject();
Class<?> modelClass;
try {
modelClass = X4OParser.loadClass(className);
} catch (ClassNotFoundException e) {
throw new ElementException(e);
}
VascAnnotationParser parser = new VascAnnotationParser();
if (parentObject instanceof VascEntry) {
VascEntry entry = (VascEntry)parentObject;
fillEntry(entry,modelClass,parser);
if (addFields!=null && "false".equals(addFields)) {
// when false we don't add the fields.
} else {
addFields(entry,modelClass);
}
for (VascEntryField field:entry.getVascEntryFields()) {
fillField(field,modelClass,parser);
}
entry.setDisplayNameFieldId(parser.getVascDisplayName(modelClass));
entry.setPrimaryKeyFieldId(parser.getVascPrimaryKey(modelClass));
} else if (parentObject instanceof VascEntryField) {
VascEntryField field = (VascEntryField)parentObject;
fillField(field,modelClass,parser);
} else {
throw new ElementException("Unknow parent object type: "+parentObject);
}
}
@SuppressWarnings("unchecked")
private void fillEntry(VascEntry entry,Class<?> modelClass,VascAnnotationParser parser) throws ElementException {
if (entry.getId()==null) {
}
VascEventListener vc = parser.getVascEventListener(modelClass);
if (vc!=null) {
int i = 0;
for (Class<?> listener:vc.listeners()) {
if (listener.isAssignableFrom(VascEntryFrontendEventListener.class)) {
entry.addVascEntryFrontendEventListener((Class<VascEntryFrontendEventListener>)listener);
}
if (listener.isAssignableFrom(VascEntryBackendEventListener.class)) {
entry.addVascEntryBackendEventListener((Class<VascEntryBackendEventListener>)listener);
}
i++;
}
}
}
private void fillField(VascEntryField field,Class<?> modelClass,VascAnnotationParser parser) {
String value = null;
value = parser.getVascFieldBackendName(modelClass, field.getId());
if (value!=null && "".equals(value)==false) {
field.setBackendName(value);
}
if (field.getDisplayName()==null) {
field.setDisplayName( parser.getVascDisplayName (modelClass, field.getId()));
}
if (field.getName()==null) {
field.setName( parser.getVascI18nName (modelClass, field.getId()));
}
if (field.getDescription()==null) {
field.setDescription( parser.getVascI18nDescription (modelClass, field.getId()));
}
if (field.getImage()==null) {
field.setImage( parser.getVascI18nImage (modelClass, field.getId()));
}
if (field.getHelpId()==null) {
field.setHelpId( parser.getVascI18nHelpId (modelClass, field.getId()));
}
if (field.getOrderIndex()==null) {
field.setOrderIndex( parser.getVascOrderIndex (modelClass, field.getId()));
}
if (field.getCreate()==null) {
field.setCreate( parser.getVascFieldCreate (modelClass, field.getId()));
}
if (field.getEdit()==null) {
field.setEdit( parser.getVascFieldEdit (modelClass, field.getId()));
}
if (field.getEditReadOnly()==null) {
field.setEditReadOnly( parser.getVascFieldEditReadOnly (modelClass, field.getId()));
}
if (field.getEditBlank()==null) {
field.setEditBlank( parser.getVascFieldEditBlank (modelClass, field.getId()));
}
if (field.getList()==null) {
field.setList( parser.getVascFieldList (modelClass, field.getId()));
}
if (field.getView()==null) {
field.setView( parser.getVascFieldView (modelClass, field.getId()));
}
if (field.getOptional()==null) {
field.setOptional( parser.getVascFieldOptional (modelClass, field.getId()));
}
if (field.getSortable()==null) {
field.setSortable( parser.getVascFieldSortable (modelClass, field.getId()));
}
if (field.getSumable()==null) {
field.setSumable( parser.getVascFieldSumable (modelClass, field.getId()));
if (field.getSumable()==null) {
Method methodCall = null;
// note: model references properties are not resolved yet.
// search for method on bean.
for (Method method:modelClass.getMethods()) {
if (method.getName().startsWith("get")==false) { //a bit durty
continue;
}
if (method.getName().equals("getClass")) {
continue;
}
if (field.getBackendName()==null) {
if (method.getName().equalsIgnoreCase("get"+field.getId())) {
methodCall = method;
break;
}
} else {
if (method.getName().equalsIgnoreCase("get"+field.getBackendName())) {
methodCall = method;
break;
}
}
}
// System.out.println("Found method: "+methodCall);
// search for type
if (methodCall!=null) {
Class<?> retType = methodCall.getReturnType();
if (retType.isAssignableFrom(Number.class)) {
field.setSumable(true);
}
}
}
if (field.getSumable()==null) {
field.setSumable(false);
}
}
if (field.getGraphable()==null) {
field.setGraphable( parser.getVascFieldGraphable (modelClass, field.getId()));
if (field.getGraphable()==null) {
field.setGraphable(field.getSumable());
}
}
if (field.getRolesCreate()==null) {
field.setRolesCreate( parser.getVascRolesCreate (modelClass, field.getId()));
}
if (field.getRolesEdit()==null) {
field.setRolesEdit( parser.getVascRolesEdit (modelClass, field.getId()));
}
if (field.getRolesEditReadOnly()==null) {
field.setRolesEditReadOnly(parser.getVascRolesEditReadOnly (modelClass, field.getId()));
}
if (field.getRolesList()==null) {
field.setRolesList( parser.getVascRolesList (modelClass, field.getId()));
}
if (field.getSizeEdit()==null) {
field.setSizeEdit( parser.getVascStyleSizeEdit (modelClass, field.getId()));
}
if (field.getSizeList()==null) {
field.setSizeList( parser.getVascStyleSizeList (modelClass, field.getId()));
}
if (field.getStyleEdit()==null) {
field.setStyleEdit( parser.getVascStyleStyleEdit (modelClass, field.getId()));
}
if (field.getStyleList()==null) {
field.setStyleList( parser.getVascStyleStyleList (modelClass, field.getId()));
}
VascValidatorClassParser validatorParser = new VascValidatorClassParser();
Class<?> temp = parser.getVascFieldTemplateClass (modelClass, field.getId());
String tempProp = parser.getVascFieldTemplate (modelClass, field.getId());
if (temp!=null) {
if (tempProp==null) {
tempProp=field.getId();
}
if (tempProp.isEmpty()) {
tempProp=field.getId();
}
List<VascValidator> val = validatorParser.getValidatorsByPropertyName(temp, tempProp);
for (VascValidator v:val) {
field.addVascValidator(v);
}
}
List<VascValidator> val = validatorParser.getValidatorsByPropertyName(modelClass, field.getId());
for (VascValidator v:val) {
field.addVascValidator(v); // todo: merg with already added list of template so we can override.
}
VascController vascController = VascParser.getVascController(this.getElementContext());
VascChoices vc = parser.getVascChoices (modelClass, field.getId());
if (vc!=null) {
VascEntryFieldType type = vascController.getVascEntryFieldTypeController().getVascEntryFieldTypeById("ListField");
type.setDataObject(new VascChoicesSelectItemModel(vc));
field.setVascEntryFieldType(type);
}
if (field.getVascEntryFieldType()==null) {
String fieldType = parser.getVascFieldType (modelClass, field.getId());
if (fieldType!=null) {
VascEntryFieldType type = vascController.getVascEntryFieldTypeController().getVascEntryFieldTypeById(fieldType);
field.setVascEntryFieldType(type);
// copy properties
String[] prop = parser.getVascFieldTypeProperties (modelClass, field.getId());
if (prop!=null) {
Properties properties = new Properties();
for (String p:prop) {
try {
// let properties class parse the key=value pairs.
properties.load(new StringReader(p));
} catch (IOException e) {
e.printStackTrace();
}
}
for (Object key:properties.keySet()) {
type.setProperty((String)key, (String)properties.get(key));
}
}
}
}
if (field.getVascEntryFieldType()==null) {
Method methodCall = null;
// note: model references properties are not resolved yet.
// search for method on bean.
for (Method method:modelClass.getMethods()) {
if (method.getName().startsWith("get")==false) { //a bit durty
continue;
}
if (method.getName().equals("getClass")) {
continue;
}
if (field.getBackendName()==null) {
if (method.getName().equalsIgnoreCase("get"+field.getId())) {
methodCall = method;
break;
}
} else {
if (method.getName().equalsIgnoreCase("get"+field.getBackendName())) {
methodCall = method;
break;
}
}
}
// System.out.println("Found method: "+methodCall);
// search for type
if (methodCall!=null) {
Class<?> retType = methodCall.getReturnType();
for (String typeId: vascController.getVascEntryFieldTypeController().getVascEntryFieldTypeIds()) {
VascEntryFieldType type = vascController.getVascEntryFieldTypeController().getVascEntryFieldTypeById(typeId);
//String auto = "";
//if (type.getAutoDetectClass()!=null) {
// auto = type.getAutoDetectClass().getName();
//}
//System.out.println("Check ret: "+retType.getName()+" type: "+type.getId()+" auto: "+auto);
if (type.getAutoDetectClass()!=null) {
if (type.getAutoDetectClass().isAssignableFrom(retType)) {
field.setVascEntryFieldType(type);
break;
}
}
}
}
}
if (field.getDefaultValue()==null) {
String defValue = parser.getVascDefaultValue (modelClass, field.getId());
if (defValue!=null) {
Method methodCall = null;
// note: model references properties are not resolved yet.
// search for method on bean.
for (Method method:modelClass.getMethods()) {
if (method.getName().startsWith("get")==false) { //a bit durty
continue;
}
if (method.getName().equals("getClass")) {
continue;
}
if (field.getBackendName()==null) {
if (method.getName().equalsIgnoreCase("get"+field.getId())) {
methodCall = method;
break;
}
} else {
if (method.getName().equalsIgnoreCase("get"+field.getBackendName())) {
methodCall = method;
break;
}
}
}
// System.out.println("Found method: "+methodCall);
// search for type
if (methodCall!=null) {
Class<?> retType = methodCall.getReturnType();
try {
//System.out.println("creating real def value of: "+defValue+" for: "+retType.getName());
Object defObject = null;
if (Date.class.equals(retType)) {
defObject = new Date();
} else if (Calendar.class.equals(retType)) {
defObject = Calendar.getInstance();
} else {
defObject = retType.getConstructor(String.class).newInstance(defValue);
}
//System.out.println("real object: "+defObject);
field.setDefaultValue(defObject);
} catch (Exception e) {
e.printStackTrace();
}
}
}
}
}
private void addFields(VascEntry entry,Class<?> modelClass) {
for (Method method:modelClass.getMethods()) {
if (method.getName().startsWith("get")==false) { //a bit durty
continue;
}
if (method.getName().equals("getClass")) {
continue;
}
if (method.getReturnType().isAssignableFrom(Collection.class)) {
continue;
}
if (method.getReturnType().isAssignableFrom(List.class)) {
continue;
}
if (method.getReturnType().isAssignableFrom(Set.class)) {
continue;
}
if (method.getReturnType().isAssignableFrom(Map.class)) {
continue;
}
String fieldId = method.getName().substring(3,4).toLowerCase()+method.getName().substring(4);
VascEntryField field = new DefaultVascEntryField();
field.setId(fieldId);
if (entry.getVascEntryFieldById(fieldId)==null) {
entry.addVascEntryField(field);
} else {
continue; // already set in xml
}
}
}
}

Some files were not shown because too many files have changed in this diff Show more