added empty files and fixed a little
This commit is contained in:
parent
d6d77072d9
commit
3d0d609462
|
@ -1,7 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<launchConfiguration type="org.eclipse.ant.AntBuilderLaunchConfigurationType">
|
||||
<booleanAttribute key="org.eclipse.ui.externaltools.ATTR_BUILDER_ENABLED" value="false"/>
|
||||
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_DISABLED_BUILDER" value="org.eclipse.wst.validation.validationbuilder"/>
|
||||
<mapAttribute key="org.eclipse.ui.externaltools.ATTR_TOOL_ARGUMENTS"/>
|
||||
<booleanAttribute key="org.eclipse.ui.externaltools.ATTR_TRIGGERS_CONFIGURED" value="true"/>
|
||||
</launchConfiguration>
|
13
.mymetadata
13
.mymetadata
|
@ -1,13 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project-module
|
||||
type="WEB"
|
||||
name="com.idcanet.vasc"
|
||||
id="myeclipse.1225411091277"
|
||||
context-root="/vasc"
|
||||
j2ee-spec="5.0"
|
||||
archive="com.idcanet.vasc.war">
|
||||
<attributes>
|
||||
<attribute name="webrootdir" value="/www" />
|
||||
</attributes>
|
||||
</project-module>
|
||||
|
|
@ -1,4 +0,0 @@
|
|||
#Thu Jan 08 18:05:54 CET 2009
|
||||
eclipse.preferences.version=1
|
||||
validator.Checked=target
|
||||
validator.Unchecked=
|
|
@ -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
|
|
@ -1,4 +0,0 @@
|
|||
#Thu Jan 15 07:20:11 CET 2009
|
||||
blue.framework.id=
|
||||
blue.target.server=
|
||||
eclipse.preferences.version=1
|
267
doc/README.txt
267
doc/README.txt
|
@ -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
|
||||
}
|
||||
|
||||
|
||||
|
||||
<servlet>
|
||||
<name>vasc</name>
|
||||
<class></class>
|
||||
<property>admin=true</property>
|
||||
<property>backend=extjs</property>
|
||||
<property>path=/js/extjs/*</property>
|
||||
</servlet>
|
||||
<servlet-mapping>
|
||||
<name>vasc</name>
|
||||
<mapping>/vasc/*</mapping>
|
||||
</servlet-mapping>
|
||||
|
||||
|
||||
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;
|
||||
|
||||
<a4j:form id="blogForm" enctype="multipart/form-data">
|
||||
<vasc:form crud="${crud}" parentForm="blogForm"
|
||||
propertyNames="firstName,lastName,department,description,file,age,numberOfPromotions,active,status,dob">
|
||||
|
||||
<vasc:compositePanel entity="${crud.entity.address}" name="address"
|
||||
propertyNames="line_1,line2,zipCode" />
|
||||
|
||||
<vasc:detailListing
|
||||
detailController="${directReportDetailController}"
|
||||
propertyNames="firstName,lastName,description,age,numberOfPromotions" />
|
||||
|
||||
<vasc:detailListing detailController="${taskDetailController}"
|
||||
propertyNames="name,startDate,endDate,complete" />
|
||||
|
||||
<vasc:detailListing detailController="${contactDetailController}"
|
||||
propertyNames="name,phone" />
|
||||
|
||||
<vasc:selectMany jsfSelectManyController="${employeeToRoleController}"
|
||||
propertyNames="name"
|
||||
parentForm="employeeForm"/>
|
||||
|
||||
</vasc:form>
|
||||
</a4j:form>
|
||||
|
||||
|
||||
|
||||
@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;
|
||||
}
|
||||
|
||||
<a4j:form id="employeeListingForm">
|
||||
<a4j:outputPanel ajaxRendered="true">
|
||||
<h:panelGroup rendered="${empRecordCrud.controller.showForm}">
|
||||
<crank:form
|
||||
crud="${empRecordCrud.controller}"
|
||||
parentForm="employeeListingForm"
|
||||
propertyNames="firstName,lastName,numberOfPromotions,age,department" ajax="${true}" />
|
||||
</h:panelGroup>
|
||||
</a4j:outputPanel>
|
||||
|
||||
<crank:listing
|
||||
jsfCrudAdapter="${empRecordCrud}"
|
||||
propertyNames="firstName,lastName"
|
||||
parentForm="employeeListingForm"
|
||||
/>
|
||||
</a4j:form>
|
||||
|
||||
|
||||
|
||||
<h:form id="expListForm" rendered="#{controllerBean.showListing}">
|
||||
<crank:listing paginator="${paginators['Employee']}"
|
||||
jsfCrudAdapter="${cruds['Employee']}"
|
||||
propertyNames="firstName,lastName,active,dob,age,phone,email,department.name,description"
|
||||
pageTitle="Employees"
|
||||
parentForm="expListForm"
|
||||
reRender="${reRender}"
|
||||
crud="${cruds['Employee'].controller}"/>
|
||||
</h:form>
|
||||
|
||||
|
||||
|
||||
|
|
@ -3,4 +3,276 @@ VASC Features
|
|||
* Mulple Type of Frontend rendering supported
|
||||
|
||||
* Different Type of Backend data is supported
|
||||
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
|
||||
|
||||
<servlet>
|
||||
<name>vasc</name>
|
||||
<class></class>
|
||||
<property>admin=true</property>
|
||||
<property>backend=extjs</property>
|
||||
<property>path=/js/extjs/*</property>
|
||||
</servlet>
|
||||
<servlet-mapping>
|
||||
<name>vasc</name>
|
||||
<mapping>/vasc/*</mapping>
|
||||
</servlet-mapping>
|
||||
|
||||
|
||||
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;
|
||||
|
||||
<a4j:form id="blogForm" enctype="multipart/form-data">
|
||||
<vasc:form crud="${crud}" parentForm="blogForm"
|
||||
propertyNames="firstName,lastName,department,description,file,age,numberOfPromotions,active,status,dob">
|
||||
|
||||
<vasc:compositePanel entity="${crud.entity.address}" name="address"
|
||||
propertyNames="line_1,line2,zipCode" />
|
||||
|
||||
<vasc:detailListing
|
||||
detailController="${directReportDetailController}"
|
||||
propertyNames="firstName,lastName,description,age,numberOfPromotions" />
|
||||
|
||||
<vasc:detailListing detailController="${taskDetailController}"
|
||||
propertyNames="name,startDate,endDate,complete" />
|
||||
|
||||
<vasc:detailListing detailController="${contactDetailController}"
|
||||
propertyNames="name,phone" />
|
||||
|
||||
<vasc:selectMany jsfSelectManyController="${employeeToRoleController}"
|
||||
propertyNames="name"
|
||||
parentForm="employeeForm"/>
|
||||
|
||||
</vasc:form>
|
||||
</a4j:form>
|
||||
|
||||
|
||||
|
||||
@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;
|
||||
}
|
||||
|
||||
<a4j:form id="employeeListingForm">
|
||||
<a4j:outputPanel ajaxRendered="true">
|
||||
<h:panelGroup rendered="${empRecordCrud.controller.showForm}">
|
||||
<crank:form
|
||||
crud="${empRecordCrud.controller}"
|
||||
parentForm="employeeListingForm"
|
||||
propertyNames="firstName,lastName,numberOfPromotions,age,department" ajax="${true}" />
|
||||
</h:panelGroup>
|
||||
</a4j:outputPanel>
|
||||
|
||||
<crank:listing
|
||||
jsfCrudAdapter="${empRecordCrud}"
|
||||
propertyNames="firstName,lastName"
|
||||
parentForm="employeeListingForm"
|
||||
/>
|
||||
</a4j:form>
|
||||
|
||||
|
||||
|
||||
<h:form id="expListForm" rendered="#{controllerBean.showListing}">
|
||||
<crank:listing paginator="${paginators['Employee']}"
|
||||
jsfCrudAdapter="${cruds['Employee']}"
|
||||
propertyNames="firstName,lastName,active,dob,age,phone,email,department.name,description"
|
||||
pageTitle="Employees"
|
||||
parentForm="expListForm"
|
||||
reRender="${reRender}"
|
||||
crud="${cruds['Employee'].controller}"/>
|
||||
</h:form>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
+--
|
|
@ -1,3 +1,6 @@
|
|||
TODO LIST
|
||||
|
||||
+--
|
||||
|
||||
|
||||
- (30%) X4O client/server config
|
||||
|
@ -28,3 +31,5 @@
|
|||
|
||||
=== DONE ===
|
||||
|
||||
|
||||
+--
|
0
vasc-backend-jpa/src/main/resources/.empty
Normal file
0
vasc-backend-jpa/src/main/resources/.empty
Normal file
0
vasc-backend-jpa/src/test/java/.empty
Normal file
0
vasc-backend-jpa/src/test/java/.empty
Normal file
0
vasc-backend-jpa/src/test/resources/.empty
Normal file
0
vasc-backend-jpa/src/test/resources/.empty
Normal file
0
vasc-backend-ldap/src/main/resources/.empty
Normal file
0
vasc-backend-ldap/src/main/resources/.empty
Normal file
0
vasc-backend-ldap/src/test/java/.empty
Normal file
0
vasc-backend-ldap/src/test/java/.empty
Normal file
0
vasc-backend-ldap/src/test/resources/.empty
Normal file
0
vasc-backend-ldap/src/test/resources/.empty
Normal file
|
@ -41,5 +41,6 @@ import java.lang.annotation.Target;
|
|||
@Target(ElementType.TYPE)
|
||||
public @interface VascEventListener {
|
||||
|
||||
Class<?>[] listeners();
|
||||
String[] backendEventListeners();
|
||||
String[] frontendEventListeners();
|
||||
}
|
|
@ -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<VascEntryBackendEventListener> listener);
|
||||
public void addVascEntryBackendEventListener(String listener);
|
||||
|
||||
/**
|
||||
* Returns the list of VascEntryBackendEventListener
|
||||
* @return
|
||||
*/
|
||||
public List<Class<VascEntryBackendEventListener>> getVascEntryBackendEventListeners();
|
||||
public List<String> getVascEntryBackendEventListeners();
|
||||
|
||||
/**
|
||||
* Added an VascEntryFrontendEventListener
|
||||
* @param listener The class of the event listener.
|
||||
*/
|
||||
public void addVascEntryFrontendEventListener(Class<VascEntryFrontendEventListener> listener);
|
||||
public void addVascEntryFrontendEventListener(String listener);
|
||||
|
||||
/**
|
||||
* Returns the list of VascEntryFrontendEventListener
|
||||
* @return
|
||||
*/
|
||||
public List<Class<VascEntryFrontendEventListener>> getVascEntryFrontendEventListeners();
|
||||
public List<String> getVascEntryFrontendEventListeners();
|
||||
|
||||
|
||||
public void addListOption(VascEntryField listOption);
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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,
|
||||
}
|
||||
|
|
|
@ -87,8 +87,8 @@ public class DefaultVascEntry implements VascEntry {
|
|||
private List<VascLinkEntry> vascLinkEntries = null;
|
||||
private Map<String,Object> entryParameters = null;
|
||||
private VascEntryFieldEventChannel vascEntryFieldEventChannel = null;
|
||||
private List<Class<VascEntryFrontendEventListener>> eventEntryFrontendEventListeners = null;
|
||||
private List<Class<VascEntryBackendEventListener>> eventEntryBackendEventListeners = null;
|
||||
private List<String> eventEntryFrontendEventListeners = null;
|
||||
private List<String> eventEntryBackendEventListeners = null;
|
||||
private List<VascEntryField> listOptions = null;
|
||||
private List<VascBackendFilter> backendFilters = null;
|
||||
|
||||
|
@ -109,8 +109,8 @@ public class DefaultVascEntry implements VascEntry {
|
|||
vascLinkEntries = new ArrayList<VascLinkEntry>(10);
|
||||
entryParameters = new HashMap<String,Object>(10);
|
||||
|
||||
eventEntryFrontendEventListeners = new ArrayList<Class<VascEntryFrontendEventListener>>(10);
|
||||
eventEntryBackendEventListeners = new ArrayList<Class<VascEntryBackendEventListener>>(10);
|
||||
eventEntryFrontendEventListeners = new ArrayList<String>(10);
|
||||
eventEntryBackendEventListeners = new ArrayList<String>(10);
|
||||
listOptions = new ArrayList<VascEntryField>(5);
|
||||
backendFilters = new ArrayList<VascBackendFilter>(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<VascEntryBackendEventListener> 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<Class<VascEntryBackendEventListener>> getVascEntryBackendEventListeners() {
|
||||
public List<String> 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<VascEntryFrontendEventListener> 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<Class<VascEntryFrontendEventListener>> getVascEntryFrontendEventListeners() {
|
||||
public List<String> getVascEntryFrontendEventListeners() {
|
||||
return eventEntryFrontendEventListeners;
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
|
@ -248,8 +248,17 @@ public class DefaultVascFrontendData implements VascFrontendData {
|
|||
|
||||
|
||||
public void initFrontendListeners(VascEntry entry) throws InstantiationException, IllegalAccessException {
|
||||
for (Class<VascEntryFrontendEventListener> 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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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<VascEntryBackendEventListener> listeners = null;
|
||||
private VascEntry entry = null;
|
||||
|
||||
public VascBackendProxyEventExecutor(VascBackend backend,VascEntry entry) {
|
||||
super(backend);
|
||||
this.entry=entry;
|
||||
this.listeners=new ArrayList<VascEntryBackendEventListener>(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<listeners.size();i++) {
|
||||
VascEntryBackendEventListener l = listeners.get(i);
|
||||
l.vascEvent(entry, data);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @see com.idcanet.vasc.core.AbstractVascBackendProxy#delete(java.lang.Object)
|
||||
*/
|
||||
@Override
|
||||
public void delete(Object object) throws VascException {
|
||||
fireVascEvent(VascBackendEventType.PRE_DELETE,object);
|
||||
super.delete(object);
|
||||
fireVascEvent(VascBackendEventType.POST_DELETE,object);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see com.idcanet.vasc.core.AbstractVascBackendProxy#doRecordMoveDownById(com.idcanet.vasc.core.VascBackendState, java.lang.Object)
|
||||
*/
|
||||
@Override
|
||||
public long doRecordMoveDownById(VascBackendState state, Object primaryId) throws VascException {
|
||||
fireVascEvent(VascBackendEventType.PRE_MOVE_DOWN,primaryId);
|
||||
Long result = super.doRecordMoveDownById(state, primaryId);
|
||||
fireVascEvent(VascBackendEventType.POST_MOVE_DOWN,result);
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see com.idcanet.vasc.core.AbstractVascBackendProxy#doRecordMoveUpById(com.idcanet.vasc.core.VascBackendState, java.lang.Object)
|
||||
*/
|
||||
@Override
|
||||
public long doRecordMoveUpById(VascBackendState state, Object primaryId) throws VascException {
|
||||
fireVascEvent(VascBackendEventType.PRE_MOVE_UP,primaryId);
|
||||
Long result = super.doRecordMoveUpById(state, primaryId);
|
||||
fireVascEvent(VascBackendEventType.POST_MOVE_UP,result);
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see com.idcanet.vasc.core.AbstractVascBackendProxy#execute(com.idcanet.vasc.core.VascBackendState)
|
||||
*/
|
||||
@Override
|
||||
public List<Object> execute(VascBackendState state) throws VascException {
|
||||
fireVascEvent(VascBackendEventType.PRE_EXECUTE,state);
|
||||
List<Object> result = super.execute(state);
|
||||
fireVascEvent(VascBackendEventType.POST_EXECUTE,result);
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see com.idcanet.vasc.core.AbstractVascBackendProxy#fetchTotalExecuteSize(com.idcanet.vasc.core.VascBackendState)
|
||||
*/
|
||||
@Override
|
||||
public long fetchTotalExecuteSize(VascBackendState state) {
|
||||
fireVascEvent(VascBackendEventType.PRE_TOTAL_EXECUTE_SIZE,state);
|
||||
Long result = super.fetchTotalExecuteSize(state);
|
||||
fireVascEvent(VascBackendEventType.POST_TOTAL_EXECUTE_SIZE,result);
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see com.idcanet.vasc.core.AbstractVascBackendProxy#merge(java.lang.Object)
|
||||
*/
|
||||
@Override
|
||||
public Object merge(Object object) throws VascException {
|
||||
fireVascEvent(VascBackendEventType.PRE_MERGE,object);
|
||||
Object result = super.merge(object);
|
||||
fireVascEvent(VascBackendEventType.POST_MERGE,result);
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see com.idcanet.vasc.core.AbstractVascBackendProxy#persist(java.lang.Object)
|
||||
*/
|
||||
@Override
|
||||
public void persist(Object object) throws VascException {
|
||||
fireVascEvent(VascBackendEventType.PRE_PERSIST,object);
|
||||
super.persist(object);
|
||||
fireVascEvent(VascBackendEventType.POST_PERSIST,object);
|
||||
}
|
||||
}
|
|
@ -51,7 +51,7 @@ public class EditRowAction extends AbstractVascAction implements RowVascAction {
|
|||
return; // nothing selected
|
||||
}
|
||||
entry.getVascFrontendData().getVascEntryState().setEditCreate(false);
|
||||
entry.getVascFrontendData().getVascFrontendHelper().fireVascEvent(entry, VascFrontendEventType.DATA_SELECT, rowObject);
|
||||
entry.getVascFrontendData().getVascFrontendHelper().fireVascEvent(entry, VascFrontendEventType.SELECT, rowObject);
|
||||
entry.getVascFrontendData().getVascEntryState().setEntryDataObject(rowObject);
|
||||
entry.getVascFrontendData().getVascFrontend().renderEdit();
|
||||
}
|
||||
|
|
|
@ -45,8 +45,6 @@ import com.idcanet.vasc.core.VascController;
|
|||
import com.idcanet.vasc.core.VascEntry;
|
||||
import com.idcanet.vasc.core.VascEntryField;
|
||||
import com.idcanet.vasc.core.VascEntryFieldType;
|
||||
import com.idcanet.vasc.core.entry.VascEntryBackendEventListener;
|
||||
import com.idcanet.vasc.core.entry.VascEntryFrontendEventListener;
|
||||
import com.idcanet.vasc.impl.DefaultVascEntryField;
|
||||
import com.idcanet.vasc.validators.VascValidator;
|
||||
import com.idcanet.vasc.validators.VascValidatorClassParser;
|
||||
|
@ -104,7 +102,6 @@ public class AnnotationParserElement extends AbstractElement {
|
|||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
private void fillEntry(VascEntry entry,Class<?> modelClass,VascAnnotationParser parser) throws ElementException {
|
||||
|
||||
|
||||
|
@ -114,15 +111,11 @@ public class AnnotationParserElement extends AbstractElement {
|
|||
|
||||
VascEventListener vc = parser.getVascEventListener(modelClass);
|
||||
if (vc!=null) {
|
||||
int i = 0;
|
||||
for (Class<?> listener:vc.listeners()) {
|
||||
if (listener.isAssignableFrom(VascEntryFrontendEventListener.class)) {
|
||||
entry.addVascEntryFrontendEventListener((Class<VascEntryFrontendEventListener>)listener);
|
||||
}
|
||||
if (listener.isAssignableFrom(VascEntryBackendEventListener.class)) {
|
||||
entry.addVascEntryBackendEventListener((Class<VascEntryBackendEventListener>)listener);
|
||||
}
|
||||
i++;
|
||||
for (String listener:vc.frontendEventListeners()) {
|
||||
entry.addVascEntryFrontendEventListener(listener);
|
||||
}
|
||||
for (String listener:vc.backendEventListeners()) {
|
||||
entry.addVascEntryBackendEventListener(listener);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
0
vasc-core/src/test/resources/.empty
Normal file
0
vasc-core/src/test/resources/.empty
Normal file
0
vasc-ejb3/src/main/resources/.empty
Normal file
0
vasc-ejb3/src/main/resources/.empty
Normal file
0
vasc-ejb3/src/test/java/.empty
Normal file
0
vasc-ejb3/src/test/java/.empty
Normal file
0
vasc-ejb3/src/test/resources/.empty
Normal file
0
vasc-ejb3/src/test/resources/.empty
Normal file
|
@ -653,7 +653,7 @@ public class SwingVascFrontend extends AbstractVascFrontend {
|
|||
}
|
||||
|
||||
public VascFrontendEventType[] getEventTypes() {
|
||||
VascFrontendEventType[] result = {VascFrontendEventType.DATA_LIST_UPDATE};
|
||||
VascFrontendEventType[] result = {VascFrontendEventType.POST_UPDATE};
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
|
0
vasc-frontend-swing/src/main/resources/.empty
Normal file
0
vasc-frontend-swing/src/main/resources/.empty
Normal file
0
vasc-frontend-swing/src/test/resources/.empty
Normal file
0
vasc-frontend-swing/src/test/resources/.empty
Normal file
|
@ -442,7 +442,7 @@ public class SwtVascFrontend extends AbstractVascFrontend {
|
|||
|
||||
entry.getVascFrontendData().addVascEntryFrontendEventListener(new VascEntryFrontendEventListener() {
|
||||
public VascFrontendEventType[] getEventTypes() {
|
||||
VascFrontendEventType[] result = {VascEntryFrontendEventListener.VascFrontendEventType.DATA_LIST_UPDATE};
|
||||
VascFrontendEventType[] result = {VascEntryFrontendEventListener.VascFrontendEventType.POST_READ};
|
||||
return result;
|
||||
}
|
||||
public void vascEvent(VascEntry entry,Object data) {
|
||||
|
|
0
vasc-frontend-swt/src/main/resources/.empty
Normal file
0
vasc-frontend-swt/src/main/resources/.empty
Normal file
0
vasc-frontend-swt/src/test/resources/.empty
Normal file
0
vasc-frontend-swt/src/test/resources/.empty
Normal file
|
@ -13,6 +13,12 @@
|
|||
<groupId>com.idcanet.vasc</groupId>
|
||||
<artifactId>vasc-core</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.idcanet.vasc</groupId>
|
||||
<artifactId>vasc-ejb3</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>javax.faces</groupId>
|
||||
|
|
|
@ -0,0 +1,405 @@
|
|||
/*
|
||||
* 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.frontends.web.jsf;
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.ObjectOutputStream;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Enumeration;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.ResourceBundle;
|
||||
|
||||
import javax.faces.context.FacesContext;
|
||||
import javax.naming.Context;
|
||||
import javax.naming.InitialContext;
|
||||
|
||||
import com.idcanet.vasc.core.VascBackend;
|
||||
import com.idcanet.vasc.core.VascBackendControllerLocal;
|
||||
import com.idcanet.vasc.core.VascBackendState;
|
||||
import com.idcanet.vasc.core.VascController;
|
||||
import com.idcanet.vasc.core.VascEntry;
|
||||
import com.idcanet.vasc.core.VascEntryControllerLocal;
|
||||
import com.idcanet.vasc.core.VascEntryField;
|
||||
import com.idcanet.vasc.core.VascException;
|
||||
import com.idcanet.vasc.core.VascFrontendData;
|
||||
import com.idcanet.vasc.core.entry.VascEntryFieldValue;
|
||||
import com.idcanet.vasc.core.entry.VascEntryFrontendEventListener;
|
||||
import com.idcanet.vasc.core.entry.VascEntryRecordCreator;
|
||||
import com.idcanet.vasc.ejb3.VascServiceManager;
|
||||
import com.idcanet.vasc.impl.DefaultVascBackedEntryFinalizer;
|
||||
import com.idcanet.vasc.impl.DefaultVascFactory;
|
||||
import com.idcanet.vasc.impl.entry.DefaultVascEntryResourceResolver;
|
||||
|
||||
/**
|
||||
* Base faces session object for managing vasc entries.
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Sep 21, 2010
|
||||
*/
|
||||
abstract public class AbstractJSFVascFacesController {
|
||||
|
||||
private VascController vascController = null;
|
||||
|
||||
abstract public String getVascSericeManagerJNDI();
|
||||
abstract public String getResourceBundleWEB();
|
||||
abstract public boolean getDisableI18N();
|
||||
abstract public VascUserInfo getVascUserInfo();
|
||||
|
||||
public class VascUserInfo {
|
||||
Long userId;
|
||||
String username;
|
||||
String[] roles;
|
||||
public VascUserInfo(Long userId,String username,String[] roles) {
|
||||
this.userId=userId;
|
||||
this.username=username;
|
||||
this.roles=roles;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
class RefreshObjectForLazyPropertiesListener implements VascEntryFrontendEventListener {
|
||||
public VascFrontendEventType[] getEventTypes() {
|
||||
VascFrontendEventType[] result = {VascEntryFrontendEventListener.VascFrontendEventType.POST_UPDATE};
|
||||
return result;
|
||||
}
|
||||
public void vascEvent(VascEntry entry,Object data) {
|
||||
if (data.getClass().getName().startsWith("com.idcanet.logstats.ejb.models")==false) {
|
||||
return; // only refresh model classes
|
||||
}
|
||||
|
||||
// TODO: mmm rewrite events to change to different object to use ejb3++ solution ?
|
||||
// Use hiberbate session to attach a detected object again. (note: this is not possible with EJB3, uses merge() which returns a new object)
|
||||
//((Session)entityManager.getDelegate()).refresh(data);
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
class MergedResourceBundle extends ResourceBundle {
|
||||
Map<String,String> data = new HashMap<String,String>(500);
|
||||
|
||||
public void addDateMap(Map<String,String> dataMap) {
|
||||
data.putAll(dataMap);
|
||||
}
|
||||
public void addDataBundle(ResourceBundle bundle) {
|
||||
for (String key:bundle.keySet()) {
|
||||
String value = bundle.getString(key);
|
||||
data.put(key, value);
|
||||
}
|
||||
}
|
||||
public Object handleGetObject(String key) {
|
||||
return data.get(key);
|
||||
}
|
||||
|
||||
public Enumeration<String> getKeys() {
|
||||
return Collections.enumeration(data.keySet());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Config vasc frontend data object for jsf component to use.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public VascFrontendData getNewVascFrontendData() {
|
||||
Locale locale = FacesContext.getCurrentInstance().getViewRoot().getLocale();
|
||||
MergedResourceBundle bundle = new MergedResourceBundle();
|
||||
bundle.addDataBundle(ResourceBundle.getBundle(getResourceBundleWEB(), locale));
|
||||
|
||||
try {
|
||||
Context context = new InitialContext();
|
||||
VascServiceManager vascManager = (VascServiceManager)context.lookup(getVascSericeManagerJNDI());
|
||||
Map<String,String> remoteI18n = vascManager.getResourceBundle(locale.toString());
|
||||
bundle.addDateMap(remoteI18n);
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException("Could not get the ejb resource bundle: "+e.getMessage(),e);
|
||||
}
|
||||
|
||||
VascFrontendData vascFrontendData = DefaultVascFactory.getDefaultVascFrontendData(bundle);
|
||||
vascFrontendData.addVascEntryFrontendEventListener(new VascEntryFrontendEventListener() {
|
||||
private static final long serialVersionUID = 1L;
|
||||
public VascFrontendEventType[] getEventTypes() {
|
||||
VascFrontendEventType[] result = {VascEntryFrontendEventListener.VascFrontendEventType.EXCEPTION};
|
||||
return result;
|
||||
}
|
||||
public void vascEvent(VascEntry entry, Object data) {
|
||||
if (data instanceof Exception) {
|
||||
((Exception)data).printStackTrace();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// config frontend data for ISF usage
|
||||
if (getDisableI18N()) {
|
||||
vascFrontendData.setVascEntryResourceResolver(new DefaultVascEntryResourceResolver());
|
||||
} else {
|
||||
vascFrontendData.setVascEntryResourceResolver(new DefaultVascEntryResourceResolver(bundle));
|
||||
}
|
||||
return vascFrontendData;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public List<Object> executeVascList(String entryId,Map<String,Object> para) {
|
||||
try {
|
||||
// plug all object
|
||||
VascEntry entry = getVascController().getVascEntryController().getVascEntryById(entryId);
|
||||
entry.setVascFrontendData(getNewVascFrontendData());
|
||||
entry.getVascFrontendData().setVascController(getVascController());
|
||||
|
||||
// copy para
|
||||
if (para!=null) {
|
||||
for (String key:para.keySet()) {
|
||||
entry.setEntryParameter(key, para.get(key));
|
||||
}
|
||||
}
|
||||
|
||||
// done, execute and return data.
|
||||
entry.getVascFrontendData().getVascFrontendHelper().refreshData(entry);
|
||||
return entry.getVascFrontendData().getVascEntryState().getEntryDataList();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return new ArrayList<Object>(0);
|
||||
}
|
||||
}
|
||||
|
||||
class RemoteVascBackend implements VascBackend {
|
||||
|
||||
private String backendId = null;
|
||||
private VascServiceManager vascManager = null;
|
||||
|
||||
public RemoteVascBackend(String backendId,VascServiceManager vascManager) {
|
||||
this.backendId=backendId;
|
||||
this.vascManager=vascManager;
|
||||
}
|
||||
|
||||
public void delete(Object object) throws VascException {
|
||||
Object[] args = new Object[1];
|
||||
args[0]=object;
|
||||
vascManager.invokeBackendMethod(backendId, "delete", args);
|
||||
}
|
||||
|
||||
public long doRecordMoveDownById(VascBackendState state,Object primaryId) throws VascException {
|
||||
Object[] args = new Object[2];
|
||||
args[0]=state;
|
||||
args[1]=primaryId;
|
||||
Object result = vascManager.invokeBackendMethod(backendId, "doRecordMoveDownById", args);
|
||||
return (Long)result;
|
||||
}
|
||||
|
||||
public long doRecordMoveUpById(VascBackendState state, Object primaryId) throws VascException {
|
||||
Object[] args = new Object[2];
|
||||
args[0]=state;
|
||||
args[1]=primaryId;
|
||||
Object result = vascManager.invokeBackendMethod(backendId, "doRecordMoveUpById", args);
|
||||
return (Long)result;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public List<Object> execute(VascBackendState state) throws VascException {
|
||||
Object[] args = new Object[1];
|
||||
args[0]=state;
|
||||
Object result = vascManager.invokeBackendMethod(backendId, "execute", args);
|
||||
return (List<Object>)result;
|
||||
}
|
||||
|
||||
public long fetchTotalExecuteSize(VascBackendState state) {
|
||||
Object[] args = new Object[1];
|
||||
args[0]=state;
|
||||
Object result = vascManager.invokeBackendMethod(backendId, "fetchTotalExecuteSize", args);
|
||||
return (Long)result;
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
return backendId;
|
||||
}
|
||||
|
||||
public boolean isPageable() {
|
||||
Object[] args = new Object[0];
|
||||
Object result = vascManager.invokeBackendMethod(backendId, "isPageable", args);
|
||||
return (Boolean)result;
|
||||
}
|
||||
|
||||
public boolean isRecordMoveable() {
|
||||
Object[] args = new Object[0];
|
||||
Object result = vascManager.invokeBackendMethod(backendId, "isRecordMoveable", args);
|
||||
return (Boolean)result;
|
||||
}
|
||||
|
||||
public boolean isSearchable() {
|
||||
Object[] args = new Object[0];
|
||||
Object result = vascManager.invokeBackendMethod(backendId, "isSearchable", args);
|
||||
return (Boolean)result;
|
||||
}
|
||||
|
||||
public boolean isSortable() {
|
||||
Object[] args = new Object[0];
|
||||
Object result = vascManager.invokeBackendMethod(backendId, "isSortable", args);
|
||||
return (Boolean)result;
|
||||
}
|
||||
|
||||
public Object merge(Object object) throws VascException {
|
||||
Object[] args = new Object[1];
|
||||
args[0]=object;
|
||||
Object result = vascManager.invokeBackendMethod(backendId, "merge", args);
|
||||
return result;
|
||||
}
|
||||
|
||||
public void persist(Object object) throws VascException {
|
||||
Object[] args = new Object[1];
|
||||
args[0]=object;
|
||||
vascManager.invokeBackendMethod(backendId, "delete", args);
|
||||
}
|
||||
|
||||
public VascEntryFieldValue provideVascEntryFieldValue(VascEntryField field) {
|
||||
/*
|
||||
try {
|
||||
ByteArrayOutputStream dataArray = new ByteArrayOutputStream(256); // it grows when needed
|
||||
ObjectOutputStream objOutstream = new ObjectOutputStream(dataArray);
|
||||
objOutstream.writeObject(field);
|
||||
objOutstream.close();
|
||||
int objectSize = dataArray.size();
|
||||
System.out.println("Writing obj to field: "+objectSize);
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
*/
|
||||
Object[] args = new Object[1];
|
||||
args[0]=field;
|
||||
Object result = vascManager.invokeBackendMethod(backendId, "provideVascEntryFieldValue", args);
|
||||
return (VascEntryFieldValue)result;
|
||||
}
|
||||
|
||||
public VascEntryRecordCreator provideVascEntryRecordCreator(VascEntry vascEntry) {
|
||||
VascEntry clone = null;
|
||||
try {
|
||||
clone = vascEntry.clone();
|
||||
clone.setVascFrontendData(null);
|
||||
clone.setVascEntryFieldEventChannel(null);
|
||||
} catch (CloneNotSupportedException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
try {
|
||||
ByteArrayOutputStream dataArray = new ByteArrayOutputStream(256); // it grows when needed
|
||||
ObjectOutputStream objOutstream = new ObjectOutputStream(dataArray);
|
||||
objOutstream.writeObject(clone);
|
||||
objOutstream.close();
|
||||
//int objectSize = dataArray.size();
|
||||
//System.out.println("Writing obj to entry: "+objectSize);
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
Object[] args = new Object[1];
|
||||
args[0]=clone;
|
||||
Object result = vascManager.invokeBackendMethod(backendId, "provideVascEntryRecordCreator", args);
|
||||
return (VascEntryRecordCreator)result;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
// we cant change id
|
||||
}
|
||||
|
||||
public Map<String, Object> executePageSummary() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public Map<String, Object> executeTotalSummary() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public boolean isPageSummary() {
|
||||
Object[] args = new Object[0];
|
||||
Object result = vascManager.invokeBackendMethod(backendId, "isPageSummary", args);
|
||||
return (Boolean)result;
|
||||
}
|
||||
|
||||
public boolean isTotalSummary() {
|
||||
Object[] args = new Object[0];
|
||||
Object result = vascManager.invokeBackendMethod(backendId, "isTotalSummary", args);
|
||||
return (Boolean)result;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the vascController
|
||||
*/
|
||||
public VascController getVascController() {
|
||||
if (vascController!=null) {
|
||||
return vascController;
|
||||
}
|
||||
try {
|
||||
VascUserInfo vui = getVascUserInfo();
|
||||
|
||||
|
||||
// get local jvm plugging controller
|
||||
VascController c = DefaultVascFactory.getDefaultVascController(vui.userId, vui.username, vui.roles);
|
||||
|
||||
/*
|
||||
DefaultVascEntryController con = new DefaultVascEntryController() {
|
||||
public VascEntry getVascEntryById(String id) {
|
||||
VascEntry ve = super.getVascEntryById(id);
|
||||
// add global listener to make sure we have all LAZY properties of a bean before we goto edit mode.
|
||||
ve.addVascEntryEventListener(VascEventType.DATA_SELECT, new RefreshObjectForLazyPropertiesListener());
|
||||
return ve;
|
||||
}
|
||||
};
|
||||
((DefaultVascController)c).setVascEntryController(con);
|
||||
*/
|
||||
|
||||
Context context = new InitialContext();
|
||||
VascServiceManager vascManager = (VascServiceManager)context.lookup(getVascSericeManagerJNDI());
|
||||
List<String> entryIds = vascManager.getVascEntryIds();
|
||||
|
||||
VascEntryControllerLocal localEntryController = (VascEntryControllerLocal)c.getVascEntryController();
|
||||
VascBackendControllerLocal localBackendController = (VascBackendControllerLocal)c.getVascBackendController();
|
||||
for (String id:entryIds) {
|
||||
VascEntry ve = vascManager.getVascEntry(id);
|
||||
String backendId = ve.getBackendId();
|
||||
VascBackend vb = new RemoteVascBackend(backendId,vascManager);
|
||||
localBackendController.addVascBackend(vb);
|
||||
|
||||
DefaultVascBackedEntryFinalizer f = new DefaultVascBackedEntryFinalizer();
|
||||
ve = f.finalizeVascEntry(ve,c);
|
||||
|
||||
localEntryController.addVascEntry(ve, c);
|
||||
}
|
||||
vascController = c;
|
||||
return vascController;
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException("Could not create remote based vasc controller; "+e.getMessage(),e);
|
||||
}
|
||||
}
|
||||
|
||||
public void setVascController(VascController vascController) {
|
||||
}
|
||||
}
|
|
@ -31,7 +31,7 @@ public class JSFVascEntryEventListener implements VascEntryFrontendEventListener
|
|||
* @see com.idcanet.vasc.core.entry.VascEntryFrontendEventListener#getEventTypes()
|
||||
*/
|
||||
public VascFrontendEventType[] getEventTypes() {
|
||||
VascFrontendEventType[] result = {VascEntryFrontendEventListener.VascFrontendEventType.DATA_LIST_UPDATE};
|
||||
VascFrontendEventType[] result = {VascEntryFrontendEventListener.VascFrontendEventType.POST_READ};
|
||||
return result;
|
||||
}
|
||||
|
||||
|
|
|
@ -239,7 +239,7 @@ public class JSFVascUIComponent extends UIComponentBase {
|
|||
try {
|
||||
VascEntry entry = supportBean.getVascEntry();
|
||||
entry.getVascFrontendData().getVascEntryState().setEditCreate(false);
|
||||
entry.getVascFrontendData().getVascFrontendHelper().fireVascEvent(entry, VascFrontendEventType.DATA_SELECT, rowObject);
|
||||
entry.getVascFrontendData().getVascFrontendHelper().fireVascEvent(entry, VascFrontendEventType.SELECT, rowObject);
|
||||
entry.getVascFrontendData().getVascEntryState().setEntryDataObject(rowObject);
|
||||
entry.getVascFrontendData().getVascFrontend().renderEdit();
|
||||
} catch (Exception e) {
|
||||
|
@ -408,7 +408,7 @@ public class JSFVascUIComponent extends UIComponentBase {
|
|||
this.value=value;
|
||||
}
|
||||
public VascFrontendEventType[] getEventTypes() {
|
||||
VascFrontendEventType[] result = {VascEntryFrontendEventListener.VascFrontendEventType.DATA_CREATE};
|
||||
VascFrontendEventType[] result = {VascEntryFrontendEventListener.VascFrontendEventType.PRE_CREATE};
|
||||
return result;
|
||||
}
|
||||
public void vascEvent(VascEntry entry,Object data) {
|
||||
|
|
|
@ -239,7 +239,7 @@ public class OldVascUIComponent extends UIComponentBase {
|
|||
entry.getVascFrontendData().addVascEntryFrontendEventListener(new VascEntryFrontendEventListener() {
|
||||
private static final long serialVersionUID = 1L;
|
||||
public VascFrontendEventType[] getEventTypes() {
|
||||
VascFrontendEventType[] result = {VascEntryFrontendEventListener.VascFrontendEventType.DATA_LIST_UPDATE};
|
||||
VascFrontendEventType[] result = {VascEntryFrontendEventListener.VascFrontendEventType.POST_READ};
|
||||
return result;
|
||||
}
|
||||
public void vascEvent(VascEntry entry, Object dataNotUsed) {
|
||||
|
@ -496,7 +496,7 @@ public class OldVascUIComponent extends UIComponentBase {
|
|||
this.value=value;
|
||||
}
|
||||
public VascFrontendEventType[] getEventTypes() {
|
||||
VascFrontendEventType[] result = {VascEntryFrontendEventListener.VascFrontendEventType.DATA_CREATE};
|
||||
VascFrontendEventType[] result = {VascEntryFrontendEventListener.VascFrontendEventType.PRE_CREATE};
|
||||
return result;
|
||||
}
|
||||
public void vascEvent(VascEntry entry,Object data) {
|
||||
|
|
|
@ -162,11 +162,17 @@ public class VascRequestFacesFilter implements Filter {
|
|||
// Set page title
|
||||
Locale locale = facesContext.getViewRoot().getLocale();
|
||||
if (locale==null) {
|
||||
locale = Locale.getDefault();
|
||||
logger.info("Failling back to defualt.");
|
||||
locale = new Locale("nl");
|
||||
}
|
||||
try {
|
||||
ResourceBundle i18n = ResourceBundle.getBundle(resourceBundle,locale);
|
||||
String titleI18n = i18n.getString("vasc.entry."+entityName+".name");
|
||||
request.setAttribute("requestScopeVascEntityNameI18n" ,titleI18n);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
request.setAttribute("requestScopeVascEntityNameI18n" ,entityName);
|
||||
}
|
||||
ResourceBundle i18n = ResourceBundle.getBundle(resourceBundle,locale);
|
||||
String titleI18n = i18n.getString("vasc.entry."+entityName+".name");
|
||||
request.setAttribute("requestScopeVascEntityNameI18n" ,titleI18n);
|
||||
|
||||
try {
|
||||
request.getRequestDispatcher(templateFile).forward(request, response);
|
||||
|
|
0
vasc-frontend-web-jsf/src/test/java/.empty
Normal file
0
vasc-frontend-web-jsf/src/test/java/.empty
Normal file
0
vasc-frontend-web-jsf/src/test/resources/.empty
Normal file
0
vasc-frontend-web-jsf/src/test/resources/.empty
Normal file
Loading…
Reference in a new issue