2
0
Fork 0

[svn r364] WIP for move to maven2

This commit is contained in:
willemc 2008-12-07 06:17:48 +01:00
parent 8fc495c6b6
commit 818ed10649
173 changed files with 275 additions and 45 deletions

View file

@ -0,0 +1,236 @@
/*
* 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.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;
/**
* 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
if (entry.getId()==null) {
throw new IllegalArgumentException("The VascEntry need an id.");
}
if (entry.getBackendId()==null) {
throw new IllegalArgumentException("The VascEntry need an backendId.");
}
if (entry.getVascEntryFields().size()==0) {
throw new IllegalArgumentException("We need at least one VascEntryField.");
}
for (VascEntryField vef:entry.getVascEntryFields()) {
if (vef.getId()==null) {
throw new IllegalArgumentException("All VascEntryField need an id");
}
}
// Check if backendId is valid
VascBackend back = vascController.getVascBackendControllerResolver().getVascBackendController().getVascBackendById( entry.getBackendId() );
if (back==null) {
throw new IllegalArgumentException("The VascEntry backendId is not found in backends: '"+entry.getBackendId()+"'");
}
// Fill up all not field i18n keys
String id = entry.getId();
// header
if (entry.getHeaderName()==null) {
entry.setHeaderName("vasc.entry."+id+".headerName");
}
if (entry.getHeaderDescription()==null) {
entry.setHeaderDescription("vasc.entry."+id+".headerDescription");
}
if (entry.getHeaderImage()==null) {
entry.setHeaderImage("vasc.entry."+id+".headerImage");
}
// entry fields
if (entry.getName()==null) {
entry.setName("vasc.entry."+id+".name");
}
if (entry.getDescription()==null) {
entry.setDescription("vasc.entry."+id+".description");
}
if (entry.getImage()==null) {
entry.setImage("vasc.entry."+id+".image");
}
if (entry.getHelpId()==null) {
entry.setHelpId("vasc.entry."+id+".helpId");
}
// 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");
}
// 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);
}
}
// 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
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);
}
// 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.getVascEntryFieldEventChannel()==null) {
//vef.setStyleList("vasc.entry."+id+"."+vid+".styleEdit");
}
if (vef.getVascEntryFieldValue()==null) {
VascBackend back2 = vascController.getVascBackendControllerResolver().getVascBackendController().getVascBackendById( entry.getBackendId() );
vef.setVascEntryFieldValue(back2.provideVascEntryFieldValue(vef));
}
if (vef.getVascEntryFieldType()==null) {
Object defValue = vef.getDefaultValue();
if (defValue != null) {
for (String typeId: vascController.getVascEntryFieldTypeControllerResolver().getVascEntryFieldTypeController().getVascEntryFieldTypeIds()) {
VascEntryFieldType type = vascController.getVascEntryFieldTypeControllerResolver().getVascEntryFieldTypeController().getVascEntryFieldTypeById(typeId);
if (type.getAutoDetectClass()!=null) {
if (type.getAutoDetectClass().isAssignableFrom(defValue.getClass())) {
vef.setVascEntryFieldType(type);
break;
}
}
}
}
if (vef.getVascEntryFieldType()==null) {
vef.setVascEntryFieldType(vascController.getVascEntryFieldTypeControllerResolver().getVascEntryFieldTypeController().getVascEntryFieldTypeById("TextField"));
}
//vef.setStyleList("vasc.entry."+id+"."+vid+".styleEdit");
}
//for (VascValidator vv:vef.getVascValidators()) {
//}
}
// Check if link entries excists
for (VascLinkEntry vle:entry.getVascLinkEntries()) {
vle.getVascEntryName();
}
// ..
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,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;
import com.idcanet.vasc.core.VascBackendController;
import com.idcanet.vasc.core.VascBackendControllerResolver;
/**
*
* @author Willem Cazander
* @version 1.0 Sep 18, 2008
*/
public class DefaultVascBackendControllerResolver implements VascBackendControllerResolver {
private VascBackendController vascBackendController = null;
/**
* @see com.idcanet.vasc.core.VascBackendControllerResolver#getVascBackendController()
*/
public VascBackendController getVascBackendController() {
return vascBackendController;
}
public void setVascBackendController(VascBackendController vascBackendController) {
this.vascBackendController=vascBackendController;
}
}

View file

