You can subscribe to this list here.
2005 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(6) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2006 |
Jan
(178) |
Feb
(169) |
Mar
(286) |
Apr
(117) |
May
(98) |
Jun
(68) |
Jul
(63) |
Aug
(121) |
Sep
(88) |
Oct
(124) |
Nov
(2) |
Dec
(111) |
2007 |
Jan
(224) |
Feb
(69) |
Mar
(10) |
Apr
(72) |
May
(7) |
Jun
(21) |
Jul
(33) |
Aug
(35) |
Sep
(12) |
Oct
(22) |
Nov
(5) |
Dec
(6) |
2008 |
Jan
(2) |
Feb
(10) |
Mar
(39) |
Apr
(58) |
May
(34) |
Jun
(9) |
Jul
(27) |
Aug
(10) |
Sep
(3) |
Oct
|
Nov
|
Dec
|
From: Walter M. <wal...@us...> - 2008-07-15 11:44:09
|
User: walterim Date: 08/07/15 04:44:08 Modified: andromda-jsf2/src/main/resources/templates/jsf2/forms FormImpl.java.vsl Form.java.vsl Log: Using java.util.Collection instead of java.util.List to represent the Collection datatype, to be compatible with other cartridges. Revision Changes Path 1.9 +1 -1 cartridges/andromda-jsf2/src/main/resources/templates/jsf2/forms/FormImpl.java.vsl Index: FormImpl.java.vsl =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-jsf2/src/main/resources/templates/jsf2/forms/FormImpl.java.vsl,v retrieving revision 1.8 retrieving revision 1.9 diff -u -w -r1.8 -r1.9 --- FormImpl.java.vsl 30 May 2008 15:04:31 -0000 1.8 +++ FormImpl.java.vsl 15 Jul 2008 11:44:08 -0000 1.9 @@ -29,7 +29,7 @@ #if ($field.pageableTable) #set ($fieldTypeName = "javax.faces.model.DataModel") #elseif ($field.type.collectionType) -#set ($fieldTypeName = "java.util.List") +#set ($fieldTypeName = "java.util.Collection") #elseif ($field.type.fileType) #set ($fieldTypeName = "$fileTypeName") #else 1.4 +1 -1 cartridges/andromda-jsf2/src/main/resources/templates/jsf2/forms/Form.java.vsl Index: Form.java.vsl =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-jsf2/src/main/resources/templates/jsf2/forms/Form.java.vsl,v retrieving revision 1.3 retrieving revision 1.4 diff -u -w -r1.3 -r1.4 --- Form.java.vsl 17 Apr 2008 20:41:51 -0000 1.3 +++ Form.java.vsl 15 Jul 2008 11:44:08 -0000 1.4 @@ -17,7 +17,7 @@ #if ($field.pageableTable) #set ($fieldTypeName = "javax.faces.model.DataModel") #elseif ($field.type.collectionType) -#set ($fieldTypeName = "java.util.List") +#set ($fieldTypeName = "java.util.Collection") #elseif ($field.type.fileType) #set ($fieldTypeName = "$fileTypeName") #else |
From: Walter M. <wal...@us...> - 2008-07-15 11:43:32
|
User: walterim Date: 08/07/15 04:42:45 Modified: andromda-jsf2/src/main/resources/templates/jsf2/controllers/crud Controller.java.vsl andromda-jsf2/src/main/resources/templates/jsf2/controllers Controller.java.vsl Log: re-throw the exceptions, case there isn't a message to be shown Revision Changes Path 1.16 +63 -21 cartridges/andromda-jsf2/src/main/resources/templates/jsf2/controllers/crud/Controller.java.vsl Index: Controller.java.vsl =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-jsf2/src/main/resources/templates/jsf2/controllers/crud/Controller.java.vsl,v retrieving revision 1.15 retrieving revision 1.16 diff -u -w -r1.15 -r1.16 --- Controller.java.vsl 10 Jul 2008 14:59:52 -0000 1.15 +++ Controller.java.vsl 15 Jul 2008 11:42:44 -0000 1.16 @@ -4,6 +4,9 @@ public abstract class ${manageable.controllerName} { + private static final org.apache.commons.logging.Log logger = org.apache.commons.logging.LogFactory.getLog(${manageable.controllerName}.class); + + static final String CONTROLLER_EXCEPTION = ${manageable.controllerName}.class.getName() + ".exception"; public String init(){ final ${managedBeansPackage}.AdfFacesContextWrapper contextWrapper = new ${managedBeansPackage}.AdfFacesContextWrapper(); @@ -20,13 +23,17 @@ catch (final Throwable throwable) { final String messageKey = ${managedBeansPackage}.${patternMatchingExceptionHandler}.instance().handleException(throwable); - if(!org.apache.commons.lang.StringUtils.isEmpty(messageKey)) + if(org.apache.commons.lang.StringUtils.isEmpty(messageKey)){ + throw throwable; + } else { this.addErrorMessage(${managedBeansPackage}.Messages.get(messageKey, null)); } } + } catch (final Throwable throwable) { - throwable.printStackTrace(); + this.setRequestAttribute(CONTROLLER_EXCEPTION, throwable); + logger.error(throwable); this.addExceptionMessage(throwable); } return "${manageable.viewFullPath}"; @@ -80,13 +87,17 @@ catch (final Throwable throwable) { final String messageKey = ${managedBeansPackage}.${patternMatchingExceptionHandler}.instance().handleException(throwable); - if(!org.apache.commons.lang.StringUtils.isEmpty(messageKey)) + if(org.apache.commons.lang.StringUtils.isEmpty(messageKey)){ + throw throwable; + } else { this.addErrorMessage(${managedBeansPackage}.Messages.get(messageKey, null)); } } + } catch (final Throwable throwable) { - throwable.printStackTrace(); + this.setRequestAttribute(CONTROLLER_EXCEPTION, throwable); + logger.error(throwable); this.addExceptionMessage(throwable); } } @@ -122,13 +133,17 @@ catch (final Throwable throwable) { final String messageKey = ${managedBeansPackage}.${patternMatchingExceptionHandler}.instance().handleException(throwable); - if(!org.apache.commons.lang.StringUtils.isEmpty(messageKey)) + if(org.apache.commons.lang.StringUtils.isEmpty(messageKey)){ + throw throwable; + } else { this.addErrorMessage(${managedBeansPackage}.Messages.get(messageKey, null)); } } + } catch (final Throwable throwable) { - throwable.printStackTrace(); + this.setRequestAttribute(CONTROLLER_EXCEPTION, throwable); + logger.error(throwable); this.addExceptionMessage(throwable); } return null; @@ -154,13 +169,17 @@ catch (final Throwable throwable) { final String messageKey = ${managedBeansPackage}.${patternMatchingExceptionHandler}.instance().handleException(throwable); - if(!org.apache.commons.lang.StringUtils.isEmpty(messageKey)) + if(org.apache.commons.lang.StringUtils.isEmpty(messageKey)){ + throw throwable; + } else { this.addErrorMessage(${managedBeansPackage}.Messages.get(messageKey, null)); } } + } catch (final Throwable throwable) { - throwable.printStackTrace(); + this.setRequestAttribute(CONTROLLER_EXCEPTION, throwable); + logger.error(throwable); this.addExceptionMessage(throwable); } @@ -239,13 +258,17 @@ catch (final Throwable throwable) { final String messageKey = ${managedBeansPackage}.${patternMatchingExceptionHandler}.instance().handleException(throwable); - if(!org.apache.commons.lang.StringUtils.isEmpty(messageKey)) + if(org.apache.commons.lang.StringUtils.isEmpty(messageKey)){ + throw throwable; + } else { this.addErrorMessage(${managedBeansPackage}.Messages.get(messageKey, null)); } } + } catch (final Throwable throwable) { - throwable.printStackTrace(); + this.setRequestAttribute(CONTROLLER_EXCEPTION, throwable); + logger.error(throwable); this.addExceptionMessage(throwable); } return null; @@ -311,13 +334,17 @@ catch (final Throwable throwable) { final String messageKey = ${managedBeansPackage}.${patternMatchingExceptionHandler}.instance().handleException(throwable); - if(!org.apache.commons.lang.StringUtils.isEmpty(messageKey)) + if(org.apache.commons.lang.StringUtils.isEmpty(messageKey)){ + throw throwable; + } else { this.addErrorMessage(${managedBeansPackage}.Messages.get(messageKey, null)); } } + } catch (final Throwable throwable) { - throwable.printStackTrace(); + this.setRequestAttribute(CONTROLLER_EXCEPTION, throwable); + logger.error(throwable); this.addExceptionMessage(throwable); } return null; @@ -339,13 +366,17 @@ catch (final Throwable throwable) { final String messageKey = ${managedBeansPackage}.${patternMatchingExceptionHandler}.instance().handleException(throwable); - if(!org.apache.commons.lang.StringUtils.isEmpty(messageKey)) + if(org.apache.commons.lang.StringUtils.isEmpty(messageKey)){ + throw throwable; + } else { this.addErrorMessage(${managedBeansPackage}.Messages.get(messageKey, null)); } } + } catch (final Throwable throwable) { - throwable.printStackTrace(); + this.setRequestAttribute(CONTROLLER_EXCEPTION, throwable); + logger.error(throwable); this.addExceptionMessage(throwable); } return null; @@ -425,19 +456,23 @@ catch (final Throwable throwable) { final String messageKey = ${managedBeansPackage}.${patternMatchingExceptionHandler}.instance().handleException(throwable); - if(!org.apache.commons.lang.StringUtils.isEmpty(messageKey)) + if(org.apache.commons.lang.StringUtils.isEmpty(messageKey)){ + throw throwable; + } else { this.addErrorMessage(${managedBeansPackage}.Messages.get(messageKey, null)); } } + } catch (final Throwable throwable) { - throwable.printStackTrace(); + this.setRequestAttribute(CONTROLLER_EXCEPTION, throwable); + logger.error(throwable); this.addExceptionMessage(throwable); } } public void doDelete(${idParamClass} ${manageable.manageableIdentifier.name}, ${manageable.formBeanType} form) throws Exception { - ${manageable.manageableServiceAccessorCall}.delete(new Long[]{${manageable.manageableIdentifier.name}}); + ${manageable.manageableServiceAccessorCall}.delete(new ${idParamClass}[]{${manageable.manageableIdentifier.name}}); doSearch(form); } @@ -478,7 +513,8 @@ } catch (final Throwable throwable) { - throwable.printStackTrace(); + this.setRequestAttribute(CONTROLLER_EXCEPTION, throwable); + logger.error(throwable); this.addExceptionMessage(throwable); } } @@ -487,9 +523,10 @@ final java.util.Collection<${manageable.valueObjectClassName}> vos; try { vos = (java.util.Collection<${manageable.valueObjectClassName}>)${manageable.manageableServiceAccessorCall}.readAll(); - } catch (Exception e) { - e.printStackTrace(); - this.addExceptionMessage(e); + } catch (final Throwable throwable) { + this.setRequestAttribute(CONTROLLER_EXCEPTION, throwable); + logger.error(throwable); + this.addExceptionMessage(throwable); return null; } final java.util.Collection<javax.faces.model.SelectItem> result=new java.util.ArrayList<javax.faces.model.SelectItem>(vos.size()); @@ -669,6 +706,11 @@ } } + protected void setRequestAttribute(final String name, final Object object) + { + ${managedBeansPackage}.JsfUtils.setAttribute(this.getContext().getExternalContext().getRequest(), name, object); + } + // crud-controller merge-point } \ No newline at end of file 1.21 +4 -1 cartridges/andromda-jsf2/src/main/resources/templates/jsf2/controllers/Controller.java.vsl Index: Controller.java.vsl =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-jsf2/src/main/resources/templates/jsf2/controllers/Controller.java.vsl,v retrieving revision 1.20 retrieving revision 1.21 diff -u -w -r1.20 -r1.21 --- Controller.java.vsl 3 Jul 2008 18:27:18 -0000 1.20 +++ Controller.java.vsl 15 Jul 2008 11:42:44 -0000 1.21 @@ -86,10 +86,13 @@ this.setRequestAttribute(CONTROLLER_EXCEPTION, throwable); this.setForm("$action.formKey", currentForm, false); final String messageKey = ${managedBeansPackage}.${patternMatchingExceptionHandler}.instance().handleException(throwable); - if(!org.apache.commons.lang.StringUtils.isEmpty(messageKey)) + if(org.apache.commons.lang.StringUtils.isEmpty(messageKey)){ + throw throwable; + } else { this.addErrorMessage(${managedBeansPackage}.Messages.get(messageKey, null)); } } + } catch (final Throwable throwable) { this.setRequestAttribute(CONTROLLER_EXCEPTION, throwable); |
From: Chad B. <cwb...@us...> - 2008-07-10 20:15:44
|
User: cwbrandon Date: 08/07/10 13:15:54 Modified: andromda-jsf2/src/main/resources/templates/jsf2/flow/portlet PortletPhaseListener.java.vsl andromda-jsf2/src/main/resources/templates/jsf2/utils/portlet GenericFaceletsPortlet.java.vsl Log: Make sure we stay on the default page when the session expires (even on refreshes) Revision Changes Path 1.18 +8 -0 cartridges/andromda-jsf2/src/main/resources/templates/jsf2/flow/portlet/PortletPhaseListener.java.vsl Index: PortletPhaseListener.java.vsl =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-jsf2/src/main/resources/templates/jsf2/flow/portlet/PortletPhaseListener.java.vsl,v retrieving revision 1.17 retrieving revision 1.18 diff -u -w -r1.17 -r1.18 --- PortletPhaseListener.java.vsl 7 Jul 2008 18:21:48 -0000 1.17 +++ PortletPhaseListener.java.vsl 10 Jul 2008 20:15:53 -0000 1.18 @@ -52,6 +52,14 @@ } } #end + // - remove the stored current view from the session so that the portlet knows it can use + // the default viewId already stored (otherwise it will use the viewId stored in the CURRENT_VIEW) + if (!(javax.faces.event.PhaseId.RESTORE_VIEW.equals(event.getPhaseId()) || + javax.faces.event.PhaseId.RENDER_RESPONSE.equals(event.getPhaseId()))) + { + request.getPortletSession().removeAttribute(${managedBeansPackage}.GenericFaceletsPortlet.CURRENT_VIEW_ID); + } + // - make the faces context available to all views ((javax.portlet.PortletRequest)event.getFacesContext().getExternalContext().getRequest()).setAttribute(FACES_CONTEXT, event.getFacesContext()); 1.3 +30 -11 cartridges/andromda-jsf2/src/main/resources/templates/jsf2/utils/portlet/GenericFaceletsPortlet.java.vsl Index: GenericFaceletsPortlet.java.vsl =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-jsf2/src/main/resources/templates/jsf2/utils/portlet/GenericFaceletsPortlet.java.vsl,v retrieving revision 1.2 retrieving revision 1.3 diff -u -w -r1.2 -r1.3 --- GenericFaceletsPortlet.java.vsl 9 Jul 2008 19:49:40 -0000 1.2 +++ GenericFaceletsPortlet.java.vsl 10 Jul 2008 20:15:54 -0000 1.3 @@ -24,7 +24,8 @@ /** * Extends the default {@link org.apache.myfaces.portlet.MyFacesGenericPortlet} instance to - * provide the necessary support for Facelets. + * provide the necessary support for Facelets. This class depends on the execution + * of {@link PortletPhaseListener}. * * @author Raymond Auge * @author Joel Kozikowski @@ -119,8 +120,8 @@ /** * Overriden in order to save the VIEW_ID to the portlet session (the version in MyFacesGenericPortlet saves the - * viewId as a render parameter which is lost when executing another portlet). This should be fixed at some point - * in the {@link org.apache.myfaces.portlet.MyFacesGenericPortlet} code at which time this method can be removed. + * viewId as a render parameter which is lost when executing another portlet). This method also makes sure + * we stay on the default view once the session becomes invalided (even on refreshes). */ @Override public void processAction(ActionRequest request, ActionResponse response) @@ -136,6 +137,14 @@ { lifecycle.execute(facesContext); + // - get and set the current view explicitly if its set (so that when page refreshes occur + // we stay on the same page). + final String currentView = (String)request.getPortletSession().getAttribute(CURRENT_VIEW_ID); + if (currentView != null) + { + facesContext.getViewRoot().setViewId(currentView); + } + if (!facesContext.getResponseComplete()) { request.getPortletSession().setAttribute(VIEW_ID, facesContext.getViewRoot().getViewId()); @@ -157,10 +166,13 @@ } /** + * Stores the current view id in the session. + */ + public static final String CURRENT_VIEW_ID = GenericFaceletsPortlet.class.getName() + "_CurrentViewId"; + + /** * Overridden in order to retrieve the VIEW_ID from the portlet session (instead of request.getParameter(VIEW_ID) - * as found in {@link org.apache.myfaces.portlet.MyFacesGenericPortlet}). When stored in the request, the VIEW_ID - * is lost when executing anything on another portlet instance. This should be fixed at some point - * in the {@link org.apache.myfaces.portlet.MyFacesGenericPortlet} code at which time this method can be removed. + * as found in {@link org.apache.myfaces.portlet.MyFacesGenericPortlet}). */ @Override protected void facesRender(RenderRequest request, RenderResponse response) @@ -180,27 +192,34 @@ restoreRequired = false; } + setPortletRequestFlag(request); + // This here below is what was in the MyFacesGenericPortlet implementation // String viewId = request.getParameter(VIEW_ID); final boolean sessionInvalidated = sessionInvalidated(request); if (sessionInvalidated) { + // - set the viewId to the default so that we are sent to the default view + viewId = this.defaultView; // - remove the view id so we aren't attempting to go back to it if the session is invalid request.getPortletSession().removeAttribute(VIEW_ID); } + + if (viewId != null) + { + request.getPortletSession().setAttribute(CURRENT_VIEW_ID, viewId); + } + if (viewId == null || sessionInvalidated) { - setPortletRequestFlag(request); nonFacesRequest(request, response); return; } - setPortletRequestFlag(request); - - ServletFacesContextImpl facesContext = null; try { - facesContext = (ServletFacesContextImpl)request.getPortletSession().getAttribute(CURRENT_FACES_CONTEXT); + ServletFacesContextImpl facesContext = (ServletFacesContextImpl) + request.getPortletSession().getAttribute(CURRENT_FACES_CONTEXT); if (facesContext == null) // processAction was not called { facesContext = (ServletFacesContextImpl)facesContext(request, response); |
From: Walter M. <wal...@us...> - 2008-07-10 14:59:47
|
User: walterim Date: 08/07/10 07:59:52 Modified: andromda-jsf2/src/main/resources/META-INF/andromda cartridge.xml metafacades.xml namespace.xml andromda-jsf2/src/main/resources/templates/jsf2/controllers/crud Controller.java.vsl andromda-jsf2/src/main/java/org/andromda/cartridges/jsf2 JSFGlobals.java andromda-jsf2/src/main/java/org/andromda/cartridges/jsf2/metafacades JSFManageableEntityLogicImpl.java Log: Added/corrected the manageableFormKey namespace property Revision Changes Path 1.32 +0 -1 cartridges/andromda-jsf2/src/main/resources/META-INF/andromda/cartridge.xml Index: cartridge.xml =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-jsf2/src/main/resources/META-INF/andromda/cartridge.xml,v retrieving revision 1.31 retrieving revision 1.32 diff -u -w -r1.31 -r1.32 --- cartridge.xml 4 Jul 2008 12:17:50 -0000 1.31 +++ cartridge.xml 10 Jul 2008 14:59:51 -0000 1.32 @@ -68,7 +68,6 @@ <property reference="fileUploadMaxMemoryPerRequest"/> <property reference="fileUploadMaxDiskSpacePerRequest"/> <property reference="defaultTableExportTypes"/> - <property reference="manageableFormName"/> <property reference="manageableFieldMaxLength"/> <property reference="useAutocompleteLookup"/> <property reference="manageableReferenceParameterPrefix"/> 1.5 +1 -1 cartridges/andromda-jsf2/src/main/resources/META-INF/andromda/metafacades.xml Index: metafacades.xml =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-jsf2/src/main/resources/META-INF/andromda/metafacades.xml,v retrieving revision 1.4 retrieving revision 1.5 diff -u -w -r1.4 -r1.5 --- metafacades.xml 28 Mar 2008 18:37:02 -0000 1.4 +++ metafacades.xml 10 Jul 2008 14:59:51 -0000 1.5 @@ -135,9 +135,9 @@ <stereotype>MANAGEABLE</stereotype> </mapping> <property reference="crudValueObjectSuffix"/> + <property reference="manageableActionFormKey"/> <property reference="defaultTableExportTypes"/> <property reference="viewPopulatorPattern"/> - <property reference="actionFormKey"/> </metafacade> <metafacade class="org.andromda.cartridges.jsf2.metafacades.JSFManageableEntityAttributeLogicImpl"> 1.12 +8 -7 cartridges/andromda-jsf2/src/main/resources/META-INF/andromda/namespace.xml Index: namespace.xml =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-jsf2/src/main/resources/META-INF/andromda/namespace.xml,v retrieving revision 1.11 retrieving revision 1.12 diff -u -w -r1.11 -r1.12 --- namespace.xml 4 Jul 2008 12:17:50 -0000 1.11 +++ namespace.xml 10 Jul 2008 14:59:51 -0000 1.12 @@ -80,6 +80,14 @@ The suffix to append to the names of generated value objects used in CRUD (manageable entities). </documentation> </property> + <property name="manageableActionFormKey"> + <default>manageableForm</default> + <documentation> + The name of the key under which each manageable action form is stored. This + form is passed along from action to action in order to transfer + all parameters. + </documentation> + </property> </propertyGroup> <propertyGroup name="Configuration"> <documentation> @@ -577,13 +585,6 @@ Properties related to the generation of the web-tier part of the manageable entities (also known as the CRUD feature). </documentation> - <property name="manageableFormName"> - <default>manageableForm</default> - <documentation> - Defines the name of the <code>form</code> that is passed along during application execution - when using the pages related to <i>manageable entities</i>. - </documentation> - </property> <property name="manageableReferenceParameterPrefix"> <default>ref_</default> <documentation> 1.15 +11 -11 cartridges/andromda-jsf2/src/main/resources/templates/jsf2/controllers/crud/Controller.java.vsl Index: Controller.java.vsl =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-jsf2/src/main/resources/templates/jsf2/controllers/crud/Controller.java.vsl,v retrieving revision 1.14 retrieving revision 1.15 diff -u -w -r1.14 -r1.15 --- Controller.java.vsl 13 Mar 2008 13:12:06 -0000 1.14 +++ Controller.java.vsl 10 Jul 2008 14:59:52 -0000 1.15 @@ -13,7 +13,7 @@ try { - contextWrapper.getCurrentInstance().getPageFlowScope().put("form", form); + contextWrapper.getCurrentInstance().getPageFlowScope().put("${manageable.formKey}", form); this.doInit(form); } @@ -73,7 +73,7 @@ try { - contextWrapper.getCurrentInstance().getPageFlowScope().put("form", form); + contextWrapper.getCurrentInstance().getPageFlowScope().put("${manageable.formKey}", form); this.doLoad(${idParamClass}.valueOf(((javax.faces.component.UIParameter)event.getComponent().findComponent("${manageable.manageableIdentifier.name}")).getValue().toString()),form); } @@ -115,7 +115,7 @@ try { - contextWrapper.getCurrentInstance().getPageFlowScope().put("form", form); + contextWrapper.getCurrentInstance().getPageFlowScope().put("${manageable.formKey}", form); this.doCancel(form); } @@ -147,7 +147,7 @@ try { - contextWrapper.getCurrentInstance().getPageFlowScope().put("form", form); + contextWrapper.getCurrentInstance().getPageFlowScope().put("${manageable.formKey}", form); this.doStartNew(form); } @@ -232,7 +232,7 @@ try { - contextWrapper.getCurrentInstance().getPageFlowScope().put("form", form); + contextWrapper.getCurrentInstance().getPageFlowScope().put("${manageable.formKey}", form); this.doSave(form); } @@ -303,7 +303,7 @@ try { - contextWrapper.getCurrentInstance().getPageFlowScope().put("form", form); + contextWrapper.getCurrentInstance().getPageFlowScope().put("${manageable.formKey}", form); this.doSave(form); this.doStartNew(form); @@ -332,7 +332,7 @@ try { - contextWrapper.getCurrentInstance().getPageFlowScope().put("form", form); + contextWrapper.getCurrentInstance().getPageFlowScope().put("${manageable.formKey}", form); this.doSearch(form); } @@ -418,7 +418,7 @@ try { - contextWrapper.getCurrentInstance().getPageFlowScope().put("form", form); + contextWrapper.getCurrentInstance().getPageFlowScope().put("${manageable.formKey}", form); this.doDelete(${idParamClass}.valueOf(((javax.faces.component.UIParameter)event.getComponent().findComponent("${manageable.manageableIdentifier.name}")).getValue().toString()),form); } @@ -486,7 +486,7 @@ public java.util.Collection<javax.faces.model.SelectItem> getAsSelectItems(){ final java.util.Collection<${manageable.valueObjectClassName}> vos; try { - vos = ${manageable.manageableServiceAccessorCall}.readAll(); + vos = (java.util.Collection<${manageable.valueObjectClassName}>)${manageable.manageableServiceAccessorCall}.readAll(); } catch (Exception e) { e.printStackTrace(); this.addExceptionMessage(e); @@ -505,9 +505,9 @@ } /** - * Returns an javax.faces.event.ActionEvent parameter value, from its name + * Returns an javax.faces.event.FacesEvent parameter value, from its name */ - protected Object getParameterValue(String parameterName, javax.faces.event.ActionEvent event){ + protected Object getParameterValue(String parameterName, javax.faces.event.FacesEvent event){ for(Object uiObject : event.getComponent().getChildren()){ if(uiObject instanceof javax.faces.component.UIParameter){ final javax.faces.component.UIParameter param = (javax.faces.component.UIParameter)uiObject; 1.5 +6 -0 cartridges/andromda-jsf2/src/main/java/org/andromda/cartridges/jsf2/JSFGlobals.java Index: JSFGlobals.java =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-jsf2/src/main/java/org/andromda/cartridges/jsf2/JSFGlobals.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -w -r1.4 -r1.5 --- JSFGlobals.java 2 Nov 2007 18:13:32 -0000 1.4 +++ JSFGlobals.java 10 Jul 2008 14:59:52 -0000 1.5 @@ -12,6 +12,12 @@ * The suffix to append to the class names of CRUD value objects. */ public static final String CRUD_VALUE_OBJECT_SUFFIX = "crudValueObjectSuffix"; + + /** + * The default key under which the manageable action form is stored. + */ + public static final String CRUD_ACTION_FORM_KEY = "manageableActionFormKey"; + /** * A space-separated list of types to which displaytag table are to be exported by default. */ 1.8 +1 -1 cartridges/andromda-jsf2/src/main/java/org/andromda/cartridges/jsf2/metafacades/JSFManageableEntityLogicImpl.java Index: JSFManageableEntityLogicImpl.java =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-jsf2/src/main/java/org/andromda/cartridges/jsf2/metafacades/JSFManageableEntityLogicImpl.java,v retrieving revision 1.7 retrieving revision 1.8 diff -u -w -r1.7 -r1.8 --- JSFManageableEntityLogicImpl.java 4 Jul 2008 12:16:29 -0000 1.7 +++ JSFManageableEntityLogicImpl.java 10 Jul 2008 14:59:52 -0000 1.8 @@ -373,7 +373,7 @@ protected java.lang.String handleGetFormKey() { final Object formKeyValue = this.findTaggedValue(JSFProfile.TAGGEDVALUE_ACTION_FORM_KEY); - return formKeyValue == null ? ObjectUtils.toString(this.getConfiguredProperty(JSFGlobals.ACTION_FORM_KEY)) + return formKeyValue == null ? ObjectUtils.toString(this.getConfiguredProperty(JSFGlobals.CRUD_ACTION_FORM_KEY)) : String.valueOf(formKeyValue); } |
From: Chad B. <cwb...@us...> - 2008-07-09 19:49:34
|
User: cwbrandon Date: 08/07/09 12:49:40 Modified: andromda-jsf2/src/main/resources/templates/jsf2/utils/portlet GenericFaceletsPortlet.java.vsl Log: remove the viewId from the session if the session is invalid Revision Changes Path 1.2 +7 -1 cartridges/andromda-jsf2/src/main/resources/templates/jsf2/utils/portlet/GenericFaceletsPortlet.java.vsl Index: GenericFaceletsPortlet.java.vsl =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-jsf2/src/main/resources/templates/jsf2/utils/portlet/GenericFaceletsPortlet.java.vsl,v retrieving revision 1.1 retrieving revision 1.2 diff -u -w -r1.1 -r1.2 --- GenericFaceletsPortlet.java.vsl 18 Apr 2008 21:25:11 -0000 1.1 +++ GenericFaceletsPortlet.java.vsl 9 Jul 2008 19:49:40 -0000 1.2 @@ -182,7 +182,13 @@ // This here below is what was in the MyFacesGenericPortlet implementation // String viewId = request.getParameter(VIEW_ID); - if (viewId == null || sessionInvalidated(request)) + final boolean sessionInvalidated = sessionInvalidated(request); + if (sessionInvalidated) + { + // - remove the view id so we aren't attempting to go back to it if the session is invalid + request.getPortletSession().removeAttribute(VIEW_ID); + } + if (viewId == null || sessionInvalidated) { setPortletRequestFlag(request); nonFacesRequest(request, response); |
From: Chad B. <cwb...@us...> - 2008-07-07 18:21:40
|
User: cwbrandon Date: 08/07/07 11:21:49 Modified: andromda-jsf2/src/main/resources/templates/jsf2/flow/portlet PortletPhaseListener.java.vsl andromda-jsf2/src/main/resources/templates/jsf2/utils FormPopulator.java.vsl Log: improve population of properties from parameters in the portlet phase listener Revision Changes Path 1.17 +14 -2 cartridges/andromda-jsf2/src/main/resources/templates/jsf2/flow/portlet/PortletPhaseListener.java.vsl Index: PortletPhaseListener.java.vsl =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-jsf2/src/main/resources/templates/jsf2/flow/portlet/PortletPhaseListener.java.vsl,v retrieving revision 1.16 retrieving revision 1.17 diff -u -w -r1.16 -r1.17 --- PortletPhaseListener.java.vsl 3 Jul 2008 21:42:15 -0000 1.16 +++ PortletPhaseListener.java.vsl 7 Jul 2008 18:21:48 -0000 1.17 @@ -35,10 +35,22 @@ final javax.portlet.PortletRequest request = (javax.portlet.PortletRequest)event.getFacesContext().getExternalContext().getRequest(); final String currentUrl = (String)request.getAttribute(CURRENT_URL); final java.util.Map<String, Object> parameters = ${managedBeansPackage}.JsfUtils.extractParameters(currentUrl); + if (parameters != null && !parameters.isEmpty()) + { + final javax.faces.context.FacesContext context = event.getFacesContext(); + final Object form = context.getApplication().getVariableResolver().resolveVariable(context, "$actionFormKey"); + if (form != null) + { + ${managedBeansPackage}.${formPopulatorName}.populateFormFromPropertyMap(form, null, parameters); + } + else + { for (final String parameter : parameters.keySet()) { request.setAttribute(parameter, parameters.get(parameter)); } + } + } #end // - make the faces context available to all views ((javax.portlet.PortletRequest)event.getFacesContext().getExternalContext().getRequest()).setAttribute(FACES_CONTEXT, event.getFacesContext()); 1.13 +2 -2 cartridges/andromda-jsf2/src/main/resources/templates/jsf2/utils/FormPopulator.java.vsl Index: FormPopulator.java.vsl =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-jsf2/src/main/resources/templates/jsf2/utils/FormPopulator.java.vsl,v retrieving revision 1.12 retrieving revision 1.13 diff -u -w -r1.12 -r1.13 --- FormPopulator.java.vsl 3 Jul 2008 18:27:18 -0000 1.12 +++ FormPopulator.java.vsl 7 Jul 2008 18:21:49 -0000 1.13 @@ -215,7 +215,7 @@ final String propertyAsString = (String)property; if (propertyAsString.trim().length() > 0) { - java.text.DateFormat formatter = (java.text.DateFormat)formatters.get(name); + java.text.DateFormat formatter = formatters != null ? (java.text.DateFormat)formatters.get(name) : null; // - if the formatter is available we use that, otherwise we attempt to convert if (formatter != null) { @@ -226,7 +226,7 @@ catch (java.text.ParseException parseException) { // - try the default formatter (handles the default java.util.Date.toString() format) - formatter = (java.text.DateFormat)formatters.get(null); + formatter = formatters != null ? (java.text.DateFormat)formatters.get(null) : null; value = formatter.parse(propertyAsString); } } |
From: Walter M. <wal...@us...> - 2008-07-04 12:17:44
|
User: walterim Date: 08/07/04 05:17:53 Modified: andromda-jsf2/src/main/resources/META-INF/andromda cartridge.xml namespace.xml andromda-jsf2/src/main/resources/templates/jsf2/configuration web.xml.vsl faces-config.xml.vsl Log: Support to optional defaultRole to be applied to all secured elements. Needed to future dynamic role support. Revision Changes Path 1.31 +1 -0 cartridges/andromda-jsf2/src/main/resources/META-INF/andromda/cartridge.xml Index: cartridge.xml =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-jsf2/src/main/resources/META-INF/andromda/cartridge.xml,v retrieving revision 1.30 retrieving revision 1.31 diff -u -w -r1.30 -r1.31 --- cartridge.xml 16 May 2008 22:09:04 -0000 1.30 +++ cartridge.xml 4 Jul 2008 12:17:50 -0000 1.31 @@ -77,6 +77,7 @@ <property reference="portletClass"/> <property reference="paginationResultClassName"/> <property reference="defaultPortletClassName"/> + <property reference="defaultRole"/> <!-- cartridge-property merge-point --> 1.11 +5 -0 cartridges/andromda-jsf2/src/main/resources/META-INF/andromda/namespace.xml Index: namespace.xml =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-jsf2/src/main/resources/META-INF/andromda/namespace.xml,v retrieving revision 1.10 retrieving revision 1.11 diff -u -w -r1.10 -r1.11 --- namespace.xml 18 Apr 2008 21:25:09 -0000 1.10 +++ namespace.xml 4 Jul 2008 12:17:50 -0000 1.11 @@ -287,6 +287,11 @@ The security realm to use when security is enabled. </documentation> </property> + <property name="defaultRole" required="false"> + <documentation> + The default role of all secured elements. + </documentation> + </property> <property name="clientValidation"> <default>true</default> <documentation> 1.18 +13 -2 cartridges/andromda-jsf2/src/main/resources/templates/jsf2/configuration/web.xml.vsl Index: web.xml.vsl =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-jsf2/src/main/resources/templates/jsf2/configuration/web.xml.vsl,v retrieving revision 1.17 retrieving revision 1.18 diff -u -w -r1.17 -r1.18 --- web.xml.vsl 16 May 2008 22:09:05 -0000 1.17 +++ web.xml.vsl 4 Jul 2008 12:17:51 -0000 1.18 @@ -420,8 +420,11 @@ </description> <url-pattern>${useCase.pathRoot}/*</url-pattern> </web-resource-collection> -#if ($useCase.secured) +#if ($useCase.secured || $stringUtils.isNotBlank($defaultRole)) <auth-constraint> +#if ($stringUtils.isNotBlank($defaultRole)) + <role-name>${defaultRole}</role-name> +#end #foreach ($user in $useCase.roles) <role-name>$user.name</role-name> #end @@ -445,8 +448,11 @@ </description> <url-pattern>${manageable.viewFullPath}.${jsfUtils.viewExtension}</url-pattern> </web-resource-collection> -#if (!$manageable.roles.empty) +#if (!$manageable.roles.empty || $stringUtils.isNotBlank($defaultRole)) <auth-constraint> +#if ($stringUtils.isNotBlank($defaultRole)) + <role-name>${defaultRole}</role-name> +#end #foreach ($role in $manageable.roles) <role-name>${role.name}</role-name> #end @@ -472,6 +478,11 @@ <role-name>$user.name</role-name> </security-role> #end +#if ($stringUtils.isNotBlank($defaultRole)) + <security-role> + <role-name>${defaultRole}</role-name> + </security-role> +#end <!-- security-role merge-point --> 1.19 +18 -2 cartridges/andromda-jsf2/src/main/resources/templates/jsf2/configuration/faces-config.xml.vsl Index: faces-config.xml.vsl =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-jsf2/src/main/resources/templates/jsf2/configuration/faces-config.xml.vsl,v retrieving revision 1.18 retrieving revision 1.19 diff -u -w -r1.18 -r1.19 --- faces-config.xml.vsl 16 Jun 2008 19:33:11 -0000 1.18 +++ faces-config.xml.vsl 4 Jul 2008 12:17:51 -0000 1.19 @@ -1,3 +1,16 @@ +## +## This macro adds the default role to the roles string +## +#macro (addDefaultRole $roles) +#if($stringUtils.isNotBlank($defaultRole)) +#if($stringUtils.isBlank($roles)) +#set($roles = $defaultRole) +#else +#set($roles = "${roles},${defaultRole}") +#end +#end +#end +## <?xml version="1.0"?> <!DOCTYPE faces-config PUBLIC @@ -107,6 +120,7 @@ <value>${useCase.controllerAction}</value> </managed-property> #set ($roles = $useCase.actionRoles) +#addDefaultRole($roles) #set ($securityEnabled = $stringUtils.isNotBlank($securityRealm) && $stringUtils.isNotBlank($roles) ) #if ($securityEnabled) <managed-property> @@ -154,11 +168,13 @@ <property-name>controllerAction</property-name> <value>init</value> </managed-property> -#set ($securityEnabled = $stringUtils.isNotBlank($securityRealm) && !$manageable.roles.empty ) +#set ($roles = $manageable.actionRoles) +#addDefaultRole($roles) +#set ($securityEnabled = $stringUtils.isNotBlank($securityRealm) && $stringUtils.isNotBlank($roles)) #if ($securityEnabled) <managed-property> <property-name>roles</property-name> - <value>$manageable.actionRoles</value> + <value>${roles}</value> </managed-property> #end <managed-property> |
From: Walter M. <wal...@us...> - 2008-07-04 12:16:21
|
User: walterim Date: 08/07/04 05:16:29 Modified: andromda-jsf2/src/main/java/org/andromda/cartridges/jsf2/metafacades JSFManageableEntityLogicImpl.java Log: Fix to support manageable entities associated with nom-manageable entities Revision Changes Path 1.7 +6 -3 cartridges/andromda-jsf2/src/main/java/org/andromda/cartridges/jsf2/metafacades/JSFManageableEntityLogicImpl.java Index: JSFManageableEntityLogicImpl.java =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-jsf2/src/main/java/org/andromda/cartridges/jsf2/metafacades/JSFManageableEntityLogicImpl.java,v retrieving revision 1.6 retrieving revision 1.7 diff -u -w -r1.6 -r1.7 --- JSFManageableEntityLogicImpl.java 17 Dec 2007 20:45:23 -0000 1.6 +++ JSFManageableEntityLogicImpl.java 4 Jul 2008 12:16:29 -0000 1.7 @@ -440,10 +440,13 @@ { final Collection coll=new java.util.ArrayList(); for(final java.util.Iterator it=getManageableAttributes().iterator(); it.hasNext(); ){ - final JSFManageableEntityAttribute attr=(JSFManageableEntityAttribute)it.next(); + Object next = it.next(); + if(next instanceof JSFManageableEntityAttribute){ + final JSFManageableEntityAttribute attr=(JSFManageableEntityAttribute)next; if(!attr.isHidden()) coll.add(attr); } + } return coll; } |
From: Chad B. <cwb...@us...> - 2008-07-03 21:42:06
|
User: cwbrandon Date: 08/07/03 14:42:16 Modified: andromda-jsf2/src/main/resources/templates/jsf2/flow/portlet PortletPhaseListener.java.vsl Log: keep track of what views have been populated so we don't do it more than once Revision Changes Path 1.16 +43 -5 cartridges/andromda-jsf2/src/main/resources/templates/jsf2/flow/portlet/PortletPhaseListener.java.vsl Index: PortletPhaseListener.java.vsl =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-jsf2/src/main/resources/templates/jsf2/flow/portlet/PortletPhaseListener.java.vsl,v retrieving revision 1.15 retrieving revision 1.16 diff -u -w -r1.15 -r1.16 --- PortletPhaseListener.java.vsl 3 Jul 2008 18:27:18 -0000 1.15 +++ PortletPhaseListener.java.vsl 3 Jul 2008 21:42:15 -0000 1.16 @@ -81,7 +81,7 @@ } } - private String getViewId(javax.faces.event.PhaseEvent event) + protected String getViewId(javax.faces.event.PhaseEvent event) { String viewId = null; if (event.getFacesContext() != null) @@ -94,6 +94,9 @@ private void populateView(javax.faces.event.PhaseEvent event, String viewId) { + final java.lang.Object session = event.getFacesContext().getExternalContext().getSession(false); + if (!this.isViewPopulated(session, viewId)) + { #foreach ($view in $useCases.iterator().next().allViews) #if ($view.populatorRequired) #set ($ifClause = "if") @@ -106,6 +109,8 @@ } #end #end + this.setCurrentView(session, viewId); + } } @Override @@ -116,5 +121,38 @@ { this.populateView(event, viewId); } + else + { + // - remove the current view + this.setCurrentView(event.getFacesContext().getExternalContext().getSession(false), null); + } + } + + /** + * The name of the attribute that stores the current view id for this phase listener. + */ + private static final String CURRENT_VIEW_ATTRIBUTE = PortletPhaseListener.class.getName() + "ViewId"; + + /** + * Keeps track of whether or not the view has already been populated (so that we don't try again). + * + * @param session the session object that stores the view id to keep track of whether or not its been populated. + * @param viewId the view Id. + * @return true if populated, false otherwise. + */ + protected boolean isViewPopulated(final Object session, final String viewId) + { + final Object currentView = ${managedBeansPackage}.JsfUtils.getAttribute(session, CURRENT_VIEW_ATTRIBUTE); + return currentView != null && currentView.equals(viewId); + } + + /** + * Sets the given viewId as the current view tracked by this portlet. + * @param session the session object that stores the view id to keep track of whether or not its been populated. + * @param viewId the view id to set. + */ + protected void setCurrentView(final Object session, final String viewId) + { + ${managedBeansPackage}.JsfUtils.setAttribute(session, CURRENT_VIEW_ATTRIBUTE, viewId); } } |
From: Chad B. <cwb...@us...> - 2008-07-03 18:27:09
|
User: cwbrandon Date: 08/07/03 11:27:18 Modified: andromda-jsf2/src/main/resources/templates/jsf2/flow ViewPopulator.java.vsl andromda-jsf2/src/main/resources/templates/jsf2/flow/portlet PortletPhaseListener.java.vsl andromda-jsf2/src/main/resources/templates/jsf2/controllers Controller.java.vsl andromda-jsf2/src/main/resources/templates/jsf2/utils FormPopulator.java.vsl Log: improve population from request attributes (don't override values that are already set). Also don't populate view variables with values that haven't been already set on the form. Revision Changes Path 1.11 +11 -1 cartridges/andromda-jsf2/src/main/resources/templates/jsf2/flow/ViewPopulator.java.vsl Index: ViewPopulator.java.vsl =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-jsf2/src/main/resources/templates/jsf2/flow/ViewPopulator.java.vsl,v retrieving revision 1.10 retrieving revision 1.11 diff -u -w -r1.10 -r1.11 --- ViewPopulator.java.vsl 3 Jul 2008 16:33:04 -0000 1.10 +++ ViewPopulator.java.vsl 3 Jul 2008 18:27:17 -0000 1.11 @@ -187,7 +187,17 @@ final boolean $readableVariable = org.apache.commons.beanutils.PropertyUtils.isReadable(form, "$variable.name"); if ($readableVariable) { - request.setAttribute("$variable.name", org.apache.commons.beanutils.PropertyUtils.getProperty(form, "$variable.name")); + java.lang.Boolean propertySet = null; + final String isSetPropertyName = "${variable.name}Set"; + if (org.apache.commons.beanutils.PropertyUtils.isReadable(form, isSetPropertyName)) + { + propertySet = (java.lang.Boolean)org.apache.commons.beanutils.PropertyUtils.getProperty(form, isSetPropertyName); + } + // - only set the property if its been set, or we can't tell if it has + if (propertySet == null || propertySet) + { + request.setAttribute("${variable.name}", org.apache.commons.beanutils.PropertyUtils.getProperty(form, "${variable.name}")); + } #if ($variable.reset) // reset $variable.name (since the model indicates that it should be reset) org.apache.commons.beanutils.PropertyUtils.setProperty(form, "$variable.name", $variable.type.javaNullString); 1.15 +2 -3 cartridges/andromda-jsf2/src/main/resources/templates/jsf2/flow/portlet/PortletPhaseListener.java.vsl Index: PortletPhaseListener.java.vsl =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-jsf2/src/main/resources/templates/jsf2/flow/portlet/PortletPhaseListener.java.vsl,v retrieving revision 1.14 retrieving revision 1.15 diff -u -w -r1.14 -r1.15 --- PortletPhaseListener.java.vsl 1 Jul 2008 15:42:41 -0000 1.14 +++ PortletPhaseListener.java.vsl 3 Jul 2008 18:27:18 -0000 1.15 @@ -70,9 +70,9 @@ event.getFacesContext(), null, controller.${useCase.controllerAction}()); // - get the new view id before population since we are navigating to a new view viewId = event.getFacesContext().getViewRoot().getViewId(); - this.populateView(event, viewId); } #end + this.populateView(event, viewId); } else if (javax.faces.event.PhaseId.APPLY_REQUEST_VALUES.equals(event.getPhaseId())) { @@ -112,8 +112,7 @@ protected void handleAfterPhase(javax.faces.event.PhaseEvent event) { final String viewId = this.getViewId(event); - if (javax.faces.event.PhaseId.INVOKE_APPLICATION.equals(event.getPhaseId()) || - javax.faces.event.PhaseId.APPLY_REQUEST_VALUES.equals(event.getPhaseId())) + if (javax.faces.event.PhaseId.INVOKE_APPLICATION.equals(event.getPhaseId())) { this.populateView(event, viewId); } 1.20 +1 -1 cartridges/andromda-jsf2/src/main/resources/templates/jsf2/controllers/Controller.java.vsl Index: Controller.java.vsl =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-jsf2/src/main/resources/templates/jsf2/controllers/Controller.java.vsl,v retrieving revision 1.19 retrieving revision 1.20 diff -u -w -r1.19 -r1.20 --- Controller.java.vsl 1 Jul 2008 15:42:42 -0000 1.19 +++ Controller.java.vsl 3 Jul 2008 18:27:18 -0000 1.20 @@ -64,7 +64,7 @@ ${managedBeansPackage}.${formPopulatorName}.populateFormFromPropertyMap( form, form.getDateTimeFormatters(), (java.util.Map)this.getRequestAttribute(ACTION_EVENT_ATTRIBUTES), new String[] {"id"}); // - populate the form with any request attributes that may match - ${managedBeansPackage}.${formPopulatorName}.populateFormFromRequestAttributes(form, form.getDateTimeFormatters()); + ${managedBeansPackage}.${formPopulatorName}.populateFormFromRequestAttributes(form, form.getDateTimeFormatters(), false); // - populate the form with any request parameters that may match ${managedBeansPackage}.${formPopulatorName}.populateFormFromPropertyMap( form, form.getDateTimeFormatters(), this.getContext().getExternalContext().getRequestParameterMap()); 1.12 +92 -44 cartridges/andromda-jsf2/src/main/resources/templates/jsf2/utils/FormPopulator.java.vsl Index: FormPopulator.java.vsl =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-jsf2/src/main/resources/templates/jsf2/utils/FormPopulator.java.vsl,v retrieving revision 1.11 retrieving revision 1.12 diff -u -w -r1.11 -r1.12 --- FormPopulator.java.vsl 2 Jul 2008 23:44:38 -0000 1.11 +++ FormPopulator.java.vsl 3 Jul 2008 18:27:18 -0000 1.12 @@ -102,8 +102,9 @@ * @param form the form to populate. * @param formatters any date or time formatters. * @param request the request object from which to populate attributes. + * @param override whether or not to override properties already set on the given form. */ - public static final void populateFormFromRequestAttributes(final Object form, final java.util.Map formatters) + public static final void populateFormFromRequestAttributes(final Object form, final java.util.Map formatters, boolean override) { final javax.faces.context.FacesContext context = javax.faces.context.FacesContext.getCurrentInstance(); final String[] names = ${managedBeansPackage}.JsfUtils.getAttributeNames(context.getExternalContext().getRequest()); @@ -115,7 +116,21 @@ attributes.put(name, ${managedBeansPackage}.JsfUtils.getAttribute(context.getExternalContext().getRequest(), name)); } } - populateFormFromPropertyMap(form, formatters, attributes); + populateFormFromPropertyMap(form, formatters, attributes, override); + } + + /** + * Populates the form from the given map of properties. If a matching property is null or an empty + * string, then null is placed on the form. + * + * @param form the form to populate. + * @param formatters any date or time formatters. + * @param properties the properties to populate from. + * @param override whether or not to override properties already set on the given form. + */ + public static final void populateFormFromPropertyMap(final Object form, final java.util.Map formatters, final java.util.Map properties, boolean override) + { + populateFormFromPropertyMap(form, formatters, properties, null, override); } /** @@ -128,7 +143,7 @@ */ public static final void populateFormFromPropertyMap(final Object form, final java.util.Map formatters, final java.util.Map properties) { - populateFormFromPropertyMap(form, formatters, properties, null); + populateFormFromPropertyMap(form, formatters, properties, null, true); } /** @@ -140,7 +155,24 @@ * @param properties the properties to populate from. * @param ignoreProperties names of any properties to ignore when it comes to populating on the form. */ - public static final void populateFormFromPropertyMap(final Object form, final java.util.Map formatters, final java.util.Map properties, final String[] ignoreProperties) + public static final void populateFormFromPropertyMap(final Object form, final java.util.Map formatters, + final java.util.Map properties, final String[] ignoreProperties) + { + populateFormFromPropertyMap(form, formatters, properties, ignoreProperties, true); + } + + /** + * Populates the form from the given map of properties. If a matching property is null or an empty + * string, then null is placed on the form. + * + * @param form the form to populate. + * @param formatters any date or time formatters. + * @param properties the properties to populate from. + * @param ignoreProperties names of any properties to ignore when it comes to populating on the form. + * @param override whether or not to override properties already set on the given form. + */ + public static final void populateFormFromPropertyMap(final Object form, final java.util.Map formatters, + final java.util.Map properties, final String[] ignoreProperties, boolean override) { if (properties != null) { @@ -157,6 +189,21 @@ org.apache.commons.beanutils.PropertyUtils.getPropertyDescriptor(form, name); if (descriptor != null) { + boolean populateProperty = true; + if (!override) + { + final String isSetPropertyName = name + "Set"; + if (org.apache.commons.beanutils.PropertyUtils.isReadable(form, isSetPropertyName)) + { + final boolean isPropertySet = (java.lang.Boolean)org.apache.commons.beanutils.PropertyUtils.getProperty(form, isSetPropertyName); + if (isPropertySet) + { + populateProperty = false; + } + } + } + if (populateProperty) + { final Object property = properties.get(name); // - only convert if the string is not empty @@ -219,6 +266,7 @@ } } } + } catch (final Throwable throwable) { throw new RuntimeException(throwable); |
From: Chad B. <cwb...@us...> - 2008-07-03 16:32:56
|
User: cwbrandon Date: 08/07/03 09:33:05 Modified: andromda-jsf2/src/main/resources/templates/jsf2/flow ViewPopulator.java.vsl Log: add comment to resettable view variables Revision Changes Path 1.10 +1 -0 cartridges/andromda-jsf2/src/main/resources/templates/jsf2/flow/ViewPopulator.java.vsl Index: ViewPopulator.java.vsl =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-jsf2/src/main/resources/templates/jsf2/flow/ViewPopulator.java.vsl,v retrieving revision 1.9 retrieving revision 1.10 diff -u -w -r1.9 -r1.10 --- ViewPopulator.java.vsl 28 May 2008 20:26:34 -0000 1.9 +++ ViewPopulator.java.vsl 3 Jul 2008 16:33:04 -0000 1.10 @@ -189,6 +189,7 @@ { request.setAttribute("$variable.name", org.apache.commons.beanutils.PropertyUtils.getProperty(form, "$variable.name")); #if ($variable.reset) + // reset $variable.name (since the model indicates that it should be reset) org.apache.commons.beanutils.PropertyUtils.setProperty(form, "$variable.name", $variable.type.javaNullString); #end } |
From: Chad B. <cwb...@us...> - 2008-07-03 15:01:31
|
User: cwbrandon Date: 08/07/03 08:01:40 Modified: andromda-jsf2/src/main/resources/templates/jsf2/utils MessagePhaseListener.java.vsl Log: prevent null pointers (JSF-41) Revision Changes Path 1.8 +29 -23 cartridges/andromda-jsf2/src/main/resources/templates/jsf2/utils/MessagePhaseListener.java.vsl Index: MessagePhaseListener.java.vsl =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-jsf2/src/main/resources/templates/jsf2/utils/MessagePhaseListener.java.vsl,v retrieving revision 1.7 retrieving revision 1.8 diff -u -w -r1.7 -r1.8 --- MessagePhaseListener.java.vsl 28 May 2008 19:04:29 -0000 1.7 +++ MessagePhaseListener.java.vsl 3 Jul 2008 15:01:36 -0000 1.8 @@ -24,8 +24,12 @@ for (final java.util.Iterator iterator = context.getClientIdsWithMessages(); iterator.hasNext();) { final String clientId = (String) iterator.next(); + if (clientId != null) + { final javax.faces.component.UIComponent component = root.findComponent(clientId); final java.util.Collection<Object> arguments = new java.util.ArrayList<Object>(); + if (component != null) + { for (final java.util.Iterator iterator2 = component.getChildren().iterator(); iterator2.hasNext();) { final Object child = iterator2.next(); @@ -41,6 +45,7 @@ } } } + } for (final java.util.Iterator iterator2 = context.getMessages(clientId); iterator2.hasNext();) { final javax.faces.application.FacesMessage facesMessage = (javax.faces.application.FacesMessage)iterator2.next(); @@ -52,6 +57,7 @@ } } } + } #if ($standalone) org.apache.myfaces.trinidad.context.RequestContext requestContext = org.apache.myfaces.trinidad.context.RequestContext.getCurrentInstance(); final Object form = requestContext != null ? requestContext.getPageFlowScope().get("$actionFormKey") : null; |
From: Chad B. <cwb...@us...> - 2008-07-02 23:44:30
|
User: cwbrandon Date: 08/07/02 16:44:38 Modified: andromda-jsf2/src/main/resources/templates/jsf2/utils FormPopulator.java.vsl Log: improve error handling Revision Changes Path 1.11 +14 -5 cartridges/andromda-jsf2/src/main/resources/templates/jsf2/utils/FormPopulator.java.vsl Index: FormPopulator.java.vsl =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-jsf2/src/main/resources/templates/jsf2/utils/FormPopulator.java.vsl,v retrieving revision 1.10 retrieving revision 1.11 diff -u -w -r1.10 -r1.11 --- FormPopulator.java.vsl 2 Jul 2008 11:51:24 -0000 1.10 +++ FormPopulator.java.vsl 2 Jul 2008 23:44:38 -0000 1.11 @@ -188,23 +188,32 @@ value = org.apache.commons.beanutils.ConvertUtils.convert(propertyAsString, descriptor.getPropertyType()); } } + org.apache.commons.beanutils.PropertyUtils.setProperty(form, name, value); } else { value = property; if (value != null) { - if (!descriptor.getPropertyType().isAssignableFrom(value.getClass())) + try + { + org.apache.commons.beanutils.PropertyUtils.setProperty(form, name, value); + } + catch (Exception exception) { - final String propertyTypeName = descriptor.getPropertyType().getName(); final String valueTypeName = value.getClass().getName(); - throw new java.lang.IllegalArgumentException("Can not set form property '" + final String propertyTypeName = descriptor.getPropertyType().getName(); + final StringBuffer message = new StringBuffer("Can not set form property '" + name + "' of type: " + propertyTypeName + " with value: " - + value + "; " + valueTypeName + " is not assignable to " + propertyTypeName); + + value); + if (!descriptor.getPropertyType().isAssignableFrom(value.getClass())) + { + message.append("; " + valueTypeName + " is not assignable to " + propertyTypeName); + } + throw new java.lang.IllegalArgumentException(message + ": " + exception.toString()); } } } - org.apache.commons.beanutils.PropertyUtils.setProperty(form, name, value); } } } |
From: Walter M. <wal...@us...> - 2008-07-02 11:51:16
|
User: walterim Date: 08/07/02 04:51:24 Modified: andromda-jsf2/src/main/resources/templates/jsf2/utils FormPopulator.java.vsl Log: Removing correcting a hard coded reference to JsfUtils Revision Changes Path 1.10 +2 -2 cartridges/andromda-jsf2/src/main/resources/templates/jsf2/utils/FormPopulator.java.vsl Index: FormPopulator.java.vsl =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-jsf2/src/main/resources/templates/jsf2/utils/FormPopulator.java.vsl,v retrieving revision 1.9 retrieving revision 1.10 diff -u -w -r1.9 -r1.10 --- FormPopulator.java.vsl 1 Jul 2008 15:42:42 -0000 1.9 +++ FormPopulator.java.vsl 2 Jul 2008 11:51:24 -0000 1.10 @@ -106,13 +106,13 @@ public static final void populateFormFromRequestAttributes(final Object form, final java.util.Map formatters) { final javax.faces.context.FacesContext context = javax.faces.context.FacesContext.getCurrentInstance(); - final String[] names = org.andromda.presentation.jsf2.JsfUtils.getAttributeNames(context.getExternalContext().getRequest()); + final String[] names = ${managedBeansPackage}.JsfUtils.getAttributeNames(context.getExternalContext().getRequest()); final java.util.Map<String, Object> attributes = new java.util.LinkedHashMap<String, Object>(); if (names != null) { for (final String name : names) { - attributes.put(name, org.andromda.presentation.jsf2.JsfUtils.getAttribute(context.getExternalContext().getRequest(), name)); + attributes.put(name, ${managedBeansPackage}.JsfUtils.getAttribute(context.getExternalContext().getRequest(), name)); } } populateFormFromPropertyMap(form, formatters, attributes); |
From: Chad B. <cwb...@us...> - 2008-07-01 15:42:35
|
User: cwbrandon Date: 08/07/01 08:42:43 Modified: andromda-jsf2/src/main/resources/templates/jsf2/flow/portlet PortletPhaseListener.java.vsl andromda-jsf2/src/main/resources/templates/jsf2/utils JsfUtils.java.vsl FormPopulator.java.vsl andromda-jsf2/src/main/resources/templates/jsf2/controllers Controller.java.vsl Log: Add ability to pass parameters from URL to portlets. Also add population of form from request attributes with matching names. Revision Changes Path 1.14 +18 -0 cartridges/andromda-jsf2/src/main/resources/templates/jsf2/flow/portlet/PortletPhaseListener.java.vsl Index: PortletPhaseListener.java.vsl =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-jsf2/src/main/resources/templates/jsf2/flow/portlet/PortletPhaseListener.java.vsl,v retrieving revision 1.13 retrieving revision 1.14 diff -u -w -r1.13 -r1.14 --- PortletPhaseListener.java.vsl 30 Jun 2008 15:15:22 -0000 1.13 +++ PortletPhaseListener.java.vsl 1 Jul 2008 15:42:41 -0000 1.14 @@ -16,12 +16,30 @@ private static final String FACES_CONTEXT = "facesContext"; +#if ($liferayPortlet) + /** + * Liferay specific attribute available in the request that gives the current URL in the browser. + */ + private static final String CURRENT_URL = "CURRENT_URL"; + +#end @Override protected void handleBeforePhase(javax.faces.event.PhaseEvent event) { String viewId = this.getViewId(event); if (viewId != null && event.getFacesContext() != null) { +#if ($liferayPortlet) + // - get the parameters from the current URL and set them as request attributes to make them available to the current portlets + // (otherwise we'd need to namespace prefix the parameter names in order to pass them to the portlet - at least in Liferay) + final javax.portlet.PortletRequest request = (javax.portlet.PortletRequest)event.getFacesContext().getExternalContext().getRequest(); + final String currentUrl = (String)request.getAttribute(CURRENT_URL); + final java.util.Map<String, Object> parameters = ${managedBeansPackage}.JsfUtils.extractParameters(currentUrl); + for (final String parameter : parameters.keySet()) + { + request.setAttribute(parameter, parameters.get(parameter)); + } +#end // - make the faces context available to all views ((javax.portlet.PortletRequest)event.getFacesContext().getExternalContext().getRequest()).setAttribute(FACES_CONTEXT, event.getFacesContext()); 1.7 +99 -6 cartridges/andromda-jsf2/src/main/resources/templates/jsf2/utils/JsfUtils.java.vsl Index: JsfUtils.java.vsl =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-jsf2/src/main/resources/templates/jsf2/utils/JsfUtils.java.vsl,v retrieving revision 1.6 retrieving revision 1.7 diff -u -w -r1.6 -r1.7 --- JsfUtils.java.vsl 20 May 2008 16:21:46 -0000 1.6 +++ JsfUtils.java.vsl 1 Jul 2008 15:42:41 -0000 1.7 @@ -255,6 +255,93 @@ } /** + * Gets the names of all attributes on the given object. + * + * @param object the object on which to get all attribute names. + * @return an array of all attribute names. + */ + public static String[] getAttributeNames(final Object object) + { + final java.util.Collection<java.lang.String> names = new java.util.ArrayList<String>(); + try + { + if (object != null) + { + try + { + final java.lang.reflect.Method method = object.getClass().getMethod("getAttributeNames", new Class[]{}); + final java.util.Enumeration enumeration = (java.util.Enumeration)method.invoke(object, (Object[])null); + if (enumeration != null) + { + while (enumeration.hasMoreElements()) + { + names.add(java.lang.String.valueOf(enumeration.nextElement())); + } + } + } + catch (NoSuchMethodException exception) + { + } + } + } + catch (Exception exception) + { + throw new RuntimeException(exception); + } + return names.toArray(new java.lang.String[0]); + } + + /** + * Extracts and returns the parameters from the given URL string. + * + * @param url the URL from which to extract parameters. + * @return the Map of parameters. + */ + @SuppressWarnings("unchecked") + public static java.util.Map<String, Object> extractParameters(final String url) + { + final java.util.Map<String, Object> parameterMap = new java.util.LinkedHashMap<String, Object>(); + if (url.contains("?")) + { + final String parameterString = url.replaceAll(".*\\?", ""); + if (parameterString.trim().length() > 0) + { + final String[] parametersAndValues = parameterString.split("\\s*&\\s*"); + for (final String parameterAndValue : parametersAndValues) + { + final String[] parameters = parameterAndValue.split("\\s*=\\s*"); + final String parameter = parameters[0]; + Object existingValue = parameterMap.get(parameter); + String value = null; + if (parameters.length > 1) + { + value = parameters[1]; + } + if (existingValue != null) + { + if (existingValue instanceof java.util.Collection) + { + ((java.util.Collection)existingValue).add(value); + } + else + { + final java.util.Collection<Object> values = new java.util.ArrayList<Object>(); + values.add(existingValue); + values.add(value); + parameterMap.put(parameter, values); + } + } + else + { + parameterMap.put(parameter, value); + } + } + } + } + return parameterMap; + } + + /** * Uses the converter identified by converterId to convert the value to a String. * @value the value to be converted * @converterId the id of the converter to be used @@ -264,7 +351,8 @@ public static String valueFromConverter( final Object value, final String converterId, - final String componentId){ + final String componentId) + { final javax.faces.context.FacesContext facesContext=javax.faces.context.FacesContext.getCurrentInstance(); final javax.faces.convert.Converter converter = facesContext.getApplication().createConverter(converterId); return converter.getAsString(facesContext, @@ -280,7 +368,8 @@ */ public static String valueFromConverter( final Object value, - final String converterId){ + final String converterId) + { final javax.faces.context.FacesContext facesContext=javax.faces.context.FacesContext.getCurrentInstance(); final javax.faces.convert.Converter converter = facesContext.getApplication().createConverter(converterId); return converter.getAsString(facesContext,null,value); @@ -292,11 +381,15 @@ * @event ActionEvent containing the parameter * @return the parameter value. */ - public static Object getParameterValue(String parameterName, javax.faces.event.ActionEvent event){ - for(Object uiObject : event.getComponent().getChildren()){ - if(uiObject instanceof javax.faces.component.UIParameter){ + public static Object getParameterValue(String parameterName, javax.faces.event.ActionEvent event) + { + for(Object uiObject : event.getComponent().getChildren()) + { + if(uiObject instanceof javax.faces.component.UIParameter) + { final javax.faces.component.UIParameter param = (javax.faces.component.UIParameter)uiObject; - if(param.getName().equals(parameterName)) { + if(param.getName().equals(parameterName)) + { return param.getValue(); } } 1.9 +22 -0 cartridges/andromda-jsf2/src/main/resources/templates/jsf2/utils/FormPopulator.java.vsl Index: FormPopulator.java.vsl =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-jsf2/src/main/resources/templates/jsf2/utils/FormPopulator.java.vsl,v retrieving revision 1.8 retrieving revision 1.9 diff -u -w -r1.8 -r1.9 --- FormPopulator.java.vsl 3 Jun 2008 21:22:02 -0000 1.8 +++ FormPopulator.java.vsl 1 Jul 2008 15:42:42 -0000 1.9 @@ -97,6 +97,28 @@ } /** + * Populates the form from the attributes contained in the request object. + * + * @param form the form to populate. + * @param formatters any date or time formatters. + * @param request the request object from which to populate attributes. + */ + public static final void populateFormFromRequestAttributes(final Object form, final java.util.Map formatters) + { + final javax.faces.context.FacesContext context = javax.faces.context.FacesContext.getCurrentInstance(); + final String[] names = org.andromda.presentation.jsf2.JsfUtils.getAttributeNames(context.getExternalContext().getRequest()); + final java.util.Map<String, Object> attributes = new java.util.LinkedHashMap<String, Object>(); + if (names != null) + { + for (final String name : names) + { + attributes.put(name, org.andromda.presentation.jsf2.JsfUtils.getAttribute(context.getExternalContext().getRequest(), name)); + } + } + populateFormFromPropertyMap(form, formatters, attributes); + } + + /** * Populates the form from the given map of properties. If a matching property is null or an empty * string, then null is placed on the form. * 1.19 +2 -0 cartridges/andromda-jsf2/src/main/resources/templates/jsf2/controllers/Controller.java.vsl Index: Controller.java.vsl =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-jsf2/src/main/resources/templates/jsf2/controllers/Controller.java.vsl,v retrieving revision 1.18 retrieving revision 1.19 diff -u -w -r1.18 -r1.19 --- Controller.java.vsl 3 Jun 2008 21:26:23 -0000 1.18 +++ Controller.java.vsl 1 Jul 2008 15:42:42 -0000 1.19 @@ -63,6 +63,8 @@ // is a reserved name in JSF (the id of a component), therefore we have to unfortunately ignore any availble "id" attribute ${managedBeansPackage}.${formPopulatorName}.populateFormFromPropertyMap( form, form.getDateTimeFormatters(), (java.util.Map)this.getRequestAttribute(ACTION_EVENT_ATTRIBUTES), new String[] {"id"}); + // - populate the form with any request attributes that may match + ${managedBeansPackage}.${formPopulatorName}.populateFormFromRequestAttributes(form, form.getDateTimeFormatters()); // - populate the form with any request parameters that may match ${managedBeansPackage}.${formPopulatorName}.populateFormFromPropertyMap( form, form.getDateTimeFormatters(), this.getContext().getExternalContext().getRequestParameterMap()); |
From: Chad B. <cwb...@us...> - 2008-06-30 15:15:15
|
User: cwbrandon Date: 08/06/30 08:15:23 Modified: andromda-jsf2/src/main/resources/templates/jsf2/flow/portlet PortletPhaseListener.java.vsl Log: improve handling of use case entry points Revision Changes Path 1.13 +6 -3 cartridges/andromda-jsf2/src/main/resources/templates/jsf2/flow/portlet/PortletPhaseListener.java.vsl Index: PortletPhaseListener.java.vsl =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-jsf2/src/main/resources/templates/jsf2/flow/portlet/PortletPhaseListener.java.vsl,v retrieving revision 1.12 retrieving revision 1.13 diff -u -w -r1.12 -r1.13 --- PortletPhaseListener.java.vsl 16 May 2008 22:09:05 -0000 1.12 +++ PortletPhaseListener.java.vsl 30 Jun 2008 15:15:22 -0000 1.13 @@ -19,7 +19,7 @@ @Override protected void handleBeforePhase(javax.faces.event.PhaseEvent event) { - final String viewId = this.getViewId(event); + String viewId = this.getViewId(event); if (viewId != null && event.getFacesContext() != null) { // - make the faces context available to all views @@ -43,12 +43,15 @@ #if ($velocityCount > 1) #set ($ifClause = "else $ifClause") #end - $ifClause (viewId.equals("${useCase.initialTargetPath}.xhtml")) + $ifClause (viewId.equals("${useCase.portletViewPath}.xhtml")) { final $controller.fullyQualifiedName controller = ($controller.fullyQualifiedName) event.getFacesContext().getApplication().getVariableResolver().resolveVariable( event.getFacesContext(), "$controller.beanName"); - controller.${useCase.controllerAction}(); + event.getFacesContext().getApplication().getNavigationHandler().handleNavigation( + event.getFacesContext(), null, controller.${useCase.controllerAction}()); + // - get the new view id before population since we are navigating to a new view + viewId = event.getFacesContext().getViewRoot().getViewId(); this.populateView(event, viewId); } #end |
From: Chad B. <cwb...@us...> - 2008-06-29 01:56:29
|
User: cwbrandon Date: 08/06/28 18:56:38 Modified: andromda-jsf2/src/main/java/org/andromda/cartridges/jsf2/metafacades JSFUseCaseLogicImpl.java JSFForwardLogicImpl.java andromda-jsf2/src/main/java/org/andromda/cartridges/jsf2 JSFUtils.java Log: minor cleanup Revision Changes Path 1.10 +3 -2 cartridges/andromda-jsf2/src/main/java/org/andromda/cartridges/jsf2/metafacades/JSFUseCaseLogicImpl.java Index: JSFUseCaseLogicImpl.java =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-jsf2/src/main/java/org/andromda/cartridges/jsf2/metafacades/JSFUseCaseLogicImpl.java,v retrieving revision 1.9 retrieving revision 1.10 diff -u -w -r1.9 -r1.10 --- JSFUseCaseLogicImpl.java 26 Apr 2008 17:36:15 -0000 1.9 +++ JSFUseCaseLogicImpl.java 29 Jun 2008 01:56:38 -0000 1.10 @@ -509,9 +509,10 @@ /** * @see org.andromda.cartridges.jsf2.metafacades.JSFUseCase#getAllForwards() */ + @SuppressWarnings("unchecked") protected List handleGetAllForwards() { - final Map forwards = new LinkedHashMap(); + final Map<String, ModelElementFacade> forwards = new LinkedHashMap<String, ModelElementFacade>(); for (final Iterator iterator = this.getActionForwards().iterator(); iterator.hasNext();) { final ModelElementFacade forward = (ModelElementFacade)iterator.next(); @@ -896,7 +897,7 @@ @Override protected String handleGetPortletViewPath() { - return this.getInitialTargetPath(); + return this.getPath(); } @SuppressWarnings("unchecked") 1.2 +9 -8 cartridges/andromda-jsf2/src/main/java/org/andromda/cartridges/jsf2/metafacades/JSFForwardLogicImpl.java Index: JSFForwardLogicImpl.java =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-jsf2/src/main/java/org/andromda/cartridges/jsf2/metafacades/JSFForwardLogicImpl.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -w -r1.1 -r1.2 --- JSFForwardLogicImpl.java 5 Dec 2006 19:39:09 -0000 1.1 +++ JSFForwardLogicImpl.java 29 Jun 2008 01:56:38 -0000 1.2 @@ -81,9 +81,10 @@ * @return maps message keys to message values, but only those that match the arguments * will have been recorded */ - private Map getMessages(String taggedValue) + @SuppressWarnings("unchecked") + private Map<String, String> getMessages(String taggedValue) { - Map messages; + Map<String, String> messages; final Collection taggedValues = this.findTaggedValues(taggedValue); if (taggedValues.isEmpty()) @@ -92,7 +93,7 @@ } else { - messages = new LinkedHashMap(); // we want to keep the order + messages = new LinkedHashMap<String, String>(); // we want to keep the order for (final Iterator iterator = taggedValues.iterator(); iterator.hasNext();) { 1.7 +6 -6 cartridges/andromda-jsf2/src/main/java/org/andromda/cartridges/jsf2/JSFUtils.java Index: JSFUtils.java =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-jsf2/src/main/java/org/andromda/cartridges/jsf2/JSFUtils.java,v retrieving revision 1.6 retrieving revision 1.7 diff -u -w -r1.6 -r1.7 --- JSFUtils.java 21 Mar 2008 16:07:13 -0000 1.6 +++ JSFUtils.java 29 Jun 2008 01:56:38 -0000 1.7 @@ -56,7 +56,7 @@ * @return returns a list of String instances or an empty list * @throws IllegalArgumentException when the input string does not match the required pattern */ - public static List parseValidatorArgs(String validatorTaggedValue) + public static List<String> parseValidatorArgs(String validatorTaggedValue) { if (validatorTaggedValue == null) { @@ -72,7 +72,7 @@ "@andromda.presentation.view.field.format?): " + validatorTaggedValue); } - final List validatorArgs = new ArrayList(); + final List<String> validatorArgs = new ArrayList<String>(); // only keep what is between parentheses (if any) int left = validatorTaggedValue.indexOf('('); @@ -122,7 +122,7 @@ throw new IllegalArgumentException("Illegal validator tagged value: " + validatorTaggedValue); } - final List validatorVars = new ArrayList(); + final List<String> validatorVars = new ArrayList<String>(); // only keep what is between parentheses (if any) int left = validatorTaggedValue.indexOf('('); @@ -583,7 +583,7 @@ final ModelElementFacade element, final ClassifierFacade type) { - final Collection validatorTypesList = new ArrayList(); + final Collection<String> validatorTypesList = new ArrayList<String>(); if (element != null && type != null) { final String format = JSFUtils.getInputFormat(element); @@ -721,7 +721,7 @@ final ClassifierFacade type, final ParameterFacade ownerParameter) { - final Map vars = new LinkedHashMap(); + final Map<String, Object> vars = new LinkedHashMap<String, Object>(); if (element != null && type != null) { final String format = JSFUtils.getInputFormat(element); @@ -866,7 +866,7 @@ final ModelElementFacade element, final java.lang.String validatorType) { - final Collection args = new ArrayList(); + final Collection<Object> args = new ArrayList<Object>(); if ("intRange".equals(validatorType) || "floatRange".equals(validatorType) || "doubleRange".equals(validatorType)) { |
From: Walter M. <wal...@us...> - 2008-06-26 18:12:44
|
User: walterim Date: 08/06/26 11:12:51 Modified: andromda-jsf2/src/main/resources/templates/jsf2/forms formImplMacros.vm Log: corrected a compilation error when the form field is of type 'Time' Revision Changes Path 1.3 +1 -1 cartridges/andromda-jsf2/src/main/resources/templates/jsf2/forms/formImplMacros.vm Index: formImplMacros.vm =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-jsf2/src/main/resources/templates/jsf2/forms/formImplMacros.vm,v retrieving revision 1.2 retrieving revision 1.3 diff -u -w -r1.2 -r1.3 --- formImplMacros.vm 30 May 2008 15:04:31 -0000 1.2 +++ formImplMacros.vm 26 Jun 2008 18:12:51 -0000 1.3 @@ -140,6 +140,6 @@ ${dateFormatter}.setLenient($lenient); this.dateTimeFormatters.put("$fieldName", $dateFormatter); #elseif ($field.type.timeType) - this.dateTimeFormatters.put("$fieldName", new java.text.SimpleDateFormat("$field.format"); + this.dateTimeFormatters.put("$fieldName", new java.text.SimpleDateFormat("$field.format")); #end #end |
From: Chad B. <cwb...@us...> - 2008-06-23 17:34:07
|
User: cwbrandon Date: 08/06/23 10:34:16 Modified: . pom.xml Log: change andromda version to 3.3 Revision Changes Path 1.16 +8 -8 plugins/pom.xml Index: pom.xml =================================================================== RCS file: /cvsroot/andromdaplugins/plugins/pom.xml,v retrieving revision 1.15 retrieving revision 1.16 diff -u -w -r1.15 -r1.16 --- pom.xml 28 Apr 2008 16:06:53 -0000 1.15 +++ pom.xml 23 Jun 2008 17:34:16 -0000 1.16 @@ -87,33 +87,33 @@ <dependency> <groupId>org.andromda</groupId> <artifactId>andromda-core</artifactId> - <version>3.3-SNAPSHOT</version> + <version>3.3</version> </dependency> <dependency> <groupId>org.andromda</groupId> <artifactId>andromda-utils</artifactId> - <version>3.3-SNAPSHOT</version> + <version>3.3</version> </dependency> <dependency> <groupId>org.andromda.metafacades</groupId> <artifactId>andromda-metafacades-uml</artifactId> - <version>3.3-SNAPSHOT</version> + <version>3.3</version> </dependency> <dependency> <groupId>org.andromda.cartridges</groupId> <artifactId>andromda-meta-cartridge</artifactId> - <version>3.3-SNAPSHOT</version> + <version>3.3</version> <scope>provided</scope> </dependency> <dependency> <groupId>org.andromda.translationlibraries</groupId> <artifactId>andromda-ocl-validation-library</artifactId> - <version>3.3-SNAPSHOT</version> + <version>3.3</version> </dependency> <dependency> <groupId>org.andromda.profiles.uml14</groupId> <artifactId>andromda-profile</artifactId> - <version>3.3-SNAPSHOT</version> + <version>3.3</version> <type>xml.zip</type> <scope>runtime</scope> </dependency> @@ -145,7 +145,7 @@ <plugin> <groupId>org.andromda.maven.plugins</groupId> <artifactId>andromda-maven-plugin</artifactId> - <version>3.3-SNAPSHOT</version> + <version>3.3</version> <executions> <execution> <goals> @@ -163,7 +163,7 @@ <extensions>true</extensions> <groupId>org.andromda.maven.plugins</groupId> <artifactId>andromda-cartridge-plugin</artifactId> - <version>3.3-SNAPSHOT</version> + <version>3.3</version> <executions> <execution> <goals> |
From: Walter M. <wal...@us...> - 2008-06-16 19:34:14
|
User: walterim Date: 08/06/16 12:34:13 Modified: andromda-jsf2 pom.xml andromda-jsf2/src/main/uml JSFMetafacadeModel.xml.zip Log: Using andromda 3.3 instead of 3.3-SNAPSHOT Revision Changes Path 1.9 +2 -2 cartridges/andromda-jsf2/pom.xml Index: pom.xml =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-jsf2/pom.xml,v retrieving revision 1.8 retrieving revision 1.9 diff -u -w -r1.8 -r1.9 --- pom.xml 25 Feb 2008 14:16:49 -0000 1.8 +++ pom.xml 16 Jun 2008 19:34:11 -0000 1.9 @@ -16,7 +16,7 @@ <dependency> <groupId>${pom.groupId}</groupId> <artifactId>andromda-jsf-cartridge-components</artifactId> - <version>3.3-SNAPSHOT</version> + <version>3.3</version> </dependency> <dependency> <groupId>commons-lang</groupId> @@ -33,7 +33,7 @@ <dependency> <groupId>org.andromda.cartridges</groupId> <artifactId>andromda-meta-cartridge</artifactId> - <version>3.3-SNAPSHOT</version> + <version>3.3</version> </dependency> </dependencies> </plugin> 1.15 +185 -214 cartridges/andromda-jsf2/src/main/uml/JSFMetafacadeModel.xml.zip <<Binary file>> |
From: Walter M. <wal...@us...> - 2008-06-16 19:33:04
|
User: walterim Date: 08/06/16 12:33:11 Modified: andromda-jsf2/src/main/resources/templates/jsf2/configuration faces-config.xml.vsl Log: Menu model and controllers using request scope Revision Changes Path 1.18 +7 -7 cartridges/andromda-jsf2/src/main/resources/templates/jsf2/configuration/faces-config.xml.vsl Index: faces-config.xml.vsl =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-jsf2/src/main/resources/templates/jsf2/configuration/faces-config.xml.vsl,v retrieving revision 1.17 retrieving revision 1.18 diff -u -w -r1.17 -r1.18 --- faces-config.xml.vsl 19 May 2008 20:17:06 -0000 1.17 +++ faces-config.xml.vsl 16 Jun 2008 19:33:11 -0000 1.18 @@ -78,7 +78,7 @@ <managed-bean> <managed-bean-name>autocompleteHelper</managed-bean-name> <managed-bean-class>${managedBeansPackage}.AutocompleteHelper</managed-bean-class> - <managed-bean-scope>application</managed-bean-scope> + <managed-bean-scope>request</managed-bean-scope> </managed-bean> #end @@ -89,7 +89,7 @@ <managed-bean> <managed-bean-name>navItem_$stringUtils.replace($useCase.forwardName, '-', '_')</managed-bean-name> <managed-bean-class>${managedBeansPackage}.NavigationItem</managed-bean-class> - <managed-bean-scope>application</managed-bean-scope> + <managed-bean-scope>request</managed-bean-scope> <managed-property> <property-name>label</property-name> <value>$useCase.titleKey</value> @@ -137,7 +137,7 @@ <managed-bean> <managed-bean-name>navItem_$manageable.actionClassName</managed-bean-name> <managed-bean-class>${managedBeansPackage}.NavigationItem</managed-bean-class> - <managed-bean-scope>application</managed-bean-scope> + <managed-bean-scope>request</managed-bean-scope> <managed-property> <property-name>label</property-name> <value>$manageable.viewTitleKey</value> @@ -176,7 +176,7 @@ <managed-bean-class> java.util.ArrayList </managed-bean-class> - <managed-bean-scope>application</managed-bean-scope> + <managed-bean-scope>request</managed-bean-scope> <list-entries> <value-class>${managedBeansPackage}.NavigationItem</value-class> #foreach ($useCase in $useCases) @@ -194,7 +194,7 @@ <managed-bean> <managed-bean-name>navTreeModel</managed-bean-name> <managed-bean-class>org.apache.myfaces.trinidad.model.ChildPropertyTreeModel</managed-bean-class> - <managed-bean-scope>application</managed-bean-scope> + <managed-bean-scope>request</managed-bean-scope> <managed-property> <property-name>childProperty</property-name> <value>children</value> @@ -210,7 +210,7 @@ <managed-bean> <managed-bean-name>viewIdMenuModel</managed-bean-name> <managed-bean-class>org.apache.myfaces.trinidad.model.ViewIdPropertyMenuModel</managed-bean-class> - <managed-bean-scope>application</managed-bean-scope> + <managed-bean-scope>request</managed-bean-scope> <managed-property> <property-name>viewIdProperty</property-name> <value>viewId</value> @@ -224,7 +224,7 @@ <managed-bean> <managed-bean-name>menuModel</managed-bean-name> <managed-bean-class>${managedBeansPackage}.MenuModelAdapter</managed-bean-class> - <managed-bean-scope>application</managed-bean-scope> + <managed-bean-scope>request</managed-bean-scope> <managed-property> <property-name>model</property-name> <value>#{viewIdMenuModel}</value> |
From: Walter M. <wal...@us...> - 2008-06-10 17:35:44
|
User: walterim Date: 08/06/10 10:35:52 Modified: andromda-jsf2/src/main/resources/templates/jsf2/forms/crud Form.java.vsl Log: Changed the support to jsf messages, following the non-crud forms handling methods. Revision Changes Path 1.6 +58 -14 cartridges/andromda-jsf2/src/main/resources/templates/jsf2/forms/crud/Form.java.vsl Index: Form.java.vsl =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-jsf2/src/main/resources/templates/jsf2/forms/crud/Form.java.vsl,v retrieving revision 1.5 retrieving revision 1.6 diff -u -w -r1.5 -r1.6 --- Form.java.vsl 7 Mar 2008 16:48:49 -0000 1.5 +++ Form.java.vsl 10 Jun 2008 17:35:52 -0000 1.6 @@ -199,10 +199,13 @@ return this.dateTimeFormatters; } + /** * The current collection of messages stored within this form. */ - private java.util.Map $formMessagesProperty = new java.util.LinkedHashMap(); + private java.util.Map<java.lang.String, javax.faces.application.FacesMessage> $formMessagesProperty = + new java.util.LinkedHashMap<java.lang.String, javax.faces.application.FacesMessage>(); + /** * Adds a {@link javax.faces.application.FacesMessage} message to the current messages @@ -224,43 +227,83 @@ * * @return the current Faces messages. */ - public java.util.Collection get${stringUtils.capitalize($formMessagesProperty)}() + public java.util.Collection<javax.faces.application.FacesMessage> get${stringUtils.capitalize($formMessagesProperty)}() { return this.${formMessagesProperty}.values(); } /** + * Sets the current {@link javax.faces.application.FacesMessage} message + * instances stored within this form. + * + * @param messages a collection of the current Faces messages. + */ + public void set${stringUtils.capitalize($formMessagesProperty)}(final java.util.Collection<javax.faces.application.FacesMessage> messages) + { + if (messages != null) + { + for (final java.util.Iterator iterator = messages.iterator(); iterator.hasNext();) + { + javax.faces.application.FacesMessage jsfMessage = (javax.faces.application.FacesMessage)iterator.next(); + this.${formMessagesProperty}.put(jsfMessage.getDetail(), jsfMessage); + } + } + } + + /** * Clear the current {@link javax.faces.application.FacesMessage} message * instances stored within this form. * */ - public void clearJsfMessages() + public void clear${stringUtils.capitalize($formMessagesProperty)}() { this.${formMessagesProperty}.clear(); } /** - * Gets the current {@link javax.faces.application.FacesMessage} message - * instances stored within this form, as Map. + * The faces message title (used on a view). + */ + private String ${formMessagesProperty}Title; + + /** + * The optional faces message title to set (used on a view). If not set, the default title + * will be used. * - * @return the current Faces messages. + * @param jsfMessagesTitle the title to use for the messages on the view. */ - public java.util.Map get${stringUtils.capitalize($formMessagesProperty)}Map() + public void set${stringUtils.capitalize($formMessagesProperty)}Title(final String ${formMessagesProperty}Title) { - return this.${formMessagesProperty}; + this.${formMessagesProperty}Title = ${formMessagesProperty}Title; } /** - * Sets the current {@link javax.faces.application.FacesMessage} message - * instances stored within this form, as Map. + * Gets the faces messages title to use. * - * @return the current Faces messages. + * @return the faces messages title. */ - public void set${stringUtils.capitalize($formMessagesProperty)}Map(java.util.Map ${formMessagesProperty}) + public String get${stringUtils.capitalize($formMessagesProperty)}Title() { - this.${formMessagesProperty} = ${formMessagesProperty}; + return this.${formMessagesProperty}Title; } + /** + * Gets the maximum severity of the messages stored in this form. + * + * @return the maximum severity or null if no messages are present and/or severity isn't set. + */ + public javax.faces.application.FacesMessage.Severity getMaximumMessageSeverity() + { + javax.faces.application.FacesMessage.Severity maxSeverity = null; + for (final javax.faces.application.FacesMessage message : this.get${stringUtils.capitalize($formMessagesProperty)}()) + { + final javax.faces.application.FacesMessage.Severity severity = message.getSeverity(); + if (maxSeverity == null || (severity != null && severity.getOrdinal() > maxSeverity.getOrdinal())) + { + maxSeverity = severity; + } + } + return maxSeverity; + } public void copyFrom($manageable.formBeanClassName otherForm){ #foreach ($field in $manageable.manageableAttributes) @@ -274,7 +317,8 @@ this.set${backingListMethod}(otherForm.get${backingListMethod}()); #end - this.set${stringUtils.capitalize($formMessagesProperty)}Map(get${stringUtils.capitalize($formMessagesProperty)}Map()); + this.set${stringUtils.capitalize($formMessagesProperty)}(otherForm.get${stringUtils.capitalize($formMessagesProperty)}()); + this.set${stringUtils.capitalize($formMessagesProperty)}Title(otherForm.get${stringUtils.capitalize($formMessagesProperty)}Title()); this.setEditState(otherForm.getEditState()); this.setSearchForm(otherForm.getSearchForm()); |
From: Chad B. <cwb...@us...> - 2008-06-03 21:26:15
|
User: cwbrandon Date: 08/06/03 14:26:23 Modified: andromda-jsf2/src/main/resources/templates/jsf2/controllers Controller.java.vsl Log: log the controller error Revision Changes Path 1.18 +1 -0 cartridges/andromda-jsf2/src/main/resources/templates/jsf2/controllers/Controller.java.vsl Index: Controller.java.vsl =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-jsf2/src/main/resources/templates/jsf2/controllers/Controller.java.vsl,v retrieving revision 1.17 retrieving revision 1.18 diff -u -w -r1.17 -r1.18 --- Controller.java.vsl 28 May 2008 19:04:33 -0000 1.17 +++ Controller.java.vsl 3 Jun 2008 21:26:23 -0000 1.18 @@ -80,6 +80,7 @@ } catch (final Throwable throwable) { + logger.error(throwable); this.setRequestAttribute(CONTROLLER_EXCEPTION, throwable); this.setForm("$action.formKey", currentForm, false); final String messageKey = ${managedBeansPackage}.${patternMatchingExceptionHandler}.instance().handleException(throwable); |
From: Chad B. <cwb...@us...> - 2008-06-03 21:21:55
|
User: cwbrandon Date: 08/06/03 14:22:04 Modified: andromda-jsf2/src/main/resources/templates/jsf2/utils FormPopulator.java.vsl Log: improve error message for copying of non-compatible types Revision Changes Path 1.8 +11 -0 cartridges/andromda-jsf2/src/main/resources/templates/jsf2/utils/FormPopulator.java.vsl Index: FormPopulator.java.vsl =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-jsf2/src/main/resources/templates/jsf2/utils/FormPopulator.java.vsl,v retrieving revision 1.7 retrieving revision 1.8 diff -u -w -r1.7 -r1.8 --- FormPopulator.java.vsl 20 May 2008 02:54:29 -0000 1.7 +++ FormPopulator.java.vsl 3 Jun 2008 21:22:02 -0000 1.8 @@ -170,6 +170,17 @@ else { value = property; + if (value != null) + { + if (!descriptor.getPropertyType().isAssignableFrom(value.getClass())) + { + final String propertyTypeName = descriptor.getPropertyType().getName(); + final String valueTypeName = value.getClass().getName(); + throw new java.lang.IllegalArgumentException("Can not set form property '" + + name + "' of type: " + propertyTypeName + " with value: " + + value + "; " + valueTypeName + " is not assignable to " + propertyTypeName); + } + } } org.apache.commons.beanutils.PropertyUtils.setProperty(form, name, value); } |
From: Chad B. <cwb...@us...> - 2008-05-30 15:04:23
|
User: cwbrandon Date: 08/05/30 08:04:31 Modified: andromda-jsf2/src/main/resources/templates/jsf2/forms formImplMacros.vm FormImpl.java.vsl Log: get rid of warnings on date formatter code Revision Changes Path 1.2 +6 -7 cartridges/andromda-jsf2/src/main/resources/templates/jsf2/forms/formImplMacros.vm Index: formImplMacros.vm =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-jsf2/src/main/resources/templates/jsf2/forms/formImplMacros.vm,v retrieving revision 1.1 retrieving revision 1.2 diff -u -w -r1.1 -r1.2 --- formImplMacros.vm 5 Dec 2006 19:39:26 -0000 1.1 +++ formImplMacros.vm 30 May 2008 15:04:31 -0000 1.2 @@ -136,11 +136,10 @@ #end #set ($lenient = !$field.strictDateFormat) #if ($field.type.dateType) - java.text.DateFormat $dateFormatter = new java.text.SimpleDateFormat("$field.format"); + final java.text.DateFormat $dateFormatter = new java.text.SimpleDateFormat("$field.format"); ${dateFormatter}.setLenient($lenient); this.dateTimeFormatters.put("$fieldName", $dateFormatter); #elseif ($field.type.timeType) - java.text.DateFormat $timeFormatter = new java.text.SimpleDateFormat("$field.format"); - this.dateTimeFormatters.put("$fieldName", $timeFormatter); + this.dateTimeFormatters.put("$fieldName", new java.text.SimpleDateFormat("$field.format"); #end #end 1.8 +4 -3 cartridges/andromda-jsf2/src/main/resources/templates/jsf2/forms/FormImpl.java.vsl Index: FormImpl.java.vsl =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-jsf2/src/main/resources/templates/jsf2/forms/FormImpl.java.vsl,v retrieving revision 1.7 retrieving revision 1.8 diff -u -w -r1.7 -r1.8 --- FormImpl.java.vsl 28 May 2008 19:04:33 -0000 1.7 +++ FormImpl.java.vsl 30 May 2008 15:04:31 -0000 1.8 @@ -20,7 +20,7 @@ #end #end // - setup the default java.util.Date.toString() formatter - java.text.DateFormat dateFormatter = new java.text.SimpleDateFormat("EEE MMM dd hh:mm:ss zzz yyyy"); + final java.text.DateFormat dateFormatter = new java.text.SimpleDateFormat("EEE MMM dd hh:mm:ss zzz yyyy"); dateFormatter.setLenient(true); this.dateTimeFormatters.put(null, dateFormatter); } @@ -111,7 +111,8 @@ /** * Stores any date or time formatters for this form. */ - private final java.util.Map dateTimeFormatters = new java.util.HashMap(); + private final java.util.Map<java.lang.String, java.text.DateFormat> dateTimeFormatters = + new java.util.HashMap<java.lang.String, java.text.DateFormat>(); /** * Gets any date and time formatters (keyed by property name) @@ -119,7 +120,7 @@ * * @return the Map containing any date and time formatters. */ - public java.util.Map getDateTimeFormatters() + public java.util.Map<java.lang.String, java.text.DateFormat> getDateTimeFormatters() { return this.dateTimeFormatters; } |