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: Chad B. <cwb...@us...> - 2007-09-26 17:59:24
|
User: cwbrandon Date: 07/09/26 10:59:28 Modified: andromda-jsf2/src/main/resources/templates/jsf2/controllers Controller.java.vsl andromda-jsf2/src/main/resources/templates/jsf2/utils FormPopulator.java.vsl Log: add ability to ignore population of id attribute Revision Changes Path 1.6 +3 -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.5 retrieving revision 1.6 diff -u -w -r1.5 -r1.6 --- Controller.java.vsl 26 Sep 2007 15:46:03 -0000 1.5 +++ Controller.java.vsl 26 Sep 2007 17:59:27 -0000 1.6 @@ -55,8 +55,10 @@ // - 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.getRequest().getAttribute(ACTION_EVENT_ATTRIBUTES)); + form, form.getDateTimeFormatters(), (java.util.Map)this.getRequest().getAttribute(ACTION_EVENT_ATTRIBUTES), new String[] {"id"}); // - populate the form with any request parameters that may match ${managedBeansPackage}.${formPopulatorName}.populateFormFromPropertyMap( form, form.getDateTimeFormatters(), this.getContext().getExternalContext().getRequestParameterMap()); 1.3 +16 -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.2 retrieving revision 1.3 diff -u -w -r1.2 -r1.3 --- FormPopulator.java.vsl 19 Sep 2007 16:50:53 -0000 1.2 +++ FormPopulator.java.vsl 26 Sep 2007 17:59:28 -0000 1.3 @@ -104,15 +104,30 @@ */ public static final void populateFormFromPropertyMap(final Object form, final java.util.Map formatters, final java.util.Map properties) { + populateFormFromPropertyMap(form, formatters, properties, null); + } + + /** + * 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. + */ + public static final void populateFormFromPropertyMap(final Object form, final java.util.Map formatters, final java.util.Map properties, final String[] ignoreProperties) + { if (properties != null) { try { + final java.util.Collection ignoredProperties = ignoreProperties != null ? java.util.Arrays.asList(ignoreProperties) : java.util.Collections.EMPTY_LIST; final java.util.Map formProperties = org.apache.commons.beanutils.PropertyUtils.describe(form); for (final java.util.Iterator iterator = formProperties.keySet().iterator(); iterator.hasNext();) { final String name = (String)iterator.next(); - if (org.apache.commons.beanutils.PropertyUtils.isWriteable(form, name)) + if (org.apache.commons.beanutils.PropertyUtils.isWriteable(form, name) && !ignoredProperties.contains(name)) { final java.beans.PropertyDescriptor descriptor = org.apache.commons.beanutils.PropertyUtils.getPropertyDescriptor(form, name); |
From: Chad B. <cwb...@us...> - 2007-09-26 16:11:42
|
User: cwbrandon Date: 07/09/26 09:11:45 Modified: andromda-jsf2/src/main/resources/templates/jsf2/views/jsp/includes view-table.jspf.vsl andromda-jsf2/src/main/resources/templates/jsf2/views/facelets view-table.xhtml.vsl Removed: andromda-jsf2/src/main/resources/resources/lib/trinidad trinidad-impl-1.0.2-SNAPSHOT.jar trinidad-api-1.0.2-SNAPSHOT.jar Log: couple minor fixes regarding commandLinks and commandButtons on tables (also remove trinidad jars since 1.0.2 was released) Revision Changes Path 1.3 +14 -9 cartridges/andromda-jsf2/src/main/resources/templates/jsf2/views/jsp/includes/view-table.jspf.vsl Index: view-table.jspf.vsl =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-jsf2/src/main/resources/templates/jsf2/views/jsp/includes/view-table.jspf.vsl,v retrieving revision 1.2 retrieving revision 1.3 diff -u -w -r1.2 -r1.3 --- view-table.jspf.vsl 19 Jul 2007 18:09:31 -0000 1.2 +++ view-table.jspf.vsl 26 Sep 2007 16:11:45 -0000 1.3 @@ -1,14 +1,19 @@ ## ## This macro renders the <f:param> elements for a command link ## -#macro (renderTableCommandLinkParameters) +#macro (renderTableCommandLinkParameters $attribute) #foreach ($parameter in $action.parameters) #if ($table.tableColumnNames.contains($parameter.name) || $table.tableAttributeNames.contains($parameter.name)) #set ($parameterValue = "row.${parameter.name}") #else #set ($parameterValue = "$parameter.name") #end - <f:param name="$parameter.name" value="#{${parameterValue}}"/> +#if($attribute) +#set ($elementType = "attribute") +#else +#set ($elementType = "param") +#end + <f:$elementType name="$parameter.name" value="#{${parameterValue}}"/> #end #end <h:form> @@ -28,13 +33,13 @@ #set ($tableColumnActions = $table.getTableColumnActions($columnName)) #if (!$tableColumnActions.empty) #set ($action = $tableColumnActions.iterator().next()) - <tr:commandLink action="#{${action.controller.beanName}.${action.triggerName}}"> + <tr:commandLink action="#{${action.controller.beanName}.${action.triggerName}}" actionListener="#{${action.controller.beanName}.action}"> <tr:outputText value="#{row.${columnName}}"> #if ($column.type.dateType) <a:convertDateTime pattern="$defaultDateFormat"/> #end </tr:outputText> -#renderTableCommandLinkParameters() +#renderTableCommandLinkParameters(false) </tr:commandLink> #else <tr:outputText value="#{row.${columnName}}"> @@ -65,8 +70,8 @@ <h:panelGroup styleClass="actionColumn"><t:graphicImage url="/images/space.gif"/></h:panelGroup> </f:facet> <h:panelGroup styleClass="actionColumn"> - <tr:commandLink text="#{messages['$action.trigger.messageKey']}" action="#{${action.controller.beanName}.${action.triggerName}}"> -#renderTableCommandLinkParameters() + <tr:commandLink text="#{messages['$action.trigger.messageKey']}" action="#{${action.controller.beanName}.${action.triggerName}}" actionListener="#{${action.controller.beanName}.action}"> +#renderTableCommandLinkParameters(false) </tr:commandLink> </h:panelGroup> </tr:column> @@ -80,8 +85,8 @@ <h:panelGroup styleClass="actionColumn"><t:graphicImage url="/images/space.gif"/></h:panelGroup> </f:facet> <h:panelGroup styleClass="actionColumn"> - <tr:commandButton text="#{messages['$action.trigger.messageKey']}" action="#{${action.controller.beanName}.${action.triggerName}}"> -#renderTableCommandLinkParameters() + <tr:commandButton text="#{messages['$action.trigger.messageKey']}" action="#{${action.controller.beanName}.${action.triggerName}}" actionListener="#{${action.controller.beanName}.action}"> +#renderTableCommandLinkParameters(true) </tr:commandButton> </h:panelGroup> </tr:column> 1.5 +11 -6 cartridges/andromda-jsf2/src/main/resources/templates/jsf2/views/facelets/view-table.xhtml.vsl Index: view-table.xhtml.vsl =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-jsf2/src/main/resources/templates/jsf2/views/facelets/view-table.xhtml.vsl,v retrieving revision 1.4 retrieving revision 1.5 diff -u -w -r1.4 -r1.5 --- view-table.xhtml.vsl 19 Sep 2007 16:50:52 -0000 1.4 +++ view-table.xhtml.vsl 26 Sep 2007 16:11:45 -0000 1.5 @@ -1,14 +1,19 @@ ## ## This macro renders the <f:param> elements for a command link ## -#macro (renderTableCommandLinkParameters) +#macro (renderTableCommandLinkParameters $attribute) #foreach ($parameter in $action.parameters) #if ($table.tableColumnNames.contains($parameter.name) || $table.tableAttributeNames.contains($parameter.name)) #set ($parameterValue = "row.${parameter.name}") #else #set ($parameterValue = "$parameter.name") #end - <f:attribute name="$parameter.name" value="#{${parameterValue}}"/> +#if($attribute) +#set ($elementType = "attribute") +#else +#set ($elementType = "param") +#end + <f:$elementType name="$parameter.name" value="#{${parameterValue}}"/> #end #end <html xmlns="http://www.w3.org/1999/xhtml" @@ -37,13 +42,13 @@ #set ($tableColumnActions = $table.getTableColumnActions($columnName)) #if (!$tableColumnActions.empty) #set ($action = $tableColumnActions.iterator().next()) - <tr:commandLink action="#{${action.controller.beanName}.${action.triggerName}}"> + <tr:commandLink action="#{${action.controller.beanName}.${action.triggerName}}" actionListener="#{${action.controller.beanName}.action}"> <tr:outputText value="#{row.${columnName}}"> #if ($column.type.dateType) <a:convertDateTime pattern="$defaultDateFormat"/> #end </tr:outputText> -#renderTableCommandLinkParameters() +#renderTableCommandLinkParameters(false) </tr:commandLink> #else <tr:outputText value="#{row.${columnName}}"> @@ -75,7 +80,7 @@ </f:facet> <h:panelGroup styleClass="actionColumn"> <tr:commandLink text="#{messages['$action.trigger.messageKey']}" action="#{${action.controller.beanName}.${action.triggerName}}" actionListener="#{${action.controller.beanName}.action}"> -#renderTableCommandLinkParameters() +#renderTableCommandLinkParameters(false) </tr:commandLink> </h:panelGroup> </tr:column> @@ -90,7 +95,7 @@ </f:facet> <h:panelGroup styleClass="actionColumn"> <tr:commandButton text="#{messages['$action.trigger.messageKey']}" action="#{${action.controller.beanName}.${action.triggerName}}" actionListener="#{${action.controller.beanName}.action}"> -#renderTableCommandLinkParameters() +#renderTableCommandLinkParameters(true) </tr:commandButton> </h:panelGroup> </tr:column> |
From: Chad B. <cwb...@us...> - 2007-09-26 15:46:03
|
User: cwbrandon Date: 07/09/26 08:46:03 Modified: andromda-jsf2/src/main/resources/templates/jsf2/controllers Controller.java.vsl Log: switch ordering of parameter/attribute population Revision Changes Path 1.5 +3 -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.4 retrieving revision 1.5 diff -u -w -r1.4 -r1.5 --- Controller.java.vsl 19 Sep 2007 16:50:53 -0000 1.4 +++ Controller.java.vsl 26 Sep 2007 15:46:03 -0000 1.5 @@ -54,11 +54,12 @@ // - pass any properties from the previous form along ${managedBeansPackage}.${formPopulatorName}.populateForm(currentForm, form); + // - populate the form with any event attributes that may match + ${managedBeansPackage}.${formPopulatorName}.populateFormFromPropertyMap( + form, form.getDateTimeFormatters(), (java.util.Map)this.getRequest().getAttribute(ACTION_EVENT_ATTRIBUTES)); // - populate the form with any request parameters that may match ${managedBeansPackage}.${formPopulatorName}.populateFormFromPropertyMap( form, form.getDateTimeFormatters(), this.getContext().getExternalContext().getRequestParameterMap()); - ${managedBeansPackage}.${formPopulatorName}.populateFormFromPropertyMap( - form, form.getDateTimeFormatters(), (java.util.Map)this.getRequest().getAttribute(ACTION_EVENT_ATTRIBUTES)); #end try { |
From: Chris M. <cm...@us...> - 2007-09-25 23:34:16
|
User: cmicali Date: 07/09/25 15:47:32 Modified: andromda-cs/src/main/resources/templates/cs ValueObject.vsl Log: - Added XmlInclude for VO inheritance and Clone() method - Fixed issue with dao->dao references Revision Changes Path 1.4 +29 -1 cartridges/andromda-cs/src/main/resources/templates/cs/ValueObject.vsl Index: ValueObject.vsl =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-cs/src/main/resources/templates/cs/ValueObject.vsl,v retrieving revision 1.3 retrieving revision 1.4 diff -u -w -r1.3 -r1.4 --- ValueObject.vsl 15 Aug 2006 22:48:43 -0000 1.3 +++ ValueObject.vsl 25 Sep 2007 22:47:32 -0000 1.4 @@ -4,7 +4,14 @@ // Attention: Generated code! Do not modify by hand! // Generated by: ValueObject.vsl in andromda-cs-cartridge. +#region Using statements + using System; +using System.IO; +using System.Xml.Serialization; +using System.Runtime.Serialization.Formatters.Binary; + +#endregion #if ($stringUtils.isNotBlank($class.packageName)) namespace $class.packageName @@ -14,9 +21,14 @@ $class.getDocumentation(" /// ") /// </summary> [Serializable] +#foreach ($subentity in $class.specializations) + [XmlInclude(typeof(${subentity.name}))] +#end public#if($class.abstract) abstract#end class $class.name #if($class.generalization) - : ${class.generalization.fullyQualifiedName} + : ${class.generalization.fullyQualifiedName} , ICloneable +#else + : ICloneable #end { @@ -114,6 +126,22 @@ #end #endregion + #region ICloneable Implementation + + public#if($class.generalization) new#end object Clone() + { + ${class.name} _clone = default(${class.name}); //initialize to default not null + BinaryFormatter bf = new BinaryFormatter(); //helper to serialize + MemoryStream memStream = new MemoryStream(); + bf.Serialize(memStream, this); + memStream.Flush(); + memStream.Position = 0; + _clone = ((${class.name})bf.Deserialize(memStream)); //this returns the copy of type T + return _clone; + } + + #endregion + // ValueObject.vsl merge-point } |
From: Chris M. <cm...@us...> - 2007-09-25 22:47:33
|
User: cmicali Date: 07/09/25 15:47:36 Modified: andromda-nspring/src/main/resources/templates/nspring NSpringHibernateDaoBase.vsl Log: - Added XmlInclude for VO inheritance and Clone() method - Fixed issue with dao->dao references Revision Changes Path 1.9 +0 -5 cartridges/andromda-nspring/src/main/resources/templates/nspring/NSpringHibernateDaoBase.vsl Index: NSpringHibernateDaoBase.vsl =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-nspring/src/main/resources/templates/nspring/NSpringHibernateDaoBase.vsl,v retrieving revision 1.8 retrieving revision 1.9 diff -u -w -r1.8 -r1.9 --- NSpringHibernateDaoBase.vsl 1 Aug 2007 05:07:05 -0000 1.8 +++ NSpringHibernateDaoBase.vsl 25 Sep 2007 22:47:36 -0000 1.9 @@ -507,11 +507,6 @@ #end } - /// <summary> - /// Performs the core logic for <seealso cref="#${operation.getSignature(false)}"/> - /// </summary> - protected abstract $operation.returnType.fullyQualifiedName $operation.implementationSignature; - #end /// <summary> /// Allows transformation of entities into value objects |
From: Chad B. <cwb...@us...> - 2007-09-19 16:50:51
|
User: cwbrandon Date: 07/09/19 09:50:54 Modified: andromda-jsf2/src/main/resources/templates/jsf2/views/facelets view-table.xhtml.vsl andromda-jsf2/src/main/resources/templates/jsf2/controllers Controller.java.vsl andromda-jsf2/src/main/resources/templates/jsf2/utils FormPopulator.java.vsl Log: use actionListeners to pass attributes on table links (since commandButton's don't work with f:param anymore) Revision Changes Path 1.4 +3 -3 cartridges/andromda-jsf2/src/main/resources/templates/jsf2/views/facelets/view-table.xhtml.vsl Index: view-table.xhtml.vsl =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-jsf2/src/main/resources/templates/jsf2/views/facelets/view-table.xhtml.vsl,v retrieving revision 1.3 retrieving revision 1.4 diff -u -w -r1.3 -r1.4 --- view-table.xhtml.vsl 19 Jul 2007 18:09:30 -0000 1.3 +++ view-table.xhtml.vsl 19 Sep 2007 16:50:52 -0000 1.4 @@ -8,7 +8,7 @@ #else #set ($parameterValue = "$parameter.name") #end - <f:param name="$parameter.name" value="#{${parameterValue}}"/> + <f:attribute name="$parameter.name" value="#{${parameterValue}}"/> #end #end <html xmlns="http://www.w3.org/1999/xhtml" @@ -74,7 +74,7 @@ <h:panelGroup styleClass="actionColumn"><t:graphicImage url="/images/space.gif"/></h:panelGroup> </f:facet> <h:panelGroup styleClass="actionColumn"> - <tr:commandLink text="#{messages['$action.trigger.messageKey']}" action="#{${action.controller.beanName}.${action.triggerName}}"> + <tr:commandLink text="#{messages['$action.trigger.messageKey']}" action="#{${action.controller.beanName}.${action.triggerName}}" actionListener="#{${action.controller.beanName}.action}"> #renderTableCommandLinkParameters() </tr:commandLink> </h:panelGroup> @@ -89,7 +89,7 @@ <h:panelGroup styleClass="actionColumn"><t:graphicImage url="/images/space.gif"/></h:panelGroup> </f:facet> <h:panelGroup styleClass="actionColumn"> - <tr:commandButton text="#{messages['$action.trigger.messageKey']}" action="#{${action.controller.beanName}.${action.triggerName}}"> + <tr:commandButton text="#{messages['$action.trigger.messageKey']}" action="#{${action.controller.beanName}.${action.triggerName}}" actionListener="#{${action.controller.beanName}.action}"> #renderTableCommandLinkParameters() </tr:commandButton> </h:panelGroup> 1.4 +22 -60 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.3 retrieving revision 1.4 diff -u -w -r1.3 -r1.4 --- Controller.java.vsl 31 Aug 2007 15:32:51 -0000 1.3 +++ Controller.java.vsl 19 Sep 2007 16:50:53 -0000 1.4 @@ -52,10 +52,13 @@ final $action.fullyQualifiedFormImplementationName form = this.$action.formImplementationGetter; - // - pass any parameters from the previous form along + // - pass any properties from the previous form along ${managedBeansPackage}.${formPopulatorName}.populateForm(currentForm, form); // - populate the form with any request parameters that may match - this.populateFormFromRequestParameters(form, form.getDateTimeFormatters()); + ${managedBeansPackage}.${formPopulatorName}.populateFormFromPropertyMap( + form, form.getDateTimeFormatters(), this.getContext().getExternalContext().getRequestParameterMap()); + ${managedBeansPackage}.${formPopulatorName}.populateFormFromPropertyMap( + form, form.getDateTimeFormatters(), (java.util.Map)this.getRequest().getAttribute(ACTION_EVENT_ATTRIBUTES)); #end try { @@ -337,63 +340,6 @@ #if ($formPopulationOperationRequired) /** - * Populates the form from the given parameters. If the request parameter 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. - */ - private final void populateFormFromRequestParameters(final Object form, final java.util.Map formatters) - { - try - { - final java.util.Map parameters = this.getContext().getExternalContext().getRequestParameterMap(); - for (final java.util.Iterator iterator = parameters.keySet().iterator(); iterator.hasNext();) - { - final String name = (String)iterator.next(); - if (org.apache.commons.beanutils.PropertyUtils.isWriteable(form, name)) - { - final java.beans.PropertyDescriptor descriptor = - org.apache.commons.beanutils.PropertyUtils.getPropertyDescriptor(form, name); - if (descriptor != null) - { - final String parameter = (String)parameters.get(name); - Object value = null; - // - only convert if the string is not empty - if (parameter != null && parameter.trim().length() > 0) - { - java.text.DateFormat formatter = (java.text.DateFormat)formatters.get(name); - // - if the formatter is available we use that, otherwise we attempt to convert - if (formatter != null) - { - try - { - value = formatter.parse(parameter); - } - catch (java.text.ParseException parseException) - { - // - try the default formatter (handles the default java.util.Date.toString() format) - formatter = (java.text.DateFormat)formatters.get(null); - value = formatter.parse(parameter); - } - } - else - { - value = org.apache.commons.beanutils.ConvertUtils.convert(parameter, descriptor.getPropertyType()); - } - org.apache.commons.beanutils.PropertyUtils.setProperty(form, name, value); - } - } - } - } - } - catch (final Throwable throwable) - { - throw new RuntimeException(throwable); - } - } - - /** * Finds the form (if one is present) on the given <code>component</code> having the given * <code>id</code>. * @@ -547,4 +493,20 @@ } #end + /** + * The name of the request attribute that stores the attributes from the current action event. + */ + private static final String ACTION_EVENT_ATTRIBUTES = "actionEventAttributes"; + + /** + * This method just captures the event attributes and sets them into the request + * so that we can retrieve in controller action operation and use to populate form. + * + * @param event the action event. + */ + public void action(javax.faces.event.ActionEvent event) + { + this.getRequest().setAttribute(ACTION_EVENT_ATTRIBUTES, event.getComponent(). + getAttributes()); + } } 1.2 +65 -6 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.1 retrieving revision 1.2 diff -u -w -r1.1 -r1.2 --- FormPopulator.java.vsl 5 Dec 2006 19:39:21 -0000 1.1 +++ FormPopulator.java.vsl 19 Sep 2007 16:50:53 -0000 1.2 @@ -12,8 +12,7 @@ implements java.io.Serializable { /** - * Populates the form from the given parameters. If the request parameter is null or an empty - * string, then null is placed on the form. + * Copies the properties from the <code>fromForm</code> to the <code>toForm</code>. Only passes not-null values to the toForm. * * @param fromForm the form from which we're populating * @param toForm the form to which we're populating @@ -24,8 +23,7 @@ } /** - * Populates the form from the given parameters. If the request parameter is null or an empty - * string, then null is placed on the form. + * Copies the properties from the <code>fromForm</code> to the <code>toForm</code>. Only passes not-null values to the toForm. * * @param fromForm the form from which we're populating * @param toForm the form to which we're populating @@ -55,7 +53,7 @@ isToFormPropertySet = (java.lang.Boolean)org.apache.commons.beanutils.PropertyUtils.getProperty(toForm, isSetPropertyName); } } - // - only if override is set to true, do we check to see if the from form property has been set + // - only if override is set to true, we check to see if the from form property has been set if (override) { if (org.apache.commons.beanutils.PropertyUtils.isReadable(fromForm, isSetPropertyName)) @@ -95,4 +93,65 @@ } } } + + /** + * 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. + */ + public static final void populateFormFromPropertyMap(final Object form, final java.util.Map formatters, final java.util.Map properties) + { + if (properties != null) + { + try + { + final java.util.Map formProperties = org.apache.commons.beanutils.PropertyUtils.describe(form); + for (final java.util.Iterator iterator = formProperties.keySet().iterator(); iterator.hasNext();) + { + final String name = (String)iterator.next(); + if (org.apache.commons.beanutils.PropertyUtils.isWriteable(form, name)) + { + final java.beans.PropertyDescriptor descriptor = + org.apache.commons.beanutils.PropertyUtils.getPropertyDescriptor(form, name); + if (descriptor != null) + { + final String property = (String)properties.get(name); + // - only convert if the string is not empty + if (property != null && property.trim().length() > 0) + { + Object value = null; + java.text.DateFormat formatter = (java.text.DateFormat)formatters.get(name); + // - if the formatter is available we use that, otherwise we attempt to convert + if (formatter != null) + { + try + { + value = formatter.parse(property); + } + catch (java.text.ParseException parseException) + { + // - try the default formatter (handles the default java.util.Date.toString() format) + formatter = (java.text.DateFormat)formatters.get(null); + value = formatter.parse(property); + } + } + else + { + value = org.apache.commons.beanutils.ConvertUtils.convert(property, descriptor.getPropertyType()); + } + org.apache.commons.beanutils.PropertyUtils.setProperty(form, name, value); + } + } + } + } + } + catch (final Throwable throwable) + { + throw new RuntimeException(throwable); + } + } + } } \ No newline at end of file |
From: Chad B. <cwb...@us...> - 2007-09-17 17:40:53
|
User: cwbrandon Date: 07/09/17 10:40:53 Modified: andromda-jsf2/src/main/resources/templates/jsf2/configuration validator-rules.xml.vsl Log: make sure validateEqual works with tr:form as well as h:form Revision Changes Path 1.3 +12 -1 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.2 retrieving revision 1.3 diff -u -w -r1.2 -r1.3 --- validator-rules.xml.vsl 2 Jul 2007 18:54:59 -0000 1.2 +++ validator-rules.xml.vsl 17 Sep 2007 17:40:50 -0000 1.3 @@ -612,6 +612,17 @@ (value.length > 0) && field.disabled == false) { var equalField = document.getElementById(equalFieldName); + if (!equalField) + { + // - try getting the field the way that trinidad identifies it (it doesn't give the element + // the prefix of the form name like regular JSF forms do). + var formAndFieldName = equalFieldName.split(':'); + var formObject = document.getElementById(formAndFieldName[0]); + if (formObject) + { + equalField = formObject.elements[formAndFieldName[1]]; + } + } if (equalField) { var valid = equalField.value == value; |
From: Walter M. <wal...@us...> - 2007-09-09 11:02:57
|
User: walterim Date: 07/09/09 04:02:58 Modified: andromda-jsf2/src/main/resources/templates/jsf2/converters EnumerationConverter.java.vsl Log: Support to other enumeration types than String Revision Changes Path 1.2 +4 -2 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.1 retrieving revision 1.2 diff -u -w -r1.1 -r1.2 --- EnumerationConverter.java.vsl 5 Dec 2006 19:39:15 -0000 1.1 +++ EnumerationConverter.java.vsl 9 Sep 2007 11:02:58 -0000 1.2 @@ -30,7 +30,9 @@ java.lang.String value) throws javax.faces.convert.ConverterException { -#if ($enumeration.literalType.primitive) +#if(${enumeration.literalType.fullyQualifiedName} == "java.lang.String") + return value != null && value.trim().length() > 0 ? ${enumeration.fullyQualifiedName}.${enumeration.fromOperationName}(value) : null; +#elseif ($enumeration.literalType.primitive) try { #set ($parseSuffix = $stringUtils.capitalize($enumeration.literalType.name)) ${enumeration.literalType.fullyQualifiedName} v = ${enumeration.literalType.wrapperName}.parse${parseSuffix}(value); @@ -39,7 +41,7 @@ throw new javax.faces.convert.ConverterException(ex); } #else - return value != null && value.trim().length() > 0 ? ${enumeration.fullyQualifiedName}.${enumeration.fromOperationName}(value) : null; + return value != null && value.trim().length() > 0 ? ${enumeration.fullyQualifiedName}.${enumeration.fromOperationName}(new ${enumeration.literalType.fullyQualifiedName}(value)) : null; #end } } |
From: Walter M. <wal...@us...> - 2007-09-09 11:02:04
|
User: walterim Date: 07/09/09 04:02:04 Modified: andromda-jsf2/src/main/java/org/andromda/cartridges/jsf2 JSFUtils.java Log: The support to manageable entities was broken. Revision Changes Path 1.5 +4 -0 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.4 retrieving revision 1.5 diff -u -w -r1.4 -r1.5 --- JSFUtils.java 7 Sep 2007 16:42:48 -0000 1.4 +++ JSFUtils.java 9 Sep 2007 11:02:04 -0000 1.5 @@ -779,6 +779,10 @@ { inputFormat = ((JSFParameter)element).getFormat(); } + else if (element instanceof JSFManageableEntityAttribute) + { + inputFormat = ((JSFManageableEntityAttribute)element).getFormat(); + } else { throw new RuntimeException("'element' is an invalid type, it must be either an instance of '" + |
From: Walter M. <wal...@us...> - 2007-09-09 11:01:10
|
User: walterim Date: 07/09/09 04:01:10 Modified: andromda-jsf2/src/main/resources/templates/jsf2/controllers/crud Controller.java.vsl andromda-jsf2/src/main/resources/templates/jsf2/views/facelets/crud view.xhtml.vsl Log: Changes to avoid the population from the request inside the controller. Revision Changes Path 1.9 +28 -93 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.8 retrieving revision 1.9 diff -u -w -r1.8 -r1.9 --- Controller.java.vsl 2 Jul 2007 17:10:14 -0000 1.8 +++ Controller.java.vsl 9 Sep 2007 11:01:06 -0000 1.9 @@ -2,6 +2,9 @@ // license-header java merge-point package $manageable.manageablePackageName; +import javax.faces.component.UIParameter; +import javax.faces.event.ActionEvent; + public class ${manageable.controllerName} implements java.io.Serializable { @@ -20,9 +23,6 @@ { contextWrapper.getCurrentInstance().getPageFlowScope().put("form", form); - // - populate the form with any request parameters that may match - this.populateFormFromRequestParameters(form, form.getDateTimeFormatters()); - this.doInit(form); } catch (final Throwable throwable) @@ -63,7 +63,12 @@ form.setEditState(false); } - public String load(){ +#if ($manageable.manageableIdentifier.type.primitive) +#set($idParamClass = $manageable.manageableIdentifier.type.wrapperName) +#else +#set($idParamClass = $manageable.manageableIdentifier.type.name) +#end + public void load(ActionEvent event){ final org.andromda.presentation.jsf2.AdfFacesContextWrapper contextWrapper = new org.andromda.presentation.jsf2.AdfFacesContextWrapper(); try { @@ -73,10 +78,7 @@ { contextWrapper.getCurrentInstance().getPageFlowScope().put("form", form); - // - populate the form with any request parameters that may match - this.populateFormFromRequestParameters(form, form.getDateTimeFormatters()); - - this.doLoad(form); + this.doLoad(${idParamClass}.valueOf(((UIParameter)event.getComponent().findComponent("${manageable.manageableIdentifier.name}")).getValue().toString()),form); } catch (final Throwable throwable) { @@ -89,15 +91,18 @@ { this.addExceptionMessage(throwable); } - return "${manageable.viewFullPath}"; } - public void doLoad(${manageable.formBeanType} form) throws Exception { - final Object vo= - ${manageable.manageableServiceAccessorCall}.readById(form.${manageable.manageableIdentifier.getterName}()); + public void doLoad(${idParamClass} ${manageable.manageableIdentifier.name}, ${manageable.formBeanType} form) throws Exception { + final ${manageable.valueObjectClassName} vo= + ${manageable.manageableServiceAccessorCall}.readById(${manageable.manageableIdentifier.name}); -## fazer via members - org.apache.commons.beanutils.BeanUtils.copyProperties(form,vo); +#foreach ($member in $manageable.attributes) + form.${member.setterName}(vo.${member.getterName}()); +#end +#foreach ($member in $manageable.manageableAssociationEnds) + form.${member.setterName}(vo.${member.getterName}()); +#end form.setEditState(true); } @@ -112,9 +117,6 @@ { contextWrapper.getCurrentInstance().getPageFlowScope().put("form", form); - // - populate the form with any request parameters that may match - this.populateFormFromRequestParameters(form, form.getDateTimeFormatters()); - this.doBack(form); } catch (final Throwable throwable) @@ -146,9 +148,6 @@ { contextWrapper.getCurrentInstance().getPageFlowScope().put("form", form); - // - populate the form with any request parameters that may match - this.populateFormFromRequestParameters(form, form.getDateTimeFormatters()); - this.doStartNew(form); } catch (final Throwable throwable) @@ -225,9 +224,6 @@ { contextWrapper.getCurrentInstance().getPageFlowScope().put("form", form); - // - populate the form with any request parameters that may match - this.populateFormFromRequestParameters(form, form.getDateTimeFormatters()); - this.doSave(form); } catch (final Throwable throwable) @@ -289,9 +285,6 @@ { contextWrapper.getCurrentInstance().getPageFlowScope().put("form", form); - // - populate the form with any request parameters that may match - this.populateFormFromRequestParameters(form, form.getDateTimeFormatters()); - this.doSearch(form); } catch (final Throwable throwable) @@ -353,7 +346,12 @@ } #if ($manageable.delete) - public String delete(){ +#if ($manageable.manageableIdentifier.type.primitive) +#set($idParamClass = $manageable.manageableIdentifier.type.wrapperName) +#else +#set($idParamClass = $manageable.manageableIdentifier.type.name) +#end + public void delete(ActionEvent event){ final org.andromda.presentation.jsf2.AdfFacesContextWrapper contextWrapper = new org.andromda.presentation.jsf2.AdfFacesContextWrapper(); try { @@ -363,10 +361,7 @@ { contextWrapper.getCurrentInstance().getPageFlowScope().put("form", form); - // - populate the form with any request parameters that may match - this.populateFormFromRequestParameters(form, form.getDateTimeFormatters()); - - this.doDelete(form); + this.doDelete(${idParamClass}.valueOf(((UIParameter)event.getComponent().findComponent("${manageable.manageableIdentifier.name}")).getValue().toString()),form); } catch (final Throwable throwable) { @@ -379,13 +374,11 @@ { this.addExceptionMessage(throwable); } - return null; } - public void doDelete(${manageable.formBeanType} form) throws Exception { - ${manageable.manageableServiceAccessorCall}.delete(new Long[]{form.${manageable.manageableIdentifier.getterName}()}); + public void doDelete(${idParamClass} ${manageable.manageableIdentifier.name}, ${manageable.formBeanType} form) throws Exception { + ${manageable.manageableServiceAccessorCall}.delete(new Long[]{${manageable.manageableIdentifier.name}}); - form.${manageable.manageableIdentifier.setterName}(null); doSearch(form); } @@ -551,62 +544,4 @@ } } } - - /** - * Populates the form from the given parameters. If the request parameter 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. - */ - private final void populateFormFromRequestParameters(final Object form, final java.util.Map formatters) - { - try - { - final java.util.Map parameters = this.getContext().getExternalContext().getRequestParameterMap(); - for (final java.util.Iterator iterator = parameters.keySet().iterator(); iterator.hasNext();) - { - final String name = (String)iterator.next(); - if (org.apache.commons.beanutils.PropertyUtils.isWriteable(form, name)) - { - final java.beans.PropertyDescriptor descriptor = - org.apache.commons.beanutils.PropertyUtils.getPropertyDescriptor(form, name); - if (descriptor != null) - { - final String parameter = (String)parameters.get(name); - Object value = null; - // - only convert if the string is not empty - if (parameter != null && parameter.trim().length() > 0) - { - java.text.DateFormat formatter = (java.text.DateFormat)formatters.get(name); - // - if the formatter is available we use that, otherwise we attempt to convert - if (formatter != null) - { - try - { - value = formatter.parse(parameter); - } - catch (java.text.ParseException parseException) - { - // - try the default formatter (handles the default java.util.Date.toString() format) - formatter = (java.text.DateFormat)formatters.get(null); - value = formatter.parse(parameter); - } - } - else - { - value = org.apache.commons.beanutils.ConvertUtils.convert(parameter, descriptor.getPropertyType()); - } - org.apache.commons.beanutils.PropertyUtils.setProperty(form, name, value); - } - } - } - } - } - catch (final Throwable throwable) - { - throw new RuntimeException(throwable); - } - } - } \ No newline at end of file 1.10 +10 -9 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.9 retrieving revision 1.10 diff -u -w -r1.9 -r1.10 --- view.xhtml.vsl 19 Jul 2007 18:09:32 -0000 1.9 +++ view.xhtml.vsl 9 Sep 2007 11:01:09 -0000 1.10 @@ -126,15 +126,15 @@ <h:panelGroup><t:graphicImage url="/images/space.gif"/></h:panelGroup> </f:facet> <h:panelGroup> - <tr:commandLink action="#{${manageable.controllerBeanName}.load}" > + <tr:commandLink actionListener="#{${manageable.controllerBeanName}.load}" action="${manageable.viewFullPath}" > <t:graphicImage url="/skins/#{${preferencesBeanName}.skin}/images/tableLoad.gif" title="#{messages['action.load']}" border="0"/> - <f:param name="${manageable.manageableIdentifier.name}" value="#{row.${manageable.manageableIdentifier.name}}" /> + <f:param name="${manageable.manageableIdentifier.name}" id="${manageable.manageableIdentifier.name}" value="#{row.${manageable.manageableIdentifier.name}}" /> </tr:commandLink> #if ($manageable.delete) <tr:spacer width="10" height="1"/> - <tr:commandLink action="#{${manageable.controllerBeanName}.delete}"> + <tr:commandLink actionListener="#{${manageable.controllerBeanName}.delete}"> <t:graphicImage url="/skins/#{${preferencesBeanName}.skin}/images/tableDelete.gif" title="#{messages['action.delete']}" border="0"/> - <f:param name="${manageable.manageableIdentifier.name}" value="#{row.${manageable.manageableIdentifier.name}}" /> + <f:param name="${manageable.manageableIdentifier.name}" id="${manageable.manageableIdentifier.name}" value="#{row.${manageable.manageableIdentifier.name}}" /> </tr:commandLink> #end </h:panelGroup> @@ -145,12 +145,13 @@ <f:facet name="header"> <tr:outputText value="#{messages['$member.messageKey']}"/> </f:facet> -#if($member.type.enumeration) - <c:set var="messageKey" value="${member.type.messageKey}.#{row.${member.name}}"/> - <tr:outputText value="#{messages[messageKey]}"> -#else +## TODO: it isn't working +###if($member.type.enumeration) +## <c:set var="messageKey" value="${member.type.messageKey}.#{row.${member.name}}"/> +## <tr:outputText value="#{messages[messageKey]}"> +###else <tr:outputText value="#{row.${member.name}}"> -#end +###end #if ($column.type.dateType) <a:convertDateTime pattern="$defaultDateFormat"/> #end |
From: Chad B. <cwb...@us...> - 2007-09-07 16:51:20
|
User: cwbrandon Date: 07/09/07 09:42:48 Modified: andromda-jsf2/src/main/resources/templates/jsf2/configuration validation.xml.vm andromda-jsf2/src/main/java/org/andromda/cartridges/jsf2/metafacades JSFManageableEntityAttributeLogicImpl.java JSFAttributeLogicImpl.java JSFParameterLogicImpl.java andromda-jsf2/src/main/uml JSFMetafacadeModel.xml.zip andromda-jsf2/src/main/java/org/andromda/cartridges/jsf2 JSFUtils.java Log: Fix generation of validation.xml for complex objects (wasn't using the nested name for the field name) Revision Changes Path 1.3 +6 -1 cartridges/andromda-jsf2/src/main/resources/templates/jsf2/configuration/validation.xml.vm Index: validation.xml.vm =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-jsf2/src/main/resources/templates/jsf2/configuration/validation.xml.vm,v retrieving revision 1.2 retrieving revision 1.3 diff -u -w -r1.2 -r1.3 --- validation.xml.vm 11 Dec 2006 13:43:57 -0000 1.2 +++ validation.xml.vm 7 Sep 2007 16:42:48 -0000 1.3 @@ -22,7 +22,12 @@ #end #end #end -#foreach ($validatorVar in $field.validatorVars) +#if ($ownerParameter.complex) +#set ($validatorVars = $field.getValidatorVars($ownerParameter)) +#else +#set ($validatorVars = $field.validatorVars) +#end +#foreach ($validatorVar in $validatorVars) #set ($varValue = $validatorVar.get(1)) #if ($field.equalValidator) #set ($varValue = "${action.formBeanName}:${varValue}") 1.3 +2 -5 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.2 retrieving revision 1.3 diff -u -w -r1.2 -r1.3 --- JSFManageableEntityAttributeLogicImpl.java 20 Feb 2007 10:12:05 -0000 1.2 +++ JSFManageableEntityAttributeLogicImpl.java 7 Sep 2007 16:42:48 -0000 1.3 @@ -226,7 +226,8 @@ { return JSFUtils.getValidatorVars( ((ModelElementFacade)this.THIS()), - this.getType()); + this.getType(), + null); } /** @@ -561,8 +562,4 @@ return dateFormat; } - - - - } \ No newline at end of file 1.2 +6 -5 cartridges/andromda-jsf2/src/main/java/org/andromda/cartridges/jsf2/metafacades/JSFAttributeLogicImpl.java Index: JSFAttributeLogicImpl.java =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-jsf2/src/main/java/org/andromda/cartridges/jsf2/metafacades/JSFAttributeLogicImpl.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -w -r1.1 -r1.2 --- JSFAttributeLogicImpl.java 5 Dec 2006 19:39:09 -0000 1.1 +++ JSFAttributeLogicImpl.java 7 Sep 2007 16:42:48 -0000 1.2 @@ -393,13 +393,14 @@ } /** - * @see org.andromda.cartridges.jsf2.metafacades.JSFParameter#getValidatorVars() + * @see org.andromda.cartridges.jsf2.metafacades.JSFAttribute#getValidatorVars(JSFParameter) */ - protected java.util.Collection handleGetValidatorVars() + protected Collection handleGetValidatorVars(JSFParameter ownerParameter) { return JSFUtils.getValidatorVars( ((ModelElementFacade)this.THIS()), - this.getType()); + this.getType(), + ownerParameter); } /** 1.2 +6 -5 cartridges/andromda-jsf2/src/main/java/org/andromda/cartridges/jsf2/metafacades/JSFParameterLogicImpl.java Index: JSFParameterLogicImpl.java =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-jsf2/src/main/java/org/andromda/cartridges/jsf2/metafacades/JSFParameterLogicImpl.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -w -r1.1 -r1.2 --- JSFParameterLogicImpl.java 5 Dec 2006 19:39:09 -0000 1.1 +++ JSFParameterLogicImpl.java 7 Sep 2007 16:42:48 -0000 1.2 @@ -842,7 +842,8 @@ { return JSFUtils.getValidatorVars( ((ModelElementFacade)this.THIS()), - this.getType()); + this.getType(), + null); } /** 1.8 +193 -178 cartridges/andromda-jsf2/src/main/uml/JSFMetafacadeModel.xml.zip <<Binary file>> 1.4 +46 -26 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.3 retrieving revision 1.4 diff -u -w -r1.3 -r1.4 --- JSFUtils.java 3 Sep 2007 00:24:31 -0000 1.3 +++ JSFUtils.java 7 Sep 2007 16:42:48 -0000 1.4 @@ -478,6 +478,28 @@ } /** + * Retrieves the "equal" value from the given element (if one is present). + * + * @param element the element from which to retrieve the equal value. + * @param ownerParameter the optional owner parameter (specified if the element is an attribute). + * @return the "equal" value. + */ + public static java.lang.String getEqual(final ModelElementFacade element, final ParameterFacade ownerParameter) + { + String equal = null; + if (element != null) + { + final Object value = element.findTaggedValue(JSFProfile.TAGGEDVALUE_INPUT_EQUAL); + equal = value == null ? null : value.toString(); + if (StringUtils.isNotBlank(equal) && ownerParameter != null) + { + equal = ownerParameter.getName() + StringUtilsHelper.upperCamelCaseName(equal); + } + } + return equal; + } + + /** * Retrieves the "validwhen" value from the given element (if one is present). * * @param element the element from which to retrieve the validwhen value. @@ -691,11 +713,13 @@ * * @param element the element from which to retrieve the variables * @param type the type of the element. + * @param ownerParameter the optional owner parameter (if the element is an attribute for example). * @return the collection of validator variables. */ public static java.util.Collection getValidatorVars( final ModelElementFacade element, - final ClassifierFacade type) + final ClassifierFacade type, + final ParameterFacade ownerParameter) { final Map vars = new LinkedHashMap(); if (element != null && type != null) @@ -755,14 +779,10 @@ { inputFormat = ((JSFParameter)element).getFormat(); } - else if (element instanceof JSFManageableEntityAttribute) - { - inputFormat = ((JSFManageableEntityAttribute)element).getFormat(); - } else { throw new RuntimeException("'element' is an invalid type, it must be either an instance of '" + - JSFAttribute.class.getName() + "' or '" +JSFManageableEntityAttribute.class.getName() + "' or '" + JSFParameter.class.getName() + "'"); + JSFAttribute.class.getName() + "' or '" + JSFParameter.class.getName() + "'"); } if (JSFUtils.isDate(type)) { @@ -798,7 +818,7 @@ Arrays.asList(new Object[] {test, validWhen})); } - final String equal = JSFUtils.getEqual(element); + final String equal = JSFUtils.getEqual(element, ownerParameter); if (equal != null) { final String fieldName = "fieldName"; |
From: Walter M. <wal...@us...> - 2007-09-03 00:24:31
|
User: walterim Date: 07/09/02 17:24:31 Modified: andromda-jsf2/src/main/java/org/andromda/cartridges/jsf2 JSFUtils.java Log: Added support to default dateTime format Revision Changes Path 1.3 +5 -1 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.2 retrieving revision 1.3 diff -u -w -r1.2 -r1.3 --- JSFUtils.java 11 Dec 2006 13:43:58 -0000 1.2 +++ JSFUtils.java 3 Sep 2007 00:24:31 -0000 1.3 @@ -965,7 +965,11 @@ format = JSFUtils.getInputFormat(element); if (format == null) { - if (type.isTimeType()) + if(type.isDateType() && type.isTimeType()) + { + format = defaultDateFormat+" "+defaultTimeFormat; + } + else if (type.isTimeType()) { format = defaultTimeFormat; } |
From: Chad B. <cwb...@us...> - 2007-08-31 16:51:44
|
User: cwbrandon Date: 07/08/31 09:51:45 Modified: andromda-jsf2/src/main/resources/templates/jsf2/views/facelets/layout layout.xhtml.vsl Log: don't display user image unless the remoteUser is available Revision Changes Path 1.12 +1 -1 cartridges/andromda-jsf2/src/main/resources/templates/jsf2/views/facelets/layout/layout.xhtml.vsl Index: layout.xhtml.vsl =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-jsf2/src/main/resources/templates/jsf2/views/facelets/layout/layout.xhtml.vsl,v retrieving revision 1.11 retrieving revision 1.12 diff -u -w -r1.11 -r1.12 --- layout.xhtml.vsl 19 Jul 2007 18:48:31 -0000 1.11 +++ layout.xhtml.vsl 31 Aug 2007 16:51:44 -0000 1.12 @@ -26,7 +26,7 @@ #if ($stringUtils.isNotBlank($securityRealm)) <f:facet name="infoUser"> <tr:panelGroupLayout> - <tr:image source="/images/user.gif"/> + <tr:image source="/images/user.gif" rendered="#{!empty remoteUser}"/> <tr:outputText value=" #{remoteUser}"/> </tr:panelGroupLayout> </f:facet> |
From: Chad B. <cwb...@us...> - 2007-08-31 16:35:21
|
User: cwbrandon Date: 07/08/31 08:32:51 Modified: andromda-jsf2/src/main/resources/templates/jsf2/controllers Controller.java.vsl andromda-jsf2/src/main/resources/templates/jsf2/flow ActionForward.java.vsl Log: imports and unused code cleanup Revision Changes Path 1.3 +16 -16 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.2 retrieving revision 1.3 diff -u -w -r1.2 -r1.3 --- Controller.java.vsl 10 Jun 2007 20:27:17 -0000 1.2 +++ Controller.java.vsl 31 Aug 2007 15:32:51 -0000 1.3 @@ -408,7 +408,7 @@ { for (final java.util.Iterator iterator = component.getFacetsAndChildren(); iterator.hasNext();) { - final Object object = (javax.faces.component.UIComponent)iterator.next(); + final Object object = iterator.next(); if (object instanceof javax.faces.component.UIComponent) { final javax.faces.component.UIComponent uiComponent = (javax.faces.component.UIComponent)object; 1.3 +0 -6 cartridges/andromda-jsf2/src/main/resources/templates/jsf2/flow/ActionForward.java.vsl Index: ActionForward.java.vsl =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-jsf2/src/main/resources/templates/jsf2/flow/ActionForward.java.vsl,v retrieving revision 1.2 retrieving revision 1.3 diff -u -w -r1.2 -r1.3 --- ActionForward.java.vsl 10 Jun 2007 20:11:40 -0000 1.2 +++ ActionForward.java.vsl 31 Aug 2007 15:32:51 -0000 1.3 @@ -4,12 +4,6 @@ import java.io.IOException; -import javax.faces.FactoryFinder; -import javax.faces.context.FacesContext; -import javax.faces.context.FacesContextFactory; -import javax.faces.lifecycle.Lifecycle; -import javax.faces.lifecycle.LifecycleFactory; - import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; |
From: Chad B. <cwb...@us...> - 2007-08-31 16:21:44
|
User: cwbrandon Date: 07/08/31 09:21:43 Modified: andromda-jsf2/src/main/resources/templates/jsf2/flow ActionForward.java.vsl Log: minor improvement Revision Changes Path 1.6 +1 -1 cartridges/andromda-jsf2/src/main/resources/templates/jsf2/flow/ActionForward.java.vsl Index: ActionForward.java.vsl =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-jsf2/src/main/resources/templates/jsf2/flow/ActionForward.java.vsl,v retrieving revision 1.5 retrieving revision 1.6 diff -u -w -r1.5 -r1.6 --- ActionForward.java.vsl 31 Aug 2007 16:21:13 -0000 1.5 +++ ActionForward.java.vsl 31 Aug 2007 16:21:43 -0000 1.6 @@ -40,7 +40,7 @@ #else #set ($useCase = $action) #end - String forwardPath = ${managedBeansPackage}.UseCaseForwards.getPath(controller.${action.controllerAction}()); + final String forwardPath = ${managedBeansPackage}.UseCaseForwards.getPath(controller.${action.controllerAction}()); response.sendRedirect(request.getContextPath() + forwardPath + (request.getQueryString() != null ? "?" + request.getQueryString() : "")); } |
From: Chad B. <cwb...@us...> - 2007-08-31 16:21:11
|
User: cwbrandon Date: 07/08/31 09:21:13 Modified: andromda-jsf2/src/main/resources/templates/jsf2/flow ActionForward.java.vsl Log: remove some unused code Revision Changes Path 1.5 +0 -4 cartridges/andromda-jsf2/src/main/resources/templates/jsf2/flow/ActionForward.java.vsl Index: ActionForward.java.vsl =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-jsf2/src/main/resources/templates/jsf2/flow/ActionForward.java.vsl,v retrieving revision 1.4 retrieving revision 1.5 diff -u -w -r1.4 -r1.5 --- ActionForward.java.vsl 31 Aug 2007 16:20:34 -0000 1.4 +++ ActionForward.java.vsl 31 Aug 2007 16:21:13 -0000 1.5 @@ -40,12 +40,8 @@ #else #set ($useCase = $action) #end -##if (!$useCase.allForwards.empty) String forwardPath = ${managedBeansPackage}.UseCaseForwards.getPath(controller.${action.controllerAction}()); response.sendRedirect(request.getContextPath() + forwardPath + (request.getQueryString() != null ? "?" + request.getQueryString() : "")); -##else - ## controller.${action.controllerAction}(); -##end } /** |
From: Chad B. <cwb...@us...> - 2007-08-31 16:20:33
|
User: cwbrandon Date: 07/08/31 09:20:34 Modified: andromda-jsf2/src/main/resources/templates/jsf2/utils FacesContextUtils.java.vsl andromda-jsf2/src/main/resources/templates/jsf2/flow ActionForward.java.vsl Log: minor cleanup and fixes Revision Changes Path 1.2 +11 -16 cartridges/andromda-jsf2/src/main/resources/templates/jsf2/utils/FacesContextUtils.java.vsl Index: FacesContextUtils.java.vsl =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-jsf2/src/main/resources/templates/jsf2/utils/FacesContextUtils.java.vsl,v retrieving revision 1.1 retrieving revision 1.2 diff -u -w -r1.1 -r1.2 --- FacesContextUtils.java.vsl 5 Dec 2006 19:39:21 -0000 1.1 +++ FacesContextUtils.java.vsl 31 Aug 2007 16:20:33 -0000 1.2 @@ -12,6 +12,7 @@ import javax.servlet.ServletContext; import javax.servlet.ServletRequest; import javax.servlet.ServletResponse; +import javax.servlet.http.HttpServletRequest; /** * Contains utilities for dealing with the FacesContext. @@ -21,23 +22,17 @@ public class $className { /** - * Retrieves the current faces context given the <code>servletContext</code>, <code>request</code>, + * Retrieves the current faces context given the <code>request</code>, * and <code>response</code>. * - * @param servletContext the servlet context. * @param request the ServletRequest instance. * @param response the ServletResponse instance * @return the current faces context. */ public static FacesContext getFacesContext( - final ServletContext servletContext, final ServletRequest request, final ServletResponse response) { - if (servletContext == null) - { - throw new IllegalArgumentException("'servletContext' can not be null"); - } if (request == null) { throw new IllegalArgumentException("'request' can not be null"); @@ -46,6 +41,8 @@ { throw new IllegalArgumentException("'response' can not be null"); } + final HttpServletRequest httpRequest = (HttpServletRequest)request; + final ServletContext servletContext = httpRequest.getSession().getServletContext(); final LifecycleFactory lifecycleFactory = (LifecycleFactory)FactoryFinder.getFactory(FactoryFinder.LIFECYCLE_FACTORY); final Lifecycle lifecycle = lifecycleFactory.getLifecycle(LifecycleFactory.DEFAULT_LIFECYCLE); @@ -65,20 +62,18 @@ /** * Attempts to resolve the variable having the given <code>name</code> from the given - * <code>servletContext</code>, <code>request</code>, and <code>response</code> - * @param servletContext the servlet context. + * <code>request</code>, and <code>response</code> * @param request the ServletRequest instance. * @param response the ServletResponse instance * @param name the name of the variable to resolve. * @return */ public static Object resolveVariable( - final ServletContext servletContext, final ServletRequest request, final ServletResponse response, final String name) { - final FacesContext facesContext = getFacesContext(servletContext,request,response); + final FacesContext facesContext = getFacesContext(request, response); final javax.faces.el.VariableResolver variableResolver = facesContext.getApplication().getVariableResolver(); return variableResolver.resolveVariable( facesContext, 1.4 +6 -6 cartridges/andromda-jsf2/src/main/resources/templates/jsf2/flow/ActionForward.java.vsl Index: ActionForward.java.vsl =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-jsf2/src/main/resources/templates/jsf2/flow/ActionForward.java.vsl,v retrieving revision 1.3 retrieving revision 1.4 diff -u -w -r1.3 -r1.4 --- ActionForward.java.vsl 31 Aug 2007 15:32:51 -0000 1.3 +++ ActionForward.java.vsl 31 Aug 2007 16:20:34 -0000 1.4 @@ -33,19 +33,19 @@ #set ($controller = $action.controller) $controller.fullyQualifiedName controller = ($controller.fullyQualifiedName)${facesContextUtilsFullyQualifiedName}.resolveVariable( - this.getServletContext(), request, response, + request, response, "$controller.beanName"); #if ($action.useCase) #set ($useCase = $action.useCase) #else #set ($useCase = $action) #end -#if (!$useCase.allForwards.empty) +##if (!$useCase.allForwards.empty) String forwardPath = ${managedBeansPackage}.UseCaseForwards.getPath(controller.${action.controllerAction}()); response.sendRedirect(request.getContextPath() + forwardPath + (request.getQueryString() != null ? "?"+request.getQueryString() : "")); -#else - controller.${action.controllerAction}(); -#end +##else + ## controller.${action.controllerAction}(); +##end } /** |
From: Chad B. <cwb...@us...> - 2007-08-30 20:05:36
|
User: cwbrandon Date: 07/08/30 13:05:35 Modified: andromda-jsf2/src/main/resources/META-INF/andromda cartridge.xml andromda-jsf2/src/main/resources/templates/jsf2/configuration web.xml.vsl Log: only render UserRoleFilter references when at least one role is present (and security is enabled) Revision Changes Path 1.10 +3 -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.9 retrieving revision 1.10 diff -u -w -r1.9 -r1.10 --- cartridge.xml 24 Jul 2007 18:18:09 -0000 1.9 +++ cartridge.xml 30 Aug 2007 20:05:35 -0000 1.10 @@ -175,6 +175,9 @@ <modelElement variable="manageables"> <type name="org.andromda.cartridges.jsf2.metafacades.JSFManageableEntity"/> </modelElement> + <modelElement variable="roles"> + <type name="org.andromda.metafacades.uml.Role"/> + </modelElement> </modelElements> </template> 1.10 +2 -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.9 retrieving revision 1.10 diff -u -w -r1.9 -r1.10 --- web.xml.vsl 2 Jul 2007 18:54:59 -0000 1.9 +++ web.xml.vsl 30 Aug 2007 20:05:35 -0000 1.10 @@ -138,7 +138,7 @@ </context-param> <!-- context-param merge-point --> <!-- filter merge-point --> -#if ($securityEnabled) +#if ($securityEnabled && !$roles.empty) <filter> <filter-name>User Role Filter</filter-name> <filter-class>${managedBeansPackage}.UserRoleFilter</filter-class> @@ -220,7 +220,7 @@ <filter-name>MyFaces Extensions Filter</filter-name> <url-pattern>/faces/myFacesExtensionResource/*</url-pattern> </filter-mapping> -#if ($securityEnabled) +#if ($securityEnabled && !$roles.empty) <filter-mapping> <filter-name>User Role Filter</filter-name> <url-pattern>*.${facesServletExtension}</url-pattern> |
From: Vance K. <va...@us...> - 2007-08-30 13:02:37
|
User: vancek Date: 07/08/30 06:02:38 Modified: profiles/uml-2.0/seam/src/main/uml andromda-profile-seam.xml.zip Log: ejb-76 - changed Seam profile TV @androdma.seam.component.scope default value to CONVERSATION Revision Changes Path 1.4 +102 -134 plugins/profiles/uml-2.0/seam/src/main/uml/andromda-profile-seam.xml.zip <<Binary file>> |
From: Vance K. <va...@us...> - 2007-08-27 14:48:02
|
User: vancek Date: 07/08/27 07:48:05 Modified: profiles/uml-2.0/seam/src/main/uml andromda-profile-seam.xml.zip Log: ejb-63 - update uml2 Seam profile, now support for MD 11.5 - 12.5 Revision Changes Path 1.3 +134 -123 plugins/profiles/uml-2.0/seam/src/main/uml/andromda-profile-seam.xml.zip <<Binary file>> |
From: Vance K. <va...@us...> - 2007-08-27 14:19:10
|
User: vancek Date: 07/08/27 07:19:12 Modified: andromda-ejb3/src/site changes.xml andromda-ejb3/src/main/resources/templates/ejb3/config/jboss components.xml.vsl andromda-ejb3/src/main/uml EJB3MetafacadeModel.xml.zip andromda-ejb3/src/main/resources/META-INF/andromda metafacades.xml cartridge.xml andromda-ejb3/src/site/axdoc howto21.xml Added: andromda-ejb3/src/main/java/org/andromda/cartridges/ejb3/metafacades EJB3ValueObjectFacadeLogicImpl.java Log: jira ejb-82 - support value objects as Seam components. added EJB3ValueObjectFacade. Revision Changes Path 1.27 +5 -0 cartridges/andromda-ejb3/src/site/changes.xml Index: changes.xml =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-ejb3/src/site/changes.xml,v retrieving revision 1.26 retrieving revision 1.27 diff -u -w -r1.26 -r1.27 --- changes.xml 21 Aug 2007 14:27:12 -0000 1.26 +++ changes.xml 27 Aug 2007 14:19:07 -0000 1.27 @@ -523,6 +523,11 @@ details. You should be aware that this patch will change the way the cartridge generates your foreign keys. Previously, it appended the _C suffix. </action> + <action dev="vancek" due-to="chawax" type="add"> + JIRA EJB-82 - Support generating Value Objects as Seam components. This required adding an + EJB3ValueObjectFacade metafacade for the cartridge and modifying the components.xml generation to + account for the new type Seam component. + </action> </release> </body> </document> \ No newline at end of file 1.1 cartridges/andromda-ejb3/src/main/java/org/andromda/cartridges/ejb3/metafacades/EJB3ValueObjectFacadeLogicImpl.java Index: EJB3ValueObjectFacadeLogicImpl.java =================================================================== package org.andromda.cartridges.ejb3.metafacades; /** * MetafacadeLogic implementation for org.andromda.cartridges.ejb3.metafacades.EJB3ValueObjectFacade. * * @see org.andromda.cartridges.ejb3.metafacades.EJB3ValueObjectFacade */ public class EJB3ValueObjectFacadeLogicImpl extends EJB3ValueObjectFacadeLogic { public EJB3ValueObjectFacadeLogicImpl (Object metaObject, String context) { super (metaObject, context); } /** * @see org.andromda.cartridges.ejb3.metafacades.EJB3ValueObjectFacade#isSeamComponent() */ protected boolean handleIsSeamComponent() { return EJB3MetafacadeUtils.isSeamComponent(this); } /** * @see org.andromda.cartridges.ejb3.metafacades.EJB3ValueObjectFacade#getSeamComponentName() */ protected java.lang.String handleGetSeamComponentName() { return EJB3MetafacadeUtils.getSeamComponentName(this); } /** * @see org.andromda.cartridges.ejb3.metafacades.EJB3ValueObjectFacade#getSeamComponentScopeType() */ protected java.lang.String handleGetSeamComponentScopeType() { return EJB3MetafacadeUtils.getSeamComponentScopeType(this, false); } } 1.2 +9 -0 cartridges/andromda-ejb3/src/main/resources/templates/ejb3/config/jboss/components.xml.vsl Index: components.xml.vsl =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-ejb3/src/main/resources/templates/ejb3/config/jboss/components.xml.vsl,v retrieving revision 1.1 retrieving revision 1.2 diff -u -w -r1.1 -r1.2 --- components.xml.vsl 16 Apr 2007 14:09:48 -0000 1.1 +++ components.xml.vsl 27 Aug 2007 14:19:08 -0000 1.2 @@ -27,6 +27,15 @@ #**##end #end +#foreach ($valueobject in $valueobjects) +#**##if ($valueobject.seamComponent) + <component + name="${valueobject.seamComponentName}" + class="${valueobject.fullyQualifiedName}" + scope="${valueobject.seamComponentScopeType}"/> + +#**##end +#end <!-- seam-components merge-point --> </components> \ No newline at end of file 1.59 +287 -241 cartridges/andromda-ejb3/src/main/uml/EJB3MetafacadeModel.xml.zip <<Binary file>> 1.35 +5 -0 cartridges/andromda-ejb3/src/main/resources/META-INF/andromda/metafacades.xml Index: metafacades.xml =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-ejb3/src/main/resources/META-INF/andromda/metafacades.xml,v retrieving revision 1.34 retrieving revision 1.35 diff -u -w -r1.34 -r1.35 --- metafacades.xml 14 Jun 2007 14:38:30 -0000 1.34 +++ metafacades.xml 27 Aug 2007 14:19:10 -0000 1.35 @@ -267,4 +267,9 @@ <metafacade class="org.andromda.cartridges.ejb3.metafacades.EJB3TypeFacadeLogicImpl"> <property reference="ejb3TypeMappingsUri"/> </metafacade> + <metafacade class="org.andromda.cartridges.ejb3.metafacades.EJB3ValueObjectFacadeLogicImpl"> + <mapping> + <stereotype>VALUE_OBJECT</stereotype> + </mapping> + </metafacade> </metafacades> \ No newline at end of file 1.39 +3 -0 cartridges/andromda-ejb3/src/main/resources/META-INF/andromda/cartridge.xml Index: cartridge.xml =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-ejb3/src/main/resources/META-INF/andromda/cartridge.xml,v retrieving revision 1.38 retrieving revision 1.39 diff -u -w -r1.38 -r1.39 --- cartridge.xml 16 Apr 2007 14:09:43 -0000 1.38 +++ cartridge.xml 27 Aug 2007 14:19:11 -0000 1.39 @@ -464,6 +464,9 @@ <modelElement variable="entities"> <type name="org.andromda.cartridges.ejb3.metafacades.EJB3EntityFacade"/> </modelElement> + <modelElement variable="valueobjects"> + <type name="org.andromda.cartridges.ejb3.metafacades.EJB3ValueObjectFacade"/> + </modelElement> </modelElements> </template> 1.6 +27 -25 cartridges/andromda-ejb3/src/site/axdoc/howto21.xml Index: howto21.xml =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-ejb3/src/site/axdoc/howto21.xml,v retrieving revision 1.5 retrieving revision 1.6 diff -u -w -r1.5 -r1.6 --- howto21.xml 4 Feb 2007 04:18:18 -0000 1.5 +++ howto21.xml 27 Aug 2007 14:19:12 -0000 1.6 @@ -68,21 +68,23 @@ <subsection name="Seam Quick Start Guide"> <p> Because we are not going to replace the existing JBoss tutorials here, it is assumed you have - followed the links above to understand the Seams framework and where you need the appropriate + followed the links above to understand the Seam framework and where you need the appropriate annotation or metadata. The following sections will briefly explain the more common Seam - stereotypes and tagged values and you can always find more documentation on these within + stereotypes and tagged values. You can always find more documentation on these within the <i>andromda-profile-seam</i>. </p> </subsection> <subsection name="Seam Component"> <p> - Every entity or session bean which is to be modelled as a Seam component must have an - extra <![CDATA[<<Seam>>]]> stereotype, along with the <![CDATA[<<Entity>>]]> stereotype. + Every entity or session bean which is to be modeled as a Seam component must have an + extra <![CDATA[<<Seam>>]]> stereotype, along with the traditional <![CDATA[<<Entity>>]]> + or <![CDATA[<<Service>>]]> stereotypes. However, now you can also model a value object with + the <![CDATA[<<ValueObject>>]]> stereotype as a Seam component in the same way. </p> </subsection> <subsection name="Component Name"> <p> - If you render the <![CDATA[<<Seam>>]]> stereotype, the <![CDATA[@Name]]> annotation will be + If you model the <![CDATA[<<Seam>>]]> stereotype, the <![CDATA[@Name]]> annotation will be generated with the value being the class name. You can override this by modelling the <![CDATA[@andromda.seam.component.name]]> tagged value. </p> @@ -94,7 +96,7 @@ type. </p> <p> - If you have modelled roles for the component, then you can use the + If you have modeled roles for the component, then you can use the <![CDATA[@andromda.seam.component.role.scope]]> tagged value where the list of scopes must be in the same order as the role names. </p> @@ -109,8 +111,8 @@ <subsection name="Bijection"> <p> The <![CDATA[@In]]> and <![CDATA[@Out]]> annotations for bijection are rendered on attributes - defined on session bean class where <![CDATA[<<In>>]]> and <![CDATA[<<Out>>]]> stereotypes are - modelled respectively. + defined on session bean classes where <![CDATA[<<In>>]]> and <![CDATA[<<Out>>]]> stereotypes are + modeled respectively. </p> <p> If attribute multiplicity is 0, 0..1, 0..*, the @@ -132,14 +134,14 @@ <subsection name="Creating Seam Component"> <p> The <![CDATA[@Create]]> annotation is rendered on session bean operations if a - <![CDATA[<<Create>>]]> stereotype is modelled on this method, indicating that the method + <![CDATA[<<Create>>]]> stereotype is modeled on this method, indicating that the method should be called when an instance of the component is instantiated by Seam. </p> </subsection> <subsection name="Destruction of Context Variables"> <p> The <![CDATA[@Destroy]]> annotation is rendered on a session bean operation if a - <![CDATA[<<Destroy>>]]> stereotype is modelled on it. Otherwise, by default, + <![CDATA[<<Destroy>>]]> stereotype is modeled on it. Otherwise, by default, a <b>Destroy</b> method is generated with this annotation. </p> </subsection> @@ -158,12 +160,12 @@ </subsection> <subsection name="Component Validation"> <p> - The <![CDATA[<<Valid>>]]> stereotype can be modelled on session bean component attributes + The <![CDATA[<<Valid>>]]> stereotype can be modeled on session bean component attributes to render the <![CDATA[@Valid]]> annotation for Hibernate Validator to recursively validate this and related objects. </p> <p> - The <![CDATA[<<Validator>>]]> stereotype can be modelled on Seam component operations indicating + The <![CDATA[<<Validator>>]]> stereotype can be modeled on Seam component operations indicating the validator must validate the component before invoking the method. </p> <p> @@ -173,8 +175,8 @@ </p> <p> The <![CDATA[@andromda.seam.validation.refreshEntities]]> tagged value can also optionally be - modelled with values 'true' or - 'false' and if defined, adds the <i>efreshEntities</i> property to the annotation. This will + modeled with values 'true' or + 'false' and if defined, adds the <i>refreshEntities</i> property to the annotation. This will indicate any invalid entity in the managed state be refreshed from the database when validation fails. This is used in conjuction with extended persistence context. </p> @@ -182,7 +184,7 @@ <subsection name="Stateful Session Bean Components"> <p> As soon as you introduce session bean attributes, the cartridge defines - the bean as a stateful session bean only if none of the attributes are modelled with Seam related + the bean as a stateful session bean only if none of the attributes are modeled with Seam related stereotypes or tagged values. If you have only Seam component attributes in the session bean (which by the way, is a Seam component), the bean is not defined as a SFSB. If you wish to explicity define this bean as a SFSB you can do this via the tagged value @@ -191,13 +193,13 @@ </subsection> <subsection name="Data Model"> <p> - The <![CDATA[<<DataModel>>]]> stereotype can be modelled on component attributes + The <![CDATA[<<DataModel>>]]> stereotype can be modeled on component attributes of type List, Map, Set or Object[]. This will render <![CDATA[@DataModel]]> on the attribute. </p> <p> An optional tagged value - <![CDATA[@andromda.seam.data.datamodel.value]]> can be modelled on such + <![CDATA[@andromda.seam.data.datamodel.value]]> can be modeled on such attributes to defined the context variable name if more than one datamodel exists. </p> <p> @@ -208,7 +210,7 @@ </subsection> <subsection name="Data Model Selection"> <p> - The <![CDATA[<<DataModelSelection>>]]> stereotype can be modelled on component attributes + The <![CDATA[<<DataModelSelection>>]]> stereotype can be modeled on component attributes to inject the selected value from the <b>DataModel</b> into the attribute. The JSF DataModel is the underlying colleciton or map value. This will render <![CDATA[@DataModelSelection]]> on the attribute. @@ -223,9 +225,9 @@ </subsection> <subsection name="Initializing Context Variable"> <p> - The <![CDATA[<<Factory>>]]> stereotype can be modelled on session bean + The <![CDATA[<<Factory>>]]> stereotype can be modeled on session bean component operations with the optional <![CDATA[@andromda.seam.bijection.factory.value]]> - tagged value which can be modelled on the operation to set the context variable name. + tagged value which can be modeled on the operation to set the context variable name. If this tagged value is NOT set, the default value is the property name. You can optionally explicity specify the scope of the context variable by using the <![CDATA[@andromda.seam.bijection.factory.scope]]> tagged value. @@ -233,7 +235,7 @@ </subsection> <subsection name="Request Parameters"> <p> - The <![CDATA[<<RequestParameter>>]]> stereotype can be modelled on session bean + The <![CDATA[<<RequestParameter>>]]> stereotype can be modeled on session bean component attributes to indicate an attribute is to be injected with the value of a request parameter. </p> @@ -260,14 +262,14 @@ <subsection name="Action Outcome in Absence of a Conversation"> <p> The tagged value <![CDATA[@andromda.seam.component.conversational.ifnotbegunoutcome]]> - an be set to render the <b>ifNotBegunOutcome</b> property on the <![CDATA[@Conversational]]> + can be set to render the <b>ifNotBegunOutcome</b> property on the <![CDATA[@Conversational]]> annotation to indicate the JSF outcome for the action, if no long-running conversation is active when the component is invoked. </p> </subsection> <subsection name="Beginging a Conversation"> <p> - The<![CDATA[<<Begin>>]]> stereotype can be modelled on Seam bean component operations + The<![CDATA[<<Begin>>]]> stereotype can be modeled on Seam component operations to indicate a long-running conversation has started. This will render a <![CDATA[@Begin]]> annotation on the operation. The following tagged values can be defined within the context of this component: @@ -282,7 +284,7 @@ </subsection> <subsection name="Ending a Conversation"> <p> - The <![CDATA[<<End>>]]> stereotype can be modelled on Seam bean component operations + The <![CDATA[<<End>>]]> stereotype can be modeled on Seam component operations to indicate the end of a long running conversation. The following tagged values can be defined within the context of this component: <ul> @@ -299,7 +301,7 @@ </subsection> <subsection name="Unwrap Stereotype"> <p> - The stereotype <![CDATA[<<Unwrap>>]]> can be modelled on attributes but is rendered + The stereotype <![CDATA[<<Unwrap>>]]> can be modeled on attributes but is rendered on getter method of bean components. </p> </subsection> |
From: Vance K. <va...@us...> - 2007-08-21 14:48:37
|
User: vancek Date: 07/08/21 07:48:38 Modified: andromda-ejb3/src/site/fml faq.fml Log: add faq to access session beans from JSF using the ServiceLocator Revision Changes Path 1.10 +18 -0 cartridges/andromda-ejb3/src/site/fml/faq.fml Index: faq.fml =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-ejb3/src/site/fml/faq.fml,v retrieving revision 1.9 retrieving revision 1.10 diff -u -w -r1.9 -r1.10 --- faq.fml 21 Aug 2007 14:27:09 -0000 1.9 +++ faq.fml 21 Aug 2007 14:48:38 -0000 1.10 @@ -154,5 +154,23 @@ </p> </answer> </faq> + <faq id="JSF_ServiceLocator_pattern"> + <question>How do I access SessionBeans from JSF using the ServiceLocator?</question> + <answer> + <p> + Use the following properties in <i>andromda.xml</i>. + namespace "ejb3": + <code><property name="jndiNamePrefix">${application.id}-${pom.version}</property></code> + <code><property name="serviceInterfaceNamePattern">{0}Interface</property></code> + <code><property name="serviceRemoteInterfaceNamePattern">{0}</property></code> + + namespace "jsf": + <code><property name="serviceAccessorPattern">(${application.package}.service.{1}) ${application.package}.ServiceLocator.getInstance().getService("${application.id}-${pom.version}/{1}")</property></code> + </p> + <p> + Have a look at <a href="http://galaxy.andromda.org/forum/viewtopic.php?p=23142">forum reference</a>. + </p> + </answer> + </faq> </part> </faqs> |
From: Vance K. <va...@us...> - 2007-08-21 14:27:18
|
User: vancek Date: 07/08/21 07:27:20 Modified: andromda-ejb3/src/site/fml faq.fml andromda-ejb3/src/site changes.xml andromda-ejb3 pom.xml andromda-ejb3/src/main/java/org/andromda/cartridges/ejb3/metafacades EJB3AssociationEndFacadeLogicImpl.java andromda-ejb3/src/test/expected cartridge-output.zip andromda-ejb3/src/test/uml EJB3CartridgeTestModel.xml.zip andromda-ejb3/src/main/resources/templates/ejb3 EntityEmbeddable.vsl andromda-ejb3/src/main/uml EJB3MetafacadeModel.xml.zip andromda-ejb3/src/site/axdoc howto.xml howto2.xml Log: fix ejb-67, 68, 69 - allowing foreign key column names and constraint names to be explicitly defined Revision Changes Path 1.9 +11 -1 cartridges/andromda-ejb3/src/site/fml/faq.fml Index: faq.fml =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-ejb3/src/site/fml/faq.fml,v retrieving revision 1.8 retrieving revision 1.9 diff -u -w -r1.8 -r1.9 --- faq.fml 2 Jul 2007 14:25:12 -0000 1.8 +++ faq.fml 21 Aug 2007 14:27:09 -0000 1.9 @@ -144,5 +144,15 @@ </p> </answer> </faq> + <faq id="Inheritance_strategy_differences_between_hibernate_ejb3_cartridges"> + <question>I used to use the subclass strategy with the Hibernate cartridge. Home come I get "Cannot use identity column key generation with union-subclass mapping for" when I use the TABLE_PER_CLASS strategy with the EJB3 cartridge?</question> + <answer> + <p> + The EJB3 cartridge equivalent of the subclass inheritance strategy for the Hibernate cartridge is the + JOINED inheritance strategy. Read more about it in + <a href="http://galaxy.andromda.org/forum/viewtopic.php?t=4825">forum thread</a>. + </p> + </answer> + </faq> </part> </faqs> 1.26 +9 -0 cartridges/andromda-ejb3/src/site/changes.xml Index: changes.xml =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-ejb3/src/site/changes.xml,v retrieving revision 1.25 retrieving revision 1.26 diff -u -w -r1.25 -r1.26 --- changes.xml 21 Jul 2007 13:31:51 -0000 1.25 +++ changes.xml 21 Aug 2007 14:27:12 -0000 1.26 @@ -514,6 +514,15 @@ this is now supported with EJb 3.0. An abstract parent entity can have a relationship with any other entity and this should be available to the child inheriting entities. Add test cases to support this. </action> + <action dev="vancek" due-to="hermida" type="fix"> + JIRA EJB-67, EJB-68, EJB-69 - Improved generation of JoinColumn and JoinTable annotations for all apprpriate + associations. By default, foreign key column names have the _FK suffix. You can explicitly overwrite + FK column names by defining the @andromda.persistence.column tagged value. You can also explicitly overwrite + the foreign key constraint names by enabling hibernate extensions and modeling the + @andromda.persistence.foreignkey.constraint tagged value. Refer to the relationshipts howto for further + details. You should be aware that this patch will change the way the cartridge generates your foreign keys. + Previously, it appended the _C suffix. + </action> </release> </body> </document> \ No newline at end of file 1.20 +1 -1 cartridges/andromda-ejb3/pom.xml Index: pom.xml =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-ejb3/pom.xml,v retrieving revision 1.19 retrieving revision 1.20 diff -u -w -r1.19 -r1.20 --- pom.xml 13 Jun 2007 16:32:11 -0000 1.19 +++ pom.xml 21 Aug 2007 14:27:13 -0000 1.20 @@ -290,7 +290,7 @@ </plugins> </reporting> <properties> - <!--maven.test.skip>false</maven.test.skip--> + <!-- maven.test.skip>true</maven.test.skip--> <model.uri>jar:file:${pom.basedir}/src/main/uml/EJB3MetafacadeModel.xml.zip!/EJB3MetafacadeModel.xml</model.uri> <test.model.uri>jar:file:${pom.basedir}/src/test/uml/EJB3CartridgeTestModel.xml.zip!/EJB3CartridgeTestModel.xml</test.model.uri> </properties> 1.19 +84 -26 cartridges/andromda-ejb3/src/main/java/org/andromda/cartridges/ejb3/metafacades/EJB3AssociationEndFacadeLogicImpl.java Index: EJB3AssociationEndFacadeLogicImpl.java =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-ejb3/src/main/java/org/andromda/cartridges/ejb3/metafacades/EJB3AssociationEndFacadeLogicImpl.java,v retrieving revision 1.18 retrieving revision 1.19 diff -u -w -r1.18 -r1.19 --- EJB3AssociationEndFacadeLogicImpl.java 29 Apr 2007 13:45:06 -0000 1.18 +++ EJB3AssociationEndFacadeLogicImpl.java 21 Aug 2007 14:27:13 -0000 1.19 @@ -8,6 +8,7 @@ import org.andromda.cartridges.ejb3.EJB3Globals; import org.andromda.cartridges.ejb3.EJB3Profile; +import org.andromda.metafacades.uml.AssociationEndFacade; import org.andromda.metafacades.uml.ClassifierFacade; import org.andromda.metafacades.uml.Entity; import org.andromda.metafacades.uml.EntityMetafacadeUtils; @@ -887,6 +888,20 @@ return BooleanUtils.toBoolean(String.valueOf(this.getConfiguredProperty(HIBERNATE_ASSOCIATION_ENABLE_CACHE))); } + + /** + * @see org.andromda.cartridges.ejb3.metafacades.EJB3AssociationEndFacadeLogic#handleIsForeignKeyConstraintDefined() + */ + protected boolean handleIsForeignKeyConstraintDefined() + { + boolean fkConstraintDefined = false; + if (findTaggedValue(UMLProfile.TAGGEDVALUE_PERSISTENCE_FOREIGN_KEY_CONSTRAINT_NAME) != null) + { + fkConstraintDefined = true; + } + return fkConstraintDefined; + } + /** * @see org.andromda.cartridges.ejb3.metafacades.EJB3AssociationEndFacadeLogic#handleGetForeignKeyConstraintName(java.lang.String) */ @@ -904,23 +919,22 @@ if (taggedValueObject == null) { - final ClassifierFacade type = getOtherEnd().getType(); + final ClassifierFacade type = this.getOtherEnd().getType(); if (type instanceof Entity) { - Entity entity = (Entity)type; - buffer.append(entity.getTableName()); + //Entity entity = (Entity)type; + //Instead of using the entity name, use the association end name to avoid duplication of + //FK constraint names which causes failures during table creation for some DBs (MySQL) + buffer.append( + EntityMetafacadeUtils.toSqlName( + this.getOtherEnd().getName(), + this.getConfiguredProperty(UMLMetafacadeProperties.SQL_NAME_SEPARATOR))); } else { // should not happen buffer.append(type.getName().toUpperCase()); } - } - else - { - // use the tagged value - buffer.append(taggedValueObject.toString()); - } buffer.append(this.getConfiguredProperty(UMLMetafacadeProperties.SQL_NAME_SEPARATOR)); @@ -949,9 +963,53 @@ buffer = new StringBuffer( EntityMetafacadeUtils.ensureMaximumNameLength(constraintName, new Short(maxLength))); buffer.append(constraintSuffix); + } + else + { + // use the tagged value + buffer.append(taggedValueObject.toString()); + } + return buffer.toString(); } + + /** + * @see org.andromda.cartridges.ejb3.metafacades.EJB3AssociationEndFacadeLogic#handleGetForeignKeyName(java.lang.String) + */ + protected String handleGetForeignKeyName(String suffix) + { + if (StringUtils.isNotBlank(suffix)) + { + suffix = new String( + this.getConfiguredProperty(UMLMetafacadeProperties.SQL_NAME_SEPARATOR) + + suffix + + this.getForeignKeySuffix()); + } + else + { + suffix = this.getForeignKeySuffix(); + } + + String columnName = null; + // prevent ClassCastException if the association isn't an Entity + if (this.getType() instanceof Entity) + { + final String columnNamePrefix = + this.isConfiguredProperty(UMLMetafacadeProperties.COLUMN_NAME_PREFIX) + ? ObjectUtils.toString(this.getConfiguredProperty(UMLMetafacadeProperties.COLUMN_NAME_PREFIX)) : null; + columnName = + EntityMetafacadeUtils.getSqlNameFromTaggedValue( + columnNamePrefix, + this, + UMLProfile.TAGGEDVALUE_PERSISTENCE_COLUMN, + ((Entity)this.getType()).getMaxSqlNameLength(), + suffix, + this.getConfiguredProperty(UMLMetafacadeProperties.SQL_NAME_SEPARATOR)); + } + return columnName; + } + /** * @see org.andromda.cartridges.ejb3.metafacades.EJB3AssociationEndFacadeLogic#handleGetDefaultCollectionInterface() */ 1.16 +712 -646 cartridges/andromda-ejb3/src/test/expected/cartridge-output.zip <<Binary file>> 1.11 +295 -300 cartridges/andromda-ejb3/src/test/uml/EJB3CartridgeTestModel.xml.zip <<Binary file>> 1.55 +55 -12 cartridges/andromda-ejb3/src/main/resources/templates/ejb3/EntityEmbeddable.vsl Index: EntityEmbeddable.vsl =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-ejb3/src/main/resources/templates/ejb3/EntityEmbeddable.vsl,v retrieving revision 1.54 retrieving revision 1.55 diff -u -w -r1.54 -r1.55 --- EntityEmbeddable.vsl 30 Jun 2007 03:53:48 -0000 1.54 +++ EntityEmbeddable.vsl 21 Aug 2007 14:27:17 -0000 1.55 @@ -562,13 +562,13 @@ ## Otherwise add the JoinColumn annotation. ## #* *##if (!$target.type.compositePrimaryKeyPresent) - @javax.persistence.JoinColumn(name = "$stringUtils.upperCase(${target.name})"#if ($associationEnd.columnDefinition), columnDefinition = "${associationEnd.columnDefinition}"#end) + @javax.persistence.JoinColumn(name = "${target.columnName}"#if ($associationEnd.columnDefinition), columnDefinition = "${associationEnd.columnDefinition}"#end) #* *##else #* *##set ($identifiers = $target.type.getIdentifiers()) @javax.persistence.JoinColumns ({ #* *##foreach ($attribute in $identifiers) - @javax.persistence.JoinColumn(name = "$stringUtils.upperCase(${target.name})_${attribute.columnName}", referencedColumnName = "${attribute.columnName}")#if($velocityCount != $identifiers.size()),#end + @javax.persistence.JoinColumn(name = "$associationEnd.getForeignKeyName(${attribute.columnName})", referencedColumnName = "${attribute.columnName}")#if($velocityCount != $identifiers.size()),#end #* *##end }) @@ -580,6 +580,13 @@ ## @org.hibernate.annotations.Cascade({${target.hibernateCascadeType}}) #* *##end +#* *##if ($target.foreignKeyConstraintDefined) +## +## Override the Hibernate foreign key constraint name +## Currently does not support composite PKs +## + @org.hibernate.annotations.ForeignKey(name = "$target.getForeignKeyConstraintName(${target.type.identifier.columnName})") +#* *##end #* *##end #* *##end public $target.getterSetterTypeName ${target.getterName}() @@ -621,10 +628,13 @@ #* *##set ($argExists = false) ## ## When the target entity is a mapped superclass AND Hibernate extensions is enabled -## then instead of the @OneToMany annotations, add the @CollectionOfElements instead +## then instead of the @OneToMany annotations, add the @CollectionOfElements instead. +## This is only applied when the target entity in the association is NOT and entity. +## In this situation, the target entity is a mapped superclass. ## #* *##if ($target.type.embeddableSuperclass && $hibernateExtensionEnabled) - @org.hibernate.annotations.CollectionOfElements + @org.hibernate.annotations.CollectionOfElements#if ($target.eager)(fetch = javax.persistence.FetchType.EAGER)#end + #* *##else @javax.persistence.OneToMany(#if ($target.cascadeType)cascade = {${target.cascadeType}}#set ($argExists = true)#end#if ($associationEnd.navigable)#if ($argExists) ,#end#**#mappedBy = "${associationEnd.name}"#set ($argExists = true)#end#if ($target.eager)#if ($argExists), #end#**#fetch = javax.persistence.FetchType.EAGER#end) #* *##end @@ -633,7 +643,12 @@ ## This is only set if the relationship is unidirectional. ## #* *##if (!$associationEnd.navigable && $target.navigable) - @javax.persistence.JoinTable(name = "${associationEnd.association.tableName}") + @javax.persistence.JoinTable + ( + name = "${associationEnd.association.tableName}", + joinColumns = {#set ($identifiers = $entity.getIdentifiers())#foreach ($attribute in $identifiers)@javax.persistence.JoinColumn(name = "$associationEnd.getForeignKeyName(${attribute.columnName})", referencedColumnName = "${attribute.columnName}")#if($velocityCount != $identifiers.size()), #end#end#**#}, + inverseJoinColumns = {#set ($identifiers = $target.type.getIdentifiers())#foreach ($attribute in $identifiers)@javax.persistence.JoinColumn(name = "$target.getForeignKeyName(${attribute.columnName})", referencedColumnName = "${attribute.columnName}")#if($velocityCount != $identifiers.size()), #end#end#**#} + ) #* *##end #* *##if ($target.map) @javax.persistence.MapKey#if ($target.hasTaggedValue("@andromda.persistence.collection.index"))(name = "${target.collectionIndexName}")#end @@ -646,6 +661,16 @@ @javax.persistence.OrderBy #* *##end #* *##elseif ($hibernateExtensionEnabled) +## +## Override the Hibernate foreign key constraint name +## Must define the name property. If the constraint on the entity itself is not defined, then dont +## render the annotation at all. +## +#* *##if ($associationEnd.owning) +#* *##if ($associationEnd.foreignKeyConstraintDefined) + @org.hibernate.annotations.ForeignKey(#if ($associationEnd.foreignKeyConstraintDefined)name = "$associationEnd.getForeignKeyConstraintName(${associationEnd.type.identifier.columnName})"#end#if ($target.foreignKeyConstraintDefined)#if ($associationEnd.foreignKeyConstraintDefined), #end#**#inverseName = "$target.getForeignKeyConstraintName(${target.type.identifier.columnName})"#end#**#) +#* *##end +#* *##end #* *##if ($target.list) ## ## Only add the IndexColumn annotation if Hibernate extensions is enabled @@ -719,13 +744,13 @@ ## Otherwise add the JoinColumn annotation. ## #* *##if (!$target.type.compositePrimaryKeyPresent) - @javax.persistence.JoinColumn(name = "$stringUtils.upperCase(${target.name})"#if ($associationEnd.columnDefinition), columnDefinition = "${associationEnd.columnDefinition}"#end) + @javax.persistence.JoinColumn(name = "${target.columnName}"#if ($associationEnd.columnDefinition), columnDefinition = "${associationEnd.columnDefinition}"#end) #* *##else #* *##set ($identifiers = $target.type.getIdentifiers()) @javax.persistence.JoinColumns ({ #* *##foreach ($attribute in $identifiers) - @javax.persistence.JoinColumn(name = "$stringUtils.upperCase(${target.name})_${attribute.columnName}", referencedColumnName = "${attribute.columnName}")#if($velocityCount != $identifiers.size()),#end + @javax.persistence.JoinColumn(name = "$associationEnd.getForeignKeyName(${attribute.columnName})", referencedColumnName = "${attribute.columnName}")#if($velocityCount != $identifiers.size()),#end #* *##end }) @@ -738,9 +763,14 @@ ## @org.hibernate.annotations.Cascade({${target.hibernateCascadeType}}) #* *##end +#* *##if($associationEnd.owning && $target.foreignKeyConstraintDefined) +## +## Override the Hibernate foreign key constraint name +## + @org.hibernate.annotations.ForeignKey(name = "$target.getForeignKeyConstraintName(${target.type.identifier.columnName})") +#* *##end #* *##end #* *##end - public $target.getterSetterTypeName ${target.getterName}() { return this.${target.name}; @@ -778,10 +808,13 @@ #* *##set ($argExists = false) ## ## When the target entity is a mapped superclass AND Hibernate extensions is enabled -## then instead of the @ManyToMany annotations, add the @CollectionOfElements +## then instead of the @OneToMany annotations, add the @CollectionOfElements instead. +## This is only applied when the target entity in the association is NOT and entity. +## In this situation, the target entity is a mapped superclass. ## #* *##if ($target.type.embeddableSuperclass && $hibernateExtensionEnabled) - @org.hibernate.annotations.CollectionOfElements + @org.hibernate.annotations.CollectionOfElements#if ($target.eager)(fetch = javax.persistence.FetchType.EAGER)#end + #* *##else @javax.persistence.ManyToMany(#if ($target.cascadeType)cascade = {${target.cascadeType}}#set ($argExists = true)#end#if(!$associationEnd.owning)#if ($argExists), #end#**#mappedBy = "${associationEnd.name}"#set ($argExists = true)#end#if ($target.eager)#if ($argExists), #end#**#fetch = javax.persistence.FetchType.EAGER#end) #* *##end @@ -794,8 +827,8 @@ @javax.persistence.JoinTable ( name = "${associationEnd.association.tableName}", - joinColumns = {#set ($identifiers = $entity.getIdentifiers())#foreach ($attribute in $identifiers)@javax.persistence.JoinColumn(name = "$target.getForeignKeyConstraintName(${attribute.columnName})", referencedColumnName = "${attribute.columnName}")#if($velocityCount != $identifiers.size()), #end#end#**#}, - inverseJoinColumns = {#set ($identifiers = $target.type.getIdentifiers())#foreach ($attribute in $identifiers)@javax.persistence.JoinColumn(name = "$associationEnd.getForeignKeyConstraintName(${attribute.columnName})", referencedColumnName = "${attribute.columnName}")#if($velocityCount != $identifiers.size()), #end#end#**#} + joinColumns = {#set ($identifiers = $entity.getIdentifiers())#foreach ($attribute in $identifiers)@javax.persistence.JoinColumn(name = "$associationEnd.getForeignKeyName(${attribute.columnName})", referencedColumnName = "${attribute.columnName}")#if($velocityCount != $identifiers.size()), #end#end#**#}, + inverseJoinColumns = {#set ($identifiers = $target.type.getIdentifiers())#foreach ($attribute in $identifiers)@javax.persistence.JoinColumn(name = "$target.getForeignKeyName(${attribute.columnName})", referencedColumnName = "${attribute.columnName}")#if($velocityCount != $identifiers.size()), #end#end#**#} ) #* *##end #* *##end @@ -819,6 +852,16 @@ #* *##end #* *##end #* *##if ($hibernateExtensionEnabled) +## +## Override the Hibernate foreign key constraint name +## Only generate the ForeignKey annotation if the constraint on the entity end is defined. The +## inverseName property cannot be defined without the name property. +## +#* *##if($associationEnd.owning) +#* *##if($associationEnd.foreignKeyConstraintDefined) + @org.hibernate.annotations.ForeignKey(#if ($associationEnd.foreignKeyConstraintDefined)name = "$associationEnd.getForeignKeyConstraintName(${associationEnd.type.identifier.columnName})"#end#if ($target.foreignKeyConstraintDefined)#if ($associationEnd.foreignKeyConstraintDefined), #end#**#inverseName = "$target.getForeignKeyConstraintName(${target.type.identifier.columnName})"#end#**#) +#* *##end +#* *##end #* *##if ($target.associationCacheEnabled) ## ## Only add the Cache annotation if assocation cache and Hibernate extensions are both enabled 1.58 +238 -236 cartridges/andromda-ejb3/src/main/uml/EJB3MetafacadeModel.xml.zip <<Binary file>> 1.6 +1 -0 cartridges/andromda-ejb3/src/site/axdoc/howto.xml Index: howto.xml =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-ejb3/src/site/axdoc/howto.xml,v retrieving revision 1.5 retrieving revision 1.6 diff -u -w -r1.5 -r1.6 --- howto.xml 30 Jun 2007 03:53:48 -0000 1.5 +++ howto.xml 21 Aug 2007 14:27:19 -0000 1.6 @@ -70,6 +70,7 @@ <li><a href="howto2.html#Join_Table_Many_To_Many_And_One_To_Many">Join Table for Many-To-Many and One-To-Many Relationships</a></li> <li><a href="howto2.html#Aggregation_Composition">Aggregation and Composition</a></li> <li><a href="howto2.html#Transient_Relationships">Transient Relationships</a></li> + <li><a href="howto2.html#Foreign_Key_Column_Names_And_Foreign_Key_Constraint_Names">Foreign Key Column Names and Foreign Key Constraint Names</a></li> <li><a href="howto2.html#Tips">Tips</a></li> </ul> </li> 1.5 +58 -0 cartridges/andromda-ejb3/src/site/axdoc/howto2.xml Index: howto2.xml =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-ejb3/src/site/axdoc/howto2.xml,v retrieving revision 1.4 retrieving revision 1.5 diff -u -w -r1.4 -r1.5 --- howto2.xml 30 Jun 2007 03:53:48 -0000 1.4 +++ howto2.xml 21 Aug 2007 14:27:19 -0000 1.5 @@ -347,6 +347,64 @@ <code>@javax.persistence.Transient</code> annotation to the relationship getter. </p> </subsection> + <a name="Foreign_Key_Column_Names_And_Foreign_Key_Constraint_Names"/> + <subsection name="Foreign Key Column Names and Foreign Key Constraint Names"> + <p> + By default, the foreign key column names are defined by the cartridge and foreign key constraint + names are defined by your database on creation. This way, we don't impose any complexity + on any project. However, there are always certain environments and projects which require a + strict architecture. This is where you may need the flexibility to control the foreign key + names and foreign key constraint names. + </p> + <p> + Controlling foreign key names is relatively simple as long as you know where to model the right + tagged value. In all four association types, you can use the + <code>@andromda.persistence.column</code> tagged value on an association end to explicitly + define the foreign key name. + </p> + <p> + In a <b>many-to-one</b> or <b>one-to-one</b> association, model the + <code>@andromda.persistence.column</code> tagged value on the target association ends. In a + <b>one-to-many</b> unidirection or <b>many-to-many</b> association, you can model the + <code>@andromda.persistence.column</code> tagged value on either one or both ends of the + association. + </p> + <p> + Remember that you don't have to explicitly define the foreign key column names. The cartridge + will create a suitable name for you using either the <b>JoinColumn</b> + annotation. Using the above solution, you are effectively overwriting the auto-generated + foreign key column names. + </p> + <p> + Explicitly defining foreign key constraint names are slightly more tricky. There is no + EJB 3.0 defined solution to setting the foreign key constraint names. Hibernate has provided + an extension to the EJB 3.0 annotations which solves this limitation. This is convenient if you + are using a JEE container with Hibernate as your persistence provider. If not, you need to + check with your provider and determine a corresponding annotation. Fortunately, the EJB3 + cartridge currently works well with JBoss and since JBoss uses Hibernate, we are almost home free. + </p> + <p> + The first thing you need to do to be able to explicitly define your foreign key constraint + names is to set the value of the <b>persistenceProviderExtensions</b> namespace property + to <b>hibernate</b> in your andromda.xml. You can then model the + <code>@andromda.persistence.foreignkey.constraint</code> tagged value on the appropriate + association ends to explicitly define your foreign key constraint names. + </p> + <p> + For <b>many-to-one</b> and <b>one-to-one</b> associations, you model the + <code>@andromda.persistence.foreignkey.constraint</code> tagged value on the target association + ends. For <b>one-to-many unidirectional</b> and <b>many-to-many</b> associations, you + can model the <code>@andromda.persistence.foreignkey.constraint</code> tagged value on either + end or both ends of the association depending on what you want. + </p> + <p class="highlight"> + Keep in mind that for <b>one-to-many unidirectional</b> and <b>many-to-many</b> associations, + you must model the foreign key constraint name on the source association end if you want + to define the foreign key constraint name on the target association end. If you don't, then + neither one will be considered during generation. You can however only define the foreign key + constraint name on the source end and not the target end. + </p> + </subsection> <a name="Tips"/> <subsection name="Tips" > <p> |
From: Chris M. <cm...@us...> - 2007-08-10 13:59:51
|
User: cmicali Date: 07/08/10 06:59:52 Modified: etc/andromda-dotnet/AndroMDA.VS80AddIn/AndroMDA.VS80AddIn/Maven Maven2Proxy.cs Log: Revision Changes Path 1.7 +1 -0 plugins/etc/andromda-dotnet/AndroMDA.VS80AddIn/AndroMDA.VS80AddIn/Maven/Maven2Proxy.cs Index: Maven2Proxy.cs =================================================================== RCS file: /cvsroot/andromdaplugins/plugins/etc/andromda-dotnet/AndroMDA.VS80AddIn/AndroMDA.VS80AddIn/Maven/Maven2Proxy.cs,v retrieving revision 1.6 retrieving revision 1.7 diff -u -w -r1.6 -r1.7 --- Maven2Proxy.cs 7 Aug 2007 02:29:41 -0000 1.6 +++ Maven2Proxy.cs 10 Aug 2007 13:59:52 -0000 1.7 @@ -159,6 +159,7 @@ if (line.Contains("does not exist or no valid version could be found") || line.Contains("required artifacts are missing") || line.Contains("required artifact is missing") || + line.Contains("not found in repository") || line.Contains("Failed to resolve artifact")) { m_mavenStatus = MavenStatus.UnsatisfiedDependency; |
From: Chris M. <cm...@us...> - 2007-08-08 00:30:19
|
User: cmicali Date: 07/08/07 17:30:20 Modified: andromda-nspring/src/main/resources/templates/nspring NSpringHibernateDaoImpl.vsl Log: Revision Changes Path 1.6 +3 -6 cartridges/andromda-nspring/src/main/resources/templates/nspring/NSpringHibernateDaoImpl.vsl Index: NSpringHibernateDaoImpl.vsl =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-nspring/src/main/resources/templates/nspring/NSpringHibernateDaoImpl.vsl,v retrieving revision 1.5 retrieving revision 1.6 diff -u -w -r1.5 -r1.6 --- NSpringHibernateDaoImpl.vsl 1 Aug 2007 04:14:16 -0000 1.5 +++ NSpringHibernateDaoImpl.vsl 8 Aug 2007 00:30:20 -0000 1.6 @@ -29,10 +29,7 @@ /// <summary> /// @see ${entity.fullyQualifiedDaoName}#${operation.getSignature(false)} /// </summary> - protected override $returnType.fullyQualifiedName $signature -#if ($operation.exceptionsPresent) - throws $operation.exceptionList -#end + protected $returnType.fullyQualifiedName $signature { //@todo implement $operation.visibility $returnType.fullyQualifiedName $signature #if ($operation.returnTypePresent) @@ -47,7 +44,7 @@ /// <summary> /// @see ${entity.fullyQualifiedDaoName}#${valueObjectRef.transformationMethodName}($entity.fullyQualifiedName) /// </summary> - public override $valueObjectRef.targetElement.fullyQualifiedName ${valueObjectRef.transformationMethodName}($entity.fullyQualifiedName entity) + public $valueObjectRef.targetElement.fullyQualifiedName ${valueObjectRef.transformationMethodName}($entity.fullyQualifiedName entity) { // put your implementation here return null; @@ -56,7 +53,7 @@ /// <summary> /// @see ${entity.fullyQualifiedDaoName}#${valueObjectRef.transformationToEntityMethodName}($valueObjectRef.targetElement.fullyQualifiedName) /// </summary> - public override $entity.fullyQualifiedEntityName ${valueObjectRef.transformationToEntityMethodName}($valueObjectRef.targetElement.fullyQualifiedName $stringUtils.uncapitalize($valueObjectRef.name)) + public $entity.fullyQualifiedEntityName ${valueObjectRef.transformationToEntityMethodName}($valueObjectRef.targetElement.fullyQualifiedName $stringUtils.uncapitalize($valueObjectRef.name)) { // put your implementation here return null; |