You can subscribe to this list here.
2005 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(6) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2006 |
Jan
(178) |
Feb
(169) |
Mar
(286) |
Apr
(117) |
May
(98) |
Jun
(68) |
Jul
(63) |
Aug
(121) |
Sep
(88) |
Oct
(124) |
Nov
(2) |
Dec
(111) |
2007 |
Jan
(224) |
Feb
(69) |
Mar
(10) |
Apr
(72) |
May
(7) |
Jun
(21) |
Jul
(33) |
Aug
(35) |
Sep
(12) |
Oct
(22) |
Nov
(5) |
Dec
(6) |
2008 |
Jan
(2) |
Feb
(10) |
Mar
(39) |
Apr
(58) |
May
(34) |
Jun
(9) |
Jul
(27) |
Aug
(10) |
Sep
(3) |
Oct
|
Nov
|
Dec
|
From: Walter M. <wal...@us...> - 2007-01-11 17:37:01
|
User: walterim Date: 07/01/11 09:37:00 Modified: andromda-jsf2/src/main/resources/templates/jsf2/messages messages.properties.vsl Log: Added a message when the search is empty. Revision Changes Path 1.3 +1 -0 cartridges/andromda-jsf2/src/main/resources/templates/jsf2/messages/messages.properties.vsl Index: messages.properties.vsl =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-jsf2/src/main/resources/templates/jsf2/messages/messages.properties.vsl,v retrieving revision 1.2 retrieving revision 1.3 diff -u -w -r1.2 -r1.3 --- messages.properties.vsl 11 Dec 2006 13:44:00 -0000 1.2 +++ messages.properties.vsl 11 Jan 2007 17:37:00 -0000 1.3 @@ -195,6 +195,7 @@ entity.management=Entity Management (click) maximum.results.fetched.warning=Maximum of {0} records retrieved, other records may be available. Please specify more search criteria to narrow result set. binary.data=[Binary] +no.entity.found=no {0} found #foreach ($manageable in $manageables) $manageable.messageKey=$manageable.messageValue |
From: Walter M. <wal...@us...> - 2007-01-11 17:35:55
|
User: walterim Date: 07/01/11 09:35:53 Modified: andromda-jsf2/src/main/resources/templates/jsf2/flow/crud ViewPopulator.java.vsl andromda-jsf2/src/main/resources/templates/jsf2/views/facelets/crud view.xhtml.vsl andromda-jsf2/src/main/resources/templates/jsf2/controllers/crud Controller.java.vsl Log: Bug fixes Revision Changes Path 1.2 +9 -35 cartridges/andromda-jsf2/src/main/resources/templates/jsf2/flow/crud/ViewPopulator.java.vsl Index: ViewPopulator.java.vsl =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-jsf2/src/main/resources/templates/jsf2/flow/crud/ViewPopulator.java.vsl,v retrieving revision 1.1 retrieving revision 1.2 diff -u -w -r1.1 -r1.2 --- ViewPopulator.java.vsl 11 Dec 2006 13:43:57 -0000 1.1 +++ ViewPopulator.java.vsl 11 Jan 2007 17:35:53 -0000 1.2 @@ -67,47 +67,22 @@ org.apache.myfaces.trinidad.context.RequestContext adfContext = org.apache.myfaces.trinidad.context.RequestContext.getCurrentInstance(); final javax.faces.el.VariableResolver variableResolver = facesContext.getApplication().getVariableResolver(); - final javax.servlet.http.HttpSession session = ((javax.servlet.http.HttpServletRequest)request).getSession(); - if (form == null) - { - // - first try getting the form from the ADF PageFlowScope + form = adfContext.getPageFlowScope().get("$manageable.formKey"); - // - if the form is null, try getting the current adfContext from the session (and then remove it from the session) - if (form == null) - { - final ${managedBeansPackage}.AdfFacesContextWrapper contextWrapper = - (${managedBeansPackage}.AdfFacesContextWrapper)session.getAttribute("$adfContextAttributeName"); - adfContext = contextWrapper != null ? contextWrapper.getCurrentInstance() : null; - form = adfContext != null ? adfContext.getPageFlowScope().get("$manageable.formKey") : null; + #if ($formSerialization) + final javax.servlet.http.HttpSession session = ((javax.servlet.http.HttpServletRequest)request).getSession(); + // - if the form is still null, see if we can get it from a serialized state if (form == null) { form = ${managedBeansPackage}.JsfUtils.getSerializedForm(session); } #end - if (form != null) - { - // - add the form to the current process scope since it wasn't in the current one to begin with - org.apache.myfaces.trinidad.context.RequestContext.getCurrentInstance().getPageFlowScope().put("$manageable.formKey", form); - } - } - else - { - // - remove the ADF context in the event that its present - session.removeAttribute("AndroMDAADFContext"); - } - } - else - { - // - since the form argument is not null, set it as the "$manageable.formKey" in the PageFlowScope - // (to replace the existing "$manageable.formKey" attribute) - adfContext.getPageFlowScope().put("$manageable.formKey", form); - } try { // - populate the forms - if (form != null) + if (form != null && form instanceof $manageable.formBeanType) { $manageable.formBeanType $manageable.formBeanName = (${manageable.formBeanType})variableResolver.resolveVariable( @@ -115,7 +90,6 @@ "$manageable.formBeanName"); // - populate the $manageable.formBeanName with any parameters from the previous form ${managedBeansPackage}.${formPopulatorName}.populateForm(form, $manageable.formBeanName); - request.setAttribute("$manageable.formBeanName", $manageable.formBeanName); } #if ($formSerialization) // - serialize the form 1.3 +10 -16 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.2 retrieving revision 1.3 diff -u -w -r1.2 -r1.3 --- view.xhtml.vsl 12 Dec 2006 18:46:32 -0000 1.2 +++ view.xhtml.vsl 11 Jan 2007 17:35:53 -0000 1.3 @@ -89,8 +89,7 @@ ## deixei false em função da discrepância com o uso do \ no javascript#set ($clientValidation = $clientValidation && $manageable.validationRequired) #set ($clientValidation = false) #set ($formValidateName = "validate$stringUtils.capitalize($formName)") - <c:if test="#{!${formName}.editState}"> - <tr:subform id="${formName}_search" enctype="multipart/form-data"> + <tr:subform id="${formName}_search" rendered="#{!${formName}.editState}"> <tr:panelFormLayout> #foreach ($field in $manageable.manageableSearchAttributes) #renderSearchInput($field) @@ -113,16 +112,14 @@ #end <f:facet name="footer"> <tr:panelButtonBar> - <tr:commandButton text="#{messages['action.search']}" action="#{${manageable.controllerBeanName}.search}" accessKey="#{messages['action.search.access.key']}"/> + <tr:commandButton id="searchButton" text="#{messages['action.search']}" action="#{${manageable.controllerBeanName}.search}" accessKey="#{messages['action.search.access.key']}"/> #if ($manageable.create) - <tr:commandButton text="#{messages['action.new']}" action="#{${manageable.controllerBeanName}.startNew}" accessKey="#{messages['action.new.access.key']}"/> + <tr:commandButton id="newButton" text="#{messages['action.new']}" action="#{${manageable.controllerBeanName}.startNew}" accessKey="#{messages['action.new.access.key']}"/> #end </tr:panelButtonBar> </f:facet> </tr:panelFormLayout> - </tr:subform> - <tr:subform> - <tr:table allDetailsEnabled="true" var="row" bandingInterval="1" banding="row" value="#{${formName}.${manageable.listName}}" rows="#{${preferencesBeanName}.maxTableRows}" width="90%"> + <tr:table allDetailsEnabled="true" var="row" bandingInterval="1" banding="row" value="#{${formName}.${manageable.listName}}" rows="#{${preferencesBeanName}.maxTableRows}" width="90%" rendered="#{!empty ${formName}.${manageable.listName}}"> <tr:column width="46px"> <f:facet name="header"> <h:panelGroup><t:graphicImage url="/images/space.gif"/></h:panelGroup> @@ -162,14 +159,11 @@ #end </tr:table> </tr:subform> - </c:if> - <c:if test="#{${formName}.editState}"> - <tr:subform> + <tr:group rendered="#{${formName}.editState}"> <tr:commandLink action="#{${manageable.controllerBeanName}.back}" accessKey="#{messages['action.back.access.key']}"> <t:graphicImage url="/skins/#{${preferencesBeanName}.skin}/images/back.gif" title="#{messages['action.back']}" border="0" /> </tr:commandLink> - </tr:subform> - <tr:subform id="$formName"#if($clientValidation) onsubmit="return $formValidateName(this);"#end enctype="multipart/form-data"> + <tr:subform id="${formName}_edit" #if($clientValidation) onsubmit="return $formValidateName(this);"#end> <tr:panelFormLayout> #foreach ($field in $manageable.manageableAttributes) #if($field.hidden) @@ -204,7 +198,7 @@ </tr:panelFormLayout> <a:validator#if(!$clientValidation) client="false"#end/> </tr:subform> - </c:if> + </tr:group> </ui:define> </ui:composition> 1.2 +52 -185 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.1 retrieving revision 1.2 diff -u -w -r1.1 -r1.2 --- Controller.java.vsl 11 Dec 2006 13:43:58 -0000 1.1 +++ Controller.java.vsl 11 Jan 2007 17:35:53 -0000 1.2 @@ -12,24 +12,21 @@ public String init(){ final org.andromda.presentation.jsf2.AdfFacesContextWrapper contextWrapper = new org.andromda.presentation.jsf2.AdfFacesContextWrapper(); - final Object currentForm = this.resolveVariable("form"); try { final ${manageable.formBeanType} form = this.getForm(); - // - populate the form with any request parameters that may match - this.populateFormFromRequestParameters(form, form.getDateTimeFormatters()); try { contextWrapper.getCurrentInstance().getPageFlowScope().put("form", form); - // - add this temporary ADF context to the session so that we can retrieve from a view populator if required - this.getSession(false).setAttribute("AndroMDAADFContext", contextWrapper); + + // - populate the form with any request parameters that may match + this.populateFormFromRequestParameters(form, form.getDateTimeFormatters()); this.doInit(form); } catch (final Throwable throwable) { - contextWrapper.getCurrentInstance().getPageFlowScope().put("form", currentForm); final String message = org.andromda.presentation.jsf2.Messages.get( org.andromda.presentation.jsf2.PatternMatchingExceptionHandler.instance().handleException(throwable), null); throwable.printStackTrace(); @@ -38,55 +35,51 @@ } catch (final Throwable throwable) { - contextWrapper.getCurrentInstance().getPageFlowScope().put("form", currentForm); this.addExceptionMessage(throwable); } - return "${manageable.viewFullPath}"; } public void doInit(${manageable.formBeanType} form) throws Exception { -#if ($manageable.preload) - final java.util.List list = ${manageable.manageableServiceAccessorCall}.readAll(); - - form.${manageable.listSetterName}(list); - -#if ($manageable.maximumListSize > 0) - if (list.size() >= $manageable.maximumListSize) - saveMaxResultsWarning(); - -#end -#if (!$manageable.manageableAssociationEnds.empty) - final java.util.Map backingLists = ${manageable.manageableServiceAccessorCall}.readBackingLists(); -#foreach ($member in $manageable.manageableAssociationEnds) - form.${member.setterName}BackingList((java.util.Collection)backingLists.get("${member.name}")); -#end - -#end +## does not preload the data anymore... testing. +###if ($manageable.preload) +## final java.util.List list = ${manageable.manageableServiceAccessorCall}.readAll(); +## +## form.${manageable.listSetterName}(list); +## +###if ($manageable.maximumListSize > 0) +## if (list.size() >= $manageable.maximumListSize) +## saveMaxResultsWarning(); +## +###end +###if (!$manageable.manageableAssociationEnds.empty) +## final java.util.Map backingLists = ${manageable.manageableServiceAccessorCall}.readBackingLists(); +###foreach ($member in $manageable.manageableAssociationEnds) +## form.${member.setterName}BackingList((java.util.Collection)backingLists.get("${member.name}")); +###end +## +###end +###end form.setEditState(false); -#end } public String load(){ final org.andromda.presentation.jsf2.AdfFacesContextWrapper contextWrapper = new org.andromda.presentation.jsf2.AdfFacesContextWrapper(); - final Object currentForm = this.resolveVariable("form"); try { final ${manageable.formBeanType} form = this.getForm(); - // - populate the form with any request parameters that may match - this.populateFormFromRequestParameters(form, form.getDateTimeFormatters()); try { contextWrapper.getCurrentInstance().getPageFlowScope().put("form", form); - // - add this temporary ADF context to the session so that we can retrieve from a view populator if required - this.getSession(false).setAttribute("AndroMDAADFContext", contextWrapper); + + // - populate the form with any request parameters that may match + this.populateFormFromRequestParameters(form, form.getDateTimeFormatters()); this.doLoad(form); } catch (final Throwable throwable) { - contextWrapper.getCurrentInstance().getPageFlowScope().put("form", currentForm); final String message = org.andromda.presentation.jsf2.Messages.get( org.andromda.presentation.jsf2.PatternMatchingExceptionHandler.instance().handleException(throwable), null); this.addErrorMessage(message); @@ -94,15 +87,14 @@ } catch (final Throwable throwable) { - contextWrapper.getCurrentInstance().getPageFlowScope().put("form", currentForm); this.addExceptionMessage(throwable); } - return null; + return "${manageable.viewFullPath}"; } public void doLoad(${manageable.formBeanType} form) throws Exception { final Object vo= - ${manageable.manageableServiceAccessorCall}.load(form.${manageable.manageableIdentifier.getterName}()); + ${manageable.manageableServiceAccessorCall}.readById(form.${manageable.manageableIdentifier.getterName}()); ## fazer via members org.apache.commons.beanutils.BeanUtils.copyProperties(form,vo); @@ -112,24 +104,21 @@ public String back(){ final org.andromda.presentation.jsf2.AdfFacesContextWrapper contextWrapper = new org.andromda.presentation.jsf2.AdfFacesContextWrapper(); - final Object currentForm = this.resolveVariable("form"); try { final ${manageable.formBeanType} form = this.getForm(); - // - populate the form with any request parameters that may match - this.populateFormFromRequestParameters(form, form.getDateTimeFormatters()); try { contextWrapper.getCurrentInstance().getPageFlowScope().put("form", form); - // - add this temporary ADF context to the session so that we can retrieve from a view populator if required - this.getSession(false).setAttribute("AndroMDAADFContext", contextWrapper); + + // - populate the form with any request parameters that may match + this.populateFormFromRequestParameters(form, form.getDateTimeFormatters()); this.doBack(form); } catch (final Throwable throwable) { - contextWrapper.getCurrentInstance().getPageFlowScope().put("form", currentForm); final String message = org.andromda.presentation.jsf2.Messages.get( org.andromda.presentation.jsf2.PatternMatchingExceptionHandler.instance().handleException(throwable), null); this.addErrorMessage(message); @@ -137,10 +126,9 @@ } catch (final Throwable throwable) { - contextWrapper.getCurrentInstance().getPageFlowScope().put("form", currentForm); this.addExceptionMessage(throwable); } - return null; + return "${manageable.viewFullPath}"; } public void doBack(${manageable.formBeanType} form) throws Exception { @@ -150,24 +138,21 @@ #if ($manageable.create) public String startNew(){ final org.andromda.presentation.jsf2.AdfFacesContextWrapper contextWrapper = new org.andromda.presentation.jsf2.AdfFacesContextWrapper(); - final Object currentForm = this.resolveVariable("form"); try { final ${manageable.formBeanType} form = this.getForm(); - // - populate the form with any request parameters that may match - this.populateFormFromRequestParameters(form, form.getDateTimeFormatters()); try { contextWrapper.getCurrentInstance().getPageFlowScope().put("form", form); - // - add this temporary ADF context to the session so that we can retrieve from a view populator if required - this.getSession(false).setAttribute("AndroMDAADFContext", contextWrapper); + + // - populate the form with any request parameters that may match + this.populateFormFromRequestParameters(form, form.getDateTimeFormatters()); this.doStartNew(form); } catch (final Throwable throwable) { - contextWrapper.getCurrentInstance().getPageFlowScope().put("form", currentForm); final String message = org.andromda.presentation.jsf2.Messages.get( org.andromda.presentation.jsf2.PatternMatchingExceptionHandler.instance().handleException(throwable), null); this.addErrorMessage(message); @@ -175,10 +160,9 @@ } catch (final Throwable throwable) { - contextWrapper.getCurrentInstance().getPageFlowScope().put("form", currentForm); this.addExceptionMessage(throwable); } - return null; + return "${manageable.viewFullPath}"; } public void doStartNew(${manageable.formBeanType} form) throws Exception { @@ -233,24 +217,21 @@ #if ($manageable.create || $manageable.update) public String save(){ final org.andromda.presentation.jsf2.AdfFacesContextWrapper contextWrapper = new org.andromda.presentation.jsf2.AdfFacesContextWrapper(); - final Object currentForm = this.resolveVariable("form"); try { final ${manageable.formBeanType} form = this.getForm(); - // - populate the form with any request parameters that may match - this.populateFormFromRequestParameters(form, form.getDateTimeFormatters()); try { contextWrapper.getCurrentInstance().getPageFlowScope().put("form", form); - // - add this temporary ADF context to the session so that we can retrieve from a view populator if required - this.getSession(false).setAttribute("AndroMDAADFContext", contextWrapper); + + // - populate the form with any request parameters that may match + this.populateFormFromRequestParameters(form, form.getDateTimeFormatters()); this.doSave(form); } catch (final Throwable throwable) { - contextWrapper.getCurrentInstance().getPageFlowScope().put("form", currentForm); final String message = org.andromda.presentation.jsf2.Messages.get( org.andromda.presentation.jsf2.PatternMatchingExceptionHandler.instance().handleException(throwable), null); this.addErrorMessage(message); @@ -258,10 +239,9 @@ } catch (final Throwable throwable) { - contextWrapper.getCurrentInstance().getPageFlowScope().put("form", currentForm); this.addExceptionMessage(throwable); } - return null; + return "${manageable.viewFullPath}"; } public void doSave(${manageable.formBeanType} form) throws Exception { @@ -285,29 +265,27 @@ ); } - doSearch(form); + if(form.${manageable.listGetterName}() != null) //only searches again if there was an old search + doSearch(form); //search again to show the updated item (if it fits the search criteria) } #end public String search(){ final org.andromda.presentation.jsf2.AdfFacesContextWrapper contextWrapper = new org.andromda.presentation.jsf2.AdfFacesContextWrapper(); - final Object currentForm = this.resolveVariable("form"); try { final ${manageable.formBeanType} form = this.getForm(); - // - populate the form with any request parameters that may match - this.populateFormFromRequestParameters(form, form.getDateTimeFormatters()); try { contextWrapper.getCurrentInstance().getPageFlowScope().put("form", form); - // - add this temporary ADF context to the session so that we can retrieve from a view populator if required - this.getSession(false).setAttribute("AndroMDAADFContext", contextWrapper); + + // - populate the form with any request parameters that may match + this.populateFormFromRequestParameters(form, form.getDateTimeFormatters()); this.doSearch(form); } catch (final Throwable throwable) { - contextWrapper.getCurrentInstance().getPageFlowScope().put("form", currentForm); final String message = org.andromda.presentation.jsf2.Messages.get( org.andromda.presentation.jsf2.PatternMatchingExceptionHandler.instance().handleException(throwable), null); this.addErrorMessage(message); @@ -315,7 +293,6 @@ } catch (final Throwable throwable) { - contextWrapper.getCurrentInstance().getPageFlowScope().put("form", currentForm); this.addExceptionMessage(throwable); } return null; @@ -336,6 +313,9 @@ form.${manageable.listSetterName}(list); + if(list.size() == 0) + addWarningMessage(org.andromda.presentation.jsf2.Messages.get("no.entity.found", new Object[]{org.andromda.presentation.jsf2.Messages.get("$manageable.messageKey",null)})); + #if ($manageable.maximumListSize > 0) if (list.size() >= $manageable.maximumListSize) saveMaxResultsWarning(); @@ -354,24 +334,21 @@ #if ($manageable.delete) public String delete(){ final org.andromda.presentation.jsf2.AdfFacesContextWrapper contextWrapper = new org.andromda.presentation.jsf2.AdfFacesContextWrapper(); - final Object currentForm = this.resolveVariable("form"); try { final ${manageable.formBeanType} form = this.getForm(); - // - populate the form with any request parameters that may match - this.populateFormFromRequestParameters(form, form.getDateTimeFormatters()); try { contextWrapper.getCurrentInstance().getPageFlowScope().put("form", form); - // - add this temporary ADF context to the session so that we can retrieve from a view populator if required - this.getSession(false).setAttribute("AndroMDAADFContext", contextWrapper); + + // - populate the form with any request parameters that may match + this.populateFormFromRequestParameters(form, form.getDateTimeFormatters()); this.doDelete(form); } catch (final Throwable throwable) { - contextWrapper.getCurrentInstance().getPageFlowScope().put("form", currentForm); final String message = org.andromda.presentation.jsf2.Messages.get( org.andromda.presentation.jsf2.PatternMatchingExceptionHandler.instance().handleException(throwable), null); this.addErrorMessage(message); @@ -379,7 +356,6 @@ } catch (final Throwable throwable) { - contextWrapper.getCurrentInstance().getPageFlowScope().put("form", currentForm); this.addExceptionMessage(throwable); } return null; @@ -402,10 +378,6 @@ protected ${manageable.formBeanType} getForm() { - // - we do this in the case a button that submitted the form was set to immediate (this should be removed - // when we found a better way to handle this). - final javax.faces.component.UIForm uiForm = this.findForm(this.getContext().getViewRoot(), "${manageable.formBeanName}"); - this.populateComponentInputs(uiForm); return (${manageable.formBeanType})this.resolveVariable("${manageable.formBeanName}"); } @@ -465,28 +437,8 @@ */ protected java.lang.Object resolveVariable(final String name) { - org.apache.myfaces.trinidad.context.RequestContext adfContext = org.apache.myfaces.trinidad.context.RequestContext.getCurrentInstance(); - Object variable = adfContext.getPageFlowScope().get(name); - // - if we couldn't get the variable from the regular ADF context, see if - // the session contains an ADF context with the variable - if (variable == null) - { - final javax.servlet.http.HttpSession session = this.getSession(false); - if (session != null) - { - final ${managedBeansPackage}.AdfFacesContextWrapper contextWrapper = - (${managedBeansPackage}.AdfFacesContextWrapper)session.getAttribute("$adfContextAttributeName"); - adfContext = contextWrapper != null ? contextWrapper.getCurrentInstance() : null; - } - variable = adfContext != null ? adfContext.getPageFlowScope().get(name) : null; - } - // - finally try resolving it in the standard JSF manner - if (variable == null) - { final javax.faces.context.FacesContext context = this.getContext(); - variable = context != null ? context.getApplication().getVariableResolver().resolveVariable(context, name) : null; - } - return variable; + return context.getApplication().getVariableResolver().resolveVariable(context, name); } /** @@ -580,15 +532,6 @@ } /** - * Copies all matching properties from the <code>fromForm</code> to the given - * <code>toForm</code> overridding any previously set values. - */ - protected void copyForm(final Object fromForm, final Object toForm) - { - ${managedBeansPackage}.${formPopulatorName}.populateForm(fromForm, toForm, true); - } - - /** * Populates the form from the given parameters. If the request parameter is null or an empty * string, then null is placed on the form. * @@ -645,80 +588,4 @@ } } - /** - * Finds the form (if one is present) on the given <code>component</code> having the given - * <code>id</code>. - * - * @param component the component to search. - * @param id the id of the form. - * @return the form or null if none was found. - */ - private javax.faces.component.UIForm findForm(javax.faces.component.UIComponent component, String id) - { - javax.faces.component.UIForm foundForm = null; - if (component != null) - { - for (final java.util.Iterator iterator = component.getFacetsAndChildren(); iterator.hasNext();) - { - final Object object = iterator.next(); - if (object instanceof javax.faces.component.UIComponent) - { - final javax.faces.component.UIComponent uiComponent = (javax.faces.component.UIComponent)object; - if (uiComponent instanceof javax.faces.component.UIForm) - { - final javax.faces.component.UIForm form = (javax.faces.component.UIForm)uiComponent; - if (form.getId().equals(id)) - { - foundForm = form; - break; - } - } - foundForm = this.findForm(uiComponent, id); - if (foundForm != null) - { - break; - } - } - } - } - return foundForm; - } - - /** - * If the given <code>component</code> has an child input elements, this method findds - * them all and populates them. This is to get around the fact that when immediate is set to true - * on a button that submits the form that the form isn't populated. - * - * @param component the component to populate. - */ - private void populateComponentInputs(javax.faces.component.UIComponent component) - { - if (component != null) - { - for (final java.util.Iterator iterator = component.getFacetsAndChildren(); iterator.hasNext();) - { - final javax.faces.component.UIComponent uiComponent = (javax.faces.component.UIComponent)iterator.next(); - if (uiComponent instanceof javax.faces.component.UIInput) - { - try - { - final javax.faces.component.UIInput input = (javax.faces.component.UIInput)uiComponent; - input.validate(this.getContext()); - input.updateModel(this.getContext()); - } - catch (javax.faces.validator.ValidatorException exception) - { - // - ignore, no value is set (validate will be called by the regular - // JSF lifecycle processing anyway, this is just called to populate the - // local value - } - } - else - { - this.populateComponentInputs(uiComponent); - } - } - } - } - } \ No newline at end of file |
From: Walter M. <wal...@us...> - 2007-01-11 17:35:22
|
User: walterim Date: 07/01/11 09:35:19 Modified: andromda-jsf2/src/main/resources/META-INF/andromda cartridge.xml andromda-jsf2/src/main/resources/templates/jsf2/configuration web.xml.vsl Removed: andromda-jsf2/src/main/resources/templates/jsf2/flow/crud ActionForward.java.vsl Log: Removing the crud action forward. Revision Changes Path 1.3 +13 -12 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.2 retrieving revision 1.3 diff -u -w -r1.2 -r1.3 --- cartridge.xml 11 Dec 2006 13:43:58 -0000 1.2 +++ cartridge.xml 11 Jan 2007 17:35:19 -0000 1.3 @@ -933,18 +933,6 @@ <!-- manageable --> <template - path="templates/jsf2/flow/crud/ActionForward.java.vsl" - outputPattern="$generatedFile" - outlet="controllers" - overwrite="true"> - <modelElements variable="manageable"> - <modelElement> - <type name="org.andromda.cartridges.jsf2.metafacades.JSFManageableEntity"/> - </modelElement> - </modelElements> - </template> - - <template path="templates/jsf2/controllers/crud/Controller.java.vsl" outputPattern="$generatedFile" outlet="controllers" @@ -993,6 +981,19 @@ </template> <template + path="templates/jsf2/views/facelets/crud/crud-index.xhtml.vsl" + outputPattern="crud-index.xhtml" + outlet="views" + overwrite="true" + outputToSingleFile="true"> + <modelElements> + <modelElement variable="manageables"> + <type name="org.andromda.cartridges.jsf2.metafacades.JSFManageableEntity"/> + </modelElement> + </modelElements> + </template> + + <template path="templates/jsf2/views/facelets/crud/view.xhtml.vsl" outputPattern="$generatedFile" outlet="views" 1.4 +0 -12 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.3 retrieving revision 1.4 diff -u -w -r1.3 -r1.4 --- web.xml.vsl 19 Dec 2006 09:15:41 -0000 1.3 +++ web.xml.vsl 11 Jan 2007 17:35:19 -0000 1.4 @@ -279,12 +279,6 @@ <servlet-class>$useCase.fullyQualifiedActionClassName</servlet-class> </servlet> #end -#foreach ($manageable in $manageables) - <servlet> - <servlet-name>$manageable.actionType</servlet-name> - <servlet-class>$manageable.actionType</servlet-class> - </servlet> -#end <servlet> <servlet-name>AndroMDA JSF Servlet</servlet-name> <servlet-class>org.andromda.cartridges.jsf2.JSFServlet</servlet-class> @@ -317,12 +311,6 @@ <url-pattern>${useCase.path}.${facesServletExtension}</url-pattern> </servlet-mapping> #end -#foreach ($manageable in $manageables) - <servlet-mapping> - <servlet-name>$manageable.actionType</servlet-name> - <url-pattern>${manageable.actionFullPath}.${facesServletExtension}</url-pattern> - </servlet-mapping> -#end <!-- servlet-mapping merge-point --> <session-config> <session-timeout>$sessionTimeout</session-timeout> |
From: Chris M. <cm...@us...> - 2007-01-11 16:55:32
|
User: cmicali Date: 07/01/11 08:55:29 Modified: andromda-aspdotnet/src/test/expected cartridge-output.zip Log: - Fixed failing tests Revision Changes Path 1.6 +55 -53 cartridges/andromda-aspdotnet/src/test/expected/cartridge-output.zip <<Binary file>> |
From: Chris M. <cm...@us...> - 2007-01-10 22:57:07
|
User: cmicali Date: 07/01/10 14:57:05 Added: etc/andromda-dotnet/AndroMDA.ScenarioUnit/AndroMDA.ScenarioUnit/Properties AssemblyInfo.cs Log: - Initial import Revision Changes Path 1.1 plugins/etc/andromda-dotnet/AndroMDA.ScenarioUnit/AndroMDA.ScenarioUnit/Properties/AssemblyInfo.cs Index: AssemblyInfo.cs =================================================================== using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("AndroMDA.ScenarioUnit")] [assembly: AssemblyDescription("A scenario-based unit testing framework built over NUnit.")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("AndroMDA.org")] [assembly: AssemblyProduct("AndroMDA.ScenarioUnit")] [assembly: AssemblyCopyright("")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("65474fc6-d2ae-4533-a91f-dca92e788584")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Revision and Build Numbers // by using the '*' as shown below: [assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")] |
From: Chris M. <cm...@us...> - 2007-01-10 22:56:52
|
User: cmicali Date: 07/01/10 14:56:53 Added: etc/andromda-dotnet/AndroMDA.ScenarioUnit/AndroMDA.ScenarioUnit.Tests AndroMDA.ScenarioUnit.Tests.csproj App.config TestDerivedObject.cs TestException.cs TestObject.cs TestScenarioHelperTests.cs etc/andromda-dotnet/AndroMDA.ScenarioUnit/AndroMDA.ScenarioUnit.Tests/Properties AssemblyInfo.cs etc/andromda-dotnet/AndroMDA.ScenarioUnit/AndroMDA.ScenarioUnit.Tests/testdata/actual_output/TestScenarioHelperTests Placeholder.txt etc/andromda-dotnet/AndroMDA.ScenarioUnit/AndroMDA.ScenarioUnit.Tests/testdata/expected_output/TestScenarioHelperTests GetMultipleTestObjects_MultipleReturnParameters.xml GetMultipleTestObjects_MultipleReturnParameters_derivedChildObj.xml GetTestObjectCollection_CollectionParameters.xml GetTestObjectList_ListParameter.xml GetTestObjectWithId_PrimitiveInputParameter.xml GetTestObject_NoInputParameter.xml ProcessMixedAsserters_CodeAssertionFailure.xml ProcessMixedAsserters_XMLAssertionFailure.xml ProcessMixedAsserters_default.xml ProcessMultipleTestObjects_MultipleInputParameters.xml ProcessTestObject_NoIgnoreRules.xml ProcessTestObject_NoRulesFile.xml ProcessTestObject_default.xml etc/andromda-dotnet/AndroMDA.ScenarioUnit/AndroMDA.ScenarioUnit.Tests/testdata/input/TestScenarioHelperTests GetMultipleTestObjects_MultipleReturnParameters_parentObj.xml GetTestObjectCollection_CollectionParameters_ids.xml GetTestObjectList_ListParameter_ids.xml GetTestObjectWithId_PrimitiveInputParameter_id.xml ProcessMixedDataProviders_default_testObject.xml ProcessMultipleTestObjects_MultipleInputParameters_baseChildObj.xml ProcessMultipleTestObjects_MultipleInputParameters_derivedChildObj.xml ProcessMultipleTestObjects_MultipleInputParameters_parentObj.xml ProcessTestObject_NoExpectedOutputFile_testObj.xml ProcessTestObject_NoIgnoreRules_testObj.xml ProcessTestObject_NoRulesFile_testObj.xml ProcessTestObject_default_testObj.xml TestObject.xml etc/andromda-dotnet/AndroMDA.ScenarioUnit/AndroMDA.ScenarioUnit.Tests/testdata/rules/TestScenarioHelperTests ProcessTestObject_NoIgnoreRules.xml ProcessTestObject_default.xml etc/andromda-dotnet/AndroMDA.ScenarioUnit AndroMDA.ScenarioUnit.sln etc/andromda-dotnet/AndroMDA.ScenarioUnit/AndroMDA.ScenarioUnit AndroMDA.ScenarioUnit.csproj CodeAsserterAttribute.cs CodeDataProviderAttribute.cs IAsserter.cs IDataProvider.cs TestScenarioHelper.cs XMLAsserterAttribute.cs XMLDataProviderAttribute.cs Log: - Initial import Revision Changes Path 1.1 plugins/etc/andromda-dotnet/AndroMDA.ScenarioUnit/AndroMDA.ScenarioUnit.Tests/AndroMDA.ScenarioUnit.Tests.csproj Index: AndroMDA.ScenarioUnit.Tests.csproj =================================================================== <Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <PropertyGroup> <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> <ProductVersion>8.0.50727</ProductVersion> <SchemaVersion>2.0</SchemaVersion> <ProjectGuid>{B17535E8-28F0-481A-845F-A383F53BF0C1}</ProjectGuid> <OutputType>Library</OutputType> <AppDesignerFolder>Properties</AppDesignerFolder> <RootNamespace>AndroMDA.ScenarioUnit.Tests</RootNamespace> <AssemblyName>AndroMDA.ScenarioUnit.Tests</AssemblyName> </PropertyGroup> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> <DebugSymbols>true</DebugSymbols> <DebugType>full</DebugType> <Optimize>false</Optimize> <OutputPath>bin\Debug\</OutputPath> <DefineConstants>DEBUG;TRACE</DefineConstants> <ErrorReport>prompt</ErrorReport> <WarningLevel>4</WarningLevel> <UseVSHostingProcess>true</UseVSHostingProcess> </PropertyGroup> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> <DebugType>pdbonly</DebugType> <Optimize>true</Optimize> <OutputPath>bin\Release\</OutputPath> <DefineConstants>TRACE</DefineConstants> <ErrorReport>prompt</ErrorReport> <WarningLevel>4</WarningLevel> </PropertyGroup> <ItemGroup> <Reference Include="nunit.core, Version=2.2.8.0, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77, processorArchitecture=MSIL"> <SpecificVersion>False</SpecificVersion> <HintPath>..\..\Lib\nunit.core.dll</HintPath> </Reference> <Reference Include="nunit.framework, Version=2.2.8.0, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77, processorArchitecture=MSIL"> <SpecificVersion>False</SpecificVersion> <HintPath>..\..\Lib\nunit.framework.dll</HintPath> </Reference> <Reference Include="System" /> <Reference Include="System.configuration" /> <Reference Include="System.Data" /> <Reference Include="System.Xml" /> </ItemGroup> <ItemGroup> <Compile Include="TestDerivedObject.cs" /> <Compile Include="TestException.cs" /> <Compile Include="TestObject.cs" /> <Compile Include="TestScenarioHelperTests.cs" /> <Compile Include="Properties\AssemblyInfo.cs" /> </ItemGroup> <ItemGroup> <None Include="App.config" /> </ItemGroup> <ItemGroup> <ProjectReference Include="..\AndroMDA.ScenarioUnit\AndroMDA.ScenarioUnit.csproj"> <Project>{0133CF39-2F87-45EB-8E8E-81C3A154FC15}</Project> <Name>AndroMDA.ScenarioUnit</Name> </ProjectReference> </ItemGroup> <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /> <!-- To modify your build process, add your task inside one of the targets below and uncomment it. Other similar extension points exist, see Microsoft.Common.targets. <Target Name="BeforeBuild"> </Target> <Target Name="AfterBuild"> </Target> --> </Project> 1.1 plugins/etc/andromda-dotnet/AndroMDA.ScenarioUnit/AndroMDA.ScenarioUnit.Tests/App.config Index: App.config =================================================================== <?xml version="1.0" encoding="utf-8" ?> <configuration> <runtime> <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> <dependentAssembly> <assemblyIdentity name="nunit.framework" publicKeyToken="96d09a1eb7f44a77" culture="Neutral" /> <bindingRedirect oldVersion="2.0.6.0" newVersion="2.2.8.0" /> <bindingRedirect oldVersion="2.1.4.0" newVersion="2.2.8.0" /> <bindingRedirect oldVersion="2.2.0.0" newVersion="2.2.8.0" /> </dependentAssembly> </assemblyBinding> </runtime> <appSettings> <add key="TestDataInputDir" value="../../testdata/input"/> <add key="TestDataExpectedOutputDir" value="../../testdata/expected_output"/> <add key="TestDataActualOutputDir" value="../../testdata/actual_output"/> <add key="TestDataRulesDir" value="../../testdata/rules"/> </appSettings> </configuration> 1.1 plugins/etc/andromda-dotnet/AndroMDA.ScenarioUnit/AndroMDA.ScenarioUnit.Tests/TestDerivedObject.cs Index: TestDerivedObject.cs =================================================================== using System; using System.Xml; using System.Xml.Serialization; using System.Collections.Generic; using System.Text; namespace AndroMDA.ScenarioUnit.Tests.TestData.Derived { public class TestDerivedObject: AndroMDA.ScenarioUnit.Tests.TestData.Base.TestObject { string middleInitial; public string MiddleInitial { get {return middleInitial;} set {middleInitial = value;} } } } 1.1 plugins/etc/andromda-dotnet/AndroMDA.ScenarioUnit/AndroMDA.ScenarioUnit.Tests/TestException.cs Index: TestException.cs =================================================================== using System; using System.Collections.Generic; using System.Text; namespace AndroMDA.ScenarioUnit.Tests { class TestException: System.Exception { } } 1.1 plugins/etc/andromda-dotnet/AndroMDA.ScenarioUnit/AndroMDA.ScenarioUnit.Tests/TestObject.cs Index: TestObject.cs =================================================================== using System; using System.Xml.Serialization; using AndroMDA.ScenarioUnit.Tests.TestData.Derived; namespace AndroMDA.ScenarioUnit.Tests.TestData.Base { [XmlInclude(typeof(TestDerivedObject))] [Serializable] public class TestObject { int id; string firstName; string lastName; TestObject child; public int Id { get { return id; } set { id = value; } } public string FirstName { get { return firstName; } set { firstName = value; } } public string LastName { get { return lastName; } set { lastName = value; } } public TestObject Child { get { return child; } set { child = value; } } } } 1.1 plugins/etc/andromda-dotnet/AndroMDA.ScenarioUnit/AndroMDA.ScenarioUnit.Tests/TestScenarioHelperTests.cs Index: TestScenarioHelperTests.cs =================================================================== using System; using System.Collections; using System.Collections.Generic; using System.Reflection; using System.Text; using System.Configuration; using System.IO; using System.Xml; using System.Xml.Serialization; using NUnit.Framework; using AndroMDA.ScenarioUnit; using AndroMDA.ScenarioUnit.Tests.TestData.Base; using AndroMDA.ScenarioUnit.Tests.TestData.Derived; namespace AndroMDA.ScenarioUnit.Tests { [TestFixture] [XMLDataProvider(InputDir = "TestScenarioHelperTests")] [XMLAsserter(ActualOutputDir = "TestScenarioHelperTests", ExpectedOutputDir = "TestScenarioHelperTests", RulesDir = "TestScenarioHelperTests")] public class TestScenarioHelperTests { #region TestInvoke [Test] public void TestInvoke() { TestScenarioHelper.Invoke("ProcessTestObject", "default", this); } [Test] [ExpectedException(typeof(FileNotFoundException))] public void TestInvokeNoInputFile() { TestScenarioHelper.Invoke("ProcessTestObject", "NoInputFile", this); } [Test] [ExpectedException(typeof(FileNotFoundException))] public void TestInvokeNoExpectedOutputFile() { TestScenarioHelper.Invoke("ProcessTestObject", "NoExpectedOutputFile", this); } [Test] public void TestInvokeNoRulesFile() { TestScenarioHelper.Invoke("ProcessTestObject", "NoRulesFile", this); } [Test] public void TestInvokeNoIgnoreRules() { TestScenarioHelper.Invoke("ProcessTestObject", "NoIgnoreRules", this); } private TestObject ProcessTestObject(TestObject testObj) { testObj.Id = 100; return testObj; } #endregion #region TestInvokeMultipleParameters [Test] public void TestInvokeMultipleInputParameters() { TestScenarioHelper.Invoke("ProcessMultipleTestObjects", "MultipleInputParameters", this); } private TestObject ProcessMultipleTestObjects(TestObject parentObj, TestObject baseChildObj, TestDerivedObject derivedChildObj) { parentObj.Id = 100; parentObj.Child = baseChildObj; baseChildObj.Child = derivedChildObj; return parentObj; } #endregion #region TestInvokeNoInputParameter [Test] public void TestInvokeNoInputParameter() { TestScenarioHelper.Invoke("GetTestObject", "NoInputParameter", this); } private TestObject GetTestObject() { TestObject testObj = new TestObject(); testObj.FirstName = "a"; testObj.LastName = "b"; return testObj; } #endregion #region TestInvokePrimitiveInputParameter [Test] public void TestInvokePrimitiveInputParameter() { TestScenarioHelper.Invoke("GetTestObjectWithId", "PrimitiveInputParameter", this); } private TestObject GetTestObjectWithId(int id) { TestObject testObj = new TestObject(); testObj.Id = id; testObj.FirstName = "a"; testObj.LastName = "b"; return testObj; } #endregion #region TestInvokeNoReturnParameter [Test] public void TestInvokeNoReturnParameter() { TestScenarioHelper.Invoke("NoReturn", "NoReturnParameter", this); } private void NoReturn() { return; } #endregion #region TestInvokeMultipleReturnParameters [Test] public void TestInvokeMultipleReturnParameters() { TestScenarioHelper.Invoke("GetMultipleTestObjects", "MultipleReturnParameters", this); } private TestObject GetMultipleTestObjects(TestObject parentObj, out TestDerivedObject derivedChildObj) { derivedChildObj = (TestDerivedObject)parentObj.Child; return parentObj; } #endregion #region TestInvokeCollectionParameters [Test] public void TestInvokeCollectionParameters() { TestScenarioHelper.Invoke("GetTestObjectCollection", "CollectionParameters", this); TestScenarioHelper.Invoke("GetTestObjectList", "ListParameter", this); } private TestObject[] GetTestObjectCollection(int[] ids) { TestObject[] tos = new TestObject[10]; for (int i = 0; i < ids.Length && i < 10; ++i) { TestObject to = new TestObject(); to.FirstName = ids[i].ToString(); to.LastName = string.Format("{0}", (ids[i] + 100)); tos[i] = to; } return tos; } private List<TestObject> GetTestObjectList(int[] ids) { List<TestObject> tos = new List<TestObject>(); for (int i = 0; i < ids.Length && i < 10; ++i) { TestObject to = new TestObject(); to.FirstName = ids[i].ToString(); to.LastName = string.Format("{0}", (ids[i] + 100)); tos.Add(to); } return tos; } #endregion #region TestBusinessException [Test] [ExpectedException(typeof(TestException))] public void TestBusinessException() { TestScenarioHelper.Invoke("ExceptionThrower", "default", this); } private void ExceptionThrower() { throw new TestException(); } #endregion #region TestCodeDataProvider [Test] public void TestCodeDataProvider() { TestScenarioHelper.Invoke("ProcessCodeBasedTestObject", "default", this); } [CodeDataProvider] private void ProcessCodeBasedTestObject(TestObject codeBasedTestObject) { Assert.IsNotNull(codeBasedTestObject); } private object ProcessCodeBasedTestObject_codeBasedTestObject_data(ParameterInfo pinfo, string methodName, string scenarioName) { return new TestObject(); } #endregion #region TestNamedCodeDataProvider [Test] public void TestNamedCodeDataProvider() { TestScenarioHelper.Invoke("ProcessTestObjectFromNamedMethod", "default", this); } [CodeDataProvider(DataMethodName = "TestObjectProvider")] private void ProcessTestObjectFromNamedMethod(TestObject testObject, TestDerivedObject derivedObject) { Assert.IsNotNull(testObject); Assert.IsNotNull(derivedObject); } private object TestObjectProvider(ParameterInfo pinfo, string methodName, string scenarioName) { if (pinfo.ParameterType == typeof(TestObject)) { return new TestObject(); } else if (pinfo.ParameterType == typeof(TestDerivedObject)) { return new TestDerivedObject(); } else { return null; } } #endregion #region TestMixedDataProviders [Test] public void TestMixedDataProvider() { TestScenarioHelper.Invoke("ProcessMixedDataProviders", "default", this); } [XMLDataProvider(InputDir = "TestScenarioHelperTests")] private void ProcessMixedDataProviders(TestObject testObject, [CodeDataProvider] TestDerivedObject derivedObject) { Assert.IsNotNull(testObject); Assert.IsNotNull(derivedObject); } private object ProcessMixedDataProviders_derivedObject_data(ParameterInfo pinfo, string methodName, string scenarioName) { return new TestDerivedObject(); } #endregion #region TestCodeAsserter [Test] public void TestCodeAsserter() { TestScenarioHelper.Invoke("ProcessTestObjectForCodeAssertion", "default", this); } [Test] [ExpectedException(typeof(AssertionException))] public void TestCodeAsserterFailure() { TestScenarioHelper.Invoke("ProcessTestObjectForCodeAssertion", "AssertionFailure", this); } [CodeAsserter] private TestObject ProcessTestObjectForCodeAssertion() { return new TestObject(); } private void ProcessTestObjectForCodeAssertion_Assert(object outputObj, ParameterInfo pInfo, string methodName, string scenarioName) { switch (scenarioName) { case "default": { TestObject testObject = (TestObject)outputObj; Assert.IsNotNull(testObject); break; } case "AssertionFailure": { Assert.IsNull(outputObj); break; } } } #endregion #region TestNamedCodeAsserter [Test] public void TestNamedCodeAsserter() { TestScenarioHelper.Invoke("ProcessTestObjectForNamedCodeAsserter", "scenario1", this); } [CodeAsserter(AsserterMethodName = "TestObjectAsserter")] private TestObject ProcessTestObjectForNamedCodeAsserter(out TestDerivedObject derivedObj) { TestObject testObj = new TestObject(); testObj.FirstName = "manish"; derivedObj = new TestDerivedObject(); derivedObj.FirstName = "derived"; derivedObj.MiddleInitial = "m"; return testObj; } private void TestObjectAsserter(object outputObj, ParameterInfo pinfo, string methodName, string scenarioName) { switch (scenarioName) { case "scenario1": { if (string.IsNullOrEmpty(pinfo.Name)) { Assert.AreEqual("manish", ((TestObject)outputObj).FirstName); } else if (pinfo.Name == "derivedObj") { Assert.AreEqual("m", ((TestDerivedObject)outputObj).MiddleInitial); } else { Assert.Fail("invalid return type"); } break; } default: { Assert.Fail("invalid scenarioname"); break; } } } #endregion #region TestMixedAsserters [Test] public void TestMixedAsserters() { TestScenarioHelper.Invoke("ProcessMixedAsserters", "default", this); } [Test] [ExpectedException(typeof(AssertionException))] public void TestProcessMixedAssertersXMLAssertionFailure() { TestScenarioHelper.Invoke("ProcessMixedAsserters", "XMLAssertionFailure", this); } [Test] [ExpectedException(typeof(AssertionException))] public void TestProcessMixedAssertersCodeAssertionFailure() { TestScenarioHelper.Invoke("ProcessMixedAsserters", "CodeAssertionFailure", this); } private TestObject ProcessMixedAsserters( [CodeAsserter] out TestDerivedObject derivedObject) { TestObject testObj = new TestObject(); testObj.FirstName = "manish"; derivedObject = new TestDerivedObject(); derivedObject.FirstName = "derived"; derivedObject.MiddleInitial = "m"; return testObj; } private void ProcessMixedAsserters_derivedObject_Assert(object outputObj, ParameterInfo pinfo, string methodName, string scenarioName) { switch(scenarioName) { case "default": Assert.AreEqual("m", ((TestDerivedObject)outputObj).MiddleInitial); break; case "CodeAssertionFailure": Assert.Fail("failing derived object assertion."); break; } } #endregion } } 1.1 plugins/etc/andromda-dotnet/AndroMDA.ScenarioUnit/AndroMDA.ScenarioUnit.Tests/Properties/AssemblyInfo.cs Index: AssemblyInfo.cs =================================================================== using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("AndroMDA.ScenarioUnit.Tests")] [assembly: AssemblyDescription("This assembly contains unit tests for the AndroMDA.ScenarioUnit assembly.")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("AndroMDA.org")] [assembly: AssemblyProduct("AndroMDA.ScenarioUnit.Tests")] [assembly: AssemblyCopyright("")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("993676be-6a6b-4863-8544-809644564c47")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Revision and Build Numbers // by using the '*' as shown below: [assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")] 1.1 plugins/etc/andromda-dotnet/AndroMDA.ScenarioUnit/AndroMDA.ScenarioUnit.Tests/testdata/actual_output/TestScenarioHelperTests/Placeholder.txt <<Binary file>> 1.1 plugins/etc/andromda-dotnet/AndroMDA.ScenarioUnit/AndroMDA.ScenarioUnit.Tests/testdata/expected_output/TestScenarioHelperTests/GetMultipleTestObjects_MultipleReturnParameters.xml Index: GetMultipleTestObjects_MultipleReturnParameters.xml =================================================================== <?xml version="1.0" encoding="utf-8"?> <TestObject xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <Id>0</Id> <FirstName>a</FirstName> <LastName>b</LastName> <Child xsi:type="TestDerivedObject"> <Id>0</Id> <FirstName>c</FirstName> <LastName>e</LastName> <MiddleInitial>d</MiddleInitial> </Child> </TestObject> 1.1 plugins/etc/andromda-dotnet/AndroMDA.ScenarioUnit/AndroMDA.ScenarioUnit.Tests/testdata/expected_output/TestScenarioHelperTests/GetMultipleTestObjects_MultipleReturnParameters_derivedChildObj.xml Index: GetMultipleTestObjects_MultipleReturnParameters_derivedChildObj.xml =================================================================== <?xml version="1.0" encoding="utf-8"?> <TestDerivedObject xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <Id>0</Id> <FirstName>c</FirstName> <LastName>e</LastName> <MiddleInitial>d</MiddleInitial> </TestDerivedObject> 1.1 plugins/etc/andromda-dotnet/AndroMDA.ScenarioUnit/AndroMDA.ScenarioUnit.Tests/testdata/expected_output/TestScenarioHelperTests/GetTestObjectCollection_CollectionParameters.xml Index: GetTestObjectCollection_CollectionParameters.xml =================================================================== <?xml version="1.0" encoding="utf-8"?> <ArrayOfTestObject xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <TestObject> <Id>0</Id> <FirstName>0</FirstName> <LastName>100</LastName> </TestObject> <TestObject> <Id>0</Id> <FirstName>1</FirstName> <LastName>101</LastName> </TestObject> <TestObject> <Id>0</Id> <FirstName>2</FirstName> <LastName>102</LastName> </TestObject> <TestObject> <Id>0</Id> <FirstName>3</FirstName> <LastName>103</LastName> </TestObject> <TestObject> <Id>0</Id> <FirstName>4</FirstName> <LastName>104</LastName> </TestObject> <TestObject> <Id>0</Id> <FirstName>5</FirstName> <LastName>105</LastName> </TestObject> <TestObject> <Id>0</Id> <FirstName>6</FirstName> <LastName>106</LastName> </TestObject> <TestObject> <Id>0</Id> <FirstName>7</FirstName> <LastName>107</LastName> </TestObject> <TestObject> <Id>0</Id> <FirstName>8</FirstName> <LastName>108</LastName> </TestObject> <TestObject> <Id>0</Id> <FirstName>9</FirstName> <LastName>109</LastName> </TestObject> </ArrayOfTestObject> 1.1 plugins/etc/andromda-dotnet/AndroMDA.ScenarioUnit/AndroMDA.ScenarioUnit.Tests/testdata/expected_output/TestScenarioHelperTests/GetTestObjectList_ListParameter.xml Index: GetTestObjectList_ListParameter.xml =================================================================== <?xml version="1.0" encoding="utf-8"?> <ArrayOfTestObject xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <TestObject> <Id>0</Id> <FirstName>0</FirstName> <LastName>100</LastName> </TestObject> <TestObject> <Id>0</Id> <FirstName>1</FirstName> <LastName>101</LastName> </TestObject> <TestObject> <Id>0</Id> <FirstName>2</FirstName> <LastName>102</LastName> </TestObject> <TestObject> <Id>0</Id> <FirstName>3</FirstName> <LastName>103</LastName> </TestObject> <TestObject> <Id>0</Id> <FirstName>4</FirstName> <LastName>104</LastName> </TestObject> <TestObject> <Id>0</Id> <FirstName>5</FirstName> <LastName>105</LastName> </TestObject> <TestObject> <Id>0</Id> <FirstName>6</FirstName> <LastName>106</LastName> </TestObject> <TestObject> <Id>0</Id> <FirstName>7</FirstName> <LastName>107</LastName> </TestObject> <TestObject> <Id>0</Id> <FirstName>8</FirstName> <LastName>108</LastName> </TestObject> <TestObject> <Id>0</Id> <FirstName>9</FirstName> <LastName>109</LastName> </TestObject> </ArrayOfTestObject> 1.1 plugins/etc/andromda-dotnet/AndroMDA.ScenarioUnit/AndroMDA.ScenarioUnit.Tests/testdata/expected_output/TestScenarioHelperTests/GetTestObjectWithId_PrimitiveInputParameter.xml Index: GetTestObjectWithId_PrimitiveInputParameter.xml =================================================================== <?xml version="1.0" encoding="utf-8"?> <TestObject xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <Id>100</Id> <FirstName>a</FirstName> <LastName>b</LastName> </TestObject> 1.1 plugins/etc/andromda-dotnet/AndroMDA.ScenarioUnit/AndroMDA.ScenarioUnit.Tests/testdata/expected_output/TestScenarioHelperTests/GetTestObject_NoInputParameter.xml Index: GetTestObject_NoInputParameter.xml =================================================================== <?xml version="1.0" encoding="utf-8"?> <TestObject xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <Id>0</Id> <FirstName>a</FirstName> <LastName>b</LastName> </TestObject> 1.1 plugins/etc/andromda-dotnet/AndroMDA.ScenarioUnit/AndroMDA.ScenarioUnit.Tests/testdata/expected_output/TestScenarioHelperTests/ProcessMixedAsserters_CodeAssertionFailure.xml Index: ProcessMixedAsserters_CodeAssertionFailure.xml =================================================================== <?xml version="1.0" encoding="utf-8"?> <TestObject xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <Id>0</Id> <FirstName>manish</FirstName> </TestObject> 1.1 plugins/etc/andromda-dotnet/AndroMDA.ScenarioUnit/AndroMDA.ScenarioUnit.Tests/testdata/expected_output/TestScenarioHelperTests/ProcessMixedAsserters_XMLAssertionFailure.xml Index: ProcessMixedAsserters_XMLAssertionFailure.xml =================================================================== <?xml version="1.0" encoding="utf-8"?> <TestObject xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <Id>0</Id> <FirstName>other</FirstName> </TestObject> 1.1 plugins/etc/andromda-dotnet/AndroMDA.ScenarioUnit/AndroMDA.ScenarioUnit.Tests/testdata/expected_output/TestScenarioHelperTests/ProcessMixedAsserters_default.xml Index: ProcessMixedAsserters_default.xml =================================================================== <?xml version="1.0" encoding="utf-8"?> <TestObject xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <Id>0</Id> <FirstName>manish</FirstName> </TestObject> 1.1 plugins/etc/andromda-dotnet/AndroMDA.ScenarioUnit/AndroMDA.ScenarioUnit.Tests/testdata/expected_output/TestScenarioHelperTests/ProcessMultipleTestObjects_MultipleInputParameters.xml Index: ProcessMultipleTestObjects_MultipleInputParameters.xml =================================================================== <?xml version="1.0" encoding="utf-8"?> <TestObject xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <Id>100</Id> <FirstName>a</FirstName> <LastName>b</LastName> <Child> <Id>0</Id> <FirstName>c</FirstName> <LastName>d</LastName> <Child xsi:type="TestDerivedObject"> <Id>0</Id> <FirstName>e</FirstName> <LastName>g</LastName> <MiddleInitial>f</MiddleInitial> </Child> </Child> </TestObject> 1.1 plugins/etc/andromda-dotnet/AndroMDA.ScenarioUnit/AndroMDA.ScenarioUnit.Tests/testdata/expected_output/TestScenarioHelperTests/ProcessTestObject_NoIgnoreRules.xml Index: ProcessTestObject_NoIgnoreRules.xml =================================================================== <?xml version="1.0" encoding="utf-8"?> <TestObject xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <Id>100</Id> <FirstName>a</FirstName> <LastName>b</LastName> <Child xsi:type="TestDerivedObject"> <Id>0</Id> <FirstName>c</FirstName> <LastName>e</LastName> <MiddleInitial>d</MiddleInitial> </Child> </TestObject> 1.1 plugins/etc/andromda-dotnet/AndroMDA.ScenarioUnit/AndroMDA.ScenarioUnit.Tests/testdata/expected_output/TestScenarioHelperTests/ProcessTestObject_NoRulesFile.xml Index: ProcessTestObject_NoRulesFile.xml =================================================================== <?xml version="1.0" encoding="utf-8"?> <TestObject xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <Id>100</Id> <FirstName>a</FirstName> <LastName>b</LastName> <Child xsi:type="TestDerivedObject"> <Id>0</Id> <FirstName>c</FirstName> <LastName>e</LastName> <MiddleInitial>d</MiddleInitial> </Child> </TestObject> 1.1 plugins/etc/andromda-dotnet/AndroMDA.ScenarioUnit/AndroMDA.ScenarioUnit.Tests/testdata/expected_output/TestScenarioHelperTests/ProcessTestObject_default.xml Index: ProcessTestObject_default.xml =================================================================== <?xml version="1.0" encoding="utf-8"?> <TestObject xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <Id>0</Id> <FirstName>a</FirstName> <LastName>b</LastName> <Child xsi:type="TestDerivedObject"> <Id>0</Id> <FirstName>c</FirstName> <LastName>e</LastName> <MiddleInitial>d</MiddleInitial> </Child> </TestObject> 1.1 plugins/etc/andromda-dotnet/AndroMDA.ScenarioUnit/AndroMDA.ScenarioUnit.Tests/testdata/input/TestScenarioHelperTests/GetMultipleTestObjects_MultipleReturnParameters_parentObj.xml Index: GetMultipleTestObjects_MultipleReturnParameters_parentObj.xml =================================================================== <?xml version="1.0" encoding="utf-8"?> <TestObject xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <Id>0</Id> <FirstName>a</FirstName> <LastName>b</LastName> <Child xsi:type="TestDerivedObject"> <Id>0</Id> <FirstName>c</FirstName> <LastName>e</LastName> <MiddleInitial>d</MiddleInitial> </Child> </TestObject> 1.1 plugins/etc/andromda-dotnet/AndroMDA.ScenarioUnit/AndroMDA.ScenarioUnit.Tests/testdata/input/TestScenarioHelperTests/GetTestObjectCollection_CollectionParameters_ids.xml Index: GetTestObjectCollection_CollectionParameters_ids.xml =================================================================== <?xml version="1.0" encoding="utf-8"?> <ArrayOfInt xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <int>0</int> <int>1</int> <int>2</int> <int>3</int> <int>4</int> <int>5</int> <int>6</int> <int>7</int> <int>8</int> <int>9</int> <int>10</int> </ArrayOfInt> 1.1 plugins/etc/andromda-dotnet/AndroMDA.ScenarioUnit/AndroMDA.ScenarioUnit.Tests/testdata/input/TestScenarioHelperTests/GetTestObjectList_ListParameter_ids.xml Index: GetTestObjectList_ListParameter_ids.xml =================================================================== <?xml version="1.0" encoding="utf-8"?> <ArrayOfInt xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <int>0</int> <int>1</int> <int>2</int> <int>3</int> <int>4</int> <int>5</int> <int>6</int> <int>7</int> <int>8</int> <int>9</int> <int>10</int> </ArrayOfInt> 1.1 plugins/etc/andromda-dotnet/AndroMDA.ScenarioUnit/AndroMDA.ScenarioUnit.Tests/testdata/input/TestScenarioHelperTests/GetTestObjectWithId_PrimitiveInputParameter_id.xml Index: GetTestObjectWithId_PrimitiveInputParameter_id.xml =================================================================== <?xml version="1.0" encoding="utf-8"?> <int>100</int> 1.1 plugins/etc/andromda-dotnet/AndroMDA.ScenarioUnit/AndroMDA.ScenarioUnit.Tests/testdata/input/TestScenarioHelperTests/ProcessMixedDataProviders_default_testObject.xml Index: ProcessMixedDataProviders_default_testObject.xml =================================================================== <?xml version="1.0" encoding="utf-8"?> <TestObject xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <Id>0</Id> <FirstName>a</FirstName> <LastName>b</LastName> <Child xsi:type="TestDerivedObject"> <Id>0</Id> <FirstName>c</FirstName> <LastName>e</LastName> <MiddleInitial>d</MiddleInitial> </Child> </TestObject> 1.1 plugins/etc/andromda-dotnet/AndroMDA.ScenarioUnit/AndroMDA.ScenarioUnit.Tests/testdata/input/TestScenarioHelperTests/ProcessMultipleTestObjects_MultipleInputParameters_baseChildObj.xml Index: ProcessMultipleTestObjects_MultipleInputParameters_baseChildObj.xml =================================================================== <?xml version="1.0" encoding="utf-8"?> <TestObject xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <Id>0</Id> <FirstName>c</FirstName> <LastName>d</LastName> </TestObject> 1.1 plugins/etc/andromda-dotnet/AndroMDA.ScenarioUnit/AndroMDA.ScenarioUnit.Tests/testdata/input/TestScenarioHelperTests/ProcessMultipleTestObjects_MultipleInputParameters_derivedChildObj.xml Index: ProcessMultipleTestObjects_MultipleInputParameters_derivedChildObj.xml =================================================================== <?xml version="1.0" encoding="utf-8"?> <TestDerivedObject xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <Id>0</Id> <FirstName>e</FirstName> <MiddleInitial>f</MiddleInitial> <LastName>g</LastName> </TestDerivedObject> 1.1 plugins/etc/andromda-dotnet/AndroMDA.ScenarioUnit/AndroMDA.ScenarioUnit.Tests/testdata/input/TestScenarioHelperTests/ProcessMultipleTestObjects_MultipleInputParameters_parentObj.xml Index: ProcessMultipleTestObjects_MultipleInputParameters_parentObj.xml =================================================================== <?xml version="1.0" encoding="utf-8"?> <TestObject xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <Id>0</Id> <FirstName>a</FirstName> <LastName>b</LastName> </TestObject> 1.1 plugins/etc/andromda-dotnet/AndroMDA.ScenarioUnit/AndroMDA.ScenarioUnit.Tests/testdata/input/TestScenarioHelperTests/ProcessTestObject_NoExpectedOutputFile_testObj.xml Index: ProcessTestObject_NoExpectedOutputFile_testObj.xml =================================================================== <?xml version="1.0" encoding="utf-8"?> <TestObject xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <Id>0</Id> <FirstName>a</FirstName> <LastName>b</LastName> <Child xsi:type="TestDerivedObject"> <Id>0</Id> <FirstName>c</FirstName> <LastName>e</LastName> <MiddleInitial>d</MiddleInitial> </Child> </TestObject> 1.1 plugins/etc/andromda-dotnet/AndroMDA.ScenarioUnit/AndroMDA.ScenarioUnit.Tests/testdata/input/TestScenarioHelperTests/ProcessTestObject_NoIgnoreRules_testObj.xml Index: ProcessTestObject_NoIgnoreRules_testObj.xml =================================================================== <?xml version="1.0" encoding="utf-8"?> <TestObject xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <Id>100</Id> <FirstName>a</FirstName> <LastName>b</LastName> <Child xsi:type="TestDerivedObject"> <Id>0</Id> <FirstName>c</FirstName> <LastName>e</LastName> <MiddleInitial>d</MiddleInitial> </Child> </TestObject> 1.1 plugins/etc/andromda-dotnet/AndroMDA.ScenarioUnit/AndroMDA.ScenarioUnit.Tests/testdata/input/TestScenarioHelperTests/ProcessTestObject_NoRulesFile_testObj.xml Index: ProcessTestObject_NoRulesFile_testObj.xml =================================================================== <?xml version="1.0" encoding="utf-8"?> <TestObject xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <Id>0</Id> <FirstName>a</FirstName> <LastName>b</LastName> <Child xsi:type="TestDerivedObject"> <Id>0</Id> <FirstName>c</FirstName> <LastName>e</LastName> <MiddleInitial>d</MiddleInitial> </Child> </TestObject> 1.1 plugins/etc/andromda-dotnet/AndroMDA.ScenarioUnit/AndroMDA.ScenarioUnit.Tests/testdata/input/TestScenarioHelperTests/ProcessTestObject_default_testObj.xml Index: ProcessTestObject_default_testObj.xml =================================================================== <?xml version="1.0" encoding="utf-8"?> <TestObject xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <Id>0</Id> <FirstName>a</FirstName> <LastName>b</LastName> <Child xsi:type="TestDerivedObject"> <Id>0</Id> <FirstName>c</FirstName> <LastName>e</LastName> <MiddleInitial>d</MiddleInitial> </Child> </TestObject> 1.1 plugins/etc/andromda-dotnet/AndroMDA.ScenarioUnit/AndroMDA.ScenarioUnit.Tests/testdata/input/TestScenarioHelperTests/TestObject.xml Index: TestObject.xml =================================================================== <?xml version="1.0" encoding="utf-8"?> <TestObject xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <Id>0</Id> <FirstName>a</FirstName> <LastName>b</LastName> <Child xsi:type="TestDerivedObject"> <Id>0</Id> <FirstName>c</FirstName> <LastName>e</LastName> <MiddleInitial>d</MiddleInitial> </Child> </TestObject> 1.1 plugins/etc/andromda-dotnet/AndroMDA.ScenarioUnit/AndroMDA.ScenarioUnit.Tests/testdata/rules/TestScenarioHelperTests/ProcessTestObject_NoIgnoreRules.xml Index: ProcessTestObject_NoIgnoreRules.xml =================================================================== <?xml version="1.0" encoding="utf-8"?> <rules/> 1.1 plugins/etc/andromda-dotnet/AndroMDA.ScenarioUnit/AndroMDA.ScenarioUnit.Tests/testdata/rules/TestScenarioHelperTests/ProcessTestObject_default.xml Index: ProcessTestObject_default.xml =================================================================== <?xml version="1.0" encoding="utf-8"?> <rules> <ignore> <item>//Id</item> </ignore> </rules> 1.1 plugins/etc/andromda-dotnet/AndroMDA.ScenarioUnit/AndroMDA.ScenarioUnit.sln Index: AndroMDA.ScenarioUnit.sln ===================================================================  Microsoft Visual Studio Solution File, Format Version 9.00 # Visual Studio 2005 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AndroMDA.ScenarioUnit", "AndroMDA.ScenarioUnit\AndroMDA.ScenarioUnit.csproj", "{0133CF39-2F87-45EB-8E8E-81C3A154FC15}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AndroMDA.ScenarioUnit.Tests", "AndroMDA.ScenarioUnit.Tests\AndroMDA.ScenarioUnit.Tests.csproj", "{B17535E8-28F0-481A-845F-A383F53BF0C1}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU Release|Any CPU = Release|Any CPU EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution {0133CF39-2F87-45EB-8E8E-81C3A154FC15}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {0133CF39-2F87-45EB-8E8E-81C3A154FC15}.Debug|Any CPU.Build.0 = Debug|Any CPU {0133CF39-2F87-45EB-8E8E-81C3A154FC15}.Release|Any CPU.ActiveCfg = Release|Any CPU {0133CF39-2F87-45EB-8E8E-81C3A154FC15}.Release|Any CPU.Build.0 = Release|Any CPU {B17535E8-28F0-481A-845F-A383F53BF0C1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {B17535E8-28F0-481A-845F-A383F53BF0C1}.Debug|Any CPU.Build.0 = Debug|Any CPU {B17535E8-28F0-481A-845F-A383F53BF0C1}.Release|Any CPU.ActiveCfg = Release|Any CPU {B17535E8-28F0-481A-845F-A383F53BF0C1}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection EndGlobal 1.1 plugins/etc/andromda-dotnet/AndroMDA.ScenarioUnit/AndroMDA.ScenarioUnit/AndroMDA.ScenarioUnit.csproj Index: AndroMDA.ScenarioUnit.csproj =================================================================== <Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <PropertyGroup> <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> <ProductVersion>8.0.50727</ProductVersion> <SchemaVersion>2.0</SchemaVersion> <ProjectGuid>{0133CF39-2F87-45EB-8E8E-81C3A154FC15}</ProjectGuid> <OutputType>Library</OutputType> <AppDesignerFolder>Properties</AppDesignerFolder> <RootNamespace>AndroMDA.ScenarioUnit</RootNamespace> <AssemblyName>AndroMDA.ScenarioUnit</AssemblyName> </PropertyGroup> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> <DebugSymbols>true</DebugSymbols> <DebugType>full</DebugType> <Optimize>false</Optimize> <OutputPath>bin\debug\</OutputPath> <DefineConstants>DEBUG;TRACE</DefineConstants> <ErrorReport>prompt</ErrorReport> <WarningLevel>4</WarningLevel> <PlatformTarget>AnyCPU</PlatformTarget> </PropertyGroup> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> <DebugType>pdbonly</DebugType> <Optimize>true</Optimize> <OutputPath>bin\Release\</OutputPath> <DefineConstants>TRACE</DefineConstants> <ErrorReport>prompt</ErrorReport> <WarningLevel>4</WarningLevel> </PropertyGroup> <ItemGroup> <Reference Include="nunit.core, Version=2.2.8.0, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77, processorArchitecture=MSIL"> <SpecificVersion>False</SpecificVersion> <HintPath>..\..\Lib\nunit.core.dll</HintPath> </Reference> <Reference Include="nunit.framework, Version=2.2.8.0, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77, processorArchitecture=MSIL"> <SpecificVersion>False</SpecificVersion> <HintPath>..\..\Lib\nunit.framework.dll</HintPath> </Reference> <Reference Include="NXUnit.Framework, Version=1.0.0.19101, Culture=neutral"> <SpecificVersion>False</SpecificVersion> <HintPath>..\..\Lib\NXUnit.Framework.dll</HintPath> </Reference> <Reference Include="System" /> <Reference Include="System.configuration" /> <Reference Include="System.Data" /> <Reference Include="System.Xml" /> </ItemGroup> <ItemGroup> <Compile Include="CodeDataProviderAttribute.cs" /> <Compile Include="CodeAsserterAttribute.cs" /> <Compile Include="XMLAsserterAttribute.cs" /> <Compile Include="IAsserter.cs" /> <Compile Include="IDataProvider.cs" /> <Compile Include="TestScenarioHelper.cs" /> <Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="XMLDataProviderAttribute.cs" /> </ItemGroup> <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /> <!-- To modify your build process, add your task inside one of the targets below and uncomment it. Other similar extension points exist, see Microsoft.Common.targets. <Target Name="BeforeBuild"> </Target> <Target Name="AfterBuild"> </Target> --> </Project> 1.1 plugins/etc/andromda-dotnet/AndroMDA.ScenarioUnit/AndroMDA.ScenarioUnit/CodeAsserterAttribute.cs Index: CodeAsserterAttribute.cs =================================================================== using System; using System.Collections.Generic; using System.Text; using System.Reflection; namespace AndroMDA.ScenarioUnit { [AttributeUsage(AttributeTargets.Class|AttributeTargets.Method|AttributeTargets.Parameter)] public class CodeAsserterAttribute : Attribute, IAsserter { private string _asserterMethodName; public string AsserterMethodName { get { return _asserterMethodName; } set { _asserterMethodName = value; } } public void AssertOutput(Object outputObj, ParameterInfo pInfo, string methodName, string scenarioName, object testFixture) { if (string.IsNullOrEmpty(AsserterMethodName)) { if (string.IsNullOrEmpty(pInfo.Name)) { AsserterMethodName = string.Format("{0}_Assert", methodName); } else { AsserterMethodName = string.Format("{0}_{1}_Assert", methodName, pInfo.Name); } } MethodInfo mInfo = testFixture.GetType().GetMethod(AsserterMethodName, BindingFlags.NonPublic | BindingFlags.Instance| BindingFlags.IgnoreCase); object[] parameters = new object[] { outputObj, pInfo, methodName, scenarioName }; mInfo.Invoke(testFixture, parameters); } } } 1.1 plugins/etc/andromda-dotnet/AndroMDA.ScenarioUnit/AndroMDA.ScenarioUnit/CodeDataProviderAttribute.cs Index: CodeDataProviderAttribute.cs =================================================================== using System; using System.Collections.Generic; using System.Text; using System.Reflection; namespace AndroMDA.ScenarioUnit { [AttributeUsage(AttributeTargets.Class|AttributeTargets.Method|AttributeTargets.Parameter)] public class CodeDataProviderAttribute : Attribute, IDataProvider { private string _dataMethodName; public string DataMethodName { get { return _dataMethodName; } set { _dataMethodName = value; } } public object GetData(ParameterInfo pInfo, string methodName, string scenarioName, object testFixture) { if (string.IsNullOrEmpty(DataMethodName)) { DataMethodName = string.Format("{0}_{1}_Data", methodName, pInfo.Name); } MethodInfo mInfo = testFixture.GetType().GetMethod(DataMethodName, BindingFlags.NonPublic | BindingFlags.Instance| BindingFlags.IgnoreCase); object[] parameters = new object[] { pInfo, methodName, scenarioName }; return mInfo.Invoke(testFixture, parameters); } } } 1.1 plugins/etc/andromda-dotnet/AndroMDA.ScenarioUnit/AndroMDA.ScenarioUnit/IAsserter.cs Index: IAsserter.cs =================================================================== using System; using System.Reflection; namespace AndroMDA.ScenarioUnit { public interface IAsserter { void AssertOutput(Object outputObj, ParameterInfo pInfo, string methodName, string scenarioName, object testFixture); } } 1.1 plugins/etc/andromda-dotnet/AndroMDA.ScenarioUnit/AndroMDA.ScenarioUnit/IDataProvider.cs Index: IDataProvider.cs =================================================================== using System; using System.Collections.Generic; using System.Text; using System.Reflection; namespace AndroMDA.ScenarioUnit { public interface IDataProvider { object GetData(ParameterInfo pInfo, string methodName, string scenarioName, object testFixture); } } 1.1 plugins/etc/andromda-dotnet/AndroMDA.ScenarioUnit/AndroMDA.ScenarioUnit/TestScenarioHelper.cs Index: TestScenarioHelper.cs =================================================================== using System; using System.Collections; using System.Collections.Generic; using System.Text; using System.Reflection; namespace AndroMDA.ScenarioUnit { public class TestScenarioHelper { /// <summary> /// The only public method of this class. /// this is called from test cases and does the following. /// Calls the method specified by the "methodName" attribute; /// passing in all input parameters after reading them from XML files on the disk. /// The following convention is used to determine the file name for reading in a parameter: /// methodName_scenarioName[_parameterName].xml /// The parameterName part is not present for files corresponding to the returned value from a method. /// The value returned from the method call, if any, is saved in XML format to /// a file. /// Next, for all output parameters and return values, assertions are performed by using the expected output XML files. These files are also loaded /// based on the naming convention specified above. /// Before comparing the actual and expected XML files, this method performs cleanup on the /// two XML documents and removes the nodes specified in the "rules" XML file. /// These are nodes like generated identifiers, date time fields etc. that cannot be specified in the expected output because these are determined at run time. /// The location of the four sets of files used in this process is specified by using the /// TestDataInputDir, TestDataExpectedOutputDir, TestDataActualOutputDir, and TestDataRulesDir key-value /// pairs in the configuration file of the test harness. /// </summary> /// <param name="methodName">The test method to execute. This must be a private instance method /// in the TestFixture class.</param> /// <param name="scenarioName">The test scenario.</param> /// <param name="testFixture">The class containing the test method.</param> public static void Invoke(string methodName, string scenarioName, Object testFixture) { MethodInfo mInfo = testFixture.GetType().GetMethod(methodName, BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.IgnoreCase); ParameterInfo[] pInfos = mInfo.GetParameters(); ParameterInfo returnParamInfo = mInfo.ReturnParameter; ArrayList allParameters = new ArrayList(); List<ParameterInfo> outParameters = new List<ParameterInfo>(); foreach (ParameterInfo pInfo in pInfos) { Object parameter = null; //Try to load a parameter from an XML //file only if it is an input parameter. //Otherwise, just add the parameterInfo for that parameter //into an array for assertion later. if (pInfo.IsOut) { outParameters.Add(pInfo); } else { IDataProvider dataProvider = GetDataProvider(testFixture, mInfo, pInfo); if (null != dataProvider) { parameter = dataProvider.GetData(pInfo, methodName, scenarioName, testFixture); } } //Add the parameter to the array to be used to call the method //irrespective of whether or not it is an out parameter. //For out parameters, a "null" is added in the array. //This is replaced by an actual object after the method is invoked. allParameters.Add(parameter); } //Call the test method. try { Object[] parameters = allParameters.ToArray(); Object returnObj = mInfo.Invoke(testFixture, parameters); //Save the returned value //and call the corresponding assertion only if the return type is not void. if (returnParamInfo.ParameterType.Name != "Void") { IAsserter outputAsserter = GetOutputAsserter(testFixture, mInfo, returnParamInfo); if (null != outputAsserter) { outputAsserter.AssertOutput(returnObj, returnParamInfo, methodName, scenarioName, testFixture); } } //Save the remaining out parameters and //call the corresponding assertions. foreach (ParameterInfo outPInfo in outParameters) { object outParameter = parameters[outPInfo.Position]; IAsserter outputAsserter = GetOutputAsserter(testFixture, mInfo, outPInfo); if (null != outputAsserter) { outputAsserter.AssertOutput(outParameter, outPInfo, me... [truncated message content] |
From: Chris M. <cm...@us...> - 2007-01-10 22:56:08
|
User: cmicali Date: 07/01/10 14:56:09 plugins/etc/andromda-dotnet/AndroMDA.ScenarioUnit/AndroMDA.ScenarioUnit.Tests/testdata/rules/TestScenarioHelperTests - New directory |
From: Chris M. <cm...@us...> - 2007-01-10 22:55:48
|
User: cmicali Date: 07/01/10 14:55:49 plugins/etc/andromda-dotnet/AndroMDA.ScenarioUnit/AndroMDA.ScenarioUnit.Tests/testdata/input/TestScenarioHelperTests - New directory |
From: Chris M. <cm...@us...> - 2007-01-10 22:55:28
|
User: cmicali Date: 07/01/10 14:55:28 plugins/etc/andromda-dotnet/AndroMDA.ScenarioUnit/AndroMDA.ScenarioUnit.Tests/testdata/expected_output/TestScenarioHelperTests - New directory |
From: Chris M. <cm...@us...> - 2007-01-10 22:55:07
|
User: cmicali Date: 07/01/10 14:55:07 plugins/etc/andromda-dotnet/AndroMDA.ScenarioUnit/AndroMDA.ScenarioUnit.Tests/testdata/actual_output/TestScenarioHelperTests - New directory |
From: Chris M. <cm...@us...> - 2007-01-10 22:54:52
|
User: cmicali Date: 07/01/10 14:54:53 plugins/etc/andromda-dotnet/AndroMDA.ScenarioUnit/AndroMDA.ScenarioUnit.Tests/testdata/rules - New directory |
From: Chris M. <cm...@us...> - 2007-01-10 22:54:52
|
User: cmicali Date: 07/01/10 14:54:53 plugins/etc/andromda-dotnet/AndroMDA.ScenarioUnit/AndroMDA.ScenarioUnit.Tests/testdata/input - New directory |
From: Chris M. <cm...@us...> - 2007-01-10 22:54:52
|
User: cmicali Date: 07/01/10 14:54:53 plugins/etc/andromda-dotnet/AndroMDA.ScenarioUnit/AndroMDA.ScenarioUnit.Tests/testdata/expected_output - New directory |
From: Chris M. <cm...@us...> - 2007-01-10 22:54:51
|
User: cmicali Date: 07/01/10 14:54:52 plugins/etc/andromda-dotnet/AndroMDA.ScenarioUnit/AndroMDA.ScenarioUnit.Tests/testdata/actual_output - New directory |
From: Chris M. <cm...@us...> - 2007-01-10 22:54:29
|
User: cmicali Date: 07/01/10 14:54:29 plugins/etc/andromda-dotnet/AndroMDA.ScenarioUnit/AndroMDA.ScenarioUnit.Tests/Properties - New directory |
From: Chris M. <cm...@us...> - 2007-01-10 22:54:29
|
User: cmicali Date: 07/01/10 14:54:29 plugins/etc/andromda-dotnet/AndroMDA.ScenarioUnit/AndroMDA.ScenarioUnit.Tests/testdata - New directory |
From: Chris M. <cm...@us...> - 2007-01-10 22:54:06
|
User: cmicali Date: 07/01/10 14:54:06 plugins/etc/andromda-dotnet/AndroMDA.ScenarioUnit/AndroMDA.ScenarioUnit/Properties - New directory |
From: Chris M. <cm...@us...> - 2007-01-10 22:53:57
|
User: cmicali Date: 07/01/10 14:53:55 plugins/etc/andromda-dotnet/AndroMDA.ScenarioUnit/AndroMDA.ScenarioUnit - New directory |
From: Chris M. <cm...@us...> - 2007-01-10 22:53:54
|
User: cmicali Date: 07/01/10 14:53:55 plugins/etc/andromda-dotnet/AndroMDA.ScenarioUnit/AndroMDA.ScenarioUnit.Tests - New directory |
From: Chris M. <cm...@us...> - 2007-01-10 22:53:40
|
User: cmicali Date: 07/01/10 14:53:41 plugins/etc/andromda-dotnet/AndroMDA.ScenarioUnit - New directory |
From: Lars B. <lb...@us...> - 2007-01-10 21:23:48
|
User: lbilger Date: 07/01/10 13:23:48 Modified: . pom.xml Added: andromda-eclipse-rcp/src/main/resources/resources/java/org/andromda/rcp/crud/core/model IEntityDeleteListener.java EntityDeletedEvent.java EntityChangedEvent.java AbstractModel.java PropertyChange.java IEntitySaveListener.java IEntityChangeListener.java EntitySavedEvent.java IModel.java andromda-eclipse-rcp/src/main/resources/templates/eclipsercp/crud/core PersistenceManager.java.vsl SearchCriteria.java.vsl Helper.java.vsl MANIFEST.MF.vsl Activator.java.vsl Model.java.vsl andromda-eclipse-rcp/src/main/resources/resources/icons edit.gif filter.gif new.gif refresh.gif search.gif andromda-eclipse-rcp/src/main/resources/templates/eclipsercp/crud/ui/edit EditorInput.java.vsl EditorInputFactory.java.vsl Editor.java.vsl EditorDialog.java.vsl EditorComposite.java.vsl andromda-eclipse-rcp/src/main/resources/resources/java/org/andromda/rcp/crud/core/util EqualitySet.java IdentityMapBackedEqualitySet.java IdentityWrapper.java MapBackedEqualitySet.java andromda-eclipse-rcp/src/main/resources/resources/java/org/andromda/rcp/crud/core/observable DirtyableObservableBean.java ObservableBean.java andromda-eclipse-rcp pom.xml .cvsignore andromda-eclipse-rcp/src/main/resources/resources/java/org/andromda/rcp/crud/core/dirty DirtyChangedEvent.java MultiDirtyTracker.java IDirtyChangeListener.java IDirtyNotifier.java INotifyingDirtyable.java DirtySupport.java IDirtyable.java andromda-eclipse-rcp/src/main/resources/templates/eclipsercp/crud/ui MANIFEST.MF.vsl plugin.properties.vsl plugin.xml.vsl Activator.java.vsl andromda-eclipse-rcp/src/main/resources/templates/eclipsercp/crud/ui/action DeleteAction.java.vsl NewAction.java.vsl FilterAction.java.vsl RefreshAction.java.vsl EditAction.java.vsl ListAction.java.vsl andromda-eclipse-rcp/src/main/resources/templates/eclipsercp/crud/ui/search FilterDialog.java.vsl SearchDialog.java.vsl TableComposite.java.vsl SearchCriteriaComposite.java.vsl SearchView.java.vsl Comparator.java.vsl andromda-eclipse-rcp/src/test/expected cartridge-output.zip andromda-eclipse-rcp/src/main/resources/resources/java/org/andromda/rcp/crud/core/persistence PersistenceManager.java PersistenceException.java andromda-eclipse-rcp/src/main/resources/resources/java/org/andromda/rcp/crud/ui/action ActionDoubleClickListener.java StructuredSelectionAction.java ActionOpenListener.java ActionDeleteKeyListener.java ActionSelectionListener.java ActionEnabledListener.java TypedSelectionIteratorAction.java andromda-eclipse-rcp/src/main/resources/resources/java/org/andromda/rcp/crud/ui/entry ManyAssociationFormEntryWithDetails.java OneAssociationFormEntry.java ManyAssociationFormEntry.java IFormEntry.java CheckboxFormEntry.java OneAssociationFormEntryWithDetails.java BaseFormEntry.java TextFormEntry.java andromda-eclipse-rcp/src/main/resources/templates/eclipsercp/crud/ui/icons filter.gif new.gif.vsl filter.gif.vsl edit.gif edit.gif.vsl search.gif.vsl refresh.gif.vsl search.gif refresh.gif new.gif andromda-eclipse-rcp/src/main/resources/templates/eclipsercp/crud/ui/entry AttributeFormEntry.java.vsl AssociationEndFormEntry.java.vsl andromda-eclipse-rcp/conf/test andromda.xml andromda-eclipse-rcp/src/main/resources/META-INF/andromda cartridge.xml profile.xml metafacades.xml namespace.xml andromda-eclipse-rcp/src/main/resources/resources/java/org/andromda/rcp/crud/ui/databinding DatabindingHelper.java ObjectArrayToStringConverter.java andromda-eclipse-rcp/src/test/uml EclipseRCPCartridgeTestModel.xml.zip andromda-eclipse-rcp/src/main/java/org/andromda/cartridges/eclipsercp/metafacades RcpManageableEntityAttributeLogicImpl.java RcpMetafacadeProperties.java RcpManageableEntityLogicImpl.java RcpManageableEntityAssociationEndLogicImpl.java andromda-eclipse-rcp/src/main/resources/resources/java/org/andromda/rcp/crud/ui/edit EditorComposite.java CrudEditorPart.java andromda-eclipse-rcp/src/main/resources/resources/java/org/andromda/rcp/crud/ui/widget SimpleWidgetFactory.java IWidgetFactory.java FormToolkitWidgetFactory.java WidgetFactoryBase.java ICompositeFactory.java andromda-eclipse-rcp/src/main/resources/resources/java/org/andromda/rcp/crud/ui/util CompareHelper.java EventPipe.java andromda-eclipse-rcp/src/main/uml EclipseRCPMetafacadeModel.xml.zip andromda-eclipse-rcp/src/main/java/org/andromda/cartridges/eclipsercp/utils StringUtilsHelper.java Log: Adding eclipse-rcp cartridge. There are no cartridge tests yet. Revision Changes Path 1.1 cartridges/andromda-eclipse-rcp/src/main/resources/resources/java/org/andromda/rcp/crud/core/model/IEntityDeleteListener.java Index: IEntityDeleteListener.java =================================================================== package org.andromda.rcp.crud.core.model; /** * Listener that is notified when an entity has been deleted persistently. * * @author Lars Bilger */ public interface IEntityDeleteListener { /** * Notifies the listener that a {@link EntityDeletedEvent} has occured. * * @param e */ public void entityDeleted(EntityDeletedEvent e); } 1.1 cartridges/andromda-eclipse-rcp/src/main/resources/resources/java/org/andromda/rcp/crud/core/model/EntityDeletedEvent.java Index: EntityDeletedEvent.java =================================================================== package org.andromda.rcp.crud.core.model; /** * Event object describing the deletion of an entity. * * @author Lars Bilger */ public class EntityDeletedEvent { /** * The identifier of the entity that has been deleted. */ private Object identifier; /** * The type of the entity that has been deleted. */ private String modelType; /** * @param identifier * @param modelType */ public EntityDeletedEvent(Object identifier, String modelType) { super(); this.identifier = identifier; this.modelType = modelType; } /** * @return the identifier */ public Object getIdentifier() { return identifier; } /** * @param identifier * the identifier to set */ public void setIdentifier(Object identifier) { this.identifier = identifier; } /** * @return the modelType */ public String getModelType() { return modelType; } /** * @param modelType * the modelType to set */ public void setModelType(String modelType) { this.modelType = modelType; } } 1.1 cartridges/andromda-eclipse-rcp/src/main/resources/resources/java/org/andromda/rcp/crud/core/model/EntityChangedEvent.java Index: EntityChangedEvent.java =================================================================== package org.andromda.rcp.crud.core.model; /** * Event object describing changes to an entity. * * @author Lars Bilger */ public class EntityChangedEvent { /** * The identifier of the entity that changed. */ private Object identifier; /** * The type of the entity that changed. */ private String modelType; /** * The changes that have occured on the entity. */ private PropertyChange[] propertyChanges; /** * @param identifier * @param modelType * @param propertyChanges */ public EntityChangedEvent(Object identifier, String modelType, PropertyChange[] propertyChanges) { super(); this.identifier = identifier; this.modelType = modelType; this.propertyChanges = propertyChanges; } /** * @return the identifier */ public Object getIdentifier() { return identifier; } /** * @param identifier * the identifier to set */ public void setIdentifier(Object identifier) { this.identifier = identifier; } /** * @return the modelType */ public String getModelType() { return modelType; } /** * @param modelType * the modelType to set */ public void setModelType(String modelType) { this.modelType = modelType; } /** * @return the propertyChanges */ public PropertyChange[] getPropertyChanges() { return propertyChanges; } /** * @param propertyChanges * the propertyChanges to set */ public void setPropertyChanges(PropertyChange[] propertyChanges) { this.propertyChanges = propertyChanges; } } 1.1 cartridges/andromda-eclipse-rcp/src/main/resources/resources/java/org/andromda/rcp/crud/core/model/AbstractModel.java Index: AbstractModel.java =================================================================== package org.andromda.rcp.crud.core.model; import org.andromda.rcp.crud.core.observable.DirtyableObservableBean; /** * Abstract basic implementation of IModel. * * @author Lars Bilger */ public abstract class AbstractModel extends DirtyableObservableBean implements IModel { /** * Whether this model is editable. */ private boolean editable = false; /** * @param propertyNames * @param editable */ public AbstractModel(String[] propertyNames, boolean editable) { super(propertyNames); this.editable = editable; } /** * @return the editable */ public boolean isEditable() { return editable; } } 1.1 cartridges/andromda-eclipse-rcp/src/main/resources/resources/java/org/andromda/rcp/crud/core/model/PropertyChange.java Index: PropertyChange.java =================================================================== package org.andromda.rcp.crud.core.model; /** * Represents a single change to a single property that has occurred on an entity. * * @see EntityChangedEvent * @author Lars Bilger */ public class PropertyChange { /** * The name of the property that has changed. */ private String propertyName; /** * The value that has been added or removed to/from the property. */ private Object propertyValue; /** * Whether the propertyValue has been removed from the property (true) or added to it (false). */ private boolean removed; /** * @param propertyName * @param propertyValue * @param removed */ public PropertyChange(String propertyName, Object propertyValue, boolean removed) { super(); this.propertyName = propertyName; this.propertyValue = propertyValue; this.removed = removed; } /** * @return the propertyName */ public String getPropertyName() { return propertyName; } /** * @param propertyName * the propertyName to set */ public void setPropertyName(String propertyName) { this.propertyName = propertyName; } /** * @return the propertyValue */ public Object getPropertyValue() { return propertyValue; } /** * @param propertyValue * the propertyValue to set */ public void setPropertyValue(Object propertyValue) { this.propertyValue = propertyValue; } /** * @return the removed */ public boolean isRemoved() { return removed; } /** * @param removed * the removed to set */ public void setRemoved(boolean removed) { this.removed = removed; } } 1.1 cartridges/andromda-eclipse-rcp/src/main/resources/resources/java/org/andromda/rcp/crud/core/model/IEntitySaveListener.java Index: IEntitySaveListener.java =================================================================== package org.andromda.rcp.crud.core.model; /** * Listener that is notified when an entity is persisted. * * @author Lars Bilger */ public interface IEntitySaveListener { /** * Notifies the listener that a {@link ModelSavsedEvent} has occured. * * @param e */ public void entitySaved(EntitySavedEvent e); } 1.1 cartridges/andromda-eclipse-rcp/src/main/resources/resources/java/org/andromda/rcp/crud/core/model/IEntityChangeListener.java Index: IEntityChangeListener.java =================================================================== package org.andromda.rcp.crud.core.model; /** * Listener that is notified when a saving an entity has caused changes to other entities. * * @author Lars Bilger */ public interface IEntityChangeListener { /** * Notifies the listener that a {@link EntityChangedEvent} has occured. * * @param e */ public void entityChanged(EntityChangedEvent e); } 1.1 cartridges/andromda-eclipse-rcp/src/main/resources/resources/java/org/andromda/rcp/crud/core/model/EntitySavedEvent.java Index: EntitySavedEvent.java =================================================================== package org.andromda.rcp.crud.core.model; /** * Event object describing that an entity has been persisted. * * @author Lars Bilger */ public class EntitySavedEvent { /** * The identifier of the entity that has been persisted. */ private Object identifier; /** * The type of the entity that has been persisted. */ private String modelType; /** * A model object of the entity that has been persisted. This might be an editable model, no references to this * instance should be kept by receivers of this event. */ private IModel model; /** * @param identifier * @param modelType * @param model */ public EntitySavedEvent(Object identifier, String modelType, IModel model) { super(); this.identifier = identifier; this.modelType = modelType; this.model = model; } /** * @return the identifier */ public Object getIdentifier() { return identifier; } /** * @param identifier * the identifier to set */ public void setIdentifier(Object identifier) { this.identifier = identifier; } /** * @return the model. This might be an editable model, no references to the returned instance should be kept by * receivers of this event. */ public IModel getModel() { return model; } /** * @param model * the model to set */ public void setModel(IModel model) { this.model = model; } /** * @return the modelType */ public String getModelType() { return modelType; } /** * @param modelType * the modelType to set */ public void setModelType(String modelType) { this.modelType = modelType; } } 1.1 cartridges/andromda-eclipse-rcp/src/main/resources/resources/java/org/andromda/rcp/crud/core/model/IModel.java Index: IModel.java =================================================================== package org.andromda.rcp.crud.core.model; import org.andromda.rcp.crud.core.dirty.IDirtyable; import org.andromda.rcp.crud.core.persistence.PersistenceManager; /** * Interface for a model object that is managed by a {@link PersistenceManager} * @author Lars Bilger * */ public interface IModel extends IDirtyable { /** * @return the model object's {@link PersistenceManager}. */ public PersistenceManager persistenceManager(); /** * @return the value of the model object's identifier property. */ public Object identifier(); /** * @return whether this is an editable model. */ public boolean isEditable(); /** * @return a non-editable copy of this IModel. */ public IModel copy(); /** * Disposes this IModel. Clears all references to other IModels and removes it as listener from all observables it is listening to. */ public void dispose(); /** * @return whether this IModel has been disposed. */ public boolean isDisposed(); } 1.1 cartridges/andromda-eclipse-rcp/src/main/resources/templates/eclipsercp/crud/core/PersistenceManager.java.vsl Index: PersistenceManager.java.vsl =================================================================== #set ($generatedFile = "${manageable.rcpPersistenceManagerFullPath}.java") // license-header java merge-point // // Attention: Generated code! Do not modify by hand! // Generated by: PersistenceManager.java.vsl in andromda-rcp-cartridge. // package $manageable.manageableCorePackageName; public class $manageable.rcpPersistenceManagerName extends org.andromda.rcp.crud.core.persistence.PersistenceManager { private static $manageable.rcpPersistenceManagerName instance; public static $manageable.rcpPersistenceManagerName instance() { if (instance == null) { instance = new ${manageable.rcpPersistenceManagerName}(); } return instance; } public String getModelType() { return ${manageable.fullyQualifiedRcpModelName}.TYPE; } #set($identifier = $manageable.manageableIdentifier) #set($rcpModelInstanceName = $stringUtils.uncapitalize($manageable.rcpModelName)) ##save public void save($manageable.fullyQualifiedRcpModelName $rcpModelInstanceName) throws org.andromda.rcp.crud.core.persistence.PersistenceException { assert(${rcpModelInstanceName}.isEditable()); // Only editable models can be saved. org.apache.commons.collections.MultiMap deleted = org.apache.commons.collections.map.MultiValueMap.decorate(new java.util.HashMap(), java.util.HashSet.class); org.apache.commons.collections.MultiMap changed = new org.apache.commons.collections.map.MultiValueMap(); java.util.Set saved = new java.util.HashSet(); this.cascadingSave(${rcpModelInstanceName}, new java.util.HashSet(), deleted, saved, changed); for(java.util.Iterator iter = deleted.entrySet().iterator(); iter.hasNext();) { java.util.Map.Entry entry = (java.util.Map.Entry)iter.next(); org.andromda.rcp.crud.core.persistence.PersistenceManager persistenceManager = (org.andromda.rcp.crud.core.persistence.PersistenceManager) entry.getKey(); persistenceManager.fireDelete((java.util.Collection)entry.getValue()); } for (final java.util.Iterator iter = changed.entrySet().iterator(); iter.hasNext();) { final java.util.Map.Entry entry = (java.util.Map.Entry)iter.next(); final org.apache.commons.collections.keyvalue.MultiKey multiKey = (org.apache.commons.collections.keyvalue.MultiKey)entry .getKey(); final org.andromda.rcp.crud.core.persistence.PersistenceManager persistenceManager = (org.andromda.rcp.crud.core.persistence.PersistenceManager)multiKey .getKey(0); final Object identifier = multiKey.getKey(1); final java.util.ArrayList propertyChanges = (java.util.ArrayList)entry.getValue(); persistenceManager.fireChange(identifier, (org.andromda.rcp.crud.core.model.PropertyChange[]) propertyChanges.toArray(new org.andromda.rcp.crud.core.model.PropertyChange[propertyChanges.size()])); } for(java.util.Iterator iter = saved.iterator(); iter.hasNext();) { org.andromda.rcp.crud.core.model.IModel model = (org.andromda.rcp.crud.core.model.IModel)iter.next(); org.andromda.rcp.crud.core.persistence.PersistenceManager persistenceManager = model.persistenceManager(); java.util.Set deletedSet = (java.util.Set)deleted.get(persistenceManager); if(deletedSet == null || !deletedSet.contains(model)) { model.setDirty(false); persistenceManager.fireSave(model); } } } public void cascadingSave($manageable.fullyQualifiedRcpModelName $rcpModelInstanceName, java.util.Set processed, org.apache.commons.collections.MultiMap deleted, java.util.Set saved, org.apache.commons.collections.MultiMap changed) throws org.andromda.rcp.crud.core.persistence.PersistenceException { assert(${rcpModelInstanceName}.isEditable()); // Only editable models can be saved. if(processed.add($rcpModelInstanceName)) { #foreach($member in $manageable.manageableAssociationEnds) #if($member.createBeforeOwner) this.saveConnected${stringUtils.capitalize($member.name)}($rcpModelInstanceName, processed, deleted, saved, changed); #end #end this.saveModel($rcpModelInstanceName, saved); #foreach($member in $manageable.manageableAssociationEnds) #if($member.createAfterOwner) this.saveConnected${stringUtils.capitalize($member.name)}($rcpModelInstanceName, processed, deleted, saved, changed); #end #end } } ## #foreach($member in $manageable.manageableAssociationEnds) private void saveConnected${stringUtils.capitalize($member.name)}($manageable.fullyQualifiedRcpModelName $rcpModelInstanceName, java.util.Set processed, org.apache.commons.collections.MultiMap deleted, java.util.Set saved, org.apache.commons.collections.MultiMap changed) throws org.andromda.rcp.crud.core.persistence.PersistenceException { #set($connected = "connected${stringUtils.capitalize($member.name)}") #set($connectedId = "${connected}Id") #set($previouslyConnected = "previously${stringUtils.capitalize($connected)}") #set($previouslyConnectedId = "${previouslyConnected}Id") #if($member.many) #set($connectedCollection = "${connected}Collection") #set($previouslyConnectedSet = "${previouslyConnected}Set") #set($connectedSet = "${connected}Set") #if($member.child || $member.otherEnd.navigable) java.util.Set $connectedSet = new java.util.HashSet(java.util.Arrays.asList(${rcpModelInstanceName}.${member.flatGetterName}())); java.util.Set $previouslyConnectedSet = new java.util.HashSet(java.util.Arrays.asList(${rcpModelInstanceName}.${member.originalGetterName}())); ${previouslyConnectedSet}.removeAll($connectedSet); for(java.util.Iterator iter = ${previouslyConnectedSet}.iterator(); iter.hasNext();) { ${member.type.manageableIdentifier.type.fullyQualifiedName} $previouslyConnectedId = (${member.type.manageableIdentifier.type.fullyQualifiedName})iter.next(); #if($member.child) $member.type.fullyQualifiedRcpModelName $previouslyConnected = ${member.type.fullyQualifiedRcpPersistenceManagerName}.instance().getEditableIfInitialized($previouslyConnectedId); if($previouslyConnected != null) { ${member.type.fullyQualifiedRcpPersistenceManagerName}.instance().cascadingDelete($previouslyConnected, deleted, saved); } else { deleted.put(${member.type.fullyQualifiedRcpPersistenceManagerName}.instance(), $previouslyConnectedId); } #else changed.put(new org.apache.commons.collections.keyvalue.MultiKey(${member.type.fullyQualifiedRcpPersistenceManagerName}.instance(), $previouslyConnectedId), new org.andromda.rcp.crud.core.model.PropertyChange(${member.type.fullyQualifiedRcpModelName}.${member.otherEnd.propertyConstantName}, $rcpModelInstanceName, true)); #end } #end java.util.Collection $connectedCollection = ${rcpModelInstanceName}.${member.ifInitializedGetterName}(); if($connectedCollection != null) { for (java.util.Iterator iter = ${connectedCollection}.iterator(); iter.hasNext();) { $member.type.fullyQualifiedRcpModelName $connected = ($member.type.fullyQualifiedRcpModelName)iter.next(); #if($member.child) ${member.type.fullyQualifiedRcpPersistenceManagerName}.instance().cascadingSave($connected, processed, deleted, saved, changed); #else if(${connected}.${member.type.manageableIdentifier.getterName}() == null) { ${member.type.fullyQualifiedRcpPersistenceManagerName}.instance().cascadingSave($connected, processed, deleted, saved, changed); } #end } } #if($member.otherEnd.navigable) #if($member.child) else #end { ${connectedSet}.removeAll(java.util.Arrays.asList(${rcpModelInstanceName}.${member.originalGetterName}())); for(java.util.Iterator iter = ${connectedSet}.iterator(); iter.hasNext();) { ${member.type.manageableIdentifier.type.fullyQualifiedName} $connectedId = (${member.type.manageableIdentifier.type.fullyQualifiedName})iter.next(); changed.put(new org.apache.commons.collections.keyvalue.MultiKey(${member.type.fullyQualifiedRcpPersistenceManagerName}.instance(), $connectedId), new org.andromda.rcp.crud.core.model.PropertyChange(${member.type.fullyQualifiedRcpModelName}.${member.otherEnd.propertyConstantName}, $rcpModelInstanceName, false)); } } #end #else## $member.one #if($member.child || $member.otherEnd.navigable) ${member.type.manageableIdentifier.type.fullyQualifiedName} $connectedId = ${rcpModelInstanceName}.${member.flatGetterName}(); ${member.type.manageableIdentifier.type.fullyQualifiedName} $previouslyConnectedId = ${rcpModelInstanceName}.${member.originalGetterName}(); if($previouslyConnectedId != null && !${previouslyConnectedId}.equals($connectedId)) { #if($member.child) $member.type.fullyQualifiedRcpModelName $previouslyConnected = ${member.type.fullyQualifiedRcpPersistenceManagerName}.instance().getEditableIfInitialized($previouslyConnectedId); if($previouslyConnected != null) { ${member.type.fullyQualifiedRcpPersistenceManagerName}.instance().cascadingDelete($previouslyConnected, deleted, saved); } else { deleted.put(${member.type.fullyQualifiedRcpPersistenceManagerName}.instance(), $previouslyConnectedId); } #else changed.put(new org.apache.commons.collections.keyvalue.MultiKey(${member.type.fullyQualifiedRcpPersistenceManagerName}.instance(), $previouslyConnectedId), new org.andromda.rcp.crud.core.model.PropertyChange(${member.type.fullyQualifiedRcpModelName}.${member.otherEnd.propertyConstantName}, $rcpModelInstanceName, true)); #end } #end $member.type.fullyQualifiedRcpModelName $connected = ${rcpModelInstanceName}.${member.ifInitializedGetterName}(); #if($member.child) if($connected != null) { ${member.type.fullyQualifiedRcpPersistenceManagerName}.instance().cascadingSave($connected, processed, deleted, saved, changed); } #else if($connected != null && ${connected}.${member.type.manageableIdentifier.getterName}() == null) { ${member.type.fullyQualifiedRcpPersistenceManagerName}.instance().cascadingSave($connected, processed, deleted, saved, changed); } #end #if($member.otherEnd.navigable) else if($connectedId != null && !${connectedId}.equals($previouslyConnectedId)) { changed.put(new org.apache.commons.collections.keyvalue.MultiKey(${member.type.fullyQualifiedRcpPersistenceManagerName}.instance(), $connectedId), new org.andromda.rcp.crud.core.model.PropertyChange(${member.type.fullyQualifiedRcpModelName}.${member.otherEnd.propertyConstantName}, $rcpModelInstanceName, false)); } #end #end // TODO: Fire a saved event if a connected model was only dirty because of a change made by // this model to assure integrity of a bidirectional association. } #end private void saveModel($manageable.fullyQualifiedRcpModelName $rcpModelInstanceName, java.util.Set saved) throws org.andromda.rcp.crud.core.persistence.PersistenceException { if (${rcpModelInstanceName}.${identifier.getterName}() == null) { this.create($rcpModelInstanceName); saved.add($rcpModelInstanceName); } else { if(${rcpModelInstanceName}.isDirty()) { this.update($rcpModelInstanceName); saved.add($rcpModelInstanceName); } } } protected void create($manageable.fullyQualifiedRcpModelName $rcpModelInstanceName) throws org.andromda.rcp.crud.core.persistence.PersistenceException { try { ${manageable.fullyQualifiedManageableValueObjectName} valueObject = ${manageable.manageableServiceAccessorCall}.create( #set ($comma = '') #foreach ($member in $manageable.manageableMembers) ${comma}${rcpModelInstanceName}.${member.flatGetterName}() #set ($comma = ', ') #end ); ${rcpModelInstanceName}.${identifier.setterName}(valueObject.${identifier.getterName}()); if(${rcpModelInstanceName}.isEditable()) { this.addEditableModel(${rcpModelInstanceName}); } } catch (Exception e) { throw new org.andromda.rcp.crud.core.persistence.PersistenceException(e); } } protected void update($manageable.fullyQualifiedRcpModelName ${rcpModelInstanceName}) throws org.andromda.rcp.crud.core.persistence.PersistenceException { try { ${manageable.manageableServiceAccessorCall}.update( #set ($comma = '') #foreach ($member in $manageable.manageableMembers) ${comma}${rcpModelInstanceName}.${member.flatGetterName}() #set ($comma = ', ') #end ); } catch (Exception e) { throw new org.andromda.rcp.crud.core.persistence.PersistenceException(e); } } #set($rcpModelInstancesName = "${rcpModelInstanceName}s") public void delete(java.util.Collection ${rcpModelInstancesName}) throws org.andromda.rcp.crud.core.persistence.PersistenceException { for(java.util.Iterator iter = ${rcpModelInstancesName}.iterator(); iter.hasNext();) { this.delete(($manageable.fullyQualifiedRcpModelName)iter.next()); } } public void delete($manageable.fullyQualifiedRcpModelName ${rcpModelInstanceName}) throws org.andromda.rcp.crud.core.persistence.PersistenceException { // If the specified model is not editable, try to get the corresponding editable if it exists, as it might have changes. if(!${rcpModelInstanceName}.isEditable()) { $manageable.fullyQualifiedRcpModelName editable = this.getEditableIfInitialized(${rcpModelInstanceName}.${identifier.getterName}()); if(editable != null) { ${rcpModelInstanceName} = editable; } } org.apache.commons.collections.MultiMap deleted = org.apache.commons.collections.map.MultiValueMap.decorate(new java.util.HashMap(), java.util.HashSet.class); java.util.Set saved = new java.util.HashSet(); this.cascadingDelete(${rcpModelInstanceName}, deleted, saved); try { ${manageable.manageableServiceAccessorCall}.delete(new ${identifier.type.fullyQualifiedName}[]{${rcpModelInstanceName}.${identifier.getterName}()}); } catch (Exception e) { throw new org.andromda.rcp.crud.core.persistence.PersistenceException(e); } for(java.util.Iterator iter = deleted.entrySet().iterator(); iter.hasNext();) { java.util.Map.Entry entry = (java.util.Map.Entry)iter.next(); org.andromda.rcp.crud.core.persistence.PersistenceManager persistenceManager = (org.andromda.rcp.crud.core.persistence.PersistenceManager) entry.getKey(); persistenceManager.fireDelete((java.util.Collection)entry.getValue()); } for(java.util.Iterator iter = saved.iterator(); iter.hasNext();) { org.andromda.rcp.crud.core.model.IModel model = (org.andromda.rcp.crud.core.model.IModel)iter.next(); org.andromda.rcp.crud.core.persistence.PersistenceManager persistenceManager = model.persistenceManager(); java.util.Set deletedSet = (java.util.Set)deleted.get(persistenceManager); if(deletedSet == null || !deletedSet.contains(model)) { model.setDirty(false); persistenceManager.fireSave(model); } } } public void cascadingDelete($manageable.fullyQualifiedRcpModelName $rcpModelInstanceName, org.apache.commons.collections.MultiMap deleted, java.util.Set saved) throws org.andromda.rcp.crud.core.persistence.PersistenceException { #foreach($member in $manageable.manageableAssociationEnds) #if($member.otherEnd.navigable || $member.child) #set($connected = "connected${stringUtils.capitalize($member.name)}") #set($connectedId = "${connected}Id") #if($member.many) #set($connectedCollection = "${connected}Collection") #set($connectedIds = "${connectedId}s") #if($member.child) #set($previouslyConnectedIds = "previously${stringUtils.capitalize($connectedIds)}") #set($previouslyConnected = "previously${stringUtils.capitalize($connected)}") $member.type.manageableIdentifier.type.fullyQualifiedName[] $previouslyConnectedIds = ${rcpModelInstanceName}.${member.originalGetterName}(); for(int i = 0; i < ${previouslyConnectedIds}.length; i++) { $member.type.fullyQualifiedRcpModelName $previouslyConnected = ${member.type.fullyQualifiedRcpPersistenceManagerName}.instance().getEditableIfInitialized(${previouslyConnectedIds}[i]); if($previouslyConnected != null) { ${member.type.fullyQualifiedRcpPersistenceManagerName}.instance().cascadingDelete($previouslyConnected, deleted, saved); } else { deleted.put(${member.type.fullyQualifiedRcpPersistenceManagerName}.instance(), ${previouslyConnectedIds}[i]); } } #end java.util.Collection $connectedCollection = null; if(${rcpModelInstanceName}.isEditable()) { $connectedCollection = ${rcpModelInstanceName}.${member.ifInitializedGetterName}(); } if($connectedCollection == null) { $connectedCollection = new java.util.ArrayList(); $member.type.manageableIdentifier.type.fullyQualifiedName[] $connectedIds = ${rcpModelInstanceName}.${member.flatGetterName}(); for(int i = 0; i < ${connectedIds}.length; i++) { $member.type.fullyQualifiedRcpModelName $connected = ${member.type.fullyQualifiedRcpPersistenceManagerName}.instance().getEditableIfInitialized(${connectedIds}[i]); if($connected != null) { ${connectedCollection}.add($connected); } #if($member.child) else { deleted.put(${member.type.fullyQualifiedRcpPersistenceManagerName}.instance(), ${connectedIds}[i]); } #end } } else { // copy collection to prevent concurrent modification $connectedCollection = new java.util.ArrayList($connectedCollection); } for(java.util.Iterator iter = ${connectedCollection}.iterator(); iter.hasNext();) { $member.type.fullyQualifiedRcpModelName $connected = ($member.type.fullyQualifiedRcpModelName)iter.next(); #else #if($member.child) #set($previouslyConnectedId = "previously${stringUtils.capitalize($connectedId)}") #set($previouslyConnected = "previously${stringUtils.capitalize($connected)}") $member.type.manageableIdentifier.type.fullyQualifiedName $previouslyConnectedId = ${rcpModelInstanceName}.${member.originalGetterName}(); if($previouslyConnectedId != null) { $member.type.fullyQualifiedRcpModelName $previouslyConnected = ${member.type.fullyQualifiedRcpPersistenceManagerName}.instance().getEditableIfInitialized(${previouslyConnectedIds}); if($previouslyConnected != null) { ${member.type.fullyQualifiedRcpPersistenceManagerName}.instance().cascadingDelete($previouslyConnected, deleted, saved); } else { deleted.put(${member.type.fullyQualifiedRcpPersistenceManagerName}.instance(), ${$previouslyConnectedId}); } } #end $member.type.fullyQualifiedRcpModelName $connected = null; if(${rcpModelInstanceName}.isEditable()) { $connected = ${rcpModelInstanceName}.${member.ifInitializedGetterName}(); } if($connected == null) { $member.type.manageableIdentifier.type.fullyQualifiedName $connectedId = ${rcpModelInstanceName}.${member.flatGetterName}(); if($connectedId != null) { $connected = ${member.type.fullyQualifiedRcpPersistenceManagerName}.instance().getEditableIfInitialized($connectedId); #if($member.child) if($connected == null) { deleted.put(${member.type.fullyQualifiedRcpPersistenceManagerName}.instance(), $connectedId); } #end } } if($connected != null) { #end if(${connected}.${member.type.manageableIdentifier.getterName}() != null) { #if($member.otherEnd.many) ## implies !$member.child && $member.otherEnd.navigable boolean wasDirty = ${connected}.isDirty(); if(${connected}.${member.otherEnd.removerName}(${rcpModelInstanceName})) { if(!wasDirty) { // we don't need to actually save ${connected} through the service because this change will take place // automatically on the database. Just add it to the saved set so that a saved event will be fired. saved.add(${connected}); } } #else #if($member.otherEnd.navigable) if(${rcpModelInstanceName}.${identifier.getterName}().equals(${connected}.${member.otherEnd.flatGetterName}())) { #if($member.child) ${member.type.fullyQualifiedRcpPersistenceManagerName}.instance().cascadingDelete($connected, deleted, saved); #else boolean wasDirty = ${connected}.isDirty(); ${connected}.${member.otherEnd.setterName}(null); if(!wasDirty) { // we don't need to actually save ${connected} through the service because this change will take place // automatically on the database. Just add it to the saved set so that a saved event will be fired. saved.add(${connected}); } #end } #else ## implies $member.child ${member.type.fullyQualifiedRcpPersistenceManagerName}.instance().cascadingDelete($connected, deleted, saved); #end #end } } #end #end // There's no need to actually delete children through the service, this should be done through cascading deletes on the database. // This is why we only add them to the deleted map so that a deleted event will be fired. // We use "this" as key so that the deleted event will be fired through ${manageable.rcpPersistenceManagerName}. deleted.put(this, ${rcpModelInstanceName}.${identifier.getterName}()); } public ${manageable.fullyQualifiedRcpModelName} getEditable(${identifier.type.fullyQualifiedName} identifier) throws org.andromda.rcp.crud.core.persistence.PersistenceException { ${manageable.fullyQualifiedRcpModelName} editable; if (identifier == null) { editable = newEditable(); } else { editable = (${manageable.fullyQualifiedRcpModelName})this.getEditableModel(identifier); } return editable; } public ${manageable.fullyQualifiedRcpModelName} getEditableIfInitialized(${identifier.type.fullyQualifiedName} identifier) { ${manageable.fullyQualifiedRcpModelName} editable = null; if (identifier != null) { editable = (${manageable.fullyQualifiedRcpModelName})this.getEditableModelIfInitialized(identifier); } return editable; } public ${manageable.fullyQualifiedRcpModelName} newEditable() { ${manageable.fullyQualifiedRcpModelName} editable = create${manageable.rcpModelName}(null, true); editable.setDirty(true); return editable; } public ${manageable.fullyQualifiedRcpModelName} forIdentifier(${identifier.type.fullyQualifiedName} identifier) throws org.andromda.rcp.crud.core.persistence.PersistenceException { return findByIdentifier(identifier, false); } protected ${manageable.fullyQualifiedRcpModelName} findByIdentifier(${identifier.type.fullyQualifiedName} identifier, boolean editable) throws org.andromda.rcp.crud.core.persistence.PersistenceException { $manageable.fullyQualifiedRcpSearchCriteriaName criteria = new ${manageable.fullyQualifiedRcpSearchCriteriaName}(); criteria.${identifier.setterName}(identifier); java.util.Collection result = this.find(criteria, editable); java.util.Iterator iter = result.iterator(); if (!iter.hasNext()) { throw new org.andromda.rcp.crud.core.persistence.PersistenceException("Unknown Identifier for $manageable.name: " + identifier); } return (${manageable.fullyQualifiedRcpModelName})iter.next(); } protected org.andromda.rcp.crud.core.model.IModel editableForIdentifier(Object identifier) throws org.andromda.rcp.crud.core.persistence.PersistenceException { return findByIdentifier((${identifier.type.fullyQualifiedName})identifier, true); } public java.util.Collection findAll() throws org.andromda.rcp.crud.core.persistence.PersistenceException { try { java.util.List valueObjects = ${manageable.manageableServiceAccessorCall}.readAll(); return create${manageable.rcpModelName}sFromValueObjects(valueObjects, false); } catch (Exception e) { throw new org.andromda.rcp.crud.core.persistence.PersistenceException(e); } } public java.util.Collection find($manageable.fullyQualifiedRcpSearchCriteriaName criteria) throws org.andromda.rcp.crud.core.persistence.PersistenceException { return this.find(criteria, false); } protected java.util.Collection find($manageable.fullyQualifiedRcpSearchCriteriaName criteria, boolean editable) throws org.andromda.rcp.crud.core.persistence.PersistenceException { try { java.util.List valueObjects = ${manageable.manageableServiceAccessorCall}.read( #set ($comma = '') #foreach ($member in $manageable.manageableMembers) ${comma}criteria.${member.getterName}() #set ($comma = ', ') #end ); return create${manageable.rcpModelName}sFromValueObjects(valueObjects, editable); } catch (Exception e) { throw new org.andromda.rcp.crud.core.persistence.PersistenceException(e); } } protected ${manageable.fullyQualifiedRcpModelName} create${manageable.rcpModelName}(${identifier.type.fullyQualifiedName} identifier, boolean editable) { ${manageable.fullyQualifiedRcpModelName} ${rcpModelInstanceName} = new ${manageable.fullyQualifiedRcpModelName}(identifier, editable); return ${rcpModelInstanceName}; } protected void copyData(${manageable.fullyQualifiedRcpModelName} ${rcpModelInstanceName}, ${manageable.fullyQualifiedManageableValueObjectName} valueObject) { #foreach($member in $manageable.manageableMembers) #set ($hasLabel = ($member.type.displayAttribute.name != $member.type.manageableIdentifier.name)) #if(!($member == $identifier)) ${rcpModelInstanceName}.${member.flatSetterName}(valueObject.${member.getterName}()#if($hasLabel), valueObject.${member.labelGetterName}()#end); #end #end } protected ${manageable.fullyQualifiedRcpModelName} create${manageable.rcpModelName}FromValueObject(${manageable.fullyQualifiedManageableValueObjectName} valueObject, boolean editable) { ${manageable.fullyQualifiedRcpModelName} ${rcpModelInstanceName} = create${manageable.rcpModelName}(valueObject.${identifier.getterName}(), editable); copyData(${rcpModelInstanceName}, valueObject); ${rcpModelInstanceName}.setDirty(false); return ${rcpModelInstanceName}; } protected java.util.Collection create${manageable.rcpModelName}sFromValueObjects(java.util.Collection valueObjects, boolean editable) { java.util.Collection ${rcpModelInstancesName} = new java.util.ArrayList(valueObjects.size()); for (java.util.Iterator iter = valueObjects.iterator(); iter.hasNext();) { ${manageable.fullyQualifiedManageableValueObjectName} valueObject = (${manageable.fullyQualifiedManageableValueObjectName})iter.next(); ${rcpModelInstancesName}.add(create${manageable.rcpModelName}FromValueObject(valueObject, editable)); } return ${rcpModelInstancesName}; } protected void reloadEditable(org.andromda.rcp.crud.core.model.IModel model) throws org.andromda.rcp.crud.core.persistence.PersistenceException { ${manageable.fullyQualifiedRcpModelName} ${rcpModelInstanceName} = (${manageable.fullyQualifiedRcpModelName}) model; try { java.util.List valueObjects = ${manageable.manageableServiceAccessorCall}.read( #set ($comma = '') #foreach ($member in $manageable.manageableMembers) #if($member.name == $manageable.manageableIdentifier.name) ${comma}${rcpModelInstanceName}.${member.getterName}() #else ${comma}null #end #set ($comma = ', ') #end ); java.util.Iterator iter = valueObjects.iterator(); if (!iter.hasNext()) { throw new org.andromda.rcp.crud.core.persistence.PersistenceException("Unknown Identifier for $manageable.name: " + ${rcpModelInstanceName}.${manageable.manageableIdentifier.getterName}()); } copyData(${rcpModelInstanceName}, (${manageable.fullyQualifiedManageableValueObjectName})iter.next()); ${rcpModelInstanceName}.setDisposed(false); } catch (Exception e) { throw new org.andromda.rcp.crud.core.persistence.PersistenceException(e); } } public void collectNewConnected(final org.andromda.rcp.crud.core.model.IModel model, java.util.Set collection) { if(model.identifier() != null || collection.add(model)) { ${manageable.fullyQualifiedRcpModelName} $rcpModelInstanceName = (${manageable.fullyQualifiedRcpModelName}) model; #foreach($member in $manageable.manageableAssociationEnds) { #if($member.many) final java.util.Collection $member.name = ${rcpModelInstanceName}.${member.ifInitializedGetterName}(); if($member.name != null) { for(java.util.Iterator iter = ${member.name}.iterator(); iter.hasNext();) { final org.andromda.rcp.crud.core.model.IModel connected = (org.andromda.rcp.crud.core.model.IModel)iter.next(); if(connected.identifier() == null) { connected.persistenceManager().collectNewConnected(connected, collection); } } } #else final org.andromda.rcp.crud.core.model.IModel connected = ${rcpModelInstanceName}.${member.ifInitializedGetterName}(); if(connected != null) { if(connected.identifier() == null) { connected.persistenceManager().collectNewConnected(connected, collection); } } #end } #end } } } 1.1 cartridges/andromda-eclipse-rcp/src/main/resources/templates/eclipsercp/crud/core/SearchCriteria.java.vsl Index: SearchCriteria.java.vsl =================================================================== #set ($generatedFile = "${manageable.rcpSearchCriteriaFullPath}.java") // license-header java merge-point // // Attention: Generated code! Do not modify by hand! // Generated by: SearchCriteria.java.vsl in andromda-rcp-cartridge. // package $manageable.manageableCorePackageName; public class ${manageable.rcpSearchCriteriaName} extends ${manageable.fullyQualifiedManageableValueObjectName} { private static final long serialVersionUID = ${manageable.serialVersionUID}L; } 1.1 cartridges/andromda-eclipse-rcp/src/main/resources/templates/eclipsercp/crud/core/Helper.java.vsl Index: Helper.java.vsl =================================================================== #set ($generatedFile = "${manageable.rcpHelperFullPath}.java") #set($identifier = $manageable.manageableIdentifier) #set($identifierType = $identifier.type.fullyQualifiedName) #set($modelInstanceName = $stringUtils.uncapitalize($manageable.rcpModelName)) #set($modelInstancesName = "${modelInstanceName}s") #set($label = $manageable.displayAttribute) #set($labelType = $label.type.fullyQualifiedName) // license-header java merge-point // // Attention: Generated code! Do not modify by hand! // Generated by: Helper.java.vsl in andromda-rcp-cartridge. // package $manageable.manageableCorePackageName; public class $manageable.rcpHelperName { public static ${identifierType}[] collectionToIdentifierArray(java.util.Collection ${modelInstancesName}) { java.util.Collection identifiers = new java.util.ArrayList(); if (${modelInstancesName} != null) { for (java.util.Iterator iter = ${modelInstancesName}.iterator(); iter.hasNext();) { $manageable.fullyQualifiedRcpModelName ${modelInstanceName} = ($manageable.fullyQualifiedRcpModelName)iter.next(); if (${modelInstanceName}.${identifier.getterName}() != null) { identifiers.add(${modelInstanceName}.${identifier.getterName}()); } } } return (${identifierType}[])identifiers.toArray(new ${identifierType}[identifiers.size()]); } public static ${labelType}[] collectionToLabelArray(final java.util.Collection ${modelInstancesName}) { final java.util.Collection labels = new java.util.ArrayList(); if (${modelInstancesName} != null) { for (java.util.Iterator iter = ${modelInstancesName}.iterator(); iter.hasNext();) { $manageable.fullyQualifiedRcpModelName ${modelInstanceName} = ($manageable.fullyQualifiedRcpModelName)iter.next(); labels.add(${modelInstanceName}.${label.getterName}()); } } return (${labelType}[])labels.toArray(new ${labelType}[labels.size()]); } public static java.util.Collection copyCollection(final java.util.Collection ${modelInstancesName}) { final java.util.Collection copies = new java.util.ArrayList(${modelInstancesName}); org.apache.commons.collections.CollectionUtils.transform(copies, new org.apache.commons.collections.Transformer() { public Object transform(final Object input) { return (($manageable.fullyQualifiedRcpModelName)input).copy(); } }); return copies; } public static java.util.Collection editableCollection(final java.util.Collection ${modelInstancesName}) { final java.util.Collection copies = new java.util.ArrayList(${modelInstancesName}); org.apache.commons.collections.CollectionUtils.transform(copies, new org.apache.commons.collections.Transformer() { public Object transform(final Object input) { Object editable = null; if((($manageable.fullyQualifiedRcpModelName)input).isEditable()) { editable = input; } else { try { editable = ${manageable.fullyQualifiedRcpPersistenceManagerName}.instance().getEditable( (($manageable.fullyQualifiedRcpModelName)input).${identifier.getterName}()); } catch (final org.andromda.rcp.crud.core.persistence.PersistenceException e) { // TODO: Exception Handling } } return editable; } }); return copies; } public static boolean matchesCriteria($manageable.fullyQualifiedRcpModelName $modelInstanceName, $manageable.fullyQualifiedRcpSearchCriteriaName criteria) { return ( #set($and = "") #set($needDateCompareMethod = false) #foreach($member in $manageable.manageableAttributes) #if ($member.type.primitive) #if ($member.type.fullyQualifiedName == 'boolean') ${and}((!criteria.${member.getterName}()) || ${modelInstanceName}.${member.getterName}()); #else ${and}(criteria.${member.getterName}() == ${modelInstanceName}.${member.getterName}()); #end #else ${and}(criteria.${member.getterName}() == null || ## no new line #if ($member.type.stringType) (${modelInstanceName}.${member.getterName}() != null && ${modelInstanceName}.${member.getterName}().startsWith(criteria.${member.getterName}()))## no new line #elseif ($member.type.dateType) compareDate(criteria.${member.getterName}(), ${modelInstanceName}.${member.getterName}())## no new line #set($needDateCompareMethod = true) #elseif ($member.type.fullyQualifiedName == 'java.lang.Boolean') ((!criteria.${member.getterName}().booleanValue()) || ${modelInstanceName}.${member.getterName}().booleanValue())##no new line #else criteria.${member.getterName}().equals(${modelInstanceName}.${member.getterName}())## no new line #end ) #end #set($and = "&& ") #end #foreach ($member in $manageable.manageableAssociationEnds) #if ($member.many) ${and}(criteria.${member.getterName}() == null || criteria.${member.getterName}().length == 0 || java.util.Arrays.asList(${modelInstanceName}.${member.flatGetterName}()).containsAll(java.util.Arrays.asList(criteria.${member.getterName}()))) #else #if ($member.type.primitive) ${and}(criteria.${member.getterName}() == ${modelInstanceName}.${member.getterName}()); #else ${and}(criteria.${member.getterName}() == null || criteria.${member.getterName}().equals(${modelInstanceName}.${member.flatGetterName}())) #end #end #set($and = "&& ") #end ); } #if($needDateCompareMethod) private static boolean compareDate(java.util.Date expected, java.util.Date actual) { boolean equal = false; // we check whether or not the user supplied time information within this particular date argument // if he/she didn't we assume he/she wishes to search in the scope of the entire day final java.util.Calendar calendar = new java.util.GregorianCalendar(); calendar.setTime(expected); if ( calendar.get(java.util.Calendar.HOUR) != 0 || calendar.get(java.util.Calendar.MINUTE) != 0 || calendar.get(java.util.Calendar.SECOND) != 0 || calendar.get(java.util.Calendar.MILLISECOND) != 0 ) { equal = expected.equals(actual); } else { calendar.add(java.util.Calendar.DATE, 1); equal = expected.getTime() <= actual.getTime() && actual.getTime() <= calendar.getTime(); } } #end public static void filterMatching(final java.util.Collection models, final $manageable.fullyQualifiedRcpSearchCriteriaName criteria) { org.apache.commons.collections.CollectionUtils.filter(models, new org.apache.commons.collections.Predicate() { public boolean evaluate(Object object) { return (object instanceof ${manageable.fullyQualifiedRcpModelName}) && matchesCriteria((${manageable.fullyQualifiedRcpModelName})object, criteria); } }); } } 1.1 cartridges/andromda-eclipse-rcp/src/main/resources/templates/eclipsercp/crud/core/MANIFEST.MF.vsl Index: MANIFEST.MF.vsl =================================================================== #set ($generatedFile = "META-INF/MANIFEST.MF") #set ($manageable = $manageables.iterator().next()) Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: CRUD Core Plug-in Bundle-SymbolicName: ${manageable.corePluginName} Bundle-Version: 1.0.0 Bundle-Activator: ${manageable.fullyQualifiedCoreActivatorClassName} Bundle-Localization: plugin Require-Bundle: org.eclipse.core.runtime, org.apache.commons_logging Eclipse-LazyStart: true Bundle-ClassPath: ., lib/commons-collections-3.2.jar, lib/spring-1.2.5.jar, lib/commons-lang-2.1.jar Export-Package:## no new line #set($list = []) #foreach($manageable in $manageables) #if(!$list.contains($manageable.manageableCorePackageName)) $manageable.manageableCorePackageName, #set($void = $list.add($manageable.manageableCorePackageName)) #end #if(!$list.contains($manageable.manageablePackageName)) $manageable.manageablePackageName, #set($void = $list.add($manageable.manageablePackageName)) #end #end org.andromda.rcp.crud.core.dirty, org.andromda.rcp.crud.core.model, org.andromda.rcp.crud.core.observable, org.andromda.rcp.crud.core.persistence 1.1 cartridges/andromda-eclipse-rcp/src/main/resources/templates/eclipsercp/crud/core/Activator.java.vsl Index: Activator.java.vsl =================================================================== #set ($manageable = $manageables.iterator().next()) #set ($generatedFile = "${manageable.coreActivatorClassFullPath}.java") // license-header java merge-point // // Attention: Generated code! Do not modify by hand! // Generated by: Activator.java.vsl in andromda-rcp-cartridge. // package $manageable.corePluginName; /** * The activator class controls the plug-in life cycle */ public class ${manageable.coreActivatorClassName} extends org.eclipse.core.runtime.Plugin { // The plug-in ID public static final String PLUGIN_ID = "${manageable.corePluginName}"; // The shared instance private static ${manageable.coreActivatorClassName} plugin; /** * The constructor */ public ${manageable.coreActivatorClassName}() { plugin = this; } /* * (non-Javadoc) * @see org.eclipse.core.runtime.Plugin#start(org.osgi.framework.BundleContext) */ public void start(org.osgi.framework.BundleContext context) throws Exception { super.start(context); } /* * (non-Javadoc) * @see org.eclipse.core.runtime.Plugin\#stop(org.osgi.framework.BundleContext) */ public void stop(org.osgi.framework.BundleContext context) throws Exception { plugin = null; super.stop(context); } /** * Returns the shared instance * * @return the shared instance */ public static ${manageable.coreActivatorClassName} getDefault() { return plugin; } } 1.1 cartridges/andromda-eclipse-rcp/src/main/resources/templates/eclipsercp/crud/core/Model.java.vsl Index: Model.java.vsl =================================================================== #set($generatedFile = "${manageable.rcpModelFullPath}.java") #set($identifier = ${manageable.manageableIdentifier}) #set($thisModel = "${manageable.rcpModelName}.this") #set($otherModel = "other${manageable.rcpModelName}") // license-header java merge-point // // Attention: Generated code! Do not modify by hand! // Generated by: Model.java.vsl in andromda-rcp-cartridge. // ... [truncated message content] |
From: Lars B. <lb...@us...> - 2007-01-10 21:23:08
|
User: lbilger Date: 07/01/10 13:22:56 cartridges/andromda-eclipse-rcp/src/main/resources/resources/java/org/andromda/rcp/crud/core/model - New directory |
From: Lars B. <lb...@us...> - 2007-01-10 21:23:08
|
User: lbilger Date: 07/01/10 13:23:02 cartridges/andromda-eclipse-rcp/src/main/resources/templates/eclipsercp/crud/ui/search - New directory |
From: Lars B. <lb...@us...> - 2007-01-10 21:23:06
|
User: lbilger Date: 07/01/10 13:23:03 cartridges/andromda-eclipse-rcp/src/test/expected - New directory |
From: Lars B. <lb...@us...> - 2007-01-10 21:23:05
|
User: lbilger Date: 07/01/10 13:22:55 cartridges/andromda-eclipse-rcp/src/main/resources/resources/java/org/andromda/rcp/crud - New directory |