@ -0,0 +1,121 @@
/*
* 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.VascBackendControllerResolver;
import com.idcanet.vasc.core.VascController;
import com.idcanet.vasc.core.VascEntryControllerResolver;
import com.idcanet.vasc.core.VascEntryFieldTypeControllerResolver;
import com.idcanet.vasc.core.VascEventChannelControllerResolver;
import com.idcanet.vasc.core.VascUserRoleControllerResolver;
/**
*
*
* @author Willem Cazander
* @version 1.0 Sep 11, 2008
*/
public class DefaultVascController implements VascController {
private VascBackendControllerResolver vascBackendControllerResolver = null;
private VascEntryControllerResolver vascEntryControllerResolver = null;
private VascEntryFieldTypeControllerResolver vascEntryFieldTypeControllerResolver = null;
private VascEventChannelControllerResolver vascEventChannelControllerResolver = null;
private VascUserRoleControllerResolver vascUserRoleControllerResolver = null;
/**
* @return the vascEventChannelControllerResolver
*/
public VascEventChannelControllerResolver getVascEventChannelControllerResolver() {
return vascEventChannelControllerResolver;
}
/**
* @param vascEventChannelControllerResolver the vascEventChannelControllerResolver to set
*/
public void setVascEventChannelControllerResolver(
VascEventChannelControllerResolver vascEventChannelControllerResolver) {
this.vascEventChannelControllerResolver = vascEventChannelControllerResolver;
}
/**
* @return the vascBackendControllerResolver
*/
public VascBackendControllerResolver getVascBackendControllerResolver() {
return vascBackendControllerResolver;
}
/**
* @param vascBackendControllerResolver the vascBackendControllerResolver to set
*/
public void setVascBackendControllerResolver(VascBackendControllerResolver vascBackendControllerResolver) {
this.vascBackendControllerResolver = vascBackendControllerResolver;
}
/**
* @return the vascEntryControllerResolver
*/
public VascEntryControllerResolver getVascEntryControllerResolver() {
return vascEntryControllerResolver;
}
/**
* @param vascEntryControllerResolver the vascEntryControllerResolver to set
*/
public void setVascEntryControllerResolver(VascEntryControllerResolver vascEntryControllerResolver) {
this.vascEntryControllerResolver = vascEntryControllerResolver;
}
/**
* @return the vascEntryFieldControllerResolver
*/
public VascEntryFieldTypeControllerResolver getVascEntryFieldTypeControllerResolver() {
return vascEntryFieldTypeControllerResolver;
}
/**
* @param vascEntryFieldControllerResolver the vascEntryFieldControllerResolver to set
*/
public void setVascEntryFieldTypeControllerResolver(VascEntryFieldTypeControllerResolver vascEntryFieldTypeControllerResolver) {
this.vascEntryFieldTypeControllerResolver = vascEntryFieldTypeControllerResolver;
}
/**
* @return the vascUserRoleControllerResolver
*/
public VascUserRoleControllerResolver getVascUserRoleControllerResolver() {
return vascUserRoleControllerResolver;
}
/**
* @param vascUserRoleControllerResolver the vascUserRoleControllerResolver to set
*/
public void setVascUserRoleControllerResolver(
VascUserRoleControllerResolver vascUserRoleControllerResolver) {
this.vascUserRoleControllerResolver = vascUserRoleControllerResolver;
}
}

View file

