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-09-29 11:25:30
|
User: walterim Date: 08/09/29 04:25:13 Modified: andromda-jsf2/src/main/resources/templates/jsf2/views/facelets/crud view.xhtml.vsl andromda-jsf2/src/main/resources/templates/jsf2/controllers/crud Controller.java.vsl Log: Better control over the ppr behavior in crud. Revision Changes Path 1.16 +3 -3 cartridges/andromda-jsf2/src/main/resources/templates/jsf2/views/facelets/crud/view.xhtml.vsl Index: view.xhtml.vsl =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-jsf2/src/main/resources/templates/jsf2/views/facelets/crud/view.xhtml.vsl,v retrieving revision 1.15 retrieving revision 1.16 diff -u -w -r1.15 -r1.16 --- view.xhtml.vsl 13 Mar 2008 13:14:13 -0000 1.15 +++ view.xhtml.vsl 29 Sep 2008 11:25:13 -0000 1.16 @@ -151,7 +151,7 @@ <h:panelGroup><tr:image source="/images/space.gif"/></h:panelGroup> </f:facet> <h:panelGroup> - <tr:commandLink id="loadAction" actionListener="#{${manageable.controllerBeanName}.load}" action="${manageable.viewFullPath}" partialSubmit="true" immediate="true"> + <tr:commandLink id="loadAction" actionListener="#{${manageable.controllerBeanName}.load}" partialSubmit="true" immediate="true"> <tr:image source="/skins/#{${preferencesBeanName}.skin}/images/tableLoad.gif" shortDesc="#{messages['action.load']}" inlineStyle="border-style:none" /> <f:param name="${manageable.manageableIdentifier.name}" id="${manageable.manageableIdentifier.name}" value="#{row.${manageable.manageableIdentifier.name}}" /> </tr:commandLink> @@ -262,9 +262,9 @@ <f:facet name="footer"> <tr:panelButtonBar> #if ($manageable.create || !$manageable.update) - <tr:commandButton id="saveAction" text="#{messages['action.save']}" action="#{${manageable.controllerBeanName}.save}" accessKey="#{messages['action.save.access.key']}" /> + <tr:commandButton id="saveAction" text="#{messages['action.save']}" action="#{${manageable.controllerBeanName}.save}" accessKey="#{messages['action.save.access.key']}" partialSubmit="true"/> #if ($manageable.create) - <tr:commandButton id="saveAndNewAction" text="#{messages['action.saveAndNew']}" action="#{${manageable.controllerBeanName}.saveAndNew}" accessKey="#{messages['action.saveAndNew.access.key']}" rendered="#{empty ${formName}.${manageable.manageableIdentifier.name}}"/> + <tr:commandButton id="saveAndNewAction" text="#{messages['action.saveAndNew']}" action="#{${manageable.controllerBeanName}.saveAndNew}" accessKey="#{messages['action.saveAndNew.access.key']}" rendered="#{empty ${formName}.${manageable.manageableIdentifier.name}}" partialSubmit="true"/> #end <tr:commandButton id="cancelAction" text="#{messages['action.cancel']}" action="#{${manageable.controllerBeanName}.cancel}" accessKey="#{messages['action.cancel.access.key']}" immediate="true" partialSubmit="true" /> #end 1.21 +87 -20 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.20 retrieving revision 1.21 diff -u -w -r1.20 -r1.21 --- Controller.java.vsl 11 Aug 2008 18:59:17 -0000 1.20 +++ Controller.java.vsl 29 Sep 2008 11:25:13 -0000 1.21 @@ -6,7 +6,8 @@ { private static final org.apache.commons.logging.Log logger = org.apache.commons.logging.LogFactory.getLog(${manageable.controllerName}.class); - public String init(){ + public String init() + { final ${managedBeansPackage}.AdfFacesContextWrapper contextWrapper = new ${managedBeansPackage}.AdfFacesContextWrapper(); try { @@ -34,7 +35,9 @@ return "${manageable.viewFullPath}"; } - public void doInit(${manageable.formBeanType} form) throws Exception { + public void doInit(${manageable.formBeanType} form) + throws Exception + { #if ($manageable.preload) final java.util.List list = ${manageable.manageableServiceAccessorCall}.readAll(); @@ -67,7 +70,8 @@ #else #set($idParamClass = $manageable.manageableIdentifier.type.name) #end - public void load(javax.faces.event.ActionEvent event){ + public void load(javax.faces.event.ActionEvent event) + { final ${managedBeansPackage}.AdfFacesContextWrapper contextWrapper = new ${managedBeansPackage}.AdfFacesContextWrapper(); try { @@ -86,6 +90,7 @@ // (no reason to check for presence of messageKey) this.addErrorMessage(${managedBeansPackage}.Messages.get(messageKey, null)); } + resetAllEditableComponentsValues(); } catch (final Throwable throwable) { @@ -94,7 +99,9 @@ } } - public void doLoad(${idParamClass} ${manageable.manageableIdentifier.name}, ${manageable.formBeanType} form) throws Exception { + public void doLoad(${idParamClass} ${manageable.manageableIdentifier.name}, ${manageable.formBeanType} form) + throws Exception + { final ${manageable.valueObjectClassName} vo= ${manageable.manageableServiceAccessorCall}.readById(${manageable.manageableIdentifier.name}); @@ -110,7 +117,8 @@ form.setEditState(true); } - public String cancel(){ + public String cancel() + { final ${managedBeansPackage}.AdfFacesContextWrapper contextWrapper = new ${managedBeansPackage}.AdfFacesContextWrapper(); try { @@ -135,15 +143,20 @@ logger.error(throwable); this.addExceptionMessage(throwable); } + + resetAllEditableComponentsValues(); return null; } - public void doCancel(${manageable.formBeanType} form) throws Exception { + public void doCancel(${manageable.formBeanType} form) + throws Exception + { form.setEditState(false); } #if ($manageable.create) - public String startNew(){ + public String startNew() + { final ${managedBeansPackage}.AdfFacesContextWrapper contextWrapper = new ${managedBeansPackage}.AdfFacesContextWrapper(); try { @@ -169,10 +182,13 @@ this.addExceptionMessage(throwable); } - return "${manageable.viewFullPath}"; + resetAllEditableComponentsValues(); + return null; } - public void doStartNew(${manageable.formBeanType} form) throws Exception { + public void doStartNew(${manageable.formBeanType} form) + throws Exception + { ## set all default attribute values #foreach ($member in $manageable.manageableAttributes) @@ -229,7 +245,8 @@ } #end #if ($manageable.create || $manageable.update) - public String save(){ + public String save() + { final ${managedBeansPackage}.AdfFacesContextWrapper contextWrapper = new ${managedBeansPackage}.AdfFacesContextWrapper(); try { @@ -254,10 +271,14 @@ logger.error(throwable); this.addExceptionMessage(throwable); } + + resetAllEditableComponentsValues(); return null; } - public void doSave(${manageable.formBeanType} form) throws Exception { + public void doSave(${manageable.formBeanType} form) + throws Exception + { #if ($manageable.create) if(form.${manageable.manageableIdentifier.getterName}() == null){ @@ -301,7 +322,8 @@ #end #if ($manageable.create) - public String saveAndNew(){ + public String saveAndNew() + { final ${managedBeansPackage}.AdfFacesContextWrapper contextWrapper = new ${managedBeansPackage}.AdfFacesContextWrapper(); try { @@ -327,11 +349,14 @@ logger.error(throwable); this.addExceptionMessage(throwable); } + + resetAllEditableComponentsValues(); return null; } #end - public String search(){ + public String search() + { final ${managedBeansPackage}.AdfFacesContextWrapper contextWrapper = new ${managedBeansPackage}.AdfFacesContextWrapper(); try { @@ -356,10 +381,14 @@ logger.error(throwable); this.addExceptionMessage(throwable); } + + resetAllEditableComponentsValues(); return null; } - public void doSearch(${manageable.formBeanType} form) throws Exception { + public void doSearch(${manageable.formBeanType} form) + throws Exception + { final java.util.List list; //if all search fields are null, call readAll() @@ -418,7 +447,8 @@ #else #set($idParamClass = $manageable.manageableIdentifier.type.name) #end - public void delete(javax.faces.event.ActionEvent event){ + public void delete(javax.faces.event.ActionEvent event) + { final ${managedBeansPackage}.AdfFacesContextWrapper contextWrapper = new ${managedBeansPackage}.AdfFacesContextWrapper(); try { @@ -437,6 +467,7 @@ // (no reason to check for presence of messageKey) this.addErrorMessage(${managedBeansPackage}.Messages.get(messageKey, null)); } + resetAllEditableComponentsValues(); } catch (final Throwable throwable) { @@ -445,7 +476,9 @@ } } - public void doDelete(${idParamClass} ${manageable.manageableIdentifier.name}, ${manageable.formBeanType} form) throws Exception { + public void doDelete(${idParamClass} ${manageable.manageableIdentifier.name}, ${manageable.formBeanType} form) + throws Exception + { ${manageable.manageableServiceAccessorCall}.delete(new ${idParamClass}[]{${manageable.manageableIdentifier.name}}); doSearch(form); @@ -453,12 +486,14 @@ #end #if ($manageable.maximumListSize > 0) - private void saveMaxResultsWarning() { + private void saveMaxResultsWarning() + { addWarningMessage(${managedBeansPackage}.Messages.get("maximum.results.fetched.warning", new Object[]{String.valueOf("${manageable.maximumListSize}")})); } #end - public void fillAutocomplete(javax.faces.event.ActionEvent event){ + public void fillAutocomplete(javax.faces.event.ActionEvent event) + { final javax.faces.context.FacesContext facesContext = this.getContext(); final java.util.Map parameters = facesContext.getExternalContext().getRequestParameterMap(); final Object fieldValue = parameters.get(this.getParameterValue("searchFieldRequestParamName",event)); @@ -492,7 +527,8 @@ } } - public java.util.Collection<javax.faces.model.SelectItem> getAsSelectItems(){ + public java.util.Collection<javax.faces.model.SelectItem> getAsSelectItems() + { final java.util.Collection<${manageable.valueObjectClassName}> vos; try { vos = (java.util.Collection<${manageable.valueObjectClassName}>)${manageable.manageableServiceAccessorCall}.readAll(); @@ -508,15 +544,46 @@ return result; } + /** + * Returns the manageable form + */ protected ${manageable.formBeanType} getForm() { return (${manageable.formBeanType})this.resolveVariable("${manageable.formBeanName}"); } /** + * Force the component to get its value from the backing bean before rendering + */ + private void resetEditableComponentsValues(javax.faces.component.UIComponent uic) + { + if(uic instanceof javax.faces.component.EditableValueHolder) + { + final javax.faces.component.EditableValueHolder evh=(javax.faces.component.EditableValueHolder)uic; + evh.setValue(null); + evh.setSubmittedValue(null); + evh.setLocalValueSet(false); + evh.setValid(true); + } + for(Object component: uic.getChildren()) + { + resetEditableComponentsValues((javax.faces.component.UIComponent)component); + } + } + + /** + * Force all the editable components to get its values from the backing bean before rendering + */ + private void resetAllEditableComponentsValues() + { + resetEditableComponentsValues(this.getContext().getViewRoot()); + } + + /** * Returns an javax.faces.event.FacesEvent parameter value, from its name */ - protected Object getParameterValue(String parameterName, javax.faces.event.FacesEvent 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; |
From: Walter M. <wal...@us...> - 2008-09-18 12:57:41
|
User: walterim Date: 08/09/18 05:57:51 Modified: andromda-jsf2/src/main/java/org/andromda/cartridges/jsf2/metafacades JSFManageableEntityAttributeLogicImpl.java andromda-jsf2/src/main/uml JSFMetafacadeModel.xml.zip andromda-jsf2/src/main/resources/templates/jsf2/views renderActionFormInput.vm Log: Better handling of associations between manageable and non-manageable associations. Revision Changes Path 1.4 +29 -0 cartridges/andromda-jsf2/src/main/java/org/andromda/cartridges/jsf2/metafacades/JSFManageableEntityAttributeLogicImpl.java Index: JSFManageableEntityAttributeLogicImpl.java =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-jsf2/src/main/java/org/andromda/cartridges/jsf2/metafacades/JSFManageableEntityAttributeLogicImpl.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -w -r1.3 -r1.4 --- JSFManageableEntityAttributeLogicImpl.java 7 Sep 2007 16:42:48 -0000 1.3 +++ JSFManageableEntityAttributeLogicImpl.java 18 Sep 2008 12:57:51 -0000 1.4 @@ -6,6 +6,7 @@ import org.andromda.utils.StringUtilsHelper; import org.andromda.metafacades.uml.ClassifierFacade; import org.andromda.metafacades.uml.ModelElementFacade; +import org.andromda.metafacades.uml.ParameterFacade; import org.apache.commons.lang.ObjectUtils; import org.apache.commons.lang.StringUtils; @@ -562,4 +563,32 @@ return dateFormat; } + + /** + * @see org.andromda.cartridges.jsf2.metafacades.JSFAttribute#getFormPropertyName(org.andromda.metafacades.uml.ParameterFacade) + */ + protected String handleGetFormPropertyName(final ParameterFacade ownerParameter) + { + final StringBuffer propertyName = new StringBuffer(); + if (ownerParameter != null) + { + propertyName.append(ownerParameter.getName()); + propertyName.append('.'); + } + final String name = this.getName(); + if (name != null && name.trim().length() > 0) + { + propertyName.append(name); + } + return propertyName.toString(); + } + + /** + * @see org.andromda.cartridges.jsf2.metafacades.JSFAttribute#getFormPropertyId(java.lang.String) + */ + protected String handleGetFormPropertyId(final ParameterFacade ownerParameter) + { + return StringUtilsHelper.lowerCamelCaseName(this.getFormPropertyName(ownerParameter)); + } + } \ No newline at end of file 1.17 +226 -179 cartridges/andromda-jsf2/src/main/uml/JSFMetafacadeModel.xml.zip <<Binary file>> 1.10 +5 -0 cartridges/andromda-jsf2/src/main/resources/templates/jsf2/views/renderActionFormInput.vm Index: renderActionFormInput.vm =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-jsf2/src/main/resources/templates/jsf2/views/renderActionFormInput.vm,v retrieving revision 1.9 retrieving revision 1.10 diff -u -w -r1.9 -r1.10 --- renderActionFormInput.vm 11 Aug 2008 12:26:18 -0000 1.9 +++ renderActionFormInput.vm 18 Sep 2008 12:57:51 -0000 1.10 @@ -8,8 +8,13 @@ ## #macro(renderActionInput $parameter $ownerParameter) #if ($parameter.backingListName) +#if ($ownerParameter.type.hasStereotype('Entity')) +#set ($propertyId = $parameter.getFormPropertyId($ownerParameter)) +#set ($valuePropertyName = ${parameter.getFormPropertyName($ownerParameter)}) +#else #set ($propertyId = $parameter.name) #set ($valuePropertyName = $parameter.name) +#end #set ($backingListName = $parameter.backingListName) #set ($backingValueName = $parameter.backingValueName) #else |
From: Walter M. <wal...@us...> - 2008-09-18 12:56:43
|
User: walterim Date: 08/09/18 05:56:53 Modified: andromda-jsf2/src/main/resources/META-INF/andromda cartridge.xml andromda-jsf2/src/main/resources/templates/jsf2/configuration web.xml.vsl andromda-jsf2/components pom.xml Removed: andromda-jsf2/src/main/resources/resources/lib/myfaces tomahawk-1.1.7-SNAPSHOT.jar Log: Using Tomahawk 1.1.7 final Revision Changes Path 1.34 +0 -7 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.33 retrieving revision 1.34 diff -u -w -r1.33 -r1.34 --- cartridge.xml 24 Jul 2008 14:38:50 -0000 1.33 +++ cartridge.xml 18 Sep 2008 12:56:51 -0000 1.34 @@ -177,13 +177,6 @@ lastModifiedCheck="true" outputCondition="portlet"/> - <resource - path="resources/lib/myfaces/*.*" - outputPattern="WEB-INF/lib/{0}" - outlet="libraries" - overwrite="true" - lastModifiedCheck="true"/> - <!-- process templates on model elements --> <template path="templates/jsf2/configuration/web.xml.vsl" 1.19 +10 -0 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.18 retrieving revision 1.19 diff -u -w -r1.18 -r1.19 --- web.xml.vsl 4 Jul 2008 12:17:51 -0000 1.18 +++ web.xml.vsl 18 Sep 2008 12:56:53 -0000 1.19 @@ -158,6 +158,16 @@ <param-value>true</param-value> </context-param> + <context-param> + <param-name>org.apache.myfaces.CHECK_EXTENSIONS_FILTER</param-name> + <param-value>false</param-value> + </context-param> + + <context-param> + <param-name>org.apache.myfaces.DISABLE_TOMAHAWK_FACES_CONTEXT_WRAPPER</param-name> + <param-value>true</param-value> + </context-param> + #if ($liferayPortlet) <context-param> <param-name>portlet_properties</param-name> 1.6 +1 -2 cartridges/andromda-jsf2/components/pom.xml Index: pom.xml =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-jsf2/components/pom.xml,v retrieving revision 1.5 retrieving revision 1.6 diff -u -w -r1.5 -r1.6 --- pom.xml 24 Jul 2008 18:07:44 -0000 1.5 +++ pom.xml 18 Sep 2008 12:56:53 -0000 1.6 @@ -23,8 +23,7 @@ <dependency> <groupId>org.apache.myfaces.tomahawk</groupId> <artifactId>tomahawk</artifactId> - <version>1.1.7-SNAPSHOT</version> - <scope>provided</scope> + <version>1.1.7</version> <exclusions> <exclusion> <groupId>commons-collections</groupId> |
From: Chad B. <cwb...@us...> - 2008-08-29 20:27:03
|
User: cwbrandon Date: 08/08/29 13:27:14 Modified: andromda-jsf2/src/main/resources/templates/jsf2/utils FormPopulator.java.vsl Log: don't allow null to be set on primitives Revision Changes Path 1.14 +5 -1 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.13 retrieving revision 1.14 diff -u -w -r1.13 -r1.14 --- FormPopulator.java.vsl 7 Jul 2008 18:21:49 -0000 1.13 +++ FormPopulator.java.vsl 29 Aug 2008 20:27:14 -0000 1.14 @@ -235,8 +235,12 @@ value = org.apache.commons.beanutils.ConvertUtils.convert(propertyAsString, descriptor.getPropertyType()); } } + // - don't attempt to set null on primitive fields + if (value != null || !descriptor.getPropertyType().isPrimitive()) + { org.apache.commons.beanutils.PropertyUtils.setProperty(form, name, value); } + } else { value = property; |
From: Chad B. <cwb...@us...> - 2008-08-27 21:59:34
|
User: cwbrandon Date: 08/08/27 14:59:46 Modified: andromda-jsf2/src/main/resources/templates/jsf2/views/portlet view-table.xhtml.vsl Log: change default scroll images Revision Changes Path 1.11 +6 -6 cartridges/andromda-jsf2/src/main/resources/templates/jsf2/views/portlet/view-table.xhtml.vsl Index: view-table.xhtml.vsl =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-jsf2/src/main/resources/templates/jsf2/views/portlet/view-table.xhtml.vsl,v retrieving revision 1.10 retrieving revision 1.11 diff -u -w -r1.10 -r1.11 --- view-table.xhtml.vsl 25 Apr 2008 19:39:22 -0000 1.10 +++ view-table.xhtml.vsl 27 Aug 2008 21:59:46 -0000 1.11 @@ -22,22 +22,22 @@ paginatorActiveColumnStyle="font-weight:bold;" immediate="true"> <f:facet name="first"> - <t:graphicImage url="/images/arrow-first.gif"/> + |< </f:facet> <f:facet name="last"> - <t:graphicImage url="/images/arrow-last.gif"/> + >| </f:facet> <f:facet name="previous"> - <t:graphicImage url="/images/arrow-previous.gif"/> + < </f:facet> <f:facet name="next"> - <t:graphicImage url="/images/arrow-next.gif"/> + > </f:facet> <f:facet name="fastforward"> - <t:graphicImage url="/images/arrow-ff.gif"/> + >> </f:facet> <f:facet name="fastrewind"> - <t:graphicImage url="/images/arrow-fr.gif"/> + << </f:facet> </t:dataScroller> #if ($table.pageableTable) |
From: Chad B. <cwb...@us...> - 2008-08-27 20:13:10
|
User: cwbrandon Date: 08/08/27 13:13:21 Modified: andromda-jsf2/src/main/java/org/andromda/cartridges/jsf2 JSFUtils.java andromda-jsf2/src/main/resources/templates/jsf2/configuration validator-rules.xml.vsl Log: Make isType work with abstract types, also add double to validator-rules Revision Changes Path 1.8 +30 -8 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.7 retrieving revision 1.8 diff -u -w -r1.7 -r1.8 --- JSFUtils.java 29 Jun 2008 01:56:38 -0000 1.7 +++ JSFUtils.java 27 Aug 2008 20:13:20 -0000 1.8 @@ -352,7 +352,7 @@ */ public static boolean isByte(final ClassifierFacade type) { - return UMLMetafacadeUtils.isType( + return isType( type, JSFProfile.BYTE_TYPE_NAME); } @@ -362,7 +362,7 @@ */ public static boolean isShort(final ClassifierFacade type) { - return UMLMetafacadeUtils.isType( + return isType( type, JSFProfile.SHORT_TYPE_NAME); } @@ -372,7 +372,7 @@ */ public static boolean isInteger(final ClassifierFacade type) { - return UMLMetafacadeUtils.isType( + return isType( type, JSFProfile.INTEGER_TYPE_NAME); } @@ -382,7 +382,7 @@ */ public static boolean isLong(final ClassifierFacade type) { - return UMLMetafacadeUtils.isType( + return isType( type, JSFProfile.LONG_TYPE_NAME); } @@ -392,7 +392,7 @@ */ public static boolean isFloat(final ClassifierFacade type) { - return UMLMetafacadeUtils.isType( + return isType( type, JSFProfile.FLOAT_TYPE_NAME); } @@ -402,11 +402,12 @@ */ public static boolean isDouble(final ClassifierFacade type) { - return UMLMetafacadeUtils.isType( + return isType( type, JSFProfile.DOUBLE_TYPE_NAME); } + /** * @return <code>true</code> if the type of this field is a date, <code>false</code> otherwise */ @@ -420,7 +421,7 @@ */ public static boolean isTime(final ClassifierFacade type) { - return UMLMetafacadeUtils.isType( + return isType( type, JSFProfile.TIME_TYPE_NAME); } @@ -430,11 +431,32 @@ */ public static boolean isUrl(final ClassifierFacade type) { - return UMLMetafacadeUtils.isType( + return isType( type, JSFProfile.URL_TYPE_NAME); } + + private static boolean isType(final ClassifierFacade type, String typeName) + { + boolean isType = UMLMetafacadeUtils.isType( + type, + typeName); + if (!isType) + { + // - handle abstract types that are mapped to java types + if (type.getLanguageMappings() != null) + { + final String javaTypeName = type.getLanguageMappings().getTo(type.getFullyQualifiedName(true)); + if (javaTypeName != null) + { + isType = javaTypeName.replaceAll(".*\\.", "").equalsIgnoreCase(type.getLanguageMappings().getTo(typeName)); + } + } + } + return isType; + } + /** * @return <code>true</code> if the type of this field is a String, <code>false</code> otherwise */ 1.4 +78 -0 cartridges/andromda-jsf2/src/main/resources/templates/jsf2/configuration/validator-rules.xml.vsl Index: validator-rules.xml.vsl =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-jsf2/src/main/resources/templates/jsf2/configuration/validator-rules.xml.vsl,v retrieving revision 1.3 retrieving revision 1.4 diff -u -w -r1.3 -r1.4 --- validator-rules.xml.vsl 17 Sep 2007 17:40:50 -0000 1.3 +++ validator-rules.xml.vsl 27 Aug 2008 20:13:21 -0000 1.4 @@ -583,6 +583,84 @@ </validator> + <validator name="double" + classname="org.andromda.cartridges.jsf.validator.ParameterChecks" + method="validateDouble" + methodParams="javax.faces.context.FacesContext, + java.lang.Object,java.util.Map, + java.util.Collection, + org.apache.commons.validator.ValidatorAction, + org.apache.commons.validator.Field" + depends="" + msg="errors.float" + jsFunctionName="FloatValidations"> + + <javascript><![CDATA[ + function validateFloat(form) { + var bValid = true; + var focusField = null; + var i = 0; + var fields = new Array(); + var formName = form.getAttributeNode("name"); + oFloat = eval('new ' + formName.value + '_FloatValidations()'); + for (x in oFloat) { + var field = form[oFloat[x][0]]; + + if (typeof(field) == 'undefined') { + return true; + } + + if (field.type == 'text' || + field.type == 'textarea' || + field.type == 'select-one' || + field.type == 'radio') { + + var value = ''; + // get field's value + if (field.type == "select-one") { + var si = field.selectedIndex; + if (si >= 0) { + value = field.options[si].value; + } + } else { + value = field.value; + } + + if (value.length > 0) { + // remove '.' before checking digits + var tempArray = value.split('.'); + var joinedString= tempArray.join(''); + + if (!isAllDigits(joinedString)) { + bValid = false; + if (i == 0) { + focusField = field; + } + fields[i++] = oFloat[x][1]; + + } else { + var iValue = parseFloat(value); + if (isNaN(iValue)) { + if (i == 0) { + focusField = field; + } + fields[i++] = oFloat[x][1]; + bValid = false; + } + } + } + } + } + if (fields.length > 0) { + focusField.focus(); + alert(fields.join('\n')); + } + return bValid; + }]]> + </javascript> + + </validator> + <validator name="equal" classname="org.andromda.cartridges.jsf.validator.ParameterChecks" method="validateEqual" |
From: Chad B. <cwb...@us...> - 2008-08-26 17:42:49
|
User: cwbrandon Date: 08/08/26 10:42:59 Modified: andromda-jsf2/src/main/resources/templates/jsf2/forms FormImpl.java.vsl Log: Add back code to always render backing lists for attributes (and add comment about why) Revision Changes Path 1.11 +3 -2 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.10 retrieving revision 1.11 diff -u -w -r1.10 -r1.11 --- FormImpl.java.vsl 4 Aug 2008 16:58:10 -0000 1.10 +++ FormImpl.java.vsl 26 Aug 2008 17:42:59 -0000 1.11 @@ -82,11 +82,12 @@ #end #if (!$field.type.enumeration) #foreach ($attribute in $field.attributes) -#if ($attribute.isSelectable($field) || $attribute.type.enumeration || $attribute.isBackingValueRequired($field)) +## - Chad Brandon - we ALWAYS render the backing list for attributes in the form +## impl (because there are complex conditions where they might not show up and cause +## uncompilable code; if we always render, we don't need to figure out what they are) #renderBackingListImplSupport($attribute $field) #end #end -#end #end #if ($action.formResetRequired) |
From: Chad B. <cwb...@us...> - 2008-08-22 15:47:55
|
User: cwbrandon Date: 08/08/22 08:48:02 Modified: andromda-jsf2/src/main/resources/templates/jsf2/flow/portlet PortletPhaseListener.java.vsl Log: fix error when no use cases present in model Revision Changes Path 1.19 +4 -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.18 retrieving revision 1.19 diff -u -w -r1.18 -r1.19 --- PortletPhaseListener.java.vsl 10 Jul 2008 20:15:53 -0000 1.18 +++ PortletPhaseListener.java.vsl 22 Aug 2008 15:48:01 -0000 1.19 @@ -63,6 +63,7 @@ // - make the faces context available to all views ((javax.portlet.PortletRequest)event.getFacesContext().getExternalContext().getRequest()).setAttribute(FACES_CONTEXT, event.getFacesContext()); +#if (!$useCases.empty) #foreach ($role in $useCases.iterator().next().getAllRoles()) #set ($userIsInRoleName = "userIs${stringUtils.upperCamelCaseName($role.name.toLowerCase())}") #set ($specializedRoles = $role.generalizedByActors) @@ -98,6 +99,7 @@ { this.populateView(event, viewId); } +#end } } @@ -117,6 +119,7 @@ final java.lang.Object session = event.getFacesContext().getExternalContext().getSession(false); if (!this.isViewPopulated(session, viewId)) { +#if (!$useCases.empty) #foreach ($view in $useCases.iterator().next().allViews) #if ($view.populatorRequired) #set ($ifClause = "if") @@ -129,6 +132,7 @@ } #end #end +#end this.setCurrentView(session, viewId); } } |
From: Walter M. <wal...@us...> - 2008-08-11 18:59:06
|
User: walterim Date: 08/08/11 11:59:17 Modified: andromda-jsf2/src/main/resources/templates/jsf2/controllers/crud Controller.java.vsl Log: Logging only unhandled exceptions. Revision Changes Path 1.20 +24 -40 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.19 retrieving revision 1.20 diff -u -w -r1.19 -r1.20 --- Controller.java.vsl 29 Jul 2008 20:27:56 -0000 1.19 +++ Controller.java.vsl 11 Aug 2008 18:59:17 -0000 1.20 @@ -21,13 +21,11 @@ catch (final Throwable throwable) { final String messageKey = ${managedBeansPackage}.${patternMatchingExceptionHandler}.instance().handleException(throwable); - if(org.apache.commons.lang.StringUtils.isEmpty(messageKey)){ - throw throwable; - } else { + // - the exception is re-thrown by the exception handler and handled by the catch below if it can't get a messageKey + // (no reason to check for presence of messageKey) this.addErrorMessage(${managedBeansPackage}.Messages.get(messageKey, null)); } } - } catch (final Throwable throwable) { logger.error(throwable); @@ -84,13 +82,11 @@ catch (final Throwable throwable) { final String messageKey = ${managedBeansPackage}.${patternMatchingExceptionHandler}.instance().handleException(throwable); - if(org.apache.commons.lang.StringUtils.isEmpty(messageKey)){ - throw throwable; - } else { + // - the exception is re-thrown by the exception handler and handled by the catch below if it can't get a messageKey + // (no reason to check for presence of messageKey) this.addErrorMessage(${managedBeansPackage}.Messages.get(messageKey, null)); } } - } catch (final Throwable throwable) { logger.error(throwable); @@ -129,13 +125,11 @@ catch (final Throwable throwable) { final String messageKey = ${managedBeansPackage}.${patternMatchingExceptionHandler}.instance().handleException(throwable); - if(org.apache.commons.lang.StringUtils.isEmpty(messageKey)){ - throw throwable; - } else { + // - the exception is re-thrown by the exception handler and handled by the catch below if it can't get a messageKey + // (no reason to check for presence of messageKey) this.addErrorMessage(${managedBeansPackage}.Messages.get(messageKey, null)); } } - } catch (final Throwable throwable) { logger.error(throwable); @@ -164,13 +158,11 @@ catch (final Throwable throwable) { final String messageKey = ${managedBeansPackage}.${patternMatchingExceptionHandler}.instance().handleException(throwable); - if(org.apache.commons.lang.StringUtils.isEmpty(messageKey)){ - throw throwable; - } else { + // - the exception is re-thrown by the exception handler and handled by the catch below if it can't get a messageKey + // (no reason to check for presence of messageKey) this.addErrorMessage(${managedBeansPackage}.Messages.get(messageKey, null)); } } - } catch (final Throwable throwable) { logger.error(throwable); @@ -252,13 +244,11 @@ catch (final Throwable throwable) { final String messageKey = ${managedBeansPackage}.${patternMatchingExceptionHandler}.instance().handleException(throwable); - if(org.apache.commons.lang.StringUtils.isEmpty(messageKey)){ - throw throwable; - } else { + // - the exception is re-thrown by the exception handler and handled by the catch below if it can't get a messageKey + // (no reason to check for presence of messageKey) this.addErrorMessage(${managedBeansPackage}.Messages.get(messageKey, null)); } } - } catch (final Throwable throwable) { logger.error(throwable); @@ -327,13 +317,11 @@ catch (final Throwable throwable) { final String messageKey = ${managedBeansPackage}.${patternMatchingExceptionHandler}.instance().handleException(throwable); - if(org.apache.commons.lang.StringUtils.isEmpty(messageKey)){ - throw throwable; - } else { + // - the exception is re-thrown by the exception handler and handled by the catch below if it can't get a messageKey + // (no reason to check for presence of messageKey) this.addErrorMessage(${managedBeansPackage}.Messages.get(messageKey, null)); } } - } catch (final Throwable throwable) { logger.error(throwable); @@ -358,13 +346,11 @@ catch (final Throwable throwable) { final String messageKey = ${managedBeansPackage}.${patternMatchingExceptionHandler}.instance().handleException(throwable); - if(org.apache.commons.lang.StringUtils.isEmpty(messageKey)){ - throw throwable; - } else { + // - the exception is re-thrown by the exception handler and handled by the catch below if it can't get a messageKey + // (no reason to check for presence of messageKey) this.addErrorMessage(${managedBeansPackage}.Messages.get(messageKey, null)); } } - } catch (final Throwable throwable) { logger.error(throwable); @@ -447,13 +433,11 @@ catch (final Throwable throwable) { final String messageKey = ${managedBeansPackage}.${patternMatchingExceptionHandler}.instance().handleException(throwable); - if(org.apache.commons.lang.StringUtils.isEmpty(messageKey)){ - throw throwable; - } else { + // - the exception is re-thrown by the exception handler and handled by the catch below if it can't get a messageKey + // (no reason to check for presence of messageKey) this.addErrorMessage(${managedBeansPackage}.Messages.get(messageKey, null)); } } - } catch (final Throwable throwable) { logger.error(throwable); |
From: Walter M. <wal...@us...> - 2008-08-11 18:58:48
|
User: walterim Date: 08/08/11 11:58:58 Modified: andromda-jsf2/src/main/resources/templates/jsf2/controllers Controller.java.vsl Log: Logging only unhandled exceptions. Revision Changes Path 1.27 +3 -3 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.26 retrieving revision 1.27 diff -u -w -r1.26 -r1.27 --- Controller.java.vsl 24 Jul 2008 21:05:48 -0000 1.26 +++ Controller.java.vsl 11 Aug 2008 18:58:58 -0000 1.27 @@ -104,8 +104,9 @@ } catch (final Throwable throwable) { - logger.error(throwable); this.setForm("$action.formKey", currentForm, $portlet); + // - set the forward to null so that we stay on the current view + forward = null; try { final String messageKey = ${managedBeansPackage}.${patternMatchingExceptionHandler}.instance().handleException(throwable); @@ -115,8 +116,7 @@ } catch (Throwable exception) { - // - set the forward to null so that we stay on the current view - forward = null; + logger.error(exception); this.addExceptionMessage(exception); } } |
From: Walter M. <wal...@us...> - 2008-08-11 12:26:10
|
User: walterim Date: 08/08/11 05:26:19 Modified: andromda-jsf2/src/main/resources/templates/jsf2/views renderActionFormInput.vm andromda-jsf2/src/main/resources/templates/jsf2/views/portlet renderPortletActionFormInput.vm Log: Removed duplicate quote. Revision Changes Path 1.9 +1 -1 cartridges/andromda-jsf2/src/main/resources/templates/jsf2/views/renderActionFormInput.vm Index: renderActionFormInput.vm =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-jsf2/src/main/resources/templates/jsf2/views/renderActionFormInput.vm,v retrieving revision 1.8 retrieving revision 1.9 diff -u -w -r1.8 -r1.9 --- renderActionFormInput.vm 25 Feb 2008 14:29:54 -0000 1.8 +++ renderActionFormInput.vm 11 Aug 2008 12:26:18 -0000 1.9 @@ -22,7 +22,7 @@ #if (!$parameter.table && !($parameter.inputHidden || $ownerParameter.inputHidden)) #if ($parameter.type.dateType) #if ($parameter.readOnly) - <tr:inputText id="$propertyId" value="#{${formValuePropertyName}}" label="#{messages['$parameter.messageKey']}:" readOnly="true""/> + <tr:inputText id="$propertyId" value="#{${formValuePropertyName}}" label="#{messages['$parameter.messageKey']}:" readOnly="true"/> #else <tr:inputDate id="$propertyId" value="#{${formValuePropertyName}}" label="#{messages['$parameter.messageKey']}:" required="$parameter.required"> <f:convertDateTime pattern="$parameter.format"/> 1.7 +1 -1 cartridges/andromda-jsf2/src/main/resources/templates/jsf2/views/portlet/renderPortletActionFormInput.vm Index: renderPortletActionFormInput.vm =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-jsf2/src/main/resources/templates/jsf2/views/portlet/renderPortletActionFormInput.vm,v retrieving revision 1.6 retrieving revision 1.7 diff -u -w -r1.6 -r1.7 --- renderPortletActionFormInput.vm 6 May 2008 21:55:17 -0000 1.6 +++ renderPortletActionFormInput.vm 11 Aug 2008 12:26:19 -0000 1.7 @@ -23,7 +23,7 @@ <h:outputLabel for="$propertyId" value="#{messages['$parameter.messageKey']}:" /> #if ($parameter.type.dateType) #if ($parameter.readOnly) - <h:inputText id="$propertyId" value="#{${formValuePropertyName}}" readonly="true""/> + <h:inputText id="$propertyId" value="#{${formValuePropertyName}}" readonly="true"/> #else <t:inputCalendar id="$propertyId" value="#{${formValuePropertyName}}" renderAsPopup="true" popupDateFormat="$parameter.format" required="$parameter.required"> <a:convertDateTime pattern="$parameter.format"/> |
From: Walter M. <wal...@us...> - 2008-08-05 17:30:49
|
User: walterim Date: 08/08/05 10:31:00 Modified: andromda-jsf2/src/main/resources/templates/jsf2/converters EnumerationConverter.java.vsl Log: Stopped using properties to get the string value in the conversion. t was a wrong choice. Revision Changes Path 1.5 +14 -7 cartridges/andromda-jsf2/src/main/resources/templates/jsf2/converters/EnumerationConverter.java.vsl Index: EnumerationConverter.java.vsl =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-jsf2/src/main/resources/templates/jsf2/converters/EnumerationConverter.java.vsl,v retrieving revision 1.4 retrieving revision 1.5 diff -u -w -r1.4 -r1.5 --- EnumerationConverter.java.vsl 25 Feb 2008 14:21:24 -0000 1.4 +++ EnumerationConverter.java.vsl 5 Aug 2008 17:30:59 -0000 1.5 @@ -18,7 +18,7 @@ java.lang.Object value) throws javax.faces.convert.ConverterException { - return value != null ? ${managedBeansPackage}.Messages.get("${enumeration.messageKey}."+value.toString(),null) : null; + return (value == null || value.toString().trim().length() == 0) ? "": ((${enumeration.fullyQualifiedName})value).toString(); } /** @@ -33,6 +33,12 @@ #if(${enumeration.literalType.fullyQualifiedName} == "java.lang.String") return value != null && value.trim().length() > 0 ? ${enumeration.fullyQualifiedName}.${enumeration.fromOperationName}(value) : null; #elseif ($enumeration.literalType.primitive) + if(value == null || value.trim().length() == 0) + { + return null; + } + else + { try { #if(${enumeration.literalType.fullyQualifiedName} == "char") char v = value.charAt(0); @@ -44,6 +50,7 @@ } catch (Exception ex) { throw new javax.faces.convert.ConverterException(ex); } + } #else return value != null && value.trim().length() > 0 ? ${enumeration.fullyQualifiedName}.${enumeration.fromOperationName}(new ${enumeration.literalType.fullyQualifiedName}(value)) : null; #end |
From: Walter M. <wal...@us...> - 2008-08-04 16:58:01
|
User: walterim Date: 08/08/04 09:58:11 Modified: andromda-jsf2/src/main/resources/templates/jsf2/forms FormImpl.java.vsl Form.java.vsl Log: Makes the condition to create backinglists follow the same rules. Revision Changes Path 1.10 +2 -0 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.9 retrieving revision 1.10 diff -u -w -r1.9 -r1.10 --- FormImpl.java.vsl 15 Jul 2008 11:44:08 -0000 1.9 +++ FormImpl.java.vsl 4 Aug 2008 16:58:10 -0000 1.10 @@ -82,9 +82,11 @@ #end #if (!$field.type.enumeration) #foreach ($attribute in $field.attributes) +#if ($attribute.isSelectable($field) || $attribute.type.enumeration || $attribute.isBackingValueRequired($field)) #renderBackingListImplSupport($attribute $field) #end #end +#end #end #if ($action.formResetRequired) 1.5 +2 -7 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.4 retrieving revision 1.5 diff -u -w -r1.4 -r1.5 --- Form.java.vsl 15 Jul 2008 11:44:08 -0000 1.4 +++ Form.java.vsl 4 Aug 2008 16:58:10 -0000 1.5 @@ -34,17 +34,12 @@ $field.getDocumentation(" * ") */ public void ${field.setterName}($fieldTypeName $field.name); -#if ( (!$field.complex || $field.type.enumeration) && $field.selectable) +#if ( (!$field.complex && !$field.defaultValuePresent) || $field.type.enumeration) #renderBackingListSupport($field "") #end -#if ($field.backingValueRequired) -#renderBackingValueSupport($field "") -#end #foreach ($attribute in $field.attributes) -#if ($attribute.isSelectable($field)) +#if ($attribute.isSelectable($field) || $attribute.type.enumeration || $attribute.isBackingValueRequired($field)) #renderBackingListSupport($attribute $field) -#elseif ($attribute.isBackingValueRequired($field)) -#renderBackingValueSupport($attribute $field) #end #end #end |
From: Walter M. <wal...@us...> - 2008-07-29 20:27:47
|
User: walterim Date: 08/07/29 13:27:57 Modified: andromda-jsf2/src/main/resources/templates/jsf2/controllers/crud Controller.java.vsl Log: Corrected a fixed class reference Revision Changes Path 1.19 +2 -2 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.18 retrieving revision 1.19 diff -u -w -r1.18 -r1.19 --- Controller.java.vsl 26 Jul 2008 12:10:48 -0000 1.18 +++ Controller.java.vsl 29 Jul 2008 20:27:56 -0000 1.19 @@ -609,8 +609,8 @@ final javax.servlet.http.HttpSession session = this.getSession(false); if (session != null) { - final org.trinityssm.webapp.AdfFacesContextWrapper contextWrapper = - (org.trinityssm.webapp.AdfFacesContextWrapper)session.getAttribute("AndroMDAADFContext"); + final ${managedBeansPackage}.AdfFacesContextWrapper contextWrapper = + (${managedBeansPackage}.AdfFacesContextWrapper)session.getAttribute("AndroMDAADFContext"); adfContext = contextWrapper != null ? contextWrapper.getCurrentInstance() : null; } variable = adfContext != null ? adfContext.getPageFlowScope().get(name) : null; |
From: Walter M. <wal...@us...> - 2008-07-26 12:10:41
|
User: walterim Date: 08/07/26 05:10:50 Modified: andromda-jsf2/src/main/resources/META-INF/andromda 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/uml JSFMetafacadeModel.xml.zip andromda-jsf2/src/main/java/org/andromda/cartridges/jsf2/metafacades JSFManageableEntityLogicImpl.java andromda-jsf2/src/main/resources/templates/jsf2/flow/crud ViewPopulator.java.vsl Log: Get rid off the manageableActionFormKey, since it looks not needed and was leading to errors in jsf messages forwarding. Revision Changes Path 1.6 +0 -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.5 retrieving revision 1.6 diff -u -w -r1.5 -r1.6 --- metafacades.xml 10 Jul 2008 14:59:51 -0000 1.5 +++ metafacades.xml 26 Jul 2008 12:10:48 -0000 1.6 @@ -135,7 +135,6 @@ <stereotype>MANAGEABLE</stereotype> </mapping> <property reference="crudValueObjectSuffix"/> - <property reference="manageableActionFormKey"/> <property reference="defaultTableExportTypes"/> <property reference="viewPopulatorPattern"/> </metafacade> 1.13 +0 -8 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.12 retrieving revision 1.13 diff -u -w -r1.12 -r1.13 --- namespace.xml 10 Jul 2008 14:59:51 -0000 1.12 +++ namespace.xml 26 Jul 2008 12:10:48 -0000 1.13 @@ -80,14 +80,6 @@ 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> 1.18 +31 -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.17 retrieving revision 1.18 diff -u -w -r1.17 -r1.18 --- Controller.java.vsl 21 Jul 2008 22:35:56 -0000 1.17 +++ Controller.java.vsl 26 Jul 2008 12:10:48 -0000 1.18 @@ -14,7 +14,7 @@ try { - contextWrapper.getCurrentInstance().getPageFlowScope().put("${manageable.formKey}", form); + contextWrapper.getCurrentInstance().getPageFlowScope().put("${actionFormKey}", form); this.doInit(form); } @@ -77,7 +77,7 @@ try { - contextWrapper.getCurrentInstance().getPageFlowScope().put("${manageable.formKey}", form); + contextWrapper.getCurrentInstance().getPageFlowScope().put("${actionFormKey}", form); this.doLoad(${idParamClass}.valueOf(((javax.faces.component.UIParameter)event.getComponent().findComponent("${manageable.manageableIdentifier.name}")).getValue().toString()),form); } @@ -122,7 +122,7 @@ try { - contextWrapper.getCurrentInstance().getPageFlowScope().put("${manageable.formKey}", form); + contextWrapper.getCurrentInstance().getPageFlowScope().put("${actionFormKey}", form); this.doCancel(form); } @@ -157,7 +157,7 @@ try { - contextWrapper.getCurrentInstance().getPageFlowScope().put("${manageable.formKey}", form); + contextWrapper.getCurrentInstance().getPageFlowScope().put("${actionFormKey}", form); this.doStartNew(form); } @@ -245,7 +245,7 @@ try { - contextWrapper.getCurrentInstance().getPageFlowScope().put("${manageable.formKey}", form); + contextWrapper.getCurrentInstance().getPageFlowScope().put("${actionFormKey}", form); this.doSave(form); } @@ -319,7 +319,7 @@ try { - contextWrapper.getCurrentInstance().getPageFlowScope().put("${manageable.formKey}", form); + contextWrapper.getCurrentInstance().getPageFlowScope().put("${actionFormKey}", form); this.doSave(form); this.doStartNew(form); @@ -351,7 +351,7 @@ try { - contextWrapper.getCurrentInstance().getPageFlowScope().put("${manageable.formKey}", form); + contextWrapper.getCurrentInstance().getPageFlowScope().put("${actionFormKey}", form); this.doSearch(form); } @@ -440,7 +440,7 @@ try { - contextWrapper.getCurrentInstance().getPageFlowScope().put("${manageable.formKey}", form); + contextWrapper.getCurrentInstance().getPageFlowScope().put("${actionFormKey}", form); this.doDelete(${idParamClass}.valueOf(((javax.faces.component.UIParameter)event.getComponent().findComponent("${manageable.manageableIdentifier.name}")).getValue().toString()),form); } @@ -600,8 +600,28 @@ */ protected java.lang.Object resolveVariable(final String name) { + org.apache.myfaces.trinidad.context.RequestContext adfContext = org.apache.myfaces.trinidad.context.RequestContext.getCurrentInstance(); + Object variable = adfContext.getPageFlowScope().get(name); + // - if we couldn't get the variable from the regular ADF context, see if + // the session contains an ADF context with the variable + if (variable == null) + { + final javax.servlet.http.HttpSession session = this.getSession(false); + if (session != null) + { + final org.trinityssm.webapp.AdfFacesContextWrapper contextWrapper = + (org.trinityssm.webapp.AdfFacesContextWrapper)session.getAttribute("AndroMDAADFContext"); + adfContext = contextWrapper != null ? contextWrapper.getCurrentInstance() : null; + } + variable = adfContext != null ? adfContext.getPageFlowScope().get(name) : null; + } + // - finally try resolving it in the standard JSF manner + if (variable == null) + { final javax.faces.context.FacesContext context = this.getContext(); - return context.getApplication().getVariableResolver().resolveVariable(context, name); + variable = context != null ? context.getApplication().getVariableResolver().resolveVariable(context, name) : null; + } + return variable; } /** @@ -677,7 +697,7 @@ { final javax.faces.application.FacesMessage facesMessage = new javax.faces.application.FacesMessage(severity, message, message); final org.apache.myfaces.trinidad.context.RequestContext adfContext = org.apache.myfaces.trinidad.context.RequestContext.getCurrentInstance(); - final Object form = adfContext.getPageFlowScope().get("$actionFormKey"); + final Object form = adfContext.getPageFlowScope().get("${actionFormKey}"); if (form != null) { try 1.6 +0 -5 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.5 retrieving revision 1.6 diff -u -w -r1.5 -r1.6 --- JSFGlobals.java 10 Jul 2008 14:59:52 -0000 1.5 +++ JSFGlobals.java 26 Jul 2008 12:10:49 -0000 1.6 @@ -14,11 +14,6 @@ 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. */ public static final String PROPERTY_DEFAULT_TABLE_EXPORT_TYPES = "defaultTableExportTypes"; 1.16 +190 -184 cartridges/andromda-jsf2/src/main/uml/JSFMetafacadeModel.xml.zip <<Binary file>> 1.9 +0 -10 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.8 retrieving revision 1.9 diff -u -w -r1.8 -r1.9 --- JSFManageableEntityLogicImpl.java 10 Jul 2008 14:59:52 -0000 1.8 +++ JSFManageableEntityLogicImpl.java 26 Jul 2008 12:10:50 -0000 1.9 @@ -368,16 +368,6 @@ } /** - * @see org.andromda.cartridges.jsf2.metafacades.JSFManageableEntity#getFormKey() - */ - protected java.lang.String handleGetFormKey() - { - final Object formKeyValue = this.findTaggedValue(JSFProfile.TAGGEDVALUE_ACTION_FORM_KEY); - return formKeyValue == null ? ObjectUtils.toString(this.getConfiguredProperty(JSFGlobals.CRUD_ACTION_FORM_KEY)) - : String.valueOf(formKeyValue); - } - - /** * @see org.andromda.cartridges.jsf2.metafacades.JSFManageableEntity#getViewFullPath() */ protected java.lang.String handleGetViewFullPath() 1.5 +1 -1 cartridges/andromda-jsf2/src/main/resources/templates/jsf2/flow/crud/ViewPopulator.java.vsl Index: ViewPopulator.java.vsl =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-jsf2/src/main/resources/templates/jsf2/flow/crud/ViewPopulator.java.vsl,v retrieving revision 1.4 retrieving revision 1.5 diff -u -w -r1.4 -r1.5 --- ViewPopulator.java.vsl 8 Apr 2008 16:29:07 -0000 1.4 +++ ViewPopulator.java.vsl 26 Jul 2008 12:10:50 -0000 1.5 @@ -68,7 +68,7 @@ org.apache.myfaces.trinidad.context.RequestContext adfContext = org.apache.myfaces.trinidad.context.RequestContext.getCurrentInstance(); final javax.faces.el.VariableResolver variableResolver = facesContext.getApplication().getVariableResolver(); - form = adfContext.getPageFlowScope().get("$manageable.formKey"); + form = adfContext.getPageFlowScope().get("$actionFormKey"); #if ($formSerialization) final javax.servlet.http.HttpSession session = ((javax.servlet.http.HttpServletRequest)request).getSession(); |
From: Chad B. <cwb...@us...> - 2008-07-24 21:05:38
|
User: cwbrandon Date: 08/07/24 14:05:48 Modified: andromda-jsf2/src/main/resources/templates/jsf2/controllers Controller.java.vsl Log: add missing indent Revision Changes Path 1.26 +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.25 retrieving revision 1.26 diff -u -w -r1.25 -r1.26 --- Controller.java.vsl 24 Jul 2008 21:03:44 -0000 1.25 +++ Controller.java.vsl 24 Jul 2008 21:05:48 -0000 1.26 @@ -84,7 +84,7 @@ ${indent}if (messageSeverity != null && javax.faces.application.FacesMessage.SEVERITY_ERROR.getOrdinal() <= messageSeverity.getOrdinal()) ${indent}{ #if ($formPopulationOperationRequired) - // - copy any messages to the 'currentForm' + ${indent}// - copy any messages to the 'currentForm' ${indent}org.apache.commons.beanutils.PropertyUtils.setProperty(currentForm, ${indent}"$formMessagesProperty", org.apache.commons.beanutils.PropertyUtils.getProperty(form, "$formMessagesProperty")); #end |
From: Chad B. <cwb...@us...> - 2008-07-24 21:03:34
|
User: cwbrandon Date: 08/07/24 14:03:44 Modified: andromda-jsf2/src/main/resources/templates/jsf2/utils JsfUtils.java.vsl andromda-jsf2/src/main/resources/templates/jsf2/controllers Controller.java.vsl Log: Add ability to prevent more than one execution of an action upon either refreshs or multiple clicks (only enabled for portlets at this point). Revision Changes Path 1.8 +37 -0 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.7 retrieving revision 1.8 diff -u -w -r1.7 -r1.8 --- JsfUtils.java.vsl 1 Jul 2008 15:42:41 -0000 1.7 +++ JsfUtils.java.vsl 24 Jul 2008 21:03:44 -0000 1.8 @@ -342,6 +342,43 @@ } /** + * Finds the command that uses the action method on the given component. + * + * @param component the component from which to start the search. + * @param actionMethod the action method (i.e. controller.myMethod) + * @return the component or null of not found. + */ + public static javax.faces.component.UICommand findCommand(final javax.faces.component.UIComponent component, final String actionMethod) + { + javax.faces.component.UICommand found = null; + if (component instanceof javax.faces.component.UICommand) + { + final javax.faces.el.MethodBinding action = ((javax.faces.component.UICommand)component).getAction(); + if (action != null) + { + final String methodName = action.getExpressionString() != null ? action.getExpressionString().replaceAll(".\\{|\\}", "") : null; + if (actionMethod.equals(methodName)) + { + found = (javax.faces.component.UICommand)component; + } + } + } + if (found == null && component != null) + { + for (final java.util.Iterator iterator = component.getFacetsAndChildren(); iterator.hasNext();) + { + final javax.faces.component.UIComponent childComponent = (javax.faces.component.UIComponent)iterator.next(); + found = findCommand(childComponent, actionMethod); + if (found != null) + { + break; + } + } + } + return found; + } + + /** * 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 1.25 +136 -44 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.24 retrieving revision 1.25 diff -u -w -r1.24 -r1.25 --- Controller.java.vsl 22 Jul 2008 16:08:17 -0000 1.24 +++ Controller.java.vsl 24 Jul 2008 21:03:44 -0000 1.25 @@ -53,37 +53,51 @@ #if ($formPopulationOperationRequired) final $action.fullyQualifiedFormImplementationName form = this.$action.formImplementationGetter; - - // - pass any properties from the previous form along - ${managedBeansPackage}.${formPopulatorName}.populateForm(currentForm, form); - // - populate the form with any event attributes that may match - // IMPORTANT: it isn't possible to automatically populate any property named "id" since that - // 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(), false); - // - populate the form with any request parameters that may match - ${managedBeansPackage}.${formPopulatorName}.populateFormFromPropertyMap( - form, form.getDateTimeFormatters(), this.getContext().getExternalContext().getRequestParameterMap()); -#end - try - { -#if (!$action.formFields.empty) this.setForm("$action.formKey", form, true); #end - forward = #processTransition($action) - final javax.faces.application.FacesMessage.Severity messageSeverity = this.getMaximumMessageSeverity(); - if (messageSeverity != null && javax.faces.application.FacesMessage.SEVERITY_ERROR.getOrdinal() <= messageSeverity.getOrdinal()) +## - For now we'll just have the transaction checking in portlets (might be worth while to add to standalone at some point) +#set($indent = "") +#if ($portlet) +#set($indent = " ") + if (this.isTransactionValid("${controller.beanName}.${action.triggerName}")) { +#end +#if ($formPopulationOperationRequired) + ${indent}// - pass any properties from the previous form along + ${indent}${managedBeansPackage}.${formPopulatorName}.populateForm(currentForm, form); + ${indent}// - populate the form with any event attributes that may match + ${indent}// IMPORTANT: it isn't possible to automatically populate any property named "id" since that + ${indent}// is a reserved name in JSF (the id of a component), therefore we have to unfortunately ignore any availble "id" attribute + ${indent}${managedBeansPackage}.${formPopulatorName}.populateFormFromPropertyMap( + ${indent}form, form.getDateTimeFormatters(), (java.util.Map)this.getRequestAttribute(ACTION_EVENT_ATTRIBUTES), new String[] {"id"}); + ${indent}// - populate the form with any request attributes that may match + ${indent}${managedBeansPackage}.${formPopulatorName}.populateFormFromRequestAttributes(form, form.getDateTimeFormatters(), false); + ${indent}// - populate the form with any request parameters that may match + ${indent}${managedBeansPackage}.${formPopulatorName}.populateFormFromPropertyMap( + ${indent}form, form.getDateTimeFormatters(), this.getContext().getExternalContext().getRequestParameterMap()); +#end + ${indent}forward = #processTransition($action) +#if ($portlet) + ${indent}this.setLastForward(forward); +#end + ${indent}final javax.faces.application.FacesMessage.Severity messageSeverity = this.getMaximumMessageSeverity(); + ${indent}if (messageSeverity != null && javax.faces.application.FacesMessage.SEVERITY_ERROR.getOrdinal() <= messageSeverity.getOrdinal()) + ${indent}{ #if ($formPopulationOperationRequired) // - copy any messages to the 'currentForm' - org.apache.commons.beanutils.PropertyUtils.setProperty(currentForm, - "$formMessagesProperty", org.apache.commons.beanutils.PropertyUtils.getProperty(form, "$formMessagesProperty")); + ${indent}org.apache.commons.beanutils.PropertyUtils.setProperty(currentForm, + ${indent}"$formMessagesProperty", org.apache.commons.beanutils.PropertyUtils.getProperty(form, "$formMessagesProperty")); #end - this.setForm("$action.formKey", currentForm, $portlet); - } + ${indent}this.setForm("$action.formKey", currentForm, $portlet); + ${indent}} #saveMessages($action " ") +#if ($portlet) + } + else + { + forward = this.getLastForward(); + } +#end #if (!$action.formFields.empty && $action.formResetRequired) form.reset(); #end @@ -92,24 +106,19 @@ { logger.error(throwable); this.setForm("$action.formKey", currentForm, $portlet); - final String messageKey = ${managedBeansPackage}.${patternMatchingExceptionHandler}.instance().handleException(throwable); - if(org.apache.commons.lang.StringUtils.isEmpty(messageKey)) - { - throw throwable; - } - else + try { + final String messageKey = ${managedBeansPackage}.${patternMatchingExceptionHandler}.instance().handleException(throwable); + // - the exception is re-thrown by the exception handler and handled by the catch below if it can't get a messageKey + // (no reason to check for presence of messageKey) this.addErrorMessage(${managedBeansPackage}.Messages.get(messageKey, null)); } - } - } - catch (final Throwable throwable) + catch (Throwable exception) { - this.setForm("$action.formKey", currentForm, $portlet); - this.addExceptionMessage(throwable); // - set the forward to null so that we stay on the current view forward = null; - logger.error(throwable); + this.addExceptionMessage(exception); + } } return forward; #end @@ -734,5 +743,88 @@ this.setPortletMode(javax.portlet.PortletMode.HELP); return "${controller.useCase.portletHelpForwardName}"; } + + /** + * Indicates whether or not the current transaction is valid (i.e. checks + * that the transaction token - if available - is different than what is stored + * for the last transaction token). + * @param actionName the action name. + * @return whether or not transaction is valid + */ + protected boolean isTransactionValid(final String actionName) + { + boolean valid = true; + final String transactionTokeName = this.getTransactionTokenName(); + if (transactionTokeName != null) + { + final javax.faces.component.UIComponent command = ${managedBeansPackage}.JsfUtils.findCommand( + javax.faces.context.FacesContext.getCurrentInstance().getViewRoot(), actionName); + final String currentToken = command != null ? (String)command.getAttributes().get(transactionTokeName) : null; + if (currentToken != null) + { + final String lastToken = (String)this.getSessionAttribute( + transactionTokeName); + valid = !currentToken.equals(lastToken); + if (valid) + { + this.setSessionAttribute( + transactionTokeName, currentToken); + } + } + } + return valid; + } + + /** + * Gets the name of the attribute that stores the transaction token. + * + * @return the name of the transaction token or null if not available. + */ + protected String getTransactionTokenName() + { + String transactionTokenName = null; + try + { + final Class transactionTokenClass = Thread.currentThread().getContextClassLoader().loadClass( + "org.andromda.cartridges.jsf2.component.TransactionToken"); + transactionTokenName = (String)transactionTokenClass.getField("TRANSACTION_TOKEN").get(null); + } + catch (Exception exception) + { + if (logger.isDebugEnabled()) + { + logger.debug(exception); + } + } + return transactionTokenName; + } + + /** + * The variable that stores the last forward. + */ + private static final String LAST_FORWARD = "AndroMDA_LastForward"; + + /** + * Gets the current value of the last forward. + * + * @return the last forward. + */ + private String getLastForward() + { + return (String)this.getSessionAttribute(LAST_FORWARD); + } + + /** + * Sets the current value of the last forward. + * + * @param forward the last forward + */ + private void setLastForward(String forward) + { + if (forward != null) + { + this.setSessionAttribute(LAST_FORWARD, forward); + } + } #end } \ No newline at end of file |
From: Chad B. <cwb...@us...> - 2008-07-24 18:08:11
|
User: cwbrandon Date: 08/07/24 11:08:21 Modified: andromda-jsf2/components/src/main/java/org/andromda/cartridges/jsf2/component TransactionToken.java Log: add missing javadoc Revision Changes Path 1.2 +4 -0 cartridges/andromda-jsf2/components/src/main/java/org/andromda/cartridges/jsf2/component/TransactionToken.java Index: TransactionToken.java =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-jsf2/components/src/main/java/org/andromda/cartridges/jsf2/component/TransactionToken.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -w -r1.1 -r1.2 --- TransactionToken.java 24 Jul 2008 18:07:43 -0000 1.1 +++ TransactionToken.java 24 Jul 2008 18:08:21 -0000 1.2 @@ -10,7 +10,11 @@ public class TransactionToken extends UIComponentBase { + /** + * The name of the attribute that stores the action transaction token. + */ public static final String TRANSACTION_TOKEN = "AndroMDA_Transaction_Token"; + private static final String RENDERER_TYPE = "org.andromda.cartridges.jsf2.TransactionToken"; public TransactionToken() |
From: Chad B. <cwb...@us...> - 2008-07-24 18:07:37
|
User: cwbrandon Date: 08/07/24 11:07:44 Modified: andromda-jsf2/components pom.xml Added: andromda-jsf2/components/src/main/resources/META-INF faces-config.xml andromda.taglib.xml andromda-jsf2/components/src/main/java/org/andromda/cartridges/jsf2/renderkit TransactionTokenRenderer.java andromda-jsf2/components/src/main/java/org/andromda/cartridges/jsf2/component TransactionToken.java Log: Add TransactionToken component that we an use for preventing multi submits of the same action either or refreshes or when a button is clicked twice Revision Changes Path 1.3 +7 -77 cartridges/andromda-jsf2/components/src/main/resources/META-INF/faces-config.xml 1.1 cartridges/andromda-jsf2/components/src/main/resources/META-INF/andromda.taglib.xml Index: andromda.taglib.xml =================================================================== <?xml version="1.0"?> <!DOCTYPE facelet-taglib PUBLIC "-//Sun Microsystems, Inc.//DTD Facelet Taglib 1.0//EN" "http://java.sun.com/dtd/facelet-taglib_1_0.dtd"> <facelet-taglib> <namespace>http://www.andromda.org/cartridges/jsf2</namespace> <tag> <tag-name>transactionToken</tag-name> <component> <component-type>org.andromda.cartridges.jsf2.component.TransactionToken</component-type> <renderer-type>org.andromda.cartridges.jsf2.TransactionToken</renderer-type> </component> </tag> </facelet-taglib> 1.1 cartridges/andromda-jsf2/components/src/main/java/org/andromda/cartridges/jsf2/renderkit/TransactionTokenRenderer.java Index: TransactionTokenRenderer.java =================================================================== package org.andromda.cartridges.jsf2.renderkit; import java.io.IOException; import java.util.UUID; import javax.faces.component.UIComponent; import javax.faces.context.FacesContext; import javax.faces.render.Renderer; import org.andromda.cartridges.jsf2.component.TransactionToken; /** * The transaction token renderer (just adds the transaction token value * as an attribute of the parent component so we can skip multi-submits of the same action). * * @author Chad Brandon */ public class TransactionTokenRenderer extends Renderer { /** * @see javax.faces.render.Renderer#encodeBegin(javax.faces.context.FacesContext, javax.faces.component.UIComponent) */ @SuppressWarnings("unchecked") public void encodeBegin( FacesContext context, UIComponent component) throws IOException { if (component.getParent() != null) { component.getParent().getAttributes().put(TransactionToken.TRANSACTION_TOKEN, UUID.randomUUID().toString()); } } } 1.1 cartridges/andromda-jsf2/components/src/main/java/org/andromda/cartridges/jsf2/component/TransactionToken.java Index: TransactionToken.java =================================================================== package org.andromda.cartridges.jsf2.component; import javax.faces.component.UIComponentBase; /** * The transaction token component, basically just registers its renderer. * * @author Chad Brandon */ public class TransactionToken extends UIComponentBase { public static final String TRANSACTION_TOKEN = "AndroMDA_Transaction_Token"; private static final String RENDERER_TYPE = "org.andromda.cartridges.jsf2.TransactionToken"; public TransactionToken() { super(); this.setRendererType(RENDERER_TYPE); } /** * @see javax.faces.component.UIComponent#getFamily() */ public String getFamily() { return RENDERER_TYPE; } } 1.5 +6 -0 cartridges/andromda-jsf2/components/pom.xml Index: pom.xml =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-jsf2/components/pom.xml,v retrieving revision 1.4 retrieving revision 1.5 diff -u -w -r1.4 -r1.5 --- pom.xml 11 Apr 2008 22:57:12 -0000 1.4 +++ pom.xml 24 Jul 2008 18:07:44 -0000 1.5 @@ -25,6 +25,12 @@ <artifactId>tomahawk</artifactId> <version>1.1.7-SNAPSHOT</version> <scope>provided</scope> + <exclusions> + <exclusion> + <groupId>commons-collections</groupId> + <artifactId>commons-collections</artifactId> + </exclusion> + </exclusions> </dependency> <dependency> <groupId>commons-lang</groupId> |
From: Chad B. <cwb...@us...> - 2008-07-24 14:38:41
|
User: cwbrandon Date: 08/07/24 07:38:51 Modified: andromda-jsf2/src/main/resources/META-INF/andromda cartridge.xml Log: generate phase listener even when we don't have a use case modeled Revision Changes Path 1.33 +1 -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.32 retrieving revision 1.33 diff -u -w -r1.32 -r1.33 --- cartridge.xml 10 Jul 2008 14:59:51 -0000 1.32 +++ cartridge.xml 24 Jul 2008 14:38:50 -0000 1.33 @@ -1152,7 +1152,7 @@ overwrite="true" outputToSingleFile="true" outputCondition="portlet" - outputOnEmptyElements="false"> + outputOnEmptyElements="true"> <modelElements> <modelElement variable="useCases"> <type name="org.andromda.metafacades.uml.FrontEndUseCase"/> |
From: Walter M. <wal...@us...> - 2008-07-22 19:31:28
|
User: walterim Date: 08/07/22 12:31:34 Modified: andromda-jsf2/src/main/resources/templates/jsf2/exception PatternMatchingExceptionHandler.java.vsl Log: Get rid off the fixed name reference Revision Changes Path 1.4 +1 -1 cartridges/andromda-jsf2/src/main/resources/templates/jsf2/exception/PatternMatchingExceptionHandler.java.vsl Index: PatternMatchingExceptionHandler.java.vsl =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-jsf2/src/main/resources/templates/jsf2/exception/PatternMatchingExceptionHandler.java.vsl,v retrieving revision 1.3 retrieving revision 1.4 diff -u -w -r1.3 -r1.4 --- PatternMatchingExceptionHandler.java.vsl 3 Apr 2008 22:21:21 -0000 1.3 +++ PatternMatchingExceptionHandler.java.vsl 22 Jul 2008 19:31:34 -0000 1.4 @@ -29,7 +29,7 @@ * * @return the shared instance */ - public static PatternMatchingExceptionHandler instance() + public static $patternMatchingExceptionHandler instance() { return instance; } |
From: Walter M. <wal...@us...> - 2008-07-22 16:08:19
|
User: walterim Date: 08/07/22 09:08:27 Modified: andromda-jsf2/src/main/resources/templates/jsf2/controllers Controller.java.vsl Log: Avoids a compile error when the form does not need the population. Revision Changes Path 1.24 +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.23 retrieving revision 1.24 diff -u -w -r1.23 -r1.24 --- Controller.java.vsl 21 Jul 2008 22:35:58 -0000 1.23 +++ Controller.java.vsl 22 Jul 2008 16:08:17 -0000 1.24 @@ -76,9 +76,11 @@ final javax.faces.application.FacesMessage.Severity messageSeverity = this.getMaximumMessageSeverity(); if (messageSeverity != null && javax.faces.application.FacesMessage.SEVERITY_ERROR.getOrdinal() <= messageSeverity.getOrdinal()) { +#if ($formPopulationOperationRequired) // - copy any messages to the 'currentForm' org.apache.commons.beanutils.PropertyUtils.setProperty(currentForm, "$formMessagesProperty", org.apache.commons.beanutils.PropertyUtils.getProperty(form, "$formMessagesProperty")); +#end this.setForm("$action.formKey", currentForm, $portlet); } #saveMessages($action " ") |
From: Chad B. <cwb...@us...> - 2008-07-21 22:35:50
|
User: cwbrandon Date: 08/07/21 15:35:58 Modified: andromda-jsf2/src/main/resources/templates/jsf2/controllers/crud Controller.java.vsl andromda-jsf2/src/main/resources/templates/jsf2/flow ViewPopulator.java.vsl andromda-jsf2/src/main/resources/templates/jsf2/controllers Controller.java.vm Controller.java.vsl Log: Get rid of exception checking in populator (was causing problems and wasn't needed anyway). Set currentForm as actionForm when message severity is equal to or greater than ERROR. Revision Changes Path 1.17 +19 -31 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.16 retrieving revision 1.17 diff -u -w -r1.16 -r1.17 --- Controller.java.vsl 15 Jul 2008 11:42:44 -0000 1.16 +++ Controller.java.vsl 21 Jul 2008 22:35:56 -0000 1.17 @@ -6,8 +6,6 @@ { 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(); try @@ -32,7 +30,6 @@ } catch (final Throwable throwable) { - this.setRequestAttribute(CONTROLLER_EXCEPTION, throwable); logger.error(throwable); this.addExceptionMessage(throwable); } @@ -96,7 +93,6 @@ } catch (final Throwable throwable) { - this.setRequestAttribute(CONTROLLER_EXCEPTION, throwable); logger.error(throwable); this.addExceptionMessage(throwable); } @@ -142,7 +138,6 @@ } catch (final Throwable throwable) { - this.setRequestAttribute(CONTROLLER_EXCEPTION, throwable); logger.error(throwable); this.addExceptionMessage(throwable); } @@ -178,7 +173,6 @@ } catch (final Throwable throwable) { - this.setRequestAttribute(CONTROLLER_EXCEPTION, throwable); logger.error(throwable); this.addExceptionMessage(throwable); } @@ -267,7 +261,6 @@ } catch (final Throwable throwable) { - this.setRequestAttribute(CONTROLLER_EXCEPTION, throwable); logger.error(throwable); this.addExceptionMessage(throwable); } @@ -343,7 +336,6 @@ } catch (final Throwable throwable) { - this.setRequestAttribute(CONTROLLER_EXCEPTION, throwable); logger.error(throwable); this.addExceptionMessage(throwable); } @@ -375,7 +367,6 @@ } catch (final Throwable throwable) { - this.setRequestAttribute(CONTROLLER_EXCEPTION, throwable); logger.error(throwable); this.addExceptionMessage(throwable); } @@ -465,7 +456,6 @@ } catch (final Throwable throwable) { - this.setRequestAttribute(CONTROLLER_EXCEPTION, throwable); logger.error(throwable); this.addExceptionMessage(throwable); } @@ -513,7 +503,6 @@ } catch (final Throwable throwable) { - this.setRequestAttribute(CONTROLLER_EXCEPTION, throwable); logger.error(throwable); this.addExceptionMessage(throwable); } @@ -524,7 +513,6 @@ try { vos = (java.util.Collection<${manageable.valueObjectClassName}>)${manageable.manageableServiceAccessorCall}.readAll(); } catch (final Throwable throwable) { - this.setRequestAttribute(CONTROLLER_EXCEPTION, throwable); logger.error(throwable); this.addExceptionMessage(throwable); return null; 1.12 +1 -2 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.11 retrieving revision 1.12 diff -u -w -r1.11 -r1.12 --- ViewPopulator.java.vsl 3 Jul 2008 18:27:17 -0000 1.11 +++ ViewPopulator.java.vsl 21 Jul 2008 22:35:58 -0000 1.12 @@ -156,7 +156,6 @@ try { #if (!$view.formActions.empty) - final boolean override = (($jsfUtils.requestClassName)facesContext.getExternalContext().getRequest()).getAttribute(${view.useCase.controller.name}.CONTROLLER_EXCEPTION) != null; // - populate the forms if (form != null) { @@ -166,7 +165,7 @@ facesContext, "$action.formBeanName"); // - populate the $action.formBeanName with any parameters from the previous form - ${managedBeansPackage}.${formPopulatorName}.populateForm(form, $action.formBeanName, override); + ${managedBeansPackage}.${formPopulatorName}.populateForm(form, $action.formBeanName, false); request.setAttribute("$action.formBeanName", $action.formBeanName); #end } 1.3 +1 -2 cartridges/andromda-jsf2/src/main/resources/templates/jsf2/controllers/Controller.java.vm Index: Controller.java.vm =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-jsf2/src/main/resources/templates/jsf2/controllers/Controller.java.vm,v retrieving revision 1.2 retrieving revision 1.3 diff -u -w -r1.2 -r1.3 --- Controller.java.vm 28 May 2008 16:40:45 -0000 1.2 +++ Controller.java.vm 21 Jul 2008 22:35:58 -0000 1.3 @@ -24,9 +24,8 @@ #set($messagesFullyQualifiedName = "${managedBeansPackage}.${messagesFullyQualifiedName}") #end #if ($transition.successMessagesPresent) -${indent}final javax.faces.application.FacesMessage.Severity messageSeverity = this.getMaximumMessageSeverity(); ${indent}// - only add info messages if we don't have any messages or warnings are the maximum severity -${indent}if (messageSeverity == null || messageSeverity.equals(javax.faces.application.FacesMessage.SEVERITY_WARN)) +${indent}else if (messageSeverity == null || messageSeverity.equals(javax.faces.application.FacesMessage.SEVERITY_WARN)) ${indent}{ #foreach ($message in $transition.successMessages.entrySet()) ${indent} this.addInfoMessage(${messagesFullyQualifiedName}.get("$message.key", (Object[])null)); 1.23 +12 -8 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.22 retrieving revision 1.23 diff -u -w -r1.22 -r1.23 --- Controller.java.vsl 17 Jul 2008 18:43:39 -0000 1.22 +++ Controller.java.vsl 21 Jul 2008 22:35:58 -0000 1.23 @@ -10,8 +10,6 @@ { private static final org.apache.commons.logging.Log logger = org.apache.commons.logging.LogFactory.getLog(${controller.name}.class); - static final String CONTROLLER_EXCEPTION = ${controller.name}.class.getName() + ".exception"; - #foreach ($operation in $controller.operations) /** $operation.getDocumentation(" * ") @@ -75,6 +73,14 @@ this.setForm("$action.formKey", form, true); #end forward = #processTransition($action) + final javax.faces.application.FacesMessage.Severity messageSeverity = this.getMaximumMessageSeverity(); + if (messageSeverity != null && javax.faces.application.FacesMessage.SEVERITY_ERROR.getOrdinal() <= messageSeverity.getOrdinal()) + { + // - copy any messages to the 'currentForm' + org.apache.commons.beanutils.PropertyUtils.setProperty(currentForm, + "$formMessagesProperty", org.apache.commons.beanutils.PropertyUtils.getProperty(form, "$formMessagesProperty")); + this.setForm("$action.formKey", currentForm, $portlet); + } #saveMessages($action " ") #if (!$action.formFields.empty && $action.formResetRequired) form.reset(); @@ -83,8 +89,7 @@ catch (final Throwable throwable) { logger.error(throwable); - this.setRequestAttribute(CONTROLLER_EXCEPTION, throwable); - this.setForm("$action.formKey", currentForm, false); + this.setForm("$action.formKey", currentForm, $portlet); final String messageKey = ${managedBeansPackage}.${patternMatchingExceptionHandler}.instance().handleException(throwable); if(org.apache.commons.lang.StringUtils.isEmpty(messageKey)) { @@ -98,8 +103,7 @@ } catch (final Throwable throwable) { - this.setRequestAttribute(CONTROLLER_EXCEPTION, throwable); - this.setForm("$action.formKey", currentForm, false); + this.setForm("$action.formKey", currentForm, $portlet); this.addExceptionMessage(throwable); // - set the forward to null so that we stay on the current view forward = null; @@ -376,7 +380,7 @@ */ protected void setMessagesTitle(final String messagesTitle) { - final Object form = this.resolveVariable("form"); + final Object form = this.resolveVariable("$actionFormKey"); if (form != null) { try @@ -401,7 +405,7 @@ protected javax.faces.application.FacesMessage.Severity getMaximumMessageSeverity() { javax.faces.application.FacesMessage.Severity maximumSeverity = null; - final Object form = this.resolveVariable("form"); + final Object form = this.resolveVariable("$actionFormKey"); if (form != null) { try |
From: Chad B. <cwb...@us...> - 2008-07-17 18:43:29
|
User: cwbrandon Date: 08/07/17 11:43:39 Modified: andromda-jsf2/src/main/resources/templates/jsf2/controllers Controller.java.vsl Log: Add a couple convience methods for getting the current action form instance within the controller Revision Changes Path 1.22 +33 -2 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.21 retrieving revision 1.22 diff -u -w -r1.21 -r1.22 --- Controller.java.vsl 15 Jul 2008 11:42:44 -0000 1.21 +++ Controller.java.vsl 17 Jul 2008 18:43:39 -0000 1.22 @@ -86,9 +86,12 @@ 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 { + } + else + { this.addErrorMessage(${managedBeansPackage}.Messages.get(messageKey, null)); } } @@ -581,6 +584,34 @@ #end /** + * Retrieves the current action form while making sure the form is of the given + * <code>type</code>. If the action form is found, but not of the given type, null will + * be returned. + * + * @param type the type of form to retrieve. + * @return the found form. + */ + protected Object getCurrentActionForm(final Class type) + { + Object form = this.getCurrentActionForm(); + if (!type.isInstance(form)) + { + form = null; + } + return form; + } + + /** + * Retrieves the current action form instance. + * + * @return the current action form instance. + */ + protected Object getCurrentActionForm() + { + return this.resolveVariable("$actionFormKey"); + } + + /** * The name of the request attribute that stores the attributes from the current action event. */ private static final String ACTION_EVENT_ATTRIBUTES = "actionEventAttributes"; |
From: Walter M. <wal...@us...> - 2008-07-15 11:45:29
|
User: walterim Date: 08/07/15 04:45:38 Modified: andromda-jsf2/src/main/resources/templates/jsf2/forms/crud SearchForm.java.vsl Log: Now the search form contains the identifier attributes, too. Revision Changes Path 1.5 +1 -1 cartridges/andromda-jsf2/src/main/resources/templates/jsf2/forms/crud/SearchForm.java.vsl Index: SearchForm.java.vsl =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-jsf2/src/main/resources/templates/jsf2/forms/crud/SearchForm.java.vsl,v retrieving revision 1.4 retrieving revision 1.5 diff -u -w -r1.4 -r1.5 --- SearchForm.java.vsl 7 Mar 2008 16:48:49 -0000 1.4 +++ SearchForm.java.vsl 15 Jul 2008 11:45:38 -0000 1.5 @@ -23,7 +23,7 @@ implements java.io.Serializable { -#foreach ($field in $manageable.manageableSearchAttributes) +#foreach ($field in $manageable.manageableAttributes) #if ($field.type.collectionType) #set ($fieldTypeName = "java.util.List") #else |