diff --git a/.externalToolBuilders/org.eclipse.wst.validation.validationbuilder.launch b/.externalToolBuilders/org.eclipse.wst.validation.validationbuilder.launch
deleted file mode 100644
index 6ef634c..0000000
--- a/.externalToolBuilders/org.eclipse.wst.validation.validationbuilder.launch
+++ /dev/null
@@ -1,7 +0,0 @@
-
-
-
-
-
-
-
diff --git a/.mymetadata b/.mymetadata
deleted file mode 100644
index 0054d57..0000000
--- a/.mymetadata
+++ /dev/null
@@ -1,13 +0,0 @@
-
-
-
-
-
-
-
diff --git a/.settings/com.genuitec.eclipse.core.prefs b/.settings/com.genuitec.eclipse.core.prefs
deleted file mode 100644
index fc7c45b..0000000
--- a/.settings/com.genuitec.eclipse.core.prefs
+++ /dev/null
@@ -1,4 +0,0 @@
-#Thu Jan 08 18:05:54 CET 2009
-eclipse.preferences.version=1
-validator.Checked=target
-validator.Unchecked=
diff --git a/.settings/com.genuitec.eclipse.j2eedt.core.prefs b/.settings/com.genuitec.eclipse.j2eedt.core.prefs
deleted file mode 100644
index 80cf3e4..0000000
--- a/.settings/com.genuitec.eclipse.j2eedt.core.prefs
+++ /dev/null
@@ -1,4 +0,0 @@
-#Thu Jan 15 07:20:11 CET 2009
-defaultTldInfo=f\=http\://java.sun.com/jsf/core;http\://java.sun.com/jsf/html\=h;http\://struts.apache.org/tags-bean\=bean;http\://java.sun.com/jsp/jstl/fmt\=fmt;bean\=http\://struts.apache.org/tags-bean;nested\=http\://struts.apache.org/tags-nested;http\://java.sun.com/jsp/jstl/sql\=sql;fmt\=http\://java.sun.com/jsp/jstl/fmt;c\=http\://java.sun.com/jsp/jstl/core;http\://struts.apache.org/tags-logic\=logic;http\://java.sun.com/jsp/jstl/xml\=x;http\://java.sun.com/jsp/jstl/core\=c;logic\=http\://struts.apache.org/tags-logic;h\=http\://java.sun.com/jsf/html;http\://struts.apache.org/tags-tiles\=tiles;http\://java.sun.com/jsp/jstl/functions\=fn;tiles\=http\://struts.apache.org/tags-tiles;sql\=http\://java.sun.com/jsp/jstl/sql;http\://struts.apache.org/tags-html\=html;html\=http\://struts.apache.org/tags-html;http\://struts.apache.org/tags-nested\=nested;http\://java.sun.com/jsf/core\=f;fn\=http\://java.sun.com/jsp/jstl/functions;x\=http\://java.sun.com/jsp/jstl/xml
-eclipse.preferences.version=1
-j2ee.deployment.web.archive_dependent_projects=always
diff --git a/.settings/com.genuitec.eclipse.ws.blue.prefs b/.settings/com.genuitec.eclipse.ws.blue.prefs
deleted file mode 100644
index 284916e..0000000
--- a/.settings/com.genuitec.eclipse.ws.blue.prefs
+++ /dev/null
@@ -1,4 +0,0 @@
-#Thu Jan 15 07:20:11 CET 2009
-blue.framework.id=
-blue.target.server=
-eclipse.preferences.version=1
diff --git a/doc/README.txt b/doc/README.txt
deleted file mode 100644
index 6464584..0000000
--- a/doc/README.txt
+++ /dev/null
@@ -1,267 +0,0 @@
-
-
-eclipse 3.2
-
-To build/run the swt stuff you need the Visual Editor plug in installed from the calisto site.
-
-eclipse 3.3
-
-Down load http://www.ehecht.com/eclipse_ve/ve.html (lin_mac version)
-
-Unzip and move the plug ins and features into the plug in and features directory of eclipse.
-
-Swing will run by default.
-
--- XyReasscan ?
-
-zie tables statline.cbs.nl voor bs asielverzoeken nl
-
-
----- Object tree:
-
-3 layers
-
-- Data Backend
- - JPA or Hibernate
- - Meta Query
- - LDAP
- # List via geparametered xql query
- # Save
- # Merge
- # Delete
- # Create ?
- FilteringDataSource
- PagingDataSource
- FilteringPagingDataSource
- Ordering
- Parameter
-
-- Data Source Controller
- - Data Access Controller
- # User ACL on data items/columns
- # Create new entry hooks
-
-- Table Controller
- - User Settings
-
-
-- Data Frontends
- - Extjs
- - Swing
- - WS
- - SWT via SwingWT
- - JSF (met utr plugin)
-
-
-
-- default view field
-- Admin fields and order
-- Admin field groups -> 'collapse
-- List filters auto by type
-- search fields
-
-verbose_name_plural
-The plural name for the object:
-verbose_name_plural = "stories"
-If this isn’t given, Django will use verbose_name + "s"
-
-List of Magic Field Names
-
- * created_at
- * created_on
- * updated_at
- * updated_on
- * lock_version
- * type
- * id
- * #{table_name}_count
- * position
- * parent_id
- * lft
- * rgt
- * quote_value (is used for quoting)
- * template
-
-
-
-- plural
-- ordering
-- order_with_respect_to
-
-# admin
-- date_hierarchy
-- fields = (
- (None, {
- 'fields': ('url', 'title', 'content', 'sites')
- }),
- ('Advanced options', {
- 'classes': 'collapse',
- 'fields' : ('enable_comments', 'registration_required', 'template_name')
- 'description' : 'sdf'
- }),
- )
-- JS
-- list_display_links
-- list_filter = BooleanField, DateField, DateTimeField or ForeignKey.
-- list_per_page
-- ordering def
-- save_as
-- search_fields
-
-@Entity
-@VascAdmin(list=true,edit=true,create=true,delete=false)
-public class BlogPost {
-
- @VascPrimaryKey
- @VascName(key="generic.id.name")
- @VascDescription(key="generic.id.name")
- @VascHelpId(key="generic.id.help")
- @VascImage(key="generid.id.image");
- Integer id;
-
- @Column(columnName="title")
- @VascDisplayName
- @VascUserRoles(list="(floormanager&sitemanager)|admin" editViewOnly="floormanager" edit="sitemanager|admin")
- String title;
-
- @VascEditorType(type="slugField")
- String slug;
-
- @VascChoices()
- @VascDefaultValue(key="")
- String tags;
-
- @VascRegex(regex="<(.*)>" key="generic.regex.html.tagsNotAllowed")
- String content;
-
- @VascEditorType(type="floatField" hints="max_digits=3,decimal_places=2")
- @VascFieldOptions
- @VascColumnWidth(width=130)
- Float price;
-
- @VascModelReference
- @VascDefaultValue
- @VascObjectNotNull
- BlogStatus blogStatus;
-
- @VascEditorType(type="dateField" hints="auto_now=true,auto_now_add=true")
- @VascDefaultValue(key="new_date")
- @VascUserRoles(list="admin")
- Date createdDate
-
- @VascEventChannel(channel="BlogPost.modifiedDate" create=true)
- Date modifiedDate
-
- @VascDateFuture
- Date publicedDate
-}
-
-
-
-
- vasc
-
- admin=true
- backend=extjs
- path=/js/extjs/*
-
-
- vasc
- /vasc/*
-
-
-
-EmployeeDataSource dataSource = new EmployeeDataSource();
-dataSource.setJdbcTemplate(new JdbcTemplate(employeeDataSource()));
- FilteringPaginator filteringPaginator = new FilteringPaginator(dataSource, EmployeeReportObject.class);
- JsfCrudAdapter adapter = new JsfCrudAdapter(filteringPaginator, (CrudController)empCrud().getController()){
- public Serializable getEntity() {
- Object object = ((Row)getModel().getRowData()).getObject();
- EmployeeReportObject employeeReportObject = (EmployeeReportObject) object;
- Employee employee = new Employee();
- employee.setId(employeeReportObject.getId());
- return employee;
- }
- };
-
- return adapter;
-
-EVt;
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-@SuppressWarnings({ "unchecked", "serial" })
-@Bean(scope = DefaultScopes.SESSION)
-public JsfCrudAdapter empRecordCrud() {
- EmployeeDataSource dataSource = new EmployeeDataSource();
- dataSource.setJdbcTemplate(new JdbcTemplate(employeeDataSource()));
- FilteringPaginator filteringPaginator = new FilteringPaginator(dataSource, EmployeeReportObject.class);
- JsfCrudAdapter adapter = new JsfCrudAdapter(filteringPaginator, (CrudController)empCrud().getController()){
- public Serializable getEntity() {
- Object object = ((Row)getModel().getRowData()).getObject();
- EmployeeReportObject employeeReportObject = (EmployeeReportObject) object;
- Employee employee = new Employee();
- employee.setId(employeeReportObject.getId());
- return employee;
- }
- };
-
- return adapter;
-}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/src/site/apt/features.apt b/src/site/apt/features.apt
index de064ef..dc9e8d1 100644
--- a/src/site/apt/features.apt
+++ b/src/site/apt/features.apt
@@ -3,4 +3,276 @@ VASC Features
* Mulple Type of Frontend rendering supported
* Different Type of Backend data is supported
-
\ No newline at end of file
+
+OLD README:
+
++--
+
+
+eclipse 3.2
+
+To build/run the swt stuff you need the Visual Editor plug in installed from the calisto site.
+
+eclipse 3.3
+
+Down load http://www.ehecht.com/eclipse_ve/ve.html (lin_mac version)
+
+Unzip and move the plug ins and features into the plug in and features directory of eclipse.
+
+Swing will run by default.
+
+-- XyReasscan ?
+
+zie tables statline.cbs.nl voor bs asielverzoeken nl
+
+
+---- Object tree:
+
+3 layers
+
+- Data Backend
+ - JPA or Hibernate
+ - Meta Query
+ - LDAP
+ # List via geparametered xql query
+ # Save
+ # Merge
+ # Delete
+ # Create ?
+ FilteringDataSource
+ PagingDataSource
+ FilteringPagingDataSource
+ Ordering
+ Parameter
+
+- Data Source Controller
+ - Data Access Controller
+ # User ACL on data items/columns
+ # Create new entry hooks
+
+- Table Controller
+ - User Settings
+
+
+- Data Frontends
+ - Extjs
+ - Swing
+ - WS
+ - SWT via SwingWT
+ - JSF (met utr plugin)
+
+
+
+- default view field
+- Admin fields and order
+- Admin field groups -> 'collapse
+- List filters auto by type
+- search fields
+
+verbose_name_plural
+The plural name for the object:
+verbose_name_plural = "stories"
+If this isn’t given, Django will use verbose_name + "s"
+
+List of Magic Field Names
+
+ * created_at
+ * created_on
+ * updated_at
+ * updated_on
+ * lock_version
+ * type
+ * id
+ * #{table_name}_count
+ * position
+ * parent_id
+ * lft
+ * rgt
+ * quote_value (is used for quoting)
+ * template
+
+
+
+- plural
+- ordering
+- order_with_respect_to
+
+# admin
+- date_hierarchy
+- fields = (
+ (None, {
+ 'fields': ('url', 'title', 'content', 'sites')
+ }),
+ ('Advanced options', {
+ 'classes': 'collapse',
+ 'fields' : ('enable_comments', 'registration_required', 'template_name')
+ 'description' : 'sdf'
+ }),
+ )
+- JS
+- list_display_links
+- list_filter = BooleanField, DateField, DateTimeField or ForeignKey.
+- list_per_page
+- ordering def
+- save_as
+- search_fields
+
+@Entity
+@VascAdmin(list=true,edit=true,create=true,delete=false)
+public class BlogPost {
+
+ @VascPrimaryKey
+ @VascName(key="generic.id.name")
+ @VascDescription(key="generic.id.name")
+ @VascHelpId(key="generic.id.help")
+ @VascImage(key="generid.id.image");
+ Integer id;
+
+ @Column(columnName="title")
+ @VascDisplayName
+ @VascUserRoles(list="(floormanager&sitemanager)|admin" editViewOnly="floormanager" edit="sitemanager|admin")
+ String title;
+
+ @VascEditorType(type="slugField")
+ String slug;
+
+ @VascChoices()
+ @VascDefaultValue(key="")
+ String tags;
+
+ @VascRegex(regex="<(.*)>" key="generic.regex.html.tagsNotAllowed")
+ String content;
+
+ @VascEditorType(type="floatField" hints="max_digits=3,decimal_places=2")
+ @VascFieldOptions
+ @VascColumnWidth(width=130)
+ Float price;
+
+ @VascModelReference
+ @VascDefaultValue
+ @VascObjectNotNull
+ BlogStatus blogStatus;
+
+ @VascEditorType(type="dateField" hints="auto_now=true,auto_now_add=true")
+ @VascDefaultValue(key="new_date")
+ @VascUserRoles(list="admin")
+ Date createdDate
+
+ @VascEventChannel(channel="BlogPost.modifiedDate" create=true)
+ Date modifiedDate
+
+ @VascDateFuture
+ Date publicedDate
+}
+
+
+
+
+ vasc
+
+ admin=true
+ backend=extjs
+ path=/js/extjs/*
+
+
+ vasc
+ /vasc/*
+
+
+
+EmployeeDataSource dataSource = new EmployeeDataSource();
+dataSource.setJdbcTemplate(new JdbcTemplate(employeeDataSource()));
+ FilteringPaginator filteringPaginator = new FilteringPaginator(dataSource, EmployeeReportObject.class);
+ JsfCrudAdapter adapter = new JsfCrudAdapter(filteringPaginator, (CrudController)empCrud().getController()){
+ public Serializable getEntity() {
+ Object object = ((Row)getModel().getRowData()).getObject();
+ EmployeeReportObject employeeReportObject = (EmployeeReportObject) object;
+ Employee employee = new Employee();
+ employee.setId(employeeReportObject.getId());
+ return employee;
+ }
+ };
+
+ return adapter;
+
+EVt;
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+@SuppressWarnings({ "unchecked", "serial" })
+@Bean(scope = DefaultScopes.SESSION)
+public JsfCrudAdapter empRecordCrud() {
+ EmployeeDataSource dataSource = new EmployeeDataSource();
+ dataSource.setJdbcTemplate(new JdbcTemplate(employeeDataSource()));
+ FilteringPaginator filteringPaginator = new FilteringPaginator(dataSource, EmployeeReportObject.class);
+ JsfCrudAdapter adapter = new JsfCrudAdapter(filteringPaginator, (CrudController)empCrud().getController()){
+ public Serializable getEntity() {
+ Object object = ((Row)getModel().getRowData()).getObject();
+ EmployeeReportObject employeeReportObject = (EmployeeReportObject) object;
+ Employee employee = new Employee();
+ employee.setId(employeeReportObject.getId());
+ return employee;
+ }
+ };
+
+ return adapter;
+}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
++--
\ No newline at end of file
diff --git a/doc/TODO.txt b/src/site/apt/todo.apt
similarity index 97%
rename from doc/TODO.txt
rename to src/site/apt/todo.apt
index 97cff65..b567db0 100644
--- a/doc/TODO.txt
+++ b/src/site/apt/todo.apt
@@ -1,3 +1,6 @@
+TODO LIST
+
++--
- (30%) X4O client/server config
@@ -28,3 +31,5 @@
=== DONE ===
+
++--
diff --git a/vasc-backend-jpa/src/main/resources/.empty b/vasc-backend-jpa/src/main/resources/.empty
new file mode 100644
index 0000000..e69de29
diff --git a/vasc-backend-jpa/src/test/java/.empty b/vasc-backend-jpa/src/test/java/.empty
new file mode 100644
index 0000000..e69de29
diff --git a/vasc-backend-jpa/src/test/resources/.empty b/vasc-backend-jpa/src/test/resources/.empty
new file mode 100644
index 0000000..e69de29
diff --git a/vasc-backend-ldap/src/main/resources/.empty b/vasc-backend-ldap/src/main/resources/.empty
new file mode 100644
index 0000000..e69de29
diff --git a/vasc-backend-ldap/src/test/java/.empty b/vasc-backend-ldap/src/test/java/.empty
new file mode 100644
index 0000000..e69de29
diff --git a/vasc-backend-ldap/src/test/resources/.empty b/vasc-backend-ldap/src/test/resources/.empty
new file mode 100644
index 0000000..e69de29
diff --git a/vasc-core/src/main/java/com/idcanet/vasc/annotations/VascEventListener.java b/vasc-core/src/main/java/com/idcanet/vasc/annotations/VascEventListener.java
index 9e99e6a..1d8646c 100644
--- a/vasc-core/src/main/java/com/idcanet/vasc/annotations/VascEventListener.java
+++ b/vasc-core/src/main/java/com/idcanet/vasc/annotations/VascEventListener.java
@@ -41,5 +41,6 @@ import java.lang.annotation.Target;
@Target(ElementType.TYPE)
public @interface VascEventListener {
- Class>[] listeners();
+ String[] backendEventListeners();
+ String[] frontendEventListeners();
}
\ No newline at end of file
diff --git a/vasc-core/src/main/java/com/idcanet/vasc/core/VascEntry.java b/vasc-core/src/main/java/com/idcanet/vasc/core/VascEntry.java
index 70cff2d..d7e2b51 100644
--- a/vasc-core/src/main/java/com/idcanet/vasc/core/VascEntry.java
+++ b/vasc-core/src/main/java/com/idcanet/vasc/core/VascEntry.java
@@ -32,9 +32,7 @@ import java.util.List;
import com.idcanet.vasc.core.actions.ColumnVascAction;
import com.idcanet.vasc.core.actions.GlobalVascAction;
import com.idcanet.vasc.core.actions.RowVascAction;
-import com.idcanet.vasc.core.entry.VascEntryBackendEventListener;
import com.idcanet.vasc.core.entry.VascEntryFieldEventChannel;
-import com.idcanet.vasc.core.entry.VascEntryFrontendEventListener;
/**
* The main vasc entry
@@ -383,25 +381,25 @@ public interface VascEntry extends Cloneable,Serializable {
* Added an VascEntryBackendEventListener
* @param listener The class of the event listener.
*/
- public void addVascEntryBackendEventListener(Class listener);
+ public void addVascEntryBackendEventListener(String listener);
/**
* Returns the list of VascEntryBackendEventListener
* @return
*/
- public List> getVascEntryBackendEventListeners();
+ public List getVascEntryBackendEventListeners();
/**
* Added an VascEntryFrontendEventListener
* @param listener The class of the event listener.
*/
- public void addVascEntryFrontendEventListener(Class listener);
+ public void addVascEntryFrontendEventListener(String listener);
/**
* Returns the list of VascEntryFrontendEventListener
* @return
*/
- public List> getVascEntryFrontendEventListeners();
+ public List getVascEntryFrontendEventListeners();
public void addListOption(VascEntryField listOption);
diff --git a/vasc-core/src/main/java/com/idcanet/vasc/core/entry/VascEntryBackendEventListener.java b/vasc-core/src/main/java/com/idcanet/vasc/core/entry/VascEntryBackendEventListener.java
index e4fa447..668346f 100644
--- a/vasc-core/src/main/java/com/idcanet/vasc/core/entry/VascEntryBackendEventListener.java
+++ b/vasc-core/src/main/java/com/idcanet/vasc/core/entry/VascEntryBackendEventListener.java
@@ -39,18 +39,28 @@ import com.idcanet.vasc.core.VascEntry;
public interface VascEntryBackendEventListener extends Serializable {
public enum VascBackendEventType {
- EXECUTE,
- PERSIST,
- MERGE,
- DELETE,
- PROVIDE_FIELD_VALUE,
- PROVIDE_RECORD_CREATOR,
- TOTAL_EXECUTE_SIZE,
- MOVE_DOWN,
- MOVE_UP
+ PRE_EXECUTE,
+ PRE_PERSIST,
+ PRE_MERGE,
+ PRE_DELETE,
+ PRE_PROVIDE_FIELD_VALUE,
+ PRE_PROVIDE_RECORD_CREATOR,
+ PRE_TOTAL_EXECUTE_SIZE,
+ PRE_MOVE_DOWN,
+ PRE_MOVE_UP,
+
+ POST_EXECUTE,
+ POST_PERSIST,
+ POST_MERGE,
+ POST_DELETE,
+ POST_PROVIDE_FIELD_VALUE,
+ POST_PROVIDE_RECORD_CREATOR,
+ POST_TOTAL_EXECUTE_SIZE,
+ POST_MOVE_DOWN,
+ POST_MOVE_UP
}
- public VascBackendEventType getEventType();
+ public VascBackendEventType[] getEventType();
/**
* Is executed when the type of event is fired.
diff --git a/vasc-core/src/main/java/com/idcanet/vasc/core/entry/VascEntryFrontendEventListener.java b/vasc-core/src/main/java/com/idcanet/vasc/core/entry/VascEntryFrontendEventListener.java
index 63351ce..b8ba926 100644
--- a/vasc-core/src/main/java/com/idcanet/vasc/core/entry/VascEntryFrontendEventListener.java
+++ b/vasc-core/src/main/java/com/idcanet/vasc/core/entry/VascEntryFrontendEventListener.java
@@ -41,17 +41,19 @@ public interface VascEntryFrontendEventListener extends Serializable {
public enum VascFrontendEventType {
EXCEPTION,
- DATA_CREATE,
- DATA_READ,
- DATA_SELECT,
- DATA_PRE_UPDATE,
- DATA_POST_UPDATE,
- DATA_DELETE,
- DATA_LIST_UPDATE,
+ PRE_CREATE,
+ POST_CREATE,
+ PRE_READ,
+ POST_READ,
+ PRE_UPDATE,
+ POST_UPDATE,
+ PRE_DELETE,
+ POST_DELETE,
- DATA_SORT,
- DATA_PAGE,
- DATA_SEARCH,
+ SELECT,
+ SORT,
+ PAGE,
+ SEARCH,
OPTION_UPDATE,
}
diff --git a/vasc-core/src/main/java/com/idcanet/vasc/impl/DefaultVascEntry.java b/vasc-core/src/main/java/com/idcanet/vasc/impl/DefaultVascEntry.java
index c8f9ddb..d1566a5 100644
--- a/vasc-core/src/main/java/com/idcanet/vasc/impl/DefaultVascEntry.java
+++ b/vasc-core/src/main/java/com/idcanet/vasc/impl/DefaultVascEntry.java
@@ -87,8 +87,8 @@ public class DefaultVascEntry implements VascEntry {
private List vascLinkEntries = null;
private Map entryParameters = null;
private VascEntryFieldEventChannel vascEntryFieldEventChannel = null;
- private List> eventEntryFrontendEventListeners = null;
- private List> eventEntryBackendEventListeners = null;
+ private List eventEntryFrontendEventListeners = null;
+ private List eventEntryBackendEventListeners = null;
private List listOptions = null;
private List backendFilters = null;
@@ -109,8 +109,8 @@ public class DefaultVascEntry implements VascEntry {
vascLinkEntries = new ArrayList(10);
entryParameters = new HashMap(10);
- eventEntryFrontendEventListeners = new ArrayList>(10);
- eventEntryBackendEventListeners = new ArrayList>(10);
+ eventEntryFrontendEventListeners = new ArrayList(10);
+ eventEntryBackendEventListeners = new ArrayList(10);
listOptions = new ArrayList(5);
backendFilters = new ArrayList(3);
}
@@ -720,7 +720,7 @@ public class DefaultVascEntry implements VascEntry {
* Added an VascEntryBackendEventListener
* @param listener The class of the event listener.
*/
- public void addVascEntryBackendEventListener(Class listener) {
+ public void addVascEntryBackendEventListener(String listener) {
eventEntryBackendEventListeners.add(listener);
}
@@ -728,7 +728,7 @@ public class DefaultVascEntry implements VascEntry {
* Returns the list of VascEntryBackendEventListener
* @return
*/
- public List> getVascEntryBackendEventListeners() {
+ public List getVascEntryBackendEventListeners() {
return eventEntryBackendEventListeners;
}
@@ -736,7 +736,7 @@ public class DefaultVascEntry implements VascEntry {
* Added an VascEntryFrontendEventListener
* @param listener The class of the event listener.
*/
- public void addVascEntryFrontendEventListener(Class listener) {
+ public void addVascEntryFrontendEventListener(String listener) {
eventEntryFrontendEventListeners.add(listener);
}
@@ -744,7 +744,7 @@ public class DefaultVascEntry implements VascEntry {
* Returns the list of VascEntryFrontendEventListener
* @return
*/
- public List> getVascEntryFrontendEventListeners() {
+ public List getVascEntryFrontendEventListeners() {
return eventEntryFrontendEventListeners;
}
diff --git a/vasc-core/src/main/java/com/idcanet/vasc/impl/DefaultVascFactory.java b/vasc-core/src/main/java/com/idcanet/vasc/impl/DefaultVascFactory.java
index f92d266..fb4af8f 100644
--- a/vasc-core/src/main/java/com/idcanet/vasc/impl/DefaultVascFactory.java
+++ b/vasc-core/src/main/java/com/idcanet/vasc/impl/DefaultVascFactory.java
@@ -35,6 +35,7 @@ import com.idcanet.vasc.core.VascController;
import com.idcanet.vasc.core.VascEntry;
import com.idcanet.vasc.core.VascException;
import com.idcanet.vasc.core.VascFrontendData;
+import com.idcanet.vasc.core.entry.VascEntryFrontendEventListener;
import com.idcanet.vasc.impl.entry.DefaultVascEntryResourceResolver;
import com.idcanet.vasc.impl.entry.VascValidatorsValidatorService;
import com.idcanet.vasc.impl.type.DefaultVascEntryFieldTypeController;
@@ -86,8 +87,13 @@ public class DefaultVascFactory {
return vascFrontendData;
}
+ /**
+ * Gets a backend of the backend controller and addes all the proxy classes.
+ * @param entry
+ * @return
+ */
static public VascBackend getProxyVascBackend(VascEntry entry) {
- // Get the real backend
+ // Get the 'real' backend
VascBackend backend = entry.getVascFrontendData().getVascController().getVascBackendController().getVascBackendById(entry.getBackendId());
// logs all actions log logger
@@ -109,6 +115,11 @@ public class DefaultVascFactory {
if (backend.isPageable()==false) {
backend = new VascBackendProxyPaged(backend,entry);
}
+
+ // execute backend event listeners
+ backend = new VascBackendProxyEventExecutor(backend,entry);
+
+ // return the configed backend.
return backend;
}
}
\ No newline at end of file
diff --git a/vasc-core/src/main/java/com/idcanet/vasc/impl/DefaultVascFrontendData.java b/vasc-core/src/main/java/com/idcanet/vasc/impl/DefaultVascFrontendData.java
index a0d6be7..ca30fd8 100644
--- a/vasc-core/src/main/java/com/idcanet/vasc/impl/DefaultVascFrontendData.java
+++ b/vasc-core/src/main/java/com/idcanet/vasc/impl/DefaultVascFrontendData.java
@@ -248,8 +248,17 @@ public class DefaultVascFrontendData implements VascFrontendData {
public void initFrontendListeners(VascEntry entry) throws InstantiationException, IllegalAccessException {
- for (Class clazz:entry.getVascEntryFrontendEventListeners()) {
- VascEntryFrontendEventListener listener = clazz.newInstance();
+ ClassLoader cl = Thread.currentThread().getContextClassLoader();
+ if (cl==null) {
+ cl = entry.getClass().getClassLoader();
+ }
+ for (String clazz:entry.getVascEntryFrontendEventListeners()) {
+ VascEntryFrontendEventListener listener;
+ try {
+ listener = (VascEntryFrontendEventListener)cl.loadClass(clazz).newInstance();
+ } catch (ClassNotFoundException e) {
+ throw new RuntimeException("Could not load VascEntryFrontendEventListener of: "+clazz);
+ }
addVascEntryFrontendEventListener(listener);
}
}
diff --git a/vasc-core/src/main/java/com/idcanet/vasc/impl/DefaultVascFrontendHelper.java b/vasc-core/src/main/java/com/idcanet/vasc/impl/DefaultVascFrontendHelper.java
index 2466d1d..f0aee14 100644
--- a/vasc-core/src/main/java/com/idcanet/vasc/impl/DefaultVascFrontendHelper.java
+++ b/vasc-core/src/main/java/com/idcanet/vasc/impl/DefaultVascFrontendHelper.java
@@ -230,6 +230,7 @@ public class DefaultVascFrontendHelper implements VascFrontendHelper {
*/
public Object createObject(VascEntry entry) {
try {
+ fireVascEvent(entry,VascEntryFrontendEventListener.VascFrontendEventType.PRE_CREATE, null);
Object object = entry.getVascFrontendData().getVascEntryState().getVascBackend().provideVascEntryRecordCreator(entry.clone()).newRecord(entry);
if (object==null) {
throw new IllegalStateException("Can't work with null object for backend storage.");
@@ -252,7 +253,7 @@ public class DefaultVascFrontendHelper implements VascFrontendHelper {
logger.finer("Setting default value for: "+field.getName()+" def: "+defaultValue);
field.getVascEntryFieldValue().setValue(field, object, defaultValue);
}
- fireVascEvent(entry,VascEntryFrontendEventListener.VascFrontendEventType.DATA_CREATE, object);
+ fireVascEvent(entry,VascEntryFrontendEventListener.VascFrontendEventType.POST_CREATE, object);
return object;
} catch (Exception e) {
handleException(entry,e);
@@ -301,7 +302,7 @@ public class DefaultVascFrontendHelper implements VascFrontendHelper {
Object object = entry.getVascFrontendData().getVascEntryState().getEntryDataObject();
Object result = null;
try {
- fireVascEvent(entry,VascEntryFrontendEventListener.VascFrontendEventType.DATA_PRE_UPDATE,object);
+ fireVascEvent(entry,VascEntryFrontendEventListener.VascFrontendEventType.PRE_UPDATE,object);
int index = removeObjectFromDataList(entry,object);
// merge object on backend
@@ -315,8 +316,7 @@ public class DefaultVascFrontendHelper implements VascFrontendHelper {
// put object back in list
entry.getVascFrontendData().getVascEntryState().getEntryDataList().add(index, result);
entry.getVascFrontendData().getVascEntryState().setEntryDataObject(null);
- fireVascEvent(entry,VascEntryFrontendEventListener.VascFrontendEventType.DATA_POST_UPDATE,result);
- fireVascEvent(entry,VascEntryFrontendEventListener.VascFrontendEventType.DATA_LIST_UPDATE,result);
+ fireVascEvent(entry,VascEntryFrontendEventListener.VascFrontendEventType.POST_UPDATE,result);
} catch (Exception e) {
handleException(entry,e);
}
@@ -330,6 +330,7 @@ public class DefaultVascFrontendHelper implements VascFrontendHelper {
*/
public void deleteObject(VascEntry entry) {
Object object = entry.getVascFrontendData().getVascEntryState().getEntryDataObject();
+ fireVascEvent(entry,VascEntryFrontendEventListener.VascFrontendEventType.PRE_DELETE, object);
try {
entry.getVascFrontendData().getVascEntryState().getVascBackend().delete(object);
} catch (Exception e) {
@@ -337,14 +338,14 @@ public class DefaultVascFrontendHelper implements VascFrontendHelper {
}
removeObjectFromDataList(entry,object);
entry.getVascFrontendData().getVascEntryState().setEntryDataObject(null);
- fireVascEvent(entry,VascEntryFrontendEventListener.VascFrontendEventType.DATA_DELETE, object);
- fireVascEvent(entry,VascEntryFrontendEventListener.VascFrontendEventType.DATA_LIST_UPDATE, object);
+ fireVascEvent(entry,VascEntryFrontendEventListener.VascFrontendEventType.POST_DELETE, object);
}
/**
* @see com.idcanet.vasc.core.VascFrontendHelper#refreshData(com.idcanet.vasc.core.VascEntry)
*/
public void refreshData(VascEntry entry) {
+ fireVascEvent(entry,VascEntryFrontendEventListener.VascFrontendEventType.PRE_READ, null);
entry.getVascFrontendData().getVascEntryState().setEntryDataObject(null);
try {
// check and correct max page size
@@ -364,8 +365,7 @@ public class DefaultVascFrontendHelper implements VascFrontendHelper {
} catch (Exception e) {
handleException(entry, e);
}
- fireVascEvent(entry,VascEntryFrontendEventListener.VascFrontendEventType.DATA_READ, null);
- fireVascEvent(entry,VascEntryFrontendEventListener.VascFrontendEventType.DATA_LIST_UPDATE, null);
+ fireVascEvent(entry,VascEntryFrontendEventListener.VascFrontendEventType.POST_READ, null);
}
public void headerOptionsCreatedFillData(VascEntry entry) {
@@ -474,7 +474,7 @@ public class DefaultVascFrontendHelper implements VascFrontendHelper {
String sortID = field.getBackendName();
entry.getVascFrontendData().getVascEntryState().getVascBackendState().setSortField(sortID);
entry.getVascFrontendData().getVascEntryState().getVascBackendState().setPageIndex(0);
- fireVascEvent(entry,VascEntryFrontendEventListener.VascFrontendEventType.DATA_SORT, field);
+ fireVascEvent(entry,VascEntryFrontendEventListener.VascFrontendEventType.SORT, field);
refreshData(entry);
}
@@ -483,7 +483,7 @@ public class DefaultVascFrontendHelper implements VascFrontendHelper {
entry.getVascFrontendData().getVascEntryState().getVascBackendState().setSearchString(searchString);
entry.getVascFrontendData().getVascEntryState().getVascBackendState().setSortField(null);
entry.getVascFrontendData().getVascEntryState().getVascBackendState().setPageIndex(0);
- fireVascEvent(entry,VascEntryFrontendEventListener.VascFrontendEventType.DATA_SEARCH, searchString);
+ fireVascEvent(entry,VascEntryFrontendEventListener.VascFrontendEventType.SEARCH, searchString);
refreshData(entry);
}
@@ -498,7 +498,7 @@ public class DefaultVascFrontendHelper implements VascFrontendHelper {
}
entry.getVascFrontendData().getVascEntryState().getVascBackendState().setPageIndex(pageIndex);
- fireVascEvent(entry,VascEntryFrontendEventListener.VascFrontendEventType.DATA_PAGE, pageIndex);
+ fireVascEvent(entry,VascEntryFrontendEventListener.VascFrontendEventType.PAGE, pageIndex);
// lets load data;
refreshData(entry);
diff --git a/vasc-core/src/main/java/com/idcanet/vasc/impl/VascBackendProxyEventExecutor.java b/vasc-core/src/main/java/com/idcanet/vasc/impl/VascBackendProxyEventExecutor.java
new file mode 100644
index 0000000..9d68bee
--- /dev/null
+++ b/vasc-core/src/main/java/com/idcanet/vasc/impl/VascBackendProxyEventExecutor.java
@@ -0,0 +1,152 @@
+/*
+ * Copyright 2004-2010 IDCA. All rights reserved.
+*
+* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
+* following conditions are met:
+*
+* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
+* the following disclaimer.
+* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions
+* and the following disclaimer in the documentation and/or other materials provided with the
+* distribution.
+*
+* THIS SOFTWARE IS PROVIDED BY IDCA AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED
+* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IDCA OR
+* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+* POSSIBILITY OF SUCH DAMAGE.
+*
+* The views and conclusions contained in the software and documentation are those of the authors and
+* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
+*/
+
+package com.idcanet.vasc.impl;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import com.idcanet.vasc.core.AbstractVascBackendProxy;
+import com.idcanet.vasc.core.VascBackend;
+import com.idcanet.vasc.core.VascBackendState;
+import com.idcanet.vasc.core.VascEntry;
+import com.idcanet.vasc.core.VascException;
+import com.idcanet.vasc.core.entry.VascEntryBackendEventListener;
+import com.idcanet.vasc.core.entry.VascEntryBackendEventListener.VascBackendEventType;
+
+
+/**
+* Holds !! and fires the backend event listeners.
+*
+* @author Willem Cazander
+* @version 1.0 Sep 21, 2010
+*/
+public class VascBackendProxyEventExecutor extends AbstractVascBackendProxy {
+
+ private List listeners = null;
+ private VascEntry entry = null;
+
+ public VascBackendProxyEventExecutor(VascBackend backend,VascEntry entry) {
+ super(backend);
+ this.entry=entry;
+ this.listeners=new ArrayList(10);
+ ClassLoader cl = Thread.currentThread().getContextClassLoader();
+ if (cl==null) {
+ cl = entry.getClass().getClassLoader();
+ }
+ for (String clazz:entry.getVascEntryBackendEventListeners()) {
+ VascEntryBackendEventListener listener;
+ try {
+ listener = (VascEntryBackendEventListener)cl.loadClass(clazz).newInstance();
+ } catch (Exception e) {
+ throw new RuntimeException("Could not load VascEntryBackendEventListener of: "+clazz);
+ }
+ listeners.add(listener);
+ }
+ }
+
+ private void fireVascEvent(VascBackendEventType type, Object data) {
+ for (int i=0;i execute(VascBackendState state) throws VascException {
+ fireVascEvent(VascBackendEventType.PRE_EXECUTE,state);
+ List