@ -0,0 +1,491 @@
/*
* 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.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;
/**
* VascEntry
*
* @author Willem Cazander
* @version 1.0 Mar 21, 2007
*/
public class DefaultVascEntry implements VascEntry {
private String id = null;
private String name = null;
private String description = null;
private String helpId = null;
private String image = null;
private String headerName = null;
private String headerImage = null;
private String headerDescription = null;
private String primaryKeyFieldId = null;
private String displayNameFieldId = null;
private boolean vascAdmimList = true;
private boolean vascAdmimEdit = true;
private boolean vascAdmimCreate = true;
private boolean vascAdmimDelete = 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 String backendId = null;
private VascFrontendData vascFrontendData = null;
/**
* Te constructor
*/
public DefaultVascEntry() {
vascFields = new ArrayList<VascEntryField>(10);
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>();
}
/**
* @see java.lang.Object#clone()
*/
@Override
protected Object clone() throws CloneNotSupportedException {
return super.clone();
}
/**
* @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 headerName
*/
public String getHeaderName() {
return headerName;
}
/**
* @param headerName the headerName to set
*/
public void setHeaderName(String headerName) {
this.headerName = headerName;
}
/**
* @return the headerImage
*/
public String getHeaderImage() {
return headerImage;
}
/**
* @param headerImage the headerImage to set
*/
public void setHeaderImage(String headerImage) {
this.headerImage = headerImage;
}
/**
* @return the headerDescription
*/
public String getHeaderDescription() {
return headerDescription;
}
/**
* @param headerDescription the headerDescription to set
*/
public void setHeaderDescription(String headerDescription) {
this.headerDescription = headerDescription;
}
/**
* @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 vascAdmimList
*/
public boolean isVascAdmimList() {
return vascAdmimList;
}
/**
* @param vascAdmimList the vascAdmimList to set
*/
public void setVascAdmimList(boolean vascAdmimList) {
this.vascAdmimList = vascAdmimList;
}
/**
* @return the vascAdmimEdit
*/
public boolean isVascAdmimEdit() {
return vascAdmimEdit;
}
/**
* @param vascAdmimEdit the vascAdmimEdit to set
*/
public void setVascAdmimEdit(boolean vascAdmimEdit) {
this.vascAdmimEdit = vascAdmimEdit;
}
/**
* @return the vascAdmimCreate
*/
public boolean isVascAdmimCreate() {
return vascAdmimCreate;
}
/**
* @param vascAdmimCreate the vascAdmimCreate to set
*/
public void setVascAdmimCreate(boolean vascAdmimCreate) {
this.vascAdmimCreate = vascAdmimCreate;
}
/**
* @return the vascAdmimDelete
*/
public boolean isVascAdmimDelete() {
return vascAdmimDelete;
}
/**
* @param vascAdmimDelete the vascAdmimDelete to set
*/
public void setVascAdmimDelete(boolean vascAdmimDelete) {
this.vascAdmimDelete = vascAdmimDelete;
}
/**
* @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;
}
}
throw new IllegalArgumentException("Id not found as field");
}
/**
* @return the rowActions
*/
public List<RowVascAction> getRowActions() {
return rowActions;
}
/**
* @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;
}
/**
* @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;
}
/**
* @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;
}
/**
* @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;
}
/**
* @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;
}
}

View file

@ -0,0 +1,85 @@
/*
* 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.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) {
return entries.get(id);
}
/**
* @see com.idcanet.vasc.core.VascEntryController#getVascEntryIds()
*/
public List<String> getVascEntryIds() {
return new ArrayList<String>(entries.keySet());
}
/**
* 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.isVascAdmimList())) {
adminIds.add(e.getId());
}
}
return adminIds;
}
}

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.impl;
import com.idcanet.vasc.core.VascEntryController;
import com.idcanet.vasc.core.VascEntryControllerResolver;
/**
*
* @author Willem Cazander
* @version 1.0 Sep 18, 2008
*/
public class DefaultVascEntryControllerResolver implements VascEntryControllerResolver {
private VascEntryController vascEntryController = null;
/**
* @see com.idcanet.vasc.core.VascEntryControllerResolver#getVascEntryController()
*/
public VascEntryController getVascEntryController() {
return vascEntryController;
}
public void setVascEntryController(VascEntryController vascEntryController) {
this.vascEntryController=vascEntryController;
}
}

View file

@ -0,0 +1,480 @@
/*
* 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.VascEntryFieldEventChannel;
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 VascEntry vascEntry = null;
/** The vasc id for this field */
private String id = null;
/** The vasc Field Type for this field entry. */
private VascEntryFieldType vascEntryFieldType = null;
/** The backendName, default to the name. **/
private String backendName = null;
private VascEntryFieldValue vascEntryFieldValue = null;
private VascEntryFieldEventChannel vascEntryFieldEventChannel = null;
private List<VascValidator> vascValidators = null;
/** Some VascField fields**/
private String name = null;
private String description = null;
private String helpId = null;
private String image = 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;
/** Defines if this columns is used in interface list,create,edit **/
private boolean view = true;
private boolean optional = false;
/** Defines per view state of this field **/
private boolean create = true;
private boolean edit = true;
private boolean editReadOnly = false;
private boolean list = true;
/** 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;
public DefaultVascEntryField() {
vascValidators = new ArrayList<VascValidator>(5);
}
public DefaultVascEntryField(String id) {
this();
setId(id);
}
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 vascEntryFieldEventChannel
*/
public VascEntryFieldEventChannel getVascEntryFieldEventChannel() {
return vascEntryFieldEventChannel;
}
/**
* @param vascEntryFieldEventChannel the vascEntryFieldEventChannel to set
*/
public void setVascEntryFieldEventChannel(VascEntryFieldEventChannel vascEntryFieldEventChannel) {
this.vascEntryFieldEventChannel = vascEntryFieldEventChannel;
}
/**
* @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 isView() {
return view;
}
/**
* @param view the view to set
*/
public void setView(boolean view) {
this.view = view;
}
/**
* @return the optional
*/
public boolean isOptional() {
return optional;
}
/**
* @param optional the optional to set
*/
public void setOptional(boolean optional) {
this.optional = optional;
}
/**
* @return the create
*/
public boolean isCreate() {
return create;
}
/**
* @param create the create to set
*/
public void setCreate(boolean create) {
this.create = create;
}
/**
* @return the edit
*/
public boolean isEdit() {
return edit;
}
/**
* @param edit the edit to set
*/
public void setEdit(boolean edit) {
this.edit = edit;
}
/**
* @return the editReadOnly
*/
public boolean isEditReadOnly() {
return editReadOnly;
}
/**
* @param editReadOnly the editReadOnly to set
*/
public void setEditReadOnly(boolean editReadOnly) {
this.editReadOnly = editReadOnly;
}
/**
* @return the list
*/
public boolean isList() {
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;
}
}

View file

@ -0,0 +1,206 @@
/*
* 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);
}
/**
* @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,55 @@
/*
* 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.VascEventChannelController;
import com.idcanet.vasc.core.VascEventChannelControllerResolver;
/**
*
* @author Willem Cazander
* @version 1.0 Nov 19, 2008
*/
public class DefaultVascEventChannelControllerResolver implements VascEventChannelControllerResolver {
private VascEventChannelController vascEventChannelController = null;
/**
* @return the vascEventChannelController
*/
public VascEventChannelController getVascEventChannelController() {
return vascEventChannelController;
}
/**
* @param vascEventChannelController the vascEventChannelController to set
*/
public void setVascEventChannelController(
VascEventChannelController vascEventChannelController) {
this.vascEventChannelController = vascEventChannelController;
}
}

View file

