|
a/src/net/timbusproject/extractors/utils/ArchiUtils.java |
|
b/src/net/timbusproject/extractors/utils/ArchiUtils.java |
|
... |
|
... |
7 |
import java.util.Map;
|
7 |
import java.util.Map;
|
8 |
|
8 |
|
9 |
import net.sf.taverna.t2.activities.stringconstant.StringConstantActivity;
|
9 |
import net.sf.taverna.t2.activities.stringconstant.StringConstantActivity;
|
10 |
import net.sf.taverna.t2.workflowmodel.Processor;
|
10 |
import net.sf.taverna.t2.workflowmodel.Processor;
|
11 |
import net.sf.taverna.t2.workflowmodel.processor.activity.Activity;
|
11 |
import net.sf.taverna.t2.workflowmodel.processor.activity.Activity;
|
12 |
|
|
|
13 |
import org.apache.log4j.LogManager;
|
|
|
14 |
import org.apache.log4j.Logger;
|
|
|
15 |
|
12 |
|
16 |
import uk.ac.bolton.archimate.model.FolderType;
|
13 |
import uk.ac.bolton.archimate.model.FolderType;
|
17 |
import uk.ac.bolton.archimate.model.IAccessRelationship;
|
14 |
import uk.ac.bolton.archimate.model.IAccessRelationship;
|
18 |
import uk.ac.bolton.archimate.model.IArchimateElement;
|
15 |
import uk.ac.bolton.archimate.model.IArchimateElement;
|
19 |
import uk.ac.bolton.archimate.model.IArchimateFactory;
|
16 |
import uk.ac.bolton.archimate.model.IArchimateFactory;
|
|
... |
|
... |
26 |
import com.google.common.collect.Iterators;
|
23 |
import com.google.common.collect.Iterators;
|
27 |
import com.google.common.collect.UnmodifiableIterator;
|
24 |
import com.google.common.collect.UnmodifiableIterator;
|
28 |
|
25 |
|
29 |
public class ArchiUtils {
|
26 |
public class ArchiUtils {
|
30 |
|
27 |
|
31 |
private static Logger LOGGER = LogManager.getLogger(ArchiUtils.class.getName());
|
|
|
32 |
|
|
|
33 |
/**
|
28 |
/**
|
34 |
* Group {@link IArchimateElement}s which have a relation of type {@link IAccessRelationship} between a source and a
|
29 |
* Group {@link IArchimateElement}s which have a relation of type {@link IAccessRelationship} between a source and a
|
35 |
* target element
|
30 |
* target element
|
36 |
*
|
31 |
*
|
37 |
* @param processors
|
32 |
* @param processors
|
38 |
* @param relationsList
|
33 |
* @param relationsList
|
|
... |
|
... |
53 |
List<IArchimateElement> elementsInBetween = ArchiUtils.getElementsInBetween(source, target,
|
48 |
List<IArchimateElement> elementsInBetween = ArchiUtils.getElementsInBetween(source, target,
|
54 |
relationsList);
|
49 |
relationsList);
|
55 |
|
50 |
|
56 |
if (elementsInBetween.size() > 0) {
|
51 |
if (elementsInBetween.size() > 0) {
|
57 |
|
52 |
|
58 |
ArrayList<IArchimateElement> key = new ArrayList<>();
|
53 |
ArrayList<IArchimateElement> key = new ArrayList<IArchimateElement>();
|
59 |
key.add(source);
|
54 |
key.add(source);
|
60 |
key.add(target);
|
55 |
key.add(target);
|
61 |
map.put(key, elementsInBetween);
|
56 |
map.put(key, elementsInBetween);
|
62 |
}
|
57 |
}
|
63 |
}
|
58 |
}
|
|
... |
|
... |
241 |
}
|
236 |
}
|
242 |
|
237 |
|
243 |
public static void redirectRelations(IArchimateElement parent, IArchimateElement source, IArchimateElement target,
|
238 |
public static void redirectRelations(IArchimateElement parent, IArchimateElement source, IArchimateElement target,
|
244 |
List<IArchimateElement> childs, List<IRelationship> relations) {
|
239 |
List<IArchimateElement> childs, List<IRelationship> relations) {
|
245 |
|
240 |
|
246 |
List<IRelationship> markedToRemove = new ArrayList<>();
|
241 |
List<IRelationship> markedToRemove = new ArrayList<IRelationship>();
|
247 |
for (IRelationship relation : relations) {
|
242 |
for (IRelationship relation : relations) {
|
248 |
|
243 |
|
249 |
for (IArchimateElement _target : childs) {
|
244 |
for (IArchimateElement _target : childs) {
|
250 |
|
245 |
|
251 |
if (relation.getSource().equals(source) && relation.getTarget().equals(_target)
|
246 |
if (relation.getSource().equals(source) && relation.getTarget().equals(_target)
|
|
... |
|
... |
335 |
elements.add(relation.getSource());
|
330 |
elements.add(relation.getSource());
|
336 |
}
|
331 |
}
|
337 |
return elements;
|
332 |
return elements;
|
338 |
}
|
333 |
}
|
339 |
|
334 |
|
340 |
public static void main(String[] args) {
|
|
|
341 |
IArchimateModel model = IArchimateFactory.eINSTANCE.createArchimateModel();
|
|
|
342 |
model.setDefaults();
|
|
|
343 |
model.setName("Test");
|
|
|
344 |
IFolder infrastructureFolder = model.getFolder(FolderType.TECHNOLOGY);
|
|
|
345 |
List<IArtifact> list = new ArrayList<IArtifact>();
|
|
|
346 |
final IArtifact x = initElement(IArchimateFactory.eINSTANCE.createArtifact(), "name", infrastructureFolder,
|
|
|
347 |
list);
|
|
|
348 |
}
|
|
|
349 |
|
|
|
350 |
}
|
335 |
}
|