diff options
99 files changed, 307 insertions, 249 deletions
diff --git a/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/merge/MergeItemBase.java b/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/merge/MergeItemBase.java index 33793a2bbc0..a3dc84f28e4 100644 --- a/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/merge/MergeItemBase.java +++ b/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/merge/MergeItemBase.java @@ -16,7 +16,7 @@ import org.eclipse.osee.framework.core.exception.OseeArgumentException; /** * @author Donald G. Dunne */ -public abstract class MergeItemBase extends NamedIdentity implements IMergeItem { +public abstract class MergeItemBase extends NamedIdentity<String> implements IMergeItem { private final MergeType mergeType; private boolean checked = false; diff --git a/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/model/CoverageItem.java b/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/model/CoverageItem.java index 59030fa8752..e113f6bb935 100644 --- a/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/model/CoverageItem.java +++ b/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/model/CoverageItem.java @@ -29,7 +29,7 @@ import org.eclipse.osee.framework.ui.swt.KeyedImage; /** * @author Donald G. Dunne */ -public class CoverageItem extends NamedIdentity implements ICoverage, IWorkProductRelatable { +public class CoverageItem extends NamedIdentity<String> implements ICoverage, IWorkProductRelatable { CoverageOption coverageMethod = CoverageOptionManager.Not_Covered; String rationale; diff --git a/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/model/CoveragePackageBase.java b/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/model/CoveragePackageBase.java index 74cb7a57e9f..91ef1f57a70 100644 --- a/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/model/CoveragePackageBase.java +++ b/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/model/CoveragePackageBase.java @@ -30,7 +30,7 @@ import org.eclipse.osee.framework.ui.swt.KeyedImage; /** * @author Donald G. Dunne */ -public abstract class CoveragePackageBase extends NamedIdentity implements ICoverage, ICoverageUnitProvider { +public abstract class CoveragePackageBase extends NamedIdentity<String> implements ICoverage, ICoverageUnitProvider { List<CoverageUnit> coverageUnits = Collections.synchronizedList(new ArrayList<CoverageUnit>()); final XResultDataFile logResultData = new XResultDataFile(false); boolean editable = true; diff --git a/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/model/CoverageTestUnit.java b/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/model/CoverageTestUnit.java index 585cfe622b0..d28246a3936 100644 --- a/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/model/CoverageTestUnit.java +++ b/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/model/CoverageTestUnit.java @@ -21,7 +21,7 @@ import org.eclipse.osee.framework.ui.swt.KeyedImage; * * @author Donald G. Dunne */ -public class CoverageTestUnit extends NamedIdentity implements ICoverage { +public class CoverageTestUnit extends NamedIdentity<String> implements ICoverage { public CoverageTestUnit(String name) { super(null, name); } diff --git a/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/model/CoverageUnit.java b/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/model/CoverageUnit.java index 3022e6994bd..afa07b2213d 100644 --- a/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/model/CoverageUnit.java +++ b/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/model/CoverageUnit.java @@ -31,7 +31,7 @@ import org.eclipse.osee.framework.ui.swt.KeyedImage; * * @author Donald G. Dunne */ -public class CoverageUnit extends NamedIdentity implements IWorkProductRelatable, ICoverage, ICoverageUnitProvider, ICoverageItemProvider { +public class CoverageUnit extends NamedIdentity<String> implements IWorkProductRelatable, ICoverage, ICoverageUnitProvider, ICoverageItemProvider { String namespace; boolean folder; diff --git a/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/model/ICoverage.java b/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/model/ICoverage.java index 6b5da5d732c..ebfb7fbf159 100644 --- a/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/model/ICoverage.java +++ b/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/model/ICoverage.java @@ -20,7 +20,7 @@ import org.eclipse.osee.framework.ui.swt.KeyedImage; /** * @author Donald G. Dunne */ -public interface ICoverage extends Named, Identity { +public interface ICoverage extends Named, Identity<String> { public String getNotes(); diff --git a/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/model/MessageCoverageItem.java b/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/model/MessageCoverageItem.java index f2981b0f462..e890b01e92f 100644 --- a/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/model/MessageCoverageItem.java +++ b/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/model/MessageCoverageItem.java @@ -20,7 +20,7 @@ import org.eclipse.osee.framework.ui.swt.KeyedImage; /** * @author Donald G. Dunne */ -public class MessageCoverageItem extends NamedIdentity implements ICoverage { +public class MessageCoverageItem extends NamedIdentity<String> implements ICoverage { public MessageCoverageItem(String message) { super(null, message); diff --git a/plugins/org.eclipse.osee.framework.branch.management.test/src/org/eclipse/osee/framework/branch/management/test/purge/DeletedBranchProviderTest.java b/plugins/org.eclipse.osee.framework.branch.management.test/src/org/eclipse/osee/framework/branch/management/test/purge/DeletedBranchProviderTest.java index 32fe604841f..aaee5519572 100644 --- a/plugins/org.eclipse.osee.framework.branch.management.test/src/org/eclipse/osee/framework/branch/management/test/purge/DeletedBranchProviderTest.java +++ b/plugins/org.eclipse.osee.framework.branch.management.test/src/org/eclipse/osee/framework/branch/management/test/purge/DeletedBranchProviderTest.java @@ -40,7 +40,7 @@ public final class DeletedBranchProviderTest { @Test public void testGetBranches() throws OseeCoreException { - BranchCache mockCache = new BranchCache(new MockOseeDataAccessor<Branch>()); + BranchCache mockCache = new BranchCache(new MockOseeDataAccessor<String, Branch>()); Collection<Branch> branches = MockBranchProvider.createTestBranches(); mockCache.cache(branches.toArray(new Branch[branches.size()])); diff --git a/plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/exchange/export/DbTableExportItem.java b/plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/exchange/export/DbTableExportItem.java index 78004dcb667..aeb5de703a6 100644 --- a/plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/exchange/export/DbTableExportItem.java +++ b/plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/exchange/export/DbTableExportItem.java @@ -196,9 +196,9 @@ public class DbTableExportItem extends AbstractDbExportItem { } } - private void handleTypeId(Appendable appendable, Object value, AbstractOseeCache<?> cache) throws IOException, OseeCoreException { + private void handleTypeId(Appendable appendable, Object value, AbstractOseeCache<?, ?> cache) throws IOException, OseeCoreException { int typeId = ((BigDecimal) value).intValueExact(); - String guid = cache.getById(typeId).getGuid(); + String guid = String.valueOf(cache.getById(typeId).getGuid()); ExportImportXml.addXmlAttribute(appendable, ExportImportXml.TYPE_GUID, guid); } diff --git a/plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/exchange/handler/DbTableSaxHandler.java b/plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/exchange/handler/DbTableSaxHandler.java index 34867084bb5..9fe246f9f6d 100644 --- a/plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/exchange/handler/DbTableSaxHandler.java +++ b/plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/exchange/handler/DbTableSaxHandler.java @@ -26,11 +26,11 @@ import org.eclipse.osee.framework.branch.management.internal.Activator; import org.eclipse.osee.framework.core.enums.ConflictType; import org.eclipse.osee.framework.core.exception.OseeCoreException; import org.eclipse.osee.framework.core.exception.OseeStateException; -import org.eclipse.osee.framework.jdk.core.type.PropertyStore; import org.eclipse.osee.framework.core.model.AbstractOseeType; import org.eclipse.osee.framework.core.model.cache.AbstractOseeCache; import org.eclipse.osee.framework.core.services.IOseeCachingService; import org.eclipse.osee.framework.core.util.Conditions; +import org.eclipse.osee.framework.jdk.core.type.PropertyStore; import org.eclipse.osee.framework.jdk.core.util.Lib; import org.eclipse.osee.framework.jdk.core.util.Strings; import org.eclipse.osee.framework.logging.OseeLog; @@ -85,7 +85,8 @@ public class DbTableSaxHandler extends BaseDbSaxHandler { services.getResourceLocatorManager().generateResourceLocator("attr", gammaId, name); IResourceLocator locator = - services.getResourceManager().save(locatorHint, new ZipBinaryResource(entry, locatorHint), new PropertyStore()); + services.getResourceManager().save(locatorHint, new ZipBinaryResource(entry, locatorHint), + new PropertyStore()); transferredBinaryContent.add(locator); return locator.getLocation().toASCIIString(); } else { @@ -96,10 +97,10 @@ public class DbTableSaxHandler extends BaseDbSaxHandler { } } - private int getTypeId(AbstractOseeCache<? extends AbstractOseeType> cache, Map<String, String> fieldMap) throws OseeCoreException { + private int getTypeId(AbstractOseeCache<?, ? extends AbstractOseeType> cache, Map<String, String> fieldMap) throws OseeCoreException { Conditions.checkNotNull(cache, "cache"); String guid = fieldMap.get(ExchangeDb.TYPE_GUID); - AbstractOseeType typeObject = cache.getByGuid(guid); + AbstractOseeType<?> typeObject = cache.getByGuid(guid); Conditions.checkNotNull(typeObject, "type", "type [%s] was not found in cache [%s]", guid, cache.getCacheId()); return typeObject.getId(); } @@ -185,8 +186,7 @@ public class DbTableSaxHandler extends BaseDbSaxHandler { } } catch (OseeCoreException ex) { cleanUpBinaryContent(); - OseeLog.logf(Activator.class, Level.SEVERE, - ex, "Error processing in [%s]", getMetaData().getTableName()); + OseeLog.logf(Activator.class, Level.SEVERE, ex, "Error processing in [%s]", getMetaData().getTableName()); throw ex; } } diff --git a/plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/exchange/transform/V0_9_0Transformer.java b/plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/exchange/transform/V0_9_0Transformer.java index c485326a53a..685f40c8e0f 100644 --- a/plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/exchange/transform/V0_9_0Transformer.java +++ b/plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/exchange/transform/V0_9_0Transformer.java @@ -54,7 +54,7 @@ public class V0_9_0Transformer implements IOseeExchangeVersionTransformer { return MAX_VERSION; } - private void replaceDataTypeIdsWithGuids(ExchangeDataProcessor processor, AbstractOseeCache<?> cache, ExportItem exportItem, String typeIdColumn, String typeNameColumn) throws OseeCoreException { + private void replaceDataTypeIdsWithGuids(ExchangeDataProcessor processor, AbstractOseeCache cache, ExportItem exportItem, String typeIdColumn, String typeNameColumn) throws OseeCoreException { V0_9_0TypeHandler typeHandler = new V0_9_0TypeHandler(cache, typeIdColumn, typeNameColumn); processor.parse(exportItem + ".type.xml", typeHandler); HashMap<Integer, String> typeIdMap = typeHandler.getTypeIdMap(); diff --git a/plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/exchange/transform/V0_9_0TypeHandler.java b/plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/exchange/transform/V0_9_0TypeHandler.java index 88b36c268f2..46c3c26e731 100644 --- a/plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/exchange/transform/V0_9_0TypeHandler.java +++ b/plugins/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/exchange/transform/V0_9_0TypeHandler.java @@ -23,9 +23,9 @@ public class V0_9_0TypeHandler extends AbstractSaxHandler { private final HashMap<Integer, String> typeIdMap = new HashMap<Integer, String>(100); private final String typeIdColumn; private final String typeNameColumn; - private final AbstractOseeCache<?> cache; + private final AbstractOseeCache<?, ?> cache; - public V0_9_0TypeHandler(AbstractOseeCache<?> cache, String typeIdColumn, String typeNameColumn) { + public V0_9_0TypeHandler(AbstractOseeCache<?, ?> cache, String typeIdColumn, String typeNameColumn) { this.typeIdColumn = typeIdColumn; this.typeNameColumn = typeNameColumn; this.cache = cache; @@ -46,7 +46,7 @@ public class V0_9_0TypeHandler extends AbstractSaxHandler { } else if (typeName.equals("ats.Parent Branch Id")) { typeName = "ats.Baseline Branch Guid"; } - String guid = cache.getBySoleName(typeName).getGuid(); + String guid = String.valueOf(cache.getBySoleName(typeName).getGuid()); typeIdMap.put(Integer.parseInt(attributes.getValue(typeIdColumn)), guid); } } diff --git a/plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/cache/AbstractDatabaseAccessor.java b/plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/cache/AbstractDatabaseAccessor.java index 5537f6fac7a..1804f4d43b1 100644 --- a/plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/cache/AbstractDatabaseAccessor.java +++ b/plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/cache/AbstractDatabaseAccessor.java @@ -19,7 +19,7 @@ import org.eclipse.osee.framework.database.core.IOseeSequence; /** * @author Roberto E. Escobar */ -public abstract class AbstractDatabaseAccessor<T extends IOseeStorable> implements IOseeDataAccessor<T> { +public abstract class AbstractDatabaseAccessor<K, T extends IOseeStorable> implements IOseeDataAccessor<K, T> { private final IOseeDatabaseService databaseService; diff --git a/plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/cache/AbstractTypeDatabaseAccessor.java b/plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/cache/AbstractTypeDatabaseAccessor.java new file mode 100644 index 00000000000..4381b6ddfb1 --- /dev/null +++ b/plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/cache/AbstractTypeDatabaseAccessor.java @@ -0,0 +1,17 @@ +/* + * Created on Aug 19, 2011 + * + * PLACE_YOUR_DISTRIBUTION_STATEMENT_RIGHT_HERE + */ +package org.eclipse.osee.framework.core.datastore.cache; + +import org.eclipse.osee.framework.core.model.IOseeStorable; +import org.eclipse.osee.framework.database.IOseeDatabaseService; + +public abstract class AbstractTypeDatabaseAccessor<T extends IOseeStorable> extends AbstractDatabaseAccessor<String, T> { + + protected AbstractTypeDatabaseAccessor(IOseeDatabaseService databaseService) { + super(databaseService); + } + +} diff --git a/plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/cache/DatabaseArtifactTypeAccessor.java b/plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/cache/DatabaseArtifactTypeAccessor.java index ca47a0a288b..be8d9da837d 100644 --- a/plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/cache/DatabaseArtifactTypeAccessor.java +++ b/plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/cache/DatabaseArtifactTypeAccessor.java @@ -43,7 +43,7 @@ import org.eclipse.osee.framework.logging.OseeLog; /** * @author Roberto E. Escobar */ -public class DatabaseArtifactTypeAccessor extends AbstractDatabaseAccessor<ArtifactType> { +public class DatabaseArtifactTypeAccessor extends AbstractTypeDatabaseAccessor<ArtifactType> { protected static final int ABSTRACT_TYPE_INDICATOR = 1; protected static final int CONCRETE_TYPE_INDICATOR = 0; @@ -84,7 +84,7 @@ public class DatabaseArtifactTypeAccessor extends AbstractDatabaseAccessor<Artif } @Override - public void load(IOseeCache<ArtifactType> cache) throws OseeCoreException { + public void load(IOseeCache<String, ArtifactType> cache) throws OseeCoreException { attributeCache.ensurePopulated(); Set<ArtifactType> loadedTypes = new HashSet<ArtifactType>(); ArtifactTypeCache artCache = (ArtifactTypeCache) cache; diff --git a/plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/cache/DatabaseAttributeTypeAccessor.java b/plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/cache/DatabaseAttributeTypeAccessor.java index 61e2bc577ef..4429c5e3d8b 100644 --- a/plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/cache/DatabaseAttributeTypeAccessor.java +++ b/plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/cache/DatabaseAttributeTypeAccessor.java @@ -31,7 +31,7 @@ import org.eclipse.osee.framework.logging.OseeLog; /** * @author Roberto E. Escobar */ -public class DatabaseAttributeTypeAccessor extends AbstractDatabaseAccessor<AttributeType> { +public class DatabaseAttributeTypeAccessor extends AbstractTypeDatabaseAccessor<AttributeType> { private static final String SELECT_ATTRIBUTE_TYPES = "SELECT * FROM osee_attribute_type aty1, osee_attribute_base_type aby1, osee_attribute_provider_type apy1 WHERE aty1.attr_base_type_id = aby1.attr_base_type_id AND aty1.attr_provider_type_id = apy1.attr_provider_type_id"; @@ -59,7 +59,7 @@ public class DatabaseAttributeTypeAccessor extends AbstractDatabaseAccessor<Attr } @Override - public void load(IOseeCache<AttributeType> cache) throws OseeCoreException { + public void load(IOseeCache<String, AttributeType> cache) throws OseeCoreException { enumCache.ensurePopulated(); IOseeStatement chStmt = getDatabaseService().getStatement(); diff --git a/plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/cache/DatabaseBranchAccessor.java b/plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/cache/DatabaseBranchAccessor.java index 44cbb3bd8e6..0b1e93fe32d 100644 --- a/plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/cache/DatabaseBranchAccessor.java +++ b/plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/cache/DatabaseBranchAccessor.java @@ -40,7 +40,7 @@ import org.eclipse.osee.framework.logging.OseeLog; /** * @author Roberto E. Escobar */ -public class DatabaseBranchAccessor extends AbstractDatabaseAccessor<Branch> { +public class DatabaseBranchAccessor extends AbstractDatabaseAccessor<String, Branch> { private static final String SELECT_BRANCHES = "SELECT * FROM osee_branch"; private static final String SELECT_MERGE_BRANCHES = "SELECT * FROM osee_merge"; @@ -57,7 +57,7 @@ public class DatabaseBranchAccessor extends AbstractDatabaseAccessor<Branch> { } @Override - public void load(IOseeCache<Branch> cache) throws OseeCoreException { + public void load(IOseeCache<String, Branch> cache) throws OseeCoreException { long startTime = System.currentTimeMillis(); Map<Branch, Integer> childToParent = new HashMap<Branch, Integer>(); Map<Branch, Integer> branchToBaseTx = new HashMap<Branch, Integer>(); @@ -74,8 +74,7 @@ public class DatabaseBranchAccessor extends AbstractDatabaseAccessor<Branch> { for (Branch branch : cache.getAll()) { branch.clearDirty(); } - OseeLog.logf(Activator.class, Level.INFO, - "Branch Cache loaded [%s]", Lib.getElapseString(startTime)); + OseeLog.logf(Activator.class, Level.INFO, "Branch Cache loaded [%s]", Lib.getElapseString(startTime)); } private void loadBranches(BranchCache cache, Map<Branch, Integer> childToParent, Map<Branch, Integer> branchToBaseTx, Map<Branch, Integer> branchToSourceTx, Map<Branch, Integer> associatedArtifact) throws OseeCoreException { diff --git a/plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/cache/DatabaseOseeEnumTypeAccessor.java b/plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/cache/DatabaseOseeEnumTypeAccessor.java index df18284eab5..afb7da66143 100644 --- a/plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/cache/DatabaseOseeEnumTypeAccessor.java +++ b/plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/cache/DatabaseOseeEnumTypeAccessor.java @@ -32,7 +32,7 @@ import org.eclipse.osee.framework.logging.OseeLog; /** * @author Roberto E. Escobar */ -public class DatabaseOseeEnumTypeAccessor extends AbstractDatabaseAccessor<OseeEnumType> { +public class DatabaseOseeEnumTypeAccessor extends AbstractTypeDatabaseAccessor<OseeEnumType> { private static final String SELECT_OSEE_ENUM_TYPES = "select * from osee_enum_type oet"; private static final String SELECT_OSEE_ENUM_ENTRIES = @@ -79,7 +79,7 @@ public class DatabaseOseeEnumTypeAccessor extends AbstractDatabaseAccessor<OseeE } @Override - public void load(IOseeCache<OseeEnumType> cache) throws OseeCoreException { + public void load(IOseeCache<String, OseeEnumType> cache) throws OseeCoreException { HashCollection<Integer, OseeEnumEntry> entryTypes = new HashCollection<Integer, OseeEnumEntry>(); loadEnumEntries(factory, entryTypes); diff --git a/plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/cache/DatabaseRelationTypeAccessor.java b/plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/cache/DatabaseRelationTypeAccessor.java index 4402e3ff5dc..c1a74e9f863 100644 --- a/plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/cache/DatabaseRelationTypeAccessor.java +++ b/plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/cache/DatabaseRelationTypeAccessor.java @@ -31,7 +31,7 @@ import org.eclipse.osee.framework.logging.OseeLog; /** * @author Roberto E. Escobar */ -public class DatabaseRelationTypeAccessor extends AbstractDatabaseAccessor<RelationType> { +public class DatabaseRelationTypeAccessor extends AbstractTypeDatabaseAccessor<RelationType> { private static final String SELECT_LINK_TYPES = "SELECT * FROM osee_relation_link_type"; private static final String INSERT_RELATION_TYPE = "INSERT INTO osee_relation_link_type (rel_link_type_id, rel_link_type_guid, type_name, a_name, b_name, a_art_type_id, b_art_type_id, multiplicity, default_order_type_guid) VALUES (?,?,?,?,?,?,?,?,?)"; @@ -48,7 +48,7 @@ public class DatabaseRelationTypeAccessor extends AbstractDatabaseAccessor<Relat } @Override - public void load(IOseeCache<RelationType> cache) throws OseeCoreException { + public void load(IOseeCache<String, RelationType> cache) throws OseeCoreException { artifactTypeCache.ensurePopulated(); IOseeStatement chStmt = getDatabaseService().getStatement(); diff --git a/plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/internal/ServerOseeCachingServiceFactory.java b/plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/internal/ServerOseeCachingServiceFactory.java index bef991ac585..ca1a7fcd643 100644 --- a/plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/internal/ServerOseeCachingServiceFactory.java +++ b/plugins/org.eclipse.osee.framework.core.datastore/src/org/eclipse/osee/framework/core/datastore/internal/ServerOseeCachingServiceFactory.java @@ -60,7 +60,7 @@ public class ServerOseeCachingServiceFactory implements IOseeCachingServiceFacto new OseeEnumTypeCache(new DatabaseOseeEnumTypeAccessor(databaseService, factoryService.getOseeEnumTypeFactory())); - IOseeDataAccessor<AttributeType> attrAccessor = + IOseeDataAccessor<String, AttributeType> attrAccessor = new DatabaseAttributeTypeAccessor(databaseService, oseeEnumTypeCache, factoryService.getAttributeTypeFactory()); AttributeTypeCache attributeCache = new AttributeTypeCache(attrAccessor); diff --git a/plugins/org.eclipse.osee.framework.core.dsl.integration.test/src/org/eclipse/osee/framework/core/dsl/integration/util/OseeUtilTest.java b/plugins/org.eclipse.osee.framework.core.dsl.integration.test/src/org/eclipse/osee/framework/core/dsl/integration/util/OseeUtilTest.java index 6b1633900d5..a8149dd1329 100644 --- a/plugins/org.eclipse.osee.framework.core.dsl.integration.test/src/org/eclipse/osee/framework/core/dsl/integration/util/OseeUtilTest.java +++ b/plugins/org.eclipse.osee.framework.core.dsl.integration.test/src/org/eclipse/osee/framework/core/dsl/integration/util/OseeUtilTest.java @@ -13,12 +13,10 @@ package org.eclipse.osee.framework.core.dsl.integration.util; import java.util.HashMap; import java.util.Map; import java.util.Map.Entry; -import org.junit.Assert; import org.eclipse.osee.framework.core.data.IArtifactType; import org.eclipse.osee.framework.core.data.IAttributeType; import org.eclipse.osee.framework.core.data.IRelationType; import org.eclipse.osee.framework.core.data.Identity; -import org.eclipse.osee.framework.core.dsl.integration.util.OseeUtil; import org.eclipse.osee.framework.core.dsl.oseeDsl.AccessPermissionEnum; import org.eclipse.osee.framework.core.dsl.oseeDsl.ObjectRestriction; import org.eclipse.osee.framework.core.dsl.oseeDsl.OseeDslFactory; @@ -35,6 +33,7 @@ import org.eclipse.osee.framework.core.enums.RelationOrderBaseTypes; import org.eclipse.osee.framework.core.enums.RelationSide; import org.eclipse.osee.framework.core.exception.OseeArgumentException; import org.eclipse.osee.framework.core.exception.OseeCoreException; +import org.junit.Assert; import org.junit.Test; /** @@ -181,7 +180,7 @@ public class OseeUtilTest { } } - private static void setupToToken(OseeType typeToCheck, Identity expected) { + private static void setupToToken(OseeType typeToCheck, Identity<String> expected) { String name = "bogus name"; // This should not affect equality String guid = expected.getGuid(); typeToCheck.setName(name); diff --git a/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/BranchCacheUpdateResponse.java b/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/BranchCacheUpdateResponse.java index 7c2a76b6be4..d9985fdf792 100644 --- a/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/BranchCacheUpdateResponse.java +++ b/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/BranchCacheUpdateResponse.java @@ -20,7 +20,7 @@ import org.eclipse.osee.framework.core.model.cache.IOseeCache; */ public class BranchCacheUpdateResponse extends AbstractBranchCacheMessage { - public static BranchCacheUpdateResponse fromCache(IOseeCache<Branch> cache, Collection<Branch> types) throws OseeCoreException { + public static BranchCacheUpdateResponse fromCache(IOseeCache<String, Branch> cache, Collection<Branch> types) throws OseeCoreException { BranchCacheUpdateResponse response = new BranchCacheUpdateResponse(); BranchCacheUpdateUtil.loadFromCache(response, types); return response; diff --git a/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/BranchCacheUpdateUtil.java b/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/BranchCacheUpdateUtil.java index a00ff73e531..d55314a3a77 100644 --- a/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/BranchCacheUpdateUtil.java +++ b/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/BranchCacheUpdateUtil.java @@ -53,7 +53,7 @@ public final class BranchCacheUpdateUtil { this.txCache = txCache; } - public Collection<Branch> updateCache(AbstractBranchCacheMessage cacheMessage, IOseeCache<Branch> cache) throws OseeCoreException { + public Collection<Branch> updateCache(AbstractBranchCacheMessage cacheMessage, IOseeCache<String, Branch> cache) throws OseeCoreException { List<Branch> updatedItems = new ArrayList<Branch>(); Map<Integer, Integer> branchToAssocArt = cacheMessage.getBranchToAssocArt(); diff --git a/plugins/org.eclipse.osee.framework.core.model.test/src/org/eclipse/osee/framework/core/model/cache/AbstractOseeCacheTest.java b/plugins/org.eclipse.osee.framework.core.model.test/src/org/eclipse/osee/framework/core/model/cache/AbstractOseeCacheTest.java index bda475179e4..9c2ed452ff2 100644 --- a/plugins/org.eclipse.osee.framework.core.model.test/src/org/eclipse/osee/framework/core/model/cache/AbstractOseeCacheTest.java +++ b/plugins/org.eclipse.osee.framework.core.model.test/src/org/eclipse/osee/framework/core/model/cache/AbstractOseeCacheTest.java @@ -20,7 +20,6 @@ import org.eclipse.osee.framework.core.exception.OseeCoreException; import org.eclipse.osee.framework.core.exception.OseeStateException; import org.eclipse.osee.framework.core.exception.OseeTypeDoesNotExist; import org.eclipse.osee.framework.core.model.AbstractOseeType; -import org.eclipse.osee.framework.jdk.core.util.GUID; import org.junit.Assert; import org.junit.Ignore; import org.junit.Test; @@ -30,12 +29,12 @@ import org.junit.Test; * * @author Roberto E. Escobar */ -public abstract class AbstractOseeCacheTest<T extends AbstractOseeType> { +public abstract class AbstractOseeCacheTest<K, T extends AbstractOseeType<K>> { private final List<T> data; - private final AbstractOseeCache<T> cache; + private final AbstractOseeCache<K, T> cache; private final TypeComparator comparator; - public AbstractOseeCacheTest(List<T> artifactTypes, AbstractOseeCache<T> typeCache) { + public AbstractOseeCacheTest(List<T> artifactTypes, AbstractOseeCache<K, T> typeCache) { this.comparator = new TypeComparator(); this.data = artifactTypes; this.cache = typeCache; @@ -59,7 +58,7 @@ public abstract class AbstractOseeCacheTest<T extends AbstractOseeType> { for (T expected : data) { Assert.assertTrue(cache.existsByGuid(expected.getGuid())); } - Assert.assertFalse(cache.existsByGuid("notExist")); + Assert.assertFalse(cache.existsByGuid(createKey())); } @org.junit.Test @@ -204,9 +203,11 @@ public abstract class AbstractOseeCacheTest<T extends AbstractOseeType> { @Test(expected = OseeTypeDoesNotExist.class) public void testNonExistingPersist() throws OseeCoreException { - cache.storeByGuid(Collections.singleton(GUID.create())); + cache.storeByGuid(Collections.singleton(createKey())); } + protected abstract K createKey(); + @SuppressWarnings("unchecked") @Test(expected = OseeArgumentException.class) public void testStoreNull2() throws OseeCoreException { diff --git a/plugins/org.eclipse.osee.framework.core.model.test/src/org/eclipse/osee/framework/core/model/cache/AbstractOseeItemCacheTest.java b/plugins/org.eclipse.osee.framework.core.model.test/src/org/eclipse/osee/framework/core/model/cache/AbstractOseeItemCacheTest.java new file mode 100644 index 00000000000..961710ee2e5 --- /dev/null +++ b/plugins/org.eclipse.osee.framework.core.model.test/src/org/eclipse/osee/framework/core/model/cache/AbstractOseeItemCacheTest.java @@ -0,0 +1,22 @@ +/* + * Created on Aug 19, 2011 + * + * PLACE_YOUR_DISTRIBUTION_STATEMENT_RIGHT_HERE + */ +package org.eclipse.osee.framework.core.model.cache; + +import java.util.List; +import org.eclipse.osee.framework.core.model.AbstractOseeType; +import org.eclipse.osee.framework.jdk.core.util.GUID; + +public abstract class AbstractOseeItemCacheTest<T extends AbstractOseeType<String>> extends AbstractOseeCacheTest<String, T> { + + public AbstractOseeItemCacheTest(List<T> artifactTypes, AbstractOseeCache<String, T> typeCache) { + super(artifactTypes, typeCache); + } + + @Override + protected String createKey() { + return GUID.create(); + } +} diff --git a/plugins/org.eclipse.osee.framework.core.model.test/src/org/eclipse/osee/framework/core/model/cache/AbstractOseeTypeCacheTest.java b/plugins/org.eclipse.osee.framework.core.model.test/src/org/eclipse/osee/framework/core/model/cache/AbstractOseeTypeCacheTest.java new file mode 100644 index 00000000000..91746b56c9d --- /dev/null +++ b/plugins/org.eclipse.osee.framework.core.model.test/src/org/eclipse/osee/framework/core/model/cache/AbstractOseeTypeCacheTest.java @@ -0,0 +1,23 @@ +/* + * Created on Aug 19, 2011 + * + * PLACE_YOUR_DISTRIBUTION_STATEMENT_RIGHT_HERE + */ +package org.eclipse.osee.framework.core.model.cache; + +import java.util.List; +import org.eclipse.osee.framework.core.model.AbstractOseeType; +import org.eclipse.osee.framework.jdk.core.util.GUID; + +public class AbstractOseeTypeCacheTest<T extends AbstractOseeType<String>> extends AbstractOseeCacheTest<String, T> { + + // john chage String in template area + public AbstractOseeTypeCacheTest(List<T> artifactTypes, AbstractOseeCache<String, T> typeCache) { + super(artifactTypes, typeCache); + } + + @Override + protected String createKey() { + return GUID.create(); + } +} diff --git a/plugins/org.eclipse.osee.framework.core.model.test/src/org/eclipse/osee/framework/core/model/cache/ArtifactTypeCacheTest.java b/plugins/org.eclipse.osee.framework.core.model.test/src/org/eclipse/osee/framework/core/model/cache/ArtifactTypeCacheTest.java index ca0e15a69b4..e0d921cf18a 100644 --- a/plugins/org.eclipse.osee.framework.core.model.test/src/org/eclipse/osee/framework/core/model/cache/ArtifactTypeCacheTest.java +++ b/plugins/org.eclipse.osee.framework.core.model.test/src/org/eclipse/osee/framework/core/model/cache/ArtifactTypeCacheTest.java @@ -13,8 +13,6 @@ package org.eclipse.osee.framework.core.model.cache; import java.util.ArrayList; import java.util.List; import org.eclipse.osee.framework.core.exception.OseeCoreException; -import org.eclipse.osee.framework.core.model.cache.ArtifactTypeCache; -import org.eclipse.osee.framework.core.model.cache.IOseeCache; import org.eclipse.osee.framework.core.model.mocks.MockDataFactory; import org.eclipse.osee.framework.core.model.mocks.MockOseeDataAccessor; import org.eclipse.osee.framework.core.model.type.ArtifactType; @@ -26,7 +24,7 @@ import org.junit.BeforeClass; * * @author Roberto E. Escobar */ -public class ArtifactTypeCacheTest extends AbstractOseeCacheTest<ArtifactType> { +public class ArtifactTypeCacheTest extends AbstractOseeTypeCacheTest<ArtifactType> { private static List<ArtifactType> artifactTypes; private static ArtifactTypeCache artCache; @@ -46,7 +44,7 @@ public class ArtifactTypeCacheTest extends AbstractOseeCacheTest<ArtifactType> { super(artifactTypes, artCache); } - private final static class ArtifactDataAccessor extends MockOseeDataAccessor<ArtifactType> { + private final static class ArtifactDataAccessor extends MockOseeDataAccessor<String, ArtifactType> { private final List<ArtifactType> artifactTypes; public ArtifactDataAccessor(List<ArtifactType> artifactTypes) { @@ -55,7 +53,7 @@ public class ArtifactTypeCacheTest extends AbstractOseeCacheTest<ArtifactType> { } @Override - public void load(IOseeCache<ArtifactType> cache) throws OseeCoreException { + public void load(IOseeCache<String, ArtifactType> cache) throws OseeCoreException { super.load(cache); int typeId = 100; diff --git a/plugins/org.eclipse.osee.framework.core.model.test/src/org/eclipse/osee/framework/core/model/cache/AttributeTypeCacheTest.java b/plugins/org.eclipse.osee.framework.core.model.test/src/org/eclipse/osee/framework/core/model/cache/AttributeTypeCacheTest.java index 140eac49551..fdb536cc487 100644 --- a/plugins/org.eclipse.osee.framework.core.model.test/src/org/eclipse/osee/framework/core/model/cache/AttributeTypeCacheTest.java +++ b/plugins/org.eclipse.osee.framework.core.model.test/src/org/eclipse/osee/framework/core/model/cache/AttributeTypeCacheTest.java @@ -13,8 +13,6 @@ package org.eclipse.osee.framework.core.model.cache; import java.util.ArrayList; import java.util.List; import org.eclipse.osee.framework.core.exception.OseeCoreException; -import org.eclipse.osee.framework.core.model.cache.AttributeTypeCache; -import org.eclipse.osee.framework.core.model.cache.IOseeCache; import org.eclipse.osee.framework.core.model.mocks.MockDataFactory; import org.eclipse.osee.framework.core.model.mocks.MockOseeDataAccessor; import org.eclipse.osee.framework.core.model.type.AttributeType; @@ -26,7 +24,7 @@ import org.junit.BeforeClass; * * @author Roberto E. Escobar */ -public class AttributeTypeCacheTest extends AbstractOseeCacheTest<AttributeType> { +public class AttributeTypeCacheTest extends AbstractOseeTypeCacheTest<AttributeType> { private static List<AttributeType> attributeTypes; private static AttributeTypeCache attrCache; @@ -46,7 +44,7 @@ public class AttributeTypeCacheTest extends AbstractOseeCacheTest<AttributeType> super(attributeTypes, attrCache); } - private final static class AttributeDataAccessor extends MockOseeDataAccessor<AttributeType> { + private final static class AttributeDataAccessor extends MockOseeDataAccessor<String, AttributeType> { private final List<AttributeType> attributeTypes; @@ -56,7 +54,7 @@ public class AttributeTypeCacheTest extends AbstractOseeCacheTest<AttributeType> } @Override - public void load(IOseeCache<AttributeType> cache) throws OseeCoreException { + public void load(IOseeCache<String, AttributeType> cache) throws OseeCoreException { super.load(cache); int typeId = 100; for (int index = 0; index < 10; index++) { diff --git a/plugins/org.eclipse.osee.framework.core.model.test/src/org/eclipse/osee/framework/core/model/cache/BranchCacheTest.java b/plugins/org.eclipse.osee.framework.core.model.test/src/org/eclipse/osee/framework/core/model/cache/BranchCacheTest.java index 10269605a3c..898770662f1 100644 --- a/plugins/org.eclipse.osee.framework.core.model.test/src/org/eclipse/osee/framework/core/model/cache/BranchCacheTest.java +++ b/plugins/org.eclipse.osee.framework.core.model.test/src/org/eclipse/osee/framework/core/model/cache/BranchCacheTest.java @@ -14,10 +14,9 @@ import java.util.ArrayList; import java.util.List; import org.eclipse.osee.framework.core.exception.OseeCoreException; import org.eclipse.osee.framework.core.model.Branch; -import org.eclipse.osee.framework.core.model.cache.BranchCache; -import org.eclipse.osee.framework.core.model.cache.IOseeCache; import org.eclipse.osee.framework.core.model.mocks.MockDataFactory; import org.eclipse.osee.framework.core.model.mocks.MockOseeDataAccessor; +import org.eclipse.osee.framework.jdk.core.util.GUID; import org.junit.Assert; import org.junit.BeforeClass; @@ -26,7 +25,7 @@ import org.junit.BeforeClass; * * @author Roberto E. Escobar */ -public class BranchCacheTest extends AbstractOseeCacheTest<Branch> { +public class BranchCacheTest extends AbstractOseeCacheTest<String, Branch> { private static List<Branch> branchData; private static BranchCache cache; @@ -47,7 +46,7 @@ public class BranchCacheTest extends AbstractOseeCacheTest<Branch> { super(branchData, cache); } - private final static class BranchDataAccessor extends MockOseeDataAccessor<Branch> { + private final static class BranchDataAccessor extends MockOseeDataAccessor<String, Branch> { private final List<Branch> data; @@ -57,7 +56,7 @@ public class BranchCacheTest extends AbstractOseeCacheTest<Branch> { } @Override - public void load(IOseeCache<Branch> cache) throws OseeCoreException { + public void load(IOseeCache<String, Branch> cache) throws OseeCoreException { super.load(cache); int typeId = 100; for (int index = 0; index < 10; index++) { @@ -68,4 +67,9 @@ public class BranchCacheTest extends AbstractOseeCacheTest<Branch> { } } } + + @Override + protected String createKey() { + return GUID.create(); + } } diff --git a/plugins/org.eclipse.osee.framework.core.model.test/src/org/eclipse/osee/framework/core/model/cache/OseeEnumTypeCacheTest.java b/plugins/org.eclipse.osee.framework.core.model.test/src/org/eclipse/osee/framework/core/model/cache/OseeEnumTypeCacheTest.java index 2bd90832d91..2567edb23e1 100644 --- a/plugins/org.eclipse.osee.framework.core.model.test/src/org/eclipse/osee/framework/core/model/cache/OseeEnumTypeCacheTest.java +++ b/plugins/org.eclipse.osee.framework.core.model.test/src/org/eclipse/osee/framework/core/model/cache/OseeEnumTypeCacheTest.java @@ -14,8 +14,6 @@ import java.util.ArrayList; import java.util.List; import org.eclipse.osee.framework.core.exception.OseeCoreException; import org.eclipse.osee.framework.core.model.OseeEnumEntry; -import org.eclipse.osee.framework.core.model.cache.IOseeCache; -import org.eclipse.osee.framework.core.model.cache.OseeEnumTypeCache; import org.eclipse.osee.framework.core.model.mocks.MockDataFactory; import org.eclipse.osee.framework.core.model.mocks.MockOseeDataAccessor; import org.eclipse.osee.framework.core.model.mocks.ModelAsserts; @@ -28,7 +26,7 @@ import org.junit.BeforeClass; * * @author Roberto E. Escobar */ -public class OseeEnumTypeCacheTest extends AbstractOseeCacheTest<OseeEnumType> { +public class OseeEnumTypeCacheTest extends AbstractOseeTypeCacheTest<OseeEnumType> { private static List<OseeEnumType> data; private static OseeEnumTypeCache cache; @@ -53,7 +51,7 @@ public class OseeEnumTypeCacheTest extends AbstractOseeCacheTest<OseeEnumType> { ModelAsserts.checkEnumType(expected, actual); } - private final static class EnumDataAccessor extends MockOseeDataAccessor<OseeEnumType> { + private final static class EnumDataAccessor extends MockOseeDataAccessor<String, OseeEnumType> { private final List<OseeEnumType> oseeEnumTypes; public EnumDataAccessor(List<OseeEnumType> oseeEnumTypes) { @@ -62,7 +60,7 @@ public class OseeEnumTypeCacheTest extends AbstractOseeCacheTest<OseeEnumType> { } @Override - public void load(IOseeCache<OseeEnumType> cache) throws OseeCoreException { + public void load(IOseeCache<String, OseeEnumType> cache) throws OseeCoreException { super.load(cache); int typeId = 100; for (int index = 0; index < 10; index++) { diff --git a/plugins/org.eclipse.osee.framework.core.model.test/src/org/eclipse/osee/framework/core/model/cache/RelationTypeCacheTest.java b/plugins/org.eclipse.osee.framework.core.model.test/src/org/eclipse/osee/framework/core/model/cache/RelationTypeCacheTest.java index bad113b91cf..9acde04edf5 100644 --- a/plugins/org.eclipse.osee.framework.core.model.test/src/org/eclipse/osee/framework/core/model/cache/RelationTypeCacheTest.java +++ b/plugins/org.eclipse.osee.framework.core.model.test/src/org/eclipse/osee/framework/core/model/cache/RelationTypeCacheTest.java @@ -13,8 +13,6 @@ package org.eclipse.osee.framework.core.model.cache; import java.util.ArrayList; import java.util.List; import org.eclipse.osee.framework.core.exception.OseeCoreException; -import org.eclipse.osee.framework.core.model.cache.IOseeCache; -import org.eclipse.osee.framework.core.model.cache.RelationTypeCache; import org.eclipse.osee.framework.core.model.mocks.MockDataFactory; import org.eclipse.osee.framework.core.model.mocks.MockOseeDataAccessor; import org.eclipse.osee.framework.core.model.type.RelationType; @@ -26,7 +24,7 @@ import org.junit.BeforeClass; * * @author Roberto E. Escobar */ -public class RelationTypeCacheTest extends AbstractOseeCacheTest<RelationType> { +public class RelationTypeCacheTest extends AbstractOseeTypeCacheTest<RelationType> { private static List<RelationType> data; private static RelationTypeCache cache; @@ -46,7 +44,7 @@ public class RelationTypeCacheTest extends AbstractOseeCacheTest<RelationType> { super(data, cache); } - private final static class RelationDataAccessor extends MockOseeDataAccessor<RelationType> { + private final static class RelationDataAccessor extends MockOseeDataAccessor<String, RelationType> { private final List<RelationType> relationTypes; public RelationDataAccessor(List<RelationType> relationTypes) { @@ -55,7 +53,7 @@ public class RelationTypeCacheTest extends AbstractOseeCacheTest<RelationType> { } @Override - public void load(IOseeCache<RelationType> cache) throws OseeCoreException { + public void load(IOseeCache<String, RelationType> cache) throws OseeCoreException { super.load(cache); int typeId = 100; for (int index = 0; index < 10; index++) { diff --git a/plugins/org.eclipse.osee.framework.core.model.test/src/org/eclipse/osee/framework/core/model/mocks/MockArtifact.java b/plugins/org.eclipse.osee.framework.core.model.test/src/org/eclipse/osee/framework/core/model/mocks/MockArtifact.java index 5818d54fb5d..fd064f3a21a 100644 --- a/plugins/org.eclipse.osee.framework.core.model.test/src/org/eclipse/osee/framework/core/model/mocks/MockArtifact.java +++ b/plugins/org.eclipse.osee.framework.core.model.test/src/org/eclipse/osee/framework/core/model/mocks/MockArtifact.java @@ -22,7 +22,7 @@ import org.eclipse.osee.framework.core.model.type.ArtifactType; /** * @author Jeff C. Phillips */ -public class MockArtifact extends NamedIdentity implements IBasicArtifact<Object> { +public class MockArtifact extends NamedIdentity<String> implements IBasicArtifact<Object> { private final Branch branch; private final ArtifactType artifactType; diff --git a/plugins/org.eclipse.osee.framework.core.model.test/src/org/eclipse/osee/framework/core/model/mocks/MockDataFactory.java b/plugins/org.eclipse.osee.framework.core.model.test/src/org/eclipse/osee/framework/core/model/mocks/MockDataFactory.java index 19c2db46b65..dd6056c73d6 100644 --- a/plugins/org.eclipse.osee.framework.core.model.test/src/org/eclipse/osee/framework/core/model/mocks/MockDataFactory.java +++ b/plugins/org.eclipse.osee.framework.core.model.test/src/org/eclipse/osee/framework/core/model/mocks/MockDataFactory.java @@ -134,13 +134,13 @@ public final class MockDataFactory { } public static IOseeCachingServiceProvider createCachingProvider() { - BranchCache brCache = new BranchCache(new MockOseeDataAccessor<Branch>()); + BranchCache brCache = new BranchCache(new MockOseeDataAccessor<String, Branch>()); TransactionCache txCache = new TransactionCache(); txCache.setAccessor(new MockOseeTransactionDataAccessor()); - ArtifactTypeCache artCache = new ArtifactTypeCache(new MockOseeDataAccessor<ArtifactType>()); - AttributeTypeCache attrCache = new AttributeTypeCache(new MockOseeDataAccessor<AttributeType>()); - RelationTypeCache relCache = new RelationTypeCache(new MockOseeDataAccessor<RelationType>()); - OseeEnumTypeCache enumCache = new OseeEnumTypeCache(new MockOseeDataAccessor<OseeEnumType>()); + ArtifactTypeCache artCache = new ArtifactTypeCache(new MockOseeDataAccessor<String, ArtifactType>()); + AttributeTypeCache attrCache = new AttributeTypeCache(new MockOseeDataAccessor<String, AttributeType>()); + RelationTypeCache relCache = new RelationTypeCache(new MockOseeDataAccessor<String, RelationType>()); + OseeEnumTypeCache enumCache = new OseeEnumTypeCache(new MockOseeDataAccessor<String, OseeEnumType>()); IOseeCachingService service = new OseeCachingService(brCache, txCache, artCache, attrCache, relCache, enumCache); return new MockOseeCachingServiceProvider(service); diff --git a/plugins/org.eclipse.osee.framework.core.model.test/src/org/eclipse/osee/framework/core/model/mocks/MockOseeDataAccessor.java b/plugins/org.eclipse.osee.framework.core.model.test/src/org/eclipse/osee/framework/core/model/mocks/MockOseeDataAccessor.java index f85987cb525..a1252a880ab 100644 --- a/plugins/org.eclipse.osee.framework.core.model.test/src/org/eclipse/osee/framework/core/model/mocks/MockOseeDataAccessor.java +++ b/plugins/org.eclipse.osee.framework.core.model.test/src/org/eclipse/osee/framework/core/model/mocks/MockOseeDataAccessor.java @@ -11,16 +11,16 @@ package org.eclipse.osee.framework.core.model.mocks; import java.util.Collection; -import org.junit.Assert; import org.eclipse.osee.framework.core.exception.OseeCoreException; import org.eclipse.osee.framework.core.model.IOseeStorable; import org.eclipse.osee.framework.core.model.cache.IOseeCache; import org.eclipse.osee.framework.core.model.cache.IOseeDataAccessor; +import org.junit.Assert; /** * @author Roberto E. Escobar */ -public class MockOseeDataAccessor<T extends IOseeStorable> implements IOseeDataAccessor<T> { +public class MockOseeDataAccessor<K, T extends IOseeStorable> implements IOseeDataAccessor<K, T> { private boolean wasLoadCalled = false; private boolean wasStoreCalled = false; @@ -43,7 +43,7 @@ public class MockOseeDataAccessor<T extends IOseeStorable> implements IOseeDataA @SuppressWarnings("unused") @Override - public void load(IOseeCache<T> cache) throws OseeCoreException { + public void load(IOseeCache<K, T> cache) throws OseeCoreException { Assert.assertNotNull(cache); setLoadCalled(true); } diff --git a/plugins/org.eclipse.osee.framework.core.model.test/src/org/eclipse/osee/framework/core/model/mocks/ModelAsserts.java b/plugins/org.eclipse.osee.framework.core.model.test/src/org/eclipse/osee/framework/core/model/mocks/ModelAsserts.java index 692c54d4780..9809f7c6425 100644 --- a/plugins/org.eclipse.osee.framework.core.model.test/src/org/eclipse/osee/framework/core/model/mocks/ModelAsserts.java +++ b/plugins/org.eclipse.osee.framework.core.model.test/src/org/eclipse/osee/framework/core/model/mocks/ModelAsserts.java @@ -15,7 +15,6 @@ import java.lang.reflect.Method; import java.util.ArrayList; import java.util.Collection; import java.util.List; -import org.junit.Assert; import org.eclipse.osee.framework.core.data.IArtifactType; import org.eclipse.osee.framework.core.data.IAttributeType; import org.eclipse.osee.framework.core.enums.BranchState; @@ -35,6 +34,7 @@ import org.eclipse.osee.framework.core.model.type.ArtifactType; import org.eclipse.osee.framework.core.model.type.AttributeType; import org.eclipse.osee.framework.core.model.type.OseeEnumType; import org.eclipse.osee.framework.core.model.type.RelationType; +import org.junit.Assert; /** * @author Roberto E. Escobar @@ -45,7 +45,7 @@ public class ModelAsserts { // Utility Class } - public static void assertTypeSetGet(AbstractOseeType type, String fieldName, String getMethodName, String setMethodName, Object expectedValue, Object newValue) throws Exception { + public static void assertTypeSetGet(AbstractOseeType<?> type, String fieldName, String getMethodName, String setMethodName, Object expectedValue, Object newValue) throws Exception { Method getMethod = type.getClass().getMethod(getMethodName); Method setMethod = type.getClass().getMethod(setMethodName, expectedValue.getClass()); @@ -135,7 +135,7 @@ public class ModelAsserts { } } - public static RelationType createRelationType(AbstractOseeCache<ArtifactType> artCache, String guid, String name, String aGUID, String bGUID, RelationTypeMultiplicity multiplicity) throws OseeCoreException { + public static RelationType createRelationType(AbstractOseeCache<String, ArtifactType> artCache, String guid, String name, String aGUID, String bGUID, RelationTypeMultiplicity multiplicity) throws OseeCoreException { IArtifactType type1 = artCache.getByGuid(aGUID); IArtifactType type2 = artCache.getByGuid(bGUID); RelationType relationType = @@ -220,7 +220,7 @@ public class ModelAsserts { Assert.assertEquals(expected.getGuid(), actual.getGuid()); } - public static void checkInheritance(AbstractOseeCache<ArtifactType> artCache, String artTypeGuid, String... superTypeGuids) throws OseeCoreException { + public static void checkInheritance(AbstractOseeCache<String, ArtifactType> artCache, String artTypeGuid, String... superTypeGuids) throws OseeCoreException { ArtifactType target = artCache.getByGuid(artTypeGuid); Assert.assertNotNull(target); @@ -243,7 +243,7 @@ public class ModelAsserts { } } - public static void checkDescendants(AbstractOseeCache<ArtifactType> artCache, String artTypeGuid, boolean isAllLevels, String... descendantGuids) throws OseeCoreException { + public static void checkDescendants(AbstractOseeCache<String, ArtifactType> artCache, String artTypeGuid, boolean isAllLevels, String... descendantGuids) throws OseeCoreException { ArtifactType target = artCache.getByGuid(artTypeGuid); Assert.assertNotNull(target); @@ -272,7 +272,7 @@ public class ModelAsserts { } } - public static void checkAttributes(AbstractOseeCache<ArtifactType> artCache, AbstractOseeCache<AttributeType> attrCache, String artTypeGuid, Branch branch, String... attributeGuids) throws OseeCoreException { + public static void checkAttributes(AbstractOseeCache<String, ArtifactType> artCache, AbstractOseeCache<String, AttributeType> attrCache, String artTypeGuid, Branch branch, String... attributeGuids) throws OseeCoreException { ArtifactType artifactType = artCache.getByGuid(artTypeGuid); Assert.assertNotNull(artifactType); @@ -299,7 +299,7 @@ public class ModelAsserts { artifactType.getName(), branch.getName(), typesNotFound), typesNotFound.isEmpty()); } - public static void checkRelationTypeInheritance(AbstractOseeCache<RelationType> cache, AbstractOseeCache<ArtifactType> artCache, String relGuid, RelationSide relationSide, int maxValue, String... artifactTypesAllowed) throws OseeCoreException { + public static void checkRelationTypeInheritance(AbstractOseeCache<String, RelationType> cache, AbstractOseeCache<String, ArtifactType> artCache, String relGuid, RelationSide relationSide, int maxValue, String... artifactTypesAllowed) throws OseeCoreException { RelationType relationType = cache.getByGuid(relGuid); Assert.assertNotNull(relationType); diff --git a/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/AbstractOseeType.java b/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/AbstractOseeType.java index cc8de7b6e04..d3fddce3c45 100644 --- a/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/AbstractOseeType.java +++ b/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/AbstractOseeType.java @@ -22,7 +22,7 @@ import org.eclipse.osee.framework.core.model.internal.fields.UniqueIdField; import org.eclipse.osee.framework.core.util.Conditions; import org.eclipse.osee.framework.logging.OseeLog; -public abstract class AbstractOseeType extends NamedIdentity implements IOseeStorable { +public abstract class AbstractOseeType<KEY> extends NamedIdentity<KEY> implements IOseeStorable { public static final String NAME_FIELD_KEY = "osee.name.field"; public static final String UNIQUE_ID_FIELD_KEY = "osee.unique.id.field"; @@ -30,7 +30,7 @@ public abstract class AbstractOseeType extends NamedIdentity implements IOseeSto private StorageState itemState; private final Map<String, IOseeField<?>> fieldMap; - protected AbstractOseeType(String guid, String name) { + protected AbstractOseeType(KEY guid, String name) { super(guid, name); this.fieldMap = new HashMap<String, IOseeField<?>>(); this.itemState = StorageState.CREATED; diff --git a/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/Branch.java b/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/Branch.java index 92bf555bb84..d3458ca939e 100644 --- a/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/Branch.java +++ b/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/Branch.java @@ -32,7 +32,7 @@ import org.eclipse.osee.framework.jdk.core.util.Strings; /** * @author Roberto E. Escobar */ -public class Branch extends AbstractOseeType implements IAdaptable, IOseeBranch { +public class Branch extends AbstractOseeType<String> implements IAdaptable, IOseeBranch { private static final int SHORT_NAME_LIMIT = 35; diff --git a/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/BranchFactory.java b/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/BranchFactory.java index 26541c622b8..2fc45bfa914 100644 --- a/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/BranchFactory.java +++ b/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/BranchFactory.java @@ -39,7 +39,7 @@ public class BranchFactory implements IOseeTypeFactory { return toReturn; } - public Branch createOrUpdate(AbstractOseeCache<Branch> cache, String guid, String name, BranchType branchType, BranchState branchState, boolean isArchived) throws OseeCoreException { + public Branch createOrUpdate(AbstractOseeCache<String, Branch> cache, String guid, String name, BranchType branchType, BranchState branchState, boolean isArchived) throws OseeCoreException { Branch branch = cache.getByGuid(guid); if (branch == null) { branch = create(guid, name, branchType, branchState, isArchived); @@ -54,7 +54,7 @@ public class BranchFactory implements IOseeTypeFactory { return branch; } - public Branch createOrUpdate(IOseeCache<Branch> cache, int uniqueId, StorageState storageState, String guid, String name, BranchType branchType, BranchState branchState, boolean isArchived) throws OseeCoreException { + public Branch createOrUpdate(IOseeCache<String, Branch> cache, int uniqueId, StorageState storageState, String guid, String name, BranchType branchType, BranchState branchState, boolean isArchived) throws OseeCoreException { Branch branch = cache.getById(uniqueId); if (branch == null) { branch = create(guid, name, branchType, branchState, isArchived); diff --git a/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/DefaultBasicArtifact.java b/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/DefaultBasicArtifact.java index ff140245707..e72de05c693 100644 --- a/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/DefaultBasicArtifact.java +++ b/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/DefaultBasicArtifact.java @@ -16,7 +16,7 @@ import org.eclipse.osee.framework.core.model.type.ArtifactType; /** * @author Roberto E. Escobar */ -public final class DefaultBasicArtifact extends NamedIdentity implements IBasicArtifact<Object> { +public final class DefaultBasicArtifact extends NamedIdentity<String> implements IBasicArtifact<Object> { private static final long serialVersionUID = -4997763989583925345L; private final int artId; diff --git a/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/OseeCachingService.java b/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/OseeCachingService.java index ca75f1a5fe9..3d594d8e167 100644 --- a/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/OseeCachingService.java +++ b/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/OseeCachingService.java @@ -37,7 +37,7 @@ public class OseeCachingService implements IOseeCachingService { private final AttributeTypeCache attributeTypeCache; private final RelationTypeCache relationTypeCache; private final OseeEnumTypeCache oseeEnumTypeCache; - private final Collection<IOseeCache<?>> caches; + private final Collection<IOseeCache<?, ?>> caches; public OseeCachingService(BranchCache branchCache, TransactionCache transactionCache, ArtifactTypeCache artifactTypeCache, AttributeTypeCache attributeTypeCache, RelationTypeCache relationTypeCache, OseeEnumTypeCache oseeEnumTypeCache) { this.branchCache = branchCache; @@ -46,7 +46,7 @@ public class OseeCachingService implements IOseeCachingService { this.attributeTypeCache = attributeTypeCache; this.relationTypeCache = relationTypeCache; this.oseeEnumTypeCache = oseeEnumTypeCache; - caches = new HashSet<IOseeCache<?>>(); + caches = new HashSet<IOseeCache<?, ?>>(); caches.add(branchCache); caches.add(transactionCache); caches.add(artifactTypeCache); @@ -86,14 +86,14 @@ public class OseeCachingService implements IOseeCachingService { } @Override - public Collection<IOseeCache<?>> getCaches() { + public Collection<IOseeCache<?, ?>> getCaches() { return caches; } @Override - public IOseeCache<?> getCache(OseeCacheEnum cacheId) throws OseeCoreException { + public IOseeCache<?, ?> getCache(OseeCacheEnum cacheId) throws OseeCoreException { Conditions.checkNotNull(cacheId, "cache id to find"); - for (IOseeCache<?> cache : getCaches()) { + for (IOseeCache<?, ?> cache : getCaches()) { if (cache.getCacheId().equals(cacheId)) { return cache; } diff --git a/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/OseeEnumEntry.java b/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/OseeEnumEntry.java index 1444ff4cc96..e592b6bb4ff 100644 --- a/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/OseeEnumEntry.java +++ b/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/OseeEnumEntry.java @@ -15,7 +15,7 @@ import org.eclipse.osee.framework.jdk.core.type.Pair; /** * @author Roberto E. Escobar */ -public class OseeEnumEntry extends AbstractOseeType { +public class OseeEnumEntry extends AbstractOseeType<String> { private final static String ENUM_ENTRY_ORDINAL_FIELD = "osee.enum.entry.ordinal.field"; public OseeEnumEntry(String guid, String name, int ordinal) { diff --git a/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/RelationTypeSide.java b/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/RelationTypeSide.java index 1f1c7b41cb0..b4d8f7f5276 100644 --- a/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/RelationTypeSide.java +++ b/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/RelationTypeSide.java @@ -19,7 +19,7 @@ import org.eclipse.osee.framework.core.enums.RelationSide; /** * @author Andrew M. Finkbeiner */ -public class RelationTypeSide extends NamedIdentity implements IRelationTypeSide { +public class RelationTypeSide extends NamedIdentity<String> implements IRelationTypeSide { private final IRelationType type; private final RelationSide side; diff --git a/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/cache/AbstractOseeCache.java b/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/cache/AbstractOseeCache.java index 78242798818..144523c6974 100644 --- a/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/cache/AbstractOseeCache.java +++ b/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/cache/AbstractOseeCache.java @@ -34,20 +34,20 @@ import org.eclipse.osee.framework.logging.OseeLog; /** * @author Roberto E. Escobar */ -public abstract class AbstractOseeCache<T extends AbstractOseeType> implements IOseeCache<T> { +public abstract class AbstractOseeCache<K, T extends AbstractOseeType<K>> implements IOseeCache<K, T> { private final HashCollection<String, T> nameToTypeMap = new HashCollection<String, T>(true, HashCollection.DEFAULT_COLLECTION_TYPE); private final Map<Integer, T> idToTypeMap = new ConcurrentHashMap<Integer, T>(); - private final Map<String, T> guidToTypeMap = new ConcurrentHashMap<String, T>(); + private final Map<K, T> guidToTypeMap = new ConcurrentHashMap<K, T>(); - private final IOseeDataAccessor<T> dataAccessor; + private final IOseeDataAccessor<K, T> dataAccessor; private final OseeCacheEnum cacheId; private final boolean uniqueName; private boolean ensurePopulatedRanOnce; private long lastLoaded; private boolean ignoreEnsurePopulateException; - protected AbstractOseeCache(OseeCacheEnum cacheId, IOseeDataAccessor<T> dataAccessor, boolean uniqueName) { + protected AbstractOseeCache(OseeCacheEnum cacheId, IOseeDataAccessor<K, T> dataAccessor, boolean uniqueName) { this.lastLoaded = 0; this.cacheId = cacheId; this.ensurePopulatedRanOnce = false; @@ -87,11 +87,11 @@ public abstract class AbstractOseeCache<T extends AbstractOseeType> implements I return guidToTypeMap.size(); } - protected IOseeDataAccessor<T> getDataAccessor() { + protected IOseeDataAccessor<K, T> getDataAccessor() { return dataAccessor; } - public boolean existsByGuid(String guid) throws OseeCoreException { + public boolean existsByGuid(K guid) throws OseeCoreException { ensurePopulated(); return guidToTypeMap.containsKey(guid); } @@ -229,15 +229,17 @@ public abstract class AbstractOseeCache<T extends AbstractOseeType> implements I } @Override - public T getByGuid(String guid) throws OseeCoreException { + public T getByGuid(Object guid) throws OseeCoreException { ensurePopulated(); - if (!GUID.isValid(guid)) { - throw new OseeArgumentException("[%s] is not a valid guid", guid); + if (guid instanceof String) { + if (!GUID.isValid((String) guid)) { + throw new OseeArgumentException("[%s] is not a valid guid", guid); + } } return guidToTypeMap.get(guid); } - public T get(Identity token) throws OseeCoreException { + public T get(Identity<K> token) throws OseeCoreException { ensurePopulated(); return getByGuid(token.getGuid()); } @@ -273,11 +275,11 @@ public abstract class AbstractOseeCache<T extends AbstractOseeType> implements I } } - public void storeByGuid(Collection<String> guids) throws OseeCoreException { + public void storeByGuid(Collection<K> guids) throws OseeCoreException { ensurePopulated(); Conditions.checkNotNull(guids, "guids to store"); Collection<T> items = new HashSet<T>(); - for (String guid : guids) { + for (K guid : guids) { T type = getByGuid(guid); if (type == null) { throw new OseeTypeDoesNotExist(String.format("Item was not found [%s]", guid)); diff --git a/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/cache/ArtifactTypeCache.java b/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/cache/ArtifactTypeCache.java index 55d7a97e98f..f6fa364cdfe 100644 --- a/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/cache/ArtifactTypeCache.java +++ b/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/cache/ArtifactTypeCache.java @@ -16,9 +16,9 @@ import org.eclipse.osee.framework.core.model.type.ArtifactType; /** * @author Roberto E. Escobar */ -public final class ArtifactTypeCache extends AbstractOseeCache<ArtifactType> { +public final class ArtifactTypeCache extends AbstractOseeCache<String, ArtifactType> { - public ArtifactTypeCache(IOseeDataAccessor<ArtifactType> dataAccessor) { + public ArtifactTypeCache(IOseeDataAccessor<String, ArtifactType> dataAccessor) { super(OseeCacheEnum.ARTIFACT_TYPE_CACHE, dataAccessor, true); } diff --git a/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/cache/AttributeTypeCache.java b/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/cache/AttributeTypeCache.java index feb3f70b15b..caad99e70da 100644 --- a/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/cache/AttributeTypeCache.java +++ b/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/cache/AttributeTypeCache.java @@ -16,9 +16,9 @@ import org.eclipse.osee.framework.core.model.type.AttributeType; /** * @author Roberto E. Escobar */ -public final class AttributeTypeCache extends AbstractOseeCache<AttributeType> { +public final class AttributeTypeCache extends AbstractOseeCache<String, AttributeType> { - public AttributeTypeCache(IOseeDataAccessor<AttributeType> dataAccessor) { + public AttributeTypeCache(IOseeDataAccessor<String, AttributeType> dataAccessor) { super(OseeCacheEnum.ATTRIBUTE_TYPE_CACHE, dataAccessor, true); } } diff --git a/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/cache/BranchCache.java b/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/cache/BranchCache.java index 2db590a6d1c..26e86ececff 100644 --- a/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/cache/BranchCache.java +++ b/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/cache/BranchCache.java @@ -24,9 +24,9 @@ import org.eclipse.osee.framework.core.util.Conditions; * @author Roberto E. Escobar * @author Ryan D. Brooks */ -public class BranchCache extends AbstractOseeCache<Branch> { +public class BranchCache extends AbstractOseeCache<String, Branch> { - public BranchCache(IOseeDataAccessor<Branch> dataAccessor) { + public BranchCache(IOseeDataAccessor<String, Branch> dataAccessor) { super(OseeCacheEnum.BRANCH_CACHE, dataAccessor, false); } diff --git a/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/cache/IOseeCache.java b/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/cache/IOseeCache.java index 965841ecf7c..dcc04e63185 100644 --- a/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/cache/IOseeCache.java +++ b/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/cache/IOseeCache.java @@ -17,7 +17,7 @@ import org.eclipse.osee.framework.core.exception.OseeCoreException; /** * @author Roberto E. Escobar */ -public interface IOseeCache<T> { +public interface IOseeCache<KEY, TYPE> { OseeCacheEnum getCacheId(); @@ -29,27 +29,27 @@ public interface IOseeCache<T> { void decacheAll(); - void decache(T... types) throws OseeCoreException; + void decache(TYPE... types) throws OseeCoreException; - void decache(T type) throws OseeCoreException; + void decache(TYPE type) throws OseeCoreException; - void cache(T... types) throws OseeCoreException; + void cache(TYPE... types) throws OseeCoreException; - void cache(T type) throws OseeCoreException; + void cache(TYPE type) throws OseeCoreException; - Collection<T> getAll() throws OseeCoreException; + Collection<TYPE> getAll() throws OseeCoreException; - T getById(int typeId) throws OseeCoreException; + TYPE getById(int typeId) throws OseeCoreException; - T getByGuid(String guid) throws OseeCoreException; + TYPE getByGuid(KEY guid) throws OseeCoreException; - Collection<T> getAllDirty() throws OseeCoreException; + Collection<TYPE> getAllDirty() throws OseeCoreException; void storeAllModified() throws OseeCoreException; void ensurePopulated() throws OseeCoreException; - void storeItems(T... items) throws OseeCoreException; + void storeItems(TYPE... items) throws OseeCoreException; - void storeItems(Collection<T> toStore) throws OseeCoreException; + void storeItems(Collection<TYPE> toStore) throws OseeCoreException; } diff --git a/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/cache/IOseeDataAccessor.java b/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/cache/IOseeDataAccessor.java index 888e691868c..5f98d0c7600 100644 --- a/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/cache/IOseeDataAccessor.java +++ b/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/cache/IOseeDataAccessor.java @@ -17,9 +17,9 @@ import org.eclipse.osee.framework.core.model.IOseeStorable; /** * @author Roberto E. Escobar */ -public interface IOseeDataAccessor<T extends IOseeStorable> { +public interface IOseeDataAccessor<K, T extends IOseeStorable> { - public void load(IOseeCache<T> cache) throws OseeCoreException; + public void load(IOseeCache<K, T> cache) throws OseeCoreException; public void store(Collection<T> types) throws OseeCoreException; } diff --git a/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/cache/OseeEnumTypeCache.java b/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/cache/OseeEnumTypeCache.java index d003cf5ad9c..fe5d9a83672 100644 --- a/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/cache/OseeEnumTypeCache.java +++ b/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/cache/OseeEnumTypeCache.java @@ -16,9 +16,9 @@ import org.eclipse.osee.framework.core.model.type.OseeEnumType; /** * @author Roberto E. Escobar */ -public final class OseeEnumTypeCache extends AbstractOseeCache<OseeEnumType> { +public final class OseeEnumTypeCache extends AbstractOseeCache<String, OseeEnumType> { - public OseeEnumTypeCache(IOseeDataAccessor<OseeEnumType> dataAccessor) { + public OseeEnumTypeCache(IOseeDataAccessor<String, OseeEnumType> dataAccessor) { super(OseeCacheEnum.OSEE_ENUM_TYPE_CACHE, dataAccessor, true); } diff --git a/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/cache/RelationTypeCache.java b/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/cache/RelationTypeCache.java index 8b6effcc514..a34ab1f0cc5 100644 --- a/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/cache/RelationTypeCache.java +++ b/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/cache/RelationTypeCache.java @@ -16,9 +16,9 @@ import org.eclipse.osee.framework.core.model.type.RelationType; /** * @author Roberto E. Escobar */ -public final class RelationTypeCache extends AbstractOseeCache<RelationType> { +public final class RelationTypeCache extends AbstractOseeCache<String, RelationType> { - public RelationTypeCache(IOseeDataAccessor<RelationType> dataAccessor) { + public RelationTypeCache(IOseeDataAccessor<String, RelationType> dataAccessor) { super(OseeCacheEnum.RELATION_TYPE_CACHE, dataAccessor, true); } } diff --git a/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/cache/TransactionCache.java b/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/cache/TransactionCache.java index 698198014b3..5171a28ea45 100644 --- a/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/cache/TransactionCache.java +++ b/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/cache/TransactionCache.java @@ -30,7 +30,7 @@ import org.eclipse.osee.framework.logging.OseeLog; /** * @author Roberto E. Escobar */ -public class TransactionCache implements IOseeCache<TransactionRecord> { +public class TransactionCache implements IOseeCache<String, TransactionRecord> { private ITransactionDataAccessor accessor; private final Map<Integer, TransactionRecord> transactionIdCache = diff --git a/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/type/ArtifactType.java b/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/type/ArtifactType.java index 3500c53fdcc..5ac1ca97f9e 100644 --- a/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/type/ArtifactType.java +++ b/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/type/ArtifactType.java @@ -30,7 +30,7 @@ import org.eclipse.osee.framework.core.model.internal.fields.ArtifactTypeAttribu /** * @author Robert A. Fisher */ -public final class ArtifactType extends AbstractOseeType implements IArtifactType { +public final class ArtifactType extends AbstractOseeType<String> implements IArtifactType { public static final String ARTIFACT_IS_ABSTRACT_FIELD_KEY = "osee.artifact.type.is.abstract.field"; public static final String ARTIFACT_INHERITANCE_FIELD_KEY = "osee.artifact.type.inheritance.field"; diff --git a/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/type/ArtifactTypeFactory.java b/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/type/ArtifactTypeFactory.java index e5aa9db669c..5ae2690e572 100644 --- a/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/type/ArtifactTypeFactory.java +++ b/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/type/ArtifactTypeFactory.java @@ -41,7 +41,7 @@ public final class ArtifactTypeFactory implements IOseeTypeFactory { return artifactType; } - public ArtifactType createOrUpdate(IOseeCache<ArtifactType> cache, int uniqueId, StorageState storageState, String guid, boolean isAbstract, String name) throws OseeCoreException { + public ArtifactType createOrUpdate(IOseeCache<String, ArtifactType> cache, int uniqueId, StorageState storageState, String guid, boolean isAbstract, String name) throws OseeCoreException { ArtifactType artifactType = cache.getById(uniqueId); if (artifactType == null) { artifactType = create(guid, isAbstract, name); diff --git a/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/type/AttributeType.java b/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/type/AttributeType.java index 071e2e7a2a1..966ddd1899f 100644 --- a/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/type/AttributeType.java +++ b/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/type/AttributeType.java @@ -22,7 +22,7 @@ import org.eclipse.osee.framework.jdk.core.util.Strings; * @author Robert A. Fisher * @author Ryan D. Brooks */ -public final class AttributeType extends AbstractOseeType implements IAttributeType { +public final class AttributeType extends AbstractOseeType<String> implements IAttributeType { private static final String ATTRIBUTE_BASE_TYPE_ID_FIELD_KEY = "osee.base.attribute.type.id.field"; private static final String ATTRIBUTE_PROVIDER_ID_FIELD_KEY = "osee.attribute.provider.id.field"; diff --git a/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/type/AttributeTypeFactory.java b/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/type/AttributeTypeFactory.java index fc1982b1d92..3159c37b729 100644 --- a/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/type/AttributeTypeFactory.java +++ b/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/type/AttributeTypeFactory.java @@ -59,7 +59,7 @@ public class AttributeTypeFactory implements IOseeTypeFactory { return attributeType; } - public AttributeType createOrUpdate(IOseeCache<AttributeType> cache, int uniqueId, StorageState storageState, String guid, String typeName, String baseAttributeTypeId, String attributeProviderNameId, String fileTypeExtension, String defaultValue, OseeEnumType oseeEnumType, int minOccurrences, int maxOccurrences, String description, String taggerId) throws OseeCoreException { + public AttributeType createOrUpdate(IOseeCache<String, AttributeType> cache, int uniqueId, StorageState storageState, String guid, String typeName, String baseAttributeTypeId, String attributeProviderNameId, String fileTypeExtension, String defaultValue, OseeEnumType oseeEnumType, int minOccurrences, int maxOccurrences, String description, String taggerId) throws OseeCoreException { AttributeType attributeType = cache.getById(uniqueId); if (attributeType == null) { attributeType = diff --git a/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/type/OseeEnumType.java b/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/type/OseeEnumType.java index 3e2020ffb63..166aa5cd5e0 100644 --- a/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/type/OseeEnumType.java +++ b/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/type/OseeEnumType.java @@ -29,7 +29,7 @@ import org.eclipse.osee.framework.core.model.internal.fields.EnumEntryField; * * @author Roberto E. Escobar */ -public class OseeEnumType extends AbstractOseeType { +public class OseeEnumType extends AbstractOseeType<String> { public static final String OSEE_ENUM_TYPE_ENTRIES_FIELD = "osee.enum.type.entries.field"; diff --git a/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/type/OseeEnumTypeFactory.java b/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/type/OseeEnumTypeFactory.java index c190d65f478..101cbfcc8c2 100644 --- a/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/type/OseeEnumTypeFactory.java +++ b/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/type/OseeEnumTypeFactory.java @@ -37,7 +37,7 @@ public class OseeEnumTypeFactory implements IOseeTypeFactory { return new OseeEnumEntry(checkedGuid, name, ordinal); } - public OseeEnumType createOrUpdate(IOseeCache<OseeEnumType> cache, int enumTypeId, StorageState storageState, String guid, String enumTypeName) throws OseeCoreException { + public OseeEnumType createOrUpdate(IOseeCache<String, OseeEnumType> cache, int enumTypeId, StorageState storageState, String guid, String enumTypeName) throws OseeCoreException { OseeEnumType oseeEnumType = cache.getById(enumTypeId); if (oseeEnumType == null) { oseeEnumType = createEnumType(guid, enumTypeName); @@ -63,8 +63,8 @@ public class OseeEnumTypeFactory implements IOseeTypeFactory { return oseeEnumType; } - public OseeEnumEntry createOrUpdate(IOseeCache<OseeEnumType> cache, String enumTypeGuid, String enumEntryGuid, String enumEntryName, int ordinal) throws OseeCoreException { - OseeEnumType oseeEnumType = ((AbstractOseeCache<OseeEnumType>) cache).getByGuid(enumTypeGuid); + public OseeEnumEntry createOrUpdate(IOseeCache<String, OseeEnumType> cache, String enumTypeGuid, String enumEntryGuid, String enumEntryName, int ordinal) throws OseeCoreException { + OseeEnumType oseeEnumType = ((AbstractOseeCache<String, OseeEnumType>) cache).getByGuid(enumTypeGuid); OseeEnumEntry enumEntry = oseeEnumType.getEntryByGuid(enumEntryGuid); if (enumEntry == null) { enumEntry = createEnumEntry(enumEntryGuid, enumEntryName, ordinal); diff --git a/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/type/RelationType.java b/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/type/RelationType.java index 2bb9742f144..5efbaa7ceed 100644 --- a/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/type/RelationType.java +++ b/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/type/RelationType.java @@ -22,7 +22,7 @@ import org.eclipse.osee.framework.core.model.OseeField; /** * @author Robert A. Fisher */ -public final class RelationType extends AbstractOseeType implements IRelationType { +public final class RelationType extends AbstractOseeType<String> implements IRelationType { private static final String RELATION_SIDE_A_NAME_FIELD_KEY = "osee.relation.type.side.a.name.field"; private static final String RELATION_SIDE_B_NAME_FIELD_KEY = "osee.relation.type.side.b.name.field"; diff --git a/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/type/RelationTypeFactory.java b/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/type/RelationTypeFactory.java index 4e972b97c5a..ffce5ca7207 100644 --- a/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/type/RelationTypeFactory.java +++ b/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/type/RelationTypeFactory.java @@ -51,7 +51,7 @@ public class RelationTypeFactory implements IOseeTypeFactory { return relationType; } - public RelationType createOrUpdate(IOseeCache<RelationType> cache, int typeId, StorageState storageState, String guid, String typeName, String sideAName, String sideBName, IArtifactType artifactTypeSideA, IArtifactType artifactTypeSideB, RelationTypeMultiplicity multiplicity, String defaultOrderTypeGuid) throws OseeCoreException { + public RelationType createOrUpdate(IOseeCache<String, RelationType> cache, int typeId, StorageState storageState, String guid, String typeName, String sideAName, String sideBName, IArtifactType artifactTypeSideA, IArtifactType artifactTypeSideB, RelationTypeMultiplicity multiplicity, String defaultOrderTypeGuid) throws OseeCoreException { RelationType relationType = cache.getById(typeId); if (relationType == null) { relationType = diff --git a/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/services/IOseeCachingService.java b/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/services/IOseeCachingService.java index d98d182ba27..842eee07762 100644 --- a/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/services/IOseeCachingService.java +++ b/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/services/IOseeCachingService.java @@ -40,7 +40,7 @@ public interface IOseeCachingService { Collection<?> getCaches(); - IOseeCache<?> getCache(OseeCacheEnum cacheId) throws OseeCoreException; + IOseeCache<?, ?> getCache(OseeCacheEnum cacheId) throws OseeCoreException; void reloadAll() throws OseeCoreException; diff --git a/plugins/org.eclipse.osee.framework.core.server.test/src/org/eclipse/osee/framework/core/server/test/internal/session/SessionCacheTest.java b/plugins/org.eclipse.osee.framework.core.server.test/src/org/eclipse/osee/framework/core/server/test/internal/session/SessionCacheTest.java index 813bf144635..bbe66b55425 100644 --- a/plugins/org.eclipse.osee.framework.core.server.test/src/org/eclipse/osee/framework/core/server/test/internal/session/SessionCacheTest.java +++ b/plugins/org.eclipse.osee.framework.core.server.test/src/org/eclipse/osee/framework/core/server/test/internal/session/SessionCacheTest.java @@ -30,9 +30,9 @@ import org.junit.BeforeClass; * * @author Roberto E. Escobar */ -public class SessionCacheTest extends AbstractOseeCacheTest<Session> { +public class SessionCacheTest extends AbstractOseeCacheTest<String, Session> { - private static AbstractOseeCache<Session> cache; + private static AbstractOseeCache<String, Session> cache; private static List<Session> sessionData; @BeforeClass @@ -50,7 +50,7 @@ public class SessionCacheTest extends AbstractOseeCacheTest<Session> { super(sessionData, cache); } - private final static class SessionDataAccessor extends MockOseeDataAccessor<Session> { + private final static class SessionDataAccessor extends MockOseeDataAccessor<String, Session> { private final List<Session> data; @@ -60,7 +60,7 @@ public class SessionCacheTest extends AbstractOseeCacheTest<Session> { } @Override - public void load(IOseeCache<Session> cache) throws OseeCoreException { + public void load(IOseeCache<String, Session> cache) throws OseeCoreException { super.load(cache); int typeId = 100; for (int index = 0; index < 10; index++) { @@ -76,4 +76,9 @@ public class SessionCacheTest extends AbstractOseeCacheTest<Session> { } } } + + @Override + protected String createKey() { + return GUID.create(); + } } diff --git a/plugins/org.eclipse.osee.framework.core.server.test/src/org/eclipse/osee/framework/core/server/test/internal/session/SessionFactoryTest.java b/plugins/org.eclipse.osee.framework.core.server.test/src/org/eclipse/osee/framework/core/server/test/internal/session/SessionFactoryTest.java index ca93aaad905..1c3ebd5f94e 100644 --- a/plugins/org.eclipse.osee.framework.core.server.test/src/org/eclipse/osee/framework/core/server/test/internal/session/SessionFactoryTest.java +++ b/plugins/org.eclipse.osee.framework.core.server.test/src/org/eclipse/osee/framework/core/server/test/internal/session/SessionFactoryTest.java @@ -13,7 +13,6 @@ package org.eclipse.osee.framework.core.server.test.internal.session; import java.util.ArrayList; import java.util.Collection; import java.util.Date; -import org.junit.Assert; import org.eclipse.osee.framework.core.enums.StorageState; import org.eclipse.osee.framework.core.exception.OseeCoreException; import org.eclipse.osee.framework.core.model.IOseeStorable; @@ -23,6 +22,7 @@ import org.eclipse.osee.framework.core.server.internal.session.Session; import org.eclipse.osee.framework.core.server.internal.session.SessionCache; import org.eclipse.osee.framework.core.server.internal.session.SessionFactory; import org.eclipse.osee.framework.core.server.test.mocks.MockBuildTypeIdentifier; +import org.junit.Assert; import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; @@ -157,10 +157,10 @@ public class SessionFactoryTest { return data; } - private static final class MockSessionAccessor implements IOseeDataAccessor<Session> { + private static final class MockSessionAccessor implements IOseeDataAccessor<String, Session> { @Override - public void load(IOseeCache<Session> cache) { + public void load(IOseeCache<String, Session> cache) { // Do Nothing } diff --git a/plugins/org.eclipse.osee.framework.core.server.test/src/org/eclipse/osee/framework/core/server/test/internal/session/SessionManagerTest.java b/plugins/org.eclipse.osee.framework.core.server.test/src/org/eclipse/osee/framework/core/server/test/internal/session/SessionManagerTest.java index 593820ee934..89b651ee4d4 100644 --- a/plugins/org.eclipse.osee.framework.core.server.test/src/org/eclipse/osee/framework/core/server/test/internal/session/SessionManagerTest.java +++ b/plugins/org.eclipse.osee.framework.core.server.test/src/org/eclipse/osee/framework/core/server/test/internal/session/SessionManagerTest.java @@ -33,7 +33,7 @@ public class SessionManagerTest { SessionFactory factory = null; ISessionQuery query = null; IAuthenticationManager authenticator = null; - MockOseeDataAccessor<Session> accessor = new MockOseeDataAccessor<Session>(); + MockOseeDataAccessor<String, Session> accessor = new MockOseeDataAccessor<String, Session>(); SessionCache sessionCache = new SessionCache(accessor); new SessionManagerImpl("ABCD", factory, query, sessionCache, authenticator); diff --git a/plugins/org.eclipse.osee.framework.core.server/src/org/eclipse/osee/framework/core/server/internal/session/DatabaseSessionAccessor.java b/plugins/org.eclipse.osee.framework.core.server/src/org/eclipse/osee/framework/core/server/internal/session/DatabaseSessionAccessor.java index 1487cd03b62..84a64ea6dd1 100644 --- a/plugins/org.eclipse.osee.framework.core.server/src/org/eclipse/osee/framework/core/server/internal/session/DatabaseSessionAccessor.java +++ b/plugins/org.eclipse.osee.framework.core.server/src/org/eclipse/osee/framework/core/server/internal/session/DatabaseSessionAccessor.java @@ -23,7 +23,7 @@ import org.eclipse.osee.framework.database.IOseeDatabaseService; /** * @author Roberto E. Escobar */ -public final class DatabaseSessionAccessor implements IOseeDataAccessor<Session> { +public final class DatabaseSessionAccessor implements IOseeDataAccessor<String, Session> { private static final String INSERT_SESSION = "INSERT INTO osee_session (managed_by_server_id, session_id, user_id, client_machine_name, client_address, client_port, client_version, created_on, last_interaction_date, last_interaction) VALUES (?,?,?,?,?,?,?,?,?,?)"; @@ -89,7 +89,7 @@ public final class DatabaseSessionAccessor implements IOseeDataAccessor<Session> } @Override - public void load(IOseeCache<Session> cache) throws OseeCoreException { + public void load(IOseeCache<String, Session> cache) throws OseeCoreException { CacheSessionCollector collector = new CacheSessionCollector(cache); getSessionQuery().selectServerManagedSessions(collector); } @@ -126,9 +126,9 @@ public final class DatabaseSessionAccessor implements IOseeDataAccessor<Session> } private final class CacheSessionCollector implements ISessionCollector { - private final IOseeCache<Session> cache; + private final IOseeCache<String, Session> cache; - public CacheSessionCollector(IOseeCache<Session> cache) { + public CacheSessionCollector(IOseeCache<String, Session> cache) { this.cache = cache; } diff --git a/plugins/org.eclipse.osee.framework.core.server/src/org/eclipse/osee/framework/core/server/internal/session/Session.java b/plugins/org.eclipse.osee.framework.core.server/src/org/eclipse/osee/framework/core/server/internal/session/Session.java index c115dadab07..556cf698839 100644 --- a/plugins/org.eclipse.osee.framework.core.server/src/org/eclipse/osee/framework/core/server/internal/session/Session.java +++ b/plugins/org.eclipse.osee.framework.core.server/src/org/eclipse/osee/framework/core/server/internal/session/Session.java @@ -19,7 +19,7 @@ import org.eclipse.osee.framework.core.server.ISession; /** * @author Roberto E. Escobar */ -public final class Session extends AbstractOseeType implements ISession { +public final class Session extends AbstractOseeType<String> implements ISession { public static final String SESSION_CREATION_DATE = "session.creation.date"; public static final String SESSION_USER_ID = "session.user.id"; diff --git a/plugins/org.eclipse.osee.framework.core.server/src/org/eclipse/osee/framework/core/server/internal/session/SessionCache.java b/plugins/org.eclipse.osee.framework.core.server/src/org/eclipse/osee/framework/core/server/internal/session/SessionCache.java index f48716e124d..6933d69be86 100644 --- a/plugins/org.eclipse.osee.framework.core.server/src/org/eclipse/osee/framework/core/server/internal/session/SessionCache.java +++ b/plugins/org.eclipse.osee.framework.core.server/src/org/eclipse/osee/framework/core/server/internal/session/SessionCache.java @@ -19,9 +19,9 @@ import org.eclipse.osee.framework.core.model.cache.IOseeDataAccessor; /** * @author Roberto E. Escobar */ -public final class SessionCache extends AbstractOseeCache<Session> { +public final class SessionCache extends AbstractOseeCache<String, Session> { - public SessionCache(IOseeDataAccessor<Session> dataAccessor) { + public SessionCache(IOseeDataAccessor<String, Session> dataAccessor) { super(OseeCacheEnum.SESSION_CACHE, dataAccessor, false); } diff --git a/plugins/org.eclipse.osee.framework.core.server/src/org/eclipse/osee/framework/core/server/internal/session/SessionFactory.java b/plugins/org.eclipse.osee.framework.core.server/src/org/eclipse/osee/framework/core/server/internal/session/SessionFactory.java index eb2fc410b52..f5b14367782 100644 --- a/plugins/org.eclipse.osee.framework.core.server/src/org/eclipse/osee/framework/core/server/internal/session/SessionFactory.java +++ b/plugins/org.eclipse.osee.framework.core.server/src/org/eclipse/osee/framework/core/server/internal/session/SessionFactory.java @@ -37,7 +37,7 @@ public final class SessionFactory implements IOseeTypeFactory { this.typeIdentifier = typeIdentifier; } - public Session createOrUpdate(IOseeCache<Session> cache, int uniqueId, StorageState storageState, String guid, String userId, Date creationDate, String managedByServerId, String clientVersion, String clientMachineName, String clientAddress, int clientPort, Date lastInteractionDate, String lastInteractionDetails) throws OseeCoreException { + public Session createOrUpdate(IOseeCache<String, Session> cache, int uniqueId, StorageState storageState, String guid, String userId, Date creationDate, String managedByServerId, String clientVersion, String clientMachineName, String clientAddress, int clientPort, Date lastInteractionDate, String lastInteractionDetails) throws OseeCoreException { Session session = cache.getById(uniqueId); if (session == null) { session = diff --git a/plugins/org.eclipse.osee.framework.core.server/src/org/eclipse/osee/framework/core/server/internal/session/SessionManagerTrackingHandler.java b/plugins/org.eclipse.osee.framework.core.server/src/org/eclipse/osee/framework/core/server/internal/session/SessionManagerTrackingHandler.java index 4bd74b142cf..f489dee4ebb 100644 --- a/plugins/org.eclipse.osee.framework.core.server/src/org/eclipse/osee/framework/core/server/internal/session/SessionManagerTrackingHandler.java +++ b/plugins/org.eclipse.osee.framework.core.server/src/org/eclipse/osee/framework/core/server/internal/session/SessionManagerTrackingHandler.java @@ -53,7 +53,7 @@ public final class SessionManagerTrackingHandler extends AbstractTrackingHandler SessionFactory sessionFactory = new SessionFactory(identifier); ISessionQuery sessionQuery = new DatabaseSessionQuery(serverId, databaseService); - IOseeDataAccessor<Session> accessor = + IOseeDataAccessor<String, Session> accessor = new DatabaseSessionAccessor(serverId, sessionFactory, sessionQuery, databaseService); SessionCache sessionCache = new SessionCache(accessor); diff --git a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/BranchToken.java b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/BranchToken.java index bbc326298c5..82ac735de83 100644 --- a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/BranchToken.java +++ b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/BranchToken.java @@ -10,7 +10,7 @@ *******************************************************************************/ package org.eclipse.osee.framework.core.data; -public final class BranchToken extends NamedIdentity implements IOseeBranch { +public final class BranchToken extends NamedIdentity<String> implements IOseeBranch { public BranchToken(String guid, String name) { super(guid, name); } diff --git a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/IAccessContextId.java b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/IAccessContextId.java index 0e4be0047e2..211e1c61591 100644 --- a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/IAccessContextId.java +++ b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/IAccessContextId.java @@ -13,6 +13,6 @@ package org.eclipse.osee.framework.core.data; /** * @author Roberto E. Escobar */ -public interface IAccessContextId extends Identity, Named { +public interface IAccessContextId extends Identity<String>, Named { // }
\ No newline at end of file diff --git a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/IArtifactToken.java b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/IArtifactToken.java index 935d0c64d26..122534b1386 100644 --- a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/IArtifactToken.java +++ b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/IArtifactToken.java @@ -13,6 +13,6 @@ package org.eclipse.osee.framework.core.data; /** * @author Donald G. Dunne */ -public interface IArtifactToken extends Identity, FullyNamed, HasArtifactType { +public interface IArtifactToken extends Identity<String>, FullyNamed, HasArtifactType { // composition interface requires no additional methods,fields } diff --git a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/IArtifactType.java b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/IArtifactType.java index cb003f5ae88..a9443b4fb97 100644 --- a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/IArtifactType.java +++ b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/IArtifactType.java @@ -13,6 +13,6 @@ package org.eclipse.osee.framework.core.data; /** * @author Ryan D. Brooks */ -public interface IArtifactType extends Identity, FullyNamed { +public interface IArtifactType extends Identity<String>, FullyNamed { // composition interface requires no additional methods,fields } diff --git a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/IAttributeType.java b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/IAttributeType.java index a9f7e9bdb7d..cf56a1e4a1e 100644 --- a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/IAttributeType.java +++ b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/IAttributeType.java @@ -13,6 +13,6 @@ package org.eclipse.osee.framework.core.data; /** * @author Ryan D. Brooks */ -public interface IAttributeType extends Identity, FullyNamed, HasDescription { +public interface IAttributeType extends Identity<String>, FullyNamed, HasDescription { // composition interface requires no additional methods,fields }
\ No newline at end of file diff --git a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/IOseeBranch.java b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/IOseeBranch.java index 5e6f59e740a..cd2b828daf3 100644 --- a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/IOseeBranch.java +++ b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/IOseeBranch.java @@ -13,6 +13,6 @@ package org.eclipse.osee.framework.core.data; /** * @author Ryan D. Brooks */ -public interface IOseeBranch extends Identity, Named { +public interface IOseeBranch extends Identity<String>, Named { // composition interface requires no additional methods,fields } diff --git a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/IRelationSorterId.java b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/IRelationSorterId.java index eb3311d8f9f..06084f11892 100644 --- a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/IRelationSorterId.java +++ b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/IRelationSorterId.java @@ -13,6 +13,6 @@ package org.eclipse.osee.framework.core.data; /** * @author Andrew M. Finkbeiner */ -public interface IRelationSorterId extends Named, Identity { +public interface IRelationSorterId extends Named, Identity<String> { // composition interface requires no additional methods,fields } diff --git a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/IRelationType.java b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/IRelationType.java index c88bf263a82..e43c5353ba8 100644 --- a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/IRelationType.java +++ b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/IRelationType.java @@ -13,6 +13,6 @@ package org.eclipse.osee.framework.core.data; /** * @author Ryan D. Brooks */ -public interface IRelationType extends Identity, FullyNamed { +public interface IRelationType extends Identity<String>, FullyNamed { // composition interface requires no additional methods,fields } diff --git a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/Identity.java b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/Identity.java index 97e83bf360a..bce2b3766ea 100644 --- a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/Identity.java +++ b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/Identity.java @@ -14,8 +14,8 @@ package org.eclipse.osee.framework.core.data; /** * @author Ryan D. Brooks */ -public interface Identity { - public abstract String getGuid(); +public interface Identity<T> { + public abstract T getGuid(); - public abstract boolean matches(Identity... identities); + public abstract boolean matches(Identity<?>... identities); } diff --git a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/NamedIdentity.java b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/NamedIdentity.java index 3ecf89f43f6..f58988f56c8 100644 --- a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/NamedIdentity.java +++ b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/NamedIdentity.java @@ -12,36 +12,30 @@ package org.eclipse.osee.framework.core.data; import org.eclipse.osee.framework.core.exception.OseeCoreException; -import org.eclipse.osee.framework.jdk.core.util.GUID; /** * @author Ryan D. Brooks */ -public class NamedIdentity implements Identity, FullyNamed, HasDescription { - private final String guid; +public class NamedIdentity<T> implements Identity<T>, FullyNamed, HasDescription { + private T guid; private String name; private final String description; - public NamedIdentity(String name) { - this(null, name); - } - - public NamedIdentity(String guid, String name) { + public NamedIdentity(T guid, String name) { this(guid, name, ""); } - public NamedIdentity(String guid, String name, String description) { + public NamedIdentity(T guid, String name, String description) { + this.guid = guid; if (guid == null) { - this.guid = GUID.create(); - } else { - this.guid = guid; + throw new IllegalArgumentException("uuid cannot be null"); } this.name = name; this.description = description; } @Override - public String getGuid() { + public T getGuid() { return guid; } @@ -63,7 +57,7 @@ public class NamedIdentity implements Identity, FullyNamed, HasDescription { @Override public boolean equals(Object obj) { if (obj instanceof NamedIdentity) { - return getGuid().equals(((NamedIdentity) obj).getGuid()); + return getGuid().equals(((NamedIdentity<?>) obj).getGuid()); } return false; } @@ -79,8 +73,8 @@ public class NamedIdentity implements Identity, FullyNamed, HasDescription { } @Override - public boolean matches(Identity... identities) { - for (Identity identity : identities) { + public boolean matches(Identity<?>... identities) { + for (Identity<?> identity : identities) { if (equals(identity)) { return true; } diff --git a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/OseeSessionGrant.java b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/OseeSessionGrant.java index c185de02393..22ee0a7860e 100644 --- a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/OseeSessionGrant.java +++ b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/OseeSessionGrant.java @@ -13,6 +13,7 @@ package org.eclipse.osee.framework.core.data; import java.io.InputStream; import java.util.Properties; import org.eclipse.osee.framework.core.exception.OseeCoreException; +import org.eclipse.osee.framework.jdk.core.util.GUID; /** * @author Roberto E. Escobar @@ -119,7 +120,7 @@ public class OseeSessionGrant extends BaseExchangeData { } private IUserToken getGrantedUserToken() { - return TokenFactory.createUserToken(null, getString(OSEE_USER_NAME), getString(OSEE_USER_EMAIL), + return TokenFactory.createUserToken(GUID.create(), getString(OSEE_USER_NAME), getString(OSEE_USER_EMAIL), getString(OSEE_USER_ID), backingData.getBoolean(OSEE_IS_USER_ACTIVE), false, false); } diff --git a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/TokenFactory.java b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/TokenFactory.java index 57a3cb8fa5c..f0041a30bbe 100644 --- a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/TokenFactory.java +++ b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/TokenFactory.java @@ -55,19 +55,19 @@ public final class TokenFactory { return new BranchToken(guid, name); } - private final static class ArtifactTypeToken extends NamedIdentity implements IArtifactType { + private final static class ArtifactTypeToken extends NamedIdentity<String> implements IArtifactType { public ArtifactTypeToken(String guid, String name) { super(guid, name); } } - private static final class BranchToken extends NamedIdentity implements IOseeBranch { + private static final class BranchToken extends NamedIdentity<String> implements IOseeBranch { public BranchToken(String guid, String name) { super(guid, name); } } - private final static class AttributeTypeToken extends NamedIdentity implements IAttributeType { + private final static class AttributeTypeToken extends NamedIdentity<String> implements IAttributeType { public AttributeTypeToken(String guid, String name) { super(guid, name); } @@ -77,13 +77,13 @@ public final class TokenFactory { } } - private final static class RelationTypeToken extends NamedIdentity implements IRelationType { + private final static class RelationTypeToken extends NamedIdentity<String> implements IRelationType { public RelationTypeToken(String guid, String name) { super(guid, name); } } - private static class ArtifactToken extends NamedIdentity implements IArtifactToken { + private static class ArtifactToken extends NamedIdentity<String> implements IArtifactToken { private final IArtifactType artifactType; public ArtifactToken(String guid, String name, IArtifactType artifactType) { @@ -97,7 +97,7 @@ public final class TokenFactory { } } - private static class UserToken extends NamedIdentity implements IUserToken { + private static class UserToken extends NamedIdentity<String> implements IUserToken { private final String userId; private final boolean active; @@ -146,7 +146,7 @@ public final class TokenFactory { } - private final static class AccessContextIdToken extends NamedIdentity implements IAccessContextId { + private final static class AccessContextIdToken extends NamedIdentity<String> implements IAccessContextId { public AccessContextIdToken(String guid, String name) { super(guid, name); } @@ -157,7 +157,7 @@ public final class TokenFactory { } } - private final static class RelationTypeSideToken extends NamedIdentity implements IRelationTypeSide { + private final static class RelationTypeSideToken extends NamedIdentity<String> implements IRelationTypeSide { private final RelationSide relationSide; private RelationTypeSideToken(String guid, String name, RelationSide relationSide) { diff --git a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/enums/RelationOrderBaseTypes.java b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/enums/RelationOrderBaseTypes.java index 42684e6a3f6..1fa4d0ba5b1 100644 --- a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/enums/RelationOrderBaseTypes.java +++ b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/enums/RelationOrderBaseTypes.java @@ -19,7 +19,7 @@ import org.eclipse.osee.framework.core.util.Conditions; /** * @author Andrew M. Finkbeiner */ -public class RelationOrderBaseTypes extends NamedIdentity implements IRelationSorterId { +public class RelationOrderBaseTypes extends NamedIdentity<String> implements IRelationSorterId { public static final RelationOrderBaseTypes USER_DEFINED = new RelationOrderBaseTypes("AAT0xogoMjMBhARkBZQA", "User Defined"); public static final RelationOrderBaseTypes LEXICOGRAPHICAL_ASC = new RelationOrderBaseTypes("AAT1QW4eVE+YuzsoHFAA", diff --git a/plugins/org.eclipse.osee.framework.server.admin/src/org/eclipse/osee/framework/server/admin/management/UpdateCachesOperation.java b/plugins/org.eclipse.osee.framework.server.admin/src/org/eclipse/osee/framework/server/admin/management/UpdateCachesOperation.java index 2f8e127c809..29133a433a9 100644 --- a/plugins/org.eclipse.osee.framework.server.admin/src/org/eclipse/osee/framework/server/admin/management/UpdateCachesOperation.java +++ b/plugins/org.eclipse.osee.framework.server.admin/src/org/eclipse/osee/framework/server/admin/management/UpdateCachesOperation.java @@ -49,7 +49,7 @@ public class UpdateCachesOperation extends AbstractOperation { Arrays.deepToString(OseeCacheEnum.values()).replaceAll(", SESSION_CACHE", "")); } else { for (OseeCacheEnum cacheId : cacheIds) { - IOseeCache<?> cache = service.getCache(cacheId); + IOseeCache<?, ?> cache = service.getCache(cacheId); if (reload) { cache.reloadCache(); } else { diff --git a/plugins/org.eclipse.osee.framework.skynet.core.test/src/org/eclipse/osee/framework/skynet/core/mocks/MockIArtifact.java b/plugins/org.eclipse.osee.framework.skynet.core.test/src/org/eclipse/osee/framework/skynet/core/mocks/MockIArtifact.java index 53799d1069c..0a97fc9f561 100644 --- a/plugins/org.eclipse.osee.framework.skynet.core.test/src/org/eclipse/osee/framework/skynet/core/mocks/MockIArtifact.java +++ b/plugins/org.eclipse.osee.framework.skynet.core.test/src/org/eclipse/osee/framework/skynet/core/mocks/MockIArtifact.java @@ -22,7 +22,7 @@ import org.eclipse.osee.framework.skynet.core.types.IArtifact; /** * @author Roberto E. Escobar */ -public class MockIArtifact extends NamedIdentity implements IArtifact { +public class MockIArtifact extends NamedIdentity<String> implements IArtifact { private boolean wasGetFullArtifactCalled; private final int uniqueId; diff --git a/plugins/org.eclipse.osee.framework.skynet.core.test/src/org/eclipse/osee/framework/skynet/core/relation/RelationTypeSideSorterTest.java b/plugins/org.eclipse.osee.framework.skynet.core.test/src/org/eclipse/osee/framework/skynet/core/relation/RelationTypeSideSorterTest.java index 9cc9cdfbfaf..2bd99ee383c 100644 --- a/plugins/org.eclipse.osee.framework.skynet.core.test/src/org/eclipse/osee/framework/skynet/core/relation/RelationTypeSideSorterTest.java +++ b/plugins/org.eclipse.osee.framework.skynet.core.test/src/org/eclipse/osee/framework/skynet/core/relation/RelationTypeSideSorterTest.java @@ -20,7 +20,6 @@ import java.util.List; import java.util.Map; import java.util.Map.Entry; import java.util.Random; - import org.eclipse.osee.framework.core.data.IArtifactType; import org.eclipse.osee.framework.core.data.IRelationSorterId; import org.eclipse.osee.framework.core.data.IRelationType; @@ -211,7 +210,7 @@ public class RelationTypeSideSorterTest { RelationSorterProvider provider = new RelationSorterProvider(); IRelationOrderAccessor accessor = new DoNothingAccessor(); - RelationTypeCache cache = new RelationTypeCache(new MockOseeDataAccessor<RelationType>()); + RelationTypeCache cache = new RelationTypeCache(new MockOseeDataAccessor<String, RelationType>()); RelationType relationType1 = createRelationType(cache, "Rel 1", RelationOrderBaseTypes.LEXICOGRAPHICAL_ASC.getGuid()); diff --git a/plugins/org.eclipse.osee.framework.skynet.core.test/src/org/eclipse/osee/framework/skynet/core/relation/order/RelationOrderDataTest.java b/plugins/org.eclipse.osee.framework.skynet.core.test/src/org/eclipse/osee/framework/skynet/core/relation/order/RelationOrderDataTest.java index 5083de05a1b..ca9695beb0f 100644 --- a/plugins/org.eclipse.osee.framework.skynet.core.test/src/org/eclipse/osee/framework/skynet/core/relation/order/RelationOrderDataTest.java +++ b/plugins/org.eclipse.osee.framework.skynet.core.test/src/org/eclipse/osee/framework/skynet/core/relation/order/RelationOrderDataTest.java @@ -15,7 +15,6 @@ import java.util.Arrays; import java.util.List; import java.util.Map.Entry; import java.util.Random; - import org.eclipse.osee.framework.core.data.IArtifactType; import org.eclipse.osee.framework.core.enums.BranchState; import org.eclipse.osee.framework.core.enums.BranchType; @@ -59,7 +58,7 @@ public class RelationOrderDataTest { accessor = new MockRelationOrderAccessor(); data = new RelationOrderData(accessor, artifact); - RelationTypeCache cache = new RelationTypeCache(new MockOseeDataAccessor<RelationType>()); + RelationTypeCache cache = new RelationTypeCache(new MockOseeDataAccessor<String, RelationType>()); relationType1 = createRelationType(cache, "Rel 1", RelationOrderBaseTypes.USER_DEFINED.getGuid()); relationType2 = createRelationType(cache, "Rel 2", RelationOrderBaseTypes.UNORDERED.getGuid()); diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/Artifact.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/Artifact.java index 0273dc1020e..1949467d253 100644 --- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/Artifact.java +++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/Artifact.java @@ -87,7 +87,7 @@ import org.eclipse.osee.framework.skynet.core.types.IArtifact; * {@link ArtifactTest} */ -public class Artifact extends NamedIdentity implements IArtifact, IAdaptable, IBasicGuidArtifact { +public class Artifact extends NamedIdentity<String> implements IArtifact, IAdaptable, IBasicGuidArtifact { public static final String UNNAMED = "Unnamed"; public static final String BEFORE_GUID_STRING = "/BeforeGUID/PrePend"; public static final String AFTER_GUID_STRING = "/AfterGUID"; diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/IATSStateMachineArtifact.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/IATSStateMachineArtifact.java index 81a98d928fa..fc4fa800f25 100644 --- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/IATSStateMachineArtifact.java +++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/IATSStateMachineArtifact.java @@ -15,6 +15,6 @@ import org.eclipse.osee.framework.core.data.Identity; /** * @author Donald G. Dunne */ -public interface IATSStateMachineArtifact extends Identity { +public interface IATSStateMachineArtifact extends Identity<String> { // do nothing } diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/attribute/AttributeTypeManager.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/attribute/AttributeTypeManager.java index 71c512449c4..9df45883afc 100644 --- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/attribute/AttributeTypeManager.java +++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/attribute/AttributeTypeManager.java @@ -35,7 +35,7 @@ import org.eclipse.osee.framework.skynet.core.internal.Activator; */ public class AttributeTypeManager { - public static AbstractOseeCache<AttributeType> getCache() { + public static AbstractOseeCache<String, AttributeType> getCache() { return Activator.getInstance().getOseeCacheService().getAttributeTypeCache(); } diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/attribute/OseeEnumTypeManager.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/attribute/OseeEnumTypeManager.java index 26425e7e121..c3b3f8f8d8a 100644 --- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/attribute/OseeEnumTypeManager.java +++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/attribute/OseeEnumTypeManager.java @@ -24,7 +24,7 @@ import org.eclipse.osee.framework.skynet.core.internal.Activator; */ public class OseeEnumTypeManager { - public static AbstractOseeCache<OseeEnumType> getCache() { + public static AbstractOseeCache<String, OseeEnumType> getCache() { return Activator.getInstance().getOseeCacheService().getEnumTypeCache(); } diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/internal/accessors/AbstractClientDataAccessor.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/internal/accessors/AbstractClientDataAccessor.java index 323a71bfbb7..331acc2e085 100644 --- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/internal/accessors/AbstractClientDataAccessor.java +++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/internal/accessors/AbstractClientDataAccessor.java @@ -27,14 +27,14 @@ import org.eclipse.osee.framework.skynet.core.artifact.HttpClientMessage; /** * @author Roberto E. Escobar */ -public abstract class AbstractClientDataAccessor<T extends IOseeStorable> implements IOseeDataAccessor<T> { +public abstract class AbstractClientDataAccessor<K, T extends IOseeStorable> implements IOseeDataAccessor<K, T> { protected AbstractClientDataAccessor() { // Hide default constructor } @Override - public void load(IOseeCache<T> cache) throws OseeCoreException { + public void load(IOseeCache<K, T> cache) throws OseeCoreException { Collection<T> updatedItems = updateCache(cache); for (T item : updatedItems) { item.clearDirty(); @@ -47,7 +47,7 @@ public abstract class AbstractClientDataAccessor<T extends IOseeStorable> implem //do nothing } - protected <J> J requestUpdateMessage(IOseeCache<T> cache, ITranslatorId txId) throws OseeCoreException { + protected <J> J requestUpdateMessage(IOseeCache<K, T> cache, ITranslatorId txId) throws OseeCoreException { CacheUpdateRequest updateRequest = new CacheUpdateRequest(cache.getCacheId()); Map<String, String> parameters = new HashMap<String, String>(); parameters.put("function", CacheOperation.UPDATE.name()); @@ -56,5 +56,5 @@ public abstract class AbstractClientDataAccessor<T extends IOseeStorable> implem CoreTranslatorId.OSEE_CACHE_UPDATE_REQUEST, updateRequest, txId); } - protected abstract Collection<T> updateCache(IOseeCache<T> cache) throws OseeCoreException; + protected abstract Collection<T> updateCache(IOseeCache<K, T> cache) throws OseeCoreException; } diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/internal/accessors/ClientArtifactTypeAccessor.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/internal/accessors/ClientArtifactTypeAccessor.java index 69169821a08..508dff03eb1 100644 --- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/internal/accessors/ClientArtifactTypeAccessor.java +++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/internal/accessors/ClientArtifactTypeAccessor.java @@ -34,14 +34,14 @@ import org.eclipse.osee.framework.jdk.core.type.Triplet; /** * @author Roberto E. Escobar */ -public class ClientArtifactTypeAccessor extends AbstractClientDataAccessor<ArtifactType> { +public class ClientArtifactTypeAccessor extends AbstractClientDataAccessor<String, ArtifactType> { - private final AbstractOseeCache<AttributeType> attrCache; - private final AbstractOseeCache<Branch> branchCache; + private final AbstractOseeCache<String, AttributeType> attrCache; + private final AbstractOseeCache<String, Branch> branchCache; private final ArtifactTypeFactory artifactTypeFactory; - public ClientArtifactTypeAccessor(ArtifactTypeFactory artifactTypeFactory, AbstractOseeCache<AttributeType> attrCache, AbstractOseeCache<Branch> branchCache) { + public ClientArtifactTypeAccessor(ArtifactTypeFactory artifactTypeFactory, AbstractOseeCache<String, AttributeType> attrCache, AbstractOseeCache<String, Branch> branchCache) { this.artifactTypeFactory = artifactTypeFactory; this.attrCache = attrCache; this.branchCache = branchCache; @@ -52,14 +52,14 @@ public class ClientArtifactTypeAccessor extends AbstractClientDataAccessor<Artif } @Override - public void load(IOseeCache<ArtifactType> cache) throws OseeCoreException { + public void load(IOseeCache<String, ArtifactType> cache) throws OseeCoreException { attrCache.ensurePopulated(); branchCache.ensurePopulated(); super.load(cache); } @Override - protected Collection<ArtifactType> updateCache(IOseeCache<ArtifactType> cache) throws OseeCoreException { + protected Collection<ArtifactType> updateCache(IOseeCache<String, ArtifactType> cache) throws OseeCoreException { List<ArtifactType> updatedItems = new ArrayList<ArtifactType>(); ArtifactTypeCacheUpdateResponse response = diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/internal/accessors/ClientAttributeTypeAccessor.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/internal/accessors/ClientAttributeTypeAccessor.java index 9234460041a..92267b16b7c 100644 --- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/internal/accessors/ClientAttributeTypeAccessor.java +++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/internal/accessors/ClientAttributeTypeAccessor.java @@ -26,12 +26,12 @@ import org.eclipse.osee.framework.core.model.type.OseeEnumType; /** * @author Roberto E. Escobar */ -public class ClientAttributeTypeAccessor extends AbstractClientDataAccessor<AttributeType> { +public class ClientAttributeTypeAccessor extends AbstractClientDataAccessor<String, AttributeType> { - private final AbstractOseeCache<OseeEnumType> enumCache; + private final AbstractOseeCache<String, OseeEnumType> enumCache; private final AttributeTypeFactory attributeTypeFactory; - public ClientAttributeTypeAccessor(AttributeTypeFactory attributeTypeFactory, AbstractOseeCache<OseeEnumType> enumCache) { + public ClientAttributeTypeAccessor(AttributeTypeFactory attributeTypeFactory, AbstractOseeCache<String, OseeEnumType> enumCache) { super(); this.attributeTypeFactory = attributeTypeFactory; this.enumCache = enumCache; @@ -42,13 +42,13 @@ public class ClientAttributeTypeAccessor extends AbstractClientDataAccessor<Attr } @Override - public void load(IOseeCache<AttributeType> cache) throws OseeCoreException { + public void load(IOseeCache<String, AttributeType> cache) throws OseeCoreException { enumCache.ensurePopulated(); super.load(cache); } @Override - protected Collection<AttributeType> updateCache(IOseeCache<AttributeType> cache) throws OseeCoreException { + protected Collection<AttributeType> updateCache(IOseeCache<String, AttributeType> cache) throws OseeCoreException { List<AttributeType> updatedItems = new ArrayList<AttributeType>(); AttributeTypeCacheUpdateResponse response = diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/internal/accessors/ClientBranchAccessor.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/internal/accessors/ClientBranchAccessor.java index f6d10de901c..ab0963b790f 100644 --- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/internal/accessors/ClientBranchAccessor.java +++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/internal/accessors/ClientBranchAccessor.java @@ -38,7 +38,7 @@ import org.eclipse.osee.framework.skynet.core.internal.Activator; /** * @author Roberto E. Escobar */ -public class ClientBranchAccessor extends AbstractClientDataAccessor<Branch> { +public class ClientBranchAccessor extends AbstractClientDataAccessor<String, Branch> { private final TransactionCache transactionCache; private BranchCache branchCache; @@ -58,13 +58,13 @@ public class ClientBranchAccessor extends AbstractClientDataAccessor<Branch> { } @Override - public void load(IOseeCache<Branch> cache) throws OseeCoreException { + public void load(IOseeCache<String, Branch> cache) throws OseeCoreException { transactionCache.ensurePopulated(); super.load(cache); } @Override - protected Collection<Branch> updateCache(IOseeCache<Branch> cache) throws OseeCoreException { + protected Collection<Branch> updateCache(IOseeCache<String, Branch> cache) throws OseeCoreException { BranchCacheUpdateResponse response = requestUpdateMessage(cache, CoreTranslatorId.BRANCH_CACHE_UPDATE_RESPONSE); return new BranchCacheUpdateUtil(getFactory(), transactionCache).updateCache(response, cache); } @@ -74,7 +74,7 @@ public class ClientBranchAccessor extends AbstractClientDataAccessor<Branch> { store(branchCache, types); } - public void store(IOseeCache<Branch> cache, Collection<Branch> branches) throws OseeCoreException { + public void store(IOseeCache<String, Branch> cache, Collection<Branch> branches) throws OseeCoreException { Map<String, String> parameters = new HashMap<String, String>(); parameters.put("function", CacheOperation.STORE.name()); diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/internal/accessors/ClientOseeEnumTypeAccessor.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/internal/accessors/ClientOseeEnumTypeAccessor.java index 8b4e1f596de..449994497be 100644 --- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/internal/accessors/ClientOseeEnumTypeAccessor.java +++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/internal/accessors/ClientOseeEnumTypeAccessor.java @@ -24,7 +24,7 @@ import org.eclipse.osee.framework.core.model.type.OseeEnumTypeFactory; /** * @author Roberto E. Escobar */ -public class ClientOseeEnumTypeAccessor extends AbstractClientDataAccessor<OseeEnumType> { +public class ClientOseeEnumTypeAccessor extends AbstractClientDataAccessor<String, OseeEnumType> { private final OseeEnumTypeFactory enumTypeFactory; @@ -38,7 +38,7 @@ public class ClientOseeEnumTypeAccessor extends AbstractClientDataAccessor<OseeE } @Override - protected Collection<OseeEnumType> updateCache(IOseeCache<OseeEnumType> cache) throws OseeCoreException { + protected Collection<OseeEnumType> updateCache(IOseeCache<String, OseeEnumType> cache) throws OseeCoreException { List<OseeEnumType> enumTypes = new ArrayList<OseeEnumType>(); OseeEnumTypeCacheUpdateResponse response = requestUpdateMessage(cache, CoreTranslatorId.OSEE_ENUM_TYPE_CACHE_UPDATE_RESPONSE); diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/internal/accessors/ClientRelationTypeAccessor.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/internal/accessors/ClientRelationTypeAccessor.java index ac9a60560f3..22918797990 100644 --- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/internal/accessors/ClientRelationTypeAccessor.java +++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/internal/accessors/ClientRelationTypeAccessor.java @@ -27,12 +27,12 @@ import org.eclipse.osee.framework.core.model.type.RelationTypeFactory; /** * @author Roberto E. Escobar */ -public class ClientRelationTypeAccessor extends AbstractClientDataAccessor<RelationType> { +public class ClientRelationTypeAccessor extends AbstractClientDataAccessor<String, RelationType> { - private final AbstractOseeCache<ArtifactType> artCache; + private final AbstractOseeCache<String, ArtifactType> artCache; private final RelationTypeFactory relationTypeFactory; - public ClientRelationTypeAccessor(RelationTypeFactory relationTypeFactory, AbstractOseeCache<ArtifactType> artCache) { + public ClientRelationTypeAccessor(RelationTypeFactory relationTypeFactory, AbstractOseeCache<String, ArtifactType> artCache) { super(); this.relationTypeFactory = relationTypeFactory; this.artCache = artCache; @@ -43,13 +43,13 @@ public class ClientRelationTypeAccessor extends AbstractClientDataAccessor<Relat } @Override - public void load(IOseeCache<RelationType> cache) throws OseeCoreException { + public void load(IOseeCache<String, RelationType> cache) throws OseeCoreException { artCache.ensurePopulated(); super.load(cache); } @Override - protected Collection<RelationType> updateCache(IOseeCache<RelationType> cache) throws OseeCoreException { + protected Collection<RelationType> updateCache(IOseeCache<String, RelationType> cache) throws OseeCoreException { List<RelationType> updatedItems = new ArrayList<RelationType>(); RelationTypeCacheUpdateResponse response = diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/relation/RelationTypeManager.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/relation/RelationTypeManager.java index 23bd5a19df8..f723afbba69 100644 --- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/relation/RelationTypeManager.java +++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/relation/RelationTypeManager.java @@ -30,11 +30,11 @@ import org.eclipse.osee.framework.skynet.core.internal.Activator; */ public class RelationTypeManager { - public static AbstractOseeCache<RelationType> getCache() { + public static AbstractOseeCache<String, RelationType> getCache() { return Activator.getInstance().getOseeCacheService().getRelationTypeCache(); } - public static AbstractOseeCache<ArtifactType> getArtifactTypeCache() { + public static AbstractOseeCache<String, ArtifactType> getArtifactTypeCache() { return Activator.getInstance().getOseeCacheService().getArtifactTypeCache(); } diff --git a/plugins/org.eclipse.osee.framework.ui.skynet.test/src/org/eclipse/osee/framework/ui/skynet/test/cases/RelationOrderRendererTest.java b/plugins/org.eclipse.osee.framework.ui.skynet.test/src/org/eclipse/osee/framework/ui/skynet/test/cases/RelationOrderRendererTest.java index d8b0e375c5c..da621883bbb 100644 --- a/plugins/org.eclipse.osee.framework.ui.skynet.test/src/org/eclipse/osee/framework/ui/skynet/test/cases/RelationOrderRendererTest.java +++ b/plugins/org.eclipse.osee.framework.ui.skynet.test/src/org/eclipse/osee/framework/ui/skynet/test/cases/RelationOrderRendererTest.java @@ -54,7 +54,8 @@ public class RelationOrderRendererTest { public static void prepareTest() throws Exception { MockArtifactGuidResolver resolver = new MockArtifactGuidResolver(null); - AbstractOseeCache<RelationType> typeCache = new RelationTypeCache(new MockOseeDataAccessor<RelationType>()); + AbstractOseeCache<String, RelationType> typeCache = + new RelationTypeCache(new MockOseeDataAccessor<String, RelationType>()); addRelationTypeData(typeCache); sorterProvider = new RelationSorterProvider(); renderer = new RelationOrderRenderer(typeCache, resolver, sorterProvider); @@ -195,8 +196,8 @@ public class RelationOrderRendererTest { Assert.assertEquals(expected, builder.toString()); } - private final static void addRelationTypeData(AbstractOseeCache<RelationType> cache) throws OseeCoreException { - ArtifactTypeCache artCache = new ArtifactTypeCache(new MockOseeDataAccessor<ArtifactType>()); + private final static void addRelationTypeData(AbstractOseeCache<String, RelationType> cache) throws OseeCoreException { + ArtifactTypeCache artCache = new ArtifactTypeCache(new MockOseeDataAccessor<String, ArtifactType>()); IArtifactType artifactType1 = createArtifactType(artCache, "Artifact 2"); IArtifactType artifactType2 = createArtifactType(artCache, "Artifact 1"); @@ -205,13 +206,13 @@ public class RelationOrderRendererTest { createRelationType(cache, "Relation 3", artifactType1, artifactType2); } - private final static ArtifactType createArtifactType(AbstractOseeCache<ArtifactType> artCache, String name) throws OseeCoreException { + private final static ArtifactType createArtifactType(AbstractOseeCache<String, ArtifactType> artCache, String name) throws OseeCoreException { ArtifactType artifactType = new ArtifactType(GUID.create(), name, false); artCache.cache(artifactType); return artifactType; } - private final static void createRelationType(AbstractOseeCache<RelationType> cache, String name, IArtifactType artifactType1, IArtifactType artifactType2) throws OseeCoreException { + private final static void createRelationType(AbstractOseeCache<String, RelationType> cache, String name, IArtifactType artifactType1, IArtifactType artifactType2) throws OseeCoreException { RelationType type = new RelationType(GUID.create(), name, name + "_A", name + "_B", artifactType1, artifactType2, RelationTypeMultiplicity.MANY_TO_MANY, ""); diff --git a/plugins/org.eclipse.osee.framework.ui.skynet.test/src/org/eclipse/osee/framework/ui/skynet/test/renderer/RenderingUtilTest.java b/plugins/org.eclipse.osee.framework.ui.skynet.test/src/org/eclipse/osee/framework/ui/skynet/test/renderer/RenderingUtilTest.java index dc89865db67..fe31b934551 100644 --- a/plugins/org.eclipse.osee.framework.ui.skynet.test/src/org/eclipse/osee/framework/ui/skynet/test/renderer/RenderingUtilTest.java +++ b/plugins/org.eclipse.osee.framework.ui.skynet.test/src/org/eclipse/osee/framework/ui/skynet/test/renderer/RenderingUtilTest.java @@ -12,7 +12,6 @@ package org.eclipse.osee.framework.ui.skynet.test.renderer; import java.io.UnsupportedEncodingException; import java.net.URLEncoder; -import org.junit.Assert; import org.eclipse.osee.framework.core.enums.BranchState; import org.eclipse.osee.framework.core.enums.BranchType; import org.eclipse.osee.framework.core.exception.OseeCoreException; @@ -23,6 +22,7 @@ import org.eclipse.osee.framework.core.model.cache.BranchCache; import org.eclipse.osee.framework.core.model.mocks.MockOseeDataAccessor; import org.eclipse.osee.framework.jdk.core.util.GUID; import org.eclipse.osee.framework.ui.skynet.render.RenderingUtil; +import org.junit.Assert; import org.junit.Test; /** @@ -31,7 +31,7 @@ import org.junit.Test; public class RenderingUtilTest { @Test public void testBranchToFileName() throws Exception { - AbstractOseeCache<Branch> cache = new TestCache(); + AbstractOseeCache<String, Branch> cache = new TestCache(); Branch branch = createBranch(cache, GUID.create(), "Test 1", 1); String actual = RenderingUtil.toFileName(branch); Assert.assertEquals(encode(branch.getShortName()), actual); @@ -41,7 +41,7 @@ public class RenderingUtilTest { return URLEncoder.encode(guid, "UTF-8"); } - private Branch createBranch(AbstractOseeCache<Branch> cache, String guid, String name, int id) throws OseeCoreException { + private Branch createBranch(AbstractOseeCache<String, Branch> cache, String guid, String name, int id) throws OseeCoreException { Branch branch = new BranchFactory().create(guid, name, BranchType.WORKING, BranchState.MODIFIED, false); Assert.assertNotNull(branch); branch.setId(id); @@ -50,7 +50,7 @@ public class RenderingUtilTest { private final class TestCache extends BranchCache { public TestCache() { - super(new MockOseeDataAccessor<Branch>()); + super(new MockOseeDataAccessor<String, Branch>()); } } }
\ No newline at end of file diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/RelationOrderRenderer.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/RelationOrderRenderer.java index 62a9996bf25..1f40f9e5ae6 100644 --- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/RelationOrderRenderer.java +++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/RelationOrderRenderer.java @@ -34,9 +34,9 @@ public class RelationOrderRenderer { private static final String NO_DATA_TAG = "None"; private final ArtifactGuidToWordML guidResolver; private final RelationSorterProvider sorterProvider; - private final AbstractOseeCache<RelationType> relationCache; + private final AbstractOseeCache<String, RelationType> relationCache; - public RelationOrderRenderer(AbstractOseeCache<RelationType> relationCache, ArtifactGuidToWordML guidResolver, RelationSorterProvider sorterProvider) { + public RelationOrderRenderer(AbstractOseeCache<String, RelationType> relationCache, ArtifactGuidToWordML guidResolver, RelationSorterProvider sorterProvider) { this.relationCache = relationCache; this.guidResolver = guidResolver; this.sorterProvider = sorterProvider; |