@ -0,0 +1,222 @@
/*
* 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.VascEntryField;
import com.idcanet.vasc.core.VascEntryFinalizer;
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.VascEntryResourceResolver;
import com.idcanet.vasc.core.ui.VascUIComponent;
/**
*
* @author Willem Cazander
* @version 1.0 Mar 21, 2007
*/
public class DefaultVascFrontendData implements VascFrontendData {
private List<Object> entryDataList = null;
private Object entryDataObject = null;
private VascFrontend vascFrontend = null;
private VascEntryFinalizer vascEntryFinalizer = null;
private VascFrontendHelper vascFrontendHelper = null;
private VascEntryResourceResolver vascEntryResourceResolver = null;
private Map<String,String> uiComponents = null;
private VascController vascController = null;
private Map<VascEntryField,VascUIComponent> fieldComps = null;
private Map<VascEntryField,Object> fieldEditors = null;
public DefaultVascFrontendData() {
entryDataList = new ArrayList<Object>(0);
uiComponents = new HashMap<String,String>(8);
fieldComps = new HashMap<VascEntryField,VascUIComponent>(8);
fieldEditors = new HashMap<VascEntryField,Object>(8);
}
/**
* @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 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) {
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);
}
/**
* @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);
}
}

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,332 @@
/*
* 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.logging.Level;
import java.util.logging.Logger;
import com.idcanet.vasc.core.VascEntry;
import com.idcanet.vasc.core.VascEntryField;
import com.idcanet.vasc.core.VascFrontendHelper;
import com.idcanet.vasc.core.entry.VascEntryEventListener;
import com.idcanet.vasc.core.entry.VascEntryEventListener.VascEventType;
import com.idcanet.vasc.core.ui.VascUIComponent;
import com.idcanet.vasc.validators.VascValidator;
/**
*
* @author Willem Cazander
* @version 1.0 Apr 28, 2007
*/
public class DefaultVascFrontendHelper implements VascFrontendHelper {
private Logger logger = null;
//private List<VascEventListener> eventListeners = null;
//private List<VascExceptionListener> exceptionListeners = null;
public DefaultVascFrontendHelper() {
logger = Logger.getLogger(DefaultVascFrontendHelper.class.getName());
//eventListeners = new ArrayList<VascEventListener>(2);
//exceptionListeners = new ArrayList<VascExceptionListener>(2);
}
/**
* @see com.idcanet.vasc.core.VascFrontendHelper#addEventListener(com.idcanet.vasc.core.entry.VascEntryEventListener)
*/
public void addEventListener(VascEntryEventListener e) {
// TODO Auto-generated method stub
}
/**
* @see com.idcanet.vasc.core.VascFrontendHelper#addExceptionListener(com.idcanet.vasc.core.entry.VascEntryEventListener)
*/
public void addExceptionListener(VascEntryEventListener listener) {
}
/**
* @see com.idcanet.vasc.core.VascFrontendHelper#fireVascEvent(com.idcanet.vasc.core.entry.VascEntryEventListener.VascEventType, java.lang.Object)
*/
public void fireVascEvent(VascEventType type, Object 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.getLogger(VascEntry.class.getName()).finer("Column no size: "+c.getName());
} else {
result+=c.getSizeList();
}
}
return result;
}
/**
* @see com.idcanet.vasc.core.VascFrontendHelper#handleException(java.lang.Exception, com.idcanet.vasc.core.VascEntry)
*/
public void handleException(Exception e, VascEntry table) {
e.printStackTrace();
/*
if (exceptionListeners.isEmpty()) {
Logger.getLogger(DefaultVascTableController.class.getName()).log(Level.WARNING,e.getMessage(),e);
return;
}
for(VascExceptionListener ee:exceptionListeners) {
try {
ee.handleException(e, table);
} catch (Exception eee) {
Logger.getLogger(DefaultVascTableController.class.getName()).log(Level.WARNING,"Error in ExceptionListener: "+eee.getMessage(),eee);
}
}
*/
}
/**
* @see com.idcanet.vasc.core.VascFrontendHelper#initEditObject(com.idcanet.vasc.core.VascEntry, java.lang.Object)
*/
public Object initEditObject(VascEntry entry, Object object) throws Exception {
if (object!=null) {
return object;
}
object = entry.getVascFrontendData().getVascController().getVascBackendControllerResolver().getVascBackendController().getVascBackendById(entry.getBackendId()).provideVascEntryRecordCreator(entry).newRecord(entry);
//fireVascEvent(VascEventListener.VascEventType.BEAN_INIT, object);
return object;
}
/**
* @see com.idcanet.vasc.core.VascFrontendHelper#initEditObjectColumn(com.idcanet.vasc.core.VascEntryField, java.lang.Object)
*/
public void initEditObjectColumn(VascEntryField field, Object bean) throws Exception {
Object value = field.getVascEntryFieldValue().getValue(field, bean);
if(value==null & field.getDefaultValue()!=null) {
try {
logger.finer("Setting default value for: "+field.getName()+" def: "+field.getDefaultValue());
field.getVascEntryFieldValue().setValue(field, bean, field.getDefaultValue());
} catch (Exception e) {
logger.log(Level.WARNING,"Error in setting default value: '"+field.getDefaultValue()+"' error: "+e.getMessage(),e);
}
}
}
/**
* @see com.idcanet.vasc.core.VascFrontendHelper#mergeObject(com.idcanet.vasc.core.VascEntry, java.lang.Object)
*/
public Object mergeObject(VascEntry entry, Object object) {
Object result = null;
try {
object = entry.getVascFrontendData().getVascController().getVascBackendControllerResolver().getVascBackendController().getVascBackendById(entry.getBackendId()).merge(object);
//fireVascEvent(VascEventListener.VascEventType.BEAN_MERGE,object);
// todo: make faster
// add to table at position old old object
// then remove old object
// send refresh
refreshData(entry);
} catch (Exception e) {
handleException(e, entry);
}
return result;
}
/**
* @see com.idcanet.vasc.core.VascFrontendHelper#refreshData(com.idcanet.vasc.core.VascEntry)
*/
public void refreshData(VascEntry entry) throws Exception {
entry.getVascFrontendData().setEntryDataObject(null);
entry.getVascFrontendData().setEntryDataList(entry.getVascFrontendData().getVascController().getVascBackendControllerResolver().getVascBackendController().getVascBackendById(entry.getBackendId()).execute());
//fireVascEvent(VascEventListener.VascEventType.DATA_UPDATE, null);
}
/**
* @see com.idcanet.vasc.core.VascFrontendHelper#removeEventListener(com.idcanet.vasc.core.entry.VascEntryEventListener)
*/
public void removeEventListener(VascEntryEventListener e) {
// TODO Auto-generated method stub
}
/**
* @see com.idcanet.vasc.core.VascFrontendHelper#removeExceptionListener(com.idcanet.vasc.core.entry.VascEntryEventListener)
*/
public void removeExceptionListener(VascEntryEventListener listener) {
// TODO Auto-generated method stub
}
/**
* @see com.idcanet.vasc.core.VascFrontendHelper#setUIComponentsBeanErrors(com.idcanet.vasc.core.VascEntry, java.lang.Object)
*/
public boolean setUIComponentsBeanErrors(VascEntry entry, Object bean) {
boolean error = false;
if(bean==null) {
logger.finest("No bean to check.");
return true; // nothing to check
}
//ClassValidator val = new ClassValidator(bean.getClass());
//InvalidValue[] ival = val.getInvalidValues(bean);
//logger.fine("Got invaliled value: "+ival.length);
for(VascEntryField col:entry.getVascEntryFields()) {
try {
Object object = col.getVascEntryFieldValue().getValue(col, bean);
VascUIComponent comp = entry.getVascFrontendData().getFieldVascUIComponent(col);
for (VascValidator val:col.getVascEntryFieldType().getVascValidators()) {
if (val.isObjectValid(object)==false) {
comp.setErrorText("error");
error = true;
} else {
comp.setErrorText(null);
}
}
for (VascValidator val:col.getVascValidators()) {
if (val.isObjectValid(object)==false) {
comp.setErrorText("error");
error = true;
} else {
comp.setErrorText(null);
}
}
} catch (Exception e) {
e.printStackTrace();
}
/*
if(col.getVascUIComponent()==null) {
continue; // we only DISPLAY user input errors !!
}
if (col instanceof VascAnnotationTableColumn) {
VascAnnotationTableColumn column = (VascAnnotationTableColumn)col;
InvalidValue iv = findInvalidValueByProperty(ival,column.getBeanProperty());
if(iv==null) {
column.getVascUIComponent().setErrorText(null);
continue; // no error on this property
}
error = true;
column.getVascUIComponent().setErrorText(iv.getMessage());
}
*/
}
logger.finest("Checked for errors: "+error);
return error;
}
/*
private InvalidValue findInvalidValueByProperty(InvalidValue[] ival,String property) {
for(InvalidValue iv:ival) {
if(iv.getPropertyName().equals(property)) {
return iv;
}
}
return null;
}
*/
/*
public void finalizeVascColumns(VascTable table) throws Exception {
VascAnnotationParser vap = new VascAnnotationParser();
for(VascTableColumn c:table.getTableColumns()) {
if (c instanceof VascAnnotationTableColumn) {
VascAnnotationTableColumn column = (VascAnnotationTableColumn)c;
if (c.getName()==null) {
c.setName(vap.getVascNameKey(table.getVascRecordCreator().getObjectClass(), column.getBeanProperty()));
}
if (c.getToolTip()==null) {
c.setToolTip(vap.getVascToolTipKey(table.getVascRecordCreator().getObjectClass(), column.getBeanProperty()));
}
if (c.getDefaultValue()==null) {
c.setDefaultValue(vap.getVascDefaultValue(table.getVascRecordCreator().getObjectClass(), column.getBeanProperty()));
}
if (c.getWidth()==null) {
Object obj = vap.getVascColumnWidth(table.getVascRecordCreator().getObjectClass(), column.getBeanProperty());
if (obj instanceof Integer) {
c.setWidth((Integer)obj);
}
c.setWidth(100);
// get KEY
}
if (c.getHelpId()==null) {
c.setHelpId(vap.getVascHelpId(table.getVascRecordCreator().getObjectClass(), column.getBeanProperty()));
}
if (c.getVascColumnValue()==null) {
c.setVascColumnValue(new BeanPropertyVascColumnValue(column.getBeanProperty()));
}
if (c.getImage()==null) {
c.setImage(vap.getVascImage(table.getVascRecordCreator().getObjectClass(),column.getBeanProperty()));
}
}
if (c.getVascUIComponent()==null) {
if (c.getDefaultValue() instanceof Boolean) {
c.setVascUIComponent(new VascToggle());
} else if (c.getDefaultValue() instanceof Date) {
c.setVascUIComponent(new VascDate());
} else {
c.setVascUIComponent(new VascTextField());
}
}
if (c.getVascColumnRenderer()==null) {
//c.setVascColumnRenderer(new DefaultVascColumnRenderer());
}
}
}
public void addEventListener(VascEventListener e) {
eventListeners.add(e);
}
public void removeEventListener(VascEventListener e) {
eventListeners.remove(e);
}
public void fireVascEvent(VascEventListener.VascEventType type,Object data) {
for(VascEventListener e:eventListeners) {
e.vascEvent(type, data);
}
}
public void addExceptionListener(VascExceptionListener listener) {
exceptionListeners.add(listener);
}
public void removeExceptionListener(VascExceptionListener listener) {
exceptionListeners.remove(listener);
}
*/
}

