summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkwilk2011-07-13 18:32:43 (EDT)
committer Ryan D. Brooks2011-07-13 18:32:43 (EDT)
commit4b5fea671657690dcb4fef8ebf1dba993319b4d9 (patch)
treedc92f4aa827979841b122eed5ab07fce68186ef5
parent5e11404d5ec635fdac5ead50ca8d30b648a09ca8 (diff)
downloadorg.eclipse.osee-4b5fea671657690dcb4fef8ebf1dba993319b4d9.zip
org.eclipse.osee-4b5fea671657690dcb4fef8ebf1dba993319b4d9.tar.gz
org.eclipse.osee-4b5fea671657690dcb4fef8ebf1dba993319b4d9.tar.bz2
bug[ats_4B08V]: Fix allowed attribute types per branch
-rw-r--r--plugins/org.eclipse.osee.ats.config.demo/src/org/eclipse/osee/ats/config/demo/PopulateDemoActions.java7
-rw-r--r--plugins/org.eclipse.osee.ats.config.demo/support/OseeTypes_Demo.osee1
-rw-r--r--plugins/org.eclipse.osee.define.test/src/org/eclipse/osee/define/blam/operation/TestPlanComplianceReportTest.java4
-rw-r--r--plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/cache/DatabaseArtifactTypeAccessor.java33
-rw-r--r--plugins/org.eclipse.osee.framework.core.datastore/support/SKYNET.VERSIONING.SCHEMA.xml7
-rw-r--r--plugins/org.eclipse.osee.framework.core.dsl.integration/src/org/eclipse/osee/framework/core/dsl/integration/OseeToXtextOperation.java11
-rw-r--r--plugins/org.eclipse.osee.framework.core.dsl.integration/src/org/eclipse/osee/framework/core/dsl/integration/XTextToOseeTypeOperation.java33
-rw-r--r--plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/AbstractBranchCacheMessage.java6
-rw-r--r--plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/ArtifactTypeCacheUpdateResponse.java28
-rw-r--r--plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/BranchCacheStoreRequest.java1
-rw-r--r--plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/BranchCacheUpdateResponse.java4
-rw-r--r--plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/BranchCacheUpdateUtil.java21
-rw-r--r--plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/BranchRow.java1
-rw-r--r--plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/TranslationUtil.java21
-rw-r--r--plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/internal/translation/ArtifactTypeCacheUpdateResponseTranslator.java2
-rw-r--r--plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/internal/translation/SearchRequestTranslator.java7
-rw-r--r--plugins/org.eclipse.osee.framework.core.model.test/src/org/eclipse/osee/framework/core/model/test/fields/ArtifactTypeAttributesFieldTest.java19
-rw-r--r--plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/MergeBranch.java5
-rw-r--r--plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/cache/AbstractOseeCache.java2
-rw-r--r--plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/cache/IOseeCache.java2
-rw-r--r--plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/cache/TransactionCache.java5
-rw-r--r--plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/internal/fields/ArtifactTypeAttributesField.java20
-rw-r--r--plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/type/ArtifactType.java12
-rw-r--r--plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/type/OseeEnumTypeFactory.java3
-rw-r--r--plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/BranchToken.java17
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core.test/src/org/eclipse/osee/framework/skynet/core/test/FrameworkCore_Demo_Suite.java2
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core.test/src/org/eclipse/osee/framework/skynet/core/test/artifact/ArtifactTest.java73
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/Artifact.java6
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/UniversalGroup.java13
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/factory/UserArtifactFactory.java2
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/internal/accessors/ClientArtifactTypeAccessor.java16
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/internal/accessors/ClientBranchAccessor.java1
32 files changed, 238 insertions, 147 deletions
diff --git a/plugins/org.eclipse.osee.ats.config.demo/src/org/eclipse/osee/ats/config/demo/PopulateDemoActions.java b/plugins/org.eclipse.osee.ats.config.demo/src/org/eclipse/osee/ats/config/demo/PopulateDemoActions.java
index 0312f45..80d653e 100644
--- a/plugins/org.eclipse.osee.ats.config.demo/src/org/eclipse/osee/ats/config/demo/PopulateDemoActions.java
+++ b/plugins/org.eclipse.osee.ats.config.demo/src/org/eclipse/osee/ats/config/demo/PopulateDemoActions.java
@@ -258,7 +258,6 @@ public class PopulateDemoActions extends XNavigateItemAction {
OseeLog.log(OseeAtsConfigDemoActivator.class, Level.INFO,
new StringBuilder("Modifying artifact => ").append(art).toString());
art.setSoleAttributeValue(CoreAttributeTypes.Csci, DemoCscis.Navigation.name());
- art.setSoleAttributeValue(CoreAttributeTypes.SafetyCriticality, "I");
art.setSoleAttributeValue(CoreAttributeTypes.Subsystem, DemoSubsystems.Navigation.name());
Artifact navArt =
ArtifactQuery.getArtifactFromTypeAndName(CoreArtifactTypes.Component, DemoSubsystems.Navigation.name(),
@@ -271,7 +270,6 @@ public class PopulateDemoActions extends XNavigateItemAction {
OseeLog.log(OseeAtsConfigDemoActivator.class, Level.INFO,
new StringBuilder("Modifying artifact => ").append(art).toString());
art.setSoleAttributeValue(CoreAttributeTypes.Csci, DemoCscis.Interface.name());
- art.setSoleAttributeValue(CoreAttributeTypes.SafetyCriticality, "IV");
art.setSoleAttributeValue(CoreAttributeTypes.Subsystem, DemoSubsystems.Communications.name());
Artifact robotArt =
ArtifactQuery.getArtifactFromTypeAndName(CoreArtifactTypes.Component, DemoSubsystems.Robot_API.name(),
@@ -295,7 +293,6 @@ public class PopulateDemoActions extends XNavigateItemAction {
OseeLog.log(OseeAtsConfigDemoActivator.class, Level.INFO, "Adding artifact => " + name);
Artifact newArt =
ArtifactTypeManager.addArtifact(CoreArtifactTypes.SoftwareRequirement, parentArt.getBranch(), name);
- newArt.setSoleAttributeValue(CoreAttributeTypes.SafetyCriticality, "IV");
newArt.setSoleAttributeValue(CoreAttributeTypes.Subsystem, DemoSubsystems.Communications.name());
newArt.persist();
parentArt.addChild(newArt);
@@ -340,7 +337,6 @@ public class PopulateDemoActions extends XNavigateItemAction {
OseeLog.log(OseeAtsConfigDemoActivator.class, Level.INFO,
new StringBuilder("Modifying branch artifact => ").append(branchArtifact).toString());
branchArtifact.setSoleAttributeValue(CoreAttributeTypes.Csci, DemoCscis.Interface.name());
- branchArtifact.setSoleAttributeValue(CoreAttributeTypes.SafetyCriticality, "IV");
branchArtifact.setSoleAttributeValue(CoreAttributeTypes.Subsystem, DemoSubsystems.Communications.name());
Artifact comArt =
ArtifactQuery.getArtifactFromTypeAndName(CoreArtifactTypes.Component, DemoSubsystems.Robot_API.name(),
@@ -354,7 +350,6 @@ public class PopulateDemoActions extends XNavigateItemAction {
OseeLog.log(OseeAtsConfigDemoActivator.class, Level.INFO,
new StringBuilder("Modifying parent artifact => ").append(parentArtifact).toString());
parentArtifact.setSoleAttributeValue(CoreAttributeTypes.Csci, DemoCscis.Navigation.name());
- parentArtifact.setSoleAttributeValue(CoreAttributeTypes.SafetyCriticality, "V");
parentArtifact.setSoleAttributeValue(CoreAttributeTypes.Subsystem,
DemoSubsystems.Cognitive_Decision_Aiding.name());
parentArtifact.persist();
@@ -386,7 +381,6 @@ public class PopulateDemoActions extends XNavigateItemAction {
OseeLog.log(OseeAtsConfigDemoActivator.class, Level.INFO,
new StringBuilder("Modifying artifact => ").append(art).toString());
art.setSoleAttributeValue(CoreAttributeTypes.Csci, DemoCscis.Interface.name());
- art.setSoleAttributeValue(CoreAttributeTypes.SafetyCriticality, "IV");
art.setSoleAttributeValue(CoreAttributeTypes.Subsystem, DemoSubsystems.Communications.name());
Artifact comArt =
ArtifactQuery.getArtifactFromTypeAndName(CoreArtifactTypes.Component, DemoSubsystems.Robot_API.name(),
@@ -410,7 +404,6 @@ public class PopulateDemoActions extends XNavigateItemAction {
OseeLog.log(OseeAtsConfigDemoActivator.class, Level.INFO, "Adding artifact => " + name);
Artifact newArt =
ArtifactTypeManager.addArtifact(CoreArtifactTypes.SoftwareRequirement, parentArt.getBranch(), name);
- newArt.setSoleAttributeValue(CoreAttributeTypes.SafetyCriticality, "IV");
newArt.setSoleAttributeValue(CoreAttributeTypes.Subsystem, DemoSubsystems.Communications.name());
parentArt.addChild(newArt);
diff --git a/plugins/org.eclipse.osee.ats.config.demo/support/OseeTypes_Demo.osee b/plugins/org.eclipse.osee.ats.config.demo/support/OseeTypes_Demo.osee
index 47ee978..01e304e 100644
--- a/plugins/org.eclipse.osee.ats.config.demo/support/OseeTypes_Demo.osee
+++ b/plugins/org.eclipse.osee.ats.config.demo/support/OseeTypes_Demo.osee
@@ -44,6 +44,7 @@ artifactType "Demo Code Team Workflow" extends "Team Workflow" {
attribute "demo.code.DP Effectivity"
attribute "demo.code.SP Effectivity"
attribute "demo.code.WP Effectivity"
+ attribute "Partition" branchGuid "AyH_f2sSKy3l07fIvAAA"
}
artifactType "Demo Req Team Workflow" extends "Team Workflow" {
diff --git a/plugins/org.eclipse.osee.define.test/src/org/eclipse/osee/define/blam/operation/TestPlanComplianceReportTest.java b/plugins/org.eclipse.osee.define.test/src/org/eclipse/osee/define/blam/operation/TestPlanComplianceReportTest.java
index 23aa5dd..9a8c9f2 100644
--- a/plugins/org.eclipse.osee.define.test/src/org/eclipse/osee/define/blam/operation/TestPlanComplianceReportTest.java
+++ b/plugins/org.eclipse.osee.define.test/src/org/eclipse/osee/define/blam/operation/TestPlanComplianceReportTest.java
@@ -44,7 +44,7 @@ public final class TestPlanComplianceReportTest {
private static final String EXPECTED_OSEE_ERROR_STYLE = " <Cell ss:StyleID=\"OseeErrorStyle\">";
private static final String EXPECTED_OSEE_BOLD_STYLE = " <Cell ss:StyleID=\"OseeBoldStyle\">";
private static final String EXPECTED_MULTIPLE_RESULTS_IN_1_CELL = //
- " <Cell><Data ss:Type=\"String\">Sample_Test_Result_0.pdf&#10;Sample_Test_Result_1.pdf</Data></Cell>";
+ " <Cell><Data ss:Type=\"String\">Sample_Test_Result_0&#10;Sample_Test_Result_1</Data></Cell>";
private static SevereLoggingMonitor monitorLog;
private final TestPlanComplianceReport testCompReport = new TestPlanComplianceReport();
@@ -109,6 +109,7 @@ public final class TestPlanComplianceReportTest {
buildTest(1, TestStatusEnum.COMPLETED_PASSED_CODE, 2);
Assert.assertTrue("All test result files should be in 1 cell",
resultBuffer.toString().contains(EXPECTED_MULTIPLE_RESULTS_IN_1_CELL));
+ new PurgeArtifacts(dummyArtifactList).execute();
}
@BeforeClass
@@ -149,7 +150,6 @@ public final class TestPlanComplianceReportTest {
Artifact testResult =
ArtifactTypeManager.addArtifact(CoreArtifactTypes.TestResultWML, DemoSawBuilds.SAW_Bld_1,
"Sample_Test_Result_" + j);
- testResult.setSoleAttributeValue(CoreAttributeTypes.Extension, "pdf");
testProcedure.addRelation(CoreRelationTypes.Test_Unit_Result__Test_Result, testResult);
testProcedure.persist();
}
diff --git a/plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/cache/DatabaseArtifactTypeAccessor.java b/plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/cache/DatabaseArtifactTypeAccessor.java
index 53e2ac3..ca47a0a 100644
--- a/plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/cache/DatabaseArtifactTypeAccessor.java
+++ b/plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/cache/DatabaseArtifactTypeAccessor.java
@@ -18,13 +18,14 @@ import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
import java.util.logging.Level;
+import org.eclipse.osee.framework.core.data.BranchToken;
+import org.eclipse.osee.framework.core.data.IOseeBranch;
import org.eclipse.osee.framework.core.datastore.internal.Activator;
import org.eclipse.osee.framework.core.enums.StorageState;
import org.eclipse.osee.framework.core.exception.OseeCoreException;
import org.eclipse.osee.framework.core.exception.OseeDataStoreException;
import org.eclipse.osee.framework.core.exception.OseeInvalidInheritanceException;
import org.eclipse.osee.framework.core.model.AbstractOseeType;
-import org.eclipse.osee.framework.core.model.Branch;
import org.eclipse.osee.framework.core.model.cache.ArtifactTypeCache;
import org.eclipse.osee.framework.core.model.cache.AttributeTypeCache;
import org.eclipse.osee.framework.core.model.cache.BranchCache;
@@ -61,9 +62,9 @@ public class DatabaseArtifactTypeAccessor extends AbstractDatabaseAccessor<Artif
"delete from osee_artifact_type_inheritance where art_type_id = ?";
private static final String SELECT_ARTIFACT_TYPE_ATTRIBUTES =
- "select * from osee_artifact_type_attributes order by art_type_id, branch_id, attr_type_id";
+ "select * from osee_artifact_type_attributes order by art_type_id, branch_guid, attr_type_id";
private static final String INSERT_ARTIFACT_TYPE_ATTRIBUTES =
- "insert into osee_artifact_type_attributes (art_type_id, attr_type_id, branch_id) VALUES (?, ?, ?)";
+ "insert into osee_artifact_type_attributes (art_type_id, attr_type_id, branch_guid) VALUES (?, ?, ?)";
private static final String DELETE_ARTIFACT_TYPE_ATTRIBUTES =
"delete from osee_artifact_type_attributes where art_type_id = ?";
@@ -156,20 +157,24 @@ public class DatabaseArtifactTypeAccessor extends AbstractDatabaseAccessor<Artif
}
private void loadAllTypeValidity(ArtifactTypeCache cache) throws OseeCoreException {
- CompositeKeyHashMap<ArtifactType, Branch, Collection<AttributeType>> typeValidity =
- new CompositeKeyHashMap<ArtifactType, Branch, Collection<AttributeType>>();
+ CompositeKeyHashMap<ArtifactType, IOseeBranch, Collection<AttributeType>> typeValidity =
+ new CompositeKeyHashMap<ArtifactType, IOseeBranch, Collection<AttributeType>>();
IOseeStatement chStmt = getDatabaseService().getStatement();
try {
chStmt.runPreparedQuery(2000, SELECT_ARTIFACT_TYPE_ATTRIBUTES);
while (chStmt.next()) {
try {
ArtifactType artifactType = cache.getById(chStmt.getInt("art_type_id"));
- Branch branch = branchCache.getById(chStmt.getInt("branch_id"));
+ String branchGuid = chStmt.getString("branch_guid");
+ IOseeBranch branchToken = branchCache.getByGuid(branchGuid);
+ if (branchToken == null) {
+ branchToken = new BranchToken(branchGuid, branchGuid);
+ }
AttributeType attributeType = attributeCache.getById(chStmt.getInt("attr_type_id"));
- Collection<AttributeType> attributes = typeValidity.get(artifactType, branch);
+ Collection<AttributeType> attributes = typeValidity.get(artifactType, branchToken);
if (attributes == null) {
attributes = new HashSet<AttributeType>();
- typeValidity.put(artifactType, branch, attributes);
+ typeValidity.put(artifactType, branchToken, attributes);
}
attributes.add(attributeType);
} catch (OseeCoreException ex) {
@@ -179,9 +184,9 @@ public class DatabaseArtifactTypeAccessor extends AbstractDatabaseAccessor<Artif
} finally {
chStmt.close();
}
- for (Entry<Pair<ArtifactType, Branch>, Collection<AttributeType>> entry : typeValidity.entrySet()) {
+ for (Entry<Pair<ArtifactType, IOseeBranch>, Collection<AttributeType>> entry : typeValidity.entrySet()) {
try {
- Pair<ArtifactType, Branch> key = entry.getKey();
+ Pair<ArtifactType, IOseeBranch> key = entry.getKey();
key.getFirst().setAttributeTypes(entry.getValue(), key.getSecond());
} catch (OseeCoreException ex) {
OseeLog.log(Activator.class, Level.SEVERE, ex);
@@ -253,12 +258,12 @@ public class DatabaseArtifactTypeAccessor extends AbstractDatabaseAccessor<Artif
List<Object[]> deleteData = new ArrayList<Object[]>();
for (ArtifactType artifactType : types) {
deleteData.add(new Object[] {artifactType.getId()});
- Map<Branch, Collection<AttributeType>> entries = artifactType.getLocalAttributeTypes();
+ Map<IOseeBranch, Collection<AttributeType>> entries = artifactType.getLocalAttributeTypes();
if (entries != null) {
- for (Entry<Branch, Collection<AttributeType>> entry : entries.entrySet()) {
- Branch branch = entry.getKey();
+ for (Entry<IOseeBranch, Collection<AttributeType>> entry : entries.entrySet()) {
+ IOseeBranch branch = entry.getKey();
for (AttributeType attributeType : entry.getValue()) {
- insertData.add(new Object[] {artifactType.getId(), attributeType.getId(), branch.getId()});
+ insertData.add(new Object[] {artifactType.getId(), attributeType.getId(), branch.getGuid()});
}
}
}
diff --git a/plugins/org.eclipse.osee.framework.core.datastore/support/SKYNET.VERSIONING.SCHEMA.xml b/plugins/org.eclipse.osee.framework.core.datastore/support/SKYNET.VERSIONING.SCHEMA.xml
index 4cf5db7..af4eceb 100644
--- a/plugins/org.eclipse.osee.framework.core.datastore/support/SKYNET.VERSIONING.SCHEMA.xml
+++ b/plugins/org.eclipse.osee.framework.core.datastore/support/SKYNET.VERSIONING.SCHEMA.xml
@@ -96,18 +96,15 @@
<Table name="OSEE_ARTIFACT_TYPE_ATTRIBUTES" schema="OSEE" tablespace="osee_data">
<Column id="ART_TYPE_ID" defaultValue="not null" type="smallint" />
+ <Column id="BRANCH_GUID" defaultValue="not null" limits="28" type="VARCHAR" />
<Column id="ATTR_TYPE_ID" defaultValue="not null" type="smallint" />
- <Column id="BRANCH_ID" type="INTEGER" defaultValue="not null" />
- <Constraint schema="OSEE" id="OSEE_ARTIFACT_TYPE_ATTRIB_PK" type="PRIMARY KEY" appliesTo="ART_TYPE_ID, ATTR_TYPE_ID, BRANCH_ID" />
+ <Constraint schema="OSEE" id="OSEE_ARTIFACT_TYPE_ATTRIB_PK" type="PRIMARY KEY" appliesTo="ART_TYPE_ID, ATTR_TYPE_ID, BRANCH_GUID" />
<Constraint schema="OSEE" id="OSEE_ARTIFACT_TYPE_ATTRIB_FK1" type="FOREIGN KEY" appliesTo="ATTR_TYPE_ID" deferrable="true">
<References schema="OSEE" table="OSEE_ATTRIBUTE_TYPE" column="ATTR_TYPE_ID" />
</Constraint>
<Constraint schema="OSEE" id="OSEE_ARTIFACT_TYPE_ATTRIB_FK2" type="FOREIGN KEY" appliesTo="ART_TYPE_ID" deferrable="true">
<References schema="OSEE" table="OSEE_ARTIFACT_TYPE" column="ART_TYPE_ID" />
</Constraint>
- <Constraint schema="OSEE" id="OSEE_ARTIFACT_TYPE_ATTRIB_FK3" type="FOREIGN KEY" appliesTo="BRANCH_ID" deferrable="true">
- <References schema="OSEE" table="OSEE_BRANCH" column="BRANCH_ID" />
- </Constraint>
</Table>
<Table name="OSEE_ATTRIBUTE" schema="OSEE" tablespace="osee_data">
diff --git a/plugins/org.eclipse.osee.framework.core.dsl.integration/src/org/eclipse/osee/framework/core/dsl/integration/OseeToXtextOperation.java b/plugins/org.eclipse.osee.framework.core.dsl.integration/src/org/eclipse/osee/framework/core/dsl/integration/OseeToXtextOperation.java
index 3c0e040..db852e5 100644
--- a/plugins/org.eclipse.osee.framework.core.dsl.integration/src/org/eclipse/osee/framework/core/dsl/integration/OseeToXtextOperation.java
+++ b/plugins/org.eclipse.osee.framework.core.dsl.integration/src/org/eclipse/osee/framework/core/dsl/integration/OseeToXtextOperation.java
@@ -17,6 +17,7 @@ import java.util.Map;
import java.util.Map.Entry;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.osee.framework.core.data.IArtifactType;
+import org.eclipse.osee.framework.core.data.IOseeBranch;
import org.eclipse.osee.framework.core.dsl.integration.internal.Activator;
import org.eclipse.osee.framework.core.dsl.integration.util.OseeUtil;
import org.eclipse.osee.framework.core.dsl.oseeDsl.OseeDsl;
@@ -28,8 +29,8 @@ import org.eclipse.osee.framework.core.dsl.oseeDsl.XAttributeTypeRef;
import org.eclipse.osee.framework.core.dsl.oseeDsl.XOseeEnumEntry;
import org.eclipse.osee.framework.core.dsl.oseeDsl.XOseeEnumType;
import org.eclipse.osee.framework.core.dsl.oseeDsl.XRelationType;
+import org.eclipse.osee.framework.core.enums.CoreBranches;
import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.core.model.Branch;
import org.eclipse.osee.framework.core.model.OseeEnumEntry;
import org.eclipse.osee.framework.core.model.type.ArtifactType;
import org.eclipse.osee.framework.core.model.type.AttributeType;
@@ -195,11 +196,11 @@ public class OseeToXtextOperation extends AbstractOperation {
OseeDsl model = getModelByNamespace(getNamespace(artifactType.getName()));
XArtifactType modelArtifactType = getArtifactType(model, artifactType.getGuid());
- Map<Branch, Collection<AttributeType>> types = artifactType.getLocalAttributeTypes();
+ Map<IOseeBranch, Collection<AttributeType>> types = artifactType.getLocalAttributeTypes();
if (types != null) {
List<XAttributeTypeRef> references = new ArrayList<XAttributeTypeRef>();
- for (Entry<Branch, Collection<AttributeType>> entry : types.entrySet()) {
- Branch branch = entry.getKey();
+ for (Entry<IOseeBranch, Collection<AttributeType>> entry : types.entrySet()) {
+ IOseeBranch branch = entry.getKey();
Collection<AttributeType> attributeTypes = entry.getValue();
if (attributeTypes != null) {
for (AttributeType attributeType : attributeTypes) {
@@ -209,7 +210,7 @@ public class OseeToXtextOperation extends AbstractOperation {
XAttributeType modelType = getAttributeType(model, attributeType.getGuid());
if (modelType != null) {
ref.setValidAttributeType(modelType);
- if (branch != null && !branch.getBranchType().isSystemRootBranch()) {
+ if (branch != null && !branch.equals(CoreBranches.SYSTEM_ROOT)) {
ref.setBranchGuid(branch.getGuid());
}
references.add(ref);
diff --git a/plugins/org.eclipse.osee.framework.core.dsl.integration/src/org/eclipse/osee/framework/core/dsl/integration/XTextToOseeTypeOperation.java b/plugins/org.eclipse.osee.framework.core.dsl.integration/src/org/eclipse/osee/framework/core/dsl/integration/XTextToOseeTypeOperation.java
index 2455eea..aa1791a 100644
--- a/plugins/org.eclipse.osee.framework.core.dsl.integration/src/org/eclipse/osee/framework/core/dsl/integration/XTextToOseeTypeOperation.java
+++ b/plugins/org.eclipse.osee.framework.core.dsl.integration/src/org/eclipse/osee/framework/core/dsl/integration/XTextToOseeTypeOperation.java
@@ -18,7 +18,9 @@ import java.util.List;
import java.util.Map;
import java.util.Set;
import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.osee.framework.core.data.BranchToken;
import org.eclipse.osee.framework.core.data.IArtifactType;
+import org.eclipse.osee.framework.core.data.IOseeBranch;
import org.eclipse.osee.framework.core.dsl.integration.internal.Activator;
import org.eclipse.osee.framework.core.dsl.integration.util.OseeUtil;
import org.eclipse.osee.framework.core.dsl.oseeDsl.AddEnum;
@@ -33,10 +35,10 @@ import org.eclipse.osee.framework.core.dsl.oseeDsl.XOseeEnumEntry;
import org.eclipse.osee.framework.core.dsl.oseeDsl.XOseeEnumOverride;
import org.eclipse.osee.framework.core.dsl.oseeDsl.XOseeEnumType;
import org.eclipse.osee.framework.core.dsl.oseeDsl.XRelationType;
+import org.eclipse.osee.framework.core.enums.CoreBranches;
import org.eclipse.osee.framework.core.enums.RelationTypeMultiplicity;
import org.eclipse.osee.framework.core.exception.OseeCoreException;
import org.eclipse.osee.framework.core.exception.OseeStateException;
-import org.eclipse.osee.framework.core.model.Branch;
import org.eclipse.osee.framework.core.model.OseeEnumEntry;
import org.eclipse.osee.framework.core.model.cache.AttributeTypeCache;
import org.eclipse.osee.framework.core.model.cache.BranchCache;
@@ -114,7 +116,7 @@ public class XTextToOseeTypeOperation extends AbstractOperation {
private void handleXArtifactTypeCrossRef(XArtifactType xArtifactType) throws OseeCoreException {
ArtifactType targetArtifactType = typeCache.getArtifactTypeCache().getByGuid(xArtifactType.getTypeGuid());
translateSuperTypes(targetArtifactType, xArtifactType);
- Map<Branch, Collection<AttributeType>> validAttributesPerBranch = getOseeAttributes(xArtifactType);
+ Map<IOseeBranch, Collection<AttributeType>> validAttributesPerBranch = getOseeAttributes(xArtifactType);
targetArtifactType.setAllAttributeTypes(validAttributesPerBranch);
}
@@ -131,17 +133,20 @@ public class XTextToOseeTypeOperation extends AbstractOperation {
}
}
- private Map<Branch, Collection<AttributeType>> getOseeAttributes(XArtifactType xArtifactType) throws OseeCoreException {
- Map<Branch, Collection<AttributeType>> validAttributes = new HashMap<Branch, Collection<AttributeType>>();
+ private Map<IOseeBranch, Collection<AttributeType>> getOseeAttributes(XArtifactType xArtifactType) throws OseeCoreException {
+ Map<IOseeBranch, Collection<AttributeType>> validAttributes =
+ new HashMap<IOseeBranch, Collection<AttributeType>>();
for (XAttributeTypeRef xAttributeTypeRef : xArtifactType.getValidAttributeTypes()) {
XAttributeType xAttributeType = xAttributeTypeRef.getValidAttributeType();
- Branch branch = getAttributeBranch(xAttributeTypeRef);
+ IOseeBranch branch = getAttributeBranch(xAttributeTypeRef);
AttributeType oseeAttributeType = typeCache.getAttributeTypeCache().getByGuid(xAttributeType.getTypeGuid());
if (oseeAttributeType != null) {
- if (validAttributes.get(branch) == null) {
- validAttributes.put(branch, new HashSet<AttributeType>());
+ Collection<AttributeType> listOfAllowedAttributes = validAttributes.get(branch);
+ if (listOfAllowedAttributes == null) {
+ listOfAllowedAttributes = new HashSet<AttributeType>();
+ validAttributes.put(branch, listOfAllowedAttributes);
}
- validAttributes.get(branch).add(oseeAttributeType);
+ listOfAllowedAttributes.add(oseeAttributeType);
} else {
System.out.println(String.format("Type was null for \"%s\"", xArtifactType.getName()));
}
@@ -149,12 +154,16 @@ public class XTextToOseeTypeOperation extends AbstractOperation {
return validAttributes;
}
- private Branch getAttributeBranch(XAttributeTypeRef xAttributeTypeRef) throws OseeCoreException {
+ private IOseeBranch getAttributeBranch(XAttributeTypeRef xAttributeTypeRef) throws OseeCoreException {
String branchGuid = xAttributeTypeRef.getBranchGuid();
- if (branchGuid == null || branchCache.getByGuid(branchGuid) == null) {
- return branchCache.getSystemRootBranch();
+ if (branchGuid == null) {
+ return CoreBranches.SYSTEM_ROOT;
} else {
- return branchCache.getByGuid(branchGuid);
+ IOseeBranch branch = branchCache.getByGuid(branchGuid);
+ if (branch == null) {
+ branch = new BranchToken(branchGuid, branchGuid);
+ }
+ return branch;
}
}
diff --git a/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/AbstractBranchCacheMessage.java b/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/AbstractBranchCacheMessage.java
index 81898ab..8ce3409 100644
--- a/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/AbstractBranchCacheMessage.java
+++ b/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/AbstractBranchCacheMessage.java
@@ -27,7 +27,7 @@ public abstract class AbstractBranchCacheMessage {
private final Map<Integer, Integer> branchToSourceTx;
private final Map<Integer, Integer> branchToAssocArt;
private final Map<Integer, String[]> branchToAliases;
- private final List<Triplet<Integer, Integer, Integer>> srcDestMerge;
+ private final List<Triplet<String, String, String>> srcDestMerge;
protected AbstractBranchCacheMessage() {
this.rows = new ArrayList<BranchRow>();
@@ -36,7 +36,7 @@ public abstract class AbstractBranchCacheMessage {
this.branchToSourceTx = new HashMap<Integer, Integer>();
this.branchToAssocArt = new HashMap<Integer, Integer>();
this.branchToAliases = new HashMap<Integer, String[]>();
- this.srcDestMerge = new ArrayList<Triplet<Integer, Integer, Integer>>();
+ this.srcDestMerge = new ArrayList<Triplet<String, String, String>>();
}
public List<BranchRow> getBranchRows() {
@@ -63,7 +63,7 @@ public abstract class AbstractBranchCacheMessage {
return branchToAliases;
}
- public List<Triplet<Integer, Integer, Integer>> getMergeBranches() {
+ public List<Triplet<String, String, String>> getMergeBranches() {
return srcDestMerge;
}
diff --git a/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/ArtifactTypeCacheUpdateResponse.java b/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/ArtifactTypeCacheUpdateResponse.java
index e244745..a006fd5 100644
--- a/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/ArtifactTypeCacheUpdateResponse.java
+++ b/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/ArtifactTypeCacheUpdateResponse.java
@@ -16,9 +16,9 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
+import org.eclipse.osee.framework.core.data.IOseeBranch;
import org.eclipse.osee.framework.core.enums.StorageState;
import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.core.model.Branch;
import org.eclipse.osee.framework.core.model.type.ArtifactType;
import org.eclipse.osee.framework.core.model.type.AttributeType;
import org.eclipse.osee.framework.jdk.core.type.Triplet;
@@ -30,9 +30,9 @@ public class ArtifactTypeCacheUpdateResponse {
private final List<ArtifactTypeRow> rows;
private final Map<Integer, Integer[]> baseToSuper;
- private final List<Triplet<Integer, Integer, Integer>> artAttrs;
+ private final List<Triplet<String, String, String>> artAttrs;
- public ArtifactTypeCacheUpdateResponse(List<ArtifactTypeRow> rows, Map<Integer, Integer[]> baseToSuper, List<Triplet<Integer, Integer, Integer>> artAttrs) {
+ public ArtifactTypeCacheUpdateResponse(List<ArtifactTypeRow> rows, Map<Integer, Integer[]> baseToSuper, List<Triplet<String, String, String>> artAttrs) {
this.rows = rows;
this.baseToSuper = baseToSuper;
this.artAttrs = artAttrs;
@@ -46,7 +46,7 @@ public class ArtifactTypeCacheUpdateResponse {
return baseToSuper;
}
- public List<Triplet<Integer, Integer, Integer>> getAttributeTypes() {
+ public List<Triplet<String, String, String>> getAttributeTypes() {
return artAttrs;
}
@@ -58,7 +58,6 @@ public class ArtifactTypeCacheUpdateResponse {
private StorageState storageState;
protected ArtifactTypeRow(int id, String guid, String name, boolean isAbstract, StorageState storageState) {
- super();
this.id = id;
this.guid = guid;
this.name = name;
@@ -117,13 +116,14 @@ public class ArtifactTypeCacheUpdateResponse {
public static ArtifactTypeCacheUpdateResponse fromCache(Collection<ArtifactType> types) throws OseeCoreException {
List<ArtifactTypeRow> rows = new ArrayList<ArtifactTypeRow>();
Map<Integer, Integer[]> baseToSuper = new HashMap<Integer, Integer[]>();
- List<Triplet<Integer, Integer, Integer>> artAttrs = new ArrayList<Triplet<Integer, Integer, Integer>>();
- for (ArtifactType art : types) {
- rows.add(new ArtifactTypeRow(art.getId(), art.getGuid(), art.getName(), art.isAbstract(),
- art.getStorageState()));
+ List<Triplet<String, String, String>> artAttrs = new ArrayList<Triplet<String, String, String>>();
+ for (ArtifactType artType : types) {
+ rows.add(new ArtifactTypeRow(artType.getId(), artType.getGuid(), artType.getName(), artType.isAbstract(),
+ artType.getStorageState()));
- Integer artId = art.getId();
- Collection<ArtifactType> superTypes = art.getSuperArtifactTypes();
+ Integer artId = artType.getId();
+
+ Collection<ArtifactType> superTypes = artType.getSuperArtifactTypes();
if (!superTypes.isEmpty()) {
Integer[] intSuperTypes = new Integer[superTypes.size()];
int index = 0;
@@ -133,11 +133,11 @@ public class ArtifactTypeCacheUpdateResponse {
baseToSuper.put(artId, intSuperTypes);
}
- for (Entry<Branch, Collection<AttributeType>> entry : art.getLocalAttributeTypes().entrySet()) {
- Integer branchId = entry.getKey().getId();
+ for (Entry<IOseeBranch, Collection<AttributeType>> entry : artType.getLocalAttributeTypes().entrySet()) {
+ IOseeBranch branch = entry.getKey();
Collection<AttributeType> attrTypes = entry.getValue();
for (AttributeType type : attrTypes) {
- artAttrs.add(new Triplet<Integer, Integer, Integer>(artId, branchId, type.getId()));
+ artAttrs.add(new Triplet<String, String, String>(artType.getGuid(), branch.getGuid(), type.getGuid()));
}
}
diff --git a/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/BranchCacheStoreRequest.java b/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/BranchCacheStoreRequest.java
index 0af71ff..adfafb1 100644
--- a/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/BranchCacheStoreRequest.java
+++ b/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/BranchCacheStoreRequest.java
@@ -22,7 +22,6 @@ public class BranchCacheStoreRequest extends AbstractBranchCacheMessage {
private boolean isServerUpdateMessage;
public BranchCacheStoreRequest() {
- super();
this.isServerUpdateMessage = false;
}
diff --git a/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/BranchCacheUpdateResponse.java b/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/BranchCacheUpdateResponse.java
index bcde8c8..7c2a76b 100644
--- a/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/BranchCacheUpdateResponse.java
+++ b/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/BranchCacheUpdateResponse.java
@@ -20,10 +20,6 @@ import org.eclipse.osee.framework.core.model.cache.IOseeCache;
*/
public class BranchCacheUpdateResponse extends AbstractBranchCacheMessage {
- public BranchCacheUpdateResponse() {
- super();
- }
-
public static BranchCacheUpdateResponse fromCache(IOseeCache<Branch> cache, Collection<Branch> types) throws OseeCoreException {
BranchCacheUpdateResponse response = new BranchCacheUpdateResponse();
BranchCacheUpdateUtil.loadFromCache(response, types);
diff --git a/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/BranchCacheUpdateUtil.java b/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/BranchCacheUpdateUtil.java
index 22399d0..a00ff73 100644
--- a/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/BranchCacheUpdateUtil.java
+++ b/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/BranchCacheUpdateUtil.java
@@ -17,6 +17,7 @@ import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
+import org.eclipse.osee.framework.core.data.IOseeBranch;
import org.eclipse.osee.framework.core.exception.OseeCoreException;
import org.eclipse.osee.framework.core.model.Branch;
import org.eclipse.osee.framework.core.model.BranchFactory;
@@ -26,6 +27,7 @@ import org.eclipse.osee.framework.core.model.cache.IOseeCache;
import org.eclipse.osee.framework.core.model.cache.TransactionCache;
import org.eclipse.osee.framework.jdk.core.type.PropertyStore;
import org.eclipse.osee.framework.jdk.core.type.Triplet;
+import org.eclipse.osee.framework.jdk.core.util.Strings;
/**
* @author Megumi Telles
@@ -47,7 +49,6 @@ public final class BranchCacheUpdateUtil {
private final TransactionCache txCache;
public BranchCacheUpdateUtil(BranchFactory factory, TransactionCache txCache) {
- super();
this.factory = factory;
this.txCache = txCache;
}
@@ -85,10 +86,10 @@ public final class BranchCacheUpdateUtil {
}
}
}
- for (Triplet<Integer, Integer, Integer> entry : cacheMessage.getMergeBranches()) {
- Branch sourceBranch = cache.getById(entry.getFirst());
- Branch destinationBranch = cache.getById(entry.getSecond());
- MergeBranch mergeBranch = (MergeBranch) cache.getById(entry.getThird());
+ for (Triplet<String, String, String> entry : cacheMessage.getMergeBranches()) {
+ IOseeBranch sourceBranch = Strings.isValid(entry.getFirst()) ? cache.getByGuid(entry.getFirst()) : null;
+ IOseeBranch destinationBranch = Strings.isValid(entry.getSecond()) ? cache.getByGuid(entry.getSecond()) : null;
+ MergeBranch mergeBranch = (MergeBranch) cache.getByGuid(entry.getThird());
mergeBranch.setSourceBranch(sourceBranch);
mergeBranch.setDestinationBranch(destinationBranch);
}
@@ -145,11 +146,11 @@ public final class BranchCacheUpdateUtil {
}
}
- private static void addMergeBranches(List<Triplet<Integer, Integer, Integer>> srcDestMerge, MergeBranch mergeBranch) throws OseeCoreException {
- Integer src = mergeBranch.getSourceBranch() != null ? mergeBranch.getSourceBranch().getId() : -1;
- Integer dest = mergeBranch.getDestinationBranch() != null ? mergeBranch.getDestinationBranch().getId() : -1;
- Integer merge = mergeBranch.getId();
- srcDestMerge.add(new Triplet<Integer, Integer, Integer>(src, dest, merge));
+ private static void addMergeBranches(List<Triplet<String, String, String>> srcDestMerge, MergeBranch mergeBranch) throws OseeCoreException {
+ String src = mergeBranch.getSourceBranch() != null ? mergeBranch.getSourceBranch().getGuid() : null;
+ String dest = mergeBranch.getDestinationBranch() != null ? mergeBranch.getDestinationBranch().getGuid() : null;
+ String merge = mergeBranch.getGuid();
+ srcDestMerge.add(new Triplet<String, String, String>(src, dest, merge));
}
private static void addTxRecord(Map<Integer, Integer> map, Integer branchId, TransactionRecord toAdd) {
diff --git a/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/BranchRow.java b/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/BranchRow.java
index 4385ad2..4aa7cad 100644
--- a/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/BranchRow.java
+++ b/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/BranchRow.java
@@ -31,7 +31,6 @@ public final class BranchRow {
}
public BranchRow(int branchId, String branchGuid, String branchName, BranchType branchType, BranchState branchState, BranchArchivedState branchArchived, StorageState storageState) {
- super();
this.branchId = branchId;
this.branchGuid = branchGuid;
this.branchName = branchName;
diff --git a/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/TranslationUtil.java b/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/TranslationUtil.java
index 4c0078c..2f62fc6 100644
--- a/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/TranslationUtil.java
+++ b/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/TranslationUtil.java
@@ -41,11 +41,11 @@ public final class TranslationUtil {
store.put(key.name(), arrayMapToStore(map));
}
- public static void loadTripletList(List<Triplet<Integer, Integer, Integer>> data, PropertyStore store, Enum<?> key) {
+ public static void loadTripletList(List<Triplet<String, String, String>> data, PropertyStore store, Enum<?> key) {
storeToTripletList(data, store.getPropertyStore(key.name()));
}
- public static void putTripletList(PropertyStore store, Enum<?> key, List<Triplet<Integer, Integer, Integer>> list) {
+ public static void putTripletList(PropertyStore store, Enum<?> key, List<Triplet<String, String, String>> list) {
store.put(key.name(), tripletListToStore(list));
}
@@ -106,25 +106,18 @@ public final class TranslationUtil {
}
}
- private static void storeToTripletList(List<Triplet<Integer, Integer, Integer>> data, PropertyStore innerStore) {
+ private static void storeToTripletList(List<Triplet<String, String, String>> data, PropertyStore innerStore) {
for (String strKey : innerStore.arrayKeySet()) {
String[] value = innerStore.getArray(strKey);
- Integer first = Integer.valueOf(value[0]);
- Integer second = Integer.valueOf(value[1]);
- Integer third = Integer.valueOf(value[2]);
- data.add(new Triplet<Integer, Integer, Integer>(first, second, third));
+ data.add(new Triplet<String, String, String>(value[0], value[1], value[2]));
}
}
- private static PropertyStore tripletListToStore(List<Triplet<Integer, Integer, Integer>> list) {
+ private static PropertyStore tripletListToStore(List<Triplet<String, String, String>> list) {
PropertyStore innerStore = new PropertyStore();
int index = 0;
- for (Triplet<Integer, Integer, Integer> entry : list) {
- String[] data = new String[3];
- data[0] = String.valueOf(entry.getFirst());
- data[1] = String.valueOf(entry.getSecond());
- data[2] = String.valueOf(entry.getThird());
- innerStore.put(String.valueOf(index), data);
+ for (Triplet<String, String, String> entry : list) {
+ innerStore.put(String.valueOf(index), new String[] {entry.getFirst(), entry.getSecond(), entry.getThird()});
index++;
}
return innerStore;
diff --git a/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/internal/translation/ArtifactTypeCacheUpdateResponseTranslator.java b/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/internal/translation/ArtifactTypeCacheUpdateResponseTranslator.java
index 6bb3915..64d5c0a 100644
--- a/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/internal/translation/ArtifactTypeCacheUpdateResponseTranslator.java
+++ b/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/internal/translation/ArtifactTypeCacheUpdateResponseTranslator.java
@@ -38,7 +38,7 @@ public class ArtifactTypeCacheUpdateResponseTranslator implements ITranslator<Ar
public ArtifactTypeCacheUpdateResponse convert(PropertyStore store) throws OseeCoreException {
List<ArtifactTypeRow> rows = new ArrayList<ArtifactTypeRow>();
Map<Integer, Integer[]> baseToSuper = new HashMap<Integer, Integer[]>();
- List<Triplet<Integer, Integer, Integer>> artAttrs = new ArrayList<Triplet<Integer, Integer, Integer>>();
+ List<Triplet<String, String, String>> artAttrs = new ArrayList<Triplet<String, String, String>>();
int rowCount = store.getInt(Fields.ITEM_COUNT.name());
for (int index = 0; index < rowCount; index++) {
diff --git a/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/internal/translation/SearchRequestTranslator.java b/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/internal/translation/SearchRequestTranslator.java
index b761845..0562d9d 100644
--- a/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/internal/translation/SearchRequestTranslator.java
+++ b/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/internal/translation/SearchRequestTranslator.java
@@ -11,6 +11,7 @@
package org.eclipse.osee.framework.core.message.internal.translation;
import java.util.Collection;
+import org.eclipse.osee.framework.core.data.BranchToken;
import org.eclipse.osee.framework.core.data.IAttributeType;
import org.eclipse.osee.framework.core.data.IOseeBranch;
import org.eclipse.osee.framework.core.data.NamedIdentity;
@@ -100,12 +101,6 @@ public class SearchRequestTranslator implements ITranslator<SearchRequest> {
return store;
}
- private static final class BranchToken extends NamedIdentity implements IOseeBranch {
- public BranchToken(String guid, String name) {
- super(guid, name);
- }
- }
-
private static final class AttributeTypeFilter extends NamedIdentity implements IAttributeType {
public AttributeTypeFilter(String guid, String name) {
super(guid, name);
diff --git a/plugins/org.eclipse.osee.framework.core.model.test/src/org/eclipse/osee/framework/core/model/test/fields/ArtifactTypeAttributesFieldTest.java b/plugins/org.eclipse.osee.framework.core.model.test/src/org/eclipse/osee/framework/core/model/test/fields/ArtifactTypeAttributesFieldTest.java
index abe70be..a363afc 100644
--- a/plugins/org.eclipse.osee.framework.core.model.test/src/org/eclipse/osee/framework/core/model/test/fields/ArtifactTypeAttributesFieldTest.java
+++ b/plugins/org.eclipse.osee.framework.core.model.test/src/org/eclipse/osee/framework/core/model/test/fields/ArtifactTypeAttributesFieldTest.java
@@ -16,6 +16,7 @@ import java.util.Collections;
import java.util.LinkedHashMap;
import java.util.Map;
import junit.framework.Assert;
+import org.eclipse.osee.framework.core.data.IOseeBranch;
import org.eclipse.osee.framework.core.exception.OseeCoreException;
import org.eclipse.osee.framework.core.model.Branch;
import org.eclipse.osee.framework.core.model.internal.fields.ArtifactTypeAttributesField;
@@ -52,7 +53,7 @@ public class ArtifactTypeAttributesFieldTest {
@Test
public void testGetSet() throws OseeCoreException {
- Map<Branch, Collection<AttributeType>> input = new LinkedHashMap<Branch, Collection<AttributeType>>();
+ Map<IOseeBranch, Collection<AttributeType>> input = new LinkedHashMap<IOseeBranch, Collection<AttributeType>>();
ArtifactTypeAttributesField field = new ArtifactTypeAttributesField(input);
Assert.assertEquals(false, field.isDirty());
@@ -72,33 +73,33 @@ public class ArtifactTypeAttributesFieldTest {
field.clearDirty();
// Add to entry
- Map<Branch, Collection<AttributeType>> values = map(br1, attr2, attr4);
+ Map<IOseeBranch, Collection<AttributeType>> values = map(br1, attr2, attr4);
map(values, br2, attr3, attr1);
assertSetGet(field, values, values, true);
field.clearDirty();
// Add to emptylist
- assertSetGet(field, Collections.<Branch, Collection<AttributeType>> emptyMap(),
- Collections.<Branch, Collection<AttributeType>> emptyMap(), true);
+ assertSetGet(field, Collections.<IOseeBranch, Collection<AttributeType>> emptyMap(),
+ Collections.<IOseeBranch, Collection<AttributeType>> emptyMap(), true);
field.clearDirty();
}
- private static Map<Branch, Collection<AttributeType>> map(Branch branch, AttributeType... attrs) {
- Map<Branch, Collection<AttributeType>> map = new LinkedHashMap<Branch, Collection<AttributeType>>();
+ private static Map<IOseeBranch, Collection<AttributeType>> map(IOseeBranch branch, AttributeType... attrs) {
+ Map<IOseeBranch, Collection<AttributeType>> map = new LinkedHashMap<IOseeBranch, Collection<AttributeType>>();
map.put(branch, Arrays.asList(attrs));
return map;
}
- private static Map<Branch, Collection<AttributeType>> map(Map<Branch, Collection<AttributeType>> map, Branch branch, AttributeType... attrs) {
+ private static Map<IOseeBranch, Collection<AttributeType>> map(Map<IOseeBranch, Collection<AttributeType>> map, IOseeBranch branch, AttributeType... attrs) {
map.put(branch, Arrays.asList(attrs));
return map;
}
- private static void assertSetGet(ArtifactTypeAttributesField field, Map<Branch, Collection<AttributeType>> setValues, Map<Branch, Collection<AttributeType>> expected, boolean expectedDirty) throws OseeCoreException {
+ private static void assertSetGet(ArtifactTypeAttributesField field, Map<IOseeBranch, Collection<AttributeType>> setValues, Map<IOseeBranch, Collection<AttributeType>> expected, boolean expectedDirty) throws OseeCoreException {
field.set(setValues);
Assert.assertEquals(expectedDirty, field.isDirty());
- Map<Branch, Collection<AttributeType>> actual = field.get();
+ Map<IOseeBranch, Collection<AttributeType>> actual = field.get();
Assert.assertEquals(expected.size(), actual.size());
Assert.assertFalse(Compare.isDifferent(actual, expected));
diff --git a/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/MergeBranch.java b/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/MergeBranch.java
index c255cb0..74aa510 100644
--- a/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/MergeBranch.java
+++ b/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/MergeBranch.java
@@ -11,6 +11,7 @@
package org.eclipse.osee.framework.core.model;
+import org.eclipse.osee.framework.core.data.IOseeBranch;
import org.eclipse.osee.framework.core.enums.BranchState;
import org.eclipse.osee.framework.core.enums.BranchType;
import org.eclipse.osee.framework.core.exception.OseeCoreException;
@@ -39,11 +40,11 @@ public final class MergeBranch extends Branch {
return getFieldValue(BranchField.MERGE_BRANCH_DESTINATION);
}
- public void setSourceBranch(Branch branch) throws OseeCoreException {
+ public void setSourceBranch(IOseeBranch branch) throws OseeCoreException {
setField(BranchField.MERGE_BRANCH_SOURCE, branch);
}
- public void setDestinationBranch(Branch branch) throws OseeCoreException {
+ public void setDestinationBranch(IOseeBranch branch) throws OseeCoreException {
setField(BranchField.MERGE_BRANCH_DESTINATION, branch);
}
} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/cache/AbstractOseeCache.java b/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/cache/AbstractOseeCache.java
index d34e58f..447fd71 100644
--- a/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/cache/AbstractOseeCache.java
+++ b/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/cache/AbstractOseeCache.java
@@ -118,7 +118,6 @@ public abstract class AbstractOseeCache<T extends AbstractOseeType> implements I
/**
* this method is intended for use by subclasses only. The calling method must synchronize the use of this view of
* the views because it is not a copy. This method exists to improve performance for subclasses
- *
*/
protected synchronized Collection<T> getRawValues() throws OseeCoreException {
ensurePopulated();
@@ -229,6 +228,7 @@ public abstract class AbstractOseeCache<T extends AbstractOseeType> implements I
return types.iterator().next();
}
+ @Override
public T getByGuid(String guid) throws OseeCoreException {
ensurePopulated();
if (!GUID.isValid(guid)) {
diff --git a/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/cache/IOseeCache.java b/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/cache/IOseeCache.java
index 42e6af4..965841e 100644
--- a/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/cache/IOseeCache.java
+++ b/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/cache/IOseeCache.java
@@ -41,6 +41,8 @@ public interface IOseeCache<T> {
T getById(int typeId) throws OseeCoreException;
+ T getByGuid(String guid) throws OseeCoreException;
+
Collection<T> getAllDirty() throws OseeCoreException;
void storeAllModified() throws OseeCoreException;
diff --git a/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/cache/TransactionCache.java b/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/cache/TransactionCache.java
index 76d56f8..8e77ef1 100644
--- a/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/cache/TransactionCache.java
+++ b/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/cache/TransactionCache.java
@@ -114,6 +114,11 @@ public class TransactionCache implements IOseeCache<TransactionRecord> {
}
@Override
+ public TransactionRecord getByGuid(String guid) throws OseeCoreException {
+ throw new OseeStateException("TransactionCache.getByGuid() is not implemented...");
+ }
+
+ @Override
public OseeCacheEnum getCacheId() {
return cacheId;
}
diff --git a/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/internal/fields/ArtifactTypeAttributesField.java b/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/internal/fields/ArtifactTypeAttributesField.java
index 916c70e..6e975e2 100644
--- a/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/internal/fields/ArtifactTypeAttributesField.java
+++ b/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/internal/fields/ArtifactTypeAttributesField.java
@@ -15,9 +15,9 @@ import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Map.Entry;
+import org.eclipse.osee.framework.core.data.IOseeBranch;
import org.eclipse.osee.framework.core.exception.OseeCoreException;
import org.eclipse.osee.framework.core.model.AbstractOseeField;
-import org.eclipse.osee.framework.core.model.Branch;
import org.eclipse.osee.framework.core.model.type.AttributeType;
import org.eclipse.osee.framework.core.util.Conditions;
import org.eclipse.osee.framework.jdk.core.util.Compare;
@@ -25,21 +25,21 @@ import org.eclipse.osee.framework.jdk.core.util.Compare;
/**
* @author Roberto E. Escobar
*/
-public final class ArtifactTypeAttributesField extends AbstractOseeField<Map<Branch, Collection<AttributeType>>> {
+public final class ArtifactTypeAttributesField extends AbstractOseeField<Map<IOseeBranch, Collection<AttributeType>>> {
- private final Map<Branch, Collection<AttributeType>> validityMap;
+ private final Map<IOseeBranch, Collection<AttributeType>> validityMap;
- public ArtifactTypeAttributesField(Map<Branch, Collection<AttributeType>> validityMap) {
+ public ArtifactTypeAttributesField(Map<IOseeBranch, Collection<AttributeType>> validityMap) {
super();
this.validityMap = validityMap;
}
@Override
- public Map<Branch, Collection<AttributeType>> get() throws OseeCoreException {
- return new HashMap<Branch, Collection<AttributeType>>(validityMap);
+ public Map<IOseeBranch, Collection<AttributeType>> get() throws OseeCoreException {
+ return new HashMap<IOseeBranch, Collection<AttributeType>>(validityMap);
}
- public void put(Branch branch, Collection<AttributeType> attributes) {
+ public void put(IOseeBranch branch, Collection<AttributeType> attributes) {
Collection<AttributeType> current = validityMap.get(branch);
validityMap.put(branch, attributes);
if (Compare.isDifferent(current, attributes)) {
@@ -48,12 +48,12 @@ public final class ArtifactTypeAttributesField extends AbstractOseeField<Map<Bra
}
@Override
- public void set(Map<Branch, Collection<AttributeType>> attributeTypeMap) throws OseeCoreException {
+ public void set(Map<IOseeBranch, Collection<AttributeType>> attributeTypeMap) throws OseeCoreException {
Conditions.checkNotNull(attributeTypeMap, "attribute type map input");
boolean isDifferent = Compare.isDifferent(get(), attributeTypeMap);
if (isDifferent) {
validityMap.clear();
- for (Entry<Branch, Collection<AttributeType>> entry : attributeTypeMap.entrySet()) {
+ for (Entry<IOseeBranch, Collection<AttributeType>> entry : attributeTypeMap.entrySet()) {
// Ensure we are using a hash set - don't use putAll
set(entry.getKey(), entry.getValue());
}
@@ -61,7 +61,7 @@ public final class ArtifactTypeAttributesField extends AbstractOseeField<Map<Bra
isDirty |= isDifferent;
}
- private void set(Branch branch, Collection<AttributeType> attributeTypes) throws OseeCoreException {
+ private void set(IOseeBranch branch, Collection<AttributeType> attributeTypes) throws OseeCoreException {
Conditions.checkNotNull(branch, "branch");
Conditions.checkNotNull(attributeTypes, "attribute types list");
diff --git a/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/type/ArtifactType.java b/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/type/ArtifactType.java
index cf4fb35..3500c53 100644
--- a/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/type/ArtifactType.java
+++ b/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/type/ArtifactType.java
@@ -18,6 +18,7 @@ import java.util.Map;
import java.util.Set;
import org.eclipse.osee.framework.core.data.IArtifactType;
import org.eclipse.osee.framework.core.data.IAttributeType;
+import org.eclipse.osee.framework.core.data.IOseeBranch;
import org.eclipse.osee.framework.core.exception.OseeCoreException;
import org.eclipse.osee.framework.core.model.AbstractOseeType;
import org.eclipse.osee.framework.core.model.Branch;
@@ -37,7 +38,8 @@ public final class ArtifactType extends AbstractOseeType implements IArtifactTyp
private final Set<ArtifactType> superTypes = new HashSet<ArtifactType>();
private final Set<ArtifactType> childTypes = new HashSet<ArtifactType>();
- private final Map<Branch, Collection<AttributeType>> attributes = new HashMap<Branch, Collection<AttributeType>>();
+ private final Map<IOseeBranch, Collection<AttributeType>> attributes =
+ new HashMap<IOseeBranch, Collection<AttributeType>>();
public ArtifactType(String guid, String name, boolean isAbstract) {
super(guid, name);
@@ -97,12 +99,12 @@ public final class ArtifactType extends AbstractOseeType implements IArtifactTyp
}
}
- public void setAttributeTypes(Collection<AttributeType> attributeTypes, Branch branch) throws OseeCoreException {
+ public void setAttributeTypes(Collection<AttributeType> attributeTypes, IOseeBranch branch) throws OseeCoreException {
IOseeField<?> field = getField(ARTIFACT_TYPE_ATTRIBUTES_FIELD_KEY);
((ArtifactTypeAttributesField) field).put(branch, attributeTypes);
}
- public void setAllAttributeTypes(Map<Branch, Collection<AttributeType>> attributeTypes) throws OseeCoreException {
+ public void setAllAttributeTypes(Map<IOseeBranch, Collection<AttributeType>> attributeTypes) throws OseeCoreException {
IOseeField<?> field = getField(ARTIFACT_TYPE_ATTRIBUTES_FIELD_KEY);
((ArtifactTypeAttributesField) field).set(attributeTypes);
}
@@ -111,7 +113,7 @@ public final class ArtifactType extends AbstractOseeType implements IArtifactTyp
return getAttributeTypes(branch).contains(attributeType);
}
- public Map<Branch, Collection<AttributeType>> getLocalAttributeTypes() throws OseeCoreException {
+ public Map<IOseeBranch, Collection<AttributeType>> getLocalAttributeTypes() throws OseeCoreException {
return getFieldValue(ARTIFACT_TYPE_ATTRIBUTES_FIELD_KEY);
}
@@ -123,7 +125,7 @@ public final class ArtifactType extends AbstractOseeType implements IArtifactTyp
}
private static void getAttributeTypes(Set<IAttributeType> attributeTypes, ArtifactType artifactType, Branch branch) throws OseeCoreException {
- Map<Branch, Collection<AttributeType>> validityMap = artifactType.getLocalAttributeTypes();
+ Map<IOseeBranch, Collection<AttributeType>> validityMap = artifactType.getLocalAttributeTypes();
Branch branchCursor = branch;
do {
diff --git a/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/type/OseeEnumTypeFactory.java b/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/type/OseeEnumTypeFactory.java
index 260a86a..c190d65 100644
--- a/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/type/OseeEnumTypeFactory.java
+++ b/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/type/OseeEnumTypeFactory.java
@@ -24,9 +24,6 @@ import org.eclipse.osee.framework.core.util.Conditions;
*/
public class OseeEnumTypeFactory implements IOseeTypeFactory {
- public OseeEnumTypeFactory() {
- }
-
public OseeEnumType createEnumType(String guid, String name) throws OseeCoreException {
Conditions.checkNotNullOrEmpty(name, "osee enum type name");
String checkedGuid = Conditions.checkGuidCreateIfNeeded(guid);
diff --git a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/BranchToken.java b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/BranchToken.java
new file mode 100644
index 0000000..bbc3262
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/BranchToken.java
@@ -0,0 +1,17 @@
+/*******************************************************************************
+ * Copyright (c) 2010 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.core.data;
+
+public final class BranchToken extends NamedIdentity implements IOseeBranch {
+ public BranchToken(String guid, String name) {
+ super(guid, name);
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.skynet.core.test/src/org/eclipse/osee/framework/skynet/core/test/FrameworkCore_Demo_Suite.java b/plugins/org.eclipse.osee.framework.skynet.core.test/src/org/eclipse/osee/framework/skynet/core/test/FrameworkCore_Demo_Suite.java
index 37b2f27..9548b7e 100644
--- a/plugins/org.eclipse.osee.framework.skynet.core.test/src/org/eclipse/osee/framework/skynet/core/test/FrameworkCore_Demo_Suite.java
+++ b/plugins/org.eclipse.osee.framework.skynet.core.test/src/org/eclipse/osee/framework/skynet/core/test/FrameworkCore_Demo_Suite.java
@@ -12,6 +12,7 @@ package org.eclipse.osee.framework.skynet.core.test;
import static org.junit.Assert.assertTrue;
import org.eclipse.osee.framework.core.client.ClientSessionManager;
+import org.eclipse.osee.framework.skynet.core.test.artifact.ArtifactTest;
import org.eclipse.osee.framework.skynet.core.test.artifact.AttributePurgeTest;
import org.eclipse.osee.framework.skynet.core.test.branch.BranchTestSuite;
import org.eclipse.osee.framework.skynet.core.test.cases.ArtifactLoaderTest;
@@ -56,6 +57,7 @@ import org.junit.runners.Suite;
@RunWith(Suite.class)
@Suite.SuiteClasses({
+ ArtifactTest.class,
ReplaceWithAttributeTest.class,
AttributePurgeTest.class,
CrossBranchLinkTest.class,
diff --git a/plugins/org.eclipse.osee.framework.skynet.core.test/src/org/eclipse/osee/framework/skynet/core/test/artifact/ArtifactTest.java b/plugins/org.eclipse.osee.framework.skynet.core.test/src/org/eclipse/osee/framework/skynet/core/test/artifact/ArtifactTest.java
new file mode 100644
index 0000000..5b2d63a
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.skynet.core.test/src/org/eclipse/osee/framework/skynet/core/test/artifact/ArtifactTest.java
@@ -0,0 +1,73 @@
+/*******************************************************************************
+ * Copyright (c) 2010 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.test.artifact;
+
+import org.eclipse.osee.framework.core.enums.CoreAttributeTypes;
+import org.eclipse.osee.framework.core.enums.CoreBranches;
+import org.eclipse.osee.framework.core.exception.OseeArgumentException;
+import org.eclipse.osee.framework.logging.SevereLoggingMonitor;
+import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
+import org.eclipse.osee.framework.skynet.core.artifact.ArtifactTypeManager;
+import org.eclipse.osee.support.test.util.DemoArtifactTypes;
+import org.eclipse.osee.support.test.util.DemoSawBuilds;
+import org.eclipse.osee.support.test.util.TestUtil;
+import org.junit.AfterClass;
+import org.junit.Assert;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+public final class ArtifactTest {
+
+ private static SevereLoggingMonitor monitorLog;
+
+ @BeforeClass
+ public static void setUp() throws Exception {
+ monitorLog = TestUtil.severeLoggingStart();
+ }
+
+ @AfterClass
+ public static void tearDown() throws Exception {
+ TestUtil.severeLoggingEnd(monitorLog);
+ }
+
+ @Test
+ public void attributeCopyAcrossRelatedBranches() throws Exception {
+ Artifact artifactWithSpecialAttr =
+ ArtifactTypeManager.makeNewArtifact(DemoArtifactTypes.DemoCodeTeamWorkflow, DemoSawBuilds.SAW_Bld_1);
+ artifactWithSpecialAttr.setSoleAttributeValue(CoreAttributeTypes.Partition, "Navigation");
+ artifactWithSpecialAttr.setName("ArtifactTest-artifactWithSpecialAttr");
+
+ Artifact copiedArtifact = artifactWithSpecialAttr.duplicate(DemoSawBuilds.SAW_Bld_2);
+
+ Assert.assertFalse(copiedArtifact.getAttributes(CoreAttributeTypes.Partition).isEmpty());
+ }
+
+ @Test
+ public void attributeCopyAcrossUnrelatedBranches() throws Exception {
+ Artifact artifactWithSpecialAttr =
+ ArtifactTypeManager.makeNewArtifact(DemoArtifactTypes.DemoCodeTeamWorkflow, DemoSawBuilds.SAW_Bld_1);
+ artifactWithSpecialAttr.setSoleAttributeValue(CoreAttributeTypes.Partition, "Navigation");
+ artifactWithSpecialAttr.setName("ArtifactTest-artifactWithSpecialAttr");
+
+ Artifact copiedArtifact = artifactWithSpecialAttr.duplicate(CoreBranches.COMMON);
+
+ Assert.assertTrue(copiedArtifact.getAttributes(CoreAttributeTypes.Partition).isEmpty());
+ }
+
+ @Test(expected = OseeArgumentException.class)
+ public void setSoleAttributeValueTest() throws Exception {
+ Artifact artifactWithSpecialAttr =
+ ArtifactTypeManager.makeNewArtifact(DemoArtifactTypes.DemoCodeTeamWorkflow, CoreBranches.COMMON);
+ artifactWithSpecialAttr.setSoleAttributeValue(CoreAttributeTypes.Partition, "Navigation");
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/Artifact.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/Artifact.java
index 94526be..bee1cfd 100644
--- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/Artifact.java
+++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/Artifact.java
@@ -599,6 +599,10 @@ public class Artifact extends NamedIdentity implements IArtifact, IAdaptable, IB
}
private <T> Attribute<T> getOrCreateSoleAttribute(IAttributeType attributeType) throws OseeCoreException {
+ if (!isAttributeTypeValid(attributeType)) {
+ throw new OseeArgumentException("The attribute type %s is not valid for artifacts of type [%s]",
+ attributeType, getArtifactTypeName());
+ }
Attribute<T> attribute = getSoleAttribute(attributeType);
if (attribute == null) {
attribute = initializeAttribute(attributeType, ModificationType.NEW, true, true);
@@ -1331,7 +1335,7 @@ public class Artifact extends NamedIdentity implements IArtifact, IAdaptable, IB
private void copyAttributes(Artifact artifact, Collection<IAttributeType> excudeAttributeTypes) throws OseeCoreException {
for (Attribute<?> attribute : getAttributes()) {
- if (!excudeAttributeTypes.contains(attribute) && isCopyAllowed(attribute)) {
+ if (!excudeAttributeTypes.contains(attribute) && isCopyAllowed(attribute) && artifact.isAttributeTypeValid(attribute.getAttributeType())) {
artifact.addAttribute(attribute.getAttributeType(), attribute.getValue());
}
}
diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/UniversalGroup.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/UniversalGroup.java
index ac0a892..3d38b3b 100644
--- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/UniversalGroup.java
+++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/UniversalGroup.java
@@ -15,12 +15,11 @@ import java.util.Collection;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.logging.Level;
-
+import org.eclipse.osee.framework.core.data.IOseeBranch;
import org.eclipse.osee.framework.core.enums.CoreArtifactTypes;
import org.eclipse.osee.framework.core.enums.CoreRelationTypes;
import org.eclipse.osee.framework.core.exception.OseeArgumentException;
import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.core.model.Branch;
import org.eclipse.osee.framework.logging.OseeLog;
import org.eclipse.osee.framework.skynet.core.OseeSystemArtifacts;
import org.eclipse.osee.framework.skynet.core.artifact.search.ArtifactQuery;
@@ -31,7 +30,7 @@ import org.eclipse.osee.framework.skynet.core.internal.Activator;
*/
public class UniversalGroup {
- public static Collection<Artifact> getGroups(Branch branch) {
+ public static Collection<Artifact> getGroups(IOseeBranch branch) {
Collection<Artifact> artifacts = null;
try {
artifacts = ArtifactQuery.getArtifactListFromType(CoreArtifactTypes.UniversalGroup, branch);
@@ -42,7 +41,7 @@ public class UniversalGroup {
return artifacts;
}
- public static Collection<Artifact> getGroupsNotRoot(Branch branch) {
+ public static Collection<Artifact> getGroupsNotRoot(IOseeBranch branch) {
Collection<Artifact> groups = new HashSet<Artifact>();
for (Artifact group : UniversalGroup.getGroups(branch)) {
if (!group.getName().equals("Root Artifact")) {
@@ -52,7 +51,7 @@ public class UniversalGroup {
return groups;
}
- public static Collection<Artifact> getGroups(String groupName, Branch branch) {
+ public static Collection<Artifact> getGroups(String groupName, IOseeBranch branch) {
try {
return ArtifactQuery.getArtifactListFromTypeAndName(CoreArtifactTypes.UniversalGroup, groupName, branch);
} catch (OseeCoreException ex) {
@@ -61,7 +60,7 @@ public class UniversalGroup {
return new ArrayList<Artifact>();
}
- public static Artifact addGroup(String name, Branch branch) throws OseeCoreException {
+ public static Artifact addGroup(String name, IOseeBranch branch) throws OseeCoreException {
if (!getGroups(name, branch).isEmpty()) {
throw new OseeArgumentException("Group Already Exists");
}
@@ -74,7 +73,7 @@ public class UniversalGroup {
return groupArt;
}
- public static Artifact getTopUniversalGroupArtifact(Branch branch) throws OseeCoreException {
+ public static Artifact getTopUniversalGroupArtifact(IOseeBranch branch) throws OseeCoreException {
return ArtifactQuery.getArtifactFromTypeAndName(CoreArtifactTypes.UniversalGroup,
OseeSystemArtifacts.ROOT_ARTIFACT_TYPE_NAME, branch);
}
diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/factory/UserArtifactFactory.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/factory/UserArtifactFactory.java
index 6f34888..0db1909 100644
--- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/factory/UserArtifactFactory.java
+++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/factory/UserArtifactFactory.java
@@ -33,7 +33,7 @@ public class UserArtifactFactory extends ArtifactFactory {
public @Override
Artifact getArtifactInstance(String guid, String humandReadableId, Branch branch, IArtifactType artifactType) throws OseeCoreException {
- if (artifactType.getGuid().equals(CoreArtifactTypes.User.getGuid())) {
+ if (artifactType.equals(CoreArtifactTypes.User)) {
return new User(this, guid, humandReadableId, branch, artifactType);
}
throw new OseeArgumentException("did not recognize the artifact type [%s]", artifactType);
diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/internal/accessors/ClientArtifactTypeAccessor.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/internal/accessors/ClientArtifactTypeAccessor.java
index 80f8730..6916982 100644
--- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/internal/accessors/ClientArtifactTypeAccessor.java
+++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/internal/accessors/ClientArtifactTypeAccessor.java
@@ -16,6 +16,7 @@ import java.util.HashSet;
import java.util.List;
import java.util.Map.Entry;
import java.util.Set;
+import org.eclipse.osee.framework.core.data.IOseeBranch;
import org.eclipse.osee.framework.core.enums.CoreTranslatorId;
import org.eclipse.osee.framework.core.exception.OseeCoreException;
import org.eclipse.osee.framework.core.message.ArtifactTypeCacheUpdateResponse;
@@ -41,7 +42,6 @@ public class ClientArtifactTypeAccessor extends AbstractClientDataAccessor<Artif
private final ArtifactTypeFactory artifactTypeFactory;
public ClientArtifactTypeAccessor(ArtifactTypeFactory artifactTypeFactory, AbstractOseeCache<AttributeType> attrCache, AbstractOseeCache<Branch> branchCache) {
- super();
this.artifactTypeFactory = artifactTypeFactory;
this.attrCache = attrCache;
this.branchCache = branchCache;
@@ -85,21 +85,21 @@ public class ClientArtifactTypeAccessor extends AbstractClientDataAccessor<Artif
baseType.setSuperTypes(superTypes);
}
- CompositeKeyHashMap<ArtifactType, Branch, Collection<AttributeType>> attrs =
- new CompositeKeyHashMap<ArtifactType, Branch, Collection<AttributeType>>();
+ CompositeKeyHashMap<ArtifactType, IOseeBranch, Collection<AttributeType>> attrs =
+ new CompositeKeyHashMap<ArtifactType, IOseeBranch, Collection<AttributeType>>();
- for (Triplet<Integer, Integer, Integer> entry : response.getAttributeTypes()) {
- ArtifactType key1 = cache.getById(entry.getFirst());
- Branch key2 = branchCache.getById(entry.getSecond());
+ for (Triplet<String, String, String> entry : response.getAttributeTypes()) {
+ ArtifactType key1 = cache.getByGuid(entry.getFirst());
+ IOseeBranch key2 = branchCache.getByGuid(entry.getSecond());
Collection<AttributeType> types = attrs.get(key1, key2);
if (types == null) {
types = new HashSet<AttributeType>();
attrs.put(key1, key2, types);
}
- types.add(attrCache.getById(entry.getThird()));
+ types.add(attrCache.getByGuid(entry.getThird()));
}
- for (Entry<Pair<ArtifactType, Branch>, Collection<AttributeType>> entry : attrs.entrySet()) {
+ for (Entry<Pair<ArtifactType, IOseeBranch>, Collection<AttributeType>> entry : attrs.entrySet()) {
entry.getKey().getFirst().setAttributeTypes(entry.getValue(), entry.getKey().getSecond());
}
return updatedItems;
diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/internal/accessors/ClientBranchAccessor.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/internal/accessors/ClientBranchAccessor.java
index e553f65..529545c 100644
--- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/internal/accessors/ClientBranchAccessor.java
+++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/internal/accessors/ClientBranchAccessor.java
@@ -45,7 +45,6 @@ public class ClientBranchAccessor extends AbstractClientDataAccessor<Branch> {
private final BranchFactory branchFactory;
public ClientBranchAccessor(BranchFactory branchFactory, TransactionCache transactionCache) {
- super();
this.branchFactory = branchFactory;
this.transactionCache = transactionCache;
}