From: Vance K. <va...@us...> - 2006-01-03 01:33:50
|
User: vancek Date: 06/01/02 17:33:44 Modified: andromda-ejb3/src/main/java/org/andromda/cartridges/ejb3 EJB3ScriptHelper.java Log: refactored getAttributesAsList out to the session facade Revision Changes Path 1.2 +1 -44 cartridges/andromda-ejb3/src/main/java/org/andromda/cartridges/ejb3/EJB3ScriptHelper.java Index: EJB3ScriptHelper.java =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-ejb3/src/main/java/org/andromda/cartridges/ejb3/EJB3ScriptHelper.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -w -r1.1 -r1.2 --- EJB3ScriptHelper.java 28 Dec 2005 00:32:56 -0000 1.1 +++ EJB3ScriptHelper.java 3 Jan 2006 01:33:44 -0000 1.2 @@ -1,6 +1,7 @@ package org.andromda.cartridges.ejb3; import org.andromda.cartridges.ejb3.metafacades.EJB3EntityAttributeFacade; +import org.andromda.cartridges.ejb3.metafacades.EJB3SessionFacade; import org.andromda.metafacades.uml.AttributeFacade; import org.andromda.metafacades.uml.ModelElementFacade; @@ -18,50 +19,6 @@ */ public class EJB3ScriptHelper { - - /** - * Create a comma seperated list of attributes. - * <p/> - * This method can be used to generated e.g. argument lists for constructors, method calls etc. - * <p/> - * It will not return attributes tagged to be optimistic lock values. - * - * @param attributes a collection of {@link Attribute} objects - * @param includeTypes if <code>true</code>, the type names of the attributes are included. - * @param includeNames if <code>true</code>, the names of the attributes are included - */ - public String getAttributesAsList(Collection attributes, boolean includeTypes, boolean includeNames) - { - if (!includeNames && !includeTypes || attributes == null) - { - return ""; - } - - StringBuffer sb = new StringBuffer(); - String separator = ""; - - for (final Iterator it = attributes.iterator(); it.hasNext();) - { - // AttributeFacade attr = (AttributeFacade)it.next(); - EJB3EntityAttributeFacade attr = (EJB3EntityAttributeFacade)it.next(); - if (!attr.isVersion()) - { - sb.append(separator); - separator = ", "; - if (includeTypes) - { - sb.append(attr.getType().getFullyQualifiedName()); - sb.append(" "); - } - if (includeNames) - { - sb.append(attr.getName()); - } - } - } - return sb.toString(); - } - /** * Create a collection of String objects representing the argument names. * |
From: Vance K. <va...@us...> - 2006-01-18 09:16:52
|
User: vancek Date: 06/01/18 01:16:46 Modified: andromda-ejb3/src/main/java/org/andromda/cartridges/ejb3 EJB3ScriptHelper.java Log: updated filterUpdatableAttributes method to remove identifier attributes for an entity with a composite primary key class Revision Changes Path 1.3 +6 -3 cartridges/andromda-ejb3/src/main/java/org/andromda/cartridges/ejb3/EJB3ScriptHelper.java Index: EJB3ScriptHelper.java =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-ejb3/src/main/java/org/andromda/cartridges/ejb3/EJB3ScriptHelper.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -w -r1.2 -r1.3 --- EJB3ScriptHelper.java 3 Jan 2006 01:33:44 -0000 1.2 +++ EJB3ScriptHelper.java 18 Jan 2006 09:16:46 -0000 1.3 @@ -1,6 +1,7 @@ package org.andromda.cartridges.ejb3; import org.andromda.cartridges.ejb3.metafacades.EJB3EntityAttributeFacade; +import org.andromda.cartridges.ejb3.metafacades.EJB3EntityFacade; import org.andromda.cartridges.ejb3.metafacades.EJB3SessionFacade; import org.andromda.metafacades.uml.AttributeFacade; import org.andromda.metafacades.uml.ModelElementFacade; @@ -58,18 +59,20 @@ /** * Filter a list of EntityAttributes by removing all non-updatable attributes. - * This filter currently removes all attributes that are of stereotype Version. + * This filter currently removes all attributes that are of stereotype Version + * and identifier attributes for an entity with a composite primary key class. * * @param list The original list + * @param isCompositePK True if entity has a composite primary key * @return Collection A list of EntityAttributes from the original list that are updatable */ - public Collection filterUpdatableAttributes(Collection list) + public Collection filterUpdatableAttributes(Collection list, boolean isCompositePK) { Collection retval = new ArrayList(list.size()); for (final Iterator iter = list.iterator(); iter.hasNext(); ) { EJB3EntityAttributeFacade attr = (EJB3EntityAttributeFacade)iter.next(); - if (!attr.isVersion()) + if (!attr.isVersion() && ((isCompositePK && !attr.isIdentifier()) || !isCompositePK)) { retval.add(attr); } |
From: Vance K. <va...@us...> - 2006-01-23 05:51:11
|
User: vancek Date: 06/01/22 21:51:05 Modified: andromda-ejb3/src/main/java/org/andromda/cartridges/ejb3 EJB3ScriptHelper.java Log: fixed filterUpdatableAttributes to filter identifiers with a specified generator Revision Changes Path 1.4 +8 -4 cartridges/andromda-ejb3/src/main/java/org/andromda/cartridges/ejb3/EJB3ScriptHelper.java Index: EJB3ScriptHelper.java =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-ejb3/src/main/java/org/andromda/cartridges/ejb3/EJB3ScriptHelper.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -w -r1.3 -r1.4 --- EJB3ScriptHelper.java 18 Jan 2006 09:16:46 -0000 1.3 +++ EJB3ScriptHelper.java 23 Jan 2006 05:51:05 -0000 1.4 @@ -60,19 +60,23 @@ /** * Filter a list of EntityAttributes by removing all non-updatable attributes. * This filter currently removes all attributes that are of stereotype Version - * and identifier attributes for an entity with a composite primary key class. + * It also removes identifier attributes for an entity with a composite primary key class + * or if the identifier attribute have a specified generator. * * @param list The original list - * @param isCompositePK True if entity has a composite primary key + * @param isCompositePKPresent True if entity has a composite primary key * @return Collection A list of EntityAttributes from the original list that are updatable */ - public Collection filterUpdatableAttributes(Collection list, boolean isCompositePK) + public Collection filterUpdatableAttributes(Collection list, boolean isCompositePKPresent) { Collection retval = new ArrayList(list.size()); for (final Iterator iter = list.iterator(); iter.hasNext(); ) { EJB3EntityAttributeFacade attr = (EJB3EntityAttributeFacade)iter.next(); - if (!attr.isVersion() && ((isCompositePK && !attr.isIdentifier()) || !isCompositePK)) + if (!attr.isVersion() && + ((isCompositePKPresent && !attr.isIdentifier()) || + (!isCompositePKPresent && (attr.isIdentifier() && attr.isGeneratorTypeNone()) || + !attr.isIdentifier()))) { retval.add(attr); } |
From: Vance K. <va...@us...> - 2006-01-31 15:23:45
|
User: vancek Date: 06/01/31 07:23:40 Modified: andromda-ejb3/src/main/java/org/andromda/cartridges/ejb3 EJB3ScriptHelper.java Log: added toUnderscoreName method Revision Changes Path 1.5 +19 -0 cartridges/andromda-ejb3/src/main/java/org/andromda/cartridges/ejb3/EJB3ScriptHelper.java Index: EJB3ScriptHelper.java =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-ejb3/src/main/java/org/andromda/cartridges/ejb3/EJB3ScriptHelper.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -w -r1.4 -r1.5 --- EJB3ScriptHelper.java 23 Jan 2006 05:51:05 -0000 1.4 +++ EJB3ScriptHelper.java 31 Jan 2006 15:23:40 -0000 1.5 @@ -5,6 +5,7 @@ import org.andromda.cartridges.ejb3.metafacades.EJB3SessionFacade; import org.andromda.metafacades.uml.AttributeFacade; import org.andromda.metafacades.uml.ModelElementFacade; +import org.apache.commons.lang.StringUtils; import java.util.ArrayList; import java.util.Collection; @@ -83,4 +84,22 @@ } return retval; } + + /** + * Replaces all instances of the dot (.) in the name argument with an understore (_) + * and returns the string response. + * + * @param name The name, typically a fully qualified name with dot notation + * @return The string with all dots replaced with underscore. + */ + public String toUnderscoreName(String name) + { + String result = null; + if (name != null) + { + result = StringUtils.replaceChars(name, '.', '_'); + } + return result; + + } } |
From: Vance K. <va...@us...> - 2006-02-06 03:36:26
|
User: vancek Date: 06/02/05 19:36:21 Modified: andromda-ejb3/src/main/java/org/andromda/cartridges/ejb3 EJB3ScriptHelper.java Log: added getInterceptorsAsList used in EJB3SessionFacade and EJB3SessionOperationFacade Revision Changes Path 1.6 +28 -0 cartridges/andromda-ejb3/src/main/java/org/andromda/cartridges/ejb3/EJB3ScriptHelper.java Index: EJB3ScriptHelper.java =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-ejb3/src/main/java/org/andromda/cartridges/ejb3/EJB3ScriptHelper.java,v retrieving revision 1.5 retrieving revision 1.6 diff -u -w -r1.5 -r1.6 --- EJB3ScriptHelper.java 31 Jan 2006 15:23:40 -0000 1.5 +++ EJB3ScriptHelper.java 6 Feb 2006 03:36:21 -0000 1.6 @@ -102,4 +102,32 @@ return result; } + + /** + * Returns the comma separated list of interceptor classes. + * + * @param interceptors The collection ModelElementFacade elements representing the interceptors + * @param prepend Prefix any interceptors to the comma separated list + * @return String containing the comma separated fully qualified class names + */ + public String getInterceptorsAsList(Collection interceptors, String prepend) + { + StringBuffer sb = new StringBuffer(); + String separator = ""; + + if (StringUtils.isNotBlank(prepend)) + { + sb.append(prepend); + separator = ", "; + } + + for (final Iterator it = interceptors.iterator(); it.hasNext();) + { + ModelElementFacade interceptor = (ModelElementFacade)it.next(); + sb.append(separator); + separator = ", "; + sb.append(interceptor.getFullyQualifiedName() + ".class"); + } + return sb.toString(); + } } |
From: Vance K. <va...@us...> - 2006-03-14 06:21:14
|
User: vancek Date: 06/03/13 22:21:13 Modified: andromda-ejb3/src/main/java/org/andromda/cartridges/ejb3 EJB3ScriptHelper.java Log: removed new line Revision Changes Path 1.7 +0 -1 cartridges/andromda-ejb3/src/main/java/org/andromda/cartridges/ejb3/EJB3ScriptHelper.java Index: EJB3ScriptHelper.java =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-ejb3/src/main/java/org/andromda/cartridges/ejb3/EJB3ScriptHelper.java,v retrieving revision 1.6 retrieving revision 1.7 diff -u -w -r1.6 -r1.7 --- EJB3ScriptHelper.java 6 Feb 2006 03:36:21 -0000 1.6 +++ EJB3ScriptHelper.java 14 Mar 2006 06:21:13 -0000 1.7 @@ -100,7 +100,6 @@ result = StringUtils.replaceChars(name, '.', '_'); } return result; - } /** |
From: Vance K. <va...@us...> - 2006-04-11 16:09:49
|
User: vancek Date: 06/04/11 09:09:45 Modified: andromda-ejb3/src/main/java/org/andromda/cartridges/ejb3 EJB3ScriptHelper.java Log: implemented reversePackage static method Revision Changes Path 1.8 +11 -0 cartridges/andromda-ejb3/src/main/java/org/andromda/cartridges/ejb3/EJB3ScriptHelper.java Index: EJB3ScriptHelper.java =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-ejb3/src/main/java/org/andromda/cartridges/ejb3/EJB3ScriptHelper.java,v retrieving revision 1.7 retrieving revision 1.8 diff -u -w -r1.7 -r1.8 --- EJB3ScriptHelper.java 14 Mar 2006 06:21:13 -0000 1.7 +++ EJB3ScriptHelper.java 11 Apr 2006 16:09:44 -0000 1.8 @@ -129,4 +129,15 @@ } return sb.toString(); } + + /** + * Reverses the <code>packageName</code>. + * + * @param packageName the package name to reverse. + * @return the reversed package name. + */ + public static String reversePackage(String packageName) + { + return StringUtils.reverseDelimited(packageName, EJB3Globals.NAMESPACE_DELIMITER); + } } |