View file

@ -0,0 +1,55 @@
/*
* 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 com.idcanet.vasc.core.VascLinkEntry;
/**
* The DefaultVascLinkEntry
*
* @author Willem Cazander
* @version 1.0 Oct 27, 2007
*/
public class DefaultVascLinkEntry implements VascLinkEntry {
private String vascEntryName = null;
/**
* @return the vascEntryName
*/
public String getVascEntryName() {
return vascEntryName;
}
/**
* @param vascEntryName the vascEntryName to set
*/
public void setVascEntryName(String vascEntryName) {
this.vascEntryName = vascEntryName;
}
}

View file

@ -0,0 +1,55 @@
/*
* 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.VascUserRoleController;
import com.idcanet.vasc.core.VascUserRoleControllerResolver;
/**
*
* @author Willem Cazander
* @version 1.0 Nov 19, 2008
*/
public class DefaultVascUserRoleControllerResolver implements VascUserRoleControllerResolver {
private VascUserRoleController vascUserRoleController = null;
/**
* @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,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.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 {
public AddRowAction() {
setName("vasc.action.add.name");
setToolTip("vasc.action.add.tooltip");
setImage("vasc.action.add.image");
}
public void doRowAction(VascEntry enty,Object rowObject) throws Exception {
enty.getVascFrontendData().getVascFrontend().renderEdit(null);
}
}

View file

@ -0,0 +1,80 @@
/*
* 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.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 {
public CSVExportGlobalAction() {
setName("vasc.action.csv.name");
setToolTip("vasc.action.csv.tooltip");
setImage("vasc.action.csv.image");
}
public void doGlobalAction(VascEntry entry) throws Exception {
entry.getVascFrontendData().getVascFrontend().renderExport(this);
}
public void doExport(OutputStream out,VascEntry entry) throws Exception {
PrintWriter p = new PrintWriter(out);
p.write("# csv\n");
for (VascEntryField c:entry.getVascEntryFields()) {
p.write(c.getName()+"\t");
}
p.write("\n");
for (Object o:entry.getVascFrontendData().getEntryDataList()) {
for (VascEntryField c:entry.getVascEntryFields()) {
p.write(c.getVascEntryFieldValue().getValue(c, o)+"\t");
}
p.write("\n");
p.flush();
}
p.write("# end\n");
p.flush();
}
public String getMineType() {
return "csv";
}
public String getType() {
return "csv";
}
}

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.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 {
public DeleteRowAction() {
setName("vasc.action.del.name");
setToolTip("vasc.action.del.tooltip");
setImage("vasc.action.del.image");
}
public void doRowAction(VascEntry entry,Object rowObject) throws Exception {
if (rowObject==null) {
return;
}
entry.getVascFrontendData().getVascFrontend().renderDelete(rowObject);
}
}

View file

@ -0,0 +1,53 @@
/*
* 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 EditRowAction extends AbstractVascAction implements RowVascAction {
public EditRowAction() {
setName("vasc.action.edit.name");
setToolTip("vasc.action.edit.tooltip");
setImage("vasc.action.edit.image");
}
public void doRowAction(VascEntry entry,Object rowObject) throws Exception {
if (rowObject==null) {
return;
}
entry.getVascFrontendData().getVascFrontend().renderEdit(rowObject);
}
}

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.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 {
public RefreshDataGlobalAction() {
setName("vasc.action.refresh.name");
setToolTip("vasc.action.refresh.tooltip");
setImage("vasc.action.refresh.image");
}
public void doGlobalAction(VascEntry entry) throws Exception {
entry.getVascFrontendData().getVascFrontendHelper().refreshData(entry); // this wil also fire the event
}
}

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.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.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 {
public XMLExportGlobalAction() {
setName("vasc.action.xml.name");
setToolTip("vasc.action.xml.tooltip");
setImage("vasc.action.xml.image");
}
public void doGlobalAction(VascEntry entry) throws Exception {
entry.getVascFrontendData().getVascFrontend().renderExport(this);
}
public void doExport(OutputStream out,VascEntry entry) throws Exception {
PrintWriter p = new PrintWriter(out);
p.write("<xml version=\"1.0\"/>\n");
p.write("<data>\n");
for (Object o:entry.getVascFrontendData().getEntryDataList()) {
for (VascEntryField c:entry.getVascEntryFields()) {
p.write("<column name=\""+c.getName()+"\">");
p.write(""+c.getVascEntryFieldValue().getValue(c, o));
p.write("</column>\n");
}
p.flush();
}
p.write("</data>\n");
p.flush();
}
public String getMineType() {
return "text/xml";
}
public String getType() {
return "xml";
}
}

View file

@ -0,0 +1,102 @@
/*
* 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.DefaultElementParameterHelper;
/**
*
* @author Willem Cazander
* @version 1.0 Mar 21, 2007
*/
public class BeanPropertyVascEntryFieldValue implements VascEntryFieldValue {
private String property = null;
private DefaultElementParameterHelper helper = null;
public BeanPropertyVascEntryFieldValue() {
helper = new DefaultElementParameterHelper();
}
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.getParameter(record, getProperty());
} catch (Exception e) {
throw new VascException(e);
}
}
/**
* @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.setParameter(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,58 @@
/*
* 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 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,45 @@
/*
* 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.entry.VascEntryResourceResolver;
/**
*
* @author Willem Cazander
* @version 1.0 Mar 21, 2007
*/
public class DefaultVascEntryResourceResolver implements VascEntryResourceResolver {
public String getKeyMapping(String key) {
return key;
}
public String getTextValue(String text,Object...params) {
return text;
}
}

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.type;
import com.idcanet.vasc.core.AbstractVascEntryFieldType;
/**
*
* @author Willem Cazander
* @version 1.0 Sep 8, 2008
*/
public class DefaultVascEntryFieldType extends AbstractVascEntryFieldType {
}

