[archstudio-commits] svn commit: r7070 - in /archstudio4/branches/enhancements/edu.uci.isr.archstudio4.comp.relatedelements/src/edu/uci/isr/archstudio4/comp/relatedelements: ./ processors/

archstudio-commits-owner at uci.edu archstudio-commits-owner at uci.edu
Fri May 2 13:02:27 PDT 2008


Author: ssubrama
Date: Fri May  2 13:02:27 2008
New Revision: 7070

Log:
Changes to Related Elements to support Types.

Added:
    archstudio4/branches/enhancements/edu.uci.isr.archstudio4.comp.relatede=
lements/src/edu/uci/isr/archstudio4/comp/relatedelements/processors/Related=
TypeElement.java
    archstudio4/branches/enhancements/edu.uci.isr.archstudio4.comp.relatede=
lements/src/edu/uci/isr/archstudio4/comp/relatedelements/processors/Related=
TypeElementsProcessor.java
Modified:
    archstudio4/branches/enhancements/edu.uci.isr.archstudio4.comp.relatede=
lements/src/edu/uci/isr/archstudio4/comp/relatedelements/IRelatedElementsPr=
ocessor.java
    archstudio4/branches/enhancements/edu.uci.isr.archstudio4.comp.relatede=
lements/src/edu/uci/isr/archstudio4/comp/relatedelements/RelatedElementsMan=
agerImpl.java
    archstudio4/branches/enhancements/edu.uci.isr.archstudio4.comp.relatede=
lements/src/edu/uci/isr/archstudio4/comp/relatedelements/processors/Related=
HintedElementsProcessor.java
    archstudio4/branches/enhancements/edu.uci.isr.archstudio4.comp.relatede=
lements/src/edu/uci/isr/archstudio4/comp/relatedelements/processors/Related=
RationaleElementsProcessor.java

Modified: archstudio4/branches/enhancements/edu.uci.isr.archstudio4.comp.re=
latedelements/src/edu/uci/isr/archstudio4/comp/relatedelements/IRelatedElem=
entsProcessor.java
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- archstudio4/branches/enhancements/edu.uci.isr.archstudio4.comp.relatede=
lements/src/edu/uci/isr/archstudio4/comp/relatedelements/IRelatedElementsPr=
ocessor.java (original)
+++ archstudio4/branches/enhancements/edu.uci.isr.archstudio4.comp.relatede=
lements/src/edu/uci/isr/archstudio4/comp/relatedelements/IRelatedElementsPr=
ocessor.java Fri May  2 13:02:27 2008
@@ -11,4 +11,5 @@
 			List<ObjRef> oldReferencedObjRefs, List<ObjRef> newReferencedObjRefs);
 =

 	ObjRef getTargetReferenceRef(ObjRef targetXArchRef,IRelatedElement relate=
dElement);
+	public boolean isDefaultSelection();
 }

Modified: archstudio4/branches/enhancements/edu.uci.isr.archstudio4.comp.re=
latedelements/src/edu/uci/isr/archstudio4/comp/relatedelements/RelatedEleme=
ntsManagerImpl.java
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- archstudio4/branches/enhancements/edu.uci.isr.archstudio4.comp.relatede=
lements/src/edu/uci/isr/archstudio4/comp/relatedelements/RelatedElementsMan=
agerImpl.java (original)
+++ archstudio4/branches/enhancements/edu.uci.isr.archstudio4.comp.relatede=
lements/src/edu/uci/isr/archstudio4/comp/relatedelements/RelatedElementsMan=
agerImpl.java Fri May  2 13:02:27 2008
@@ -4,6 +4,7 @@
 import java.util.List;
 =

 import edu.uci.isr.archstudio4.comp.relatedelements.processors.RelatedHint=
edElementsProcessor;
+import edu.uci.isr.archstudio4.comp.relatedelements.processors.RelatedType=
ElementsProcessor;
 import edu.uci.isr.xarchflat.ObjRef;
 import edu.uci.isr.xarchflat.XArchFlatInterface;
 =

@@ -18,6 +19,8 @@
 		relatedElementsProcessors =3D new ArrayList<IRelatedElementsProcessor>();
 		RelatedHintedElementsProcessor relatedHintedElementsProcessor =3D new Re=
latedHintedElementsProcessor(xArch);
 		relatedElementsProcessors.add(relatedHintedElementsProcessor);
