summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRainer Pielmann2012-11-08 08:44:05 (EST)
committer Sven Rottstock2012-11-08 08:44:05 (EST)
commit86c611b05df79c6753a15773849502ccb301c6e2 (patch)
tree795339c6f4b7e5721251c9bda746dee7181b3a57
parent1f2944447c1898a5181942fb6e497386313e9909 (diff)
downloadorg.eclipse.stardust.ide-86c611b05df79c6753a15773849502ccb301c6e2.zip
org.eclipse.stardust.ide-86c611b05df79c6753a15773849502ccb301c6e2.tar.gz
org.eclipse.stardust.ide-86c611b05df79c6753a15773849502ccb301c6e2.tar.bz2
CRNT-26945 We based Modeler: Add getBooleanAttributes method to ModelBuilderFacade.
git-svn-id: http://emeafrazerg/svn/ipp/product/trunk/stardust/ide@60668 8100b5e0-4d52-466c-ae9c-bdeccbdeaf6b
-rw-r--r--model/org.eclipse.stardust.model.xpdl.builder/src/main/java/org/eclipse/stardust/model/xpdl/builder/utils/ModelBuilderFacade.java44
1 files changed, 44 insertions, 0 deletions
diff --git a/model/org.eclipse.stardust.model.xpdl.builder/src/main/java/org/eclipse/stardust/model/xpdl/builder/utils/ModelBuilderFacade.java b/model/org.eclipse.stardust.model.xpdl.builder/src/main/java/org/eclipse/stardust/model/xpdl/builder/utils/ModelBuilderFacade.java
index 87b36d7..d7ea684 100644
--- a/model/org.eclipse.stardust.model.xpdl.builder/src/main/java/org/eclipse/stardust/model/xpdl/builder/utils/ModelBuilderFacade.java
+++ b/model/org.eclipse.stardust.model.xpdl.builder/src/main/java/org/eclipse/stardust/model/xpdl/builder/utils/ModelBuilderFacade.java
@@ -2574,6 +2574,31 @@ public class ModelBuilderFacade
return new ArrayList();
}
+ @SuppressWarnings({"rawtypes", "unchecked"})
+ public List getAttributes(Object element, boolean excludeBoolean, boolean booleanOnly)
+ {
+ if (excludeBoolean == booleanOnly && booleanOnly == true)
+ {
+ return new ArrayList();
+ }
+ List attributes = getAttributes(element);
+ if (excludeBoolean == booleanOnly && booleanOnly == false)
+ {
+ return attributes;
+ }
+ List filteredAttributes = new ArrayList();
+ for (Iterator<Object> i = attributes.iterator(); i.hasNext();)
+ {
+ Object attribute = i.next();
+ if ((booleanOnly && isBooleanAttribute(attribute))
+ || (excludeBoolean && !isBooleanAttribute(attribute)))
+ {
+ filteredAttributes.add(attribute);
+ }
+ }
+ return filteredAttributes;
+ }
+
/**
*
* @param element
@@ -2619,6 +2644,25 @@ public class ModelBuilderFacade
return null;
}
+ public boolean isBooleanAttribute(Object attribute)
+ {
+ if (attribute instanceof ExtendedAttributeType)
+ {
+ ExtendedAttributeType attributeType = (ExtendedAttributeType)attribute;
+ if (attributeType.getValue().equalsIgnoreCase("true") || attributeType.getValue().equalsIgnoreCase("false")) {
+ return true;
+ }
+ }
+ if (attribute instanceof AttributeType)
+ {
+ AttributeType attributeType = (AttributeType)attribute;
+ if (attributeType.getType() != null && attributeType.getType().equalsIgnoreCase("Boolean")) {
+ return true;
+ }
+ }
+ return false;
+ }
+
public boolean isExternalReference(EObject modelElement)
{
if (modelElement != null)