From 0469f27d143e3474cc5d1d0b3ccb9181c463762c Mon Sep 17 00:00:00 2001 From: Ryan D. Brooks Date: Sat, 11 May 2019 15:40:30 -0700 Subject: refactor: Use generics with AttributeTypeToken Change-Id: I215a6e9ea15aa7b8711f911db5414a0045bab04d --- .../osee/ats/api/workdef/IAttributeResolver.java | 18 +++--- .../core/column/CompletedCancelledByColumn.java | 6 +- .../operations/CommitOverrideOperationsImpl.java | 7 +-- .../osee/ats/core/review/UserRoleManager.java | 12 ++-- .../ats/resource/AtsActionEndpointImplTest.java | 6 +- .../ats/ide/column/AbstractNumericTotalColumn.java | 4 +- .../search/internal/query/AtsQueryServiceImpl.java | 14 ++--- .../internal/AtsAttributeResolverServiceImpl.java | 10 ++-- .../agile/operations/SprintConfigOperations.java | 4 +- .../internal/config/UpdateAtsConfiguration.java | 6 +- .../util/AtsAttributeResolverServiceImpl.java | 26 ++++----- .../workitem/operations/ActionOperations.java | 7 ++- .../internal/SafetyInformationAccumulator.java | 2 +- .../rest/internal/TraceInformationAccumulator.java | 2 +- .../define/rest/internal/TraceReportGenerator.java | 4 +- .../disposition/rest/internal/OrcsStorageImpl.java | 2 +- .../framework/core/data/AttributeTypeGeneric.java | 2 +- .../framework/core/data/AttributeTypeToken.java | 4 +- .../framework/core/enums/CoreAttributeTypes.java | 3 + .../server/ide/internal/ClientEndpointImpl.java | 3 +- .../account/admin/internal/AccountArtifact.java | 2 +- .../admin/internal/oauth/ClientArtifact.java | 3 +- .../internal/artifact/ArtifactFactoryTest.java | 10 ++-- .../orcs/core/internal/attribute/ArtifactTest.java | 24 ++++---- .../proxy/impl/ArtifactReadOnlyImplTest.java | 8 +-- .../transaction/TransactionBuilderImplTest.java | 2 +- .../internal/transaction/TxDataManagerTest.java | 2 +- .../org/eclipse/osee/orcs/core/ds/Attribute.java | 2 +- .../eclipse/osee/orcs/core/ds/AttributeData.java | 2 +- .../core/internal/artifact/ArtifactFactory.java | 21 ++++--- .../orcs/core/internal/artifact/ArtifactImpl.java | 2 +- .../internal/attribute/AttributeContainer.java | 12 ++-- .../core/internal/attribute/AttributeFactory.java | 2 +- .../core/internal/attribute/AttributeManager.java | 42 +++++++------- .../internal/attribute/AttributeManagerImpl.java | 64 +++++++++++----------- .../internal/proxy/impl/ArtifactReadOnlyImpl.java | 29 +++++----- .../transaction/TransactionBuilderImpl.java | 4 +- .../core/internal/transaction/TxDataManager.java | 4 +- .../orcs/core/internal/util/OrcsPredicates.java | 6 +- .../db/internal/loader/data/AttributeDataImpl.java | 2 +- .../orcs/rest/internal/AttributeEndpointImpl.java | 16 +++--- .../osee/orcs/rest/internal/HtmlWriter.java | 4 +- .../osee/orcs/rest/internal/TypesEndpointImpl.java | 2 +- .../rest/internal/writer/OrcsCollectorWriter.java | 15 +++-- .../eclipse/osee/orcs/data/ArtifactReadable.java | 28 +++++----- .../osee/orcs/data/ArtifactReadableImpl.java | 35 ++++++------ .../osee/orcs/transaction/TransactionBuilder.java | 4 +- 47 files changed, 246 insertions(+), 243 deletions(-) diff --git a/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/workdef/IAttributeResolver.java b/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/workdef/IAttributeResolver.java index 81d0d475729..12da3a5c886 100644 --- a/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/workdef/IAttributeResolver.java +++ b/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/workdef/IAttributeResolver.java @@ -44,17 +44,17 @@ public interface IAttributeResolver { return getAttributeValues(artifact, artifactReferencedAttributeType); } - T getSoleAttributeValue(IAtsObject atsObject, AttributeTypeToken attributeType, T defaultReturnValue); + T getSoleAttributeValue(IAtsObject atsObject, AttributeTypeToken attributeType, T defaultReturnValue); List getAttributesToStringList(IAtsObject atsObject, AttributeTypeToken attributeType); - boolean isAttributeTypeValid(IAtsWorkItem workItem, AttributeTypeToken attributeType); + boolean isAttributeTypeValid(IAtsWorkItem workItem, AttributeTypeToken attributeType); - String getSoleAttributeValueAsString(IAtsObject atsObject, AttributeTypeToken attributeType, String defaultReturnValue); + String getSoleAttributeValueAsString(IAtsObject atsObject, AttributeTypeToken attributeType, String defaultReturnValue); - int getAttributeCount(IAtsObject atsObject, AttributeTypeToken attributeType); + int getAttributeCount(IAtsObject atsObject, AttributeTypeToken attributeType); - int getAttributeCount(ArtifactId artifact, AttributeTypeToken attributeType); + int getAttributeCount(ArtifactId artifact, AttributeTypeToken attributeType); void addAttribute(IAtsWorkItem workItem, AttributeTypeId attributeType, Object value); @@ -62,9 +62,9 @@ public interface IAttributeResolver { Collection> getAttributes(IAtsWorkItem workItem); - Collection> getAttributes(IAtsObject atsObject, AttributeTypeToken attributeType); + Collection> getAttributes(IAtsObject atsObject, AttributeTypeToken attributeType); - Collection> getAttributes(ArtifactId artifact, AttributeTypeToken attributeType); + Collection> getAttributes(ArtifactId artifact, AttributeTypeToken attributeType); void deleteSoleAttribute(IAtsWorkItem workItem, AttributeTypeId attributeType); @@ -86,13 +86,13 @@ public interface IAttributeResolver { void setSoleAttributeValue(IAtsObject atsObject, AttributeTypeId attributeType, Object value); - T getSoleAttributeValue(ArtifactId artifact, AttributeTypeToken attributeType, T defaultValue); + T getSoleAttributeValue(ArtifactId artifact, AttributeTypeToken attributeType, T defaultValue); Collection getAttributeValues(ArtifactId artifact, AttributeTypeToken attributeType); Collection getAttributeValues(IAtsObject atsObject, AttributeTypeToken attributeType); - String getSoleAttributeValueAsString(ArtifactId artifact, AttributeTypeToken attributeType, String defaultReturnValue); + String getSoleAttributeValueAsString(ArtifactId artifact, AttributeTypeToken attributeType, String defaultReturnValue); int getAttributeCount(IAtsWorkItem workItem, AttributeTypeToken attributeType); diff --git a/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/column/CompletedCancelledByColumn.java b/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/column/CompletedCancelledByColumn.java index f07f089603c..876e3401faa 100644 --- a/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/column/CompletedCancelledByColumn.java +++ b/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/column/CompletedCancelledByColumn.java @@ -18,7 +18,7 @@ import org.eclipse.osee.ats.api.IAtsObject; import org.eclipse.osee.ats.api.IAtsWorkItem; import org.eclipse.osee.ats.api.data.AtsAttributeTypes; import org.eclipse.osee.ats.api.user.AtsUser; -import org.eclipse.osee.framework.core.data.AttributeTypeToken; +import org.eclipse.osee.framework.core.data.AttributeTypeString; import org.eclipse.osee.framework.jdk.core.util.Strings; /** @@ -45,7 +45,7 @@ public class CompletedCancelledByColumn extends AbstractServicesColumn { String userId = null; if (obj instanceof IAtsWorkItem) { IAtsWorkItem workItem = (IAtsWorkItem) obj; - AttributeTypeToken type = null; + AttributeTypeString type = null; if (workItem.isCompleted()) { type = AtsAttributeTypes.CompletedBy; } else if (workItem.isCancelled()) { @@ -60,4 +60,4 @@ public class CompletedCancelledByColumn extends AbstractServicesColumn { } return null; } -} +} \ No newline at end of file diff --git a/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/commit/operations/CommitOverrideOperationsImpl.java b/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/commit/operations/CommitOverrideOperationsImpl.java index 4c2005c631c..5254f96dd45 100644 --- a/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/commit/operations/CommitOverrideOperationsImpl.java +++ b/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/commit/operations/CommitOverrideOperationsImpl.java @@ -111,9 +111,9 @@ public class CommitOverrideOperationsImpl implements CommitOverrideOperations { try { IAtsChangeSet changes = atsApi.createChangeSet("Remove Commit Override"); - for (IAttribute attr : atsApi.getAttributeResolver().getAttributes(teamWf, + for (IAttribute attr : atsApi.getAttributeResolver().getAttributes(teamWf, AtsAttributeTypes.CommitOverride)) { - String jsonValue = (String) attr.getValue(); + String jsonValue = attr.getValue(); CommitOverride or = mapper.readValue(jsonValue, CommitOverride.class); if (or.getBranchId().equals(branch.getIdString())) { @@ -127,5 +127,4 @@ public class CommitOverrideOperationsImpl implements CommitOverrideOperations { } return Result.TrueResult; } - -} +} \ No newline at end of file diff --git a/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/review/UserRoleManager.java b/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/review/UserRoleManager.java index d81ce78bbb4..c2f1db6870a 100644 --- a/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/review/UserRoleManager.java +++ b/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/review/UserRoleManager.java @@ -139,8 +139,8 @@ public class UserRoleManager implements IAtsPeerReviewRoleManager { private List getStoredUserRoles() { // Add new ones: items in userRoles that are not in dbuserRoles List storedUserRoles = new ArrayList<>(); - for (IAttribute attr : atsApi.getAttributeResolver().getAttributes(peerRev, AtsAttributeTypes.Role)) { - UserRole storedRole = new UserRole((String) attr.getValue()); + for (IAttribute attr : atsApi.getAttributeResolver().getAttributes(peerRev, AtsAttributeTypes.Role)) { + UserRole storedRole = new UserRole(attr.getValue()); storedUserRoles.add(storedRole); } return storedUserRoles; @@ -152,8 +152,8 @@ public class UserRoleManager implements IAtsPeerReviewRoleManager { List storedUserRoles = getStoredUserRoles(); // Change existing ones - for (IAttribute attr : atsApi.getAttributeResolver().getAttributes(peerRev, AtsAttributeTypes.Role)) { - UserRole storedRole = new UserRole((String) attr.getValue()); + for (IAttribute attr : atsApi.getAttributeResolver().getAttributes(peerRev, AtsAttributeTypes.Role)) { + UserRole storedRole = new UserRole(attr.getValue()); for (UserRole pItem : getUserRoles()) { if (pItem.equals(storedRole)) { changes.setAttribute(peerRev, attr, AXml.addTagData(ROLE_ITEM_TAG, pItem.toXml())); @@ -165,9 +165,9 @@ public class UserRoleManager implements IAtsPeerReviewRoleManager { // Remove deleted ones; items in dbuserRoles that are not in userRoles for (UserRole delUserRole : org.eclipse.osee.framework.jdk.core.util.Collections.setComplement( updatedStoredUserRoles, userRoles)) { - for (IAttribute attr : atsApi.getAttributeResolver().getAttributes(peerRev, + for (IAttribute attr : atsApi.getAttributeResolver().getAttributes(peerRev, AtsAttributeTypes.Role)) { - UserRole storedRole = new UserRole((String) attr.getValue()); + UserRole storedRole = new UserRole(attr.getValue()); if (storedRole.equals(delUserRole)) { changes.deleteAttribute(peerRev, attr); } diff --git a/plugins/org.eclipse.osee.ats.ide.integration.tests/src/org/eclipse/osee/ats/ide/integration/tests/ats/resource/AtsActionEndpointImplTest.java b/plugins/org.eclipse.osee.ats.ide.integration.tests/src/org/eclipse/osee/ats/ide/integration/tests/ats/resource/AtsActionEndpointImplTest.java index 148dfa0804d..58aef98398b 100644 --- a/plugins/org.eclipse.osee.ats.ide.integration.tests/src/org/eclipse/osee/ats/ide/integration/tests/ats/resource/AtsActionEndpointImplTest.java +++ b/plugins/org.eclipse.osee.ats.ide.integration.tests/src/org/eclipse/osee/ats/ide/integration/tests/ats/resource/AtsActionEndpointImplTest.java @@ -415,7 +415,7 @@ public class AtsActionEndpointImplTest extends AbstractRestTest { teamWf.reloadAttributesAndRelations(); teamWf = testAttributeTypeMatchesRestAttributes(AtsAttributeTypes.PercentRework); Assert.assertEquals((Integer) 4, AtsApiService.get().getAttributeResolver().getSoleAttributeValue( - (IAtsObject) teamWf, AtsAttributeTypes.PercentRework, 1.0)); + (IAtsObject) teamWf, AtsAttributeTypes.PercentRework, 1)); } @Test @@ -442,7 +442,7 @@ public class AtsActionEndpointImplTest extends AbstractRestTest { teamWf.reloadAttributesAndRelations(); teamWf = testAttributeTypeMatchesRestAttributes(AtsAttributeTypes.NeedBy); - Date date2 = (Date) AtsApiService.get().getAttributeResolver().getSoleAttributeValue((IAtsObject) teamWf, + Date date2 = AtsApiService.get().getAttributeResolver().getSoleAttributeValue((IAtsObject) teamWf, AtsAttributeTypes.NeedBy, null); Long dateTime = date2.getTime(); Assert.assertEquals(446579845, dateTime.intValue()); @@ -654,7 +654,7 @@ public class AtsActionEndpointImplTest extends AbstractRestTest { AtsApiService.get().getAttributeResolver().getSoleAttributeValue(teamWf, AtsAttributeTypes.Priority, "")); Assert.assertEquals(ai, teamWf.getActionableItems().iterator().next()); Assert.assertEquals(needBy, - AtsApiService.get().getAttributeResolver().getSoleAttributeValue(teamWf, AtsAttributeTypes.NeedBy, "")); + AtsApiService.get().getAttributeResolver().getSoleAttributeValue(teamWf, AtsAttributeTypes.NeedBy, null)); Assert.assertEquals("Blue Team", AtsApiService.get().getAttributeResolver().getSoleAttributeValue(teamWf, AtsAttributeTypes.ColorTeam, "")); Assert.assertEquals("My IPT", diff --git a/plugins/org.eclipse.osee.ats.ide/src/org/eclipse/osee/ats/ide/column/AbstractNumericTotalColumn.java b/plugins/org.eclipse.osee.ats.ide/src/org/eclipse/osee/ats/ide/column/AbstractNumericTotalColumn.java index 7c3d6f61837..c04f33498d1 100644 --- a/plugins/org.eclipse.osee.ats.ide/src/org/eclipse/osee/ats/ide/column/AbstractNumericTotalColumn.java +++ b/plugins/org.eclipse.osee.ats.ide/src/org/eclipse/osee/ats/ide/column/AbstractNumericTotalColumn.java @@ -44,9 +44,9 @@ import org.eclipse.swt.widgets.TreeItem; public abstract class AbstractNumericTotalColumn extends XViewerAtsColumn implements IXViewerValueColumn, IAltLeftClickProvider { private final String calulationStr; - private final AttributeTypeToken pointsAttrType; + private final AttributeTypeToken pointsAttrType; - public AbstractNumericTotalColumn(String id, String name, String description, String calulationStr, AttributeTypeToken pointsAttrType) { + public AbstractNumericTotalColumn(String id, String name, String description, String calulationStr, AttributeTypeToken pointsAttrType) { super(id, name, 40, XViewerAlign.Center, false, SortDataType.Float, false, description); this.calulationStr = calulationStr; this.pointsAttrType = pointsAttrType; diff --git a/plugins/org.eclipse.osee.ats.ide/src/org/eclipse/osee/ats/ide/search/internal/query/AtsQueryServiceImpl.java b/plugins/org.eclipse.osee.ats.ide/src/org/eclipse/osee/ats/ide/search/internal/query/AtsQueryServiceImpl.java index ba4308f221a..c221f421a71 100644 --- a/plugins/org.eclipse.osee.ats.ide/src/org/eclipse/osee/ats/ide/search/internal/query/AtsQueryServiceImpl.java +++ b/plugins/org.eclipse.osee.ats.ide/src/org/eclipse/osee/ats/ide/search/internal/query/AtsQueryServiceImpl.java @@ -131,7 +131,7 @@ public class AtsQueryServiceImpl extends AbstractAtsQueryService { TransactionId transaction = TransactionId.SENTINEL; try { - IAttribute attr = getAttrById(userArt, data.getId()); + IAttribute attr = getAttrById(userArt, data.getId()); if (attr == null) { changes.addAttribute(userArt, CoreAttributeTypes.AtsActionSearch, jaxRsApi.toJson(data)); } else { @@ -147,10 +147,10 @@ public class AtsQueryServiceImpl extends AbstractAtsQueryService { return transaction; } - private IAttribute getAttrById(ArtifactId artifact, Long attrId) { - for (IAttribute attr : atsApi.getAttributeResolver().getAttributes(artifact, + private IAttribute getAttrById(ArtifactId artifact, Long attrId) { + for (IAttribute attr : atsApi.getAttributeResolver().getAttributes(artifact, CoreAttributeTypes.AtsActionSearch)) { - String jsonValue = (String) attr.getValue(); + String jsonValue = attr.getValue(); try { AtsSearchData data = fromJson(jsonValue); if (attrId.equals(data.getId())) { @@ -171,7 +171,7 @@ public class AtsQueryServiceImpl extends AbstractAtsQueryService { TransactionId transaction = TransactionId.SENTINEL; try { - IAttribute attr = getAttrById(userArt, data.getId()); + IAttribute attr = getAttrById(userArt, data.getId()); if (attr != null) { changes.deleteAttribute(userArt, attr); transaction = changes.execute(); @@ -187,9 +187,9 @@ public class AtsQueryServiceImpl extends AbstractAtsQueryService { public AtsSearchData getSearch(AtsUser atsUser, Long id) { try { ArtifactId userArt = atsApi.getStoreObject(atsUser); - IAttribute attr = getAttrById(userArt, id); + IAttribute attr = getAttrById(userArt, id); if (attr != null) { - AtsSearchData existing = fromJson((String) attr.getValue()); + AtsSearchData existing = fromJson(attr.getValue()); if (existing != null) { return existing; } diff --git a/plugins/org.eclipse.osee.ats.ide/src/org/eclipse/osee/ats/ide/workflow/internal/AtsAttributeResolverServiceImpl.java b/plugins/org.eclipse.osee.ats.ide/src/org/eclipse/osee/ats/ide/workflow/internal/AtsAttributeResolverServiceImpl.java index 1c37aacd8d0..06d6be3029e 100644 --- a/plugins/org.eclipse.osee.ats.ide/src/org/eclipse/osee/ats/ide/workflow/internal/AtsAttributeResolverServiceImpl.java +++ b/plugins/org.eclipse.osee.ats.ide/src/org/eclipse/osee/ats/ide/workflow/internal/AtsAttributeResolverServiceImpl.java @@ -38,7 +38,7 @@ import org.eclipse.osee.framework.skynet.core.artifact.Attribute; public class AtsAttributeResolverServiceImpl extends AbstractAtsAttributeResolverServiceImpl { @Override - public T getSoleAttributeValue(IAtsObject atsObject, AttributeTypeToken attributeType, T defaultReturnValue) { + public T getSoleAttributeValue(IAtsObject atsObject, AttributeTypeToken attributeType, T defaultReturnValue) { return getArtifact(atsObject).getSoleAttributeValue(attributeType, defaultReturnValue); } @@ -127,7 +127,7 @@ public class AtsAttributeResolverServiceImpl extends AbstractAtsAttributeResolve @SuppressWarnings({"unchecked"}) @Override - public Collection> getAttributes(IAtsObject atsObject, AttributeTypeToken attributeType) { + public Collection> getAttributes(IAtsObject atsObject, AttributeTypeToken attributeType) { List> attrs = new ArrayList<>(); for (Attribute attr : getArtifact(atsObject).getAttributes(attributeType)) { attrs.add((IAttribute) attr); @@ -214,7 +214,7 @@ public class AtsAttributeResolverServiceImpl extends AbstractAtsAttributeResolve } @Override - public T getSoleAttributeValue(ArtifactId artifact, AttributeTypeToken attributeType, T defaultValue) { + public T getSoleAttributeValue(ArtifactId artifact, AttributeTypeToken attributeType, T defaultValue) { if (getArtifact(artifact) != null) { return getArtifact(artifact).getSoleAttributeValue(attributeType, defaultValue); } @@ -237,11 +237,11 @@ public class AtsAttributeResolverServiceImpl extends AbstractAtsAttributeResolve @SuppressWarnings({"unchecked"}) @Override - public Collection> getAttributes(ArtifactId artifact, AttributeTypeToken attributeType) { + public Collection> getAttributes(ArtifactId artifact, AttributeTypeToken attributeType) { Assert.isNotNull(artifact, "Artifact can not be null"); Assert.isNotNull(attributeType, "Attribute Type can not be null"); List> attributes = new LinkedList<>(); - for (Attribute attr : getArtifact(artifact).getAttributes(attributeType)) { + for (Attribute attr : getArtifact(artifact).getAttributes(attributeType)) { attributes.add((IAttribute) attr); } return attributes; diff --git a/plugins/org.eclipse.osee.ats.rest/src/org/eclipse/osee/ats/rest/internal/agile/operations/SprintConfigOperations.java b/plugins/org.eclipse.osee.ats.rest/src/org/eclipse/osee/ats/rest/internal/agile/operations/SprintConfigOperations.java index 4a73ea46d09..59b54b49b07 100644 --- a/plugins/org.eclipse.osee.ats.rest/src/org/eclipse/osee/ats/rest/internal/agile/operations/SprintConfigOperations.java +++ b/plugins/org.eclipse.osee.ats.rest/src/org/eclipse/osee/ats/rest/internal/agile/operations/SprintConfigOperations.java @@ -94,7 +94,7 @@ public class SprintConfigOperations { return sprintConfig; } - private void updatePointsIfNecessary(String newPointsStr, SprintConfigurations sprintConfig, IAgileSprint sprint, AttributeTypeToken attrType, IAtsChangeSet changes) { + private void updatePointsIfNecessary(String newPointsStr, SprintConfigurations sprintConfig, IAgileSprint sprint, AttributeTypeToken attrType, IAtsChangeSet changes) { if (Strings.isValid(newPointsStr)) { try { if (Strings.isInValid(newPointsStr)) { @@ -117,7 +117,7 @@ public class SprintConfigOperations { } } - private void updateDateIfNecessary(String newDateStr, SprintConfigurations sprintConfig, IAgileSprint sprint, AttributeTypeToken attrType, IAtsChangeSet changes) { + private void updateDateIfNecessary(String newDateStr, SprintConfigurations sprintConfig, IAgileSprint sprint, AttributeTypeToken attrType, IAtsChangeSet changes) { if (Strings.isValid(newDateStr)) { try { if (Strings.isInValid(newDateStr)) { diff --git a/plugins/org.eclipse.osee.ats.rest/src/org/eclipse/osee/ats/rest/internal/config/UpdateAtsConfiguration.java b/plugins/org.eclipse.osee.ats.rest/src/org/eclipse/osee/ats/rest/internal/config/UpdateAtsConfiguration.java index 2662688eafb..6ce4ee8be04 100644 --- a/plugins/org.eclipse.osee.ats.rest/src/org/eclipse/osee/ats/rest/internal/config/UpdateAtsConfiguration.java +++ b/plugins/org.eclipse.osee.ats.rest/src/org/eclipse/osee/ats/rest/internal/config/UpdateAtsConfiguration.java @@ -112,13 +112,13 @@ public class UpdateAtsConfiguration { TransactionBuilder tx = orcsApi.getTransactionFactory().createTransaction(CoreBranches.COMMON, userId, "Create Update Config Attributes"); - Iterator> iterator = + Iterator> iterator = configArt.getAttributes(CoreAttributeTypes.GeneralStringData, DeletionFlag.EXCLUDE_DELETED).iterator(); boolean found = false; while (iterator.hasNext()) { - AttributeReadable attributeReadable = iterator.next(); + AttributeReadable attributeReadable = iterator.next(); - if (attributeReadable != null && ((String) attributeReadable.getValue()).startsWith(VIEWS_EQUAL_KEY)) { + if (attributeReadable != null && attributeReadable.getValue().startsWith(VIEWS_EQUAL_KEY)) { tx.setAttributeById(configArt, attributeReadable, getViewsAttrValue(databaseViews)); rd.log("Create or update AtsConfig.VIEWS attribute\n"); found = true; diff --git a/plugins/org.eclipse.osee.ats.rest/src/org/eclipse/osee/ats/rest/internal/util/AtsAttributeResolverServiceImpl.java b/plugins/org.eclipse.osee.ats.rest/src/org/eclipse/osee/ats/rest/internal/util/AtsAttributeResolverServiceImpl.java index e3334543d2d..b964511f0a9 100644 --- a/plugins/org.eclipse.osee.ats.rest/src/org/eclipse/osee/ats/rest/internal/util/AtsAttributeResolverServiceImpl.java +++ b/plugins/org.eclipse.osee.ats.rest/src/org/eclipse/osee/ats/rest/internal/util/AtsAttributeResolverServiceImpl.java @@ -63,7 +63,7 @@ public class AtsAttributeResolverServiceImpl extends AbstractAtsAttributeResolve } @Override - public T getSoleAttributeValue(IAtsObject atsObject, AttributeTypeToken attributeType, T defaultReturnValue) { + public T getSoleAttributeValue(IAtsObject atsObject, AttributeTypeToken attributeType, T defaultReturnValue) { return getArtifact(atsObject).getSoleAttributeValue(attributeType, defaultReturnValue); } @@ -79,13 +79,13 @@ public class AtsAttributeResolverServiceImpl extends AbstractAtsAttributeResolve } @Override - public String getSoleAttributeValueAsString(IAtsObject atsObject, AttributeTypeToken attributeType, String defaultValue) { - return getArtifact(atsObject).getAttributeValuesAsString(attributeType); + public String getSoleAttributeValueAsString(IAtsObject atsObject, AttributeTypeToken attributeType, String defaultValue) { + return getArtifact(atsObject).getSoleAttributeAsString(attributeType, defaultValue); } @Override - public String getSoleAttributeValueAsString(ArtifactId artifact, AttributeTypeToken attributeType, String defaultValue) { - return getArtifact(artifact).getSoleAttributeValue(attributeType, defaultValue); + public String getSoleAttributeValueAsString(ArtifactId artifact, AttributeTypeToken attributeType, String defaultValue) { + return getArtifact(artifact).getSoleAttributeAsString(attributeType, defaultValue); } @Override @@ -116,12 +116,11 @@ public class AtsAttributeResolverServiceImpl extends AbstractAtsAttributeResolve throw new OseeStateException("Not Implemented"); } - @SuppressWarnings("unchecked") @Override - public Collection> getAttributes(IAtsObject atsObject, AttributeTypeToken attributeType) { + public Collection> getAttributes(IAtsObject atsObject, AttributeTypeToken attributeType) { Collection> attrs = new ArrayList<>(); - for (AttributeReadable attr : getArtifact(atsObject).getAttributes(attributeType)) { - attrs.add((IAttribute) attr); + for (AttributeReadable attr : getArtifact(atsObject).getAttributes(attributeType)) { + attrs.add(attr); } return attrs; } @@ -177,7 +176,7 @@ public class AtsAttributeResolverServiceImpl extends AbstractAtsAttributeResolve } @Override - public T getSoleAttributeValue(ArtifactId artifact, AttributeTypeToken attributeType, T defaultValue) { + public T getSoleAttributeValue(ArtifactId artifact, AttributeTypeToken attributeType, T defaultValue) { return getArtifact(artifact).getSoleAttributeValue(attributeType, defaultValue); } @@ -191,15 +190,12 @@ public class AtsAttributeResolverServiceImpl extends AbstractAtsAttributeResolve return getAttributeValues(atsObject.getStoreObject(), attributeType); } - @SuppressWarnings("unchecked") @Override - public Collection> getAttributes(ArtifactId artifact, AttributeTypeToken attributeType) { + public Collection> getAttributes(ArtifactId artifact, AttributeTypeToken attributeType) { Assert.isNotNull(artifact, "Artifact can not be null"); Assert.isNotNull(attributeType, "Attribute Type can not be null"); List> attributes = new LinkedList<>(); - for (AttributeReadable attr : ((ArtifactReadable) artifact).getAttributes(attributeType)) { - attributes.add((IAttribute) attr); - } + ((ArtifactReadable) artifact).getAttributes(attributeType).forEach(attributes::add); return attributes; } diff --git a/plugins/org.eclipse.osee.ats.rest/src/org/eclipse/osee/ats/rest/internal/workitem/operations/ActionOperations.java b/plugins/org.eclipse.osee.ats.rest/src/org/eclipse/osee/ats/rest/internal/workitem/operations/ActionOperations.java index f3a8bc64a12..e03abd2048f 100644 --- a/plugins/org.eclipse.osee.ats.rest/src/org/eclipse/osee/ats/rest/internal/workitem/operations/ActionOperations.java +++ b/plugins/org.eclipse.osee.ats.rest/src/org/eclipse/osee/ats/rest/internal/workitem/operations/ActionOperations.java @@ -65,7 +65,7 @@ public class ActionOperations { public Attribute setActionAttributeByType(String id, String attrTypeIdOrKey, List values) { Conditions.assertNotNull(values, "values can not be null"); IAtsChangeSet changes = atsApi.createChangeSet("set attr by type or key " + attrTypeIdOrKey); - AttributeTypeGeneric attrTypeId = null; + AttributeTypeToken attrTypeId = null; if (attrTypeIdOrKey.equals(AttributeKey.Title.name())) { changes.setSoleAttributeValue(workItem, CoreAttributeTypes.Name, values.iterator().next()); attrTypeId = CoreAttributeTypes.Name; @@ -194,11 +194,12 @@ public class ActionOperations { return null; } - private AttributeTypeGeneric getAttributeType(String id) { + private AttributeTypeToken getAttributeType(String id) { return orcsApi.tokenService().getAttributeType(Long.valueOf(id)); } - public Attribute getActionAttributeValues(AttributeTypeToken attributeType, IAtsWorkItem workItem) { + public Attribute getActionAttributeValues(AttributeTypeToken attributeType, IAtsWorkItem workItem) { + private Attribute getActionAttributeValues(AttributeTypeToken attrType, IAtsWorkItem workItem) { Attribute attribute = new Attribute(); attribute.setArtId(workItem.getStoreObject()); attribute.setAttributeType(attributeType); diff --git a/plugins/org.eclipse.osee.define.rest/src/org/eclipse/osee/define/rest/internal/SafetyInformationAccumulator.java b/plugins/org.eclipse.osee.define.rest/src/org/eclipse/osee/define/rest/internal/SafetyInformationAccumulator.java index f9a0d405037..116e3e13149 100644 --- a/plugins/org.eclipse.osee.define.rest/src/org/eclipse/osee/define/rest/internal/SafetyInformationAccumulator.java +++ b/plugins/org.eclipse.osee.define.rest/src/org/eclipse/osee/define/rest/internal/SafetyInformationAccumulator.java @@ -180,7 +180,7 @@ public final class SafetyInformationAccumulator { writer.writeRow((Object[]) currentRowValues); } - private String writeCriticality(ArtifactReadable art, AttributeTypeToken thisType, String[] currentRowValues, int col) { + private String writeCriticality(ArtifactReadable art, AttributeTypeToken thisType, String[] currentRowValues, int col) { String current = art.getSoleAttributeAsString(thisType, "Error"); if ("Error".equals(current)) { writeCell("Error: invalid content", currentRowValues, col); diff --git a/plugins/org.eclipse.osee.define.rest/src/org/eclipse/osee/define/rest/internal/TraceInformationAccumulator.java b/plugins/org.eclipse.osee.define.rest/src/org/eclipse/osee/define/rest/internal/TraceInformationAccumulator.java index ba59f06a583..bd1b2d078f9 100644 --- a/plugins/org.eclipse.osee.define.rest/src/org/eclipse/osee/define/rest/internal/TraceInformationAccumulator.java +++ b/plugins/org.eclipse.osee.define.rest/src/org/eclipse/osee/define/rest/internal/TraceInformationAccumulator.java @@ -134,7 +134,7 @@ public class TraceInformationAccumulator { public String handleEquivalentName(ArtifactReadable softwareRequirement) { String toReturn = softwareRequirement.getName(); if (softwareRequirement.isOfType(traceReport.getAlternateArtifactType())) { - AttributeTypeToken attrType = traceReport.getAlternateAttributeType(); + AttributeTypeToken attrType = traceReport.getAlternateAttributeType(); if (attrType != null) { toReturn = softwareRequirement.getSoleAttributeAsString(attrType, toReturn); } diff --git a/plugins/org.eclipse.osee.define.rest/src/org/eclipse/osee/define/rest/internal/TraceReportGenerator.java b/plugins/org.eclipse.osee.define.rest/src/org/eclipse/osee/define/rest/internal/TraceReportGenerator.java index f4d3e807bc9..d3be912afac 100644 --- a/plugins/org.eclipse.osee.define.rest/src/org/eclipse/osee/define/rest/internal/TraceReportGenerator.java +++ b/plugins/org.eclipse.osee.define.rest/src/org/eclipse/osee/define/rest/internal/TraceReportGenerator.java @@ -42,7 +42,7 @@ public class TraceReportGenerator { private final TraceMatch traceMatch; private final TraceAccumulator testTraces; private final ArtifactTypeToken alternateArtifactType; - private final AttributeTypeToken alternateAttributeType; + private final AttributeTypeToken alternateAttributeType; public static int SOFTWARE_SHEETREQ_INDEX = 3; public static int SOFTWARE_REQUIREMENT_INDEX = 4; @@ -207,7 +207,7 @@ public class TraceReportGenerator { return alternateArtifactType; } - public AttributeTypeToken getAlternateAttributeType() { + public AttributeTypeToken getAlternateAttributeType() { return alternateAttributeType; } } diff --git a/plugins/org.eclipse.osee.disposition.rest/src/org/eclipse/osee/disposition/rest/internal/OrcsStorageImpl.java b/plugins/org.eclipse.osee.disposition.rest/src/org/eclipse/osee/disposition/rest/internal/OrcsStorageImpl.java index ccf9b2d5688..abcaf4ebcaa 100644 --- a/plugins/org.eclipse.osee.disposition.rest/src/org/eclipse/osee/disposition/rest/internal/OrcsStorageImpl.java +++ b/plugins/org.eclipse.osee.disposition.rest/src/org/eclipse/osee/disposition/rest/internal/OrcsStorageImpl.java @@ -583,7 +583,7 @@ public class OrcsStorageImpl implements Storage { ArtifactReadable newRerpotArt = getQuery().fromBranch(branch).fromTransaction(commit).andId(reportArt).getResults().getExactlyOne(); - AttributeReadable contentsAsAttribute = + AttributeReadable contentsAsAttribute = newRerpotArt.getAttributes(CoreAttributeTypes.GeneralStringData).getExactlyOne(); toReturn = String.format("/orcs/branch/%s/artifact/%s/attribute/%s/version/%s", branch, newRerpotArt.getGuid(), diff --git a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/AttributeTypeGeneric.java b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/AttributeTypeGeneric.java index 4366a4213f5..a635c8a1fa4 100644 --- a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/AttributeTypeGeneric.java +++ b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/AttributeTypeGeneric.java @@ -20,7 +20,7 @@ import org.eclipse.osee.framework.jdk.core.type.NamedIdDescription; /** * @author Ryan D. Brooks */ -public abstract class AttributeTypeGeneric extends NamedIdDescription implements AttributeTypeToken { +public abstract class AttributeTypeGeneric extends NamedIdDescription implements AttributeTypeToken { public static final AttributeTypeString SENTINEL = AttributeTypeToken.createString(Id.SENTINEL, NamespaceToken.OSEE, Named.SENTINEL, Named.SENTINEL, "", ""); diff --git a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/AttributeTypeToken.java b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/AttributeTypeToken.java index b6ea73fd6bd..ef857134c19 100644 --- a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/AttributeTypeToken.java +++ b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/AttributeTypeToken.java @@ -26,8 +26,8 @@ import org.eclipse.osee.framework.jdk.core.type.NamedId; /** * @author Ryan D. Brooks */ - -public interface AttributeTypeToken extends AttributeTypeId, FullyNamed, HasDescription, NamedId { +public interface AttributeTypeToken extends AttributeTypeId, FullyNamed, HasDescription, NamedId { + static final AttributeTypeToken SENTINEL = valueOf(Id.SENTINEL, Named.SENTINEL); static final AttributeTypeGeneric SENTINEL = valueOf(Id.SENTINEL, Named.SENTINEL); static final String APPLICATION_ZIP = "application/zip"; static final String TEXT_CALENDAR = "text/calendar"; diff --git a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/enums/CoreAttributeTypes.java b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/enums/CoreAttributeTypes.java index 02eb6b58783..334659ce639 100644 --- a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/enums/CoreAttributeTypes.java +++ b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/enums/CoreAttributeTypes.java @@ -22,6 +22,9 @@ import org.eclipse.osee.framework.core.data.AttributeTypeInputStream; import org.eclipse.osee.framework.core.data.AttributeTypeInteger; import org.eclipse.osee.framework.core.data.AttributeTypeJoin; import org.eclipse.osee.framework.core.data.AttributeTypeString; +import java.io.InputStream; +import java.util.Date; +import org.eclipse.osee.framework.core.data.ArtifactId; import org.eclipse.osee.framework.core.data.AttributeTypeToken; import org.eclipse.osee.framework.core.data.DynamicEnumAttributeType; import org.eclipse.osee.framework.core.enums.token.ComponentAttributeType; diff --git a/plugins/org.eclipse.osee.framework.server.ide/src/org/eclipse/osee/framework/server/ide/internal/ClientEndpointImpl.java b/plugins/org.eclipse.osee.framework.server.ide/src/org/eclipse/osee/framework/server/ide/internal/ClientEndpointImpl.java index b32915d4e79..759b697acda 100644 --- a/plugins/org.eclipse.osee.framework.server.ide/src/org/eclipse/osee/framework/server/ide/internal/ClientEndpointImpl.java +++ b/plugins/org.eclipse.osee.framework.server.ide/src/org/eclipse/osee/framework/server/ide/internal/ClientEndpointImpl.java @@ -171,7 +171,8 @@ public class ClientEndpointImpl implements ClientEndpoint { for (ArtifactReadable userArt : orcsApi.getQueryFactory().fromBranch(CoreBranches.COMMON).andTypeEquals( CoreArtifactTypes.User).and(CoreAttributeTypes.Name, userIdOrName, QueryOption.CONTAINS_MATCH_OPTIONS).getResults()) { - results.add(userArt.getSoleAttributeValue(CoreAttributeTypes.UserId, null)); + String defaultValue = null; + results.add(userArt.getSoleAttributeValue(CoreAttributeTypes.UserId, defaultValue)); } } return results; diff --git a/plugins/org.eclipse.osee.orcs.account.admin/src/org/eclipse/osee/orcs/account/admin/internal/AccountArtifact.java b/plugins/org.eclipse.osee.orcs.account.admin/src/org/eclipse/osee/orcs/account/admin/internal/AccountArtifact.java index f1096e1cd9e..79546d839ac 100644 --- a/plugins/org.eclipse.osee.orcs.account.admin/src/org/eclipse/osee/orcs/account/admin/internal/AccountArtifact.java +++ b/plugins/org.eclipse.osee.orcs.account.admin/src/org/eclipse/osee/orcs/account/admin/internal/AccountArtifact.java @@ -41,7 +41,7 @@ public class AccountArtifact extends BaseId implements Account, ArtifactId { @Override public boolean isActive() { - return artifact.getSoleAttributeValue(CoreAttributeTypes.Active, false); + return artifact.getSoleAttributeValue(CoreAttributeTypes.Active, Boolean.FALSE); } @Override diff --git a/plugins/org.eclipse.osee.orcs.account.admin/src/org/eclipse/osee/orcs/account/admin/internal/oauth/ClientArtifact.java b/plugins/org.eclipse.osee.orcs.account.admin/src/org/eclipse/osee/orcs/account/admin/internal/oauth/ClientArtifact.java index 9e3801b0a65..21a644bc6a4 100644 --- a/plugins/org.eclipse.osee.orcs.account.admin/src/org/eclipse/osee/orcs/account/admin/internal/oauth/ClientArtifact.java +++ b/plugins/org.eclipse.osee.orcs.account.admin/src/org/eclipse/osee/orcs/account/admin/internal/oauth/ClientArtifact.java @@ -139,5 +139,4 @@ public class ClientArtifact extends BaseIdentity implements OAuthClient public InputStream getInput() { return artifact.getSoleAttributeValue(CoreAttributeTypes.ImageContent); } - -} +} \ No newline at end of file diff --git a/plugins/org.eclipse.osee.orcs.core.test/src/org/eclipse/osee/orcs/core/internal/artifact/ArtifactFactoryTest.java b/plugins/org.eclipse.osee.orcs.core.test/src/org/eclipse/osee/orcs/core/internal/artifact/ArtifactFactoryTest.java index 753187fe299..a74e2610601 100644 --- a/plugins/org.eclipse.osee.orcs.core.test/src/org/eclipse/osee/orcs/core/internal/artifact/ArtifactFactoryTest.java +++ b/plugins/org.eclipse.osee.orcs.core.test/src/org/eclipse/osee/orcs/core/internal/artifact/ArtifactFactoryTest.java @@ -78,7 +78,7 @@ public class ArtifactFactoryTest { private String guid; private ArtifactFactory artifactFactory; - private List types; + private List> types; @Before public void init() { @@ -209,15 +209,15 @@ public class ArtifactFactoryTest { } }; - private static final class ReturnExistingTypes implements Answer> { - private final List types; + private static final class ReturnExistingTypes implements Answer>> { + private final List> types; - public ReturnExistingTypes(List types) { + public ReturnExistingTypes(List> types) { this.types = types; } @Override - public List answer(InvocationOnMock invocation) throws Throwable { + public List> answer(InvocationOnMock invocation) throws Throwable { return types; } }; diff --git a/plugins/org.eclipse.osee.orcs.core.test/src/org/eclipse/osee/orcs/core/internal/attribute/ArtifactTest.java b/plugins/org.eclipse.osee.orcs.core.test/src/org/eclipse/osee/orcs/core/internal/attribute/ArtifactTest.java index 3a4d3256b43..d7d63ef070f 100644 --- a/plugins/org.eclipse.osee.orcs.core.test/src/org/eclipse/osee/orcs/core/internal/attribute/ArtifactTest.java +++ b/plugins/org.eclipse.osee.orcs.core.test/src/org/eclipse/osee/orcs/core/internal/attribute/ArtifactTest.java @@ -73,10 +73,10 @@ public class ArtifactTest { @SuppressWarnings("rawtypes") @Mock private Attribute attribute; + @Mock private Attribute integerAttribute; + @Mock private Attribute notDeleted; @SuppressWarnings("rawtypes") - @Mock private Attribute notDeleted; - @SuppressWarnings("rawtypes") - @Mock private Attribute deleted; + @Mock private Attribute deleted; @SuppressWarnings("rawtypes") @Mock private Attribute differentType; @@ -118,7 +118,7 @@ public class ArtifactTest { @Test @SuppressWarnings("unchecked") public void testAddAndGet() { - Attribute attribute = mock(Attribute.class); + Attribute attribute = mock(Attribute.class); when(attribute.getOrcsData()).thenReturn(attributeData); Assert.assertEquals(0, artifact.getAttributes().size()); artifact.add(CoreAttributeTypes.GeneralStringData, attribute); @@ -142,7 +142,7 @@ public class ArtifactTest { @Test @SuppressWarnings("unchecked") public void testAreAttributesDirty() { - Attribute attribute = mock(Attribute.class); + Attribute attribute = mock(Attribute.class); when(attribute.getOrcsData()).thenReturn(attributeData); artifact.add(CoreAttributeTypes.GeneralStringData, attribute); Assert.assertFalse(artifact.areAttributesDirty()); @@ -311,9 +311,9 @@ public class ArtifactTest { Assert.assertTrue(attributes.contains(differentType)); Assert.assertFalse(attributes.contains(deleted)); - attributes = artifact.getAttributes(CoreAttributeTypes.AccessContextId); - Assert.assertEquals(1, attributes.size()); - Assert.assertTrue(attributes.contains(notDeleted)); + List> attributes2 = artifact.getAttributes(CoreAttributeTypes.AccessContextId); + Assert.assertEquals(1, attributes2.size()); + Assert.assertTrue(attributes2.contains(notDeleted)); } @Test @@ -322,16 +322,16 @@ public class ArtifactTest { artifact.add(CoreAttributeTypes.AccessContextId, deleted); when(notDeleted.getValue()).thenReturn("notDeleted"); when(deleted.getValue()).thenReturn("deleted"); - List values = artifact.getAttributeValues(CoreAttributeTypes.AccessContextId); + List values = artifact.getAttributeValues(CoreAttributeTypes.AccessContextId); Assert.assertEquals(1, values.size()); Assert.assertTrue(values.contains("notDeleted")); } @Test public void testGetSoleAttributeAsString() { - when(notDeleted.getValue()).thenReturn(new Integer(5)); - artifact.add(CoreAttributeTypes.AccessContextId, notDeleted); - String attribute = artifact.getSoleAttributeAsString(CoreAttributeTypes.AccessContextId); + when(integerAttribute.getValue()).thenReturn(new Integer(5)); + artifact.add(CoreAttributeTypes.ReviewId, integerAttribute); + String attribute = artifact.getSoleAttributeAsString(CoreAttributeTypes.ReviewId); Assert.assertEquals("5", attribute); attribute = artifact.getSoleAttributeAsString(CoreAttributeTypes.Category, "default"); diff --git a/plugins/org.eclipse.osee.orcs.core.test/src/org/eclipse/osee/orcs/core/internal/proxy/impl/ArtifactReadOnlyImplTest.java b/plugins/org.eclipse.osee.orcs.core.test/src/org/eclipse/osee/orcs/core/internal/proxy/impl/ArtifactReadOnlyImplTest.java index a683644f93f..6acda174ba5 100644 --- a/plugins/org.eclipse.osee.orcs.core.test/src/org/eclipse/osee/orcs/core/internal/proxy/impl/ArtifactReadOnlyImplTest.java +++ b/plugins/org.eclipse.osee.orcs.core.test/src/org/eclipse/osee/orcs/core/internal/proxy/impl/ArtifactReadOnlyImplTest.java @@ -160,7 +160,7 @@ public class ArtifactReadOnlyImplTest { List types = Arrays.asList(Active, Name); when(proxiedObject.getExistingAttributeTypes()).thenAnswer(answer(types)); - Collection actual = readOnly.getExistingAttributeTypes(); + Collection actual = readOnly.getExistingAttributeTypes(); assertEquals(types, actual); verify(proxiedObject).getExistingAttributeTypes(); @@ -171,7 +171,7 @@ public class ArtifactReadOnlyImplTest { List types = Arrays.asList(Active, Name, Annotation); when(proxiedObject.getValidAttributeTypes()).thenAnswer(answer(types)); - Collection actual = readOnly.getValidAttributeTypes(); + Collection> actual = readOnly.getValidAttributeTypes(); assertEquals(types, actual); verify(proxiedObject).getValidAttributeTypes(); @@ -395,7 +395,7 @@ public class ArtifactReadOnlyImplTest { when(proxiedObject.getAttributes(Name)).thenAnswer(answer(attributes1)); when(proxyManager.asExternalAttributes(session, attributes1)).thenAnswer(answer(expected)); - ResultSet> actual = readOnly.getAttributes(Name); + ResultSet> actual = readOnly.getAttributes(Name); assertEquals(expected, actual); verify(proxiedObject).getAttributes(Name); @@ -409,7 +409,7 @@ public class ArtifactReadOnlyImplTest { when(proxiedObject.getAttributes(Name, EXCLUDE_DELETED)).thenAnswer(answer(attributes1)); when(proxyManager.asExternalAttributes(session, attributes1)).thenAnswer(answer(expected)); - ResultSet> actual = readOnly.getAttributes(Name, EXCLUDE_DELETED); + ResultSet> actual = readOnly.getAttributes(Name, EXCLUDE_DELETED); assertEquals(expected, actual); verify(proxiedObject).getAttributes(Name, EXCLUDE_DELETED); diff --git a/plugins/org.eclipse.osee.orcs.core.test/src/org/eclipse/osee/orcs/core/internal/transaction/TransactionBuilderImplTest.java b/plugins/org.eclipse.osee.orcs.core.test/src/org/eclipse/osee/orcs/core/internal/transaction/TransactionBuilderImplTest.java index 593bf05da2b..31b15ffecd4 100644 --- a/plugins/org.eclipse.osee.orcs.core.test/src/org/eclipse/osee/orcs/core/internal/transaction/TransactionBuilderImplTest.java +++ b/plugins/org.eclipse.osee.orcs.core.test/src/org/eclipse/osee/orcs/core/internal/transaction/TransactionBuilderImplTest.java @@ -146,7 +146,7 @@ public class TransactionBuilderImplTest { @Test public void testCopyArtifactWithList() { - Collection attributesToDuplicate = Arrays.asList(Name, Annotation); + Collection> attributesToDuplicate = Arrays.asList(Name, Annotation); factory.copyArtifact(expectedAuthor, attributesToDuplicate); diff --git a/plugins/org.eclipse.osee.orcs.core.test/src/org/eclipse/osee/orcs/core/internal/transaction/TxDataManagerTest.java b/plugins/org.eclipse.osee.orcs.core.test/src/org/eclipse/osee/orcs/core/internal/transaction/TxDataManagerTest.java index 3c4b8c06ec6..ac83ff9eb3a 100644 --- a/plugins/org.eclipse.osee.orcs.core.test/src/org/eclipse/osee/orcs/core/internal/transaction/TxDataManagerTest.java +++ b/plugins/org.eclipse.osee.orcs.core.test/src/org/eclipse/osee/orcs/core/internal/transaction/TxDataManagerTest.java @@ -105,7 +105,7 @@ public class TxDataManagerTest { private TxDataManager txDataManager; private TxData txDataReal; - private final Collection types = Arrays.asList(Name, Category); + private final Collection> types = Arrays.asList(Name, Category); private String r1Guid; private String r2Guid; private String r3Guid; diff --git a/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/ds/Attribute.java b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/ds/Attribute.java index 654c82b8002..4f59939db24 100644 --- a/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/ds/Attribute.java +++ b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/ds/Attribute.java @@ -26,7 +26,7 @@ import org.eclipse.osee.orcs.data.AttributeReadable; * @author Roberto E. Escobar * @author Andrew M. Finkbeiner */ -public interface Attribute extends OrcsWriteable, AttributeReadable, HasOrcsData, AttributeData> { +public interface Attribute extends OrcsWriteable, AttributeReadable, HasOrcsData, AttributeData> { void setValue(T value); diff --git a/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/ds/AttributeData.java b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/ds/AttributeData.java index 7f4885497ed..37628967430 100644 --- a/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/ds/AttributeData.java +++ b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/ds/AttributeData.java @@ -20,7 +20,7 @@ import org.eclipse.osee.framework.core.data.AttributeTypeGeneric; /** * @author Roberto E. Escobar */ -public interface AttributeData extends OrcsData>, AttributeId { +public interface AttributeData extends OrcsData>, AttributeId { ArtifactId getArtifactId(); 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 df43b05abad..908853abd78 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 @@ -84,14 +84,13 @@ public class ArtifactFactory { return artifact; } - public Artifact copyArtifact(OrcsSession session, Artifact source, Collection types, BranchId ontoBranch) { + public Artifact copyArtifact(OrcsSession session, Artifact source, Collection> types, BranchId ontoBranch) { ArtifactData artifactData = factory.copy(ontoBranch, source.getOrcsData()); Artifact copy = createArtifact(session, artifactData); - Collection typesToCopy = getAllowedTypes(copy, types); - for (AttributeTypeToken attributeType : typesToCopy) { + Collection> typesToCopy = getAllowedTypes(copy, types); + for (AttributeTypeToken attributeType : typesToCopy) { for (AttributeReadable attributeSource : source.getAttributes(attributeType)) { - AttributeData data = getAttributeData(attributeSource); - attributeFactory.copyAttribute(data, ontoBranch, copy); + attributeFactory.copyAttribute(getAttributeData(attributeSource), ontoBranch, copy); } } copy.setLoaded(true); @@ -136,9 +135,9 @@ public class ArtifactFactory { public Artifact clone(OrcsSession session, Artifact source) { ArtifactData artifactData = factory.clone(source.getOrcsData()); Artifact copy = createArtifact(session, artifactData); - for (AttributeTypeToken attributeType : source.getExistingAttributeTypes()) { + for (AttributeTypeToken attributeType : source.getExistingAttributeTypes()) { for (AttributeReadable attributeSource : source.getAttributes(attributeType)) { - AttributeData data = getAttributeData(attributeSource); + AttributeData data = getAttributeData(attributeSource); attributeFactory.cloneAttribute(data, copy); } } @@ -146,13 +145,13 @@ public class ArtifactFactory { return copy; } - private AttributeData getAttributeData(AttributeReadable source) { + private AttributeData getAttributeData(AttributeReadable source) { return ((Attribute) source).getOrcsData(); } - private Collection getAllowedTypes(Artifact destination, Collection types) { - Set toReturn = new HashSet<>(); - for (AttributeTypeToken type : types) { + private Collection> getAllowedTypes(Artifact destination, Collection> types) { + Set> toReturn = new HashSet<>(); + for (AttributeTypeToken type : types) { if (type.notEqual(RelationOrder)) { if (destination.isAttributeTypeValid(type)) { toReturn.add(type); diff --git a/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/artifact/ArtifactImpl.java b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/artifact/ArtifactImpl.java index b3c0ce34c25..73fe817cbab 100644 --- a/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/artifact/ArtifactImpl.java +++ b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/artifact/ArtifactImpl.java @@ -146,7 +146,7 @@ public class ArtifactImpl extends AttributeManagerImpl implements Artifact { } @Override - public Collection getValidAttributeTypes() { + public Collection> getValidAttributeTypes() { return getArtifactType().getValidAttributeTypes(); } diff --git a/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/attribute/AttributeContainer.java b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/attribute/AttributeContainer.java index cf6c136e89d..8ab96fcbcf1 100644 --- a/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/attribute/AttributeContainer.java +++ b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/attribute/AttributeContainer.java @@ -24,9 +24,9 @@ import org.eclipse.osee.orcs.core.ds.Attribute; */ public interface AttributeContainer extends ArtifactToken { - void add(AttributeTypeToken attributeType, Attribute attribute); + void add(AttributeTypeToken attributeType, Attribute attribute); - void remove(AttributeTypeToken type, Attribute attribute); + void remove(AttributeTypeToken type, Attribute attribute); boolean isLoaded(); @@ -36,11 +36,11 @@ public interface AttributeContainer extends ArtifactToken { boolean areAttributesDirty(); - int getAttributeCount(AttributeTypeToken type); + int getAttributeCount(AttributeTypeToken type); - int getAttributeCount(AttributeTypeToken type, DeletionFlag deletionFlag); + int getAttributeCount(AttributeTypeToken type, DeletionFlag deletionFlag); - Collection getValidAttributeTypes(); + Collection> getValidAttributeTypes(); - Collection getExistingAttributeTypes(); + Collection> getExistingAttributeTypes(); } \ No newline at end of file diff --git a/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/attribute/AttributeFactory.java b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/attribute/AttributeFactory.java index 405c5fab21a..fd85ff80c77 100644 --- a/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/attribute/AttributeFactory.java +++ b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/attribute/AttributeFactory.java @@ -54,7 +54,7 @@ public class AttributeFactory { this.tokenService = tokenService; } - public Attribute createAttributeWithDefaults(AttributeContainer container, ArtifactData artifactData, AttributeTypeToken attributeType) { + public Attribute createAttributeWithDefaults(AttributeContainer container, ArtifactData artifactData, AttributeTypeToken attributeType) { AttributeData data = dataFactory.create(artifactData, tokenService.getAttributeType(attributeType.getId())); return createAttribute(container, data, true, true); } diff --git a/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/attribute/AttributeManager.java b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/attribute/AttributeManager.java index 6dd96671f82..bd9f418fc02 100644 --- a/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/attribute/AttributeManager.java +++ b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/attribute/AttributeManager.java @@ -36,21 +36,21 @@ public interface AttributeManager extends AttributeContainer { void unDeleteAttributesByArtifact(); - T getSoleAttributeValue(AttributeTypeToken attributeType); + T getSoleAttributeValue(AttributeTypeToken attributeType); - T getSoleAttributeValue(AttributeTypeToken attributeType, DeletionFlag flag, T defaultValue); + T getSoleAttributeValue(AttributeTypeToken attributeType, DeletionFlag flag, T defaultValue); - T getSoleAttributeValue(AttributeTypeToken attributeType, T defaultValue); + T getSoleAttributeValue(AttributeTypeToken attributeType, T defaultValue); - Attribute getSoleAttribute(AttributeTypeToken attributeType); + Attribute getSoleAttribute(AttributeTypeToken attributeType); - Attribute getSoleAttribute(AttributeTypeToken attributeType, DeletionFlag flag); + Attribute getSoleAttribute(AttributeTypeToken attributeType, DeletionFlag flag); - String getSoleAttributeAsString(AttributeTypeToken attributeType); + String getSoleAttributeAsString(AttributeTypeToken attributeType); - String getSoleAttributeAsString(AttributeTypeToken attributeType, String defaultValue); + String getSoleAttributeAsString(AttributeTypeToken attributeType, String defaultValue); - List getAttributeValues(AttributeTypeToken attributeType); + List getAttributeValues(AttributeTypeToken attributeType); List getAttributeValues(AttributeTypeToken attributeType, DeletionFlag deletionFlag); @@ -61,35 +61,35 @@ public interface AttributeManager extends AttributeContainer { return enumValue.matches(values); } - void setSoleAttributeValue(AttributeTypeToken attributeType, T value); + void setSoleAttributeValue(AttributeTypeToken attributeType, T value); - void setSoleAttributeFromStream(AttributeTypeToken attributeType, InputStream inputStream); + void setSoleAttributeFromStream(AttributeTypeToken attributeType, InputStream inputStream); - void setSoleAttributeFromString(AttributeTypeToken attributeType, String value); + void setSoleAttributeFromString(AttributeTypeToken attributeType, String value); - void setAttributesFromValues(AttributeTypeToken attributeType, Collection values); + void setAttributesFromValues(AttributeTypeToken attributeType, Collection values); - void setAttributesFromStrings(AttributeTypeToken attributeType, String... values); + void setAttributesFromStrings(AttributeTypeToken attributeType, String... values); - void setAttributesFromStrings(AttributeTypeToken attributeType, Collection values); + void setAttributesFromStrings(AttributeTypeToken attributeType, Collection values); - void deleteSoleAttribute(AttributeTypeToken attributeType); + void deleteSoleAttribute(AttributeTypeToken attributeType); - void deleteAttributes(AttributeTypeToken attributeType); + void deleteAttributes(AttributeTypeToken attributeType); - void deleteAttributesWithValue(AttributeTypeToken attributeType, Object value); + void deleteAttributesWithValue(AttributeTypeToken attributeType, Object value); - Attribute createAttribute(AttributeTypeGeneric attributeType); + Attribute createAttribute(AttributeTypeToken attributeType); - Attribute createAttribute(AttributeTypeToken attributeType, T value); + Attribute createAttribute(AttributeTypeToken attributeType, T value); List> getAttributes(); - List> getAttributes(AttributeTypeToken attributeType); + List> getAttributes(AttributeTypeToken attributeType); List> getAttributes(DeletionFlag deletionFlag); - List> getAttributes(AttributeTypeToken attributeType, DeletionFlag deletionFlag); + List> getAttributes(AttributeTypeToken attributeType, DeletionFlag deletionFlag); Attribute getAttributeById(AttributeId attributeId); diff --git a/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/attribute/AttributeManagerImpl.java b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/attribute/AttributeManagerImpl.java index c97fa09432a..5deb51fe83a 100644 --- a/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/attribute/AttributeManagerImpl.java +++ b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/attribute/AttributeManagerImpl.java @@ -55,9 +55,9 @@ import org.eclipse.osee.orcs.core.internal.util.OrcsPredicates; /** * @author Roberto E. Escobar */ -public abstract class AttributeManagerImpl extends BaseId implements HasOrcsData, AttributeManager, AttributeExceptionFactory, Iterable>>> { +public abstract class AttributeManagerImpl extends BaseId implements HasOrcsData, AttributeManager, AttributeExceptionFactory, Iterable, List>>> { - private final HashCollection> attributes; + private final HashCollection, Attribute> attributes; private final String guid; private boolean isLoaded; private final ArtifactData artifactData; @@ -91,13 +91,13 @@ public abstract class AttributeManagerImpl extends BaseId implements HasOrcsData } @Override - public synchronized void add(AttributeTypeToken attributeType, Attribute attribute) { + public synchronized void add(AttributeTypeToken attributeType, Attribute attribute) { attributes.put(attributeType, attribute); attribute.getOrcsData().setArtifactId(this); } @Override - public synchronized void remove(AttributeTypeToken type, Attribute attribute) { + public synchronized void remove(AttributeTypeToken type, Attribute attribute) { attributes.removeValue(type, attribute); attribute.getOrcsData().setArtifactId(ArtifactId.SENTINEL); } @@ -142,8 +142,8 @@ public abstract class AttributeManagerImpl extends BaseId implements HasOrcsData } @Override - public Collection getExistingAttributeTypes() { - Collection notDeleted = new HashSet<>(); + public Collection> getExistingAttributeTypes() { + Collection> notDeleted = new HashSet<>(); for (Attribute attr : attributes.getValues()) { if (!attr.isDeleted()) { notDeleted.add(attr.getAttributeType()); @@ -181,27 +181,27 @@ public abstract class AttributeManagerImpl extends BaseId implements HasOrcsData } @Override - public List> getAttributes(AttributeTypeToken attributeType) { + public List> getAttributes(AttributeTypeToken attributeType) { return getAttributes(attributeType, DeletionFlag.EXCLUDE_DELETED); } @Override - public List> getAttributes(AttributeTypeToken attributeType, DeletionFlag deletionFlag) { + public List> getAttributes(AttributeTypeToken attributeType, DeletionFlag deletionFlag) { return filterAttributes(attributes.getValues(attributeType), deletionFlag); } @Override - public int getAttributeCount(AttributeTypeToken attributeType) { + public int getAttributeCount(AttributeTypeToken attributeType) { return getAttributeCount(attributeType, DeletionFlag.EXCLUDE_DELETED); } @Override - public int getAttributeCount(AttributeTypeToken attributeType, DeletionFlag deletionFlag) { + public int getAttributeCount(AttributeTypeToken attributeType, DeletionFlag deletionFlag) { return filterAttributes(attributes.getValues(attributeType), deletionFlag).size(); } @Override - public List getAttributeValues(AttributeTypeToken attributeType) { + public List getAttributeValues(AttributeTypeToken attributeType) { List> attributes = getAttributes(attributeType); List values = new LinkedList<>(); @@ -265,13 +265,13 @@ public abstract class AttributeManagerImpl extends BaseId implements HasOrcsData } @Override - public T getSoleAttributeValue(AttributeTypeToken attributeType) { + public T getSoleAttributeValue(AttributeTypeToken attributeType) { Attribute attribute = getSoleAttribute(attributeType); return attribute.getValue(); } @Override - public T getSoleAttributeValue(AttributeTypeToken attributeType, DeletionFlag flag, T defaultValue) { + public T getSoleAttributeValue(AttributeTypeToken attributeType, DeletionFlag flag, T defaultValue) { T value = defaultValue; Attribute attribute = null; try { @@ -286,7 +286,7 @@ public abstract class AttributeManagerImpl extends BaseId implements HasOrcsData @SuppressWarnings("unchecked") @Override - public T getSoleAttributeValue(AttributeTypeToken attributeType, T defaultValue) { + public T getSoleAttributeValue(AttributeTypeToken attributeType, T defaultValue) { T value = defaultValue; List> attributes = getAttributes(attributeType); if (attributes.size() == 1) { @@ -302,23 +302,23 @@ public abstract class AttributeManagerImpl extends BaseId implements HasOrcsData } @Override - public void setSoleAttributeValue(AttributeTypeToken attributeType, T value) { + public void setSoleAttributeValue(AttributeTypeToken attributeType, T value) { Attribute attribute = getOrCreateSoleAttribute(attributeType); attribute.setValue(value); } @Override - public void setSoleAttributeFromString(AttributeTypeToken attributeType, String value) { + public void setSoleAttributeFromString(AttributeTypeToken attributeType, String value) { getOrCreateSoleAttribute(attributeType).setFromString(value); } @Override - public void setSoleAttributeFromStream(AttributeTypeToken attributeType, InputStream inputStream) { + public void setSoleAttributeFromStream(AttributeTypeToken attributeType, InputStream inputStream) { getOrCreateSoleAttribute(attributeType).setValueFromInputStream(inputStream); } @Override - public void setAttributesFromStrings(AttributeTypeToken attributeType, String... values) { + public void setAttributesFromStrings(AttributeTypeToken attributeType, String... values) { setAttributesFromStrings(attributeType, Arrays.asList(values)); } @@ -327,7 +327,7 @@ public abstract class AttributeManagerImpl extends BaseId implements HasOrcsData * the createAttributeFromString() method. */ @Override - public void setAttributesFromStrings(AttributeTypeToken attributeType, Collection values) { + public void setAttributesFromStrings(AttributeTypeToken attributeType, Collection values) { Set uniqueItems = new LinkedHashSet<>(values); List> remainingAttributes = getAttributes(attributeType); List remainingNewValues = new ArrayList<>(uniqueItems.size()); @@ -365,7 +365,7 @@ public abstract class AttributeManagerImpl extends BaseId implements HasOrcsData } @Override - public void setAttributesFromValues(AttributeTypeToken attributeType, Collection values) { + public void setAttributesFromValues(AttributeTypeToken attributeType, Collection values) { Set uniqueItems = new LinkedHashSet<>(values); List> remainingAttributes = getAttributes(attributeType); List remainingNewValues = new ArrayList<>(uniqueItems.size()); @@ -453,7 +453,7 @@ public abstract class AttributeManagerImpl extends BaseId implements HasOrcsData } @Override - public Attribute createAttribute(AttributeTypeGeneric attributeType) { + public Attribute createAttribute(AttributeTypeToken attributeType) { checkTypeValid(attributeType); checkMultiplicityCanAdd(attributeType); Attribute attr = attributeFactory.createAttributeWithDefaults(this, getOrcsData(), attributeType); @@ -461,26 +461,26 @@ public abstract class AttributeManagerImpl extends BaseId implements HasOrcsData } @Override - public Attribute createAttribute(AttributeTypeToken attributeType, T value) { + public Attribute createAttribute(AttributeTypeToken attributeType, T value) { Attribute attribute = createAttribute(attributeType); attribute.setValue(value); return attribute; } - private Attribute createAttributeFromString(AttributeTypeToken attributeType, String value) { + private Attribute createAttributeFromString(AttributeTypeToken attributeType, String value) { Attribute attribute = createAttribute(attributeType); attribute.setFromString(value); return attribute; } @Override - public Iterator>>> iterator() { + public Iterator, List>>> iterator() { return attributes.iterator(); } ////////////////////////////////////////////////////////////// - private Attribute getOrCreateSoleAttribute(AttributeTypeToken attributeType) { + private Attribute getOrCreateSoleAttribute(AttributeTypeToken attributeType) { List> filterAttributes = getAttributes(attributeType); int count = filterAttributes.size(); if (count > 1) { @@ -495,7 +495,7 @@ public abstract class AttributeManagerImpl extends BaseId implements HasOrcsData * Exclude any hard deleted attributes, but include artifact deleted attributes */ @Override - public Attribute getSoleAttribute(AttributeTypeToken attributeType) { + public Attribute getSoleAttribute(AttributeTypeToken attributeType) { return getSoleAttribute(attributeType, DeletionFlag.EXCLUDE_DELETED); } @@ -504,7 +504,7 @@ public abstract class AttributeManagerImpl extends BaseId implements HasOrcsData * all hard deleted attributes, but include artifact deleted attributes */ @Override - public Attribute getSoleAttribute(AttributeTypeToken attributeType, DeletionFlag flag) { + public Attribute getSoleAttribute(AttributeTypeToken attributeType, DeletionFlag flag) { Collection> filterAttributes = getAttributes(attributeType, flag); int size = filterAttributes.size(); if (size == 1) { @@ -518,7 +518,7 @@ public abstract class AttributeManagerImpl extends BaseId implements HasOrcsData ////////////////////////////////////////////////////////////// - private void checkTypeValid(AttributeTypeToken attributeType) { + private void checkTypeValid(AttributeTypeToken attributeType) { if (CoreAttributeTypes.Name.notEqual(attributeType)) { if (!isAttributeTypeValid(attributeType)) { throw new OseeArgumentException("The attribute type [%s] is not valid for artifacts [%s]", attributeType, @@ -527,11 +527,11 @@ public abstract class AttributeManagerImpl extends BaseId implements HasOrcsData } } - private void checkMultiplicityCanAdd(AttributeTypeToken attributeType) { + private void checkMultiplicityCanAdd(AttributeTypeToken attributeType) { checkMultiplicity(attributeType, getAttributeCount(attributeType) + 1); } - private void checkMultiplicityCanDelete(AttributeTypeToken attributeType) { + private void checkMultiplicityCanDelete(AttributeTypeToken attributeType) { checkMultiplicity(attributeType, getAttributeCount(attributeType) - 1); } @@ -568,7 +568,7 @@ public abstract class AttributeManagerImpl extends BaseId implements HasOrcsData } private void meetMinimumAttributes() { - for (AttributeTypeToken attributeType : getValidAttributeTypes()) { + for (AttributeTypeToken attributeType : getValidAttributeTypes()) { int missingCount = getRemainingAttributeCount(attributeType); for (int i = 0; i < missingCount; i++) { attributeFactory.createAttributeWithDefaults(this, getOrcsData(), attributeType); @@ -576,7 +576,7 @@ public abstract class AttributeManagerImpl extends BaseId implements HasOrcsData } } - private final int getRemainingAttributeCount(AttributeTypeToken attributeType) { + private final int getRemainingAttributeCount(AttributeTypeToken attributeType) { int minLimit = artifactData.getType().getMin(attributeType); return minLimit - getAttributeCount(attributeType); } diff --git a/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/proxy/impl/ArtifactReadOnlyImpl.java b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/proxy/impl/ArtifactReadOnlyImpl.java index 355a255d431..3ba1546ab30 100644 --- a/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/proxy/impl/ArtifactReadOnlyImpl.java +++ b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/proxy/impl/ArtifactReadOnlyImpl.java @@ -114,12 +114,12 @@ public class ArtifactReadOnlyImpl extends AbstractProxied implements A } @Override - public int getAttributeCount(AttributeTypeToken type) { + public int getAttributeCount(AttributeTypeToken type) { return getProxiedObject().getAttributeCount(type); } @Override - public int getAttributeCount(AttributeTypeToken type, DeletionFlag deletionFlag) { + public int getAttributeCount(AttributeTypeToken type, DeletionFlag deletionFlag) { return getProxiedObject().getAttributeCount(type, deletionFlag); } @@ -129,42 +129,42 @@ public class ArtifactReadOnlyImpl extends AbstractProxied implements A } @Override - public Collection getValidAttributeTypes() { + public Collection> getValidAttributeTypes() { return getProxiedObject().getValidAttributeTypes(); } @Override - public Collection getExistingAttributeTypes() { + public Collection> getExistingAttributeTypes() { return getProxiedObject().getExistingAttributeTypes(); } @Override - public T getSoleAttributeValue(AttributeTypeToken attributeType) { + public T getSoleAttributeValue(AttributeTypeToken attributeType) { return getProxiedObject().getSoleAttributeValue(attributeType); } @Override - public T getSoleAttributeValue(AttributeTypeToken attributeType, DeletionFlag flag, T defaultValue) { + public T getSoleAttributeValue(AttributeTypeToken attributeType, DeletionFlag flag, T defaultValue) { return getProxiedObject().getSoleAttributeValue(attributeType, flag, defaultValue); } @Override - public T getSoleAttributeValue(AttributeTypeToken attributeType, T defaultValue) { + public T getSoleAttributeValue(AttributeTypeToken attributeType, T defaultValue) { return getProxiedObject().getSoleAttributeValue(attributeType, defaultValue); } @Override - public String getSoleAttributeAsString(AttributeTypeToken attributeType) { + public String getSoleAttributeAsString(AttributeTypeToken attributeType) { return getProxiedObject().getSoleAttributeAsString(attributeType); } @Override - public String getSoleAttributeAsString(AttributeTypeToken attributeType, String defaultValue) { + public String getSoleAttributeAsString(AttributeTypeToken attributeType, String defaultValue) { return getProxiedObject().getSoleAttributeAsString(attributeType, defaultValue); } @Override - public Long getSoleAttributeId(AttributeTypeToken attributeType) { + public Long getSoleAttributeId(AttributeTypeToken attributeType) { return getProxiedObject().getSoleAttribute(attributeType).getId(); } @@ -174,7 +174,7 @@ public class ArtifactReadOnlyImpl extends AbstractProxied implements A } @Override - public List getAttributeValues(AttributeTypeToken attributeType) { + public List getAttributeValues(AttributeTypeToken attributeType) { return getProxiedObject().getAttributeValues(attributeType); } @@ -195,9 +195,8 @@ public class ArtifactReadOnlyImpl extends AbstractProxied implements A } @Override - public ResultSet> getAttributes(AttributeTypeToken attributeType) { - List> attributes = getProxiedObject().getAttributes(attributeType); - return getProxyManager().asExternalAttributes(getSession(), attributes); + public ResultSet> getAttributes(AttributeTypeToken attributeType) { + return getProxyManager().asExternalAttributes(getSession(), getProxiedObject().getAttributes(attributeType)); } @Override @@ -207,7 +206,7 @@ public class ArtifactReadOnlyImpl extends AbstractProxied implements A } @Override - public ResultSet> getAttributes(AttributeTypeToken attributeType, DeletionFlag deletionFlag) { + public ResultSet> getAttributes(AttributeTypeToken attributeType, DeletionFlag deletionFlag) { List> attributes = getProxiedObject().getAttributes(attributeType, deletionFlag); return getProxyManager().asExternalAttributes(getSession(), attributes); } 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 05e957ca08d..c944d112de7 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 @@ -200,12 +200,12 @@ public class TransactionBuilderImpl implements TransactionBuilder { } @Override - public ArtifactToken copyArtifact(ArtifactReadable sourceArtifact, Collection attributesToDuplicate) { + public ArtifactToken copyArtifact(ArtifactReadable sourceArtifact, Collection> attributesToDuplicate) { return copyArtifact(sourceArtifact.getBranch(), sourceArtifact, attributesToDuplicate); } @Override - public ArtifactToken copyArtifact(BranchId fromBranch, ArtifactId artifactId, Collection attributesToDuplicate) { + public ArtifactToken copyArtifact(BranchId fromBranch, ArtifactId artifactId, Collection> attributesToDuplicate) { return txManager.copyArtifact(txData, fromBranch, artifactId, attributesToDuplicate); } 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 82a37c498dd..44dea6c9d25 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 @@ -315,13 +315,13 @@ public class TxDataManager { return copyArtifactHelper(txData, source, source.getExistingAttributeTypes()); } - public ArtifactReadable copyArtifact(TxData txData, BranchId fromBranch, ArtifactId artifactId, Collection attributesToDuplicate) { + public ArtifactReadable copyArtifact(TxData txData, BranchId fromBranch, ArtifactId artifactId, Collection> attributesToDuplicate) { checkChangesAllowed(txData); Artifact source = getSourceArtifact(txData, fromBranch, artifactId); return copyArtifactHelper(txData, source, attributesToDuplicate); } - private ArtifactReadable copyArtifactHelper(TxData txData, Artifact source, Collection attributesToDuplicate) { + private ArtifactReadable copyArtifactHelper(TxData txData, Artifact source, Collection> attributesToDuplicate) { Artifact copy = artifactFactory.copyArtifact(txData.getSession(), source, attributesToDuplicate, txData.getBranch()); return asExternalArtifact(txData, copy); diff --git a/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/util/OrcsPredicates.java b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/util/OrcsPredicates.java index f116548ea4c..dc3c10e0a79 100644 --- a/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/util/OrcsPredicates.java +++ b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/util/OrcsPredicates.java @@ -124,11 +124,11 @@ public final class OrcsPredicates { }); } - public static Predicate> attributeId(final AttributeId attributeId) { - return new Predicate>() { + public static Predicate> attributeId(final AttributeId attributeId) { + return new Predicate>() { @Override - public boolean apply(Attribute input) { + public boolean apply(Attribute input) { return attributeId.equals(input); } }; diff --git a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/loader/data/AttributeDataImpl.java b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/loader/data/AttributeDataImpl.java index fe3737c7932..038d81feb9e 100644 --- a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/loader/data/AttributeDataImpl.java +++ b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/loader/data/AttributeDataImpl.java @@ -23,7 +23,7 @@ import org.eclipse.osee.orcs.core.ds.VersionData; /** * @author Roberto E. Escobar */ -public class AttributeDataImpl extends OrcsVersionedObjectImpl> implements AttributeData { +public class AttributeDataImpl extends OrcsVersionedObjectImpl> implements AttributeData { private ArtifactId artifactId = ArtifactId.SENTINEL; private boolean useBackingData = false; diff --git a/plugins/org.eclipse.osee.orcs.rest/src/org/eclipse/osee/orcs/rest/internal/AttributeEndpointImpl.java b/plugins/org.eclipse.osee.orcs.rest/src/org/eclipse/osee/orcs/rest/internal/AttributeEndpointImpl.java index 84530a42c40..8b943576db4 100644 --- a/plugins/org.eclipse.osee.orcs.rest/src/org/eclipse/osee/orcs/rest/internal/AttributeEndpointImpl.java +++ b/plugins/org.eclipse.osee.orcs.rest/src/org/eclipse/osee/orcs/rest/internal/AttributeEndpointImpl.java @@ -111,9 +111,9 @@ public class AttributeEndpointImpl implements AttributeEndpoint { if (mediaType.isEmpty() || mediaType.startsWith("text") || textOut) { builder.entity(attribute.getDisplayableString()); } else { - ResultSet> results = + ResultSet> results = exactlyOne.getAttributes(CoreAttributeTypes.Extension); - AttributeReadable extension = results.getOneOrNull(); + AttributeReadable extension = results.getOneOrNull(); if (extension != null) { fileExtension = extension.getDisplayableString(); } @@ -159,22 +159,22 @@ public class AttributeEndpointImpl implements AttributeEndpoint { } ArtifactReadable exactlyOne = queryBuilder.getResults().getExactlyOne(); - List> attrs = new ArrayList<>(); - for (AttributeReadable attr : exactlyOne.getAttributes(attributeType)) { + List> attrs = new ArrayList<>(); + for (AttributeReadable attr : exactlyOne.getAttributes(attributeType)) { attrs.add(attr); } if (attrs.size() == 1) { builder = Response.ok(); AttributeReadable attribute = attrs.iterator().next(); - String mediaType = attribute.getAttributeType().getMediaType(); + String mediaType = attributeType.getMediaType(); String fileExtension = attribute.getAttributeType().getFileExtension(); if (mediaType.isEmpty() || mediaType.startsWith("text")) { builder.entity(attribute.getDisplayableString()); } else { - ResultSet> results = + ResultSet> results = exactlyOne.getAttributes(CoreAttributeTypes.Extension); - AttributeReadable extension = results.getOneOrNull(); + AttributeReadable extension = results.getOneOrNull(); if (extension != null) { fileExtension = extension.getDisplayableString(); } @@ -206,7 +206,7 @@ public class AttributeEndpointImpl implements AttributeEndpoint { sb.append(AHTML.beginMultiColumnTable(95)); sb.append(AHTML.addRowMultiColumnTable(AHTML.bold("Valid Types"))); sb.append(AHTML.addRowMultiColumnTable("")); - for (AttributeTypeToken attrType : exactlyOne.getValidAttributeTypes()) { + for (AttributeTypeToken attrType : exactlyOne.getValidAttributeTypes()) { sb.append(AHTML.addRowMultiColumnTable(AHTML.bold("Name:"), attrType.getName())); sb.append(AHTML.addRowMultiColumnTable(AHTML.bold("AttributeTypeId:"), AHTML.getHyperlink(String.format("/orcs/branch/%s/artifact/%s/attribute/type/%s", branch, artifactId, diff --git a/plugins/org.eclipse.osee.orcs.rest/src/org/eclipse/osee/orcs/rest/internal/HtmlWriter.java b/plugins/org.eclipse.osee.orcs.rest/src/org/eclipse/osee/orcs/rest/internal/HtmlWriter.java index 300c2c657c6..6e02ba75850 100644 --- a/plugins/org.eclipse.osee.orcs.rest/src/org/eclipse/osee/orcs/rest/internal/HtmlWriter.java +++ b/plugins/org.eclipse.osee.orcs.rest/src/org/eclipse/osee/orcs/rest/internal/HtmlWriter.java @@ -97,8 +97,8 @@ public class HtmlWriter { data.put("Branch Id", asLink(uri.toASCIIString(), branchId)); data.put("Branch Name", asLink(uri.toASCIIString(), branchName)); - Collection types = artifact.getExistingAttributeTypes(); - for (AttributeTypeToken type : types) { + Collection> types = artifact.getExistingAttributeTypes(); + for (AttributeTypeToken type : types) { for (AttributeReadable attr : artifact.getAttributes(type)) { URI attrUri = uriInfo.getAbsolutePathBuilder().path("/attribute/{attributeId}").build(attr.getId()); String label = asLink(attrUri.getPath(), type.getName()); diff --git a/plugins/org.eclipse.osee.orcs.rest/src/org/eclipse/osee/orcs/rest/internal/TypesEndpointImpl.java b/plugins/org.eclipse.osee.orcs.rest/src/org/eclipse/osee/orcs/rest/internal/TypesEndpointImpl.java index cc9c3247b04..a0bdec481b6 100644 --- a/plugins/org.eclipse.osee.orcs.rest/src/org/eclipse/osee/orcs/rest/internal/TypesEndpointImpl.java +++ b/plugins/org.eclipse.osee.orcs.rest/src/org/eclipse/osee/orcs/rest/internal/TypesEndpointImpl.java @@ -130,7 +130,7 @@ public class TypesEndpointImpl implements TypesEndpoint { OrcsTypesSheet sheet = new OrcsTypesSheet(); sheet.setArtifactId(art.getId()); sheet.setName(art.getName()); - ResultSet> attributes = + ResultSet> attributes = art.getAttributes(CoreAttributeTypes.UriGeneralStringData); if (!attributes.isEmpty()) { sheet.setAttrId(attributes.iterator().next().getId()); 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 49fb8200a1e..86e730be687 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 @@ -148,13 +148,17 @@ public class OrcsCollectorWriter { AttributeTypeToken attrType = getAttributeType(orcsApi.tokenService(), owAttribute.getType()); if (artifact.getAttributeCount(attrType) <= 1 && owAttribute.getValues().size() <= 1) { - String currValue = artifact.getSoleAttributeAsString(attrType, null); + Object value = artifact.getSoleAttributeValue(attrType, null); + String currValue = null; + if (value != null) { + currValue = value.toString(); + } String newValue = null; if (owAttribute.getValues().size() == 1) { Object object = owAttribute.getValues().iterator().next(); if (object != null) { - newValue = owAttribute.getValues().iterator().next().toString(); + newValue = object.toString(); } } @@ -195,10 +199,9 @@ public class OrcsCollectorWriter { } } else if (attrType.isDate()) { try { - Date currVal = artifact.getSoleAttributeValue(attrType, null); Date newVal = getDate(newValue); - if (currVal == null || currVal.compareTo(newVal) != 0) { - logChange(artifact, attrType, DateUtil.getMMDDYYHHMM(currVal), + if (value == null || ((Date) value).compareTo(newVal) != 0) { + logChange(artifact, attrType, DateUtil.getMMDDYYHHMM((Date) value), DateUtil.getMMDDYYHHMM(newVal)); TransactionBuilder tx = getTransaction(); tx.setSoleAttributeValue(artifact, attrType, newVal); @@ -277,7 +280,7 @@ public class OrcsCollectorWriter { return null; } - protected static AttributeTypeToken getAttributeType(OrcsTokenService tokenService, OwAttributeType attributeType) { + protected static AttributeTypeToken getAttributeType(OrcsTokenService tokenService, OwAttributeType attributeType) { AttributeTypeToken attributeTypeToken = AttributeTypeToken.SENTINEL; if (attributeType != null && attributeType.isValid()) { attributeTypeToken = tokenService.getAttributeTypeOrSentinel(attributeType.getId()); diff --git a/plugins/org.eclipse.osee.orcs/src/org/eclipse/osee/orcs/data/ArtifactReadable.java b/plugins/org.eclipse.osee.orcs/src/org/eclipse/osee/orcs/data/ArtifactReadable.java index 864e48bc12c..762542d2581 100644 --- a/plugins/org.eclipse.osee.orcs/src/org/eclipse/osee/orcs/data/ArtifactReadable.java +++ b/plugins/org.eclipse.osee.orcs/src/org/eclipse/osee/orcs/data/ArtifactReadable.java @@ -48,29 +48,29 @@ public interface ArtifactReadable extends ArtifactToken, HasTransaction, OrcsRea TransactionId getLastModifiedTransaction(); - int getAttributeCount(AttributeTypeToken type); + int getAttributeCount(AttributeTypeToken type); - int getAttributeCount(AttributeTypeToken type, DeletionFlag deletionFlag); + int getAttributeCount(AttributeTypeToken type, DeletionFlag deletionFlag); - Collection getValidAttributeTypes(); + Collection> getValidAttributeTypes(); - Collection getExistingAttributeTypes(); + Collection> getExistingAttributeTypes(); - T getSoleAttributeValue(AttributeTypeToken attributeType); + T getSoleAttributeValue(AttributeTypeToken attributeType); - T getSoleAttributeValue(AttributeTypeToken attributeType, DeletionFlag flag, T defaultValue); + T getSoleAttributeValue(AttributeTypeToken attributeType, DeletionFlag flag, T defaultValue); - T getSoleAttributeValue(AttributeTypeToken attributeType, T defaultValue); + T getSoleAttributeValue(AttributeTypeToken attributeType, T defaultValue); - String getSoleAttributeAsString(AttributeTypeToken attributeType); + String getSoleAttributeAsString(AttributeTypeToken attributeType); - String getSoleAttributeAsString(AttributeTypeToken attributeType, String defaultValue); + String getSoleAttributeAsString(AttributeTypeToken attributeType, String defaultValue); - Long getSoleAttributeId(AttributeTypeToken attributeType); + Long getSoleAttributeId(AttributeTypeToken attributeType); Long getSoleAttributeId(AttributeTypeToken attributeType, Long defaultValue); - List getAttributeValues(AttributeTypeToken attributeType); + List getAttributeValues(AttributeTypeToken attributeType); Iterable>> getAttributeIterable(); @@ -85,13 +85,13 @@ public interface ArtifactReadable extends ArtifactToken, HasTransaction, OrcsRea ResultSet> getAttributes(); - ResultSet> getAttributes(AttributeTypeToken attributeType); + ResultSet> getAttributes(AttributeTypeToken attributeType); ResultSet> getAttributes(DeletionFlag deletionFlag); - public ResultSet> getAttributes(AttributeTypeToken attributeType, DeletionFlag deletionFlag); + ResultSet> getAttributes(AttributeTypeToken attributeType, DeletionFlag deletionFlag); - default String getAttributeValuesAsString(AttributeTypeToken attributeType) { + default String getAttributeValuesAsString(AttributeTypeToken attributeType) { return Collections.toString(", ", getAttributeValues(attributeType)); } diff --git a/plugins/org.eclipse.osee.orcs/src/org/eclipse/osee/orcs/data/ArtifactReadableImpl.java b/plugins/org.eclipse.osee.orcs/src/org/eclipse/osee/orcs/data/ArtifactReadableImpl.java index 4c5b188b589..29a24ac9111 100644 --- a/plugins/org.eclipse.osee.orcs/src/org/eclipse/osee/orcs/data/ArtifactReadableImpl.java +++ b/plugins/org.eclipse.osee.orcs/src/org/eclipse/osee/orcs/data/ArtifactReadableImpl.java @@ -24,7 +24,6 @@ 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.AttributeId; -import org.eclipse.osee.framework.core.data.AttributeTypeGeneric; import org.eclipse.osee.framework.core.data.AttributeTypeToken; import org.eclipse.osee.framework.core.data.BranchId; import org.eclipse.osee.framework.core.data.IAttribute; @@ -106,33 +105,33 @@ public final class ArtifactReadableImpl extends BaseId implements ArtifactReadab } @Override - public int getAttributeCount(AttributeTypeToken type) { + public int getAttributeCount(AttributeTypeToken type) { return attributes.sizeByKey(type); } @Override - public int getAttributeCount(AttributeTypeToken type, DeletionFlag deletionFlag) { + public int getAttributeCount(AttributeTypeToken type, DeletionFlag deletionFlag) { throw new UnsupportedOperationException(); } @Override - public Collection getValidAttributeTypes() { + public Collection> getValidAttributeTypes() { throw new UnsupportedOperationException(); } @Override - public Collection getExistingAttributeTypes() { + public Collection> getExistingAttributeTypes() { return attributes.keySet(); } @Override - public T getSoleAttributeValue(AttributeTypeToken attributeType) { + public T getSoleAttributeValue(AttributeTypeToken attributeType) { List values = getAttributeValues(attributeType); ensureSole(attributeType, values); return values.iterator().next(); } - private void ensureSole(AttributeTypeToken attributeType, Collection values) { + private void ensureSole(AttributeTypeToken attributeType, Collection values) { if (values == null || values.size() < 1) { throw new AttributeDoesNotExist("Attribute of type [%s] could not be found on [%s]", attributeType, getIdString()); @@ -148,12 +147,12 @@ public final class ArtifactReadableImpl extends BaseId implements ArtifactReadab } @Override - public T getSoleAttributeValue(AttributeTypeToken attributeType, DeletionFlag flag, T defaultValue) { + public T getSoleAttributeValue(AttributeTypeToken attributeType, DeletionFlag flag, T defaultValue) { throw new UnsupportedOperationException(); } @Override - public T getSoleAttributeValue(AttributeTypeToken attributeType, T defaultValue) { + public T getSoleAttributeValue(AttributeTypeToken attributeType, T defaultValue) { List values = getAttributeValues(attributeType); if (values == null) { return defaultValue; @@ -168,12 +167,12 @@ public final class ArtifactReadableImpl extends BaseId implements ArtifactReadab } @Override - public String getSoleAttributeAsString(AttributeTypeToken attributeType) { + public String getSoleAttributeAsString(AttributeTypeToken attributeType) { return getSoleAttributeValue(attributeType).toString(); } @Override - public String getSoleAttributeAsString(AttributeTypeToken attributeType, String defaultValue) { + public String getSoleAttributeAsString(AttributeTypeToken attributeType, String defaultValue) { Object value = getSoleAttributeValue(attributeType, null); if (value == null) { return defaultValue; @@ -182,7 +181,7 @@ public final class ArtifactReadableImpl extends BaseId implements ArtifactReadab } @Override - public Long getSoleAttributeId(AttributeTypeToken attributeType) { + public Long getSoleAttributeId(AttributeTypeToken attributeType) { List> list = attributes.getValues(attributeType); ensureNotMoreThanOne(attributeType, list.size()); return list.iterator().next().getId(); @@ -200,7 +199,7 @@ public final class ArtifactReadableImpl extends BaseId implements ArtifactReadab @SuppressWarnings("unchecked") @Override - public List getAttributeValues(AttributeTypeToken attributeType) { + public List getAttributeValues(AttributeTypeToken attributeType) { if (attributes.isEmpty()) { throw new OseeStateException("attributes not loaded for artifact [%s]", getIdString()); } @@ -212,6 +211,10 @@ public final class ArtifactReadableImpl extends BaseId implements ArtifactReadab return (List) values.stream().map(IAttribute::getValue).collect(Collectors.toList()); } + public void putAttributeValue(AttributeTypeToken attributeType, Object value) { + + } + @SuppressWarnings("unchecked") @Override public List getAttributeValues(AttributeTypeToken attributeType, DeletionFlag deletionFlag) { @@ -226,7 +229,7 @@ public final class ArtifactReadableImpl extends BaseId implements ArtifactReadab return (List) values.stream().map(IAttribute::getValue).collect(Collectors.toList()); } - public void putAttributeValue(AttributeTypeGeneric attributeType, IAttribute attribute) { + public void putAttributeValue(AttributeTypeToken attributeType, IAttribute attribute) { attributes.put(attributeType, attribute); } @@ -250,7 +253,7 @@ public final class ArtifactReadableImpl extends BaseId implements ArtifactReadab } @Override - public ResultSet> getAttributes(AttributeTypeToken attributeType) { + public ResultSet> getAttributes(AttributeTypeToken attributeType) { throw new UnsupportedOperationException(); } @@ -260,7 +263,7 @@ public final class ArtifactReadableImpl extends BaseId implements ArtifactReadab } @Override - public ResultSet> getAttributes(AttributeTypeToken attributeType, DeletionFlag deletionFlag) { + public ResultSet> getAttributes(AttributeTypeToken attributeType, DeletionFlag deletionFlag) { throw new UnsupportedOperationException(); } 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 769707a3866..aaf7af51d1c 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 @@ -96,11 +96,11 @@ public interface TransactionBuilder { ArtifactToken copyArtifact(ArtifactReadable sourceArtifact); - ArtifactToken copyArtifact(ArtifactReadable sourceArtifact, Collection attributesToDuplicate); + ArtifactToken copyArtifact(ArtifactReadable sourceArtifact, Collection> attributesToDuplicate); ArtifactToken copyArtifact(BranchId fromBranch, ArtifactId sourceArtifact); - ArtifactToken copyArtifact(BranchId fromBranch, ArtifactId sourceArtifact, Collection attributesToDuplicate); + ArtifactToken copyArtifact(BranchId fromBranch, ArtifactId sourceArtifact, Collection> attributesToDuplicate); ArtifactToken introduceArtifact(BranchId fromBranch, ArtifactId sourceArtifact); -- cgit v1.2.3