From: Vance K. <va...@us...> - 2006-06-14 05:01:14
|
User: vancek Date: 06/06/13 22:01:14 Modified: andromda-ejb3/src/main/java/org/andromda/cartridges/ejb3/metafacades EJB3MetafacadeUtils.java Log: getViewType no longer has to worry about interface view type for entity pojos Revision Changes Path 1.6 +74 -24 cartridges/andromda-ejb3/src/main/java/org/andromda/cartridges/ejb3/metafacades/EJB3MetafacadeUtils.java Index: EJB3MetafacadeUtils.java =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-ejb3/src/main/java/org/andromda/cartridges/ejb3/metafacades/EJB3MetafacadeUtils.java,v retrieving revision 1.5 retrieving revision 1.6 diff -u -w -r1.5 -r1.6 --- EJB3MetafacadeUtils.java 1 Feb 2006 08:41:34 -0000 1.5 +++ EJB3MetafacadeUtils.java 14 Jun 2006 05:01:13 -0000 1.6 @@ -90,8 +90,7 @@ * view type can be retrieved from the <code>classifier</code>, then the * <code>defaultViewType</code> is returned. * - * If the model element has the entity stereotype, returns 'local'. - * Otherwise (session ejb) checks the ejb tagged value and if there is + * If session ejb pojo then checks the ejb tagged value and if there is * no value defined, returns 'remote'. * * @param classifier The classifier to lookup the view type tagged value @@ -105,19 +104,16 @@ final String methodName = "EJBMetafacadeUtils.getViewType"; ExceptionUtils.checkNull(methodName, "classifer", classifier); String viewType = (String)classifier.findTaggedValue(EJB3Profile.TAGGEDVALUE_EJB_VIEWTYPE); - if (classifier.hasStereotype(EJB3Profile.STEREOTYPE_ENTITY)) - { if (StringUtils.isEmpty(viewType)) { - viewType = (StringUtils.isNotBlank(defaultViewType) ? defaultViewType : EJB3Globals.VIEW_TYPE_LOCAL); - } - } - else if (classifier.hasStereotype(EJB3Profile.STEREOTYPE_SERVICE)) + if (classifier.hasStereotype(EJB3Profile.STEREOTYPE_SERVICE)) { // if the view type wasn't found, search all super classes if (StringUtils.isEmpty(viewType)) { - viewType = (String)CollectionUtils.find(classifier.getAllGeneralizations(), new Predicate() + viewType = (String)CollectionUtils.find( + classifier.getAllGeneralizations(), + new Predicate() { public boolean evaluate(Object object) { @@ -128,7 +124,9 @@ } if (StringUtils.isEmpty(viewType)) { - viewType = (StringUtils.isNotBlank(defaultViewType) ? defaultViewType : EJB3Globals.VIEW_TYPE_REMOTE); + viewType = (StringUtils.isNotBlank(defaultViewType) ? + defaultViewType : EJB3Globals.VIEW_TYPE_REMOTE); + } } } return viewType.toLowerCase(); @@ -356,4 +354,56 @@ fullyQualifiedName.append(StringUtils.trimToEmpty(suffix)); return fullyQualifiedName.toString(); } + + /** + * Returns true if the Seam stereotype is modelled on the class. + * + * @param classifier The classifier to lookup if the stereotype is modelled + * @return True is stereotype exists, false otherwise + */ + static boolean isSeamComponent(ClassifierFacade classifier) + { + boolean isSeamComponent = false; + if (classifier.hasStereotype(EJB3Profile.STEREOTYPE_SEAM_COMPONENT)) + { + isSeamComponent = true; + } + return isSeamComponent; + } + + /** + * Gets the Seam component scope type for Entity and Session beans. + * If no scope has been specified: + * If the Classifier is a stateless session bean, then returns STATELESS + * If the Classifier is an entity or stateful session bean, then returns CONVERSATION + * + * @param classifier The classifier to lookup the scope type tagged value + * @paam stateful Whether the classifier is a stateful session bean + * @return The scope type as a String + */ + static String getSeamComponentScopeType(ClassifierFacade classifier, boolean stateless) + { + final String methodName = "EJBMetafacadeUtils.getSeamComponentScopeType"; + ExceptionUtils.checkNull(methodName, "classifer", classifier); + return (String)classifier.findTaggedValue(EJB3Profile.TAGGEDVALUE_SEAM_SCOPE_TYPE); + } + + /** + * Returns the Seam component name. Can override using tagged value, otherwise just the + * class name. + * + * @param classifier The classifier to get the tagged value or the name from. + * @return The Seam component name + */ + static String getSeamComponentName(ClassifierFacade classifier) + { + final String methodName = "EJBMetafacadeUtils.getSeamComponentName"; + ExceptionUtils.checkNull(methodName, "classifer", classifier); + String componentName = (String)classifier.findTaggedValue(EJB3Profile.TAGGEDVALUE_SEAM_COMPONENT_NAME); + if (StringUtils.isBlank(componentName)) + { + componentName = StringUtils.uncapitalize(classifier.getName()); + } + return componentName; + } } \ No newline at end of file |
From: Vance K. <va...@us...> - 2007-02-01 14:32:15
|
User: vancek Date: 07/02/01 06:32:10 Modified: andromda-ejb3/src/site changes.xml andromda-ejb3/src/main/java/org/andromda/cartridges/ejb3/metafacades EJB3MetafacadeUtils.java Log: incorrect method attribute name causing invalid transaction type annotation for type NotSupported Revision Changes Path 1.5 +3 -0 cartridges/andromda-ejb3/src/site/changes.xml Index: changes.xml =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-ejb3/src/site/changes.xml,v retrieving revision 1.4 retrieving revision 1.5 diff -u -w -r1.4 -r1.5 --- changes.xml 24 Jan 2007 04:37:55 -0000 1.4 +++ changes.xml 1 Feb 2007 14:32:10 -0000 1.5 @@ -354,6 +354,9 @@ <action dev="vancek" type="fix"> Fix DAO injection into DAO base when entity references another entity. </action> + <action dev="vancek" due-to="rajtuz" type="fix"> + Fix incorrect method name in EJB3MetafacadeUtils.convertTransactionType() for transaction type NotSupported. + </action> </release> </body> </document> \ No newline at end of file 1.9 +1 -1 cartridges/andromda-ejb3/src/main/java/org/andromda/cartridges/ejb3/metafacades/EJB3MetafacadeUtils.java Index: EJB3MetafacadeUtils.java =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-ejb3/src/main/java/org/andromda/cartridges/ejb3/metafacades/EJB3MetafacadeUtils.java,v retrieving revision 1.8 retrieving revision 1.9 diff -u -w -r1.8 -r1.9 --- EJB3MetafacadeUtils.java 17 Jan 2007 00:50:55 -0000 1.8 +++ EJB3MetafacadeUtils.java 1 Feb 2007 14:32:10 -0000 1.9 @@ -250,7 +250,7 @@ } else if (StringUtils.equalsIgnoreCase(transType, EJB3Globals.TRANSACTION_TYPE_NOT_SUPPORTED)) { - transType = "NOT_SUPPORTED"; + type = "NOT_SUPPORTED"; } else if (StringUtils.equalsIgnoreCase(transType, EJB3Globals.TRANSACTION_TYPE_REQUIRED)) { |