View file

@ -0,0 +1,74 @@
/*
* 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.List;
import com.idcanet.vasc.core.VascEntryFieldType;
import com.idcanet.vasc.core.VascEntryFieldTypeController;
/**
*
* @author Willem Cazander
* @version 1.0 Sep 14, 2008
*/
public class DefaultVascEntryFieldTypeController implements VascEntryFieldTypeController {
FieldTypeParser parser = null;
public DefaultVascEntryFieldTypeController() throws Exception {
parser = new FieldTypeParser();
parser.parseVascFieldTypes();
}
/**
* @see com.idcanet.vasc.core.VascEntryFieldTypeController#getVascEntryFieldTypeById(java.lang.String)
*/
public VascEntryFieldType getVascEntryFieldTypeById(String name) {
for(VascEntryFieldType v:parser.getTypes()) {
if (v.getId().equals(name)) {
return v;
}
}
throw new IllegalArgumentException("Field not found: "+name);
}
/**
* @see com.idcanet.vasc.core.VascEntryFieldTypeController#getVascEntryFieldTypeIds()
*/
public List<String> getVascEntryFieldTypeIds() {
List<String> result = new ArrayList<String>(5);
for(VascEntryFieldType v:parser.getTypes()) {
result.add(v.getId());
}
return result;
}
}

