Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework')
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event/filter/ArtifactTypeEventFilter.java2
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/internal/DslToTypeLoader.java14
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/relation/RelationLink.java9
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/relation/RelationManager.java13
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/relation/RelationTypeSideSorter.java20
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/relation/order/RelationOrderData.java36
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/relation/order/RelationOrderMergeUtility.java7
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/relation/order/RelationOrderParser.java11
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/relation/order/RelationSorterIdComparator.java28
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/relation/order/RelationSorterProvider.java20
10 files changed, 52 insertions, 108 deletions
diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event/filter/ArtifactTypeEventFilter.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event/filter/ArtifactTypeEventFilter.java
index c8d27a61b9a..58db429cb3a 100644
--- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event/filter/ArtifactTypeEventFilter.java
+++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event/filter/ArtifactTypeEventFilter.java
@@ -57,7 +57,7 @@ public class ArtifactTypeEventFilter implements IEventFilter {
return true;
}
for (IArtifactType matchArtType : artifactTypes) {
- if (matchArtType.getGuid().equals(artType.getGuid())) {
+ if (matchArtType.equals(artType)) {
return true;
}
}
diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/internal/DslToTypeLoader.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/internal/DslToTypeLoader.java
index 8223f77763f..aa1ff0246d9 100644
--- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/internal/DslToTypeLoader.java
+++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/internal/DslToTypeLoader.java
@@ -23,6 +23,7 @@ import java.util.Set;
import java.util.logging.Level;
import org.eclipse.emf.common.util.EList;
import org.eclipse.osee.framework.core.data.BranchId;
+import org.eclipse.osee.framework.core.data.RelationSorter;
import org.eclipse.osee.framework.core.data.TokenFactory;
import org.eclipse.osee.framework.core.dsl.OseeDslResource;
import org.eclipse.osee.framework.core.dsl.OseeDslResourceUtil;
@@ -45,7 +46,6 @@ import org.eclipse.osee.framework.core.dsl.oseeDsl.XOseeEnumType;
import org.eclipse.osee.framework.core.dsl.oseeDsl.XRelationType;
import org.eclipse.osee.framework.core.dsl.oseeDsl.util.OseeDslSwitch;
import org.eclipse.osee.framework.core.enums.CoreBranches;
-import org.eclipse.osee.framework.core.enums.RelationOrderBaseTypes;
import org.eclipse.osee.framework.core.enums.RelationTypeMultiplicity;
import org.eclipse.osee.framework.core.model.IOseeStorable;
import org.eclipse.osee.framework.core.model.OseeEnumEntry;
@@ -64,7 +64,6 @@ import org.eclipse.osee.framework.core.model.type.OseeEnumTypeFactory;
import org.eclipse.osee.framework.core.model.type.RelationTypeFactory;
import org.eclipse.osee.framework.core.services.IOseeCachingService;
import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
-import org.eclipse.osee.framework.jdk.core.util.Conditions;
import org.eclipse.osee.framework.jdk.core.util.HexUtil;
import org.eclipse.osee.framework.jdk.core.util.Lib;
import org.eclipse.osee.framework.jdk.core.util.Strings;
@@ -166,8 +165,7 @@ public class DslToTypeLoader implements TypesLoader {
}
private Map<BranchId, Collection<AttributeType>> getOseeAttributes(TypeBuffer buffer, BranchCache branchCache, XArtifactType xArtifactType) throws OseeCoreException {
- Map<BranchId, Collection<AttributeType>> validAttributes =
- new HashMap<BranchId, Collection<AttributeType>>();
+ Map<BranchId, Collection<AttributeType>> validAttributes = new HashMap<BranchId, Collection<AttributeType>>();
for (XAttributeTypeRef xAttributeTypeRef : xArtifactType.getValidAttributeTypes()) {
XAttributeType xAttributeType = xAttributeTypeRef.getValidAttributeType();
BranchId branch = getAttributeBranch(branchCache, xAttributeTypeRef);
@@ -375,13 +373,7 @@ public class DslToTypeLoader implements TypesLoader {
sideAType, //
sideBType, //
multiplicity, //
- orderTypeNameToGuid(xRelationType.getDefaultOrderType()) //
- );
- }
-
- private String orderTypeNameToGuid(String orderTypeName) throws OseeCoreException {
- Conditions.checkNotNull(orderTypeName, "orderTypeName");
- return RelationOrderBaseTypes.getFromOrderTypeName(orderTypeName.replaceAll("_", " ")).getGuid();
+ RelationSorter.valueOfName(xRelationType.getDefaultOrderType()));
}
private static final class TypeBuffer {
diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/relation/RelationLink.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/relation/RelationLink.java
index 35a68d418b5..2042dee5616 100644
--- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/relation/RelationLink.java
+++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/relation/RelationLink.java
@@ -15,12 +15,11 @@ import java.util.logging.Level;
import org.eclipse.osee.framework.core.data.ApplicabilityId;
import org.eclipse.osee.framework.core.data.BranchId;
import org.eclipse.osee.framework.core.data.HasBranch;
-import org.eclipse.osee.framework.core.data.RelationSorter;
import org.eclipse.osee.framework.core.data.IRelationType;
+import org.eclipse.osee.framework.core.data.RelationSorter;
import org.eclipse.osee.framework.core.enums.CoreAttributeTypes;
import org.eclipse.osee.framework.core.enums.DeletionFlag;
import org.eclipse.osee.framework.core.enums.ModificationType;
-import org.eclipse.osee.framework.core.enums.RelationOrderBaseTypes;
import org.eclipse.osee.framework.core.enums.RelationSide;
import org.eclipse.osee.framework.core.model.type.RelationType;
import org.eclipse.osee.framework.jdk.core.type.OseeArgumentException;
@@ -393,10 +392,8 @@ public class RelationLink implements HasBranch {
RelationOrderData leftData = factory.createRelationOrderData(aArtifact);
RelationOrderData rightData = factory.createRelationOrderData(bArtifact);
- RelationSorter leftSorter =
- RelationOrderBaseTypes.getFromGuid(leftData.getCurrentSorterGuid(getRelationType(), getSide(aArtifact)));
- RelationSorter rightSorter =
- RelationOrderBaseTypes.getFromGuid(rightData.getCurrentSorterGuid(getRelationType(), getSide(bArtifact)));
+ RelationSorter leftSorter = leftData.getCurrentSorterGuid(getRelationType(), getSide(aArtifact));
+ RelationSorter rightSorter = rightData.getCurrentSorterGuid(getRelationType(), getSide(bArtifact));
return rightSorter.equals(USER_DEFINED) && leftSorter.equals(USER_DEFINED);
}
diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/relation/RelationManager.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/relation/RelationManager.java
index 0ac6a311c09..7f232020670 100644
--- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/relation/RelationManager.java
+++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/relation/RelationManager.java
@@ -24,9 +24,9 @@ import java.util.concurrent.CopyOnWriteArrayList;
import java.util.logging.Level;
import org.eclipse.osee.framework.core.data.ApplicabilityId;
import org.eclipse.osee.framework.core.data.BranchId;
-import org.eclipse.osee.framework.core.data.RelationSorter;
import org.eclipse.osee.framework.core.data.IRelationType;
import org.eclipse.osee.framework.core.data.IRelationTypeSide;
+import org.eclipse.osee.framework.core.data.RelationSorter;
import org.eclipse.osee.framework.core.enums.DeletionFlag;
import org.eclipse.osee.framework.core.enums.ModificationType;
import org.eclipse.osee.framework.core.enums.RelationOrderBaseTypes;
@@ -84,9 +84,9 @@ public class RelationManager {
// Need to do this check before to catch the relations that are .equal but not ==
for (RelationLink relation : artifactsRelations) {
if (relation.getAArtifactId() == newRelation.getAArtifactId() && //
- relation.getBArtifactId() == newRelation.getBArtifactId() && //
- relation.getRelationType() == newRelation.getRelationType() && //
- relation != newRelation) {
+ relation.getBArtifactId() == newRelation.getBArtifactId() && //
+ relation.getRelationType() == newRelation.getRelationType() && //
+ relation != newRelation) {
OseeLog.logf(Activator.class, Level.WARNING,
"Duplicate relation objects for same relation for RELATION 1 [%s] RELATION 2 [%s]", relation,
newRelation);
@@ -111,7 +111,6 @@ public class RelationManager {
return getRelatedArtifacts(artifact, relationType, relationSide, true);
}
- @SuppressWarnings("unused")
private static List<Artifact> getRelatedArtifacts(Artifact artifact, IRelationType relationType, RelationSide relationSide, boolean sort) throws OseeCoreException {
if (artifact.isHistorical()) {
throw new OseeCoreException("Artifact [%s] is historical. Historical relations are only supported on server",
@@ -552,10 +551,6 @@ public class RelationManager {
relationType.getName(), artifactA.getName(), artifactB.getName());
}
- public static RelationSorterProvider getSorterProvider() {
- return relationSorterProvider;
- }
-
public static List<RelationSorter> getRelationOrderTypes() {
return relationSorterProvider.getAllRelationOrderIds();
}
diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/relation/RelationTypeSideSorter.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/relation/RelationTypeSideSorter.java
index 7e752340af9..0dc386c959a 100644
--- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/relation/RelationTypeSideSorter.java
+++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/relation/RelationTypeSideSorter.java
@@ -77,26 +77,12 @@ public class RelationTypeSideSorter extends RelationTypeSide {
return hashCode;
}
- public RelationType getRelationTypeHard() {
- return relationType;
- }
-
- private IRelationSorter getSorter() throws OseeCoreException {
- String guid = orderData.getCurrentSorterGuid(getRelationTypeHard(), getSide());
- return sorterProvider.getRelationOrder(guid);
- }
-
public RelationSorter getSorterId() throws OseeCoreException {
- return getSorter().getSorterId();
- }
-
- public String getSorterName() throws OseeCoreException {
- RelationSorter id = getSorterId();
- return id.getName();
+ return orderData.getCurrentSorterGuid(relationType, getSide());
}
public void sort(List<? extends IArtifact> listToOrder) throws OseeCoreException {
- IRelationSorter order = getSorter();
+ IRelationSorter order = sorterProvider.getRelationOrder(getSorterId());
List<String> relativeOrder = orderData.getOrderList(getRelationType(), getSide());
order.sort(listToOrder, relativeOrder);
}
@@ -137,7 +123,7 @@ public class RelationTypeSideSorter extends RelationTypeSide {
}
public void setOrder(List<? extends IArtifact> relatives, RelationSorter sorterId) throws OseeCoreException {
- orderData.store(getRelationTypeHard(), getSide(), sorterId, relatives);
+ orderData.store(relationType, getSide(), sorterId, relatives);
}
@Override
diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/relation/order/RelationOrderData.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/relation/order/RelationOrderData.java
index 46987560031..0a7473eb2fb 100644
--- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/relation/order/RelationOrderData.java
+++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/relation/order/RelationOrderData.java
@@ -18,8 +18,8 @@ import java.util.Comparator;
import java.util.List;
import java.util.Map.Entry;
import org.eclipse.osee.framework.core.data.BranchId;
-import org.eclipse.osee.framework.core.data.RelationSorter;
import org.eclipse.osee.framework.core.data.IRelationType;
+import org.eclipse.osee.framework.core.data.RelationSorter;
import org.eclipse.osee.framework.core.enums.RelationOrderBaseTypes;
import org.eclipse.osee.framework.core.enums.RelationSide;
import org.eclipse.osee.framework.core.model.event.DefaultBasicGuidArtifact;
@@ -38,7 +38,7 @@ import org.eclipse.osee.framework.skynet.core.utility.Artifacts;
*/
public class RelationOrderData {
- private final CompositeKeyHashMap<String, String, Pair<String, List<String>>> lists;
+ private final CompositeKeyHashMap<String, String, Pair<RelationSorter, List<String>>> lists;
private final IRelationOrderAccessor accessor;
private final IArtifact artifact;
@@ -61,39 +61,38 @@ public class RelationOrderData {
accessor.load(getIArtifact(), this);
}
- public Collection<Entry<Pair<String, String>, Pair<String, List<String>>>> entrySet() {
+ public Collection<Entry<Pair<String, String>, Pair<RelationSorter, List<String>>>> entrySet() {
return lists.entrySet();
}
- public Collection<Entry<Pair<String, String>, Pair<String, List<String>>>> getOrderedEntrySet() {
- List<Entry<Pair<String, String>, Pair<String, List<String>>>> entries =
- new ArrayList<Entry<Pair<String, String>, Pair<String, List<String>>>>(entrySet());
+ public Collection<Entry<Pair<String, String>, Pair<RelationSorter, List<String>>>> getOrderedEntrySet() {
+ List<Entry<Pair<String, String>, Pair<RelationSorter, List<String>>>> entries = new ArrayList<>(entrySet());
Collections.sort(entries, new EntryComparator());
return entries;
}
public List<String> getOrderList(IRelationType type, RelationSide side) throws OseeCoreException {
- Pair<String, List<String>> currentOrder = getTypeSideEntry(type, side);
+ Pair<RelationSorter, List<String>> currentOrder = getTypeSideEntry(type, side);
return currentOrder != null ? currentOrder.getSecond() : new ArrayList<String>();
}
- public String getCurrentSorterGuid(RelationType type, RelationSide side) throws OseeCoreException {
- Pair<String, List<String>> currentOrder = getTypeSideEntry(type, side);
+ public RelationSorter getCurrentSorterGuid(RelationType type, RelationSide side) throws OseeCoreException {
+ Pair<RelationSorter, List<String>> currentOrder = getTypeSideEntry(type, side);
return currentOrder != null ? currentOrder.getFirst() : type.getDefaultOrderTypeGuid();
}
- private Pair<String, List<String>> getTypeSideEntry(IRelationType type, RelationSide side) throws OseeCoreException {
+ private Pair<RelationSorter, List<String>> getTypeSideEntry(IRelationType type, RelationSide side) throws OseeCoreException {
Conditions.checkNotNull(type, "relationType");
Conditions.checkNotNull(side, "relationSide");
return lists.get(type.getName(), side.name());
}
public void addOrderList(IRelationType type, RelationSide side, RelationSorter sorterId, List<String> guidList) {
- addOrderList(type.getName(), side.name(), sorterId.getGuid(), guidList);
+ addOrderList(type.getName(), side.name(), sorterId, guidList);
}
- public void addOrderList(String relationType, String relationSide, String sorterGuid, List<String> guidList) {
- lists.put(relationType, relationSide, new Pair<String, List<String>>(sorterGuid, guidList));
+ public void addOrderList(String relationType, String relationSide, RelationSorter sorterId, List<String> guidList) {
+ lists.put(relationType, relationSide, new Pair<RelationSorter, List<String>>(sorterId, guidList));
}
public void removeOrderList(IRelationType type, RelationSide side) throws OseeCoreException {
@@ -138,8 +137,7 @@ public class RelationOrderData {
}
protected boolean isRevertingToDefaultTypeOrder(RelationType type, RelationSide side, RelationSorter sorterId) throws OseeCoreException {
- String defaultOrderGuid = type.getDefaultOrderTypeGuid();
- return sorterId.getGuid().equals(defaultOrderGuid) && isDifferentSorterId(type, side, sorterId);
+ return sorterId.equals(type.getDefaultOrderTypeGuid()) && isDifferentSorterId(type, side, sorterId);
}
protected boolean isRelativeOrderChange(IRelationType type, RelationSide side, RelationSorter sorterId, List<String> relativeSequence) throws OseeCoreException {
@@ -147,8 +145,8 @@ public class RelationOrderData {
}
protected boolean isDifferentSorterId(RelationType type, RelationSide side, RelationSorter sorterId) throws OseeCoreException {
- String currentSorterGuid = getCurrentSorterGuid(type, side);
- return !sorterId.getGuid().equals(currentSorterGuid);
+ RelationSorter currentSorterGuid = getCurrentSorterGuid(type, side);
+ return !sorterId.equals(currentSorterGuid);
}
@Override
@@ -160,11 +158,11 @@ public class RelationOrderData {
return lists.getEnumeratedKeys();
}
- private final static class EntryComparator implements Serializable, Comparator<Entry<Pair<String, String>, Pair<String, List<String>>>> {
+ private final static class EntryComparator implements Serializable, Comparator<Entry<Pair<String, String>, Pair<RelationSorter, List<String>>>> {
private static final long serialVersionUID = 5242452476694174988L;
@Override
- public int compare(Entry<Pair<String, String>, Pair<String, List<String>>> o1, Entry<Pair<String, String>, Pair<String, List<String>>> o2) {
+ public int compare(Entry<Pair<String, String>, Pair<RelationSorter, List<String>>> o1, Entry<Pair<String, String>, Pair<RelationSorter, List<String>>> o2) {
int result = o1.getKey().getFirst().compareTo(o2.getKey().getFirst());
if (result == 0) {
result = o1.getKey().getSecond().compareTo(o2.getKey().getSecond());
diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/relation/order/RelationOrderMergeUtility.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/relation/order/RelationOrderMergeUtility.java
index a4d232ae508..74d5933063a 100644
--- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/relation/order/RelationOrderMergeUtility.java
+++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/relation/order/RelationOrderMergeUtility.java
@@ -15,10 +15,9 @@ import java.util.ArrayList;
import java.util.Collection;
import java.util.HashSet;
import java.util.List;
-import org.eclipse.osee.framework.core.data.RelationSorter;
import org.eclipse.osee.framework.core.data.IRelationTypeSide;
+import org.eclipse.osee.framework.core.data.RelationSorter;
import org.eclipse.osee.framework.core.enums.DeletionFlag;
-import org.eclipse.osee.framework.core.enums.RelationOrderBaseTypes;
import org.eclipse.osee.framework.core.enums.RelationSide;
import org.eclipse.osee.framework.core.model.RelationTypeSide;
import org.eclipse.osee.framework.core.model.type.RelationType;
@@ -41,8 +40,8 @@ public class RelationOrderMergeUtility {
RelationType type = RelationTypeManager.getType(typeSide.getFirst());
RelationSide side = RelationSide.fromString(typeSide.getSecond());
RelationTypeSide rts = new RelationTypeSide(type, side);
- RelationSorter leftSorter = RelationOrderBaseTypes.getFromGuid(leftData.getCurrentSorterGuid(type, side));
- RelationSorter rightSorter = RelationOrderBaseTypes.getFromGuid(rightData.getCurrentSorterGuid(type, side));
+ RelationSorter leftSorter = leftData.getCurrentSorterGuid(type, side);
+ RelationSorter rightSorter = rightData.getCurrentSorterGuid(type, side);
List<String> order = null;
if (rightSorter.equals(USER_DEFINED) && leftSorter.equals(USER_DEFINED)) {
diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/relation/order/RelationOrderParser.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/relation/order/RelationOrderParser.java
index f8092bede3f..2f957579f99 100644
--- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/relation/order/RelationOrderParser.java
+++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/relation/order/RelationOrderParser.java
@@ -16,6 +16,7 @@ import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Map.Entry;
+import org.eclipse.osee.framework.core.data.RelationSorter;
import org.eclipse.osee.framework.jdk.core.type.OseeArgumentException;
import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
import org.eclipse.osee.framework.jdk.core.type.Pair;
@@ -71,7 +72,7 @@ public class RelationOrderParser {
StringBuilder sb = new StringBuilder();
openRoot(sb);
- for (Entry<Pair<String, String>, Pair<String, List<String>>> entry : data.getOrderedEntrySet()) {
+ for (Entry<Pair<String, String>, Pair<RelationSorter, List<String>>> entry : data.getOrderedEntrySet()) {
writeEntry(sb, entry);
sb.append("\n");
}
@@ -91,7 +92,7 @@ public class RelationOrderParser {
sb.append(">");
}
- private void writeEntry(StringBuilder sb, Entry<Pair<String, String>, Pair<String, List<String>>> entry) {
+ private void writeEntry(StringBuilder sb, Entry<Pair<String, String>, Pair<RelationSorter, List<String>>> entry) {
Pair<String, String> key = entry.getKey();
sb.append("<");
sb.append("Order ");
@@ -101,8 +102,8 @@ public class RelationOrderParser {
sb.append(key.getSecond());
sb.append("\" orderType=\"");
- Pair<String, List<String>> value = entry.getValue();
- sb.append(value.getFirst());
+ Pair<RelationSorter, List<String>> value = entry.getValue();
+ sb.append(value.getFirst().getGuid());
List<String> guids = value.getSecond();
if (guids != null) {
if (guids.size() > 0) {
@@ -145,7 +146,7 @@ public class RelationOrderParser {
guidsList = new ArrayList<>();
Collections.addAll(guidsList, guids);
}
- data.addOrderList(relationType, relationSide, orderType, guidsList);
+ data.addOrderList(relationType, relationSide, RelationSorter.valueOfGuid(orderType), guidsList);
}
}
}
diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/relation/order/RelationSorterIdComparator.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/relation/order/RelationSorterIdComparator.java
deleted file mode 100644
index 1001d568d1d..00000000000
--- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/relation/order/RelationSorterIdComparator.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.framework.skynet.core.relation.order;
-
-import java.io.Serializable;
-import java.util.Comparator;
-import org.eclipse.osee.framework.core.data.RelationSorter;
-
-/**
- * @author Andrew M. Finkbeiner
- */
-public class RelationSorterIdComparator implements Serializable, Comparator<RelationSorter> {
- private static final long serialVersionUID = -8364743688821990429L;
-
- @Override
- public int compare(RelationSorter o1, RelationSorter o2) {
- return o1.getName().compareToIgnoreCase(o2.getName());
- }
-
-}
diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/relation/order/RelationSorterProvider.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/relation/order/RelationSorterProvider.java
index 38eb104d76a..9cacee14517 100644
--- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/relation/order/RelationSorterProvider.java
+++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/relation/order/RelationSorterProvider.java
@@ -31,7 +31,7 @@ import org.eclipse.osee.framework.skynet.core.relation.sorters.UserDefinedRelati
*/
public class RelationSorterProvider {
- private final Map<String, IRelationSorter> orderMap;
+ private final Map<RelationSorter, IRelationSorter> orderMap;
public RelationSorterProvider() {
orderMap = new ConcurrentHashMap<>();
@@ -43,7 +43,7 @@ public class RelationSorterProvider {
}
private void registerOrderType(IRelationSorter order) {
- orderMap.put(order.getSorterId().getGuid(), order);
+ orderMap.put(order.getSorterId(), order);
}
public boolean exists(String orderGuid) throws OseeCoreException {
@@ -53,24 +53,28 @@ public class RelationSorterProvider {
return orderMap.get(orderGuid) != null;
}
- public IRelationSorter getRelationOrder(String orderGuid) throws OseeCoreException {
- if (!GUID.isValid(orderGuid)) {
- throw new OseeArgumentException("Error invalid guid argument");
+ public IRelationSorter getRelationOrder(RelationSorter sorterId) throws OseeCoreException {
+ if (sorterId.equals(RelationSorter.PREEXISTING)) {
+ throw new OseeArgumentException("No sorted is defined for preexisting (nor should there be).");
}
- IRelationSorter order = orderMap.get(orderGuid);
+ IRelationSorter order = orderMap.get(sorterId);
if (order == null) {
- throw new OseeCoreException("Unable to locate RelationOrder for guid[%s].", orderGuid);
+ throw new OseeCoreException("Unable to locate RelationSorter[%s].", sorterId);
}
return order;
}
+ public Collection<IRelationSorter> getSorters() {
+ return orderMap.values();
+ }
+
public List<RelationSorter> getAllRelationOrderIds() {
Collection<IRelationSorter> relationOrder = orderMap.values();
List<RelationSorter> ids = new ArrayList<>();
for (IRelationSorter order : relationOrder) {
ids.add(order.getSorterId());
}
- Collections.sort(ids, new RelationSorterIdComparator());
+ Collections.sort(ids);
return ids;
}
}

Back to the top