Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjmisinco2014-02-17 20:20:45 +0000
committerjmisinco2014-02-20 13:43:40 +0000
commit6c3dd7b04b944eaf1985d1b2b551421afa5c0d36 (patch)
tree7c89469627488de30b02d4aee165e3a76e96959b /plugins/org.eclipse.osee.framework.skynet.core
parent432afaa9a00231228b69729dd5798feb257f11e3 (diff)
downloadorg.eclipse.osee-6c3dd7b04b944eaf1985d1b2b551421afa5c0d36.tar.gz
org.eclipse.osee-6c3dd7b04b944eaf1985d1b2b551421afa5c0d36.tar.xz
org.eclipse.osee-6c3dd7b04b944eaf1985d1b2b551421afa5c0d36.zip
refactor[ats_ATS22155]: Remove duplicate get by long methods
Diffstat (limited to 'plugins/org.eclipse.osee.framework.skynet.core')
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/ArtifactLoader.java2
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/ArtifactTypeManager.java11
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/AttributeLoader.java2
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/RelationLoader.java2
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/attribute/AttributeTypeManager.java12
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/conflict/AttributeConflict.java2
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/relation/RelationTypeManager.java8
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/revision/ChangeData.java2
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/revision/ChangeDataLoader.java4
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/revision/acquirer/ArtifactChangeAcquirer.java5
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/revision/acquirer/AttributeChangeAcquirer.java6
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/revision/acquirer/RelationChangeAcquirer.java6
12 files changed, 16 insertions, 46 deletions
diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/ArtifactLoader.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/ArtifactLoader.java
index 0e80396d7f1..bd250005a99 100644
--- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/ArtifactLoader.java
+++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/ArtifactLoader.java
@@ -371,7 +371,7 @@ public final class ArtifactLoader {
Artifact artifact = historical ? null : ArtifactCache.getActive(artifactId, branch);
if (artifact == null) {
- IArtifactType artifactType = ArtifactTypeManager.getType(chStmt.getLong("art_type_id"));
+ IArtifactType artifactType = ArtifactTypeManager.getTypeByGuid(chStmt.getLong("art_type_id"));
ArtifactFactory factory = ArtifactTypeManager.getFactory(artifactType);
artifact =
diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/ArtifactTypeManager.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/ArtifactTypeManager.java
index cb258f020e1..67bfa925aa7 100644
--- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/ArtifactTypeManager.java
+++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/ArtifactTypeManager.java
@@ -129,17 +129,6 @@ public class ArtifactTypeManager {
return getTypeByGuid(artifactType.getGuid());
}
- /**
- * @return Returns the descriptor with a particular name, null if it does not exist.
- */
- public static ArtifactType getType(long artTypeId) throws OseeCoreException {
- ArtifactType artifactType = getCache().getById(artTypeId);
- if (artifactType == null) {
- throw new OseeTypeDoesNotExist("Artifact type: %d is not available.", artTypeId);
- }
- return artifactType;
- }
-
public static boolean inheritsFrom(IArtifactType artifactType, IArtifactType... parentTypes) throws OseeCoreException {
return getType(artifactType).inheritsFrom(parentTypes);
}
diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/AttributeLoader.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/AttributeLoader.java
index edfc60dd716..bb45523dcb8 100644
--- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/AttributeLoader.java
+++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/AttributeLoader.java
@@ -164,7 +164,7 @@ public class AttributeLoader {
}
private static void loadAttribute(Artifact artifact, AttrData current, AttrData previous) throws OseeCoreException {
- IAttributeType attributeType = AttributeTypeManager.getType(current.attrTypeId);
+ IAttributeType attributeType = AttributeTypeManager.getTypeByGuid(current.attrTypeId);
String value = current.value;
if (isEnumOrBoolean(attributeType)) {
value = Strings.intern(value);
diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/RelationLoader.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/RelationLoader.java
index aca9eb83a5a..f1ad02e2359 100644
--- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/RelationLoader.java
+++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/RelationLoader.java
@@ -48,7 +48,7 @@ class RelationLoader {
int aArtifactId = chStmt.getInt("a_art_id");
int bArtifactId = chStmt.getInt("b_art_id");
Branch branch = BranchManager.getBranch(chStmt.getLong("branch_id"));
- RelationType relationType = RelationTypeManager.getType(chStmt.getLong("rel_link_type_id"));
+ RelationType relationType = RelationTypeManager.getTypeByGuid(chStmt.getLong("rel_link_type_id"));
int gammaId = chStmt.getInt("gamma_id");
String rationale = chStmt.getString("rationale");
diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/attribute/AttributeTypeManager.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/attribute/AttributeTypeManager.java
index 0396527ff75..c031974e253 100644
--- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/attribute/AttributeTypeManager.java
+++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/attribute/AttributeTypeManager.java
@@ -107,18 +107,6 @@ public class AttributeTypeManager {
return attributeType;
}
- /**
- * Returns the attribute type with the given type id or throws an IllegalArgumentException if it does not exist.
- */
- public static AttributeType getType(long attrTypeId) throws OseeCoreException {
- AttributeType attributeType = getCache().getById(attrTypeId);
- if (attributeType == null) {
- throw new OseeTypeDoesNotExist("Attribute type: %d is not available.", attrTypeId);
- }
-
- return attributeType;
- }
-
private static Set<String> getEnumerationValues(AttributeType attributeType) throws OseeCoreException {
return attributeType.getOseeEnumType().valuesAsOrderedStringSet();
}
diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/conflict/AttributeConflict.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/conflict/AttributeConflict.java
index f599b34d9d3..eff7f1a7cf3 100644
--- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/conflict/AttributeConflict.java
+++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/conflict/AttributeConflict.java
@@ -160,7 +160,7 @@ public class AttributeConflict extends Conflict {
*/
public AttributeType getAttributeType() throws OseeCoreException {
if (attributeType == null) {
- attributeType = AttributeTypeManager.getType(attrTypeId);
+ attributeType = AttributeTypeManager.getTypeByGuid(attrTypeId);
}
return attributeType;
}
diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/relation/RelationTypeManager.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/relation/RelationTypeManager.java
index 075f205282f..d3bf07df5f6 100644
--- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/relation/RelationTypeManager.java
+++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/relation/RelationTypeManager.java
@@ -81,14 +81,6 @@ public class RelationTypeManager {
return getCache().getAll();
}
- public static RelationType getType(long relationTypeId) throws OseeCoreException {
- RelationType relationType = getCache().getById(relationTypeId);
- if (relationType == null) {
- throw new OseeTypeDoesNotExist("The relation with type id[" + relationTypeId + "] does not exist");
- }
- return relationType;
- }
-
public static RelationType getTypeByGuid(Long guid) throws OseeCoreException {
RelationType relationType = getCache().getByGuid(guid);
if (relationType == null) {
diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/revision/ChangeData.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/revision/ChangeData.java
index 267f26faed0..1feb466b9f9 100644
--- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/revision/ChangeData.java
+++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/revision/ChangeData.java
@@ -106,7 +106,7 @@ public class ChangeData {
if (change instanceof AttributeChange) {
Integer id = artifact.getArtId();
long typeId = change.getItemTypeId();
- AttributeType attributeType = AttributeTypeManager.getType(typeId);
+ AttributeType attributeType = AttributeTypeManager.getTypeByGuid(typeId);
if (excludeArtifact.containsKey(id)) {
if (!artifactTypesToIgnore.contains(attributeType)) {
if (excludeArtifact.get(id)) {
diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/revision/ChangeDataLoader.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/revision/ChangeDataLoader.java
index 85860a8d65c..5e8e8e844be 100644
--- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/revision/ChangeDataLoader.java
+++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/revision/ChangeDataLoader.java
@@ -209,7 +209,7 @@ public class ChangeDataLoader extends AbstractOperation {
artifactDelta);
} else if (item instanceof AttributeChangeItem) {
String isValue = item.getCurrentVersion().getValue();
- AttributeType attributeType = AttributeTypeManager.getType(item.getItemTypeId());
+ AttributeType attributeType = AttributeTypeManager.getTypeByGuid(item.getItemTypeId());
String wasValue = "";
if (!txDelta.areOnTheSameBranch()) {
@@ -236,7 +236,7 @@ public class ChangeDataLoader extends AbstractOperation {
} else if (item instanceof RelationChangeItem) {
RelationChangeItem relationItem = (RelationChangeItem) item;
- RelationType relationType = RelationTypeManager.getType(relationItem.getItemTypeId());
+ RelationType relationType = RelationTypeManager.getTypeByGuid(relationItem.getItemTypeId());
TransactionRecord transaction = txDelta.getStartTx();
if (txDelta.areOnTheSameBranch()) {
diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/revision/acquirer/ArtifactChangeAcquirer.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/revision/acquirer/ArtifactChangeAcquirer.java
index 32984abaa62..22d707cec96 100644
--- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/revision/acquirer/ArtifactChangeAcquirer.java
+++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/revision/acquirer/ArtifactChangeAcquirer.java
@@ -79,8 +79,9 @@ public class ArtifactChangeAcquirer extends ChangeAcquirer {
ModificationType modificationType = ModificationType.getMod(chStmt.getInt("mod_type"));
ArtifactChangeBuilder artifactChangeBuilder =
- new ArtifactChangeBuilder(getSourceBranch(), ArtifactTypeManager.getType(chStmt.getLong("art_type_id")),
- chStmt.getInt("gamma_id"), artId, txDelta, modificationType, !hasBranch);
+ new ArtifactChangeBuilder(getSourceBranch(),
+ ArtifactTypeManager.getTypeByGuid(chStmt.getLong("art_type_id")), chStmt.getInt("gamma_id"), artId,
+ txDelta, modificationType, !hasBranch);
getArtIds().add(artId);
getChangeBuilders().add(artifactChangeBuilder);
diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/revision/acquirer/AttributeChangeAcquirer.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/revision/acquirer/AttributeChangeAcquirer.java
index c4e767dbcb4..ee085aac8ef 100644
--- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/revision/acquirer/AttributeChangeAcquirer.java
+++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/revision/acquirer/AttributeChangeAcquirer.java
@@ -131,7 +131,7 @@ public class AttributeChangeAcquirer extends ChangeAcquirer {
if (artModType == ModificationType.MODIFIED && !modifiedArtifacts.contains(artId)) {
ArtifactChangeBuilder artifactChangeBuilder =
- new ArtifactChangeBuilder(sourceBranch, ArtifactTypeManager.getType(artTypeId), -1, artId,
+ new ArtifactChangeBuilder(sourceBranch, ArtifactTypeManager.getTypeByGuid(artTypeId), -1, artId,
txDelta, ModificationType.MODIFIED, !hasBranch);
changeBuilders.add(artifactChangeBuilder);
@@ -142,8 +142,8 @@ public class AttributeChangeAcquirer extends ChangeAcquirer {
if (modificationType == ModificationType.MODIFIED && artModType != ModificationType.INTRODUCED) {
modificationType = ModificationType.NEW;
}
- IArtifactType artifactType = ArtifactTypeManager.getType(artTypeId);
- AttributeType attributeType = AttributeTypeManager.getType(attrTypeId);
+ IArtifactType artifactType = ArtifactTypeManager.getTypeByGuid(artTypeId);
+ AttributeType attributeType = AttributeTypeManager.getTypeByGuid(attrTypeId);
attributeChangeBuilder =
new AttributeChangeBuilder(sourceBranch, artifactType, sourceGamma, artId, txDelta, modificationType,
!hasBranch, isValue, "", attrId, attributeType, artModType);
diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/revision/acquirer/RelationChangeAcquirer.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/revision/acquirer/RelationChangeAcquirer.java
index 385e2e05cb4..6c4d9f256fc 100644
--- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/revision/acquirer/RelationChangeAcquirer.java
+++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/revision/acquirer/RelationChangeAcquirer.java
@@ -84,9 +84,9 @@ public class RelationChangeAcquirer extends ChangeAcquirer {
getChangeBuilders().add(
new RelationChangeBuilder(getSourceBranch(),
- ArtifactTypeManager.getType(chStmt.getLong("art_type_id")), chStmt.getInt("gamma_id"), aArtId,
- txDelta, modificationType, bArtId, relLinkId, rationale,
- RelationTypeManager.getType(chStmt.getLong("rel_link_type_id")), !hasBranch));
+ ArtifactTypeManager.getTypeByGuid(chStmt.getLong("art_type_id")), chStmt.getInt("gamma_id"),
+ aArtId, txDelta, modificationType, bArtId, relLinkId, rationale,
+ RelationTypeManager.getTypeByGuid(chStmt.getLong("rel_link_type_id")), !hasBranch));
}
}
if (getMonitor() != null) {

Back to the top