View file

@ -0,0 +1,56 @@
/*
* 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.VascEntryFieldTypeController;
import com.idcanet.vasc.core.VascEntryFieldTypeControllerResolver;
/**
*
* @author Willem Cazander
* @version 1.0 Sep 14, 2008
*/
public class DefaultVascEntryFieldTypeControllerResolver implements VascEntryFieldTypeControllerResolver {
VascEntryFieldTypeController vascEntryFieldTypeController = null;
/**
* @see com.idcanet.vasc.core.VascEntryFieldTypeControllerResolver#getVascEntryFieldTypeController()
*/
public VascEntryFieldTypeController getVascEntryFieldTypeController() {
return vascEntryFieldTypeController;
}
/**
* @param vascEntryFieldTypeController the vascEntryFieldTypeController to set
*/
public void setVascEntryFieldTypeController(VascEntryFieldTypeController vascEntryFieldTypeController) {
this.vascEntryFieldTypeController = vascEntryFieldTypeController;
}
}

View file

@ -0,0 +1,72 @@
/*
* 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.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 Exception
*/
public FieldTypeParser() throws Exception {
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().getRootElements()) {
VascEntryFieldType a = (VascEntryFieldType)e.getElementObject();
result.add(a);
}
return result;
}
}

View file

@ -0,0 +1,131 @@
/*
* 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.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 Object getIndexValue(VascEntryField entryField,int index) throws VascException {
Object record = entryField.getVascEntry().getVascFrontendData().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");
}
private void setIndexValue(VascEntryField entryField,int index,Object newValue) throws VascException {
Object record = entryField.getVascEntry().getVascFrontendData().getEntryDataObject();
Object value = entryField.getVascEntryFieldValue().getValue(entryField, record);
if (value instanceof List) {
((List)value).set(index, newValue);
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 {
Object record = entryField.getVascEntry().getVascFrontendData().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) {
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;
}
}

View file

@ -0,0 +1,68 @@
/*
* 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 com.idcanet.vasc.core.VascBackend;
import com.idcanet.vasc.core.VascBackendController;
import com.idcanet.vasc.core.VascBackendControllerLocal;
import com.idcanet.vasc.core.VascController;
import com.idcanet.x4o.element.AbstractElementConfigurator;
import com.idcanet.x4o.element.Element;
import com.idcanet.x4o.element.ElementConfiguratorException;
/**
* Adds the backend to the local controller
*
* @author Willem Cazander
* @version 1.0 Nov 16, 2008
*/
public class VascBackendElementConfigurator extends AbstractElementConfigurator {
/**
* @see com.idcanet.x4o.element.AbstractElementConfigurator#doConfigEndTag(com.idcanet.x4o.element.Element)
*/
@Override
public void doConfigEndTag(Element element) throws ElementConfiguratorException {
VascBackend backend = (VascBackend)element.getElementObject();
VascController vascController = VascParser.getVascController(element.getElementContext());
VascBackendController backendController = vascController.getVascBackendControllerResolver().getVascBackendController();
if (backendController instanceof VascBackendControllerLocal) {
try {
((VascBackendControllerLocal)backendController).addVascBackend(backend);
} catch (Exception e) {
throw new ElementConfiguratorException(this,"Couln't add backend: "+e.getMessage(),e);
}
} else {
throw new ElementConfiguratorException(this,"Can not add backend '"+backend.getId()+"' to VascBackendController because we have no access to VascBackendControllerLocal interface.");
}
}
}

View file

