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); } |