Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoraudrey.e.denk2019-11-07 14:41:52 +0000
committerRyan T. Baldwin2019-11-07 14:41:52 +0000
commitd99806d1493edf85512381b5f8da86f238a17147 (patch)
tree70997bf053911fba4bcc157298720697bde42236
parent68270dd68b88784abd460efc56386367dc5103d0 (diff)
downloadorg.eclipse.osee-d99806d1493edf85512381b5f8da86f238a17147.tar.gz
org.eclipse.osee-d99806d1493edf85512381b5f8da86f238a17147.tar.xz
org.eclipse.osee-d99806d1493edf85512381b5f8da86f238a17147.zip
feature[TW15019]: Update OrcsWriter to accept Applicability values
Change-Id: Ic3fc36d355379448356632319708ade0f906f831 Signed-off-by: audrey.e.denk <audrey.e.denk@boeing.com>
-rw-r--r--plugins/org.eclipse.osee.ats.ide.integration.tests/src/org/eclipse/osee/ats/ide/integration/tests/ats/resource/OrcsWriterEndpointTest.java14
-rw-r--r--plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/ds/ArtifactDataFactory.java9
-rw-r--r--plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/artifact/ArtifactFactory.java15
-rw-r--r--plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/transaction/TransactionBuilderImpl.java10
-rw-r--r--plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/transaction/TxDataManager.java16
-rw-r--r--plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/loader/DataFactoryImpl.java31
-rw-r--r--plugins/org.eclipse.osee.orcs.rest.model/src/org/eclipse/osee/orcs/rest/model/writer/reader/OwApplicability.java53
-rw-r--r--plugins/org.eclipse.osee.orcs.rest.model/src/org/eclipse/osee/orcs/rest/model/writer/reader/OwApplicabilityType.java35
-rw-r--r--plugins/org.eclipse.osee.orcs.rest.model/src/org/eclipse/osee/orcs/rest/model/writer/reader/OwArtifact.java10
-rw-r--r--plugins/org.eclipse.osee.orcs.rest.model/src/org/eclipse/osee/orcs/rest/model/writer/reader/OwCollector.java12
-rw-r--r--plugins/org.eclipse.osee.orcs.rest/src/org/eclipse/osee/orcs/rest/internal/writer/IOrcsValidationHelper.java2
-rw-r--r--plugins/org.eclipse.osee.orcs.rest/src/org/eclipse/osee/orcs/rest/internal/writer/OrcsCollectorValidator.java5
-rw-r--r--plugins/org.eclipse.osee.orcs.rest/src/org/eclipse/osee/orcs/rest/internal/writer/OrcsCollectorWriter.java74
-rw-r--r--plugins/org.eclipse.osee.orcs.rest/src/org/eclipse/osee/orcs/rest/internal/writer/OrcsValidationHelperAdapter.java16
-rw-r--r--plugins/org.eclipse.osee.orcs.rest/src/org/eclipse/osee/orcs/rest/internal/writer/OrcsWriterCollectorGenerator.java23
-rw-r--r--plugins/org.eclipse.osee.orcs.rest/src/org/eclipse/osee/orcs/rest/internal/writer/OrcsWriterFactory.java10
-rw-r--r--plugins/org.eclipse.osee.orcs.rest/src/org/eclipse/osee/orcs/rest/internal/writer/OrcsWriterSheetProcessorForCreateUpdate.java13
-rw-r--r--plugins/org.eclipse.osee.orcs.rest/src/org/eclipse/osee/orcs/rest/internal/writer/OwFactory.java10
-rw-r--r--plugins/org.eclipse.osee.orcs/src/org/eclipse/osee/orcs/transaction/TransactionBuilder.java5
19 files changed, 350 insertions, 13 deletions
diff --git a/plugins/org.eclipse.osee.ats.ide.integration.tests/src/org/eclipse/osee/ats/ide/integration/tests/ats/resource/OrcsWriterEndpointTest.java b/plugins/org.eclipse.osee.ats.ide.integration.tests/src/org/eclipse/osee/ats/ide/integration/tests/ats/resource/OrcsWriterEndpointTest.java
index dadbb6d4c03..aa726b3d2ed 100644
--- a/plugins/org.eclipse.osee.ats.ide.integration.tests/src/org/eclipse/osee/ats/ide/integration/tests/ats/resource/OrcsWriterEndpointTest.java
+++ b/plugins/org.eclipse.osee.ats.ide.integration.tests/src/org/eclipse/osee/ats/ide/integration/tests/ats/resource/OrcsWriterEndpointTest.java
@@ -47,7 +47,7 @@ public class OrcsWriterEndpointTest extends AbstractRestTest {
@Test
public void testGetOrcsWriterInputDefaultJson() throws Exception {
OwCollector collector = getDefaultOwCollector();
- assertEquals(3, collector.getCreate().size());
+ assertEquals(4, collector.getCreate().size());
}
private OwCollector getDefaultOwCollector() throws Exception {
@@ -90,16 +90,22 @@ public class OrcsWriterEndpointTest extends AbstractRestTest {
long artId = art.getId();
Artifact folderArt = AtsClientService.get().getQueryServiceClient().getArtifact(artId);
assertNotNull(folderArt);
- assertEquals(2, folderArt.getChildren().size());
+ assertEquals(3, folderArt.getChildren().size());
for (Artifact child : folderArt.getChildren()) {
- assertTrue(
- child.getName().equals("Software Requirement 1") || child.getName().equals("Software Requirement 2"));
+ assertTrue(child.getName().equals("MSWordRequirement3") || child.getName().equals(
+ "Software Requirement 1") || child.getName().equals("Software Requirement 2"));
+ if (child.getName().equals("MSWordRequirement3")) {
+ assertTrue(child.getAttributes().get(4).getValue().toString().contains("<w:p><w:r><w:t>"));
+
+ }
+
}
}
}
OwArtifact userGroupOwArt = collector.getUpdate().iterator().next();
Artifact userGroupArt = AtsClientService.get().getQueryServiceClient().getArtifact(userGroupOwArt.getId());
+
assertNotNull(userGroupArt);
userGroupArt.reloadAttributesAndRelations();
assertEquals("test static id", userGroupArt.getSoleAttributeValue(CoreAttributeTypes.StaticId, null));
diff --git a/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/ds/ArtifactDataFactory.java b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/ds/ArtifactDataFactory.java
index fcda64e5176..4548d3fd2bb 100644
--- a/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/ds/ArtifactDataFactory.java
+++ b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/ds/ArtifactDataFactory.java
@@ -10,8 +10,9 @@
*******************************************************************************/
package org.eclipse.osee.orcs.core.ds;
-import org.eclipse.osee.framework.core.data.BranchId;
+import org.eclipse.osee.framework.core.data.ApplicabilityId;
import org.eclipse.osee.framework.core.data.ArtifactTypeToken;
+import org.eclipse.osee.framework.core.data.BranchId;
/**
* @author Roberto E. Escobar
@@ -20,10 +21,16 @@ public interface ArtifactDataFactory {
ArtifactData create(BranchId branch, ArtifactTypeToken artifactType, String guid);
+ ArtifactData create(BranchId branch, ArtifactTypeToken artifactType, String guid, ApplicabilityId appId);
+
ArtifactData create(BranchId branch, ArtifactTypeToken artifactType, String guid, long artifactId);
+ ArtifactData create(BranchId branch, ArtifactTypeToken artifactType, String guid, long artifactId, ApplicabilityId appId);
+
ArtifactData create(BranchId branch, ArtifactTypeToken artifactType, Long artifactId);
+ ArtifactData create(BranchId branch, ArtifactTypeToken artifactType, Long artifactId, ApplicabilityId appId);
+
ArtifactData copy(BranchId destination, ArtifactData source);
ArtifactData clone(ArtifactData source);
diff --git a/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/artifact/ArtifactFactory.java b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/artifact/ArtifactFactory.java
index 3e12a8b4b9a..6c329b0a9e3 100644
--- a/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/artifact/ArtifactFactory.java
+++ b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/artifact/ArtifactFactory.java
@@ -14,6 +14,7 @@ import static org.eclipse.osee.framework.core.enums.CoreAttributeTypes.RelationO
import java.util.Collection;
import java.util.HashSet;
import java.util.Set;
+import org.eclipse.osee.framework.core.data.ApplicabilityId;
import org.eclipse.osee.framework.core.data.ArtifactTypeToken;
import org.eclipse.osee.framework.core.data.AttributeTypeToken;
import org.eclipse.osee.framework.core.data.BranchId;
@@ -54,6 +55,13 @@ public class ArtifactFactory {
return artifact;
}
+ public Artifact createArtifact(OrcsSession session, BranchId branch, ArtifactTypeToken artifactType, String guid, ApplicabilityId appId) {
+ ArtifactData artifactData = factory.create(branch, artifactType, guid, appId);
+ Artifact artifact = createArtifact(session, artifactData);
+ artifact.setLoaded(true);
+ return artifact;
+ }
+
public Artifact createArtifact(OrcsSession session, BranchId branch, ArtifactTypeToken artifactType, String guid, long uuid) {
ArtifactData artifactData = factory.create(branch, artifactType, guid, uuid);
Artifact artifact = createArtifact(session, artifactData);
@@ -68,6 +76,13 @@ public class ArtifactFactory {
return artifact;
}
+ public Artifact createArtifact(OrcsSession session, BranchId branch, ArtifactTypeToken artifactType, Long artifactId, ApplicabilityId appId) {
+ ArtifactData artifactData = factory.create(branch, artifactType, artifactId, appId);
+ Artifact artifact = createArtifact(session, artifactData);
+ artifact.setLoaded(true);
+ return artifact;
+ }
+
public Artifact copyArtifact(OrcsSession session, Artifact source, Collection<AttributeTypeToken> types, BranchId ontoBranch) {
ArtifactData artifactData = factory.copy(ontoBranch, source.getOrcsData());
Artifact copy = createArtifact(session, artifactData);
diff --git a/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/transaction/TransactionBuilderImpl.java b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/transaction/TransactionBuilderImpl.java
index 8d5ec37b13f..1005084c210 100644
--- a/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/transaction/TransactionBuilderImpl.java
+++ b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/transaction/TransactionBuilderImpl.java
@@ -133,6 +133,11 @@ public class TransactionBuilderImpl implements TransactionBuilder {
}
@Override
+ public ArtifactToken createArtifact(ArtifactTypeToken artifactType, String name, ApplicabilityId appId) {
+ return txManager.createArtifact(txData, artifactType, name, (String) null, appId);
+ }
+
+ @Override
public ArtifactToken createArtifact(ArtifactToken token) {
return txManager.createArtifact(txData, token.getArtifactType(), token.getName(), token.getUuid());
}
@@ -143,6 +148,11 @@ public class TransactionBuilderImpl implements TransactionBuilder {
}
@Override
+ public ArtifactToken createArtifact(ArtifactTypeToken artifactType, String name, Long artifactId, ApplicabilityId appId) {
+ return txManager.createArtifact(txData, artifactType, name, artifactId, appId);
+ }
+
+ @Override
public ArtifactToken createArtifact(ArtifactTypeToken artifactType, String name, String guid) {
return txManager.createArtifact(txData, artifactType, name, guid);
}
diff --git a/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/transaction/TxDataManager.java b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/transaction/TxDataManager.java
index a9fcc7fcb58..1e817a1983d 100644
--- a/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/transaction/TxDataManager.java
+++ b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/transaction/TxDataManager.java
@@ -276,6 +276,14 @@ public class TxDataManager {
return asExternalArtifact(txData, artifact);
}
+ public ArtifactReadable createArtifact(TxData txData, ArtifactTypeToken artifactType, String name, String guid, ApplicabilityId appId) {
+ checkChangesAllowed(txData);
+ Artifact artifact =
+ artifactFactory.createArtifact(txData.getSession(), txData.getBranch(), artifactType, guid, appId);
+ artifact.setName(name);
+ return asExternalArtifact(txData, artifact);
+ }
+
public ArtifactReadable createArtifact(TxData txData, ArtifactTypeToken artifactType, String name, Long artifactId, String guid) {
checkChangesAllowed(txData);
Artifact artifact =
@@ -291,6 +299,14 @@ public class TxDataManager {
return asExternalArtifact(txData, artifact);
}
+ public ArtifactReadable createArtifact(TxData txData, ArtifactTypeToken artifactType, String name, long uuid, ApplicabilityId appId) {
+ checkChangesAllowed(txData);
+ Artifact artifact =
+ artifactFactory.createArtifact(txData.getSession(), txData.getBranch(), artifactType, uuid, appId);
+ artifact.setName(name);
+ return asExternalArtifact(txData, artifact);
+ }
+
public ArtifactReadable copyArtifact(TxData txData, BranchId fromBranch, ArtifactId artifactId) {
checkChangesAllowed(txData);
Artifact source = getSourceArtifact(txData, fromBranch, artifactId);
diff --git a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/loader/DataFactoryImpl.java b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/loader/DataFactoryImpl.java
index 6cfffd51eed..c7f79edfc1b 100644
--- a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/loader/DataFactoryImpl.java
+++ b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/loader/DataFactoryImpl.java
@@ -60,11 +60,21 @@ public class DataFactoryImpl implements DataFactory {
}
@Override
+ public ArtifactData create(BranchId branch, ArtifactTypeToken token, String guid, ApplicabilityId appId) {
+ return this.create(branch, token, guid, idFactory.getNextArtifactId(), appId);
+ }
+
+ @Override
public ArtifactData create(BranchId branch, ArtifactTypeToken token, Long artifactId) {
return this.create(branch, token, null, artifactId);
}
@Override
+ public ArtifactData create(BranchId branch, ArtifactTypeToken token, Long artifactId, ApplicabilityId appId) {
+ return this.create(branch, token, null, artifactId, appId);
+ }
+
+ @Override
public ArtifactData create(BranchId branchId, ArtifactTypeToken token, String guid, long artifactId) {
Conditions.checkNotNull(branchId, "branch");
@@ -86,6 +96,27 @@ public class DataFactoryImpl implements DataFactory {
}
@Override
+ public ArtifactData create(BranchId branchId, ArtifactTypeToken token, String guid, long artifactId, ApplicabilityId appId) {
+ Conditions.checkNotNull(branchId, "branch");
+
+ Conditions.checkExpressionFailOnTrue(artifactCache.isAbstract(token),
+ "Cannot create an instance of abstract type [%s]", token);
+
+ String guidToSet = idFactory.getUniqueGuid(guid);
+
+ Conditions.checkExpressionFailOnTrue(!GUID.isValid(guidToSet),
+ "Invalid guid [%s] during artifact creation [type: %s]", guidToSet, token);
+
+ VersionData version = objectFactory.createDefaultVersionData();
+ version.setBranch(branchId);
+
+ ModificationType modType = RelationalConstants.DEFAULT_MODIFICATION_TYPE;
+ ArtifactData artifactData =
+ objectFactory.createArtifactData(version, (int) artifactId, token, modType, guidToSet, appId);
+ return artifactData;
+ }
+
+ @Override
public ArtifactData copy(BranchId destination, ArtifactData source) {
ArtifactData copy = objectFactory.createCopy(source);
updateDataForCopy(destination, copy);
diff --git a/plugins/org.eclipse.osee.orcs.rest.model/src/org/eclipse/osee/orcs/rest/model/writer/reader/OwApplicability.java b/plugins/org.eclipse.osee.orcs.rest.model/src/org/eclipse/osee/orcs/rest/model/writer/reader/OwApplicability.java
new file mode 100644
index 00000000000..77ea0aa9081
--- /dev/null
+++ b/plugins/org.eclipse.osee.orcs.rest.model/src/org/eclipse/osee/orcs/rest/model/writer/reader/OwApplicability.java
@@ -0,0 +1,53 @@
+/*******************************************************************************
+ * Copyright (c) 2015 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.orcs.rest.model.writer.reader;
+
+/**
+ * Data Transfer object for Orcs Writer
+ *
+ * @author Donald G. Dunne
+ */
+public class OwApplicability {
+
+ public Long appId;
+ public String value;
+ public String data;
+
+ public String getData() {
+ return data;
+ }
+
+ public void setData(String data) {
+ this.data = data;
+ }
+
+ @Override
+ public String toString() {
+ return "OwApplicability [appId=" + getAppId() + ", data=" + data + "]";
+ }
+
+ public Long getAppId() {
+ return appId;
+ }
+
+ public void setAppId(Long appId) {
+ this.appId = appId;
+ }
+
+ public String getValue() {
+ return value;
+ }
+
+ public void setValue(String value) {
+ this.value = value;
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.orcs.rest.model/src/org/eclipse/osee/orcs/rest/model/writer/reader/OwApplicabilityType.java b/plugins/org.eclipse.osee.orcs.rest.model/src/org/eclipse/osee/orcs/rest/model/writer/reader/OwApplicabilityType.java
new file mode 100644
index 00000000000..24bb1652987
--- /dev/null
+++ b/plugins/org.eclipse.osee.orcs.rest.model/src/org/eclipse/osee/orcs/rest/model/writer/reader/OwApplicabilityType.java
@@ -0,0 +1,35 @@
+/*******************************************************************************
+ * Copyright (c) 2015 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.orcs.rest.model.writer.reader;
+
+import org.eclipse.osee.framework.jdk.core.type.Id;
+
+/**
+ * @author Donald G. Dunne
+ */
+// Data Transfer object for Orcs Writer
+public class OwApplicabilityType extends OwBase {
+
+ public OwApplicabilityType() {
+ // for jax-rs instantiation
+ super(Id.SENTINEL, "");
+ }
+
+ public OwApplicabilityType(Long id, String name) {
+ super(id, name);
+ }
+
+ @Override
+ public String toString() {
+ return "OwApplicabilityType [id=" + getId() + ", data=" + data + "]";
+ }
+
+} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.orcs.rest.model/src/org/eclipse/osee/orcs/rest/model/writer/reader/OwArtifact.java b/plugins/org.eclipse.osee.orcs.rest.model/src/org/eclipse/osee/orcs/rest/model/writer/reader/OwArtifact.java
index d31dd73a0d5..1141dd35464 100644
--- a/plugins/org.eclipse.osee.orcs.rest.model/src/org/eclipse/osee/orcs/rest/model/writer/reader/OwArtifact.java
+++ b/plugins/org.eclipse.osee.orcs.rest.model/src/org/eclipse/osee/orcs/rest/model/writer/reader/OwArtifact.java
@@ -31,7 +31,7 @@ public class OwArtifact extends OwBase {
}
OwArtifactType type;
-
+ OwApplicability appId;
List<OwAttribute> attributes;
List<OwRelation> relations;
@@ -70,4 +70,12 @@ public class OwArtifact extends OwBase {
return "OwArtifact [type=" + type + ", id=" + getId() + ", data=" + data + "]";
}
+ public OwApplicability getAppId() {
+ return appId;
+ }
+
+ public void setAppId(OwApplicability appId) {
+ this.appId = appId;
+ }
+
}
diff --git a/plugins/org.eclipse.osee.orcs.rest.model/src/org/eclipse/osee/orcs/rest/model/writer/reader/OwCollector.java b/plugins/org.eclipse.osee.orcs.rest.model/src/org/eclipse/osee/orcs/rest/model/writer/reader/OwCollector.java
index 00e7d5a9224..4d68f1694c9 100644
--- a/plugins/org.eclipse.osee.orcs.rest.model/src/org/eclipse/osee/orcs/rest/model/writer/reader/OwCollector.java
+++ b/plugins/org.eclipse.osee.orcs.rest.model/src/org/eclipse/osee/orcs/rest/model/writer/reader/OwCollector.java
@@ -33,6 +33,7 @@ public class OwCollector {
private List<ArtifactToken> delete;
private List<OwArtifactType> artTypes;
private List<OwAttributeType> attrTypes;
+ private List<OwApplicability> apps;
private List<OwRelationType> relTypes;
private List<OwBranch> branches;
private List<OwArtifactToken> artTokens;
@@ -72,6 +73,17 @@ public class OwCollector {
return attrTypes;
}
+ public List<OwApplicability> getApps() {
+ if (apps == null) {
+ apps = new LinkedList<>();
+ }
+ return apps;
+ }
+
+ public void setApps(List<OwApplicability> apps) {
+ this.apps = apps;
+ }
+
public void setAttrTypes(List<OwAttributeType> attrTypes) {
this.attrTypes = attrTypes;
}
diff --git a/plugins/org.eclipse.osee.orcs.rest/src/org/eclipse/osee/orcs/rest/internal/writer/IOrcsValidationHelper.java b/plugins/org.eclipse.osee.orcs.rest/src/org/eclipse/osee/orcs/rest/internal/writer/IOrcsValidationHelper.java
index 8e3d36c7cd2..4de660dea46 100644
--- a/plugins/org.eclipse.osee.orcs.rest/src/org/eclipse/osee/orcs/rest/internal/writer/IOrcsValidationHelper.java
+++ b/plugins/org.eclipse.osee.orcs.rest/src/org/eclipse/osee/orcs/rest/internal/writer/IOrcsValidationHelper.java
@@ -31,4 +31,6 @@ public interface IOrcsValidationHelper {
boolean isAttributeTypeExists(String attributeTypeName);
+ boolean isApplicabilityExist(BranchId branch, String value);
+
}
diff --git a/plugins/org.eclipse.osee.orcs.rest/src/org/eclipse/osee/orcs/rest/internal/writer/OrcsCollectorValidator.java b/plugins/org.eclipse.osee.orcs.rest/src/org/eclipse/osee/orcs/rest/internal/writer/OrcsCollectorValidator.java
index 3d984a3dba7..01896882cf5 100644
--- a/plugins/org.eclipse.osee.orcs.rest/src/org/eclipse/osee/orcs/rest/internal/writer/OrcsCollectorValidator.java
+++ b/plugins/org.eclipse.osee.orcs.rest/src/org/eclipse/osee/orcs/rest/internal/writer/OrcsCollectorValidator.java
@@ -110,6 +110,11 @@ public class OrcsCollectorValidator {
if (!helper.isArtifactTypeExist(artType.getId())) {
results.errorf("Artifact Type [%s] does not exist.\n", artType);
}
+
+ if (artifact.getAppId() != null && !helper.isApplicabilityExist(collector.getBranchId(),
+ artifact.getAppId().getValue())) {
+ results.errorf("Applicability [%s] is invalid for chosen branch", artifact.getAppId().getValue());
+ }
}
}
diff --git a/plugins/org.eclipse.osee.orcs.rest/src/org/eclipse/osee/orcs/rest/internal/writer/OrcsCollectorWriter.java b/plugins/org.eclipse.osee.orcs.rest/src/org/eclipse/osee/orcs/rest/internal/writer/OrcsCollectorWriter.java
index 64179c739ac..2dfb1d2669f 100644
--- a/plugins/org.eclipse.osee.orcs.rest/src/org/eclipse/osee/orcs/rest/internal/writer/OrcsCollectorWriter.java
+++ b/plugins/org.eclipse.osee.orcs.rest/src/org/eclipse/osee/orcs/rest/internal/writer/OrcsCollectorWriter.java
@@ -11,17 +11,20 @@
package org.eclipse.osee.orcs.rest.internal.writer;
import java.util.Calendar;
+import java.util.Collection;
import java.util.Date;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
+import org.eclipse.osee.framework.core.data.ApplicabilityId;
+import org.eclipse.osee.framework.core.data.ApplicabilityToken;
import org.eclipse.osee.framework.core.data.ArtifactId;
import org.eclipse.osee.framework.core.data.ArtifactToken;
+import org.eclipse.osee.framework.core.data.ArtifactTypeToken;
import org.eclipse.osee.framework.core.data.AttributeTypeId;
import org.eclipse.osee.framework.core.data.AttributeTypeToken;
import org.eclipse.osee.framework.core.data.BranchId;
-import org.eclipse.osee.framework.core.data.ArtifactTypeToken;
import org.eclipse.osee.framework.core.data.RelationTypeSide;
import org.eclipse.osee.framework.core.data.RelationTypeToken;
import org.eclipse.osee.framework.core.data.UserId;
@@ -109,7 +112,32 @@ public class OrcsCollectorWriter {
} catch (Exception ex) {
throw new OseeWrappedException(ex, "Exception processing relations for [%s]", owArtifact);
}
+ if (owArtifact.getAppId() != null) {
+ try {
+ ApplicabilityId appId = ApplicabilityId.BASE;
+ HashMap<Long, ApplicabilityToken> tokenMap =
+ orcsApi.getQueryFactory().applicabilityQuery().getApplicabilityTokens(branch);
+ Collection<ApplicabilityToken> tokens = tokenMap.values();
+ for (ApplicabilityToken applicToken : tokens) {
+ if (applicToken.getName().equals(owArtifact.getAppId().getValue())) {
+ appId = ApplicabilityId.valueOf(applicToken.getId());
+ break;
+ }
+ }
+ if (appId.isInvalid()) {
+ results.warningf("Couldn't find applicability " + owArtifact.getAppId().getValue() + " on branch %s",
+ branch.getIdString());
+ } else {
+ ApplicabilityId currApp = artifact.getApplicability();
+ if (!currApp.equals(appId)) {
+ getTransaction().setApplicability(artifact, appId);
+ }
+ }
+ } catch (Exception ex) {
+ throw new OseeWrappedException(ex, "Exception processing applicability for [%s]", owArtifact);
+ }
+ }
try {
for (OwAttribute owAttribute : owArtifact.getAttributes()) {
AttributeTypeToken attrType =
@@ -175,6 +203,15 @@ public class OrcsCollectorWriter {
throw new OseeArgumentException("Exception processing Integer for OwAttribute %s Exception %s",
owAttribute, ex);
}
+ } else if (attrType.equals(CoreAttributeTypes.WordTemplateContent)) {
+ if (!newValue.contains("<w:p><w:r><w:t>")) {
+ newValue = "<w:p><w:r><w:t>" + newValue + "</w:t></w:r></w:p>";
+ }
+ if (currValue == null && newValue != null || currValue != null && !currValue.equals(newValue)) {
+ logChange(artifact, attrType, currValue, newValue);
+ getTransaction().setSoleAttributeValue(artifact, attrType, newValue);
+ }
+
} else if (currValue == null && newValue != null || currValue != null && !currValue.equals(
newValue)) {
logChange(artifact, attrType, currValue, newValue);
@@ -254,10 +291,34 @@ public class OrcsCollectorWriter {
long artifactId = owArtifact.getId();
String name = owArtifact.getName();
ArtifactId artifact;
+ ApplicabilityId appId = ApplicabilityId.BASE;
+ if (owArtifact.getAppId() != null) {
+ try {
+
+ HashMap<Long, ApplicabilityToken> tokenMap =
+ orcsApi.getQueryFactory().applicabilityQuery().getApplicabilityTokens(branch);
+ Collection<ApplicabilityToken> tokens = tokenMap.values();
+ for (ApplicabilityToken applicToken : tokens) {
+ if (applicToken.getName().equals(owArtifact.getAppId().getValue())) {
+ appId = ApplicabilityId.valueOf(applicToken.getId());
+ break;
+ }
+ }
+ if (appId == null) {
+ results.warningf("Couldn't find applicability " + owArtifact.getAppId().getValue() + " on branch %s",
+ branch.getIdString());
+ appId = ApplicabilityId.BASE;
+ }
+
+ } catch (Exception ex) {
+ throw new OseeWrappedException(ex, "Exception processing applicability for [%s]", owArtifact);
+ }
+ }
+
if (artifactId < 1) {
- artifact = getTransaction().createArtifact(artType, name);
+ artifact = getTransaction().createArtifact(artType, name, appId);
} else {
- artifact = getTransaction().createArtifact(artType, name, artifactId);
+ artifact = getTransaction().createArtifact(artType, name, artifactId, appId);
}
if (idToArtifact == null) {
@@ -276,6 +337,7 @@ public class OrcsCollectorWriter {
} catch (Exception ex) {
throw new OseeWrappedException(ex, "Exception creating relations for [%s]", owArtifact);
}
+
}
}
@@ -341,6 +403,12 @@ public class OrcsCollectorWriter {
} else {
throw new OseeArgumentException("Unexpected date format [%s]", value);
}
+ } else if (attrType.equals(CoreAttributeTypes.WordTemplateContent)) {
+ if (!valueOf.contains("<w:p><w:r><w:t>")) {
+ valueOf = "<w:p><w:r><w:t>" + valueOf + "</w:t></w:r></w:p>";
+ }
+ getTransaction().createAttribute(artifact, attrType, valueOf);
+
} else if (orcsApi.getOrcsTypes().getAttributeTypes().getMaxOccurrences(attrType) == 1) {
getTransaction().setSoleAttributeValue(artifact, attrType, value);
} else {
diff --git a/plugins/org.eclipse.osee.orcs.rest/src/org/eclipse/osee/orcs/rest/internal/writer/OrcsValidationHelperAdapter.java b/plugins/org.eclipse.osee.orcs.rest/src/org/eclipse/osee/orcs/rest/internal/writer/OrcsValidationHelperAdapter.java
index efd7d94d7f5..a97b59fe427 100644
--- a/plugins/org.eclipse.osee.orcs.rest/src/org/eclipse/osee/orcs/rest/internal/writer/OrcsValidationHelperAdapter.java
+++ b/plugins/org.eclipse.osee.orcs.rest/src/org/eclipse/osee/orcs/rest/internal/writer/OrcsValidationHelperAdapter.java
@@ -11,6 +11,9 @@
package org.eclipse.osee.orcs.rest.internal.writer;
import static org.eclipse.osee.framework.core.enums.CoreBranches.COMMON;
+import java.util.Collection;
+import java.util.HashMap;
+import org.eclipse.osee.framework.core.data.ApplicabilityToken;
import org.eclipse.osee.framework.core.data.AttributeTypeToken;
import org.eclipse.osee.framework.core.data.BranchId;
import org.eclipse.osee.framework.core.enums.CoreAttributeTypes;
@@ -54,6 +57,19 @@ public class OrcsValidationHelperAdapter implements IOrcsValidationHelper {
}
@Override
+ public boolean isApplicabilityExist(BranchId branch, String value) {
+
+ HashMap<Long, ApplicabilityToken> tokenMap = queryFactory.applicabilityQuery().getApplicabilityTokens(branch);
+ Collection<ApplicabilityToken> tokens = tokenMap.values();
+ for (ApplicabilityToken applicToken : tokens) {
+ if (applicToken.getName().equals(value)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ @Override
public boolean isRelationTypeExist(long relationTypeUuid) {
return orcsTypes.getRelationTypes().get(relationTypeUuid) != null;
}
diff --git a/plugins/org.eclipse.osee.orcs.rest/src/org/eclipse/osee/orcs/rest/internal/writer/OrcsWriterCollectorGenerator.java b/plugins/org.eclipse.osee.orcs.rest/src/org/eclipse/osee/orcs/rest/internal/writer/OrcsWriterCollectorGenerator.java
index 26f821d5105..e3a56289b85 100644
--- a/plugins/org.eclipse.osee.orcs.rest/src/org/eclipse/osee/orcs/rest/internal/writer/OrcsWriterCollectorGenerator.java
+++ b/plugins/org.eclipse.osee.orcs.rest/src/org/eclipse/osee/orcs/rest/internal/writer/OrcsWriterCollectorGenerator.java
@@ -17,8 +17,8 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.eclipse.osee.framework.core.data.ArtifactToken;
-import org.eclipse.osee.framework.core.data.AttributeTypeToken;
import org.eclipse.osee.framework.core.data.ArtifactTypeToken;
+import org.eclipse.osee.framework.core.data.AttributeTypeToken;
import org.eclipse.osee.framework.core.data.IOseeBranch;
import org.eclipse.osee.framework.core.data.RelationTypeToken;
import org.eclipse.osee.framework.core.enums.CoreArtifactTokens;
@@ -31,6 +31,7 @@ import org.eclipse.osee.orcs.OrcsApi;
import org.eclipse.osee.orcs.rest.model.writer.OrcsWriterToken;
import org.eclipse.osee.orcs.rest.model.writer.config.OrcsWriterInputConfig;
import org.eclipse.osee.orcs.rest.model.writer.config.OrcsWriterRelationSide;
+import org.eclipse.osee.orcs.rest.model.writer.reader.OwApplicability;
import org.eclipse.osee.orcs.rest.model.writer.reader.OwArtifact;
import org.eclipse.osee.orcs.rest.model.writer.reader.OwArtifactToken;
import org.eclipse.osee.orcs.rest.model.writer.reader.OwArtifactType;
@@ -99,12 +100,32 @@ public class OrcsWriterCollectorGenerator {
ArtifactToken folder = createFolder();
createSoftwareRequirement(folder, "1");
createSoftwareRequirement(folder, "2");
+ createMSWordRequirement(folder, "3");
+ }
+
+ private void createMSWordRequirement(ArtifactToken folderToken, String number) {
+ Long reqId = Lib.generateArtifactIdAsInt();
+ String name = "MSWordRequirement" + number;
+ OwArtifact wordReq = OwFactory.createArtifact(CoreArtifactTypes.CustomerRequirementMsWord, name, reqId);
+ OwApplicability owApp = OwFactory.createApplicability("Base");
+ wordReq.setAppId(owApp);
+ OwFactory.createAttribute(wordReq, CoreAttributeTypes.WordTemplateContent,
+ "WordTemplate Content field " + number);
+ collector.getCreate().add(wordReq);
+
+ // add to new folder
+ OwRelation relation = new OwRelation();
+ relation.setType(OwFactory.createRelationType(orcsApi, CoreRelationTypes.Default_Hierarchical__Parent));
+ relation.setArtToken(folderToken);
+ wordReq.getRelations().add(relation);
}
private void createSoftwareRequirement(ArtifactToken folderToken, String number) {
Long reqId = Lib.generateArtifactIdAsInt();
String name = "Software Requirement " + number;
OwArtifact softwareReq = OwFactory.createArtifact(CoreArtifactTypes.SoftwareRequirement, name, reqId);
+ OwApplicability owApp = OwFactory.createApplicability("Base");
+ softwareReq.setAppId(owApp);
OwFactory.createAttribute(softwareReq, CoreAttributeTypes.StaticId, "static id field " + number);
collector.getCreate().add(softwareReq);
diff --git a/plugins/org.eclipse.osee.orcs.rest/src/org/eclipse/osee/orcs/rest/internal/writer/OrcsWriterFactory.java b/plugins/org.eclipse.osee.orcs.rest/src/org/eclipse/osee/orcs/rest/internal/writer/OrcsWriterFactory.java
index 9099e10e462..1649058c167 100644
--- a/plugins/org.eclipse.osee.orcs.rest/src/org/eclipse/osee/orcs/rest/internal/writer/OrcsWriterFactory.java
+++ b/plugins/org.eclipse.osee.orcs.rest/src/org/eclipse/osee/orcs/rest/internal/writer/OrcsWriterFactory.java
@@ -15,6 +15,7 @@ import java.util.Map;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.eclipse.osee.framework.core.data.ArtifactToken;
+import org.eclipse.osee.orcs.rest.model.writer.reader.OwApplicability;
import org.eclipse.osee.orcs.rest.model.writer.reader.OwArtifact;
import org.eclipse.osee.orcs.rest.model.writer.reader.OwArtifactToken;
import org.eclipse.osee.orcs.rest.model.writer.reader.OwArtifactType;
@@ -91,6 +92,15 @@ public class OrcsWriterFactory {
return attr;
}
+ public OwApplicability getOrCreateApplicability(OwArtifact artifact) {
+ OwApplicability app = artifact.getAppId();
+ if (app == null) {
+ app = new OwApplicability();
+ artifact.setAppId(app);
+ }
+ return app;
+ }
+
public OwRelation createRelationType(OwRelationType relType, String value) {
ArtifactToken token = getOrCreateToken(value);
OwRelation relation = new OwRelation();
diff --git a/plugins/org.eclipse.osee.orcs.rest/src/org/eclipse/osee/orcs/rest/internal/writer/OrcsWriterSheetProcessorForCreateUpdate.java b/plugins/org.eclipse.osee.orcs.rest/src/org/eclipse/osee/orcs/rest/internal/writer/OrcsWriterSheetProcessorForCreateUpdate.java
index 33fcbf640fd..24db1c8d03c 100644
--- a/plugins/org.eclipse.osee.orcs.rest/src/org/eclipse/osee/orcs/rest/internal/writer/OrcsWriterSheetProcessorForCreateUpdate.java
+++ b/plugins/org.eclipse.osee.orcs.rest/src/org/eclipse/osee/orcs/rest/internal/writer/OrcsWriterSheetProcessorForCreateUpdate.java
@@ -19,6 +19,7 @@ import org.eclipse.osee.framework.jdk.core.type.OseeArgumentException;
import org.eclipse.osee.framework.jdk.core.type.OseeStateException;
import org.eclipse.osee.framework.jdk.core.util.Strings;
import org.eclipse.osee.framework.jdk.core.util.io.xml.RowProcessor;
+import org.eclipse.osee.orcs.rest.model.writer.reader.OwApplicability;
import org.eclipse.osee.orcs.rest.model.writer.reader.OwArtifact;
import org.eclipse.osee.orcs.rest.model.writer.reader.OwArtifactType;
import org.eclipse.osee.orcs.rest.model.writer.reader.OwAttribute;
@@ -35,7 +36,8 @@ public class OrcsWriterSheetProcessorForCreateUpdate implements RowProcessor {
private final OwCollector collector;
private final Map<Integer, OwAttributeType> columnToAttributeType = new HashMap<>();
private final Map<Integer, OwRelationType> columnToRelationType = new HashMap<>();
- private Integer artTokenColumn = null, nameColumn = null;
+
+ private Integer artTokenColumn = null, nameColumn = null, applicabilityColumn = null;
private int rowCount = 0;
private final OrcsWriterFactory factory;
private final boolean createSheet;
@@ -95,6 +97,8 @@ public class OrcsWriterSheetProcessorForCreateUpdate implements RowProcessor {
relType.setData(OrcsWriterUtil.getData(getSheetName(), rowCount, colCount));
columnToRelationType.put(colCount, relType);
collector.getRelTypes().add(relType);
+ } else if (value.toLowerCase().equals("applicability")) {
+ applicabilityColumn = colCount;
} else if (value.toLowerCase().startsWith("new art token")) {
if (artTokenColumn != null) {
throw new OseeArgumentException("Can't have multiple \"New Art Token\" columns on %s sheet",
@@ -201,6 +205,13 @@ public class OrcsWriterSheetProcessorForCreateUpdate implements RowProcessor {
OrcsWriterUtil.getRowColumnStr(colCount, colCount, getSheetName()));
}
}
+ if (applicabilityColumn != null && applicabilityColumn == colCount) {
+ String value = row[colCount];
+
+ OwApplicability app = factory.getOrCreateApplicability(artifact);
+ app.setValue(value);
+ artifact.setAppId(app);
+ }
if (isAttributeColumn(colCount)) {
OwAttributeType attrType = columnToAttributeType.get(colCount);
if (attrType.getName().equals(CoreAttributeTypes.Name.getName())) {
diff --git a/plugins/org.eclipse.osee.orcs.rest/src/org/eclipse/osee/orcs/rest/internal/writer/OwFactory.java b/plugins/org.eclipse.osee.orcs.rest/src/org/eclipse/osee/orcs/rest/internal/writer/OwFactory.java
index bf17410e955..79e7144899a 100644
--- a/plugins/org.eclipse.osee.orcs.rest/src/org/eclipse/osee/orcs/rest/internal/writer/OwFactory.java
+++ b/plugins/org.eclipse.osee.orcs.rest/src/org/eclipse/osee/orcs/rest/internal/writer/OwFactory.java
@@ -14,13 +14,14 @@ package org.eclipse.osee.orcs.rest.internal.writer;
* Donald G. Dunne
*/
import org.eclipse.osee.framework.core.data.ArtifactToken;
-import org.eclipse.osee.framework.core.data.AttributeTypeToken;
import org.eclipse.osee.framework.core.data.ArtifactTypeToken;
+import org.eclipse.osee.framework.core.data.AttributeTypeToken;
import org.eclipse.osee.framework.core.data.IOseeBranch;
import org.eclipse.osee.framework.core.data.RelationTypeSide;
import org.eclipse.osee.framework.core.data.RelationTypeToken;
import org.eclipse.osee.framework.jdk.core.util.Lib;
import org.eclipse.osee.orcs.OrcsApi;
+import org.eclipse.osee.orcs.rest.model.writer.reader.OwApplicability;
import org.eclipse.osee.orcs.rest.model.writer.reader.OwArtifact;
import org.eclipse.osee.orcs.rest.model.writer.reader.OwArtifactToken;
import org.eclipse.osee.orcs.rest.model.writer.reader.OwArtifactType;
@@ -38,6 +39,13 @@ public class OwFactory {
return type;
}
+ public static OwApplicability createApplicability(String value) {
+
+ OwApplicability app = new OwApplicability();
+ app.setValue(value);
+ return app;
+ }
+
public static OwAttributeType createAttributeType(AttributeTypeToken attrType) {
String typeStr = String.format("[%s]-[%d]", attrType.getName(), attrType.getId());
OwAttributeType type = new OwAttributeType(attrType.getId(), attrType.getName());
diff --git a/plugins/org.eclipse.osee.orcs/src/org/eclipse/osee/orcs/transaction/TransactionBuilder.java b/plugins/org.eclipse.osee.orcs/src/org/eclipse/osee/orcs/transaction/TransactionBuilder.java
index 4e3d4d31aeb..9dda873f612 100644
--- a/plugins/org.eclipse.osee.orcs/src/org/eclipse/osee/orcs/transaction/TransactionBuilder.java
+++ b/plugins/org.eclipse.osee.orcs/src/org/eclipse/osee/orcs/transaction/TransactionBuilder.java
@@ -70,8 +70,12 @@ public interface TransactionBuilder {
ArtifactToken createArtifact(ArtifactTypeToken artifactType, String name);
+ ArtifactToken createArtifact(ArtifactTypeToken artifactType, String name, ApplicabilityId appId);
+
ArtifactToken createArtifact(ArtifactTypeToken artifactType, String name, Long artifactId);
+ ArtifactToken createArtifact(ArtifactTypeToken artifactType, String name, Long artifactId, ApplicabilityId appId);
+
ArtifactToken createArtifact(ArtifactToken token);
ArtifactToken createArtifact(ArtifactTypeToken artifactType, String name, String guid);
@@ -204,5 +208,4 @@ public interface TransactionBuilder {
List<ArtifactToken> createArtifacts(ArtifactTypeId artifactType, ArtifactId parent, List<String> names);
void introduceTuple(TupleTypeId tupleType, GammaId tupleGamma);
-
} \ No newline at end of file

Back to the top