+		RelatedTypeElementsProcessor relatedTypeElementsProcessor =3D new Relate=
dTypeElementsProcessor(xArch);
+		relatedElementsProcessors.add(relatedTypeElementsProcessor);
 	}
 	=

 	public List<IRelatedElement> getRelatedElements(ObjRef xArchRef,ObjRef ob=
jRef) {		=


Modified: archstudio4/branches/enhancements/edu.uci.isr.archstudio4.comp.re=
latedelements/src/edu/uci/isr/archstudio4/comp/relatedelements/processors/R=
elatedHintedElementsProcessor.java
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- archstudio4/branches/enhancements/edu.uci.isr.archstudio4.comp.relatede=
lements/src/edu/uci/isr/archstudio4/comp/relatedelements/processors/Related=
HintedElementsProcessor.java (original)
+++ archstudio4/branches/enhancements/edu.uci.isr.archstudio4.comp.relatede=
lements/src/edu/uci/isr/archstudio4/comp/relatedelements/processors/Related=
HintedElementsProcessor.java Fri May  2 13:02:27 2008
@@ -125,7 +125,10 @@
 			}
 			if(found) {
 				ObjRef[] refs =3D xArch.getAll(requiredHintBundleRef,"HintedElement");
-				ObjRef parentHintedElementRef =3D refs[0];
+				ObjRef parentHintedElementRef =3D null;
+				if(refs !=3D null && refs.length > 0) {
+					parentHintedElementRef =3D refs[0];
+				}
 				if(parentHintedElementRef =3D=3D null) {
 					parentHintedElementRef =3D xArch.create(hintsContextRef, "HintedEleme=
nt");
 				}
@@ -139,4 +142,8 @@
 		return null;
 =

 	}
+	=

+	public boolean isDefaultSelection() {
+		return true;
+	}
 }

Modified: archstudio4/branches/enhancements/edu.uci.isr.archstudio4.comp.re=
latedelements/src/edu/uci/isr/archstudio4/comp/relatedelements/processors/R=
elatedRationaleElementsProcessor.java
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- archstudio4/branches/enhancements/edu.uci.isr.archstudio4.comp.relatede=
lements/src/edu/uci/isr/archstudio4/comp/relatedelements/processors/Related=
RationaleElementsProcessor.java (original)
+++ archstudio4/branches/enhancements/edu.uci.isr.archstudio4.comp.relatede=
lements/src/edu/uci/isr/archstudio4/comp/relatedelements/processors/Related=
RationaleElementsProcessor.java Fri May  2 13:02:27 2008
@@ -52,4 +52,8 @@
 	public ObjRef getTargetReferenceRef(ObjRef targetXArchRef,IRelatedElement=
 relatedElement) {
 		return null;
 	}
+	=

+	public boolean isDefaultSelection() {
+		return false;
+	}
 }

Added: archstudio4/branches/enhancements/edu.uci.isr.archstudio4.comp.relat=
edelements/src/edu/uci/isr/archstudio4/comp/relatedelements/processors/Rela=
tedTypeElement.java
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- archstudio4/branches/enhancements/edu.uci.isr.archstudio4.comp.relatede=
lements/src/edu/uci/isr/archstudio4/comp/relatedelements/processors/Related=
TypeElement.java (added)
+++ archstudio4/branches/enhancements/edu.uci.isr.archstudio4.comp.relatede=
lements/src/edu/uci/isr/archstudio4/comp/relatedelements/processors/Related=
TypeElement.java Fri May  2 13:02:27 2008
@@ -0,0 +1,51 @@
+package edu.uci.isr.archstudio4.comp.relatedelements.processors;
+
+import java.util.Map;
+
+import edu.uci.isr.archstudio4.comp.relatedelements.IRelatedElement;
+import edu.uci.isr.archstudio4.comp.relatedelements.IRelatedElementsProces=
sor;
+import edu.uci.isr.xarchflat.ObjRef;
+import edu.uci.isr.xarchflat.XArchFlatInterface;
+
+public class RelatedTypeElement implements IRelatedElement{
+	=

+	ObjRef relatedObjRef;
+	=

+	ObjRef sourceObjRef;
+	=

+	XArchFlatInterface xArch;
+	=

+	String description;
+	=

+	IRelatedElementsProcessor relatedTypeElementsProcessor;
+	=

+	Map<String,String> properties;
+	=

+	public RelatedTypeElement(ObjRef sourceObjRef,ObjRef relatedObjRef,String=
 description,IRelatedElementsProcessor relatedTypeElementsProcessor,Map<Str=
ing,String> properties) {
+		this.sourceObjRef =3D sourceObjRef;
+		this.relatedObjRef =3D relatedObjRef;
+		this.description =3D description;
+		this.relatedTypeElementsProcessor =3D relatedTypeElementsProcessor;
+		this.properties =3D properties;
+	}
+	=

+	public String getDescription() {
+		return this.description;
+	}
+
+	public ObjRef getRelatedObjRef() {
+		return relatedObjRef;
+	}
+	=

+	public IRelatedElementsProcessor getRelatedElementsProcessor() {
+		return this.relatedTypeElementsProcessor;
+	}
+	=

+	public Map<String,String> getProperties() {
+		return this.properties;
+	}
+	=

+	public ObjRef getSourceObjRef() {
+		return this.sourceObjRef;
+	}	=

+}

