diff options
author | Roberto E. Escobar | 2012-05-22 19:32:24 +0000 |
---|---|---|
committer | Roberto E. Escobar | 2012-05-22 19:32:24 +0000 |
commit | c72cba75ecc1d256fd1e0dca729517ff52dc4467 (patch) | |
tree | 897651d5b88fade3547ca5445c6768f66e8aa287 /plugins/org.eclipse.osee.framework.core.model | |
parent | 04c3aa09abe83729a38af78dde6bed4530b66bb1 (diff) | |
download | org.eclipse.osee-c72cba75ecc1d256fd1e0dca729517ff52dc4467.tar.gz org.eclipse.osee-c72cba75ecc1d256fd1e0dca729517ff52dc4467.tar.xz org.eclipse.osee-c72cba75ecc1d256fd1e0dca729517ff52dc4467.zip |
bug[ats_9YVXA]: Add cache checks to IOseeTypeFactories0.9.9.v201205221941_SR6
Diffstat (limited to 'plugins/org.eclipse.osee.framework.core.model')
7 files changed, 26 insertions, 14 deletions
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 2fc45bfa914..d9decdb4044 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 @@ -40,6 +40,7 @@ public class BranchFactory implements IOseeTypeFactory { } public Branch createOrUpdate(AbstractOseeCache<String, Branch> cache, String guid, String name, BranchType branchType, BranchState branchState, boolean isArchived) throws OseeCoreException { + Conditions.checkNotNull(cache, "BranchCache"); Branch branch = cache.getByGuid(guid); if (branch == null) { branch = create(guid, name, branchType, branchState, isArchived); @@ -55,6 +56,7 @@ public class BranchFactory implements IOseeTypeFactory { } public Branch createOrUpdate(IOseeCache<String, Branch> cache, int uniqueId, StorageState storageState, String guid, String name, BranchType branchType, BranchState branchState, boolean isArchived) throws OseeCoreException { + Conditions.checkNotNull(cache, "BranchCache"); 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/TransactionRecord.java b/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/TransactionRecord.java index e6a1d55dafd..c831edc0b3c 100644 --- a/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/TransactionRecord.java +++ b/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/TransactionRecord.java @@ -36,10 +36,6 @@ public final class TransactionRecord extends BaseIdentity<Integer> implements IT public TransactionRecord(int transactionNumber, int branchId, String comment, Date time, int authorArtId, int commitArtId, TransactionDetailsType txType, BranchCache branchCache) { super(transactionNumber); - if (branchCache == null) { - System.out.print("BranchCache cannot be null"); - Thread.dumpStack(); - } this.branchId = branchId; this.comment = Strings.intern(comment); this.time = time; diff --git a/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/TransactionRecordFactory.java b/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/TransactionRecordFactory.java index 80635ccf9a0..39721974b13 100644 --- a/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/TransactionRecordFactory.java +++ b/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/TransactionRecordFactory.java @@ -16,42 +16,47 @@ import org.eclipse.osee.framework.core.exception.OseeCoreException; import org.eclipse.osee.framework.core.model.cache.BranchCache; import org.eclipse.osee.framework.core.model.cache.IOseeTypeFactory; import org.eclipse.osee.framework.core.model.cache.TransactionCache; +import org.eclipse.osee.framework.core.util.Conditions; /** * @author Roberto E. Escobar */ public class TransactionRecordFactory implements IOseeTypeFactory { - public TransactionRecord create(int transactionNumber, int branchId, String comment, Date timestamp, int authorArtId, int commitArtId, TransactionDetailsType txType, BranchCache branchCache) { + public TransactionRecord create(int transactionNumber, int branchId, String comment, Date timestamp, int authorArtId, int commitArtId, TransactionDetailsType txType, BranchCache branchCache) throws OseeCoreException { + Conditions.checkNotNull(branchCache, "branchCache"); return new TransactionRecord(transactionNumber, branchId, comment, timestamp, authorArtId, commitArtId, txType, branchCache); } - public TransactionRecord create(int transactionNumber, BranchCache branchCache) { + private TransactionRecord create(int transactionNumber, BranchCache branchCache) throws OseeCoreException { + Conditions.checkNotNull(branchCache, "branchCache"); return new TransactionRecord(transactionNumber, branchCache); } - public TransactionRecord createOrUpdate(TransactionCache cache, int transactionNumber, int branchId, String comment, Date timestamp, int authorArtId, int commitArtId, TransactionDetailsType txType, BranchCache branchCache) throws OseeCoreException { - TransactionRecord record = cache.getById(transactionNumber); + public TransactionRecord createOrUpdate(TransactionCache txCache, int transactionNumber, int branchId, String comment, Date timestamp, int authorArtId, int commitArtId, TransactionDetailsType txType, BranchCache branchCache) throws OseeCoreException { + Conditions.checkNotNull(txCache, "txCache"); + TransactionRecord record = txCache.getById(transactionNumber); if (record == null) { record = create(transactionNumber, branchId, comment, timestamp, authorArtId, commitArtId, txType, branchCache); } else { - cache.decache(record); + txCache.decache(record); record.setAuthor(authorArtId); record.setComment(comment); record.setCommit(commitArtId); record.setTimeStamp(timestamp); } - cache.cache(record); + txCache.cache(record); return record; } - public TransactionRecord getOrCreate(TransactionCache cache, int transactionNumber, BranchCache branchCache) throws OseeCoreException { - TransactionRecord record = cache.getById(transactionNumber); + public TransactionRecord getOrCreate(TransactionCache txCache, int transactionNumber, BranchCache branchCache) throws OseeCoreException { + Conditions.checkNotNull(txCache, "txCache"); + TransactionRecord record = txCache.getById(transactionNumber); if (record == null) { - record = new TransactionRecord(transactionNumber, branchCache); - cache.cache(record); + record = create(transactionNumber, branchCache); + txCache.cache(record); } return record; } 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 95dfca2eaf6..e6da8324079 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 @@ -28,6 +28,7 @@ public final class ArtifactTypeFactory implements IOseeTypeFactory { } public ArtifactType createOrUpdate(ArtifactTypeCache cache, Long guid, boolean isAbstract, String name) throws OseeCoreException { + Conditions.checkNotNull(cache, "ArtifactTypeCache"); ArtifactType artifactType = cache.getByGuid(guid); if (artifactType == null) { artifactType = create(guid, isAbstract, name); @@ -41,6 +42,7 @@ public final class ArtifactTypeFactory implements IOseeTypeFactory { } public ArtifactType createOrUpdate(IOseeCache<Long, ArtifactType> cache, int uniqueId, StorageState storageState, Long guid, boolean isAbstract, String name) throws OseeCoreException { + Conditions.checkNotNull(cache, "ArtifactTypeCache"); 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/AttributeTypeFactory.java b/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/type/AttributeTypeFactory.java index 2fc8c0153ac..f070fd16864 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 @@ -42,6 +42,7 @@ public class AttributeTypeFactory implements IOseeTypeFactory { } public AttributeType createOrUpdate(AttributeTypeCache cache, long guid, String typeName, String baseAttributeTypeId, String attributeProviderNameId, String fileTypeExtension, String defaultValue, OseeEnumType oseeEnumType, int minOccurrences, int maxOccurrences, String description, String taggerId) throws OseeCoreException { + Conditions.checkNotNull(cache, "AttributeTypeCache"); AttributeType attributeType = cache.getByGuid(guid); if (attributeType == null) { @@ -59,6 +60,7 @@ public class AttributeTypeFactory implements IOseeTypeFactory { } public AttributeType createOrUpdate(IOseeCache<Long, AttributeType> cache, int uniqueId, StorageState storageState, Long guid, String typeName, String baseAttributeTypeId, String attributeProviderNameId, String fileTypeExtension, String defaultValue, OseeEnumType oseeEnumType, int minOccurrences, int maxOccurrences, String description, String taggerId) throws OseeCoreException { + Conditions.checkNotNull(cache, "AttributeTypeCache"); 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/OseeEnumTypeFactory.java b/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/type/OseeEnumTypeFactory.java index a90445c1136..6e9aa2aae8e 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,6 +37,7 @@ public class OseeEnumTypeFactory implements IOseeTypeFactory { } public OseeEnumType createOrUpdate(IOseeCache<Long, OseeEnumType> cache, int enumTypeId, StorageState storageState, Long guid, String enumTypeName) throws OseeCoreException { + Conditions.checkNotNull(cache, "OseeEnumTypeCache"); OseeEnumType oseeEnumType = cache.getById(enumTypeId); if (oseeEnumType == null) { oseeEnumType = createEnumType(guid, enumTypeName); @@ -51,6 +52,7 @@ public class OseeEnumTypeFactory implements IOseeTypeFactory { } public OseeEnumType createOrUpdate(OseeEnumTypeCache cache, Long guid, String enumTypeName) throws OseeCoreException { + Conditions.checkNotNull(cache, "OseeEnumTypeCache"); OseeEnumType oseeEnumType = cache.getByGuid(guid); if (oseeEnumType == null) { oseeEnumType = createEnumType(guid, enumTypeName); @@ -63,6 +65,7 @@ public class OseeEnumTypeFactory implements IOseeTypeFactory { } public OseeEnumEntry createOrUpdate(IOseeCache<Long, OseeEnumType> cache, Long enumTypeGuid, String enumEntryGuid, String enumEntryName, int ordinal) throws OseeCoreException { + Conditions.checkNotNull(cache, "OseeEnumTypeCache"); OseeEnumType oseeEnumType = ((AbstractOseeCache<Long, OseeEnumType>) cache).getByGuid(enumTypeGuid); OseeEnumEntry enumEntry = oseeEnumType.getEntryByGuid(enumEntryGuid); if (enumEntry == null) { 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 2f2c2479555..85867929327 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 @@ -36,6 +36,7 @@ public class RelationTypeFactory implements IOseeTypeFactory { } public RelationType createOrUpdate(RelationTypeCache cache, Long guid, String typeName, String sideAName, String sideBName, IArtifactType artifactTypeSideA, IArtifactType artifactTypeSideB, RelationTypeMultiplicity multiplicity, String defaultOrderTypeGuid) throws OseeCoreException { + Conditions.checkNotNull(cache, "RelationTypeCache"); RelationType relationType = cache.getByGuid(guid); if (relationType == null) { relationType = @@ -51,6 +52,7 @@ public class RelationTypeFactory implements IOseeTypeFactory { } public RelationType createOrUpdate(IOseeCache<Long, RelationType> cache, int typeId, StorageState storageState, Long guid, String typeName, String sideAName, String sideBName, IArtifactType artifactTypeSideA, IArtifactType artifactTypeSideB, RelationTypeMultiplicity multiplicity, String defaultOrderTypeGuid) throws OseeCoreException { + Conditions.checkNotNull(cache, "RelationTypeCache"); RelationType relationType = cache.getById(typeId); if (relationType == null) { relationType = |