@ -0,0 +1,68 @@
/*
* 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 com.idcanet.vasc.core.VascController;
import com.idcanet.vasc.core.VascEntry;
import com.idcanet.vasc.core.VascEntryController;
import com.idcanet.vasc.core.VascEntryControllerLocal;
import com.idcanet.vasc.core.VascException;
import com.idcanet.x4o.element.AbstractElementConfigurator;
import com.idcanet.x4o.element.Element;
import com.idcanet.x4o.element.ElementConfiguratorException;
/**
* Converts the type to the type object
*
* @author Willem Cazander
* @version 1.0 Nov 16, 2008
*/
public class VascEntryElementConfigurator extends AbstractElementConfigurator {
/**
* @see com.idcanet.x4o.element.AbstractElementConfigurator#doConfigEndTag(com.idcanet.x4o.element.Element)
*/
@Override
public void doConfigEndTag(Element element) throws ElementConfiguratorException {
VascEntry entry = (VascEntry)element.getElementObject();
VascController vascController = VascParser.getVascController(element.getElementContext());
VascEntryController entryController = vascController.getVascEntryControllerResolver().getVascEntryController();
if (entryController instanceof VascEntryControllerLocal) {
try {
((VascEntryControllerLocal)entryController).addVascEntry(entry, vascController);
} catch (VascException e) {
throw new ElementConfiguratorException(this,"Couln't add entry: "+e.getMessage(),e);
}
} else {
throw new ElementConfiguratorException(this,"Can not add entry '"+entry.getId()+"' to VascEntryController because we have no access to VascEntryControllerLocal interface.");
}
}
}

View file

@ -0,0 +1,63 @@
/*
* 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 com.idcanet.vasc.core.VascEntryFieldSet;
import com.idcanet.x4o.element.AbstractElementParameterConverter;
import com.idcanet.x4o.element.Element;
import com.idcanet.x4o.element.ElementParameterConverterException;
/**
* Converts the VascEntryFieldSet parameter
*
* @author Willem Cazander
* @version 1.0 Nov 17, 2008
*/
public class VascEntryFieldSetParameterConverter extends AbstractElementParameterConverter {
/**
* @see com.idcanet.x4o.element.AbstractElementParameterConverter#doConvertParameter(com.idcanet.x4o.element.Element, java.lang.Object)
*/
@Override
public Object doConvertParameter(Element element, Object parameterValue) throws ElementParameterConverterException {
if (parameterValue==null) {
throw new NullPointerException("can't convert null parameter");
}
if ("".equals(parameterValue)) {
return null;
}
String[] ids = parameterValue.toString().split(",");
VascEntryFieldSet set = (VascEntryFieldSet)element.getElementObject();
for (String id:ids) {
set.addVascEntryFieldId(id);
}
return null;
}
}

View file

@ -0,0 +1,62 @@
/*
* 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 com.idcanet.vasc.core.VascController;
import com.idcanet.x4o.element.AbstractElementParameterConverter;
import com.idcanet.x4o.element.Element;
import com.idcanet.x4o.element.ElementParameterConverterException;
/**
* Converts the type to the type object
*
* @author Willem Cazander
* @version 1.0 Nov 16, 2008
*/
public class VascEntryFieldTypeParameterConverter extends AbstractElementParameterConverter {
/**
* @see com.idcanet.x4o.element.AbstractElementParameterConverter#doConvertParameter(com.idcanet.x4o.element.Element, java.lang.Object)
*/
@Override
public Object doConvertParameter(Element element, Object parameterValue) throws ElementParameterConverterException {
if (parameterValue==null) {
throw new NullPointerException("can't convert null parameter");
}
if ("".equals(parameterValue)) {
parameterValue = "TextField"; // ??
}
String fieldID = parameterValue.toString();
VascController controller = VascParser.getVascController(element.getElementContext());
Object result = controller.getVascEntryFieldTypeControllerResolver().getVascEntryFieldTypeController().getVascEntryFieldTypeById(fieldID);
return result;
}
}

View file

@ -0,0 +1,79 @@
/*
* 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 javax.el.ValueExpression;
import javax.xml.parsers.ParserConfigurationException;
import org.xml.sax.SAXException;
import com.idcanet.vasc.core.VascController;
import com.idcanet.x4o.core.X4OParser;
import com.idcanet.x4o.element.ElementContext;
/**
* Parses the vasc xml streams
*
*
*
* @author Willem Cazander
* @version 1.0 Oct 27, 2008
*/
public class VascParser extends X4OParser {
static public String VASC_LANGUAGE = "vasc";
private VascController vascController = null;
/**
* @see X4OParser#X4OParser(String)
*/
public VascParser(VascController vascController) throws Exception {
super(VASC_LANGUAGE);
if (vascController==null) {
throw new NullPointerException("vascController may not be null");
}
this.vascController=vascController;
}
public VascController getVascController() {
return vascController;
}
static public VascController getVascController(ElementContext context) {
ValueExpression ee = context.getExpressionFactory().createValueExpression(context.getELContext(),"${vascController}", VascController.class);
VascController con = (VascController)ee.getValue(context.getELContext());
return con;
}
protected void preStartParsing() throws ParserConfigurationException,SAXException,IOException {
super.preStartParsing();
// Add the controller to EL
ValueExpression ee = getElementContext().getExpressionFactory().createValueExpression(getElementContext().getELContext(),"${vascController}", VascController.class);
ee.setValue(getElementContext().getELContext(), vascController);
}
}