Added: archstudio4/branches/enhancements/edu.uci.isr.archstudio4.comp.relat=
edelements/src/edu/uci/isr/archstudio4/comp/relatedelements/processors/Rela=
tedTypeElementsProcessor.java
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- archstudio4/branches/enhancements/edu.uci.isr.archstudio4.comp.relatede=
lements/src/edu/uci/isr/archstudio4/comp/relatedelements/processors/Related=
TypeElementsProcessor.java (added)
+++ archstudio4/branches/enhancements/edu.uci.isr.archstudio4.comp.relatede=
lements/src/edu/uci/isr/archstudio4/comp/relatedelements/processors/Related=
TypeElementsProcessor.java Fri May  2 13:02:27 2008
@@ -0,0 +1,70 @@
+package edu.uci.isr.archstudio4.comp.relatedelements.processors;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import edu.uci.isr.archstudio4.comp.relatedelements.IRelatedElement;
+import edu.uci.isr.archstudio4.comp.relatedelements.IRelatedElementsProces=
sor;
+import edu.uci.isr.xarchflat.IXArchPropertyMetadata;
+import edu.uci.isr.xarchflat.IXArchTypeMetadata;
+import edu.uci.isr.xarchflat.ObjRef;
+import edu.uci.isr.xarchflat.XArchFlatInterface;
+
+public class RelatedTypeElementsProcessor implements IRelatedElementsProce=
ssor{
+
+	XArchFlatInterface xArch;
+
+	public RelatedTypeElementsProcessor(XArchFlatInterface xArch) {
+		this.xArch =3D xArch;
+	}
+
+	public List<IRelatedElement> getRelatedElements(ObjRef objRef) {
+		IXArchTypeMetadata typeMetadata =3D xArch.getTypeMetadata(objRef);
+		IXArchPropertyMetadata propertyMetadata =3D typeMetadata.getProperty("Ty=
pe");
+		if(propertyMetadata !=3D null) {
+			String type =3D propertyMetadata.getType();
+			if(type !=3D null && type.equals("instance#XMLLink")) {
+				ObjRef typeRef =3D (ObjRef)xArch.get(objRef,"Type");
+				if(typeRef !=3D null) {				=

+					String href =3D (String)xArch.get(typeRef,"href");
+					if(href !=3D null && !"".equals(href.trim())) {
+						String id =3D href.replaceFirst("#", "");
+						ObjRef xArchRef =3D xArch.getXArch(objRef);
+						ObjRef objRefType =3D xArch.getByID(xArchRef,id);
+						String description =3D (String)xArch.get((ObjRef)xArch.get(objRefTyp=
e,"Description"),"value");
+						IRelatedElement relatedElement =3D new RelatedTypeElement(objRef,obj=
RefType,description,this,null);
+						List<IRelatedElement> relatedElements =3D new ArrayList<IRelatedElem=
ent>();
+						relatedElements.add(relatedElement);
+						return relatedElements;
+					}
+				}
+			}
+		}
+		return null;
+	}
+
+	public ObjRef getTargetReferenceRef(ObjRef targetXArchRef,
+			IRelatedElement relatedElement) {
+
+		ObjRef contextRef =3D xArch.createContext(targetXArchRef, "types");
+		ObjRef typesElement =3D xArch.getElement(contextRef, "ArchTypes",targetX=
ArchRef);
+		if(typesElement =3D=3D null) {
+			typesElement =3D xArch.createElement(contextRef, "types#ArchTypes");
+			xArch.add(targetXArchRef,"object",typesElement);
+		}		=

+		return typesElement;
+	}
+
+	public boolean isDefaultSelection() {
+		return false;
+	}
+
+	public void paste(IRelatedElement relatedElement, ObjRef newXArchRef,
+			ObjRef duplicateObjRef, List<ObjRef> oldReferencedObjRefs,
+			List<ObjRef> newReferencedObjRefs) {
+		// TODO Auto-generated method stub
+
+	}
+}




More information about the archstudio-commits mailing list