2
0
Fork 0

Upgraded backend api with generics.

This commit is contained in:
Willem Cazander 2014-05-28 14:16:03 +02:00
parent 9a6227be5b
commit 1b3e65fa83
53 changed files with 282 additions and 256 deletions

View file

@ -22,6 +22,7 @@
package net.forwardfire.vasc.frontend.web.jsf;
import java.io.Serializable;
import java.util.List;
import java.util.Map;
@ -50,7 +51,7 @@ public abstract class AbstractJSFVascFacesControllerBase {
/**
*
*/
public List<Object> executeVascList(String entryId,Map<String,Object> para) {
public List<Serializable> executeVascList(String entryId,Map<String,Object> para) {
try {
// plug all object
VascEntryLocal entry = (VascEntryLocal)getVascController().getVascEntryController().getVascEntryById(entryId);

View file

@ -22,6 +22,7 @@
package net.forwardfire.vasc.frontend.web.jsf;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
@ -78,10 +79,10 @@ public class JSFVascEntryEventListener implements VascEntryFrontendEventListener
throw new RuntimeException(e);
}
*/
List<Object> data = entry.getVascFrontendController().getVascEntryState().getEntryDataList();
List<Serializable> data = entry.getVascFrontendController().getVascEntryState().getEntryDataList();
List<Object> result = new ArrayList<Object>(data.size());
int index = 0;
for (Object o:data) {
for (Serializable o:data) {
VascDataBackendBean b = new VascDataBackendBean(entry,o,index);
result.add(b);
index++;

View file

@ -318,7 +318,7 @@ public class JSFVascEntrySupportBean implements Serializable {
VascEntry parent = entry.getVascFrontendController().getVascEntryState().getParent().getVascEntry();
RowVascAction action = parent.getRowActionById(actionIdString);
Object parentSelected = entry.getVascFrontendController().getVascEntryState().getParent().getEntryDataObject();
Serializable parentSelected = entry.getVascFrontendController().getVascEntryState().getParent().getEntryDataObject();
logger.fine("parentCustomRowaction do on: "+action+" parentSelection: "+parentSelected);
try {
action.doRowAction(parent,parentSelected);
@ -401,7 +401,7 @@ public class JSFVascEntrySupportBean implements Serializable {
Boolean value = state.getMultiActionSelection().get(rowId);
logger.fine("multiRow selected: "+rowId+" value: "+value);
if (value!=null && value==true) {
Object row = state.getEntryDataList().get(rowId);
Serializable row = state.getEntryDataList().get(rowId);
logger.finer("row: "+row);
action.doRowAction(vascEntry, row);
if (action.getId().equals(DeleteRowAction.ACTION_ID)) {
@ -468,7 +468,7 @@ public class JSFVascEntrySupportBean implements Serializable {
VascEntry entry = getVascEntry();
// select record to edit
Object rowObject = entry.getVascFrontendController().getVascEntryState().getParent().getEntryDataObject();
Serializable rowObject = entry.getVascFrontendController().getVascEntryState().getParent().getEntryDataObject();
comp.initGoto(entry.getVascFrontendController().getVascEntryState().getParent(),rowObject);
}
@ -613,7 +613,7 @@ public class JSFVascEntrySupportBean implements Serializable {
VascEntryLink link = comp.getVascEntry().getVascFrontendController().getVascEntryState().getParent().getVascEntry().getVascEntryLinkById(linkId);
comp.initGoto(link,comp.getVascEntry().getVascFrontendController().getVascEntryState().getParent());
Object o = comp.getVascEntry().getVascFrontendController().getVascEntryState().getParent().getEntryDataObject();
Serializable o = comp.getVascEntry().getVascFrontendController().getVascEntryState().getParent().getEntryDataObject();
int index = comp.getVascEntry().getVascFrontendController().getVascEntryState().getParent().getEntryDataList().indexOf(o);
VascDataBackendBean selected = new VascDataBackendBean(entry,o,index);
this.selected=selected;
@ -668,17 +668,17 @@ public class JSFVascEntrySupportBean implements Serializable {
VascEntry entry = comp.getVascEntry();
VascEntryState state = entry.getVascFrontendController().getVascEntryState();
List<Object> sels = new ArrayList<Object>(5);
List<Serializable> sels = new ArrayList<Serializable>(5);
for (Integer rowId:state.getMultiActionSelection().keySet()) {
Boolean value = state.getMultiActionSelection().get(rowId);
logger.fine("multiRow delete: "+rowId+" value: "+value);
if (value!=null && value==true) {
Object row = state.getEntryDataList().get(rowId);
Serializable row = state.getEntryDataList().get(rowId);
sels.add(row);
}
}
if (sels.isEmpty()==false) {
for (Object row:sels) {
for (Serializable row:sels) {
entry.getVascFrontendController().getVascEntryState().setEntryDataObject(row);
entry.getVascFrontendController().getVascFrontendActions().deleteObject();
}

View file

@ -23,6 +23,7 @@
package net.forwardfire.vasc.frontend.web.jsf;
import java.io.IOException;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
@ -72,7 +73,7 @@ public class JSFVascUIComponent extends UIComponentBase {
private VascEntryLink link = null;
private VascEntryState linkState = null;
private VascEntryState state = null;
private Object stateEditId = null;
private Serializable stateEditId = null;
private Logger logger = null;
private Boolean initClear = null;
private String injectTableOptionOnChange = null;
@ -182,7 +183,7 @@ public class JSFVascUIComponent extends UIComponentBase {
this.state=state;
}
protected void initGoto(VascEntryState state,Object stateEditId) {
protected void initGoto(VascEntryState state,Serializable stateEditId) {
logger.fine("init goto "+state);
this.state=state;
this.stateEditId=stateEditId;
@ -218,7 +219,7 @@ public class JSFVascUIComponent extends UIComponentBase {
}
if (stateEditId!=null) {
Object rowObject = stateEditId;
Serializable rowObject = stateEditId;
// setup for renderEdit() of frontend
List<Object> list = new ArrayList<Object>(1);

View file

@ -29,11 +29,8 @@ import net.forwardfire.vasc.backend.VascBackendException;
import net.forwardfire.vasc.backend.VascEntryFieldValue;
import net.forwardfire.vasc.core.VascEntry;
import net.forwardfire.vasc.core.VascEntryField;
import net.forwardfire.vasc.core.VascException;
import net.forwardfire.vasc.frontend.VascFrontendDataSelector.EntryFieldSelectType;
/**
*
*
@ -44,11 +41,11 @@ public class VascDataBackendBean implements Serializable {
private static final long serialVersionUID = 3881688974089760074L;
private VascEntry entry = null;
private Object record = null;
private Serializable record = null;
private boolean realValue = false;
private int recordId = 0;
public VascDataBackendBean(VascEntry entry,Object record,int recordId) {
public VascDataBackendBean(VascEntry entry,Serializable record,int recordId) {
this.entry=entry;
this.record=record;
this.recordId=recordId;
@ -102,7 +99,7 @@ public class VascDataBackendBean implements Serializable {
}
}
public Object getRecord() {
public Serializable getRecord() {
return record;
}