Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoberto E. Escobar2013-06-13 20:03:54 -0400
committerjmisinco2013-07-09 16:37:50 -0400
commit6b6a6fb56d1d2dc09993179651ff218b4f7d5346 (patch)
tree45c5c07a7abd03ea36159b6c2fb238e45eb85612
parentb336e949f17dcc41928c8da373c00b857871c04c (diff)
downloadorg.eclipse.osee-6b6a6fb56d1d2dc09993179651ff218b4f7d5346.tar.gz
org.eclipse.osee-6b6a6fb56d1d2dc09993179651ff218b4f7d5346.tar.xz
org.eclipse.osee-6b6a6fb56d1d2dc09993179651ff218b4f7d5346.zip
feature[ats_SF2V6]: Integrate new OrcsTypes API
-rw-r--r--plugins/org.eclipse.osee.display.api/src/org/eclipse/osee/display/api/search/ArtifactProvider.java8
-rw-r--r--plugins/org.eclipse.osee.display.presenter.mocks/src/org/eclipse/osee/display/presenter/mocks/MockArtifactProvider.java15
-rw-r--r--plugins/org.eclipse.osee.display.presenter.test/src/org/eclipse/osee/display/presenter/internal/SearchPresenterTest.java13
-rw-r--r--plugins/org.eclipse.osee.display.presenter/src/org/eclipse/osee/display/presenter/ArtifactProviderImpl.java21
-rw-r--r--plugins/org.eclipse.osee.display.presenter/src/org/eclipse/osee/display/presenter/SearchPresenterImpl.java17
-rw-r--r--plugins/org.eclipse.osee.framework.manager.servlet/src/org/eclipse/osee/framework/manager/servlet/OseeModelServlet.java45
-rw-r--r--plugins/org.eclipse.osee.orcs.core.test/src/org/eclipse/osee/orcs/core/internal/artifact/ArtifactFactoryTest.java31
-rw-r--r--plugins/org.eclipse.osee.orcs.core.test/src/org/eclipse/osee/orcs/core/internal/attribute/ArtifactImplTest.java50
-rw-r--r--plugins/org.eclipse.osee.orcs.core.test/src/org/eclipse/osee/orcs/core/internal/attribute/AttributeClassResolverTest.java53
-rw-r--r--plugins/org.eclipse.osee.orcs.core.test/src/org/eclipse/osee/orcs/core/internal/attribute/AttributeFactoryTest.java22
-rw-r--r--plugins/org.eclipse.osee.orcs.core.test/src/org/eclipse/osee/orcs/core/internal/relation/RelationLoadingTest.java41
-rw-r--r--plugins/org.eclipse.osee.orcs.core.test/src/org/eclipse/osee/orcs/core/internal/search/SearchCriteriaTest.java39
-rw-r--r--plugins/org.eclipse.osee.orcs.core.test/src/org/eclipse/osee/orcs/core/internal/types/OrcsTypesTest.java1
-rw-r--r--plugins/org.eclipse.osee.orcs.core/OSGI-INF/attribute.class.registry.xml (renamed from plugins/org.eclipse.osee.orcs.core/OSGI-INF/attribute.class.resolver.xml)10
-rw-r--r--plugins/org.eclipse.osee.orcs.core/OSGI-INF/orcs.api.xml4
-rw-r--r--plugins/org.eclipse.osee.orcs.core/OSGI-INF/orcs.types.purge.artifact.type.console.command.xml1
-rw-r--r--plugins/org.eclipse.osee.orcs.core/OSGI-INF/orcs.types.purge.attribute.type.console.command.xml1
-rw-r--r--plugins/org.eclipse.osee.orcs.core/OSGI-INF/orcs.types.purge.relation.type.console.command.xml1
-rw-r--r--plugins/org.eclipse.osee.orcs.core/OSGI-INF/orcs.update.cache.console.command.xml3
-rw-r--r--plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/ds/BranchDataStore.java5
-rw-r--r--plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/ds/OrcsDataStore.java3
-rw-r--r--plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/ds/TempCachingService.java (renamed from plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/types/IOseeModelingService.java)23
-rw-r--r--plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/ds/criteria/CriteriaArtifactType.java10
-rw-r--r--plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/ds/criteria/CriteriaAttributeKeywords.java12
-rw-r--r--plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/OrcsApiImpl.java78
-rw-r--r--plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/OrcsBranchImpl.java9
-rw-r--r--plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/artifact/ArtifactFactory.java14
-rw-r--r--plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/artifact/ArtifactImpl.java19
-rw-r--r--plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/artifact/ArtifactTypeProvider.java35
-rw-r--r--plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/attribute/Attribute.java17
-rw-r--r--plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/attribute/AttributeClassRegistry.java71
-rw-r--r--plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/attribute/AttributeClassResolver.java67
-rw-r--r--plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/attribute/AttributeFactory.java21
-rw-r--r--plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/attribute/AttributeResourceNameResolver.java8
-rw-r--r--plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/console/CacheUpdateCommand.java98
-rw-r--r--plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/console/PurgeArtifactTypeCommand.java19
-rw-r--r--plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/console/PurgeAttributeTypeCommand.java19
-rw-r--r--plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/console/PurgeRelationTypeCommand.java19
-rw-r--r--plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/relation/RelationContainerImpl.java4
-rw-r--r--plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/relation/RelationFactory.java6
-rw-r--r--plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/relation/RelationGraphImpl.java38
-rw-r--r--plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/relation/RelationRowCollection.java8
-rw-r--r--plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/search/CriteriaFactory.java13
-rw-r--r--plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/search/QueryModule.java6
-rw-r--r--plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/types/OrcsTypes.java49
-rw-r--r--plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/types/OrcsTypesModule.java1
-rw-r--r--plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/types/impl/OrcsTypesImpl.java7
-rw-r--r--plugins/org.eclipse.osee.orcs.db/OSGI-INF/fix.duplicate.attributes.console.command.xml3
-rw-r--r--plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/OrcsDataStoreImpl.java82
-rw-r--r--plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/accessor/ArtifactTypeDataAccessor.java55
-rw-r--r--plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/accessor/TypeLoaderImpl.java148
-rw-r--r--plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/branch/BranchDataStoreImpl.java21
-rw-r--r--plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/callable/CreateBranchDatabaseCallable.java103
-rw-r--r--plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/callable/DuplicateAttributesDatabaseTxCallable.java100
-rw-r--r--plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/callable/ImportBranchDatabaseCallable.java69
-rw-r--r--plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/console/FixDuplicateAttributesCommand.java109
-rw-r--r--plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/exchange/ExportItemFactory.java18
-rw-r--r--plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/exchange/export/OseeTypeModelExportItem.java12
-rw-r--r--plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/types/CacheServiceFactory.java4
-rw-r--r--plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/types/OseeModelingServiceImpl.java166
-rw-r--r--plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/types/OseeToXtextOperation.java271
-rw-r--r--plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/types/OseeTypeCache.java83
-rw-r--r--plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/types/OseeUtil.java36
-rw-r--r--plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/types/TempCachingServiceFactory.java108
-rw-r--r--plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/types/XTextToOseeTypeOperation.java368
-rw-r--r--plugins/org.eclipse.osee.orcs.test/src/org/eclipse/osee/orcs/OrcsIntegrationRule.java2
-rw-r--r--plugins/org.eclipse.osee.orcs/src/org/eclipse/osee/orcs/OrcsTypes.java19
-rw-r--r--plugins/org.eclipse.osee.orcs/src/org/eclipse/osee/orcs/data/GraphReadable.java9
-rw-r--r--plugins/org.eclipse.osee.orcs/src/org/eclipse/osee/orcs/utility/Providers.java32
69 files changed, 875 insertions, 1998 deletions
diff --git a/plugins/org.eclipse.osee.display.api/src/org/eclipse/osee/display/api/search/ArtifactProvider.java b/plugins/org.eclipse.osee.display.api/src/org/eclipse/osee/display/api/search/ArtifactProvider.java
index 56c000ffac..b378ddbdbf 100644
--- a/plugins/org.eclipse.osee.display.api/src/org/eclipse/osee/display/api/search/ArtifactProvider.java
+++ b/plugins/org.eclipse.osee.display.api/src/org/eclipse/osee/display/api/search/ArtifactProvider.java
@@ -14,9 +14,9 @@ import java.util.Collection;
import java.util.List;
import org.eclipse.osee.framework.core.data.IArtifactToken;
import org.eclipse.osee.framework.core.data.IOseeBranch;
+import org.eclipse.osee.framework.core.data.IRelationType;
import org.eclipse.osee.framework.core.data.IRelationTypeSide;
import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.core.model.type.RelationType;
import org.eclipse.osee.orcs.data.ArtifactReadable;
/**
@@ -34,7 +34,11 @@ public interface ArtifactProvider {
ArtifactReadable getParent(ArtifactReadable art) throws OseeCoreException;
- Collection<RelationType> getValidRelationTypes(ArtifactReadable art) throws OseeCoreException;
+ Collection<? extends IRelationType> getValidRelationTypes(ArtifactReadable art) throws OseeCoreException;
+
+ String getSideAName(IRelationType type) throws OseeCoreException;
+
+ String getSideBName(IRelationType type) throws OseeCoreException;
void getSearchResults(IOseeBranch branch, boolean nameOnly, String searchPhrase, final AsyncSearchListener callback) throws OseeCoreException;
diff --git a/plugins/org.eclipse.osee.display.presenter.mocks/src/org/eclipse/osee/display/presenter/mocks/MockArtifactProvider.java b/plugins/org.eclipse.osee.display.presenter.mocks/src/org/eclipse/osee/display/presenter/mocks/MockArtifactProvider.java
index 15ad9b5e30..c03f30a73f 100644
--- a/plugins/org.eclipse.osee.display.presenter.mocks/src/org/eclipse/osee/display/presenter/mocks/MockArtifactProvider.java
+++ b/plugins/org.eclipse.osee.display.presenter.mocks/src/org/eclipse/osee/display/presenter/mocks/MockArtifactProvider.java
@@ -19,9 +19,10 @@ import org.eclipse.osee.display.api.search.ArtifactProvider;
import org.eclipse.osee.display.api.search.AsyncSearchListener;
import org.eclipse.osee.framework.core.data.IArtifactToken;
import org.eclipse.osee.framework.core.data.IOseeBranch;
+import org.eclipse.osee.framework.core.data.IRelationType;
import org.eclipse.osee.framework.core.data.IRelationTypeSide;
+import org.eclipse.osee.framework.core.enums.RelationSide;
import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.core.model.type.RelationType;
import org.eclipse.osee.orcs.data.ArtifactReadable;
import org.eclipse.osee.orcs.data.AttributeReadable;
import org.eclipse.osee.orcs.data.RelationsReadable;
@@ -90,7 +91,7 @@ public class MockArtifactProvider implements ArtifactProvider {
}
@Override
- public Collection<RelationType> getValidRelationTypes(ArtifactReadable art) {
+ public Collection<? extends IRelationType> getValidRelationTypes(ArtifactReadable art) {
if (art instanceof MockArtifact) {
return ((MockArtifact) art).getValidRelationTypes();
} else {
@@ -107,4 +108,14 @@ public class MockArtifactProvider implements ArtifactProvider {
public void cancelSearch() {
//do nothing
}
+
+ @Override
+ public String getSideAName(IRelationType type) {
+ return String.format("%s:%s", type, RelationSide.SIDE_A);
+ }
+
+ @Override
+ public String getSideBName(IRelationType type) {
+ return String.format("%s:%s", type, RelationSide.SIDE_B);
+ }
} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.display.presenter.test/src/org/eclipse/osee/display/presenter/internal/SearchPresenterTest.java b/plugins/org.eclipse.osee.display.presenter.test/src/org/eclipse/osee/display/presenter/internal/SearchPresenterTest.java
index 9075855c39..8d3546ca5b 100644
--- a/plugins/org.eclipse.osee.display.presenter.test/src/org/eclipse/osee/display/presenter/internal/SearchPresenterTest.java
+++ b/plugins/org.eclipse.osee.display.presenter.test/src/org/eclipse/osee/display/presenter/internal/SearchPresenterTest.java
@@ -35,6 +35,7 @@ import org.eclipse.osee.display.presenter.mocks.MockSearchResultComponent;
import org.eclipse.osee.display.presenter.mocks.MockSearchResultsListComponent;
import org.eclipse.osee.framework.core.data.IArtifactToken;
import org.eclipse.osee.framework.core.data.IOseeBranch;
+import org.eclipse.osee.framework.core.data.IRelationType;
import org.eclipse.osee.framework.core.data.IRelationTypeSide;
import org.eclipse.osee.framework.core.enums.CoreArtifactTypes;
import org.eclipse.osee.framework.core.enums.CoreAttributeTypes;
@@ -288,7 +289,7 @@ public class SearchPresenterTest {
}
@Override
- public Collection<RelationType> getValidRelationTypes(ArtifactReadable art) throws OseeCoreException {
+ public Collection<? extends IRelationType> getValidRelationTypes(ArtifactReadable art) throws OseeCoreException {
throw new OseeCoreException("test");
}
@@ -302,5 +303,15 @@ public class SearchPresenterTest {
// do nothing
}
+ @Override
+ public String getSideAName(IRelationType type) throws OseeCoreException {
+ throw new OseeCoreException("test");
+ }
+
+ @Override
+ public String getSideBName(IRelationType type) throws OseeCoreException {
+ throw new OseeCoreException("test");
+ }
+
}
}
diff --git a/plugins/org.eclipse.osee.display.presenter/src/org/eclipse/osee/display/presenter/ArtifactProviderImpl.java b/plugins/org.eclipse.osee.display.presenter/src/org/eclipse/osee/display/presenter/ArtifactProviderImpl.java
index d6dbed8c07..33b72d32d6 100644
--- a/plugins/org.eclipse.osee.display.presenter/src/org/eclipse/osee/display/presenter/ArtifactProviderImpl.java
+++ b/plugins/org.eclipse.osee.display.presenter/src/org/eclipse/osee/display/presenter/ArtifactProviderImpl.java
@@ -29,6 +29,7 @@ import org.eclipse.osee.executor.admin.PassThroughCallable;
import org.eclipse.osee.framework.core.data.IArtifactToken;
import org.eclipse.osee.framework.core.data.IAttributeType;
import org.eclipse.osee.framework.core.data.IOseeBranch;
+import org.eclipse.osee.framework.core.data.IRelationType;
import org.eclipse.osee.framework.core.data.IRelationTypeSide;
import org.eclipse.osee.framework.core.data.ResultSet;
import org.eclipse.osee.framework.core.enums.CaseType;
@@ -39,7 +40,6 @@ import org.eclipse.osee.framework.core.enums.TokenDelimiterMatch;
import org.eclipse.osee.framework.core.enums.TokenOrderType;
import org.eclipse.osee.framework.core.exception.OseeCoreException;
import org.eclipse.osee.framework.core.exception.OseeExceptions;
-import org.eclipse.osee.framework.core.model.type.RelationType;
import org.eclipse.osee.logger.Log;
import org.eclipse.osee.orcs.data.ArtifactReadable;
import org.eclipse.osee.orcs.data.AttributeReadable;
@@ -174,21 +174,32 @@ public class ArtifactProviderImpl implements ArtifactProvider {
}
@Override
- public List<RelationType> getValidRelationTypes(ArtifactReadable art) throws OseeCoreException {
+ public Collection<? extends IRelationType> getValidRelationTypes(ArtifactReadable art) {
Collection<IRelationTypeSide> existingRelationTypes = graph.getExistingRelationTypes(art);
- Set<RelationType> toReturn = new HashSet<RelationType>();
+ Set<IRelationType> toReturn = new HashSet<IRelationType>();
for (IRelationTypeSide side : existingRelationTypes) {
- toReturn.add(graph.getFullRelationType(side));
+ toReturn.add(side);
}
- List<RelationType> listToReturn = Lists.newLinkedList(toReturn);
+ List<? extends IRelationType> listToReturn = Lists.newLinkedList(toReturn);
java.util.Collections.sort(listToReturn);
return listToReturn;
}
@Override
+ public String getSideAName(IRelationType type) throws OseeCoreException {
+ return graph.getTypes().getSideAName(type);
+ }
+
+ @Override
+ public String getSideBName(IRelationType type) throws OseeCoreException {
+ return graph.getTypes().getSideBName(type);
+ }
+
+ @Override
public void cancelSearch() {
if (cache.isSearchInProgress()) {
cache.getSearchFuture().cancel(true);
}
}
+
}
diff --git a/plugins/org.eclipse.osee.display.presenter/src/org/eclipse/osee/display/presenter/SearchPresenterImpl.java b/plugins/org.eclipse.osee.display.presenter/src/org/eclipse/osee/display/presenter/SearchPresenterImpl.java
index 299d60c95d..66db317ba3 100644
--- a/plugins/org.eclipse.osee.display.presenter/src/org/eclipse/osee/display/presenter/SearchPresenterImpl.java
+++ b/plugins/org.eclipse.osee.display.presenter/src/org/eclipse/osee/display/presenter/SearchPresenterImpl.java
@@ -44,7 +44,6 @@ import org.eclipse.osee.framework.core.data.IRelationType;
import org.eclipse.osee.framework.core.data.TokenFactory;
import org.eclipse.osee.framework.core.enums.RelationSide;
import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.core.model.type.RelationType;
import org.eclipse.osee.framework.jdk.core.type.MatchLocation;
import org.eclipse.osee.framework.jdk.core.util.Lib;
import org.eclipse.osee.framework.jdk.core.util.Strings;
@@ -184,19 +183,19 @@ public class SearchPresenterImpl<T extends SearchHeaderComponent, K extends View
relComp.clearAll();
relComp.setArtifact(artifact);
- Collection<RelationType> relationTypes = null;
+
try {
- relationTypes = artifactProvider.getValidRelationTypes(displayArt);
+ Collection<? extends IRelationType> relationTypes = artifactProvider.getValidRelationTypes(displayArt);
+ for (IRelationType relType : relationTypes) {
+ ViewId toAdd = new ViewId(relType.getGuid().toString(), relType.getName());
+ toAdd.setAttribute(SIDE_A_KEY, artifactProvider.getSideAName(relType));
+ toAdd.setAttribute(SIDE_B_KEY, artifactProvider.getSideBName(relType));
+ relComp.addRelationType(toAdd);
+ }
} catch (Exception ex) {
setErrorMessage(relComp, "Error in initArtifactPage:\n Cannot load valid relation types", ex);
return;
}
- for (RelationType relTypeSide : relationTypes) {
- ViewId toAdd = new ViewId(relTypeSide.getGuid().toString(), relTypeSide.getName());
- toAdd.setAttribute(SIDE_A_KEY, relTypeSide.getSideAName());
- toAdd.setAttribute(SIDE_B_KEY, relTypeSide.getSideBName());
- relComp.addRelationType(toAdd);
- }
attrComp.clearAll();
Collection<IAttributeType> attributeTypes = null;
diff --git a/plugins/org.eclipse.osee.framework.manager.servlet/src/org/eclipse/osee/framework/manager/servlet/OseeModelServlet.java b/plugins/org.eclipse.osee.framework.manager.servlet/src/org/eclipse/osee/framework/manager/servlet/OseeModelServlet.java
index 4c2067cea0..989880e9dc 100644
--- a/plugins/org.eclipse.osee.framework.manager.servlet/src/org/eclipse/osee/framework/manager/servlet/OseeModelServlet.java
+++ b/plugins/org.eclipse.osee.framework.manager.servlet/src/org/eclipse/osee/framework/manager/servlet/OseeModelServlet.java
@@ -14,16 +14,20 @@ import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
+import java.io.UnsupportedEncodingException;
+import java.net.URI;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.eclipse.osee.framework.core.enums.CoreTranslatorId;
import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.core.exception.OseeExceptions;
import org.eclipse.osee.framework.core.model.OseeImportModelRequest;
import org.eclipse.osee.framework.core.model.OseeImportModelResponse;
import org.eclipse.osee.framework.core.server.ISessionManager;
import org.eclipse.osee.framework.core.server.SecureOseeHttpServlet;
import org.eclipse.osee.framework.core.translation.IDataTranslationService;
import org.eclipse.osee.framework.jdk.core.util.Lib;
+import org.eclipse.osee.framework.resource.management.IResource;
import org.eclipse.osee.logger.Log;
import org.eclipse.osee.orcs.OrcsApi;
import org.eclipse.osee.orcs.OrcsTypes;
@@ -66,15 +70,14 @@ public class OseeModelServlet extends SecureOseeHttpServlet {
@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException {
+ ByteArrayOutputStream output = new ByteArrayOutputStream();
try {
- ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
-
- getOrcsTypes().exportOseeTypes(outputStream);
+ getOrcsTypes().writeTypes(output).call();
resp.setStatus(HttpServletResponse.SC_ACCEPTED);
resp.setContentType("text/plain");
resp.setCharacterEncoding("UTF-8");
- Lib.inputStreamToOutputStream(new ByteArrayInputStream(outputStream.toByteArray()), resp.getOutputStream());
+ Lib.inputStreamToOutputStream(new ByteArrayInputStream(output.toByteArray()), resp.getOutputStream());
} catch (Exception ex) {
handleError(resp, req.getQueryString(), ex);
}
@@ -84,12 +87,42 @@ public class OseeModelServlet extends SecureOseeHttpServlet {
protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws IOException {
try {
IDataTranslationService service = dataTransalatorService;
- OseeImportModelRequest modelRequest =
+ final OseeImportModelRequest modelRequest =
service.convert(req.getInputStream(), CoreTranslatorId.OSEE_IMPORT_MODEL_REQUEST);
+ IResource resource = new IResource() {
+
+ @Override
+ public InputStream getContent() throws OseeCoreException {
+ InputStream inputStream = null;
+ try {
+ inputStream = new ByteArrayInputStream(modelRequest.getModel().getBytes("UTF-8"));
+ } catch (UnsupportedEncodingException ex) {
+ OseeExceptions.wrapAndThrow(ex);
+ }
+ return inputStream;
+ }
+
+ @Override
+ public URI getLocation() {
+ return null;
+ }
+
+ @Override
+ public String getName() {
+ return modelRequest.getModelName();
+ }
+
+ @Override
+ public boolean isCompressed() {
+ return false;
+ }
+
+ };
+
OseeImportModelResponse modelResponse = new OseeImportModelResponse();
- getOrcsTypes().importOseeTypes(isInitializing(req), modelRequest, modelResponse);
+ getOrcsTypes().loadTypes(resource, isInitializing(req)).call();
resp.setStatus(HttpServletResponse.SC_ACCEPTED);
resp.setContentType("text/xml");
diff --git a/plugins/org.eclipse.osee.orcs.core.test/src/org/eclipse/osee/orcs/core/internal/artifact/ArtifactFactoryTest.java b/plugins/org.eclipse.osee.orcs.core.test/src/org/eclipse/osee/orcs/core/internal/artifact/ArtifactFactoryTest.java
index 969cb79115..612160390f 100644
--- a/plugins/org.eclipse.osee.orcs.core.test/src/org/eclipse/osee/orcs/core/internal/artifact/ArtifactFactoryTest.java
+++ b/plugins/org.eclipse.osee.orcs.core.test/src/org/eclipse/osee/orcs/core/internal/artifact/ArtifactFactoryTest.java
@@ -10,21 +10,24 @@
*******************************************************************************/
package org.eclipse.osee.orcs.core.internal.artifact;
-import static org.junit.Assert.*;
-import static org.mockito.Matchers.*;
-import static org.mockito.Mockito.*;
+import static org.junit.Assert.assertEquals;
+import static org.mockito.Matchers.any;
+import static org.mockito.Matchers.eq;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
+import org.eclipse.osee.framework.core.data.IArtifactType;
import org.eclipse.osee.framework.core.data.IAttributeType;
import org.eclipse.osee.framework.core.data.IOseeBranch;
import org.eclipse.osee.framework.core.enums.CoreAttributeTypes;
import org.eclipse.osee.framework.core.exception.OseeArgumentException;
import org.eclipse.osee.framework.core.exception.OseeCoreException;
import org.eclipse.osee.framework.core.model.Branch;
-import org.eclipse.osee.framework.core.model.cache.ArtifactTypeCache;
import org.eclipse.osee.framework.core.model.cache.BranchCache;
-import org.eclipse.osee.framework.core.model.type.ArtifactType;
import org.eclipse.osee.framework.jdk.core.util.GUID;
import org.eclipse.osee.orcs.core.ds.ArtifactData;
import org.eclipse.osee.orcs.core.ds.ArtifactDataFactory;
@@ -34,6 +37,7 @@ import org.eclipse.osee.orcs.core.internal.attribute.Attribute;
import org.eclipse.osee.orcs.core.internal.attribute.AttributeFactory;
import org.eclipse.osee.orcs.core.internal.relation.RelationContainer;
import org.eclipse.osee.orcs.core.internal.relation.RelationFactory;
+import org.eclipse.osee.orcs.data.ArtifactTypes;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Rule;
@@ -57,7 +61,7 @@ public class ArtifactFactoryTest {
// @formatter:off
@Mock private Branch branch;
- @Mock private ArtifactType artifactType;
+ @Mock private IArtifactType artifactType;
@Mock private ArtifactData artifactData;
@Mock private RelationContainer relationContainer;
@Mock private VersionData artifactVersion;
@@ -65,7 +69,7 @@ public class ArtifactFactoryTest {
@Mock private ArtifactDataFactory dataFactory;
@Mock private AttributeFactory attributeFactory;
@Mock private RelationFactory relationFactory;
- @Mock private ArtifactTypeCache artifactTypeCache;
+ @Mock private ArtifactTypes artifactTypeCache;
@Mock private BranchCache branchCache;
@Mock private Attribute<Object> attribute;
@@ -84,7 +88,7 @@ public class ArtifactFactoryTest {
MockitoAnnotations.initMocks(this);
artifactFactory =
- new ArtifactFactory(dataFactory, attributeFactory, relationFactory, artifactTypeCache, branchCache);
+ new ArtifactFactory(dataFactory, attributeFactory, relationFactory, branchCache, artifactTypeCache);
guid = GUID.create();
@@ -109,8 +113,9 @@ public class ArtifactFactoryTest {
when(otherArtifactData.getVersion()).thenReturn(artifactVersion);
when(relationFactory.createRelationContainer(45)).thenReturn(relationContainer);
- when(artifactTypeCache.getByGuid(65L)).thenReturn(artifactType);
when(branchCache.getById(23)).thenReturn(branch);
+
+ when(artifactTypeCache.getByUuid(65L)).thenReturn(artifactType);
}
@Test
@@ -127,7 +132,6 @@ public class ArtifactFactoryTest {
@Test
public void testCreateArtifactFromArtifactData() throws OseeCoreException {
when(relationFactory.createRelationContainer(45)).thenReturn(relationContainer);
- when(artifactTypeCache.getByGuid(65L)).thenReturn(artifactType);
when(branchCache.getById(23)).thenReturn(branch);
ArtifactImpl artifact = artifactFactory.createArtifact(artifactData);
@@ -143,7 +147,7 @@ public class ArtifactFactoryTest {
when(source.getAttributes(CoreAttributeTypes.Annotation)).thenAnswer(new ReturnAttribute(attribute));
when(attribute.getOrcsData()).thenReturn(attributeData);
- when(artifactType.isValidAttributeType(CoreAttributeTypes.Annotation, branch)).thenReturn(true);
+ when(artifactTypeCache.isValidAttributeType(artifactType, branch, CoreAttributeTypes.Annotation)).thenReturn(true);
ArgumentCaptor<ArtifactImpl> implCapture = ArgumentCaptor.forClass(ArtifactImpl.class);
@@ -153,6 +157,7 @@ public class ArtifactFactoryTest {
verify(source, times(0)).getAttributes(CoreAttributeTypes.City);
verify(source, times(1)).getAttributes(CoreAttributeTypes.Annotation);
verify(attributeFactory).copyAttribute(eq(attributeData), eq(branch), implCapture.capture());
+
Assert.assertTrue(implCapture.getValue().isLoaded());
Assert.assertTrue(actual == implCapture.getValue());
}
@@ -178,7 +183,7 @@ public class ArtifactFactoryTest {
when(source.getExistingAttributeTypes()).thenAnswer(new ReturnExistingTypes(types));
when(source.getAttributes(CoreAttributeTypes.Annotation)).thenAnswer(new ReturnAttribute(attribute));
when(attribute.getOrcsData()).thenReturn(attributeData);
- when(artifactType.isValidAttributeType(CoreAttributeTypes.Annotation, branch)).thenReturn(true);
+ when(artifactTypeCache.isValidAttributeType(artifactType, branch, CoreAttributeTypes.Annotation)).thenReturn(true);
ArgumentCaptor<ArtifactImpl> implCapture = ArgumentCaptor.forClass(ArtifactImpl.class);
@@ -202,7 +207,7 @@ public class ArtifactFactoryTest {
when(source.getExistingAttributeTypes()).thenAnswer(new ReturnExistingTypes(types));
when(source.getAttributes(CoreAttributeTypes.Annotation)).thenAnswer(new ReturnAttribute(attribute));
when(attribute.getOrcsData()).thenReturn(attributeData);
- when(artifactType.isValidAttributeType(CoreAttributeTypes.Annotation, branch)).thenReturn(true);
+ when(artifactTypeCache.isValidAttributeType(artifactType, branch, CoreAttributeTypes.Annotation)).thenReturn(true);
ArgumentCaptor<ArtifactImpl> implCapture = ArgumentCaptor.forClass(ArtifactImpl.class);
diff --git a/plugins/org.eclipse.osee.orcs.core.test/src/org/eclipse/osee/orcs/core/internal/attribute/ArtifactImplTest.java b/plugins/org.eclipse.osee.orcs.core.test/src/org/eclipse/osee/orcs/core/internal/attribute/ArtifactImplTest.java
index f04403a054..37fa8d71e0 100644
--- a/plugins/org.eclipse.osee.orcs.core.test/src/org/eclipse/osee/orcs/core/internal/attribute/ArtifactImplTest.java
+++ b/plugins/org.eclipse.osee.orcs.core.test/src/org/eclipse/osee/orcs/core/internal/attribute/ArtifactImplTest.java
@@ -19,6 +19,7 @@ import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
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.CoreArtifactTypes;
import org.eclipse.osee.framework.core.enums.CoreAttributeTypes;
@@ -27,8 +28,6 @@ import org.eclipse.osee.framework.core.exception.MultipleAttributesExist;
import org.eclipse.osee.framework.core.exception.OseeCoreException;
import org.eclipse.osee.framework.core.exception.OseeStateException;
import org.eclipse.osee.framework.core.model.Branch;
-import org.eclipse.osee.framework.core.model.type.ArtifactType;
-import org.eclipse.osee.framework.core.model.type.AttributeType;
import org.eclipse.osee.framework.jdk.core.util.GUID;
import org.eclipse.osee.orcs.core.ds.ArtifactData;
import org.eclipse.osee.orcs.core.ds.AttributeData;
@@ -37,6 +36,7 @@ import org.eclipse.osee.orcs.core.internal.artifact.ArtifactImpl;
import org.eclipse.osee.orcs.core.internal.artifact.AttributeManager;
import org.eclipse.osee.orcs.core.internal.artifact.ValueProvider;
import org.eclipse.osee.orcs.core.internal.relation.RelationContainer;
+import org.eclipse.osee.orcs.data.ArtifactTypes;
import org.eclipse.osee.orcs.data.AttributeReadable;
import org.junit.Before;
import org.junit.Rule;
@@ -59,9 +59,8 @@ public class ArtifactImplTest {
@Mock private AttributeFactory attributeFactory;
@Mock private RelationContainer relationContainer;
@Mock private ValueProvider<Branch, ArtifactData> branchProvider;
- @Mock private ValueProvider<ArtifactType, ArtifactData> artifactTypeProvider;
- @Mock private ArtifactType artifactType;
- @Mock private AttributeType attributeType;
+ @Mock private ArtifactTypes types;
+
@Mock private VersionData version;
@Mock private AttributeData attributeData;
@Mock private Branch branch;
@@ -77,15 +76,17 @@ public class ArtifactImplTest {
// @formatter:on
private final String guid = GUID.create();
+ private final IAttributeType attributeType = CoreAttributeTypes.Annotation;
+ private final IArtifactType artifactType = CoreArtifactTypes.GeneralData;
@SuppressWarnings("unchecked")
@Before
public void init() throws OseeCoreException {
MockitoAnnotations.initMocks(this);
- artifactImpl =
- new ArtifactImpl(artifactData, attributeFactory, relationContainer, branchProvider, artifactTypeProvider);
- when(artifactTypeProvider.get()).thenReturn(artifactType);
- when(artifactType.isValidAttributeType(any(IAttributeType.class), any(Branch.class))).thenReturn(true);
+ artifactImpl = new ArtifactImpl(types, artifactData, attributeFactory, relationContainer, branchProvider);
+
+ when(types.isValidAttributeType(any(IArtifactType.class), any(Branch.class), any(IAttributeType.class))).thenReturn(
+ true);
when(attributeFactory.getMaxOccurrenceLimit(any(IAttributeType.class))).thenReturn(1);
when(attributeFactory.createAttribute(any(AttributeManager.class), any(AttributeData.class))).thenReturn(
@@ -97,11 +98,16 @@ public class ArtifactImplTest {
when(artifactData.getGuid()).thenReturn(guid);
when(artifactData.getVersion()).thenReturn(version);
+ when(artifactData.getTypeUuid()).thenReturn(artifactType.getGuid());
when(branchProvider.get()).thenReturn(branch);
+
when(deleted.isDeleted()).thenReturn(true);
when(notDeleted.getOrcsData()).thenReturn(attributeData);
when(deleted.getOrcsData()).thenReturn(attributeData);
when(differentType.getOrcsData()).thenReturn(attributeData);
+
+ when(types.getByUuid(CoreArtifactTypes.GeneralData.getGuid())).thenReturn(CoreArtifactTypes.GeneralData);
+ when(types.getByUuid(CoreArtifactTypes.CodeUnit.getGuid())).thenReturn(CoreArtifactTypes.CodeUnit);
}
@Test
@@ -122,7 +128,8 @@ public class ArtifactImplTest {
Attribute two = mock(Attribute.class);
when(one.getOrcsData()).thenReturn(attributeData);
when(two.getOrcsData()).thenReturn(attributeData);
- when(attributeType.getMaxOccurrences()).thenReturn(1);
+
+ when(attributeFactory.getMaxOccurrenceLimit(attributeType)).thenReturn(1);
artifactImpl.add(attributeType, one);
artifactImpl.add(attributeType, two);
Assert.assertEquals(2, artifactImpl.getAttributes(attributeType).size());
@@ -150,7 +157,6 @@ public class ArtifactImplTest {
ArtifactData newOrcsData = mock(ArtifactData.class);
artifactImpl.setOrcsData(newOrcsData);
verify(branchProvider).setOrcsData(newOrcsData);
- verify(artifactTypeProvider).setOrcsData(newOrcsData);
}
@Test
@@ -192,7 +198,7 @@ public class ArtifactImplTest {
@Test
public void testArtifactType() throws OseeCoreException {
artifactImpl.getArtifactType();
- verify(artifactTypeProvider).get();
+ verify(types).getByUuid(artifactData.getTypeUuid());
}
@Test
@@ -210,13 +216,20 @@ public class ArtifactImplTest {
@Test
public void testSetArtifactType() throws OseeCoreException {
when(version.isInStorage()).thenReturn(true);
+
artifactImpl.setArtifactType(CoreArtifactTypes.CodeUnit);
+
verify(artifactData).setTypeUuid(CoreArtifactTypes.CodeUnit.getGuid());
verify(artifactData).setModType(ModificationType.MODIFIED);
reset(version);
reset(artifactData);
+
+ when(artifactData.getVersion()).thenReturn(version);
+ when(artifactData.getGuid()).thenReturn(guid);
when(artifactData.getVersion()).thenReturn(version);
+ when(artifactData.getTypeUuid()).thenReturn(artifactType.getGuid());
+
artifactImpl.setArtifactType(CoreArtifactTypes.CodeUnit);
verify(artifactData, never()).setModType(ModificationType.MODIFIED);
}
@@ -224,7 +237,8 @@ public class ArtifactImplTest {
@Test
public void testIsOfType() throws OseeCoreException {
artifactImpl.isOfType(CoreArtifactTypes.CodeUnit);
- verify(artifactType).inheritsFrom(CoreArtifactTypes.CodeUnit);
+
+ verify(types).inheritsFrom(CoreArtifactTypes.GeneralData, CoreArtifactTypes.CodeUnit);
}
@Test
@@ -264,13 +278,13 @@ public class ArtifactImplTest {
@Test
public void testIsAttributeTypeValid() throws OseeCoreException {
artifactImpl.isAttributeTypeValid(CoreAttributeTypes.Afha);
- verify(artifactType).isValidAttributeType(CoreAttributeTypes.Afha, branch);
+ verify(types).isValidAttributeType(artifactType, branch, CoreAttributeTypes.Afha);
}
@Test
public void testGetValidAttributeTypes() throws OseeCoreException {
artifactImpl.getValidAttributeTypes();
- verify(artifactType).getAttributeTypes(branch);
+ verify(types).getAttributeTypes(artifactType, branch);
}
@Test
@@ -314,7 +328,7 @@ public class ArtifactImplTest {
int result = artifactImpl.getMaximumAttributeTypeAllowed(CoreAttributeTypes.AccessContextId);
Assert.assertEquals(expected, result);
- reset(artifactType);
+ reset(types);
result = artifactImpl.getMaximumAttributeTypeAllowed(CoreAttributeTypes.AccessContextId);
Assert.assertEquals(-1, result);
}
@@ -328,7 +342,7 @@ public class ArtifactImplTest {
int result = artifactImpl.getMinimumAttributeTypeAllowed(CoreAttributeTypes.AccessContextId);
Assert.assertEquals(expected, result);
- reset(artifactType);
+ reset(types);
result = artifactImpl.getMaximumAttributeTypeAllowed(CoreAttributeTypes.AccessContextId);
Assert.assertEquals(-1, result);
}
@@ -413,7 +427,7 @@ public class ArtifactImplTest {
@Test
@SuppressWarnings("unchecked")
public void testDeleteSoleAttribute() throws OseeCoreException {
- when(attributeType.getMinOccurrences()).thenReturn(0);
+ when(attributeFactory.getMinOccurrenceLimit(attributeType)).thenReturn(0);
when(notDeleted.getAttributeType()).thenReturn(attributeType);
when(notDeleted.getContainer()).thenReturn(artifactImpl);
artifactImpl.add(attributeType, notDeleted);
diff --git a/plugins/org.eclipse.osee.orcs.core.test/src/org/eclipse/osee/orcs/core/internal/attribute/AttributeClassResolverTest.java b/plugins/org.eclipse.osee.orcs.core.test/src/org/eclipse/osee/orcs/core/internal/attribute/AttributeClassResolverTest.java
index f65a14ac93..373be3c9bb 100644
--- a/plugins/org.eclipse.osee.orcs.core.test/src/org/eclipse/osee/orcs/core/internal/attribute/AttributeClassResolverTest.java
+++ b/plugins/org.eclipse.osee.orcs.core.test/src/org/eclipse/osee/orcs/core/internal/attribute/AttributeClassResolverTest.java
@@ -10,13 +10,14 @@
*******************************************************************************/
package org.eclipse.osee.orcs.core.internal.attribute;
+import static org.mockito.Mockito.when;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
import org.junit.Assert;
+import org.eclipse.osee.framework.core.data.IAttributeType;
import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.core.model.type.AttributeType;
import org.eclipse.osee.orcs.core.AttributeClassProvider;
import org.eclipse.osee.orcs.core.internal.attribute.primitives.BooleanAttribute;
import org.eclipse.osee.orcs.core.internal.attribute.primitives.CompressedContentAttribute;
@@ -27,11 +28,14 @@ import org.eclipse.osee.orcs.core.internal.attribute.primitives.IntegerAttribute
import org.eclipse.osee.orcs.core.internal.attribute.primitives.JavaObjectAttribute;
import org.eclipse.osee.orcs.core.internal.attribute.primitives.PrimitiveAttributeClassProvider;
import org.eclipse.osee.orcs.core.internal.attribute.primitives.StringAttribute;
+import org.eclipse.osee.orcs.data.AttributeTypes;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
import org.junit.runners.Parameterized.Parameters;
+import org.mockito.Mock;
+import org.mockito.MockitoAnnotations;
/**
* Test Case for {@link AttributeClassResolver}
@@ -41,9 +45,15 @@ import org.junit.runners.Parameterized.Parameters;
@RunWith(Parameterized.class)
public class AttributeClassResolverTest {
+ //@formatter:off
+ @Mock private AttributeTypes cache;
+ @Mock private IAttributeType type;
+ //@formatter:on
+
private final String alias;
private final Class<? extends Attribute<?>> expected;
private AttributeClassResolver resolver;
+ private AttributeClassRegistry registry;
public AttributeClassResolverTest(String alias, Class<? extends Attribute<?>> expected) {
this.alias = alias;
@@ -52,9 +62,13 @@ public class AttributeClassResolverTest {
@Before
public void setup() {
- resolver = new AttributeClassResolver();
+ MockitoAnnotations.initMocks(this);
+
+ registry = new AttributeClassRegistry();
+ resolver = new AttributeClassResolver(registry, cache);
+
PrimitiveAttributeClassProvider provider = new PrimitiveAttributeClassProvider();
- resolver.addProvider(provider);
+ registry.addProvider(provider);
}
@Test
@@ -64,24 +78,25 @@ public class AttributeClassResolverTest {
}
@Test
- public void testGetBaseClazzByType() {
- AttributeType type = createType(alias);
+ public void testGetBaseClazzByType() throws OseeCoreException {
+ when(cache.getBaseAttributeTypeId(type)).thenReturn(alias);
+
Class<? extends Attribute<?>> actual = resolver.getBaseClazz(type);
Assert.assertEquals(expected, actual);
}
@Test
- public void testRemoveProvider() {
+ public void testRemoveProvider() throws OseeCoreException {
Class<? extends Attribute<?>> actual1 = resolver.getBaseClazz(alias);
Assert.assertNotNull(actual1);
- AttributeType type = createType(alias);
+ when(cache.getBaseAttributeTypeId(type)).thenReturn(alias);
Class<? extends Attribute<?>> actual2 = resolver.getBaseClazz(type);
Assert.assertNotNull(actual2);
Assert.assertEquals(actual1, actual2);
- resolver.removeProvider(new AttributeClassProvider() {
+ registry.removeProvider(new AttributeClassProvider() {
@Override
public List<Class<? extends Attribute<?>>> getClasses() {
@@ -98,7 +113,8 @@ public class AttributeClassResolverTest {
@Test(expected = OseeCoreException.class)
public void testIsBaseCompatibleException1() throws OseeCoreException {
- AttributeType type = createType(alias);
+ when(cache.getBaseAttributeTypeId(type)).thenReturn(alias);
+
resolver.isBaseTypeCompatible(null, type);
}
@@ -109,24 +125,23 @@ public class AttributeClassResolverTest {
@Test(expected = OseeCoreException.class)
public void testIsBaseCompatibleException3() throws OseeCoreException {
- AttributeType type2 = createType(alias + "1");
- resolver.isBaseTypeCompatible(expected, type2);
+ when(cache.getBaseAttributeTypeId(type)).thenReturn(alias + "1");
+
+ resolver.isBaseTypeCompatible(expected, type);
}
@Test
public void testIsBaseCompatible() throws OseeCoreException {
- AttributeType type1 = createType(alias);
- boolean result1 = resolver.isBaseTypeCompatible(expected, type1);
+ when(cache.getBaseAttributeTypeId(type)).thenReturn(alias);
+
+ boolean result1 = resolver.isBaseTypeCompatible(expected, type);
Assert.assertTrue(result1);
String other = !alias.equals("BooleanAttribute") ? "BooleanAttribute" : "StringAttribute";
- AttributeType type2 = createType(other);
- boolean result2 = resolver.isBaseTypeCompatible(expected, type2);
- Assert.assertFalse(result2);
- }
+ when(cache.getBaseAttributeTypeId(type)).thenReturn(other);
- private static AttributeType createType(String baseType) {
- return new AttributeType(1L, "dummy", baseType, "", "", "", 1, 1, "", "", "");
+ boolean result2 = resolver.isBaseTypeCompatible(expected, type);
+ Assert.assertFalse(result2);
}
@Parameters
diff --git a/plugins/org.eclipse.osee.orcs.core.test/src/org/eclipse/osee/orcs/core/internal/attribute/AttributeFactoryTest.java b/plugins/org.eclipse.osee.orcs.core.test/src/org/eclipse/osee/orcs/core/internal/attribute/AttributeFactoryTest.java
index 8505184ab0..b487931b89 100644
--- a/plugins/org.eclipse.osee.orcs.core.test/src/org/eclipse/osee/orcs/core/internal/attribute/AttributeFactoryTest.java
+++ b/plugins/org.eclipse.osee.orcs.core.test/src/org/eclipse/osee/orcs/core/internal/attribute/AttributeFactoryTest.java
@@ -25,7 +25,6 @@ import org.eclipse.osee.framework.core.enums.CoreAttributeTypes;
import org.eclipse.osee.framework.core.enums.CoreBranches;
import org.eclipse.osee.framework.core.exception.OseeArgumentException;
import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.core.model.cache.AttributeTypeCache;
import org.eclipse.osee.framework.core.model.type.AttributeType;
import org.eclipse.osee.orcs.core.ds.ArtifactData;
import org.eclipse.osee.orcs.core.ds.AttributeData;
@@ -34,6 +33,7 @@ import org.eclipse.osee.orcs.core.ds.DataProxy;
import org.eclipse.osee.orcs.core.ds.ResourceNameResolver;
import org.eclipse.osee.orcs.core.ds.VersionData;
import org.eclipse.osee.orcs.core.internal.artifact.AttributeManager;
+import org.eclipse.osee.orcs.data.AttributeTypes;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
@@ -54,13 +54,13 @@ public class AttributeFactoryTest {
// @formatter:off
@Mock private AttributeClassResolver classResolver;
- @Mock private AttributeTypeCache cache;
+ @Mock private AttributeTypes cache;
@Mock private AttributeDataFactory dataFactory;
@Mock private AttributeData attributeData;
@Mock private VersionData attrVersionData;
- @Mock private AttributeType attributeType;
+ @Mock private IAttributeType attributeType;
@Mock private Attribute<Object> attribute;
@Mock private AttributeManager container;
@@ -75,19 +75,19 @@ public class AttributeFactoryTest {
public void init() throws OseeCoreException {
MockitoAnnotations.initMocks(this);
- factory = new AttributeFactory(classResolver, cache, dataFactory);
+ factory = new AttributeFactory(classResolver, dataFactory, cache);
expectedGuid = CoreAttributeTypes.Name.getGuid();
when(attributeData.getTypeUuid()).thenReturn(expectedGuid);
- when(cache.getByGuid(expectedGuid)).thenReturn(attributeType);
+ when(cache.getByUuid(expectedGuid)).thenReturn(attributeType);
when(classResolver.createAttribute(attributeType)).thenReturn(attribute);
when(attributeData.getDataProxy()).thenReturn(proxy);
}
@Test
public void testCreateAttributeNullType() throws OseeCoreException {
- when(cache.getByGuid(expectedGuid)).thenReturn(null);
+ when(cache.getByUuid(expectedGuid)).thenReturn(null);
thrown.expect(OseeArgumentException.class);
thrown.expectMessage("attributeType cannot be null - Cannot find attribute type with uuid[" + expectedGuid + "]");
@@ -202,27 +202,25 @@ public class AttributeFactoryTest {
public void testGetMaxOccurrenceLimit() throws OseeCoreException {
IAttributeType token = mock(IAttributeType.class);
- when(cache.get(token)).thenReturn(attributeType);
- when(attributeType.getMaxOccurrences()).thenReturn(56);
+ when(cache.getMaxOccurrences(token)).thenReturn(56);
int actual = factory.getMaxOccurrenceLimit(token);
assertEquals(56, actual);
- verify(attributeType).getMaxOccurrences();
+ verify(cache).getMaxOccurrences(token);
}
@Test
public void testGetMinOccurrenceLimit() throws OseeCoreException {
IAttributeType token = mock(IAttributeType.class);
- when(cache.get(token)).thenReturn(attributeType);
- when(attributeType.getMinOccurrences()).thenReturn(99);
+ when(cache.getMinOccurrences(token)).thenReturn(99);
int actual = factory.getMinOccurrenceLimit(token);
assertEquals(99, actual);
- verify(attributeType).getMinOccurrences();
+ verify(cache).getMinOccurrences(token);
}
}
diff --git a/plugins/org.eclipse.osee.orcs.core.test/src/org/eclipse/osee/orcs/core/internal/relation/RelationLoadingTest.java b/plugins/org.eclipse.osee.orcs.core.test/src/org/eclipse/osee/orcs/core/internal/relation/RelationLoadingTest.java
index 484112ef05..8b3f670a4f 100644
--- a/plugins/org.eclipse.osee.orcs.core.test/src/org/eclipse/osee/orcs/core/internal/relation/RelationLoadingTest.java
+++ b/plugins/org.eclipse.osee.orcs.core.test/src/org/eclipse/osee/orcs/core/internal/relation/RelationLoadingTest.java
@@ -10,23 +10,26 @@
*******************************************************************************/
package org.eclipse.osee.orcs.core.internal.relation;
+import static org.mockito.Matchers.any;
+import static org.mockito.Matchers.eq;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
import java.io.IOException;
import java.net.URL;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import org.eclipse.osee.framework.core.data.IRelationType;
import org.eclipse.osee.framework.core.data.TokenFactory;
import org.eclipse.osee.framework.core.enums.CoreArtifactTypes;
import org.eclipse.osee.framework.core.enums.ModificationType;
import org.eclipse.osee.framework.core.enums.RelationSide;
import org.eclipse.osee.framework.core.enums.RelationTypeMultiplicity;
import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.core.model.cache.RelationTypeCache;
-import org.eclipse.osee.framework.core.model.mocks.MockOseeDataAccessor;
-import org.eclipse.osee.framework.core.model.type.RelationType;
import org.eclipse.osee.orcs.core.ds.RelationData;
import org.eclipse.osee.orcs.core.ds.VersionData;
+import org.eclipse.osee.orcs.data.RelationTypes;
import org.junit.Assert;
import org.junit.Ignore;
import org.junit.Test;
@@ -39,7 +42,7 @@ public class RelationLoadingTest {
@Test
public void testRelationCountMatches() throws OseeCoreException, IOException {
- RelationTypeCache cache = createAndPopulate();
+ RelationTypes cache = createAndPopulate();
Map<Integer, RelationContainer> providersThatWillBeLoaded = getRelationProviderList(cache, 22);
RelationRowMapper relationRowMapper = new RelationRowMapper(providersThatWillBeLoaded);
@@ -57,7 +60,7 @@ public class RelationLoadingTest {
@Ignore
@Test
public void testRelatedArtifactsMatch() throws OseeCoreException, IOException {
- RelationTypeCache cache = createAndPopulate();
+ RelationTypes cache = createAndPopulate();
Map<Integer, RelationContainer> providersThatWillBeLoaded = getRelationProviderList(cache, 22);
RelationRowMapper relationRowMapper = new RelationRowMapper(providersThatWillBeLoaded);
@@ -72,15 +75,29 @@ public class RelationLoadingTest {
}
//@formatter:on
- public RelationTypeCache createAndPopulate() throws OseeCoreException {
- RelationTypeCache cache = new RelationTypeCache(new MockOseeDataAccessor<Long, RelationType>());
- cache.cache(new RelationType(1l, "test", "sideAName", "sideBName", CoreArtifactTypes.Artifact,
- CoreArtifactTypes.Artifact, RelationTypeMultiplicity.MANY_TO_MANY, ""));
+ public RelationTypes createAndPopulate() throws OseeCoreException {
+ IRelationType type = mock(IRelationType.class);
+ RelationTypes cache = mock(RelationTypes.class);
+
+ when(type.getGuid()).thenReturn(1L);
+ when(type.getName()).thenReturn("test");
+
+ when(cache.getByUuid(1L)).thenReturn(type);
+ when(cache.getSideAName(type)).thenReturn("sideAName");
+ when(cache.getSideBName(type)).thenReturn("sideBName");
+ when(cache.getArtifactTypeSideA(type)).thenReturn(CoreArtifactTypes.Artifact);
+ when(cache.getArtifactTypeSideB(type)).thenReturn(CoreArtifactTypes.Artifact);
+ when(cache.getMultiplicity(type)).thenReturn(RelationTypeMultiplicity.MANY_TO_MANY);
+ when(cache.getDefaultOrderTypeGuid(type)).thenReturn("");
+
+ when(cache.getSideName(type, RelationSide.SIDE_A)).thenReturn("sideAName");
+ when(cache.getSideName(type, RelationSide.SIDE_B)).thenReturn("sideBName");
+
+ when(cache.getArtifactType(eq(type), any(RelationSide.class))).thenReturn(CoreArtifactTypes.Artifact);
return cache;
}
private void checkRelationCount(RelationContainer relationContainer, RelationSide side, int size) {
- // int count = relationContainer.getRelationCount(1, side);
int count = relationContainer.getRelationCount(TokenFactory.createRelationTypeSide(side, 1, "blah"));
Assert.assertEquals(
String.format("We did not get the expected number of relations back [%d != %d]", size, count), size, count);
@@ -96,7 +113,7 @@ public class RelationLoadingTest {
}
}
- private Map<Integer, RelationContainer> getRelationProviderList(RelationTypeCache relationTypeCache, int size) {
+ private Map<Integer, RelationContainer> getRelationProviderList(RelationTypes relationTypeCache, int size) {
Map<Integer, RelationContainer> providersThatWillBeLoaded = new HashMap<Integer, RelationContainer>();
for (int i = 1; i <= size; i++) {
providersThatWillBeLoaded.put(i, createRelationContainer(relationTypeCache, i));
@@ -104,7 +121,7 @@ public class RelationLoadingTest {
return providersThatWillBeLoaded;
}
- private RelationContainer createRelationContainer(RelationTypeCache relationTypeCache, final int parentId) {
+ private RelationContainer createRelationContainer(RelationTypes relationTypeCache, final int parentId) {
return new RelationContainerImpl(parentId, relationTypeCache);
}
diff --git a/plugins/org.eclipse.osee.orcs.core.test/src/org/eclipse/osee/orcs/core/internal/search/SearchCriteriaTest.java b/plugins/org.eclipse.osee.orcs.core.test/src/org/eclipse/osee/orcs/core/internal/search/SearchCriteriaTest.java
index c67d2f3bc7..4fdbccf90d 100644
--- a/plugins/org.eclipse.osee.orcs.core.test/src/org/eclipse/osee/orcs/core/internal/search/SearchCriteriaTest.java
+++ b/plugins/org.eclipse.osee.orcs.core.test/src/org/eclipse/osee/orcs/core/internal/search/SearchCriteriaTest.java
@@ -18,9 +18,8 @@ import org.eclipse.osee.framework.core.data.IAttributeType;
import org.eclipse.osee.framework.core.enums.CoreAttributeTypes;
import org.eclipse.osee.framework.core.exception.OseeArgumentException;
import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.core.model.cache.AttributeTypeCache;
-import org.eclipse.osee.framework.core.model.type.AttributeType;
import org.eclipse.osee.orcs.core.ds.criteria.CriteriaAttributeKeywords;
+import org.eclipse.osee.orcs.data.AttributeTypes;
import org.junit.Before;
import org.junit.Test;
import org.mockito.Mock;
@@ -34,23 +33,21 @@ import org.mockito.MockitoAnnotations;
public class SearchCriteriaTest {
@Mock
- private AttributeTypeCache cache;
- @Mock
- private AttributeType type;
- private final ArrayList<IAttributeType> types = new ArrayList<IAttributeType>();
+ private AttributeTypes cache;
@Before
- public void setup() {
+ public void setup() throws OseeCoreException {
MockitoAnnotations.initMocks(this);
- types.add(CoreAttributeTypes.Active);
- types.add(CoreAttributeTypes.FavoriteBranch);
+
+ when(cache.getByUuid(CoreAttributeTypes.Name.getGuid())).thenReturn(CoreAttributeTypes.Name);
+ when(cache.getByUuid(CoreAttributeTypes.Active.getGuid())).thenReturn(CoreAttributeTypes.Active);
+ when(cache.getByUuid(CoreAttributeTypes.FavoriteBranch.getGuid())).thenReturn(CoreAttributeTypes.FavoriteBranch);
}
@Test
public void isTagged() throws OseeCoreException {
- when(cache.get(CoreAttributeTypes.Name)).thenReturn(type);
- when(type.getName()).thenReturn("Name");
- when(type.isTaggable()).thenReturn(true);
+ when(cache.isTaggable(CoreAttributeTypes.Name)).thenReturn(true);
+
CriteriaAttributeKeywords keyword =
new CriteriaAttributeKeywords(false, Collections.singletonList(CoreAttributeTypes.Name), cache, "");
keyword.checkNotTaggable();
@@ -59,9 +56,9 @@ public class SearchCriteriaTest {
@Test(expected = OseeArgumentException.class)
public void notTagged() throws OseeCoreException {
- when(cache.get(CoreAttributeTypes.Active)).thenReturn(type);
- when(type.getName()).thenReturn("Active");
- when(type.isTaggable()).thenReturn(false);
+
+ when(cache.isTaggable(CoreAttributeTypes.Active)).thenReturn(false);
+
CriteriaAttributeKeywords keyword =
new CriteriaAttributeKeywords(false, Collections.singletonList(CoreAttributeTypes.Active), cache, "");
keyword.checkNotTaggable();
@@ -71,11 +68,13 @@ public class SearchCriteriaTest {
@Test(expected = OseeArgumentException.class)
public void notTaggedList() throws OseeCoreException {
- when(cache.get(CoreAttributeTypes.Active)).thenReturn(type);
- when(type.getName()).thenReturn("Active");
- when(cache.get(CoreAttributeTypes.FavoriteBranch)).thenReturn(type);
- when(type.getName()).thenReturn("Favorite Branch");
- when(type.isTaggable()).thenReturn(false);
+
+ when(cache.isTaggable(CoreAttributeTypes.FavoriteBranch)).thenReturn(false);
+
+ ArrayList<IAttributeType> types = new ArrayList<IAttributeType>();
+ types.add(CoreAttributeTypes.Active);
+ types.add(CoreAttributeTypes.FavoriteBranch);
+
CriteriaAttributeKeywords keyword = new CriteriaAttributeKeywords(false, types, cache, "");
keyword.checkNotTaggable();
diff --git a/plugins/org.eclipse.osee.orcs.core.test/src/org/eclipse/osee/orcs/core/internal/types/OrcsTypesTest.java b/plugins/org.eclipse.osee.orcs.core.test/src/org/eclipse/osee/orcs/core/internal/types/OrcsTypesTest.java
index b9dd0ff46e..2742f03354 100644
--- a/plugins/org.eclipse.osee.orcs.core.test/src/org/eclipse/osee/orcs/core/internal/types/OrcsTypesTest.java
+++ b/plugins/org.eclipse.osee.orcs.core.test/src/org/eclipse/osee/orcs/core/internal/types/OrcsTypesTest.java
@@ -39,6 +39,7 @@ import org.eclipse.osee.framework.core.exception.OseeExceptions;
import org.eclipse.osee.framework.jdk.core.util.GUID;
import org.eclipse.osee.framework.resource.management.IResource;
import org.eclipse.osee.logger.Log;
+import org.eclipse.osee.orcs.OrcsTypes;
import org.eclipse.osee.orcs.core.ds.OrcsTypesDataStore;
import org.eclipse.osee.orcs.core.internal.SessionContext;
import org.eclipse.osee.orcs.core.internal.types.impl.OrcsTypesImpl;
diff --git a/plugins/org.eclipse.osee.orcs.core/OSGI-INF/attribute.class.resolver.xml b/plugins/org.eclipse.osee.orcs.core/OSGI-INF/attribute.class.registry.xml
index 66477fafcf..8ad4b3a255 100644
--- a/plugins/org.eclipse.osee.orcs.core/OSGI-INF/attribute.class.resolver.xml
+++ b/plugins/org.eclipse.osee.orcs.core/OSGI-INF/attribute.class.registry.xml
@@ -1,9 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
-<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" activate="start" deactivate="stop" name="org.eclipse.osee.orcs.core.internal.attribute.AttributeClassResolver">
- <implementation class="org.eclipse.osee.orcs.core.internal.attribute.AttributeClassResolver"/>
- <reference interface="org.eclipse.osee.logger.Log" name="Log" cardinality="1..1" policy="static" bind="setLogger" />
- <reference bind="addProvider" cardinality="1..n" interface="org.eclipse.osee.orcs.core.AttributeClassProvider" name="AttributeClassProvider" policy="dynamic" unbind="removeProvider"/>
+<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" activate="start" deactivate="stop" name="org.eclipse.osee.orcs.core.internal.attribute.AttributeClassRegistry">
+ <implementation class="org.eclipse.osee.orcs.core.internal.attribute.AttributeClassRegistry"/>
<service>
- <provide interface="org.eclipse.osee.orcs.core.internal.attribute.AttributeClassResolver"/>
+ <provide interface="org.eclipse.osee.orcs.core.internal.attribute.AttributeClassRegistry"/>
</service>
+ <reference interface="org.eclipse.osee.logger.Log" name="Log" cardinality="1..1" policy="static" bind="setLogger" />
+ <reference bind="addProvider" cardinality="1..n" interface="org.eclipse.osee.orcs.core.AttributeClassProvider" name="AttributeClassProvider" policy="dynamic" unbind="removeProvider"/>
</scr:component>
diff --git a/plugins/org.eclipse.osee.orcs.core/OSGI-INF/orcs.api.xml b/plugins/org.eclipse.osee.orcs.core/OSGI-INF/orcs.api.xml
index 8eeac5313a..678a89516f 100644
--- a/plugins/org.eclipse.osee.orcs.core/OSGI-INF/orcs.api.xml
+++ b/plugins/org.eclipse.osee.orcs.core/OSGI-INF/orcs.api.xml
@@ -5,8 +5,8 @@
<provide interface="org.eclipse.osee.orcs.OrcsApi"/>
</service>
<reference bind="setLogger" cardinality="1..1" interface="org.eclipse.osee.logger.Log" name="Log" policy="static"/>
- <reference bind="setAttributeClassResolver" cardinality="1..1" interface="org.eclipse.osee.orcs.core.internal.attribute.AttributeClassResolver" name="AttributeClassResolver" policy="static"/>
- <reference bind="setCacheService" cardinality="1..1" interface="org.eclipse.osee.framework.core.services.IOseeCachingService" name="IOseeCachingService" policy="static"/>
+ <reference bind="setAttributeClassRegistry" cardinality="1..1" interface="org.eclipse.osee.orcs.core.internal.attribute.AttributeClassRegistry" name="AttributeClassRegistry" policy="static"/>
+ <reference bind="setCacheService" cardinality="1..1" interface="org.eclipse.osee.orcs.core.ds.TempCachingService" name="IOseeCachingService" policy="static"/>
<reference bind="setExecutorAdmin" cardinality="1..1" interface="org.eclipse.osee.executor.admin.ExecutorAdmin" name="ExecutorAdmin" policy="static"/>
<reference bind="setSystemPreferences" cardinality="1..1" interface="org.eclipse.osee.orcs.core.SystemPreferences" name="SystemPreferences" policy="static"/>
<reference bind="setOrcsDataStore" cardinality="1..1" interface="org.eclipse.osee.orcs.core.ds.OrcsDataStore" name="OrcsDataStore" policy="static"/>
diff --git a/plugins/org.eclipse.osee.orcs.core/OSGI-INF/orcs.types.purge.artifact.type.console.command.xml b/plugins/org.eclipse.osee.orcs.core/OSGI-INF/orcs.types.purge.artifact.type.console.command.xml
index 7c0cf6ba2c..93d755738c 100644
--- a/plugins/org.eclipse.osee.orcs.core/OSGI-INF/orcs.types.purge.artifact.type.console.command.xml
+++ b/plugins/org.eclipse.osee.orcs.core/OSGI-INF/orcs.types.purge.artifact.type.console.command.xml
@@ -5,5 +5,4 @@
<provide interface="org.eclipse.osee.console.admin.ConsoleCommand"/>
</service>
<reference bind="setOrcsApi" cardinality="1..1" interface="org.eclipse.osee.orcs.OrcsApi" name="OrcsApi" policy="static"/>
- <reference bind="setCachingService" cardinality="1..1" interface="org.eclipse.osee.framework.core.services.IOseeCachingService" name="IOseeCachingService" policy="static"/>
</scr:component>
diff --git a/plugins/org.eclipse.osee.orcs.core/OSGI-INF/orcs.types.purge.attribute.type.console.command.xml b/plugins/org.eclipse.osee.orcs.core/OSGI-INF/orcs.types.purge.attribute.type.console.command.xml
index ec04c5df2b..8eddcf7928 100644
--- a/plugins/org.eclipse.osee.orcs.core/OSGI-INF/orcs.types.purge.attribute.type.console.command.xml
+++ b/plugins/org.eclipse.osee.orcs.core/OSGI-INF/orcs.types.purge.attribute.type.console.command.xml
@@ -5,5 +5,4 @@
<provide interface="org.eclipse.osee.console.admin.ConsoleCommand"/>
</service>
<reference bind="setOrcsApi" cardinality="1..1" interface="org.eclipse.osee.orcs.OrcsApi" name="OrcsApi" policy="static"/>
- <reference bind="setCachingService" cardinality="1..1" interface="org.eclipse.osee.framework.core.services.IOseeCachingService" name="IOseeCachingService" policy="static"/>
</scr:component>
diff --git a/plugins/org.eclipse.osee.orcs.core/OSGI-INF/orcs.types.purge.relation.type.console.command.xml b/plugins/org.eclipse.osee.orcs.core/OSGI-INF/orcs.types.purge.relation.type.console.command.xml
index 9d0df61015..7775bb712e 100644
--- a/plugins/org.eclipse.osee.orcs.core/OSGI-INF/orcs.types.purge.relation.type.console.command.xml
+++ b/plugins/org.eclipse.osee.orcs.core/OSGI-INF/orcs.types.purge.relation.type.console.command.xml
@@ -5,5 +5,4 @@
<provide interface="org.eclipse.osee.console.admin.ConsoleCommand"/>
</service>
<reference bind="setOrcsApi" cardinality="1..1" interface="org.eclipse.osee.orcs.OrcsApi" name="OrcsApi" policy="static"/>
- <reference bind="setCachingService" cardinality="1..1" interface="org.eclipse.osee.framework.core.services.IOseeCachingService" name="IOseeCachingService" policy="static"/>
</scr:component>
diff --git a/plugins/org.eclipse.osee.orcs.core/OSGI-INF/orcs.update.cache.console.command.xml b/plugins/org.eclipse.osee.orcs.core/OSGI-INF/orcs.update.cache.console.command.xml
index c0db68d9ce..ca290d3c62 100644
--- a/plugins/org.eclipse.osee.orcs.core/OSGI-INF/orcs.update.cache.console.command.xml
+++ b/plugins/org.eclipse.osee.orcs.core/OSGI-INF/orcs.update.cache.console.command.xml
@@ -4,5 +4,6 @@
<service>
<provide interface="org.eclipse.osee.console.admin.ConsoleCommand"/>
</service>
- <reference bind="setCachingService" cardinality="1..1" interface="org.eclipse.osee.framework.core.services.IOseeCachingService" name="IOseeCachingService" policy="static"/>
+ <reference bind="setOrcsApi" cardinality="1..1" interface="org.eclipse.osee.orcs.OrcsApi" name="OrcsApi" policy="static"/>
+ <reference bind="setCachingService" cardinality="1..1" interface="org.eclipse.osee.orcs.core.ds.TempCachingService" name="IOseeCachingService" policy="static"/>
</scr:component>
diff --git a/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/ds/BranchDataStore.java b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/ds/BranchDataStore.java
index 82da71de9f..00a7607266 100644
--- a/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/ds/BranchDataStore.java
+++ b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/ds/BranchDataStore.java
@@ -20,6 +20,7 @@ import org.eclipse.osee.framework.core.model.Branch;
import org.eclipse.osee.framework.core.model.TransactionRecord;
import org.eclipse.osee.framework.core.model.change.ChangeItem;
import org.eclipse.osee.framework.jdk.core.type.PropertyStore;
+import org.eclipse.osee.orcs.OrcsTypes;
import org.eclipse.osee.orcs.data.ArtifactReadable;
import org.eclipse.osee.orcs.data.CreateBranchData;
@@ -38,9 +39,9 @@ public interface BranchDataStore {
Callable<List<ChangeItem>> compareBranch(String sessionId, TransactionRecord sourceTx, TransactionRecord destinationTx);
- Callable<URI> exportBranch(String sessionId, List<IOseeBranch> branches, PropertyStore options, String exportName);
+ Callable<URI> exportBranch(String sessionId, OrcsTypes orcsTypes, List<IOseeBranch> branches, PropertyStore options, String exportName);
- Callable<URI> importBranch(String sessionId, URI fileToImport, List<IOseeBranch> branches, PropertyStore options);
+ Callable<URI> importBranch(String sessionId, OrcsTypes orcsTypes, URI fileToImport, List<IOseeBranch> branches, PropertyStore options);
Callable<URI> checkBranchExchangeIntegrity(String sessionId, URI fileToCheck);
diff --git a/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/ds/OrcsDataStore.java b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/ds/OrcsDataStore.java
index 6da1ea394f..0066638108 100644
--- a/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/ds/OrcsDataStore.java
+++ b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/ds/OrcsDataStore.java
@@ -10,12 +10,11 @@
*******************************************************************************/
package org.eclipse.osee.orcs.core.ds;
-import org.eclipse.osee.orcs.OrcsTypes;
/**
* @author Roberto E. Escobar
*/
-public interface OrcsDataStore extends OrcsTypes, OrcsTypesDataStore {
+public interface OrcsDataStore extends OrcsTypesDataStore {
BranchDataStore getBranchDataStore();
diff --git a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/types/IOseeModelingService.java b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/ds/TempCachingService.java
index 9fb24b6502..8ae5e5f2cd 100644
--- a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/types/IOseeModelingService.java
+++ b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/ds/TempCachingService.java
@@ -8,20 +8,29 @@
* Contributors:
* Boeing - initial API and implementation
*******************************************************************************/
-package org.eclipse.osee.orcs.db.internal.types;
+package org.eclipse.osee.orcs.core.ds;
-import java.io.OutputStream;
+import java.util.Collection;
+import org.eclipse.osee.framework.core.enums.OseeCacheEnum;
import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.core.model.OseeImportModelRequest;
-import org.eclipse.osee.framework.core.model.OseeImportModelResponse;
+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.cache.TransactionCache;
/**
* @author Roberto E. Escobar
*/
-public interface IOseeModelingService {
+public interface TempCachingService {
- void importOseeTypes(boolean isInitializing, OseeImportModelRequest request, OseeImportModelResponse response) throws OseeCoreException;
+ BranchCache getBranchCache();
- void exportOseeTypes(OutputStream outputStream) throws OseeCoreException;
+ TransactionCache getTransactionCache();
+ Collection<?> getCaches();
+
+ IOseeCache<?, ?> getCache(OseeCacheEnum cacheId) throws OseeCoreException;
+
+ void reloadAll() throws OseeCoreException;
+
+ void clearAll();
}
diff --git a/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/ds/criteria/CriteriaArtifactType.java b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/ds/criteria/CriteriaArtifactType.java
index eae40dc55b..3ea4faf7bb 100644
--- a/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/ds/criteria/CriteriaArtifactType.java
+++ b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/ds/criteria/CriteriaArtifactType.java
@@ -14,11 +14,10 @@ import java.util.Collection;
import java.util.LinkedHashSet;
import org.eclipse.osee.framework.core.data.IArtifactType;
import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.core.model.cache.ArtifactTypeCache;
-import org.eclipse.osee.framework.core.model.type.ArtifactType;
import org.eclipse.osee.framework.core.util.Conditions;
import org.eclipse.osee.orcs.core.ds.Criteria;
import org.eclipse.osee.orcs.core.ds.QueryOptions;
+import org.eclipse.osee.orcs.data.ArtifactTypes;
/**
* @author Roberto E. Escobar
@@ -26,9 +25,9 @@ import org.eclipse.osee.orcs.core.ds.QueryOptions;
public class CriteriaArtifactType extends Criteria<QueryOptions> {
private final Collection<? extends IArtifactType> artifactTypes;
- private final ArtifactTypeCache artTypeCache;
+ private final ArtifactTypes artTypeCache;
- public CriteriaArtifactType(ArtifactTypeCache artTypeCache, Collection<? extends IArtifactType> artifactTypes) {
+ public CriteriaArtifactType(ArtifactTypes artTypeCache, Collection<? extends IArtifactType> artifactTypes) {
super();
this.artifactTypes = artifactTypes;
this.artTypeCache = artTypeCache;
@@ -54,8 +53,7 @@ public class CriteriaArtifactType extends Criteria<QueryOptions> {
boolean includeTypeInheritance = options.isTypeInheritanceIncluded();
for (IArtifactType type : artifactTypes) {
if (includeTypeInheritance) {
- ArtifactType fullType = artTypeCache.get(type);
- for (IArtifactType descendant : fullType.getAllDescendantTypes()) {
+ for (IArtifactType descendant : artTypeCache.getAllDescendantTypes(type)) {
typesToUse.add(descendant);
}
}
diff --git a/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/ds/criteria/CriteriaAttributeKeywords.java b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/ds/criteria/CriteriaAttributeKeywords.java
index c96fb9b357..c62e4561f4 100644
--- a/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/ds/criteria/CriteriaAttributeKeywords.java
+++ b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/ds/criteria/CriteriaAttributeKeywords.java
@@ -17,24 +17,24 @@ import org.eclipse.osee.framework.core.data.IAttributeType;
import org.eclipse.osee.framework.core.enums.QueryOption;
import org.eclipse.osee.framework.core.exception.OseeArgumentException;
import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.core.model.cache.AttributeTypeCache;
import org.eclipse.osee.framework.core.util.Conditions;
import org.eclipse.osee.framework.jdk.core.util.Collections;
import org.eclipse.osee.orcs.core.ds.Criteria;
import org.eclipse.osee.orcs.core.ds.QueryOptions;
+import org.eclipse.osee.orcs.data.AttributeTypes;
/**
* @author Roberto E. Escobar
*/
public class CriteriaAttributeKeywords extends Criteria<QueryOptions> {
- private final AttributeTypeCache attributeTypeCache;
+ private final AttributeTypes attributeTypeCache;
private final Collection<? extends IAttributeType> attributeType;
private final Collection<String> values;
private final QueryOption[] options;
private final boolean includeAllTypes;
- public CriteriaAttributeKeywords(boolean includeAllTypes, Collection<? extends IAttributeType> attributeType, AttributeTypeCache attributeTypeCache, Collection<String> values, QueryOption... options) {
+ public CriteriaAttributeKeywords(boolean includeAllTypes, Collection<? extends IAttributeType> attributeType, AttributeTypes attributeTypeCache, Collection<String> values, QueryOption... options) {
super();
this.includeAllTypes = includeAllTypes;
this.attributeTypeCache = attributeTypeCache;
@@ -43,7 +43,7 @@ public class CriteriaAttributeKeywords extends Criteria<QueryOptions> {
this.options = options;
}
- public CriteriaAttributeKeywords(boolean includeAllTypes, Collection<? extends IAttributeType> attributeType, AttributeTypeCache attributeTypeCache, String value, QueryOption... options) {
+ public CriteriaAttributeKeywords(boolean includeAllTypes, Collection<? extends IAttributeType> attributeType, AttributeTypes attributeTypeCache, String value, QueryOption... options) {
this(includeAllTypes, attributeType, attributeTypeCache, java.util.Collections.singleton(value), options);
}
@@ -89,8 +89,8 @@ public class CriteriaAttributeKeywords extends Criteria<QueryOptions> {
ArrayList<String> notTaggable = new ArrayList<String>();
if (attributeTypeCache != null) {
for (IAttributeType type : attributeType) {
- if (!(attributeTypeCache.get(type)).isTaggable()) {
- notTaggable.add((attributeTypeCache.get(type)).getName());
+ if (!attributeTypeCache.isTaggable(type)) {
+ notTaggable.add((attributeTypeCache.getByUuid(type.getGuid())).getName());
}
}
if (!notTaggable.isEmpty()) {
diff --git a/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/OrcsApiImpl.java b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/OrcsApiImpl.java
index 5f7dee81ba..e2ff349221 100644
--- a/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/OrcsApiImpl.java
+++ b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/OrcsApiImpl.java
@@ -10,15 +10,19 @@
*******************************************************************************/
package org.eclipse.osee.orcs.core.internal;
+import java.util.Collections;
+import java.util.Set;
import java.util.concurrent.Callable;
import java.util.concurrent.FutureTask;
import org.eclipse.osee.executor.admin.ExecutorAdmin;
+import org.eclipse.osee.framework.core.data.IOseeBranch;
import org.eclipse.osee.framework.core.data.LazyObject;
import org.eclipse.osee.framework.core.enums.CoreBranches;
import org.eclipse.osee.framework.core.enums.SystemUser;
+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.TransactionCache;
-import org.eclipse.osee.framework.core.services.IOseeCachingService;
import org.eclipse.osee.framework.jdk.core.util.GUID;
import org.eclipse.osee.framework.jdk.core.util.Strings;
import org.eclipse.osee.logger.Log;
@@ -30,8 +34,10 @@ import org.eclipse.osee.orcs.OrcsPerformance;
import org.eclipse.osee.orcs.OrcsTypes;
import org.eclipse.osee.orcs.core.SystemPreferences;
import org.eclipse.osee.orcs.core.ds.OrcsDataStore;
+import org.eclipse.osee.orcs.core.ds.TempCachingService;
import org.eclipse.osee.orcs.core.internal.artifact.ArtifactBuilderFactoryImpl;
import org.eclipse.osee.orcs.core.internal.artifact.ArtifactFactory;
+import org.eclipse.osee.orcs.core.internal.attribute.AttributeClassRegistry;
import org.eclipse.osee.orcs.core.internal.attribute.AttributeClassResolver;
import org.eclipse.osee.orcs.core.internal.attribute.AttributeFactory;
import org.eclipse.osee.orcs.core.internal.indexer.IndexerModule;
@@ -42,11 +48,14 @@ import org.eclipse.osee.orcs.core.internal.search.QueryModule;
import org.eclipse.osee.orcs.core.internal.session.SessionContextImpl;
import org.eclipse.osee.orcs.core.internal.transaction.TransactionFactoryImpl;
import org.eclipse.osee.orcs.core.internal.transaction.handler.TxDataHandlerFactoryImpl;
+import org.eclipse.osee.orcs.core.internal.types.BranchHierarchyProvider;
+import org.eclipse.osee.orcs.core.internal.types.OrcsTypesModule;
import org.eclipse.osee.orcs.data.ArtifactReadable;
import org.eclipse.osee.orcs.data.GraphReadable;
import org.eclipse.osee.orcs.search.QueryFactory;
import org.eclipse.osee.orcs.search.QueryIndexer;
import org.eclipse.osee.orcs.transaction.TransactionFactory;
+import com.google.common.collect.Sets;
/**
* @author Roberto E. Escobar
@@ -55,8 +64,8 @@ public class OrcsApiImpl implements OrcsApi {
private Log logger;
private OrcsDataStore dataStore;
- private AttributeClassResolver resolver;
- private IOseeCachingService cacheService;
+ private AttributeClassRegistry registry;
+ private TempCachingService cacheService;
private ExecutorAdmin executorAdmin;
private SystemPreferences preferences;
@@ -66,6 +75,8 @@ public class OrcsApiImpl implements OrcsApi {
private QueryModule queryModule;
private IndexerModule indexerModule;
private TxDataHandlerFactoryImpl txUpdateFactory;
+ private OrcsTypesModule typesModule;
+ private SessionContext systemSession;
public void setLogger(Log logger) {
this.logger = logger;
@@ -75,11 +86,11 @@ public class OrcsApiImpl implements OrcsApi {
this.dataStore = dataStore;
}
- public void setAttributeClassResolver(AttributeClassResolver resolver) {
- this.resolver = resolver;
+ public void setAttributeClassRegistry(AttributeClassRegistry registry) {
+ this.registry = registry;
}
- public void setCacheService(IOseeCachingService cacheService) {
+ public void setCacheService(TempCachingService cacheService) {
this.cacheService = cacheService;
}
@@ -92,14 +103,42 @@ public class OrcsApiImpl implements OrcsApi {
}
public void start() {
- RelationFactory relationFactory = new RelationFactory(cacheService.getRelationTypeCache());
+ systemSession = createSession();
+ BranchHierarchyProvider hierarchyProvider = new BranchHierarchyProvider() {
+
+ @Override
+ public Iterable<? extends IOseeBranch> getParentHierarchy(IOseeBranch branch) throws OseeCoreException {
+ Set<IOseeBranch> branches = Sets.newLinkedHashSet();
+ BranchCache branchCache = cacheService.getBranchCache();
+
+ Branch branchPtr = branchCache.get(branch);
+ while (branchPtr != null) {
+ if (!branches.add(branchPtr)) {
+ logger.error("Cycle detected with branch: [%s]", branchPtr);
+ return Collections.emptyList();
+ }
+ branchPtr = branchPtr.getParentBranch();
+ }
+
+ return branches;
+ }
+ };
+
+ typesModule = new OrcsTypesModule(logger, dataStore, hierarchyProvider);
+ typesModule.start(getSystemSession());
+
+ OrcsTypes orcsTypes = typesModule.createOrcsTypes(getSystemSession());
+
+ RelationFactory relationFactory = new RelationFactory(orcsTypes.getRelationTypes());
+
+ AttributeClassResolver resolver = new AttributeClassResolver(registry, orcsTypes.getAttributeTypes());
AttributeFactory attributeFactory =
- new AttributeFactory(resolver, cacheService.getAttributeTypeCache(), dataStore.getDataFactory());
+ new AttributeFactory(resolver, dataStore.getDataFactory(), orcsTypes.getAttributeTypes());
ArtifactFactory artifactFactory =
new ArtifactFactory(dataStore.getDataFactory(), attributeFactory, relationFactory,
- cacheService.getArtifactTypeCache(), cacheService.getBranchCache());
+ cacheService.getBranchCache(), orcsTypes.getArtifactTypes());
proxyFactory = new ArtifactProxyFactory(artifactFactory);
@@ -111,8 +150,8 @@ public class OrcsApiImpl implements OrcsApi {
loaderFactory = new ArtifactLoaderFactoryImpl(dataStore.getDataLoaderFactory(), builderFactory);
queryModule =
- new QueryModule(logger, dataStore.getQueryEngine(), loaderFactory, cacheService.getArtifactTypeCache(),
- cacheService.getAttributeTypeCache(), dataStore.getDataLoaderFactory());
+ new QueryModule(logger, dataStore.getQueryEngine(), loaderFactory, dataStore.getDataLoaderFactory(),
+ orcsTypes.getArtifactTypes(), orcsTypes.getAttributeTypes());
indexerModule = new IndexerModule(logger, preferences, executorAdmin, dataStore.getQueryEngineIndexer());
indexerModule.start();
@@ -147,8 +186,7 @@ public class OrcsApiImpl implements OrcsApi {
@Override
public GraphReadable getGraph(ApplicationContext context) {
SessionContext sessionContext = getSessionContext(context);
- return new RelationGraphImpl(sessionContext, loaderFactory, cacheService.getArtifactTypeCache(),
- cacheService.getRelationTypeCache());
+ return new RelationGraphImpl(sessionContext, loaderFactory, getOrcsTypes(context).getRelationTypes());
}
@Override
@@ -169,7 +207,7 @@ public class OrcsApiImpl implements OrcsApi {
}
};
return new OrcsBranchImpl(logger, sessionContext, dataStore.getBranchDataStore(), cacheService.getBranchCache(),
- cacheService.getTransactionCache(), systemUser);
+ cacheService.getTransactionCache(), systemUser, getOrcsTypes(context));
}
@Override
@@ -197,6 +235,10 @@ public class OrcsApiImpl implements OrcsApi {
return indexerModule.createQueryIndexer(sessionContext);
}
+ private SessionContext getSystemSession() {
+ return systemSession;
+ }
+
private SessionContext getSessionContext(ApplicationContext context) {
// TODO get sessions from a session context cache - improve this
String sessionId = null;
@@ -209,9 +251,15 @@ public class OrcsApiImpl implements OrcsApi {
return new SessionContextImpl(sessionId);
}
+ private SessionContext createSession() {
+ String sessionId = GUID.create();
+ return new SessionContextImpl(sessionId);
+ }
+
@Override
public OrcsTypes getOrcsTypes(ApplicationContext context) {
- return dataStore;
+ SessionContext sessionContext = getSessionContext(context);
+ return typesModule.createOrcsTypes(sessionContext);
}
}
diff --git a/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/OrcsBranchImpl.java b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/OrcsBranchImpl.java
index 65e3eb7a85..124f48a99b 100644
--- a/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/OrcsBranchImpl.java
+++ b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/OrcsBranchImpl.java
@@ -28,6 +28,7 @@ import org.eclipse.osee.framework.core.model.change.ChangeItem;
import org.eclipse.osee.framework.jdk.core.type.PropertyStore;
import org.eclipse.osee.logger.Log;
import org.eclipse.osee.orcs.OrcsBranch;
+import org.eclipse.osee.orcs.OrcsTypes;
import org.eclipse.osee.orcs.core.ds.BranchDataStore;
import org.eclipse.osee.orcs.core.internal.branch.ArchiveUnarchiveBranchCallable;
import org.eclipse.osee.orcs.core.internal.branch.BranchDataFactory;
@@ -54,14 +55,16 @@ public class OrcsBranchImpl implements OrcsBranch {
private final BranchCache branchCache;
private final TransactionCache txCache;
private final BranchDataFactory branchDataFactory;
+ private final OrcsTypes orcsTypes;
- public OrcsBranchImpl(Log logger, SessionContext sessionContext, BranchDataStore branchStore, BranchCache branchCache, TransactionCache txCache, LazyObject<ArtifactReadable> systemUser) {
+ public OrcsBranchImpl(Log logger, SessionContext sessionContext, BranchDataStore branchStore, BranchCache branchCache, TransactionCache txCache, LazyObject<ArtifactReadable> systemUser, OrcsTypes orcsTypes) {
this.logger = logger;
this.sessionContext = sessionContext;
this.branchStore = branchStore;
this.branchCache = branchCache;
this.txCache = txCache;
branchDataFactory = new BranchDataFactory(branchCache, txCache);
+ this.orcsTypes = orcsTypes;
}
@Override
@@ -119,12 +122,12 @@ public class OrcsBranchImpl implements OrcsBranch {
@Override
public Callable<URI> exportBranch(List<IOseeBranch> branches, PropertyStore options, String exportName) {
- return branchStore.exportBranch(sessionContext.toString(), branches, options, exportName);
+ return branchStore.exportBranch(sessionContext.toString(), orcsTypes, branches, options, exportName);
}
@Override
public Callable<URI> importBranch(URI fileToImport, List<IOseeBranch> branches, PropertyStore options) {
- return branchStore.importBranch(sessionContext.toString(), fileToImport, branches, options);
+ return branchStore.importBranch(sessionContext.toString(), orcsTypes, fileToImport, branches, options);
}
@Override
diff --git a/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/artifact/ArtifactFactory.java b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/artifact/ArtifactFactory.java
index c8640afb73..d2695944cd 100644
--- a/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/artifact/ArtifactFactory.java
+++ b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/artifact/ArtifactFactory.java
@@ -18,7 +18,6 @@ import org.eclipse.osee.framework.core.data.IAttributeType;
import org.eclipse.osee.framework.core.data.IOseeBranch;
import org.eclipse.osee.framework.core.enums.CoreAttributeTypes;
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.BranchCache;
import org.eclipse.osee.framework.core.util.Conditions;
import org.eclipse.osee.orcs.core.ds.ArtifactData;
@@ -29,6 +28,7 @@ import org.eclipse.osee.orcs.core.internal.attribute.AttributeFactory;
import org.eclipse.osee.orcs.core.internal.relation.RelationContainer;
import org.eclipse.osee.orcs.core.internal.relation.RelationFactory;
import org.eclipse.osee.orcs.data.ArtifactReadable;
+import org.eclipse.osee.orcs.data.ArtifactTypes;
import org.eclipse.osee.orcs.data.AttributeReadable;
/**
@@ -36,19 +36,19 @@ import org.eclipse.osee.orcs.data.AttributeReadable;
*/
public class ArtifactFactory {
+ private final ArtifactDataFactory factory;
private final AttributeFactory attributeFactory;
private final RelationFactory relationFactory;
- private final ArtifactTypeCache artifactTypeCache;
private final BranchCache branchCache;
- private final ArtifactDataFactory factory;
+ private final ArtifactTypes artifactTypeCache;
- public ArtifactFactory(ArtifactDataFactory factory, AttributeFactory attributeFactory, RelationFactory relationFactory, ArtifactTypeCache artifactTypeCache, BranchCache branchCache) {
+ public ArtifactFactory(ArtifactDataFactory factory, AttributeFactory attributeFactory, RelationFactory relationFactory, BranchCache branchCache, ArtifactTypes artifactTypeCache) {
super();
this.factory = factory;
this.attributeFactory = attributeFactory;
this.relationFactory = relationFactory;
- this.artifactTypeCache = artifactTypeCache;
this.branchCache = branchCache;
+ this.artifactTypeCache = artifactTypeCache;
}
@SuppressWarnings("unused")
@@ -56,8 +56,8 @@ public class ArtifactFactory {
//TODO implement an artifact class resolver for specific artifact types
RelationContainer relationContainer = relationFactory.createRelationContainer(artifactData.getLocalId());
- return new ArtifactImpl(artifactData, attributeFactory, relationContainer, new BranchProvider(branchCache,
- artifactData), new ArtifactTypeProvider(artifactTypeCache, artifactData));
+ return new ArtifactImpl(artifactTypeCache, artifactData, attributeFactory, relationContainer, new BranchProvider(
+ branchCache, artifactData));
}
public ArtifactImpl createArtifact(IOseeBranch branch, IArtifactType artifactType, String guid) throws OseeCoreException {
diff --git a/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/artifact/ArtifactImpl.java b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/artifact/ArtifactImpl.java
index a85e8bf8c0..2666e9cf62 100644
--- a/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/artifact/ArtifactImpl.java
+++ b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/artifact/ArtifactImpl.java
@@ -18,7 +18,6 @@ import org.eclipse.osee.framework.core.enums.EditState;
import org.eclipse.osee.framework.core.enums.ModificationType;
import org.eclipse.osee.framework.core.exception.OseeCoreException;
import org.eclipse.osee.framework.core.model.Branch;
-import org.eclipse.osee.framework.core.model.type.ArtifactType;
import org.eclipse.osee.framework.jdk.core.util.Lib;
import org.eclipse.osee.orcs.core.ds.ArtifactData;
import org.eclipse.osee.orcs.core.internal.attribute.Attribute;
@@ -26,20 +25,21 @@ import org.eclipse.osee.orcs.core.internal.attribute.AttributeFactory;
import org.eclipse.osee.orcs.core.internal.attribute.AttributeManagerImpl;
import org.eclipse.osee.orcs.core.internal.relation.HasRelationContainer;
import org.eclipse.osee.orcs.core.internal.relation.RelationContainer;
+import org.eclipse.osee.orcs.data.ArtifactTypes;
import org.eclipse.osee.orcs.data.ArtifactWriteable;
public class ArtifactImpl extends AttributeManagerImpl implements ArtifactWriteable, HasRelationContainer, ArtifactVisitable {
+ private final ArtifactTypes artifactTypeCache;
private final RelationContainer relationContainer;
private EditState objectEditState;
private ArtifactData artifactData;
private final ValueProvider<Branch, ArtifactData> branchProvider;
- private final ValueProvider<ArtifactType, ArtifactData> artifactTypeProvider;
- public ArtifactImpl(ArtifactData artifactData, AttributeFactory attributeFactory, RelationContainer relationContainer, ValueProvider<Branch, ArtifactData> branchProvider, ValueProvider<ArtifactType, ArtifactData> artifactTypeProvider) {
+ public ArtifactImpl(ArtifactTypes artifactTypeCache, ArtifactData artifactData, AttributeFactory attributeFactory, RelationContainer relationContainer, ValueProvider<Branch, ArtifactData> branchProvider) {
super(attributeFactory);
+ this.artifactTypeCache = artifactTypeCache;
this.artifactData = artifactData;
- this.artifactTypeProvider = artifactTypeProvider;
this.branchProvider = branchProvider;
this.relationContainer = relationContainer;
this.objectEditState = EditState.NO_CHANGE;
@@ -60,7 +60,6 @@ public class ArtifactImpl extends AttributeManagerImpl implements ArtifactWritea
this.artifactData = data;
objectEditState = EditState.NO_CHANGE;
branchProvider.setOrcsData(data);
- artifactTypeProvider.setOrcsData(data);
}
public ModificationType getModificationType() {
@@ -93,8 +92,8 @@ public class ArtifactImpl extends AttributeManagerImpl implements ArtifactWritea
}
@Override
- public ArtifactType getArtifactType() throws OseeCoreException {
- return artifactTypeProvider.get();
+ public IArtifactType getArtifactType() throws OseeCoreException {
+ return artifactTypeCache.getByUuid(getOrcsData().getTypeUuid());
}
@Override
@@ -117,7 +116,7 @@ public class ArtifactImpl extends AttributeManagerImpl implements ArtifactWritea
@Override
public boolean isOfType(IArtifactType... otherTypes) throws OseeCoreException {
- return getArtifactType().inheritsFrom(otherTypes);
+ return artifactTypeCache.inheritsFrom(getArtifactType(), otherTypes);
}
@Override
@@ -140,12 +139,12 @@ public class ArtifactImpl extends AttributeManagerImpl implements ArtifactWritea
@Override
public boolean isAttributeTypeValid(IAttributeType attributeType) throws OseeCoreException {
- return getArtifactType().isValidAttributeType(attributeType, getBranch());
+ return artifactTypeCache.isValidAttributeType(getArtifactType(), getBranch(), attributeType);
}
@Override
public Collection<? extends IAttributeType> getValidAttributeTypes() throws OseeCoreException {
- return getArtifactType().getAttributeTypes(getBranch());
+ return artifactTypeCache.getAttributeTypes(getArtifactType(), getBranch());
}
@Override
diff --git a/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/artifact/ArtifactTypeProvider.java b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/artifact/ArtifactTypeProvider.java
deleted file mode 100644
index c21c81e5a6..0000000000
--- a/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/artifact/ArtifactTypeProvider.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2012 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.orcs.core.internal.artifact;
-
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.core.model.cache.ArtifactTypeCache;
-import org.eclipse.osee.framework.core.model.type.ArtifactType;
-import org.eclipse.osee.orcs.core.ds.ArtifactData;
-
-/**
- * @author Roberto E. Escobar
- */
-public class ArtifactTypeProvider extends OrcsLazyObject<ArtifactType, ArtifactData> implements ValueProvider<ArtifactType, ArtifactData> {
-
- private final ArtifactTypeCache artifactTypeCache;
-
- public ArtifactTypeProvider(ArtifactTypeCache artifactTypeCache, ArtifactData data) {
- super(data);
- this.artifactTypeCache = artifactTypeCache;
- }
-
- @Override
- protected ArtifactType instance() throws OseeCoreException {
- return artifactTypeCache.getByGuid(getOrcsData().getTypeUuid());
- }
-
-}
diff --git a/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/attribute/Attribute.java b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/attribute/Attribute.java
index 4b08cac496..498346f26e 100644
--- a/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/attribute/Attribute.java
+++ b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/attribute/Attribute.java
@@ -18,8 +18,6 @@ import org.eclipse.osee.framework.core.enums.ModificationType;
import org.eclipse.osee.framework.core.exception.OseeCoreException;
import org.eclipse.osee.framework.core.exception.OseeExceptions;
import org.eclipse.osee.framework.core.exception.OseeStateException;
-import org.eclipse.osee.framework.core.model.cache.AttributeTypeCache;
-import org.eclipse.osee.framework.core.model.type.AttributeType;
import org.eclipse.osee.framework.core.util.Conditions;
import org.eclipse.osee.framework.jdk.core.util.Lib;
import org.eclipse.osee.logger.Log;
@@ -27,20 +25,21 @@ import org.eclipse.osee.orcs.core.ds.AttributeData;
import org.eclipse.osee.orcs.core.ds.DataProxy;
import org.eclipse.osee.orcs.core.ds.HasOrcsData;
import org.eclipse.osee.orcs.core.internal.artifact.AttributeManager;
+import org.eclipse.osee.orcs.data.AttributeTypes;
import org.eclipse.osee.orcs.data.AttributeWriteable;
/**
* @author Ryan D. Brooks
*/
public abstract class Attribute<T> implements HasOrcsData<AttributeData>, Comparable<Attribute<T>>, AttributeWriteable<T> {
- private AttributeTypeCache attributeTypeCache;
+ private AttributeTypes attributeTypeCache;
private Reference<AttributeManager> containerReference;
private boolean dirty;
private String defaultValue;
private Log logger;
private AttributeData attributeData;
- public void internalInitialize(AttributeTypeCache attributeTypeCache, Reference<AttributeManager> containerReference, AttributeData attributeData, boolean isDirty, boolean setDefaultValue) throws OseeCoreException {
+ public void internalInitialize(AttributeTypes attributeTypeCache, Reference<AttributeManager> containerReference, AttributeData attributeData, boolean isDirty, boolean setDefaultValue) throws OseeCoreException {
this.attributeTypeCache = attributeTypeCache;
this.containerReference = containerReference;
this.attributeData = attributeData;
@@ -210,11 +209,7 @@ public abstract class Attribute<T> implements HasOrcsData<AttributeData>, Compar
}
protected String getDefaultValueFromMetaData() throws OseeCoreException {
- return getType().getDefaultValue();
- }
-
- private AttributeType getType() throws OseeCoreException {
- return attributeTypeCache.getByGuid(getOrcsData().getTypeUuid());
+ return attributeTypeCache.getDefaultValue(getAttributeType());
}
/**
@@ -223,7 +218,7 @@ public abstract class Attribute<T> implements HasOrcsData<AttributeData>, Compar
*/
@Override
public IAttributeType getAttributeType() throws OseeCoreException {
- return attributeTypeCache.getByGuid(getOrcsData().getTypeUuid());
+ return attributeTypeCache.getByUuid(getOrcsData().getTypeUuid());
}
/**
@@ -270,7 +265,7 @@ public abstract class Attribute<T> implements HasOrcsData<AttributeData>, Compar
@Override
public boolean canDelete() {
try {
- return getContainer().getAttributeCount(getAttributeType()) > getType().getMinOccurrences();
+ return getContainer().getAttributeCount(getAttributeType()) > attributeTypeCache.getMinOccurrences(getAttributeType());
} catch (OseeCoreException ex) {
return false;
}
diff --git a/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/attribute/AttributeClassRegistry.java b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/attribute/AttributeClassRegistry.java
new file mode 100644
index 0000000000..4de0bd70ed
--- /dev/null
+++ b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/attribute/AttributeClassRegistry.java
@@ -0,0 +1,71 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.orcs.core.internal.attribute;
+
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+import org.eclipse.osee.logger.Log;
+import org.eclipse.osee.orcs.core.AttributeClassProvider;
+import org.eclipse.osee.orcs.core.annotations.OseeAttribute;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class AttributeClassRegistry {
+
+ private final Map<String, Class<? extends Attribute<?>>> map =
+ new ConcurrentHashMap<String, Class<? extends Attribute<?>>>();
+
+ private Log logger;
+
+ public void setLogger(Log logger) {
+ this.logger = logger;
+ }
+
+ public void start() {
+ //
+ }
+
+ public void stop() {
+ //
+ }
+
+ public void addProvider(AttributeClassProvider provider) {
+ for (Class<? extends Attribute<?>> clazz : provider.getClasses()) {
+ String alias = toAlias(clazz);
+ map.put(alias, clazz);
+ }
+ }
+
+ public void removeProvider(AttributeClassProvider provider) {
+ for (Class<? extends Attribute<?>> clazz : provider.getClasses()) {
+ String alias = toAlias(clazz);
+ map.remove(alias);
+ }
+ }
+
+ private String toAlias(Class<? extends Attribute<?>> clazz) {
+ OseeAttribute annotation = clazz.getAnnotation(OseeAttribute.class);
+ String toReturn;
+ if (annotation != null) {
+ toReturn = annotation.value();
+ } else {
+ toReturn = clazz.getSimpleName();
+ logger.warn("Unable to find OseeAttribute annotation for [%s] - registering using clazz simple name [%s]",
+ clazz, toReturn);
+ }
+ return toReturn;
+ }
+
+ public Class<? extends Attribute<?>> getBaseClazz(String alias) {
+ return map.get(alias);
+ }
+}
diff --git a/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/attribute/AttributeClassResolver.java b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/attribute/AttributeClassResolver.java
index 852bbffb93..389b181a31 100644
--- a/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/attribute/AttributeClassResolver.java
+++ b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/attribute/AttributeClassResolver.java
@@ -10,79 +10,40 @@
*******************************************************************************/
package org.eclipse.osee.orcs.core.internal.attribute;
-import java.util.Map;
-import java.util.concurrent.ConcurrentHashMap;
+import org.eclipse.osee.framework.core.data.IAttributeType;
import org.eclipse.osee.framework.core.exception.OseeCoreException;
import org.eclipse.osee.framework.core.exception.OseeExceptions;
-import org.eclipse.osee.framework.core.model.type.AttributeType;
import org.eclipse.osee.framework.core.util.Conditions;
import org.eclipse.osee.framework.jdk.core.util.Lib;
-import org.eclipse.osee.logger.Log;
-import org.eclipse.osee.orcs.core.AttributeClassProvider;
-import org.eclipse.osee.orcs.core.annotations.OseeAttribute;
+import org.eclipse.osee.orcs.data.AttributeTypes;
/**
* @author Roberto E. Escobar
*/
public class AttributeClassResolver {
- private final Map<String, Class<? extends Attribute<?>>> map =
- new ConcurrentHashMap<String, Class<? extends Attribute<?>>>();
+ private final AttributeClassRegistry registry;
+ private final AttributeTypes attributeTypes;
- private Log logger;
-
- public void setLogger(Log logger) {
- this.logger = logger;
- }
-
- public void start() {
- //
- }
-
- public void stop() {
- //
- }
-
- public void addProvider(AttributeClassProvider provider) {
- for (Class<? extends Attribute<?>> clazz : provider.getClasses()) {
- String alias = toAlias(clazz);
- map.put(alias, clazz);
- }
- }
-
- public void removeProvider(AttributeClassProvider provider) {
- for (Class<? extends Attribute<?>> clazz : provider.getClasses()) {
- String alias = toAlias(clazz);
- map.remove(alias);
- }
- }
-
- private String toAlias(Class<? extends Attribute<?>> clazz) {
- OseeAttribute annotation = clazz.getAnnotation(OseeAttribute.class);
- String toReturn;
- if (annotation != null) {
- toReturn = annotation.value();
- } else {
- toReturn = clazz.getSimpleName();
- logger.warn("Unable to find OseeAttribute annotation for [%s] - registering using clazz simple name [%s]",
- clazz, toReturn);
- }
- return toReturn;
+ public AttributeClassResolver(AttributeClassRegistry registry, AttributeTypes attributeTypes) {
+ super();
+ this.registry = registry;
+ this.attributeTypes = attributeTypes;
}
public Class<? extends Attribute<?>> getBaseClazz(String alias) {
- return map.get(alias);
+ return registry.getBaseClazz(alias);
}
- protected Class<? extends Attribute<?>> getBaseClazz(AttributeType attributeType) {
- String alias = attributeType.getBaseAttributeTypeId();
+ protected Class<? extends Attribute<?>> getBaseClazz(IAttributeType attributeType) throws OseeCoreException {
+ String alias = attributeTypes.getBaseAttributeTypeId(attributeType);
if (alias.contains(".")) {
alias = Lib.getExtension(alias);
}
return getBaseClazz(alias);
}
- public boolean isBaseTypeCompatible(Class<? extends Attribute<?>> baseType, AttributeType attributeType) throws OseeCoreException {
+ public boolean isBaseTypeCompatible(Class<? extends Attribute<?>> baseType, IAttributeType attributeType) throws OseeCoreException {
Conditions.checkNotNull(baseType, "baseType", "Unable to determine base type from null");
Conditions.checkNotNull(attributeType, "attributeType");
Class<? extends Attribute<?>> clazz = getBaseClazz(attributeType);
@@ -91,14 +52,14 @@ public class AttributeClassResolver {
return baseType.isAssignableFrom(clazz);
}
- public <T> Attribute<T> createAttribute(AttributeType type) throws OseeCoreException {
+ public <T> Attribute<T> createAttribute(IAttributeType type) throws OseeCoreException {
Class<? extends Attribute<?>> attributeClass = getAttributeClass(type);
Conditions.checkNotNull(attributeClass, "attributeClass",
"Cannot find attribute class base type for attributeType[%s]", type);
return createAttribute(attributeClass);
}
- private Class<? extends Attribute<?>> getAttributeClass(AttributeType type) {
+ private Class<? extends Attribute<?>> getAttributeClass(IAttributeType type) throws OseeCoreException {
Class<? extends Attribute<?>> attributeClass = getBaseClazz(type);
if (attributeClass == null) {
// TODO Word Attributes etc - Default to StringAttribute if Null
diff --git a/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/attribute/AttributeFactory.java b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/attribute/AttributeFactory.java
index fb74a26f89..b20ebe59af 100644
--- a/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/attribute/AttributeFactory.java
+++ b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/attribute/AttributeFactory.java
@@ -15,8 +15,6 @@ import java.lang.ref.WeakReference;
import org.eclipse.osee.framework.core.data.IAttributeType;
import org.eclipse.osee.framework.core.data.IOseeBranch;
import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.core.model.cache.AttributeTypeCache;
-import org.eclipse.osee.framework.core.model.type.AttributeType;
import org.eclipse.osee.framework.core.util.Conditions;
import org.eclipse.osee.orcs.core.ds.ArtifactData;
import org.eclipse.osee.orcs.core.ds.AttributeData;
@@ -24,6 +22,7 @@ import org.eclipse.osee.orcs.core.ds.AttributeDataFactory;
import org.eclipse.osee.orcs.core.ds.DataProxy;
import org.eclipse.osee.orcs.core.ds.ResourceNameResolver;
import org.eclipse.osee.orcs.core.internal.artifact.AttributeManager;
+import org.eclipse.osee.orcs.data.AttributeTypes;
/**
* @author Roberto E. Escobar
@@ -31,13 +30,13 @@ import org.eclipse.osee.orcs.core.internal.artifact.AttributeManager;
public class AttributeFactory {
private final AttributeClassResolver classResolver;
- private final AttributeTypeCache cache;
private final AttributeDataFactory dataFactory;
+ private final AttributeTypes cache;
- public AttributeFactory(AttributeClassResolver classResolver, AttributeTypeCache cache, AttributeDataFactory dataFactory) {
+ public AttributeFactory(AttributeClassResolver classResolver, AttributeDataFactory dataFactory, AttributeTypes cache) {
this.classResolver = classResolver;
- this.cache = cache;
this.dataFactory = dataFactory;
+ this.cache = cache;
}
public <T> Attribute<T> createAttributeWithDefaults(AttributeManager container, ArtifactData artifactData, IAttributeType attributeType) throws OseeCoreException {
@@ -50,7 +49,7 @@ public class AttributeFactory {
}
private <T> Attribute<T> createAttribute(AttributeManager container, AttributeData data, boolean isDirty, boolean createWithDefaults) throws OseeCoreException {
- AttributeType type = cache.getByGuid(data.getTypeUuid());
+ IAttributeType type = cache.getByUuid(data.getTypeUuid());
Conditions.checkNotNull(type, "attributeType", "Cannot find attribute type with uuid[%s]", data.getTypeUuid());
Attribute<T> attribute = classResolver.createAttribute(type);
@@ -89,22 +88,16 @@ public class AttributeFactory {
return introducedAttribute;
}
- private AttributeType getAttribeType(IAttributeType token) throws OseeCoreException {
- return token instanceof AttributeType ? (AttributeType) token : cache.get(token);
- }
-
private ResourceNameResolver createResolver(Attribute<?> attribute) {
return new AttributeResourceNameResolver(cache, attribute);
}
public int getMaxOccurrenceLimit(IAttributeType attributeType) throws OseeCoreException {
- AttributeType type = getAttribeType(attributeType);
- return type.getMaxOccurrences();
+ return cache.getMaxOccurrences(attributeType);
}
public int getMinOccurrenceLimit(IAttributeType attributeType) throws OseeCoreException {
- AttributeType type = getAttribeType(attributeType);
- return type.getMinOccurrences();
+ return cache.getMinOccurrences(attributeType);
}
}
diff --git a/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/attribute/AttributeResourceNameResolver.java b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/attribute/AttributeResourceNameResolver.java
index b65613c942..88091da88e 100644
--- a/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/attribute/AttributeResourceNameResolver.java
+++ b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/attribute/AttributeResourceNameResolver.java
@@ -17,11 +17,11 @@ import org.eclipse.osee.framework.core.data.Identity;
import org.eclipse.osee.framework.core.data.Named;
import org.eclipse.osee.framework.core.enums.CoreAttributeTypes;
import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.core.model.cache.AttributeTypeCache;
import org.eclipse.osee.framework.core.util.Conditions;
import org.eclipse.osee.framework.jdk.core.util.GUID;
import org.eclipse.osee.framework.jdk.core.util.Strings;
import org.eclipse.osee.orcs.core.ds.ResourceNameResolver;
+import org.eclipse.osee.orcs.data.AttributeTypes;
/**
* @author Roberto E. Escobar
@@ -30,9 +30,9 @@ public class AttributeResourceNameResolver implements ResourceNameResolver {
private final static int MAX_NAME_SIZE = 60;
private final Attribute<?> attribute;
- private final AttributeTypeCache attributeTypeCache;
+ private final AttributeTypes attributeTypeCache;
- public AttributeResourceNameResolver(AttributeTypeCache attributeTypeCache, Attribute<?> attribute) {
+ public AttributeResourceNameResolver(AttributeTypes attributeTypeCache, Attribute<?> attribute) {
this.attributeTypeCache = attributeTypeCache;
this.attribute = attribute;
}
@@ -78,7 +78,7 @@ public class AttributeResourceNameResolver implements ResourceNameResolver {
fileTypeExtension = (String) attribute.getValue();
}
if (!Strings.isValid(fileTypeExtension)) {
- fileTypeExtension = attributeTypeCache.get(attributeType).getFileTypeExtension();
+ fileTypeExtension = attributeTypeCache.getFileTypeExtension(attributeType);
}
return fileTypeExtension;
}
diff --git a/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/console/CacheUpdateCommand.java b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/console/CacheUpdateCommand.java
index f95159e6e0..8464078576 100644
--- a/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/console/CacheUpdateCommand.java
+++ b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/console/CacheUpdateCommand.java
@@ -21,25 +21,38 @@ import org.eclipse.osee.executor.admin.CancellableCallable;
import org.eclipse.osee.framework.core.enums.OseeCacheEnum;
import org.eclipse.osee.framework.core.exception.OseeCoreException;
import org.eclipse.osee.framework.core.model.cache.IOseeCache;
-import org.eclipse.osee.framework.core.services.IOseeCachingService;
+import org.eclipse.osee.orcs.ApplicationContext;
+import org.eclipse.osee.orcs.OrcsApi;
+import org.eclipse.osee.orcs.OrcsTypes;
+import org.eclipse.osee.orcs.core.ds.TempCachingService;
/**
* @author Roberto E. Escobar
*/
public class CacheUpdateCommand implements ConsoleCommand {
- private static final OseeCacheEnum[] reloadableCaches = {
- OseeCacheEnum.ARTIFACT_TYPE_CACHE,
- OseeCacheEnum.BRANCH_CACHE,
- OseeCacheEnum.TRANSACTION_CACHE};
+ private static enum CacheType {
+ BRANCH_CACHE,
+ TRANSACTION_CACHE,
+ TYPE_CACHE;
+ }
+
+ private OrcsApi orcsApi;
+ private TempCachingService cachingService;
+
+ public void setOrcsApi(OrcsApi orcsApi) {
+ this.orcsApi = orcsApi;
+ }
- private IOseeCachingService cachingService;
+ public OrcsApi getOrcsApi() {
+ return orcsApi;
+ }
- public IOseeCachingService getCachingService() {
+ public TempCachingService getCachingService() {
return cachingService;
}
- public void setCachingService(IOseeCachingService cachingService) {
+ public void setCachingService(TempCachingService cachingService) {
this.cachingService = cachingService;
}
@@ -58,60 +71,79 @@ public class CacheUpdateCommand implements ConsoleCommand {
StringBuilder builder = new StringBuilder();
builder.append(" - Update all caches.\n");
builder.append("cache=<");
- builder.append(Arrays.deepToString(reloadableCaches).replaceAll(",", " | "));
+ builder.append(Arrays.deepToString(CacheType.values()).replaceAll(",", " | "));
builder.append("> - Caches to update.\n");
return builder.toString();
}
@Override
public Callable<?> createCallable(Console console, ConsoleParameters params) {
- Set<OseeCacheEnum> cacheIds = new HashSet<OseeCacheEnum>();
- for (String cacheId : params.getArray("cacheId")) {
- cacheIds.add(OseeCacheEnum.valueOf(cacheId.toUpperCase()));
- }
- if (cacheIds.isEmpty()) {
- cacheIds.addAll(Arrays.asList(reloadableCaches));
- }
- return new CacheUpdateCallable(console, getCachingService(), cacheIds, true);
+ return new CacheUpdateCallable(console, params, true);
}
- private final static class CacheUpdateCallable extends CancellableCallable<Boolean> {
+ private class CacheUpdateCallable extends CancellableCallable<Boolean> {
private final Console console;
- private final IOseeCachingService cachingService;
- private final Set<OseeCacheEnum> cacheIds;
+ private final ConsoleParameters params;
private final boolean reload;
private final String verb;
- public CacheUpdateCallable(Console console, IOseeCachingService cachingService, Set<OseeCacheEnum> cacheIds, boolean reload) {
+ public CacheUpdateCallable(Console console, ConsoleParameters params, boolean reload) {
this.console = console;
- this.cachingService = cachingService;
- this.cacheIds = cacheIds;
+ this.params = params;
this.reload = reload;
this.verb = reload ? "Reloaded" : "Cleared";
}
+ private Set<CacheType> getSelectedType() {
+ Set<CacheType> cacheIds = new HashSet<CacheType>();
+ for (String cacheId : params.getArray("cacheId")) {
+ cacheIds.add(CacheType.valueOf(cacheId.toUpperCase()));
+ }
+ if (cacheIds.isEmpty()) {
+ for (CacheType type : CacheType.values()) {
+ cacheIds.add(type);
+ }
+ }
+ return cacheIds;
+ }
+
+ private OrcsTypes getOrcTypes() {
+ return getOrcsApi().getOrcsTypes(new ApplicationContext() {
+
+ @Override
+ public String getSessionId() {
+ return "Update Cache Console Command";
+ }
+ });
+ }
+
@Override
public Boolean call() throws OseeCoreException {
- if (cacheIds.isEmpty()) {
- if (reload) {
- cachingService.reloadAll();
- } else {
- cachingService.clearAll();
+ OrcsTypes orcsTypes = getOrcTypes();
+
+ Set<CacheType> selectedType = getSelectedType();
+ for (CacheType type : selectedType) {
+ OseeCacheEnum cacheId = null;
+
+ if (CacheType.BRANCH_CACHE == type) {
+ cacheId = OseeCacheEnum.BRANCH_CACHE;
+ } else if (CacheType.TRANSACTION_CACHE == type) {
+ cacheId = OseeCacheEnum.TRANSACTION_CACHE;
}
- console.writeln("%s the following caches: %s", verb,
- Arrays.deepToString(OseeCacheEnum.values()).replaceAll(", SESSION_CACHE", ""));
- } else {
- for (OseeCacheEnum cacheId : cacheIds) {
+
+ if (cacheId != null) {
IOseeCache<?, ?> cache = cachingService.getCache(cacheId);
if (reload) {
cache.reloadCache();
} else {
cache.decacheAll();
}
+ } else {
+ orcsTypes.invalidateAll();
}
- console.writeln("%s %s", verb, cacheIds);
}
+ console.writeln("%s %s", verb, selectedType);
return Boolean.TRUE;
}
}
diff --git a/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/console/PurgeArtifactTypeCommand.java b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/console/PurgeArtifactTypeCommand.java
index 39e5adc365..8df4897e87 100644
--- a/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/console/PurgeArtifactTypeCommand.java
+++ b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/console/PurgeArtifactTypeCommand.java
@@ -19,12 +19,10 @@ import org.eclipse.osee.console.admin.ConsoleParameters;
import org.eclipse.osee.framework.core.data.IArtifactType;
import org.eclipse.osee.framework.core.exception.OseeArgumentException;
import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.core.model.cache.IOseeCache;
-import org.eclipse.osee.framework.core.model.type.ArtifactType;
-import org.eclipse.osee.framework.core.services.IOseeCachingService;
import org.eclipse.osee.framework.core.util.HexUtil;
import org.eclipse.osee.orcs.OrcsApi;
import org.eclipse.osee.orcs.OrcsTypes;
+import org.eclipse.osee.orcs.data.ArtifactTypes;
/**
* @author Angel Avila
@@ -32,7 +30,6 @@ import org.eclipse.osee.orcs.OrcsTypes;
public class PurgeArtifactTypeCommand implements ConsoleCommand {
private OrcsApi orcsApi;
- private IOseeCachingService cachingService;
public void setOrcsApi(OrcsApi orcsApi) {
this.orcsApi = orcsApi;
@@ -42,14 +39,6 @@ public class PurgeArtifactTypeCommand implements ConsoleCommand {
return orcsApi;
}
- public IOseeCachingService getCachingService() {
- return cachingService;
- }
-
- public void setCachingService(IOseeCachingService cachingService) {
- this.cachingService = cachingService;
- }
-
@Override
public String getName() {
return "purge_artifact_type";
@@ -68,7 +57,6 @@ public class PurgeArtifactTypeCommand implements ConsoleCommand {
@Override
public Callable<?> createCallable(final Console console, final ConsoleParameters params) {
final OrcsTypes orcsTypes = orcsApi.getOrcsTypes(null);
- final IOseeCache<Long, ArtifactType> types = getCachingService().getArtifactTypeCache();
return new Callable<Void>() {
@Override
@@ -90,11 +78,12 @@ public class PurgeArtifactTypeCommand implements ConsoleCommand {
}
private Set<IArtifactType> getTypes(String[] typesToPurge) throws OseeCoreException {
+ ArtifactTypes artifactTypes = orcsTypes.getArtifactTypes();
Set<IArtifactType> toReturn = new HashSet<IArtifactType>();
for (String uuid : typesToPurge) {
try {
- Long converted = HexUtil.toLong(uuid);
- IArtifactType type = types.getByGuid(converted);
+ Long typeId = HexUtil.toLong(uuid);
+ IArtifactType type = artifactTypes.getByUuid(typeId);
console.writeln("Type [%s] found. Guid: [0x%X]", type.getName(), type.getGuid());
toReturn.add(type);
} catch (OseeArgumentException ex) {
diff --git a/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/console/PurgeAttributeTypeCommand.java b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/console/PurgeAttributeTypeCommand.java
index c5c10164a9..4d50296785 100644
--- a/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/console/PurgeAttributeTypeCommand.java
+++ b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/console/PurgeAttributeTypeCommand.java
@@ -19,12 +19,10 @@ import org.eclipse.osee.console.admin.ConsoleParameters;
import org.eclipse.osee.framework.core.data.IAttributeType;
import org.eclipse.osee.framework.core.exception.OseeArgumentException;
import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.core.model.cache.IOseeCache;
-import org.eclipse.osee.framework.core.model.type.AttributeType;
-import org.eclipse.osee.framework.core.services.IOseeCachingService;
import org.eclipse.osee.framework.core.util.HexUtil;
import org.eclipse.osee.orcs.OrcsApi;
import org.eclipse.osee.orcs.OrcsTypes;
+import org.eclipse.osee.orcs.data.AttributeTypes;
/**
* @author Angel Avila
@@ -32,7 +30,6 @@ import org.eclipse.osee.orcs.OrcsTypes;
public class PurgeAttributeTypeCommand implements ConsoleCommand {
private OrcsApi orcsApi;
- private IOseeCachingService cachingService;
public void setOrcsApi(OrcsApi orcsApi) {
this.orcsApi = orcsApi;
@@ -42,14 +39,6 @@ public class PurgeAttributeTypeCommand implements ConsoleCommand {
return orcsApi;
}
- public IOseeCachingService getCachingService() {
- return cachingService;
- }
-
- public void setCachingService(IOseeCachingService cachingService) {
- this.cachingService = cachingService;
- }
-
@Override
public String getName() {
return "purge_attribute_type";
@@ -68,7 +57,6 @@ public class PurgeAttributeTypeCommand implements ConsoleCommand {
@Override
public Callable<?> createCallable(final Console console, final ConsoleParameters params) {
final OrcsTypes orcsTypes = orcsApi.getOrcsTypes(null);
- final IOseeCache<Long, AttributeType> types = getCachingService().getAttributeTypeCache();
return new Callable<Void>() {
@Override
@@ -90,11 +78,12 @@ public class PurgeAttributeTypeCommand implements ConsoleCommand {
}
private Set<IAttributeType> getTypes(String[] typesToPurge) throws OseeCoreException {
+ AttributeTypes attributeTypes = orcsTypes.getAttributeTypes();
Set<IAttributeType> toReturn = new HashSet<IAttributeType>();
for (String uuid : typesToPurge) {
try {
- Long converted = HexUtil.toLong(uuid);
- IAttributeType type = types.getByGuid(converted);
+ Long typeId = HexUtil.toLong(uuid);
+ IAttributeType type = attributeTypes.getByUuid(typeId);
console.writeln("Type [%s] found. Guid: [0x%X]", type.getName(), type.getGuid());
toReturn.add(type);
} catch (OseeArgumentException ex) {
diff --git a/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/console/PurgeRelationTypeCommand.java b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/console/PurgeRelationTypeCommand.java
index 4a61d8f981..678c2682b6 100644
--- a/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/console/PurgeRelationTypeCommand.java
+++ b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/console/PurgeRelationTypeCommand.java
@@ -19,12 +19,10 @@ import org.eclipse.osee.console.admin.ConsoleParameters;
import org.eclipse.osee.framework.core.data.IRelationType;
import org.eclipse.osee.framework.core.exception.OseeArgumentException;
import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.core.model.cache.IOseeCache;
-import org.eclipse.osee.framework.core.model.type.RelationType;
-import org.eclipse.osee.framework.core.services.IOseeCachingService;
import org.eclipse.osee.framework.core.util.HexUtil;
import org.eclipse.osee.orcs.OrcsApi;
import org.eclipse.osee.orcs.OrcsTypes;
+import org.eclipse.osee.orcs.data.RelationTypes;
/**
* @author Roberto E. Escobar
@@ -32,7 +30,6 @@ import org.eclipse.osee.orcs.OrcsTypes;
public class PurgeRelationTypeCommand implements ConsoleCommand {
private OrcsApi orcsApi;
- private IOseeCachingService cachingService;
public void setOrcsApi(OrcsApi orcsApi) {
this.orcsApi = orcsApi;
@@ -42,14 +39,6 @@ public class PurgeRelationTypeCommand implements ConsoleCommand {
return orcsApi;
}
- public IOseeCachingService getCachingService() {
- return cachingService;
- }
-
- public void setCachingService(IOseeCachingService cachingService) {
- this.cachingService = cachingService;
- }
-
@Override
public String getName() {
return "purge_relation_type";
@@ -68,7 +57,6 @@ public class PurgeRelationTypeCommand implements ConsoleCommand {
@Override
public Callable<?> createCallable(final Console console, final ConsoleParameters params) {
final OrcsTypes orcsTypes = orcsApi.getOrcsTypes(null);
- final IOseeCache<Long, RelationType> types = getCachingService().getRelationTypeCache();
return new Callable<Void>() {
@Override
@@ -90,11 +78,12 @@ public class PurgeRelationTypeCommand implements ConsoleCommand {
}
private Set<IRelationType> getTypes(String[] typesToPurge) throws OseeCoreException {
+ RelationTypes relationTypes = orcsTypes.getRelationTypes();
Set<IRelationType> toReturn = new HashSet<IRelationType>();
for (String uuid : typesToPurge) {
try {
- Long converted = HexUtil.toLong(uuid);
- IRelationType type = types.getByGuid(converted);
+ Long typeId = HexUtil.toLong(uuid);
+ IRelationType type = relationTypes.getByUuid(typeId);
console.writeln("Type [%s] found. Guid: [0x%X]", type.getName(), type.getGuid());
toReturn.add(type);
} catch (OseeArgumentException ex) {
diff --git a/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/relation/RelationContainerImpl.java b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/relation/RelationContainerImpl.java
index 319aaafb55..31ababc46e 100644
--- a/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/relation/RelationContainerImpl.java
+++ b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/relation/RelationContainerImpl.java
@@ -13,8 +13,8 @@ package org.eclipse.osee.orcs.core.internal.relation;
import java.util.Collection;
import org.eclipse.osee.framework.core.data.IRelationTypeSide;
import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.core.model.cache.RelationTypeCache;
import org.eclipse.osee.orcs.core.ds.RelationData;
+import org.eclipse.osee.orcs.data.RelationTypes;
/**
* @author Andrew M. Finkbeiner
@@ -23,7 +23,7 @@ public class RelationContainerImpl implements RelationContainer {
private final RelationRowCollection rows;
- public RelationContainerImpl(int parentId, RelationTypeCache relationTypeCache) {
+ public RelationContainerImpl(int parentId, RelationTypes relationTypeCache) {
this.rows = new RelationRowCollection(parentId, relationTypeCache);
}
diff --git a/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/relation/RelationFactory.java b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/relation/RelationFactory.java
index 9d82f7e4f8..39cbeeb30d 100644
--- a/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/relation/RelationFactory.java
+++ b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/relation/RelationFactory.java
@@ -10,13 +10,13 @@
*******************************************************************************/
package org.eclipse.osee.orcs.core.internal.relation;
-import org.eclipse.osee.framework.core.model.cache.RelationTypeCache;
+import org.eclipse.osee.orcs.data.RelationTypes;
public class RelationFactory {
- private final RelationTypeCache relationTypeCache;
+ private final RelationTypes relationTypeCache;
- public RelationFactory(RelationTypeCache relationTypeCache) {
+ public RelationFactory(RelationTypes relationTypeCache) {
this.relationTypeCache = relationTypeCache;
}
diff --git a/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/relation/RelationGraphImpl.java b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/relation/RelationGraphImpl.java
index 6a8f24da76..ca152fff51 100644
--- a/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/relation/RelationGraphImpl.java
+++ b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/relation/RelationGraphImpl.java
@@ -13,6 +13,7 @@ package org.eclipse.osee.orcs.core.internal.relation;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
+import java.util.LinkedList;
import java.util.List;
import org.eclipse.osee.framework.core.data.IArtifactType;
import org.eclipse.osee.framework.core.data.IOseeBranch;
@@ -23,16 +24,13 @@ import org.eclipse.osee.framework.core.enums.CoreRelationTypes;
import org.eclipse.osee.framework.core.enums.LoadLevel;
import org.eclipse.osee.framework.core.enums.RelationSide;
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.RelationTypeCache;
-import org.eclipse.osee.framework.core.model.type.ArtifactType;
-import org.eclipse.osee.framework.core.model.type.RelationType;
import org.eclipse.osee.orcs.core.internal.ArtifactLoaderFactory;
import org.eclipse.osee.orcs.core.internal.SessionContext;
import org.eclipse.osee.orcs.core.internal.proxy.HasProxiedObject;
import org.eclipse.osee.orcs.data.ArtifactReadable;
import org.eclipse.osee.orcs.data.ArtifactWriteable;
import org.eclipse.osee.orcs.data.GraphWriteable;
+import org.eclipse.osee.orcs.data.RelationTypes;
import org.eclipse.osee.orcs.data.RelationsReadable;
import org.eclipse.osee.orcs.data.RelationsWriteable;
@@ -43,14 +41,12 @@ public class RelationGraphImpl implements GraphWriteable, Cloneable {
private final SessionContext sessionContext;
private final ArtifactLoaderFactory loader;
- private final ArtifactTypeCache artifactTypeCache;
- private final RelationTypeCache relationTypeCache;
+ private final RelationTypes relationTypeCache;
- public RelationGraphImpl(SessionContext sessionContext, ArtifactLoaderFactory loader, ArtifactTypeCache artifactTypeCache, RelationTypeCache relationTypeCache) {
+ public RelationGraphImpl(SessionContext sessionContext, ArtifactLoaderFactory loader, RelationTypes relationTypeCache) {
super();
this.sessionContext = sessionContext;
this.loader = loader;
- this.artifactTypeCache = artifactTypeCache;
this.relationTypeCache = relationTypeCache;
}
@@ -106,11 +102,12 @@ public class RelationGraphImpl implements GraphWriteable, Cloneable {
}
@Override
- public List<RelationType> getValidRelationTypes(ArtifactReadable art) throws OseeCoreException {
+ public List<IRelationType> getValidRelationTypes(ArtifactReadable art) throws OseeCoreException {
IArtifactType artifactType = art.getArtifactType();
- Collection<RelationType> relationTypes = relationTypeCache.getAll();
- List<RelationType> validRelationTypes = new ArrayList<RelationType>();
- for (RelationType relationType : relationTypes) {
+
+ Collection<? extends IRelationType> relationTypes = relationTypeCache.getAll();
+ List<IRelationType> validRelationTypes = new LinkedList<IRelationType>();
+ for (IRelationType relationType : relationTypes) {
int sideAMax = getRelationSideMax(relationType, artifactType, RelationSide.SIDE_A);
int sideBMax = getRelationSideMax(relationType, artifactType, RelationSide.SIDE_B);
boolean onSideA = sideBMax > 0;
@@ -123,20 +120,14 @@ public class RelationGraphImpl implements GraphWriteable, Cloneable {
}
@Override
- public int getRelationSideMax(RelationType relationType, IArtifactType artifactType, RelationSide relationSide) throws OseeCoreException {
+ public int getRelationSideMax(IRelationType relationType, IArtifactType artifactType, RelationSide relationSide) throws OseeCoreException {
int toReturn = 0;
- ArtifactType type = artifactTypeCache.get(artifactType);
- if (relationType.isArtifactTypeAllowed(relationSide, type)) {
- toReturn = relationType.getMultiplicity().getLimit(relationSide);
+ if (relationTypeCache.isArtifactTypeAllowed(relationType, relationSide, artifactType)) {
+ toReturn = relationTypeCache.getMultiplicity(relationType).getLimit(relationSide);
}
return toReturn;
}
- @Override
- public RelationType getFullRelationType(IRelationTypeSide relationTypeSide) throws OseeCoreException {
- return relationTypeCache.get(relationTypeSide);
- }
-
@SuppressWarnings("unused")
@Override
public ArtifactWriteable getWriteableParent(ArtifactReadable otherArtifact) throws OseeCoreException {
@@ -188,4 +179,9 @@ public class RelationGraphImpl implements GraphWriteable, Cloneable {
// TX_TODO
return null;
}
+
+ @Override
+ public RelationTypes getTypes() {
+ return relationTypeCache;
+ }
}
diff --git a/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/relation/RelationRowCollection.java b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/relation/RelationRowCollection.java
index 21ceb553af..0a92c3ff87 100644
--- a/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/relation/RelationRowCollection.java
+++ b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/relation/RelationRowCollection.java
@@ -21,9 +21,9 @@ import org.eclipse.osee.framework.core.data.IRelationTypeSide;
import org.eclipse.osee.framework.core.data.TokenFactory;
import org.eclipse.osee.framework.core.enums.RelationSide;
import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.core.model.cache.RelationTypeCache;
import org.eclipse.osee.framework.core.util.Conditions;
import org.eclipse.osee.orcs.core.ds.RelationData;
+import org.eclipse.osee.orcs.data.RelationTypes;
/**
* @author Andrew M. Finkbeiner
@@ -34,16 +34,16 @@ public class RelationRowCollection {
new ConcurrentHashMap<IRelationTypeSide, List<RelationData>>();
private final int parentId;
- private final RelationTypeCache relationTypeCache;
+ private final RelationTypes relationTypeCache;
- RelationRowCollection(int parentId, RelationTypeCache relationTypeCache) {
+ RelationRowCollection(int parentId, RelationTypes relationTypeCache) {
this.parentId = parentId;
this.relationTypeCache = relationTypeCache;
}
private IRelationType getRelationType(RelationData relationRow) throws OseeCoreException {
long uuid = relationRow.getTypeUuid();
- IRelationType type = relationTypeCache.getByGuid(uuid);
+ IRelationType type = relationTypeCache.getByUuid(uuid);
Conditions.checkNotNull(type, "RelationType", "Unknown relation type. UUID[%d]", uuid);
return type;
}
diff --git a/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/search/CriteriaFactory.java b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/search/CriteriaFactory.java
index 40b2856809..947d983dec 100644
--- a/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/search/CriteriaFactory.java
+++ b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/search/CriteriaFactory.java
@@ -21,9 +21,6 @@ import org.eclipse.osee.framework.core.data.IRelationTypeSide;
import org.eclipse.osee.framework.core.enums.Operator;
import org.eclipse.osee.framework.core.enums.QueryOption;
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.AttributeTypeCache;
-import org.eclipse.osee.framework.core.model.type.AttributeType;
import org.eclipse.osee.orcs.core.ds.Criteria;
import org.eclipse.osee.orcs.core.ds.QueryOptions;
import org.eclipse.osee.orcs.core.ds.criteria.CriteriaAllArtifacts;
@@ -36,6 +33,8 @@ import org.eclipse.osee.orcs.core.ds.criteria.CriteriaAttributeOther;
import org.eclipse.osee.orcs.core.ds.criteria.CriteriaAttributeTypeExists;
import org.eclipse.osee.orcs.core.ds.criteria.CriteriaRelatedTo;
import org.eclipse.osee.orcs.core.ds.criteria.CriteriaRelationTypeExists;
+import org.eclipse.osee.orcs.data.ArtifactTypes;
+import org.eclipse.osee.orcs.data.AttributeTypes;
import org.eclipse.osee.orcs.search.QueryBuilder;
/**
@@ -44,10 +43,10 @@ import org.eclipse.osee.orcs.search.QueryBuilder;
@SuppressWarnings("unused")
public class CriteriaFactory {
- private final ArtifactTypeCache artifactTypeCache;
- private final AttributeTypeCache attributeTypeCache;
+ private final ArtifactTypes artifactTypeCache;
+ private final AttributeTypes attributeTypeCache;
- public CriteriaFactory(ArtifactTypeCache artifactTypeCache, AttributeTypeCache attributeTypeCache) {
+ public CriteriaFactory(ArtifactTypes artifactTypeCache, AttributeTypes attributeTypeCache) {
this.artifactTypeCache = artifactTypeCache;
this.attributeTypeCache = attributeTypeCache;
}
@@ -55,7 +54,7 @@ public class CriteriaFactory {
private Collection<? extends IAttributeType> checkForAnyType(Collection<? extends IAttributeType> attributeTypes) throws OseeCoreException {
Collection<? extends IAttributeType> toReturn;
if (attributeTypes.contains(QueryBuilder.ANY_ATTRIBUTE_TYPE)) {
- Collection<AttributeType> temp = new LinkedList<AttributeType>();
+ Collection<IAttributeType> temp = new LinkedList<IAttributeType>();
temp.addAll(attributeTypeCache.getAll());
toReturn = temp;
} else {
diff --git a/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/search/QueryModule.java b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/search/QueryModule.java
index 389057646d..9c5081d73c 100644
--- a/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/search/QueryModule.java
+++ b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/search/QueryModule.java
@@ -10,14 +10,14 @@
*******************************************************************************/
package org.eclipse.osee.orcs.core.internal.search;
-import org.eclipse.osee.framework.core.model.cache.ArtifactTypeCache;
-import org.eclipse.osee.framework.core.model.cache.AttributeTypeCache;
import org.eclipse.osee.logger.Log;
import org.eclipse.osee.orcs.core.ds.DataLoaderFactory;
import org.eclipse.osee.orcs.core.ds.QueryEngine;
import org.eclipse.osee.orcs.core.internal.ArtifactLoaderFactory;
import org.eclipse.osee.orcs.core.internal.HasStatistics;
import org.eclipse.osee.orcs.core.internal.SessionContext;
+import org.eclipse.osee.orcs.data.ArtifactTypes;
+import org.eclipse.osee.orcs.data.AttributeTypes;
import org.eclipse.osee.orcs.search.QueryFactory;
import org.eclipse.osee.orcs.statistics.QueryStatistics;
@@ -31,7 +31,7 @@ public class QueryModule implements HasStatistics<QueryStatistics> {
private final CriteriaFactory criteriaFctry;
private final CallableQueryFactory callableQueryFactory;
- public QueryModule(Log logger, QueryEngine queryEngine, ArtifactLoaderFactory objectLoader, ArtifactTypeCache artifactTypeCache, AttributeTypeCache attributeTypeCache, DataLoaderFactory dataLoader) {
+ public QueryModule(Log logger, QueryEngine queryEngine, ArtifactLoaderFactory objectLoader, DataLoaderFactory dataLoader, ArtifactTypes artifactTypeCache, AttributeTypes attributeTypeCache) {
QueryStatsCollectorImpl queryStatsCollector = new QueryStatsCollectorImpl(statistics);
this.criteriaFctry = new CriteriaFactory(artifactTypeCache, attributeTypeCache);
this.callableQueryFactory =
diff --git a/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/types/OrcsTypes.java b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/types/OrcsTypes.java
deleted file mode 100644
index 4b69a40409..0000000000
--- a/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/types/OrcsTypes.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2013 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.orcs.core.internal.types;
-
-import java.io.OutputStream;
-import java.util.Collection;
-import java.util.concurrent.Callable;
-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.resource.management.IResource;
-import org.eclipse.osee.orcs.data.ArtifactTypes;
-import org.eclipse.osee.orcs.data.AttributeTypes;
-import org.eclipse.osee.orcs.data.RelationTypes;
-import org.eclipse.osee.orcs.utility.ObjectProvider;
-
-/**
- * @author Roberto E. Escobar
- */
-public interface OrcsTypes {
-
- //TODO: Move this interface to org.eclipse.osee.orcs api
-
- ArtifactTypes getArtifactTypes();
-
- AttributeTypes getAttributeTypes();
-
- RelationTypes getRelationTypes();
-
- Callable<?> loadTypes(IResource resource, boolean isInitializing);
-
- Callable<?> writeTypes(ObjectProvider<? extends OutputStream> supplier);
-
- Callable<?> purgeArtifactsByArtifactType(Collection<? extends IArtifactType> artifactTypes);
-
- Callable<?> purgeAttributesByAttributeType(Collection<? extends IAttributeType> attributeTypes);
-
- Callable<?> purgeRelationsByRelationType(Collection<? extends IRelationType> relationTypes);
-
- void invalidateAll();
-}
diff --git a/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/types/OrcsTypesModule.java b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/types/OrcsTypesModule.java
index 4135856d31..f563a6f052 100644
--- a/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/types/OrcsTypesModule.java
+++ b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/types/OrcsTypesModule.java
@@ -11,6 +11,7 @@
package org.eclipse.osee.orcs.core.internal.types;
import org.eclipse.osee.logger.Log;
+import org.eclipse.osee.orcs.OrcsTypes;
import org.eclipse.osee.orcs.core.ds.OrcsTypesDataStore;
import org.eclipse.osee.orcs.core.internal.SessionContext;
import org.eclipse.osee.orcs.core.internal.types.impl.OrcsTypesImpl;
diff --git a/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/types/impl/OrcsTypesImpl.java b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/types/impl/OrcsTypesImpl.java
index 4d7a2a5cc3..5fc90ee59b 100644
--- a/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/types/impl/OrcsTypesImpl.java
+++ b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/types/impl/OrcsTypesImpl.java
@@ -22,16 +22,15 @@ import org.eclipse.osee.framework.core.exception.OseeExceptions;
import org.eclipse.osee.framework.jdk.core.util.Lib;
import org.eclipse.osee.framework.resource.management.IResource;
import org.eclipse.osee.logger.Log;
+import org.eclipse.osee.orcs.OrcsTypes;
import org.eclipse.osee.orcs.core.ds.OrcsTypesDataStore;
import org.eclipse.osee.orcs.core.internal.SessionContext;
-import org.eclipse.osee.orcs.core.internal.types.OrcsTypes;
import org.eclipse.osee.orcs.core.internal.types.OrcsTypesIndexProvider;
import org.eclipse.osee.orcs.core.internal.types.OrcsTypesLoaderFactory;
import org.eclipse.osee.orcs.core.internal.types.OrcsTypesResourceProvider;
import org.eclipse.osee.orcs.data.ArtifactTypes;
import org.eclipse.osee.orcs.data.AttributeTypes;
import org.eclipse.osee.orcs.data.RelationTypes;
-import org.eclipse.osee.orcs.utility.ObjectProvider;
/**
* @author Roberto E. Escobar
@@ -100,16 +99,14 @@ public class OrcsTypesImpl implements OrcsTypes {
}
@Override
- public Callable<?> writeTypes(final ObjectProvider<? extends OutputStream> supplier) {
+ public Callable<?> writeTypes(final OutputStream outputStream) {
return new CancellableCallable<Void>() {
@Override
public Void call() throws Exception {
logger.trace("Writing OrcsTypes for session [%s]", session);
IResource resource = indexProvider.getOrcsTypesResource();
InputStream inputStream = null;
- OutputStream outputStream = null;
try {
- outputStream = supplier.get();
inputStream = resource.getContent();
checkForCancelled();
Lib.inputStreamToOutputStream(inputStream, outputStream);
diff --git a/plugins/org.eclipse.osee.orcs.db/OSGI-INF/fix.duplicate.attributes.console.command.xml b/plugins/org.eclipse.osee.orcs.db/OSGI-INF/fix.duplicate.attributes.console.command.xml
index c0cfb8b32e..b46cfeee5d 100644
--- a/plugins/org.eclipse.osee.orcs.db/OSGI-INF/fix.duplicate.attributes.console.command.xml
+++ b/plugins/org.eclipse.osee.orcs.db/OSGI-INF/fix.duplicate.attributes.console.command.xml
@@ -6,5 +6,6 @@
</service>
<reference bind="setLogger" cardinality="1..1" interface="org.eclipse.osee.logger.Log" name="Log" policy="static"/>
<reference bind="setDatabaseService" cardinality="1..1" interface="org.eclipse.osee.framework.database.IOseeDatabaseService" name="IOseeDatabaseService" policy="static"/>
- <reference bind="setCachingService" cardinality="1..1" interface="org.eclipse.osee.framework.core.services.IOseeCachingService" name="IOseeCachingService" policy="static"/>
+ <reference bind="setIdentityService" cardinality="1..1" interface="org.eclipse.osee.framework.core.services.IdentityService" name="IdentityService" policy="static"/>
+ <reference bind="setOrcsApi" cardinality="1..1" interface="org.eclipse.osee.orcs.OrcsApi" name="OrcsApi" policy="static"/>
</scr:component>
diff --git a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/OrcsDataStoreImpl.java b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/OrcsDataStoreImpl.java
index 5678c97bd7..22816d2447 100644
--- a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/OrcsDataStoreImpl.java
+++ b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/OrcsDataStoreImpl.java
@@ -10,7 +10,6 @@
*******************************************************************************/
package org.eclipse.osee.orcs.db.internal;
-import java.io.OutputStream;
import java.util.Collection;
import java.util.concurrent.Callable;
import org.eclipse.osee.event.EventService;
@@ -20,16 +19,9 @@ import org.eclipse.osee.framework.core.data.IAttributeType;
import org.eclipse.osee.framework.core.data.IRelationType;
import org.eclipse.osee.framework.core.enums.OseeCacheEnum;
import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.core.model.OseeImportModelRequest;
-import org.eclipse.osee.framework.core.model.OseeImportModelResponse;
-import org.eclipse.osee.framework.core.model.cache.ArtifactTypeCache;
-import org.eclipse.osee.framework.core.model.cache.AttributeTypeCache;
import org.eclipse.osee.framework.core.model.cache.BranchCache;
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.cache.RelationTypeCache;
import org.eclipse.osee.framework.core.model.cache.TransactionCache;
-import org.eclipse.osee.framework.core.services.IOseeCachingService;
import org.eclipse.osee.framework.core.services.IOseeModelFactoryService;
import org.eclipse.osee.framework.core.services.IdentityService;
import org.eclipse.osee.framework.database.IOseeDatabaseService;
@@ -44,6 +36,7 @@ import org.eclipse.osee.orcs.core.ds.DataStoreAdmin;
import org.eclipse.osee.orcs.core.ds.OrcsDataStore;
import org.eclipse.osee.orcs.core.ds.QueryEngine;
import org.eclipse.osee.orcs.core.ds.QueryEngineIndexer;
+import org.eclipse.osee.orcs.core.ds.TempCachingService;
import org.eclipse.osee.orcs.db.internal.branch.BranchDataStoreImpl;
import org.eclipse.osee.orcs.db.internal.callable.OrcsTypeLoaderCallable;
import org.eclipse.osee.orcs.db.internal.callable.PurgeArtifactTypeDatabaseTxCallable;
@@ -57,13 +50,13 @@ import org.eclipse.osee.orcs.db.internal.loader.IdFactory;
import org.eclipse.osee.orcs.db.internal.loader.data.IdFactoryImpl;
import org.eclipse.osee.orcs.db.internal.search.QueryModuleFactory;
import org.eclipse.osee.orcs.db.internal.sql.StaticSqlProvider;
-import org.eclipse.osee.orcs.db.internal.types.OseeModelingServiceImpl;
+import org.eclipse.osee.orcs.db.internal.types.TempCachingServiceFactory;
import org.osgi.framework.BundleContext;
/**
* @author Roberto E. Escobar
*/
-public class OrcsDataStoreImpl implements OrcsDataStore, IOseeCachingService {
+public class OrcsDataStoreImpl implements OrcsDataStore, TempCachingService {
private Log logger;
private IOseeDatabaseService dbService;
@@ -80,8 +73,7 @@ public class OrcsDataStoreImpl implements OrcsDataStore, IOseeCachingService {
private DataModuleFactory dataModuleFactory;
private QueryModuleFactory queryModule;
- private OseeModelingServiceImpl modelingService;
- private IOseeCachingService cacheService;
+ private TempCachingService cacheService;
public void setLogger(Log logger) {
this.logger = logger;
@@ -121,9 +113,8 @@ public class OrcsDataStoreImpl implements OrcsDataStore, IOseeCachingService {
public void start(BundleContext context) {
- modelingService =
- new OseeModelingServiceImpl(logger, dbService, identityService, executorAdmin, resourceManager, modelFactory,
- eventService, this);
+ TempCachingServiceFactory modelingService =
+ new TempCachingServiceFactory(logger, dbService, executorAdmin, modelFactory, eventService);
cacheService = modelingService.createCachingService(true);
@@ -135,14 +126,14 @@ public class OrcsDataStoreImpl implements OrcsDataStore, IOseeCachingService {
dataModuleFactory = new DataModuleFactory(logger);
dataModuleFactory.create(dbService, idFactory, identityService, sqlProvider, proxyProvider,
- cacheService.getBranchCache(), cacheService.getArtifactTypeCache(), cacheService.getAttributeTypeCache());
+ cacheService.getBranchCache());
MissingChangeItemFactory missingChangeItemFactory =
new MissingChangeItemFactoryImpl(dataModuleFactory.getDataLoaderFactory(), identityService);
branchStore =
new BranchDataStoreImpl(logger, dbService, identityService, cacheService, preferences, executorAdmin,
- resourceManager, modelFactory, modelingService, idFactory, dataModuleFactory.getDataLoaderFactory(),
+ resourceManager, modelFactory, idFactory, dataModuleFactory.getDataLoaderFactory(),
missingChangeItemFactory);
dataStoreAdmin = new DataStoreAdminImpl(logger, dbService, identityService, branchStore, preferences);
@@ -193,17 +184,7 @@ public class OrcsDataStoreImpl implements OrcsDataStore, IOseeCachingService {
return queryModule.getQueryIndexer();
}
- @Override
- public void importOseeTypes(boolean isInitializing, OseeImportModelRequest request, OseeImportModelResponse response) throws OseeCoreException {
- modelingService.importOseeTypes(isInitializing, request, response);
- }
-
- @Override
- public void exportOseeTypes(OutputStream outputStream) throws OseeCoreException {
- modelingService.exportOseeTypes(outputStream);
- }
-
- private IOseeCachingService getProxied() {
+ private TempCachingService getProxied() {
return cacheService;
}
@@ -218,31 +199,6 @@ public class OrcsDataStoreImpl implements OrcsDataStore, IOseeCachingService {
}
@Override
- public ArtifactTypeCache getArtifactTypeCache() {
- return getProxied().getArtifactTypeCache();
- }
-
- @Override
- public AttributeTypeCache getAttributeTypeCache() {
- return getProxied().getAttributeTypeCache();
- }
-
- @Override
- public RelationTypeCache getRelationTypeCache() {
- return getProxied().getRelationTypeCache();
- }
-
- @Override
- public OseeEnumTypeCache getEnumTypeCache() {
- return getProxied().getEnumTypeCache();
- }
-
- @Override
- public IdentityService getIdentityService() {
- return getProxied().getIdentityService();
- }
-
- @Override
public Collection<?> getCaches() {
return getProxied().getCaches();
}
@@ -282,24 +238,4 @@ public class OrcsDataStoreImpl implements OrcsDataStore, IOseeCachingService {
return new PurgeRelationTypeDatabaseTxCallable(logger, dbService, identityService, typesToPurge);
}
- // TODO - REMOVE OrcsTypes interface from OrcsDataStore interface
- // TODO - REMOVE the bottom three methods
- // TODO - REMOVE IOseeCachingService interface from OrcsDataStoreImpl and all cachingService related methods
- // TODO - REMOVE IOseeModelingService and its implementations
- // TODO - DELETE types package from org.eclipse.osee.orcs.db.internal
- @Override
- public Callable<?> purgeArtifactsByArtifactType(Collection<? extends IArtifactType> artifactTypes) {
- return purgeArtifactsByArtifactType("", artifactTypes);
- }
-
- @Override
- public Callable<?> purgeAttributesByAttributeType(Collection<? extends IAttributeType> attributeTypes) {
- return purgeAttributesByAttributeType("", attributeTypes);
- }
-
- @Override
- public Callable<?> purgeRelationsByRelationType(Collection<? extends IRelationType> relationTypes) {
- return purgeRelationsByRelationType("", relationTypes);
- }
-
}
diff --git a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/accessor/ArtifactTypeDataAccessor.java b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/accessor/ArtifactTypeDataAccessor.java
deleted file mode 100644
index 1503564937..0000000000
--- a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/accessor/ArtifactTypeDataAccessor.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.orcs.db.internal.accessor;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.core.model.AbstractOseeType;
-import org.eclipse.osee.framework.core.model.cache.IOseeCache;
-import org.eclipse.osee.framework.core.model.cache.IOseeDataAccessor;
-import org.eclipse.osee.framework.core.services.IdentityService;
-
-/**
- * @author John R. Misinco
- */
-public class ArtifactTypeDataAccessor<T extends AbstractOseeType<Long>> implements IOseeDataAccessor<Long, T> {
-
- public static interface TypeLoader {
- void load() throws OseeCoreException;
- }
-
- private final TypeLoader loader;
- private final IdentityService identityService;
-
- public ArtifactTypeDataAccessor(IdentityService identityService, TypeLoader loader) {
- this.identityService = identityService;
- this.loader = loader;
- }
-
- @Override
- public synchronized void load(IOseeCache<Long, T> cache) throws OseeCoreException {
- loader.load();
- }
-
- @Override
- public void store(Collection<T> types) throws OseeCoreException {
- Collection<Long> remoteIds = new ArrayList<Long>();
- for (T type : types) {
- remoteIds.add(type.getGuid());
- }
- identityService.store(remoteIds);
- for (T type : types) {
- type.setId(identityService.getLocalId(type.getGuid()));
- type.clearDirty();
- }
- }
-}
diff --git a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/accessor/TypeLoaderImpl.java b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/accessor/TypeLoaderImpl.java
deleted file mode 100644
index 88d0fee58f..0000000000
--- a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/accessor/TypeLoaderImpl.java
+++ /dev/null
@@ -1,148 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2013 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.orcs.db.internal.accessor;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.StringWriter;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
-import org.eclipse.osee.framework.core.enums.CoreArtifactTypes;
-import org.eclipse.osee.framework.core.enums.CoreAttributeTypes;
-import org.eclipse.osee.framework.core.enums.CoreBranches;
-import org.eclipse.osee.framework.core.enums.TxChange;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.core.exception.OseeExceptions;
-import org.eclipse.osee.framework.core.model.Branch;
-import org.eclipse.osee.framework.core.model.OseeImportModelRequest;
-import org.eclipse.osee.framework.core.model.OseeImportModelResponse;
-import org.eclipse.osee.framework.core.model.cache.BranchCache;
-import org.eclipse.osee.framework.core.services.IdentityService;
-import org.eclipse.osee.framework.database.IOseeDatabaseService;
-import org.eclipse.osee.framework.database.core.IOseeStatement;
-import org.eclipse.osee.framework.jdk.core.type.PropertyStore;
-import org.eclipse.osee.framework.jdk.core.util.Lib;
-import org.eclipse.osee.framework.resource.management.IResource;
-import org.eclipse.osee.framework.resource.management.IResourceLocator;
-import org.eclipse.osee.framework.resource.management.IResourceManager;
-import org.eclipse.osee.framework.resource.management.StandardOptions;
-import org.eclipse.osee.orcs.db.internal.accessor.ArtifactTypeDataAccessor.TypeLoader;
-import org.eclipse.osee.orcs.db.internal.types.IOseeModelingService;
-
-public class TypeLoaderImpl implements TypeLoader {
- private static final String LOAD_OSEE_TYPE_DEF_URIS =
- "select attr.uri from osee_txs txs1, osee_artifact art, osee_attribute attr, osee_txs txs2 where txs1.branch_id = ? and txs1.tx_current = ? and txs1.gamma_id = art.gamma_id and txs2.branch_id = ? and txs2.tx_current = ? and txs2.gamma_id = attr.gamma_id and art.art_type_id = ? and art.art_id = attr.art_id and attr.attr_type_id = ?";
-
- private final boolean needsPriming;
- private final IOseeModelingService modelingService;
- private final IdentityService identityService;
- private final IOseeDatabaseService dbService;
- private final IResourceManager resourceManager;
- private final BranchCache branchCache;
- private volatile boolean loading = false;
-
- public TypeLoaderImpl(IOseeModelingService modelingService, IdentityService identityService, IOseeDatabaseService dbService, IResourceManager resourceManager, BranchCache branchCache, boolean needsPriming) {
- super();
- this.modelingService = modelingService;
- this.identityService = identityService;
- this.dbService = dbService;
- this.resourceManager = resourceManager;
- this.branchCache = branchCache;
- this.needsPriming = needsPriming;
- }
-
- @Override
- public void load() throws OseeCoreException {
- if (needsPriming && !loading) {
- loading = true;
- try {
- loadTypes();
- } finally {
- loading = false;
- }
- }
- }
-
- private void loadTypes() throws OseeCoreException {
- Collection<String> uriPaths = findOseeTypeData();
- if (!uriPaths.isEmpty()) {
- List<IResource> resources = getTypeData(uriPaths);
- String modelData = createCombinedFile(resources);
- String modelName = String.format("osee.types.%s.osee", Lib.getDateTimeString());
- OseeImportModelRequest request = new OseeImportModelRequest(modelName, modelData, false, false, true);
- OseeImportModelResponse response = new OseeImportModelResponse();
- modelingService.importOseeTypes(true, request, response);
- }
- }
-
- private Collection<String> findOseeTypeData() throws OseeCoreException {
- Collection<String> paths = new ArrayList<String>();
-
- Integer artifactTypeId = identityService.getLocalId(CoreArtifactTypes.OseeTypeDefinition);
- Integer attributeTypeId = identityService.getLocalId(CoreAttributeTypes.UriGeneralStringData);
-
- Branch commonBranch = branchCache.get(CoreBranches.COMMON);
-
- if (commonBranch != null) {
- IOseeStatement chStmt = null;
- try {
- chStmt = dbService.getStatement();
- chStmt.runPreparedQuery(LOAD_OSEE_TYPE_DEF_URIS, commonBranch.getId(), TxChange.CURRENT.getValue(),
- commonBranch.getId(), TxChange.CURRENT.getValue(), artifactTypeId, attributeTypeId);
- while (chStmt.next()) {
- String uri = chStmt.getString("uri");
- paths.add(uri);
- }
- } finally {
- Lib.close(chStmt);
- }
- }
- return paths;
- }
-
- private List<IResource> getTypeData(Collection<String> paths) throws OseeCoreException {
- List<IResource> toReturn = new ArrayList<IResource>();
-
- PropertyStore options = new PropertyStore();
- options.put(StandardOptions.DecompressOnAquire.name(), "true");
- for (String path : paths) {
- IResourceLocator locator = resourceManager.getResourceLocator(path);
- IResource resource = resourceManager.acquire(locator, options);
- toReturn.add(resource);
- }
- return toReturn;
- }
-
- private String createCombinedFile(List<IResource> resources) throws OseeCoreException {
- StringWriter writer = new StringWriter();
- for (IResource resource : resources) {
- InputStream inputStream = null;
- try {
- inputStream = resource.getContent();
- String oseeTypeFragment = Lib.inputStreamToString(inputStream);
- oseeTypeFragment = oseeTypeFragment.replaceAll("import\\s+\"", "// import \"");
- writer.write("\n");
- writer.write("////////////// ");
- writer.write(resource.getName());
- writer.write("\n");
- writer.write("\n");
- writer.write(oseeTypeFragment);
- } catch (IOException ex) {
- OseeExceptions.wrapAndThrow(ex);
- } finally {
- Lib.close(inputStream);
- }
- }
- return writer.toString();
- }
-
-}
diff --git a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/branch/BranchDataStoreImpl.java b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/branch/BranchDataStoreImpl.java
index 27725ccb64..4465ed3b4a 100644
--- a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/branch/BranchDataStoreImpl.java
+++ b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/branch/BranchDataStoreImpl.java
@@ -21,16 +21,17 @@ import org.eclipse.osee.framework.core.data.ITransaction;
import org.eclipse.osee.framework.core.model.Branch;
import org.eclipse.osee.framework.core.model.TransactionRecord;
import org.eclipse.osee.framework.core.model.change.ChangeItem;
-import org.eclipse.osee.framework.core.services.IOseeCachingService;
import org.eclipse.osee.framework.core.services.IOseeModelFactoryService;
import org.eclipse.osee.framework.core.services.IdentityService;
import org.eclipse.osee.framework.database.IOseeDatabaseService;
import org.eclipse.osee.framework.jdk.core.type.PropertyStore;
import org.eclipse.osee.framework.resource.management.IResourceManager;
import org.eclipse.osee.logger.Log;
+import org.eclipse.osee.orcs.OrcsTypes;
import org.eclipse.osee.orcs.core.SystemPreferences;
import org.eclipse.osee.orcs.core.ds.BranchDataStore;
import org.eclipse.osee.orcs.core.ds.DataLoaderFactory;
+import org.eclipse.osee.orcs.core.ds.TempCachingService;
import org.eclipse.osee.orcs.core.ds.TransactionData;
import org.eclipse.osee.orcs.core.ds.TransactionResult;
import org.eclipse.osee.orcs.data.ArtifactReadable;
@@ -54,7 +55,6 @@ import org.eclipse.osee.orcs.db.internal.transaction.TransactionCheck;
import org.eclipse.osee.orcs.db.internal.transaction.TransactionWriter;
import org.eclipse.osee.orcs.db.internal.transaction.TxSqlBuilderImpl;
import org.eclipse.osee.orcs.db.internal.transaction.UnsubscribeTransaction;
-import org.eclipse.osee.orcs.db.internal.types.IOseeModelingService;
/**
* @author Roberto E. Escobar
@@ -65,19 +65,18 @@ public class BranchDataStoreImpl implements BranchDataStore {
private final Log logger;
private final IOseeDatabaseService dbService;
private final IdentityService identityService;
- private final IOseeCachingService cachingService;
+ private final TempCachingService cachingService;
private final SystemPreferences preferences;
private final ExecutorAdmin executorAdmin;
private final IResourceManager resourceManager;
private final IOseeModelFactoryService modelFactory;
- private final IOseeModelingService typeModelService;
private final IdFactory idFactory;
private final DataLoaderFactory dataLoader;
private final MissingChangeItemFactory missingChangeItemFactory;
- public BranchDataStoreImpl(Log logger, IOseeDatabaseService dbService, IdentityService identityService, IOseeCachingService cachingService, SystemPreferences preferences, ExecutorAdmin executorAdmin, IResourceManager resourceManager, IOseeModelFactoryService modelFactory, IOseeModelingService typeModelService, IdFactory idFactory, DataLoaderFactory dataLoader, MissingChangeItemFactory missingChangeItemFactory) {
+ public BranchDataStoreImpl(Log logger, IOseeDatabaseService dbService, IdentityService identityService, TempCachingService cachingService, SystemPreferences preferences, ExecutorAdmin executorAdmin, IResourceManager resourceManager, IOseeModelFactoryService modelFactory, IdFactory idFactory, DataLoaderFactory dataLoader, MissingChangeItemFactory missingChangeItemFactory) {
super();
this.logger = logger;
this.dbService = dbService;
@@ -87,7 +86,6 @@ public class BranchDataStoreImpl implements BranchDataStore {
this.executorAdmin = executorAdmin;
this.resourceManager = resourceManager;
this.modelFactory = modelFactory;
- this.typeModelService = typeModelService;
this.idFactory = idFactory;
this.dataLoader = dataLoader;
this.missingChangeItemFactory = missingChangeItemFactory;
@@ -126,18 +124,17 @@ public class BranchDataStoreImpl implements BranchDataStore {
}
@Override
- public Callable<URI> exportBranch(String sessionId, List<IOseeBranch> branches, PropertyStore options, String exportName) {
- ExportItemFactory factory =
- new ExportItemFactory(logger, dbService, identityService, typeModelService, resourceManager);
+ public Callable<URI> exportBranch(String sessionId, OrcsTypes orcsTypes, List<IOseeBranch> branches, PropertyStore options, String exportName) {
+ ExportItemFactory factory = new ExportItemFactory(logger, dbService, identityService, resourceManager, orcsTypes);
return new ExportBranchDatabaseCallable(factory, preferences, executorAdmin, cachingService.getBranchCache(),
branches, options, exportName);
}
@Override
- public Callable<URI> importBranch(String sessionId, URI fileToImport, List<IOseeBranch> branches, PropertyStore options) {
+ public Callable<URI> importBranch(String sessionId, OrcsTypes orcsTypes, URI fileToImport, List<IOseeBranch> branches, PropertyStore options) {
ImportBranchDatabaseCallable callable =
- new ImportBranchDatabaseCallable(logger, dbService, preferences, typeModelService, resourceManager,
- identityService, fileToImport, branches, options);
+ new ImportBranchDatabaseCallable(logger, dbService, preferences, resourceManager, identityService, orcsTypes,
+ fileToImport, branches, options);
return callable;
}
diff --git a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/callable/CreateBranchDatabaseCallable.java b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/callable/CreateBranchDatabaseCallable.java
deleted file mode 100644
index c022685cfc..0000000000
--- a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/callable/CreateBranchDatabaseCallable.java
+++ /dev/null
@@ -1,103 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.orcs.db.internal.callable;
-
-import java.util.concurrent.Callable;
-import org.eclipse.osee.database.schema.DatabaseCallable;
-import org.eclipse.osee.framework.core.data.ITransaction;
-import org.eclipse.osee.framework.core.enums.BranchType;
-import org.eclipse.osee.framework.core.model.Branch;
-import org.eclipse.osee.framework.core.model.BranchFactory;
-import org.eclipse.osee.framework.core.model.TransactionRecord;
-import org.eclipse.osee.framework.core.model.TransactionRecordFactory;
-import org.eclipse.osee.framework.core.model.cache.BranchCache;
-import org.eclipse.osee.framework.core.model.cache.TransactionCache;
-import org.eclipse.osee.framework.database.IOseeDatabaseService;
-import org.eclipse.osee.logger.Log;
-import org.eclipse.osee.orcs.data.ArtifactReadable;
-import org.eclipse.osee.orcs.data.CreateBranchData;
-import org.eclipse.osee.orcs.db.internal.branch.CreateDatabaseBranch;
-
-/**
- * @author Roberto E. Escobar
- */
-public class CreateBranchDatabaseCallable extends DatabaseCallable<Branch> {
-
- private static final int NULL_PARENT_BRANCH_ID = -1;
- private static final int NULL_SOURCE_TRANSACTION_ID = -1;
- private static final int NULL_ARTIFACT_ID = -1;
-
- private final BranchCache branchCache;
- private final TransactionCache txCache;
- private final BranchFactory branchFactory;
- private final TransactionRecordFactory txFactory;
- private final CreateBranchData branchData;
-
- public CreateBranchDatabaseCallable(Log logger, IOseeDatabaseService service, BranchCache branchCache, TransactionCache txCache, BranchFactory branchFactory, TransactionRecordFactory txFactory, CreateBranchData branchData) {
- super(logger, service);
- this.branchCache = branchCache;
- this.txCache = txCache;
- this.branchFactory = branchFactory;
- this.txFactory = txFactory;
- this.branchData = branchData;
- }
-
- private TransactionCache getTxCache() {
- return txCache;
- }
-
- private BranchCache getBranchCache() {
- return branchCache;
- }
-
- private int toArtId(ArtifactReadable artifact) {
- int result = NULL_ARTIFACT_ID;
- if (artifact != null) {
- result = artifact.getLocalId();
- }
- return result;
- }
-
- @Override
- public Branch call() throws Exception {
- String branchGuid = branchData.getGuid();
- String branchName = branchData.getName();
- BranchType branchType = branchData.getBranchType();
- String creationComment = branchData.getCreationComment();
- ITransaction txData = branchData.getFromTransaction();
-
- ArtifactReadable authorArtifact = branchData.getUserArtifact();
- int authorId = toArtId(authorArtifact);
-
- ArtifactReadable associatedArtifact = branchData.getAssociatedArtifact();
- int associatedArtifactId = toArtId(associatedArtifact);
-
- int sourceTransactionId = NULL_SOURCE_TRANSACTION_ID;
- int parentBranchId = NULL_PARENT_BRANCH_ID;
- if (BranchType.SYSTEM_ROOT != branchType) {
- TransactionRecord sourceTx = getTxCache().getOrLoad(txData.getGuid());
- sourceTransactionId = sourceTx.getId();
- parentBranchId = sourceTx.getBranchId();
- }
-
- int mergeAddressingQueryId = branchData.getMergeAddressingQueryId();
- int destinationBranchId = branchData.getMergeDestinationBranchId();
-
- CreateDatabaseBranch createBranchData =
- new CreateDatabaseBranch(branchType, sourceTransactionId, parentBranchId, branchGuid, branchName,
- associatedArtifactId, authorId, creationComment, mergeAddressingQueryId, destinationBranchId);
-
- Callable<Branch> callable =
- new CreateBranchDatabaseTxCallable(getLogger(), getDatabaseService(), getBranchCache(), getTxCache(),
- branchFactory, txFactory, branchData);
- return callAndCheckForCancel(callable);
- }
-}
diff --git a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/callable/DuplicateAttributesDatabaseTxCallable.java b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/callable/DuplicateAttributesDatabaseTxCallable.java
deleted file mode 100644
index c30b4360f1..0000000000
--- a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/callable/DuplicateAttributesDatabaseTxCallable.java
+++ /dev/null
@@ -1,100 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.orcs.db.internal.callable;
-
-/**
- * @author Ryan D. Brooks
- */
-import org.eclipse.osee.console.admin.Console;
-import org.eclipse.osee.database.schema.DatabaseTxCallable;
-import org.eclipse.osee.framework.core.enums.TxChange;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.core.model.cache.AttributeTypeCache;
-import org.eclipse.osee.framework.core.model.type.AttributeType;
-import org.eclipse.osee.framework.database.IOseeDatabaseService;
-import org.eclipse.osee.framework.database.core.ExportImportJoinQuery;
-import org.eclipse.osee.framework.database.core.IOseeStatement;
-import org.eclipse.osee.framework.database.core.IdJoinQuery;
-import org.eclipse.osee.framework.database.core.JoinUtility;
-import org.eclipse.osee.framework.database.core.OseeConnection;
-import org.eclipse.osee.logger.Log;
-
-public final class DuplicateAttributesDatabaseTxCallable extends DatabaseTxCallable<Object> {
- private static final String SELECT_ATTRIBUTES =
- "select att1.gamma_id as gamma1, att2.gamma_id as gamma2 from osee_join_id oji, osee_attribute att1, osee_attribute att2 where oji.query_id = ? AND oji.id = att1.attr_type_id and att1.art_id = att2.art_id and att1.attr_type_id = att2.attr_type_id and att1.attr_id <> att2.attr_id";
- private static final String SELECT_DUPLICATES =
- "select txs1.branch_id, txs1.gamma_id as gamma1, txs2.gamma_id as gamma2 from osee_join_export_import idj, osee_txs txs1, osee_txs txs2 where idj.query_id = ? and idj.id1 = txs1.gamma_id and idj.id2 = txs2.gamma_id and txs1.branch_id = txs2.branch_id and txs1.tx_current = ? and txs2.tx_current = ?";
-
- private final Console console;
- private final AttributeTypeCache attTypeCache;
-
- public DuplicateAttributesDatabaseTxCallable(Log logger, IOseeDatabaseService databaseService, Console console, AttributeTypeCache attTypeCache) {
- super(logger, databaseService, "Duplicate Attributes");
- this.console = console;
- this.attTypeCache = attTypeCache;
- }
-
- @Override
- protected Object handleTxWork(OseeConnection connection) throws OseeCoreException {
- ExportImportJoinQuery gammaJoin = JoinUtility.createExportImportJoinQuery();
- try {
- selectAttributes(gammaJoin, connection);
- gammaJoin.store(connection);
- selectDuplicates(gammaJoin, connection);
- } catch (Exception ex) {
- console.write(ex);
- getLogger().error(ex, "Error fixing duplicate attributes");
- } finally {
- gammaJoin.delete(connection);
- }
- return null;
- }
-
- private void selectAttributes(ExportImportJoinQuery gammaJoin, OseeConnection connection) throws OseeCoreException {
- IdJoinQuery typeJoin = JoinUtility.createIdJoinQuery();
- populateAttributeTypeJoin(typeJoin);
-
- IOseeStatement chStmt = getDatabaseService().getStatement(connection);
- try {
- chStmt.runPreparedQuery(10000, SELECT_ATTRIBUTES, typeJoin.getQueryId());
- while (chStmt.next()) {
- gammaJoin.add(chStmt.getLong("gamma1"), chStmt.getLong("gamma2"));
- }
- } finally {
- chStmt.close();
- typeJoin.delete(connection);
- }
- }
-
- private void selectDuplicates(ExportImportJoinQuery gammaJoin, OseeConnection connection) throws OseeCoreException {
- IOseeStatement chStmt = getDatabaseService().getStatement(connection);
- try {
- chStmt.runPreparedQuery(SELECT_DUPLICATES, gammaJoin.getQueryId(), TxChange.CURRENT.getValue(),
- TxChange.CURRENT.getValue());
- while (chStmt.next()) {
- console.writeln("branch: " + chStmt.getInt("branch_id"), "gamma1: " + chStmt.getLong("gamma1"),
- "gamma2: " + chStmt.getLong("gamma2"));
- }
- } finally {
- chStmt.close();
- }
- }
-
- private void populateAttributeTypeJoin(IdJoinQuery typeJoin) throws OseeCoreException {
- for (AttributeType attributeType : attTypeCache.getAll()) {
- if (attributeType.getMaxOccurrences() == 1) {
- typeJoin.add(attributeType.getId());
- }
- }
- typeJoin.store();
- }
-
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/callable/ImportBranchDatabaseCallable.java b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/callable/ImportBranchDatabaseCallable.java
index fc0ac41192..711dea72c3 100644
--- a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/callable/ImportBranchDatabaseCallable.java
+++ b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/callable/ImportBranchDatabaseCallable.java
@@ -12,8 +12,10 @@ package org.eclipse.osee.orcs.db.internal.callable;
import java.io.BufferedInputStream;
import java.io.File;
+import java.io.IOException;
import java.io.InputStream;
import java.net.URI;
+import java.net.URL;
import java.sql.Timestamp;
import java.util.Collection;
import java.util.Date;
@@ -27,8 +29,6 @@ import org.eclipse.osee.framework.core.exception.OseeArgumentException;
import org.eclipse.osee.framework.core.exception.OseeCoreException;
import org.eclipse.osee.framework.core.exception.OseeExceptions;
import org.eclipse.osee.framework.core.exception.OseeStateException;
-import org.eclipse.osee.framework.core.model.OseeImportModelRequest;
-import org.eclipse.osee.framework.core.model.OseeImportModelResponse;
import org.eclipse.osee.framework.core.operation.OperationLogger;
import org.eclipse.osee.framework.core.services.IdentityService;
import org.eclipse.osee.framework.database.IOseeDatabaseService;
@@ -36,11 +36,12 @@ import org.eclipse.osee.framework.database.core.IOseeStatement;
import org.eclipse.osee.framework.database.core.OseeConnection;
import org.eclipse.osee.framework.jdk.core.type.Pair;
import org.eclipse.osee.framework.jdk.core.type.PropertyStore;
-import org.eclipse.osee.framework.jdk.core.util.Lib;
+import org.eclipse.osee.framework.resource.management.IResource;
import org.eclipse.osee.framework.resource.management.IResourceLocator;
import org.eclipse.osee.framework.resource.management.IResourceManager;
import org.eclipse.osee.logger.Log;
import org.eclipse.osee.orcs.ImportOptions;
+import org.eclipse.osee.orcs.OrcsTypes;
import org.eclipse.osee.orcs.core.SystemPreferences;
import org.eclipse.osee.orcs.db.internal.exchange.ExchangeUtil;
import org.eclipse.osee.orcs.db.internal.exchange.IOseeExchangeDataProvider;
@@ -60,7 +61,6 @@ import org.eclipse.osee.orcs.db.internal.exchange.transform.ExchangeTransformPro
import org.eclipse.osee.orcs.db.internal.exchange.transform.ExchangeTransformer;
import org.eclipse.osee.orcs.db.internal.exchange.transform.IExchangeTransformProvider;
import org.eclipse.osee.orcs.db.internal.resource.ResourceConstants;
-import org.eclipse.osee.orcs.db.internal.types.IOseeModelingService;
/**
* @author Roberto E. Escobar
@@ -68,9 +68,10 @@ import org.eclipse.osee.orcs.db.internal.types.IOseeModelingService;
public class ImportBranchDatabaseCallable extends DatabaseCallable<URI> {
private final SystemPreferences preferences;
- private final IOseeModelingService typeModelService;
+
private final IResourceManager resourceManager;
private final IdentityService identityService;
+ private final OrcsTypes orcsTypes;
private final SavePointManager savePointManager;
private final OperationLogger legacyLogger;
@@ -87,12 +88,12 @@ public class ImportBranchDatabaseCallable extends DatabaseCallable<URI> {
private ExchangeDataProcessor exchangeDataProcessor;
private int[] branchesToImport;
- public ImportBranchDatabaseCallable(Log logger, IOseeDatabaseService dbService, SystemPreferences preferences, IOseeModelingService typeModelService, IResourceManager resourceManager, IdentityService identityService, URI exchangeFile, List<IOseeBranch> selectedBranches, PropertyStore options) {
+ public ImportBranchDatabaseCallable(Log logger, IOseeDatabaseService dbService, SystemPreferences preferences, IResourceManager resourceManager, IdentityService identityService, OrcsTypes orcsTypes, URI exchangeFile, List<IOseeBranch> selectedBranches, PropertyStore options) {
super(logger, dbService);
this.preferences = preferences;
- this.typeModelService = typeModelService;
this.resourceManager = resourceManager;
this.identityService = identityService;
+ this.orcsTypes = orcsTypes;
this.savePointManager = new SavePointManager(dbService);
this.legacyLogger = new OperationLoggerAdaptor();
this.exchangeFile = exchangeFile;
@@ -282,30 +283,46 @@ public class ImportBranchDatabaseCallable extends DatabaseCallable<URI> {
}
}
- private void loadTypeModel(URI modelUri) throws Exception {
- String name = modelUri.toASCIIString();
- int index = name.lastIndexOf("/");
- if (index > 0) {
- name = name.substring(index + 1, name.length());
- }
+ private void loadTypeModel(final URI modelUri) throws Exception {
+ IResource typesResource = new IResource() {
- String model;
- InputStream inputStream = null;
- try {
- inputStream = new BufferedInputStream(modelUri.toURL().openStream());
- model = Lib.inputStreamToString(inputStream);
- } finally {
- Lib.close(inputStream);
- }
+ @Override
+ public InputStream getContent() throws OseeCoreException {
+ InputStream inputStream = null;
+ try {
+ URL url = modelUri.toURL();
+ inputStream = new BufferedInputStream(url.openStream());
+ } catch (IOException ex) {
+ OseeExceptions.wrapAndThrow(ex);
+ }
+ return inputStream;
+ }
- OseeImportModelRequest modelRequest = new OseeImportModelRequest(name, model, false, false, true);
- OseeImportModelResponse response = new OseeImportModelResponse();
+ @Override
+ public URI getLocation() {
+ return modelUri;
+ }
+
+ @Override
+ public String getName() {
+ String name = modelUri.toASCIIString();
+ int index = name.lastIndexOf("/");
+ if (index > 0) {
+ name = name.substring(index + 1, name.length());
+ }
+ return name;
+ }
- getLogger().info("Updating Type Model with [%s]", model);
- typeModelService.importOseeTypes(true, modelRequest, response);
+ @Override
+ public boolean isCompressed() {
+ return false;
+ }
+ };
+
+ getLogger().info("Updating Type Model with [%s]", typesResource.getLocation());
+ orcsTypes.loadTypes(typesResource, true).call();
getLogger().info("Type Model Import complete");
}
-
private final class CommitImportSavePointsTx extends DatabaseTxCallable<Boolean> {
private static final String INSERT_INTO_IMPORT_SOURCES =
"INSERT INTO osee_import_source (import_id, db_source_guid, source_export_date, date_imported) VALUES (?, ?, ?, ?)";
diff --git a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/console/FixDuplicateAttributesCommand.java b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/console/FixDuplicateAttributesCommand.java
index 6286f7b4fc..6166c56163 100644
--- a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/console/FixDuplicateAttributesCommand.java
+++ b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/console/FixDuplicateAttributesCommand.java
@@ -14,10 +14,20 @@ import java.util.concurrent.Callable;
import org.eclipse.osee.console.admin.Console;
import org.eclipse.osee.console.admin.ConsoleCommand;
import org.eclipse.osee.console.admin.ConsoleParameters;
-import org.eclipse.osee.framework.core.services.IOseeCachingService;
+import org.eclipse.osee.database.schema.DatabaseTxCallable;
+import org.eclipse.osee.framework.core.data.IAttributeType;
+import org.eclipse.osee.framework.core.enums.TxChange;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.core.services.IdentityService;
import org.eclipse.osee.framework.database.IOseeDatabaseService;
+import org.eclipse.osee.framework.database.core.ExportImportJoinQuery;
+import org.eclipse.osee.framework.database.core.IOseeStatement;
+import org.eclipse.osee.framework.database.core.IdJoinQuery;
+import org.eclipse.osee.framework.database.core.JoinUtility;
+import org.eclipse.osee.framework.database.core.OseeConnection;
import org.eclipse.osee.logger.Log;
-import org.eclipse.osee.orcs.db.internal.callable.DuplicateAttributesDatabaseTxCallable;
+import org.eclipse.osee.orcs.OrcsApi;
+import org.eclipse.osee.orcs.data.AttributeTypes;
/**
* @author Roberto E. Escobar
@@ -26,30 +36,23 @@ public class FixDuplicateAttributesCommand implements ConsoleCommand {
private Log logger;
private IOseeDatabaseService dbService;
- private IOseeCachingService cachingService;
-
- public Log getLogger() {
- return logger;
- }
+ private IdentityService identityService;
+ private OrcsApi orcsApi;
public void setLogger(Log logger) {
this.logger = logger;
}
- public IOseeDatabaseService getDatabaseService() {
- return dbService;
+ public void setIdentityService(IdentityService identityService) {
+ this.identityService = identityService;
}
public void setDatabaseService(IOseeDatabaseService dbService) {
this.dbService = dbService;
}
- public IOseeCachingService getCachingService() {
- return cachingService;
- }
-
- public void setCachingService(IOseeCachingService cachingService) {
- this.cachingService = cachingService;
+ public void setOrcsApi(OrcsApi orcsApi) {
+ this.orcsApi = orcsApi;
}
@Override
@@ -64,12 +67,82 @@ public class FixDuplicateAttributesCommand implements ConsoleCommand {
@Override
public String getUsage() {
- return "";
+ return "No Parameters";
}
@Override
public Callable<?> createCallable(Console console, ConsoleParameters params) {
- return new DuplicateAttributesDatabaseTxCallable(getLogger(), getDatabaseService(), console,
- getCachingService().getAttributeTypeCache());
+ return new DuplicateAttributesDatabaseTxCallable(console);
+ }
+
+ private final class DuplicateAttributesDatabaseTxCallable extends DatabaseTxCallable<Object> {
+ private static final String SELECT_ATTRIBUTES =
+ "select att1.gamma_id as gamma1, att2.gamma_id as gamma2 from osee_join_id oji, osee_attribute att1, osee_attribute att2 where oji.query_id = ? AND oji.id = att1.attr_type_id and att1.art_id = att2.art_id and att1.attr_type_id = att2.attr_type_id and att1.attr_id <> att2.attr_id";
+ private static final String SELECT_DUPLICATES =
+ "select txs1.branch_id, txs1.gamma_id as gamma1, txs2.gamma_id as gamma2 from osee_join_export_import idj, osee_txs txs1, osee_txs txs2 where idj.query_id = ? and idj.id1 = txs1.gamma_id and idj.id2 = txs2.gamma_id and txs1.branch_id = txs2.branch_id and txs1.tx_current = ? and txs2.tx_current = ?";
+
+ private final Console console;
+
+ public DuplicateAttributesDatabaseTxCallable(Console console) {
+ super(logger, dbService, "Duplicate Attributes");
+ this.console = console;
+ }
+
+ @Override
+ protected Object handleTxWork(OseeConnection connection) throws OseeCoreException {
+ ExportImportJoinQuery gammaJoin = JoinUtility.createExportImportJoinQuery();
+ try {
+ selectAttributes(gammaJoin, connection);
+ gammaJoin.store(connection);
+ selectDuplicates(gammaJoin, connection);
+ } catch (Exception ex) {
+ console.write(ex);
+ getLogger().error(ex, "Error fixing duplicate attributes");
+ } finally {
+ gammaJoin.delete(connection);
+ }
+ return null;
+ }
+
+ private void selectAttributes(ExportImportJoinQuery gammaJoin, OseeConnection connection) throws OseeCoreException {
+ IdJoinQuery typeJoin = JoinUtility.createIdJoinQuery();
+ populateAttributeTypeJoin(typeJoin);
+
+ IOseeStatement chStmt = getDatabaseService().getStatement(connection);
+ try {
+ chStmt.runPreparedQuery(10000, SELECT_ATTRIBUTES, typeJoin.getQueryId());
+ while (chStmt.next()) {
+ gammaJoin.add(chStmt.getLong("gamma1"), chStmt.getLong("gamma2"));
+ }
+ } finally {
+ chStmt.close();
+ typeJoin.delete(connection);
+ }
+ }
+
+ private void selectDuplicates(ExportImportJoinQuery gammaJoin, OseeConnection connection) throws OseeCoreException {
+ IOseeStatement chStmt = getDatabaseService().getStatement(connection);
+ try {
+ chStmt.runPreparedQuery(SELECT_DUPLICATES, gammaJoin.getQueryId(), TxChange.CURRENT.getValue(),
+ TxChange.CURRENT.getValue());
+ while (chStmt.next()) {
+ console.writeln("branch: " + chStmt.getInt("branch_id"), "gamma1: " + chStmt.getLong("gamma1"),
+ "gamma2: " + chStmt.getLong("gamma2"));
+ }
+ } finally {
+ chStmt.close();
+ }
+ }
+
+ private void populateAttributeTypeJoin(IdJoinQuery typeJoin) throws OseeCoreException {
+ AttributeTypes types = orcsApi.getOrcsTypes(null).getAttributeTypes();
+ for (IAttributeType attributeType : types.getAll()) {
+ if (types.getMaxOccurrences(attributeType) == 1) {
+ Integer localId = identityService.getLocalId(attributeType.getGuid());
+ typeJoin.add(localId);
+ }
+ }
+ typeJoin.store();
+ }
}
}
diff --git a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/exchange/ExportItemFactory.java b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/exchange/ExportItemFactory.java
index 4998577a6f..e13ac69090 100644
--- a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/exchange/ExportItemFactory.java
+++ b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/exchange/ExportItemFactory.java
@@ -25,13 +25,13 @@ import org.eclipse.osee.framework.jdk.core.util.Strings;
import org.eclipse.osee.framework.resource.management.IResourceManager;
import org.eclipse.osee.logger.Log;
import org.eclipse.osee.orcs.ExportOptions;
+import org.eclipse.osee.orcs.OrcsTypes;
import org.eclipse.osee.orcs.db.internal.exchange.export.AbstractExportItem;
import org.eclipse.osee.orcs.db.internal.exchange.export.DbTableExportItem;
import org.eclipse.osee.orcs.db.internal.exchange.export.ManifestExportItem;
import org.eclipse.osee.orcs.db.internal.exchange.export.MetadataExportItem;
import org.eclipse.osee.orcs.db.internal.exchange.export.OseeTypeModelExportItem;
import org.eclipse.osee.orcs.db.internal.exchange.handler.ExportItem;
-import org.eclipse.osee.orcs.db.internal.types.IOseeModelingService;
public class ExportItemFactory {
private static final String GET_MAX_TX =
@@ -71,15 +71,15 @@ public class ExportItemFactory {
private final Log logger;
private final IOseeDatabaseService dbService;
private final IdentityService identityService;
- private final IOseeModelingService typeModelService;
private final IResourceManager resourceManager;
+ private final OrcsTypes orcsTypes;
- public ExportItemFactory(Log logger, IOseeDatabaseService dbService, IdentityService identityService, IOseeModelingService typeModelService, IResourceManager resourceManager) {
+ public ExportItemFactory(Log logger, IOseeDatabaseService dbService, IdentityService identityService, IResourceManager resourceManager, OrcsTypes orcsTypes) {
this.logger = logger;
this.dbService = dbService;
this.identityService = identityService;
- this.typeModelService = typeModelService;
this.resourceManager = resourceManager;
+ this.orcsTypes = orcsTypes;
}
public Log getLogger() {
@@ -90,10 +90,6 @@ public class ExportItemFactory {
return dbService;
}
- public IOseeModelingService getModelingService() {
- return typeModelService;
- }
-
public IResourceManager getResourceManager() {
return resourceManager;
}
@@ -102,6 +98,10 @@ public class ExportItemFactory {
return identityService;
}
+ private OrcsTypes getOrcsTypes() {
+ return orcsTypes;
+ }
+
public List<AbstractExportItem> createTaskList(int joinId, PropertyStore options) throws OseeCoreException {
List<AbstractExportItem> items = new ArrayList<AbstractExportItem>();
@@ -111,7 +111,7 @@ public class ExportItemFactory {
items.add(new ManifestExportItem(logger, items, options));
items.add(new MetadataExportItem(logger, items, getMetaData(getDbService())));
- items.add(new OseeTypeModelExportItem(logger, getModelingService()));
+ items.add(new OseeTypeModelExportItem(logger, getOrcsTypes()));
addItem(items, joinId, options, gammaJoinId, ExportItem.OSEE_BRANCH_DATA, BRANCH_TABLE_QUERY);
addItem(items, joinId, options, gammaJoinId, ExportItem.OSEE_TX_DETAILS_DATA, TX_DETAILS_TABLE_QUERY);
diff --git a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/exchange/export/OseeTypeModelExportItem.java b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/exchange/export/OseeTypeModelExportItem.java
index 6fefec6dad..11017ba744 100644
--- a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/exchange/export/OseeTypeModelExportItem.java
+++ b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/exchange/export/OseeTypeModelExportItem.java
@@ -15,27 +15,27 @@ import java.io.FileOutputStream;
import java.io.OutputStream;
import org.eclipse.osee.framework.jdk.core.util.Lib;
import org.eclipse.osee.logger.Log;
+import org.eclipse.osee.orcs.OrcsTypes;
import org.eclipse.osee.orcs.db.internal.exchange.handler.ExportItem;
-import org.eclipse.osee.orcs.db.internal.types.IOseeModelingService;
/**
* @author Roberto E. Escobar
*/
public class OseeTypeModelExportItem extends AbstractExportItem {
- private final IOseeModelingService modelingService;
+ private final OrcsTypes orcsTypes;
- public OseeTypeModelExportItem(Log logger, IOseeModelingService modelingService) {
+ public OseeTypeModelExportItem(Log logger, OrcsTypes orcsTypes) {
super(logger, ExportItem.EXPORT_TYPE_MODEL);
- this.modelingService = modelingService;
+ this.orcsTypes = orcsTypes;
}
@Override
protected void executeWork() throws Exception {
- File outputFile = new File(getWriteLocation(), getFileName());
OutputStream outputStream = null;
try {
+ File outputFile = new File(getWriteLocation(), getFileName());
outputStream = new FileOutputStream(outputFile);
- modelingService.exportOseeTypes(outputStream);
+ orcsTypes.writeTypes(outputStream).call();
} finally {
Lib.close(outputStream);
}
diff --git a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/types/CacheServiceFactory.java b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/types/CacheServiceFactory.java
index 7205e0a214..11e9dffcc9 100644
--- a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/types/CacheServiceFactory.java
+++ b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/types/CacheServiceFactory.java
@@ -11,13 +11,13 @@
package org.eclipse.osee.orcs.db.internal.types;
import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.core.services.IOseeCachingService;
+import org.eclipse.osee.orcs.core.ds.TempCachingService;
/**
* @author Roberto E. Escobar
*/
public interface CacheServiceFactory {
- IOseeCachingService createCachingService(boolean needsPriming) throws OseeCoreException;
+ TempCachingService createCachingService(boolean needsPriming) throws OseeCoreException;
}
diff --git a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/types/OseeModelingServiceImpl.java b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/types/OseeModelingServiceImpl.java
deleted file mode 100644
index 969d2035c7..0000000000
--- a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/types/OseeModelingServiceImpl.java
+++ /dev/null
@@ -1,166 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.orcs.db.internal.types;
-
-import java.io.OutputStream;
-import org.eclipse.osee.event.EventService;
-import org.eclipse.osee.executor.admin.ExecutorAdmin;
-import org.eclipse.osee.framework.core.dsl.OseeDslResource;
-import org.eclipse.osee.framework.core.dsl.OseeDslResourceUtil;
-import org.eclipse.osee.framework.core.dsl.oseeDsl.OseeDsl;
-import org.eclipse.osee.framework.core.dsl.oseeDsl.OseeDslFactory;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.core.exception.OseeExceptions;
-import org.eclipse.osee.framework.core.model.OseeCachingService;
-import org.eclipse.osee.framework.core.model.OseeImportModelRequest;
-import org.eclipse.osee.framework.core.model.OseeImportModelResponse;
-import org.eclipse.osee.framework.core.model.cache.ArtifactTypeCache;
-import org.eclipse.osee.framework.core.model.cache.AttributeTypeCache;
-import org.eclipse.osee.framework.core.model.cache.BranchCache;
-import org.eclipse.osee.framework.core.model.cache.OseeEnumTypeCache;
-import org.eclipse.osee.framework.core.model.cache.RelationTypeCache;
-import org.eclipse.osee.framework.core.model.cache.TransactionCache;
-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.eclipse.osee.framework.core.operation.IOperation;
-import org.eclipse.osee.framework.core.operation.Operations;
-import org.eclipse.osee.framework.core.services.IOseeCachingService;
-import org.eclipse.osee.framework.core.services.IOseeModelFactoryService;
-import org.eclipse.osee.framework.core.services.IdentityService;
-import org.eclipse.osee.framework.database.IOseeDatabaseService;
-import org.eclipse.osee.framework.jdk.core.util.Lib;
-import org.eclipse.osee.framework.resource.management.IResourceManager;
-import org.eclipse.osee.logger.Log;
-import org.eclipse.osee.orcs.db.internal.accessor.ArtifactTypeDataAccessor;
-import org.eclipse.osee.orcs.db.internal.accessor.DatabaseBranchAccessor;
-import org.eclipse.osee.orcs.db.internal.accessor.DatabaseTransactionRecordAccessor;
-import org.eclipse.osee.orcs.db.internal.accessor.TypeLoaderImpl;
-
-/**
- * @author Roberto E. Escobar
- */
-public class OseeModelingServiceImpl implements IOseeModelingService {
-
- private final Log logger;
- private final IOseeDatabaseService dbService;
- private final IdentityService identityService;
- private final ExecutorAdmin executorAdmin;
- private final IResourceManager resourceManager;
- private final IOseeModelFactoryService modelFactoryService;
- private final IOseeCachingService caches;
- private final EventService eventService;
-
- public OseeModelingServiceImpl(Log logger, IOseeDatabaseService dbService, IdentityService identityService, ExecutorAdmin executorAdmin, IResourceManager resourceManager, IOseeModelFactoryService modelFactoryService, EventService eventService, IOseeCachingService caches) {
- super();
- this.logger = logger;
- this.dbService = dbService;
- this.identityService = identityService;
- this.executorAdmin = executorAdmin;
- this.resourceManager = resourceManager;
- this.modelFactoryService = modelFactoryService;
- this.caches = caches;
- this.eventService = eventService;
- }
-
- @Override
- public void exportOseeTypes(OutputStream outputStream) throws OseeCoreException {
- OseeTypeCache cache =
- new OseeTypeCache(caches.getArtifactTypeCache(), caches.getAttributeTypeCache(),
- caches.getRelationTypeCache(), caches.getEnumTypeCache());
-
- OseeDslFactory modelFactory = OseeDslFactory.eINSTANCE;
- OseeDsl model = modelFactory.createOseeDsl();
-
- IOperation operation = new OseeToXtextOperation(cache, modelFactory, model);
- Operations.executeWorkAndCheckStatus(operation, null);
- try {
- OseeDslResourceUtil.saveModel(model, "osee:/oseeTypes_" + Lib.getDateTimeString() + ".osee", outputStream,
- false);
- } catch (Exception ex) {
- OseeExceptions.wrapAndThrow(ex);
- }
- }
-
- @Override
- public void importOseeTypes(boolean isInitializing, OseeImportModelRequest request, OseeImportModelResponse response) throws OseeCoreException {
- String modelName = request.getModelName();
- if (!modelName.endsWith(".osee")) {
- modelName += ".osee";
- }
-
- OseeDsl inputModel = null;
- try {
- OseeDslResource dslResource = OseeDslResourceUtil.loadModel("osee:/" + modelName, request.getModel());
- inputModel = dslResource.getModel();
- } catch (Exception ex) {
- OseeExceptions.wrapAndThrow(ex);
- }
-
- IOseeCachingService tempCacheService = createCachingService(false);
- OseeTypeCache tempCache =
- new OseeTypeCache(tempCacheService.getArtifactTypeCache(), tempCacheService.getAttributeTypeCache(),
- tempCacheService.getRelationTypeCache(), tempCacheService.getEnumTypeCache());
-
- IOperation operation =
- new XTextToOseeTypeOperation(modelFactoryService, tempCache, tempCacheService.getBranchCache(), inputModel);
- Operations.executeWorkAndCheckStatus(operation);
-
- if (request.isPersistAllowed()) {
- tempCache.storeAllModified();
- response.setPersisted(true);
- if (isInitializing) {
- caches.clearAll();
- }
- caches.getEnumTypeCache().cacheFrom(tempCache.getEnumTypeCache());
- caches.getAttributeTypeCache().cacheFrom(tempCache.getAttributeTypeCache());
- caches.getArtifactTypeCache().cacheFrom(tempCache.getArtifactTypeCache());
- caches.getRelationTypeCache().cacheFrom(tempCache.getRelationTypeCache());
-
- caches.reloadAll();
- } else {
- response.setPersisted(false);
- }
- }
-
- public IOseeCachingService createCachingService(boolean needsPriming) {
- TransactionCache txCache = new TransactionCache();
- BranchCache branchCache =
- new BranchCache(new DatabaseBranchAccessor(logger, executorAdmin, eventService, dbService, txCache,
- modelFactoryService.getBranchFactory()));
- txCache.setAccessor(new DatabaseTransactionRecordAccessor(dbService, branchCache,
- modelFactoryService.getTransactionFactory()));
-
- TypeLoaderImpl loader =
- new TypeLoaderImpl(this, identityService, dbService, resourceManager, branchCache, needsPriming);
-
- boolean typesSynchronized = false;
- OseeEnumTypeCache oseeEnumTypeCache =
- new OseeEnumTypeCache(new ArtifactTypeDataAccessor<OseeEnumType>(identityService, loader));
- oseeEnumTypeCache.setSynchronizedEnsurePopulate(typesSynchronized);
-
- AttributeTypeCache attributeCache =
- new AttributeTypeCache(new ArtifactTypeDataAccessor<AttributeType>(identityService, loader));
- attributeCache.setSynchronizedEnsurePopulate(typesSynchronized);
-
- ArtifactTypeCache artifactCache =
- new ArtifactTypeCache(new ArtifactTypeDataAccessor<ArtifactType>(identityService, loader));
- artifactCache.setSynchronizedEnsurePopulate(typesSynchronized);
-
- RelationTypeCache relationCache =
- new RelationTypeCache(new ArtifactTypeDataAccessor<RelationType>(identityService, loader));
- relationCache.setSynchronizedEnsurePopulate(typesSynchronized);
-
- return new OseeCachingService(branchCache, txCache, artifactCache, attributeCache, relationCache,
- oseeEnumTypeCache, identityService);
- }
-}
diff --git a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/types/OseeToXtextOperation.java b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/types/OseeToXtextOperation.java
deleted file mode 100644
index 5178b37088..0000000000
--- a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/types/OseeToXtextOperation.java
+++ /dev/null
@@ -1,271 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.orcs.db.internal.types;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
-import java.util.Map;
-import java.util.Map.Entry;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.osee.framework.core.data.IOseeBranch;
-import org.eclipse.osee.framework.core.dsl.oseeDsl.OseeDsl;
-import org.eclipse.osee.framework.core.dsl.oseeDsl.OseeDslFactory;
-import org.eclipse.osee.framework.core.dsl.oseeDsl.RelationMultiplicityEnum;
-import org.eclipse.osee.framework.core.dsl.oseeDsl.XArtifactType;
-import org.eclipse.osee.framework.core.dsl.oseeDsl.XAttributeType;
-import org.eclipse.osee.framework.core.dsl.oseeDsl.XAttributeTypeRef;
-import org.eclipse.osee.framework.core.dsl.oseeDsl.XOseeEnumEntry;
-import org.eclipse.osee.framework.core.dsl.oseeDsl.XOseeEnumType;
-import org.eclipse.osee.framework.core.dsl.oseeDsl.XRelationType;
-import org.eclipse.osee.framework.core.enums.CoreBranches;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.core.model.OseeEnumEntry;
-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.eclipse.osee.framework.core.operation.AbstractOperation;
-import org.eclipse.osee.framework.core.util.HexUtil;
-
-/**
- * @author Roberto E. Escobar
- */
-public class OseeToXtextOperation extends AbstractOperation {
-
- private final OseeDsl oseeModel;
- private final OseeDslFactory factory;
- private final OseeTypeCache cache;
-
- public OseeToXtextOperation(OseeTypeCache cache, OseeDslFactory factory, OseeDsl oseeModel) {
- super("OSEE to Text Model", "");
- this.oseeModel = oseeModel;
- this.factory = factory;
- this.cache = cache;
- }
-
- private OseeDslFactory getFactory() {
- return factory;
- }
-
- private OseeDsl getModelByNamespace(String namespace) {
- return oseeModel;
- }
-
- private String getNamespace(String name) {
- String toReturn = "default";
- // if (Strings.isValid(name)) {
- // int index = name.lastIndexOf(".");
- // if (index > 0) {
- // toReturn = name.substring(0, index);
- // }
- // }
- return toReturn;
- }
-
- private String asPrimitiveType(String name) {
- return name.replace("org.eclipse.osee.framework.skynet.core.", "");
- }
-
- @Override
- protected void doWork(IProgressMonitor monitor) throws Exception {
- double workPercentage = 1.0 / 6.0;
- populateEnumTypes(monitor, workPercentage);
- populateAttributeTypes(monitor, workPercentage);
- populateArtifactTypes(monitor, workPercentage);
- populateArtifactTypeInheritance(monitor, workPercentage);
- populateArtifactTypeAttributeTypes(monitor, workPercentage);
- populateRelationTypes(monitor, workPercentage);
- }
-
- private void populateEnumTypes(IProgressMonitor monitor, double workPercentage) throws OseeCoreException {
- Collection<OseeEnumType> enumTypes = cache.getEnumTypeCache().getAll();
- for (OseeEnumType enumType : enumTypes) {
- checkForCancelledStatus(monitor);
- XOseeEnumType modelType = getFactory().createXOseeEnumType();
-
- OseeDsl model = getModelByNamespace(getNamespace(enumType.getName()));
- model.getEnumTypes().add(modelType);
-
- modelType.setName(enumType.getName());
- modelType.setUuid(HexUtil.toString(enumType.getGuid()));
-
- for (OseeEnumEntry entry : enumType.values()) {
- checkForCancelledStatus(monitor);
- XOseeEnumEntry entryModelType = getFactory().createXOseeEnumEntry();
- modelType.getEnumEntries().add(entryModelType);
-
- entryModelType.setName(entry.getName());
- entryModelType.setOrdinal(String.valueOf(entry.ordinal()));
- }
- }
- monitor.worked(calculateWork(workPercentage));
- }
-
- private void populateAttributeTypes(IProgressMonitor monitor, double workPercentage) throws OseeCoreException {
- monitor.setTaskName("Attribute Types");
- Collection<AttributeType> attributeTypes = cache.getAttributeTypeCache().getAll();
- for (AttributeType attributeType : attributeTypes) {
- checkForCancelledStatus(monitor);
- XAttributeType modelType = getFactory().createXAttributeType();
-
- OseeDsl model = getModelByNamespace(getNamespace(attributeType.getName()));
- model.getAttributeTypes().add(modelType);
-
- modelType.setName(attributeType.getName());
-
- modelType.setUuid(HexUtil.toString(attributeType.getGuid()));
-
- modelType.setBaseAttributeType(asPrimitiveType(attributeType.getBaseAttributeTypeId()));
- modelType.setDataProvider(asPrimitiveType(attributeType.getAttributeProviderId()));
- modelType.setMax(String.valueOf(attributeType.getMaxOccurrences()));
- modelType.setMin(String.valueOf(attributeType.getMinOccurrences()));
- modelType.setFileExtension(attributeType.getFileTypeExtension());
- modelType.setDescription(attributeType.getDescription());
- modelType.setDefaultValue(attributeType.getDefaultValue());
- modelType.setTaggerId(attributeType.getTaggerId());
- modelType.setMediaType(attributeType.getMediaType());
-
- OseeEnumType oseeEnumType = attributeType.getOseeEnumType();
- if (oseeEnumType != null) {
- XOseeEnumType enumType = toModelEnumType(model, oseeEnumType.getGuid());
- modelType.setEnumType(enumType);
- }
- }
- monitor.worked(calculateWork(workPercentage));
- }
-
- private void populateArtifactTypes(IProgressMonitor monitor, double workPercentage) throws OseeCoreException {
- monitor.setTaskName("Artifact Types");
- Collection<ArtifactType> artifactTypes = cache.getArtifactTypeCache().getAll();
- for (ArtifactType artifactType : artifactTypes) {
- checkForCancelledStatus(monitor);
- XArtifactType modelType = getFactory().createXArtifactType();
-
- OseeDsl model = getModelByNamespace(getNamespace(artifactType.getName()));
- model.getArtifactTypes().add(modelType);
-
- modelType.setName(artifactType.getName());
- modelType.setUuid(HexUtil.toString(artifactType.getGuid()));
- }
- monitor.worked(calculateWork(workPercentage));
- }
-
- private void populateArtifactTypeInheritance(IProgressMonitor monitor, double workPercentage) throws OseeCoreException {
- monitor.setTaskName("Artifact Type Inheritance");
- Collection<ArtifactType> artifactTypes = cache.getArtifactTypeCache().getAll();
- for (ArtifactType artifactType : artifactTypes) {
- checkForCancelledStatus(monitor);
- OseeDsl model = getModelByNamespace(getNamespace(artifactType.getName()));
-
- XArtifactType childType = getArtifactType(model, artifactType.getGuid());
-
- for (ArtifactType oseeSuperType : artifactType.getSuperArtifactTypes()) {
- XArtifactType superModelType = getArtifactType(model, oseeSuperType.getGuid());
- childType.getSuperArtifactTypes().add(superModelType);
- }
- }
- monitor.worked(calculateWork(workPercentage));
- }
-
- private void populateArtifactTypeAttributeTypes(IProgressMonitor monitor, double workPercentage) throws OseeCoreException {
- monitor.setTaskName("Artifact Type to Attribute Types");
- Collection<ArtifactType> artifactTypes = cache.getArtifactTypeCache().getAll();
- for (ArtifactType artifactType : artifactTypes) {
- checkForCancelledStatus(monitor);
-
- OseeDsl model = getModelByNamespace(getNamespace(artifactType.getName()));
- XArtifactType modelArtifactType = getArtifactType(model, artifactType.getGuid());
-
- Map<IOseeBranch, Collection<AttributeType>> types = artifactType.getLocalAttributeTypes();
- if (types != null) {
- List<XAttributeTypeRef> references = new ArrayList<XAttributeTypeRef>();
- for (Entry<IOseeBranch, Collection<AttributeType>> entry : types.entrySet()) {
- IOseeBranch branch = entry.getKey();
- Collection<AttributeType> attributeTypes = entry.getValue();
- if (attributeTypes != null) {
- for (AttributeType attributeType : attributeTypes) {
-
- XAttributeTypeRef ref = getFactory().createXAttributeTypeRef();
-
- XAttributeType modelType = getAttributeType(model, attributeType.getGuid());
- if (modelType != null) {
- ref.setValidAttributeType(modelType);
- if (branch != null && !branch.equals(CoreBranches.SYSTEM_ROOT)) {
- ref.setBranchGuid(branch.getGuid());
- }
- references.add(ref);
- }
- }
- }
- }
- modelArtifactType.getValidAttributeTypes().addAll(references);
- }
- }
- monitor.worked(calculateWork(workPercentage));
- }
-
- private void populateRelationTypes(IProgressMonitor monitor, double workPercentage) throws OseeCoreException {
- monitor.setTaskName("Relation Types");
- Collection<RelationType> relationTypes = cache.getRelationTypeCache().getAll();
- for (RelationType relationType : relationTypes) {
- checkForCancelledStatus(monitor);
- XRelationType modelType = getFactory().createXRelationType();
-
- OseeDsl model = getModelByNamespace(getNamespace(relationType.getName()));
- model.getRelationTypes().add(modelType);
-
- modelType.setName(relationType.getName());
- modelType.setUuid(HexUtil.toString(relationType.getGuid()));
-
- modelType.setDefaultOrderType(OseeUtil.getRelationOrderType(relationType.getDefaultOrderTypeGuid()));
- modelType.setMultiplicity(RelationMultiplicityEnum.getByName(relationType.getMultiplicity().name()));
-
- modelType.setSideAName(relationType.getSideAName());
- modelType.setSideBName(relationType.getSideBName());
-
- modelType.setSideAArtifactType(getArtifactType(model, relationType.getArtifactTypeSideA().getGuid()));
- modelType.setSideBArtifactType(getArtifactType(model, relationType.getArtifactTypeSideB().getGuid()));
- }
- monitor.worked(calculateWork(workPercentage));
- }
-
- private XArtifactType getArtifactType(OseeDsl model, Long uuid) throws OseeCoreException {
- for (XArtifactType type : model.getArtifactTypes()) {
- Long normalizedGuid = HexUtil.toLong(type.getUuid());
- if (uuid.equals(normalizedGuid)) {
- return type;
- }
- }
- return null;
- }
-
- private XAttributeType getAttributeType(OseeDsl model, Long uuid) throws OseeCoreException {
- for (XAttributeType type : model.getAttributeTypes()) {
- Long normalizedGuid = HexUtil.toLong(type.getUuid());
- if (uuid.equals(normalizedGuid)) {
- return type;
- }
- }
- return null;
- }
-
- private XOseeEnumType toModelEnumType(OseeDsl model, Long uuid) throws OseeCoreException {
- for (XOseeEnumType type : model.getEnumTypes()) {
- Long normalizedGuid = HexUtil.toLong(type.getUuid());
- if (uuid.equals(normalizedGuid)) {
- return type;
- }
- }
- return null;
- }
-
-}
diff --git a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/types/OseeTypeCache.java b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/types/OseeTypeCache.java
deleted file mode 100644
index 16de7572ea..0000000000
--- a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/types/OseeTypeCache.java
+++ /dev/null
@@ -1,83 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.orcs.db.internal.types;
-
-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.AttributeTypeCache;
-import org.eclipse.osee.framework.core.model.cache.OseeEnumTypeCache;
-import org.eclipse.osee.framework.core.model.cache.RelationTypeCache;
-
-/**
- * @author Roberto E. Escobar
- */
-public class OseeTypeCache {
-
- private final ArtifactTypeCache artifactCache;
- private final AttributeTypeCache attributeCache;
- private final RelationTypeCache relationCache;
- private final OseeEnumTypeCache oseeEnumTypeCache;
-
- private boolean duringPopulate;
-
- public OseeTypeCache(ArtifactTypeCache artifactCache, AttributeTypeCache attributeCache, RelationTypeCache relationCache, OseeEnumTypeCache oseeEnumTypeCache) {
- this.duringPopulate = false;
- this.artifactCache = artifactCache;
- this.attributeCache = attributeCache;
- this.relationCache = relationCache;
- this.oseeEnumTypeCache = oseeEnumTypeCache;
- }
-
- public void storeAllModified() throws OseeCoreException {
- getEnumTypeCache().storeAllModified();
- getAttributeTypeCache().storeAllModified();
- getArtifactTypeCache().storeAllModified();
- getRelationTypeCache().storeAllModified();
- }
-
- public synchronized void ensurePopulated() throws OseeCoreException {
- if (!duringPopulate) {
- duringPopulate = true;
- getEnumTypeCache().ensurePopulated();
- getAttributeTypeCache().ensurePopulated();
- getArtifactTypeCache().ensurePopulated();
- getRelationTypeCache().ensurePopulated();
- duringPopulate = false;
- }
- }
-
- public synchronized void clearAll() {
- if (!duringPopulate) {
- duringPopulate = true;
- getEnumTypeCache().decacheAll();
- getAttributeTypeCache().decacheAll();
- getArtifactTypeCache().decacheAll();
- getRelationTypeCache().decacheAll();
- duringPopulate = false;
- }
- }
-
- public ArtifactTypeCache getArtifactTypeCache() {
- return artifactCache;
- }
-
- public AttributeTypeCache getAttributeTypeCache() {
- return attributeCache;
- }
-
- public OseeEnumTypeCache getEnumTypeCache() {
- return oseeEnumTypeCache;
- }
-
- public RelationTypeCache getRelationTypeCache() {
- return relationCache;
- }
-}
diff --git a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/types/OseeUtil.java b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/types/OseeUtil.java
deleted file mode 100644
index a619dad205..0000000000
--- a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/types/OseeUtil.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.orcs.db.internal.types;
-
-import org.eclipse.osee.framework.core.data.IRelationSorterId;
-import org.eclipse.osee.framework.core.enums.RelationOrderBaseTypes;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.core.util.Conditions;
-
-/**
- * @author Roberto E. Escobar
- */
-public final class OseeUtil {
-
- private OseeUtil() {
- // Utility Class
- }
-
- public static String getRelationOrderType(String guid) throws OseeCoreException {
- IRelationSorterId type = RelationOrderBaseTypes.getFromGuid(guid);
- return type.getName().replaceAll(" ", "_");
- }
-
- public static String orderTypeNameToGuid(String orderTypeName) throws OseeCoreException {
- Conditions.checkNotNull(orderTypeName, "orderTypeName");
- return RelationOrderBaseTypes.getFromOrderTypeName(orderTypeName.replaceAll("_", " ")).getGuid();
- }
-}
diff --git a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/types/TempCachingServiceFactory.java b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/types/TempCachingServiceFactory.java
new file mode 100644
index 0000000000..4afd86a42d
--- /dev/null
+++ b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/types/TempCachingServiceFactory.java
@@ -0,0 +1,108 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.orcs.db.internal.types;
+
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.List;
+import org.eclipse.osee.event.EventService;
+import org.eclipse.osee.executor.admin.ExecutorAdmin;
+import org.eclipse.osee.framework.core.enums.OseeCacheEnum;
+import org.eclipse.osee.framework.core.exception.OseeArgumentException;
+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.IOseeCache;
+import org.eclipse.osee.framework.core.model.cache.TransactionCache;
+import org.eclipse.osee.framework.core.services.IOseeModelFactoryService;
+import org.eclipse.osee.framework.core.util.Conditions;
+import org.eclipse.osee.framework.database.IOseeDatabaseService;
+import org.eclipse.osee.logger.Log;
+import org.eclipse.osee.orcs.core.ds.TempCachingService;
+import org.eclipse.osee.orcs.db.internal.accessor.DatabaseBranchAccessor;
+import org.eclipse.osee.orcs.db.internal.accessor.DatabaseTransactionRecordAccessor;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class TempCachingServiceFactory implements CacheServiceFactory {
+
+ private final Log logger;
+ private final IOseeDatabaseService dbService;
+ private final ExecutorAdmin executorAdmin;
+ private final IOseeModelFactoryService modelFactoryService;
+ private final EventService eventService;
+
+ public TempCachingServiceFactory(Log logger, IOseeDatabaseService dbService, ExecutorAdmin executorAdmin, IOseeModelFactoryService modelFactoryService, EventService eventService) {
+ super();
+ this.logger = logger;
+ this.dbService = dbService;
+ this.executorAdmin = executorAdmin;
+ this.modelFactoryService = modelFactoryService;
+ this.eventService = eventService;
+ }
+
+ @Override
+ public TempCachingService createCachingService(boolean needsPriming) {
+ final TransactionCache txCache = new TransactionCache();
+ final BranchCache branchCache =
+ new BranchCache(new DatabaseBranchAccessor(logger, executorAdmin, eventService, dbService, txCache,
+ modelFactoryService.getBranchFactory()));
+ txCache.setAccessor(new DatabaseTransactionRecordAccessor(dbService, branchCache,
+ modelFactoryService.getTransactionFactory()));
+
+ final List<IOseeCache<?, ?>> caches = Arrays.<IOseeCache<?, ?>> asList(txCache, branchCache);
+
+ return new TempCachingService() {
+
+ @Override
+ public BranchCache getBranchCache() {
+ return branchCache;
+ }
+
+ @Override
+ public TransactionCache getTransactionCache() {
+ return txCache;
+ }
+
+ @Override
+ public Collection<?> getCaches() {
+ return caches;
+ }
+
+ @Override
+ public IOseeCache<?, ?> getCache(OseeCacheEnum cacheId) throws OseeCoreException {
+ Conditions.checkNotNull(cacheId, "cache id to find");
+ IOseeCache<?, ?> toReturn = null;
+ if (OseeCacheEnum.TRANSACTION_CACHE == cacheId) {
+ toReturn = txCache;
+ } else if (OseeCacheEnum.BRANCH_CACHE == cacheId) {
+ toReturn = branchCache;
+ } else {
+ throw new OseeArgumentException("Unable to find cache for id [%s]", cacheId);
+ }
+ return toReturn;
+ }
+
+ @Override
+ public void reloadAll() throws OseeCoreException {
+ getBranchCache().reloadCache();
+ getTransactionCache().reloadCache();
+ }
+
+ @Override
+ public void clearAll() {
+ getBranchCache().decacheAll();
+ getTransactionCache().decacheAll();
+ }
+
+ };
+ }
+}
diff --git a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/types/XTextToOseeTypeOperation.java b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/types/XTextToOseeTypeOperation.java
deleted file mode 100644
index afd16a73fe..0000000000
--- a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/types/XTextToOseeTypeOperation.java
+++ /dev/null
@@ -1,368 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.orcs.db.internal.types;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.emf.common.util.EList;
-import org.eclipse.osee.framework.core.data.IOseeBranch;
-import org.eclipse.osee.framework.core.data.TokenFactory;
-import org.eclipse.osee.framework.core.dsl.oseeDsl.AddAttribute;
-import org.eclipse.osee.framework.core.dsl.oseeDsl.AddEnum;
-import org.eclipse.osee.framework.core.dsl.oseeDsl.AttributeOverrideOption;
-import org.eclipse.osee.framework.core.dsl.oseeDsl.OseeDsl;
-import org.eclipse.osee.framework.core.dsl.oseeDsl.OseeDslFactory;
-import org.eclipse.osee.framework.core.dsl.oseeDsl.OverrideOption;
-import org.eclipse.osee.framework.core.dsl.oseeDsl.RemoveAttribute;
-import org.eclipse.osee.framework.core.dsl.oseeDsl.RemoveEnum;
-import org.eclipse.osee.framework.core.dsl.oseeDsl.UpdateAttribute;
-import org.eclipse.osee.framework.core.dsl.oseeDsl.XArtifactType;
-import org.eclipse.osee.framework.core.dsl.oseeDsl.XAttributeType;
-import org.eclipse.osee.framework.core.dsl.oseeDsl.XAttributeTypeRef;
-import org.eclipse.osee.framework.core.dsl.oseeDsl.XOseeArtifactTypeOverride;
-import org.eclipse.osee.framework.core.dsl.oseeDsl.XOseeEnumEntry;
-import org.eclipse.osee.framework.core.dsl.oseeDsl.XOseeEnumOverride;
-import org.eclipse.osee.framework.core.dsl.oseeDsl.XOseeEnumType;
-import org.eclipse.osee.framework.core.dsl.oseeDsl.XRelationType;
-import org.eclipse.osee.framework.core.dsl.oseeDsl.util.OseeDslSwitch;
-import org.eclipse.osee.framework.core.enums.CoreBranches;
-import org.eclipse.osee.framework.core.enums.RelationTypeMultiplicity;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.core.model.OseeEnumEntry;
-import org.eclipse.osee.framework.core.model.cache.AttributeTypeCache;
-import org.eclipse.osee.framework.core.model.cache.BranchCache;
-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.operation.AbstractOperation;
-import org.eclipse.osee.framework.core.services.IOseeModelFactoryService;
-import org.eclipse.osee.framework.core.util.HexUtil;
-import org.eclipse.osee.framework.jdk.core.util.Strings;
-
-/**
- * @author Ryan D. Brooks
- * @author Roberto E. Escobar
- */
-public class XTextToOseeTypeOperation extends AbstractOperation {
- private final IOseeModelFactoryService provider;
- private final OseeDsl model;
- private final OseeTypeCache typeCache;
- private final BranchCache branchCache;
-
- public XTextToOseeTypeOperation(IOseeModelFactoryService provider, OseeTypeCache typeCache, BranchCache branchCache, OseeDsl model) {
- super("OSEE Text Model to OSEE", "");
- this.provider = provider;
- this.typeCache = typeCache;
- this.branchCache = branchCache;
- this.model = model;
- }
-
- @Override
- protected void doWork(IProgressMonitor monitor) throws Exception {
- double workAmount = 1.0;
-
- int workTotal = model.getArtifactTypes().size();
- workTotal += model.getArtifactTypeOverrides().size();
- workTotal += model.getAttributeTypes().size();
- workTotal += model.getRelationTypes().size();
- workTotal += model.getEnumTypes().size();
- workTotal += model.getEnumOverrides().size();
-
- if (workTotal > 0) {
- int amount = calculateWork(workAmount / workTotal);
-
- for (XOseeArtifactTypeOverride xArtifactTypeOverride : model.getArtifactTypeOverrides()) {
- translateXArtifactTypeOverride(xArtifactTypeOverride);
- monitor.worked(amount);
- }
-
- for (XArtifactType xArtifactType : model.getArtifactTypes()) {
- translateXArtifactType(xArtifactType);
- monitor.worked(amount);
- }
-
- for (XOseeEnumOverride xEnumOverride : model.getEnumOverrides()) {
- translateXEnumOverride(xEnumOverride);
- monitor.worked(amount);
- }
-
- for (XOseeEnumType xEnumType : model.getEnumTypes()) {
- translateXEnumType(xEnumType);
- monitor.worked(amount);
- }
-
- for (XAttributeType xAttributeType : model.getAttributeTypes()) {
- translateXAttributeType(xAttributeType);
- monitor.worked(amount);
- }
-
- for (XArtifactType xArtifactType : model.getArtifactTypes()) {
- handleXArtifactTypeCrossRef(xArtifactType);
- monitor.worked(amount);
- }
-
- for (XRelationType xRelationType : model.getRelationTypes()) {
- translateXRelationType(xRelationType);
- monitor.worked(amount);
- }
- }
- }
-
- private void handleXArtifactTypeCrossRef(XArtifactType xArtifactType) throws OseeCoreException {
- ArtifactType targetArtifactType =
- typeCache.getArtifactTypeCache().getByGuid(HexUtil.toLong(xArtifactType.getUuid()));
- translateSuperTypes(targetArtifactType, xArtifactType);
- Map<IOseeBranch, Collection<AttributeType>> validAttributesPerBranch = getOseeAttributes(xArtifactType);
- targetArtifactType.setAllAttributeTypes(validAttributesPerBranch);
- }
-
- private void translateSuperTypes(ArtifactType targetArtifactType, XArtifactType xArtifactType) throws OseeCoreException {
- Set<ArtifactType> oseeSuperTypes = new HashSet<ArtifactType>();
- for (XArtifactType xSuperType : xArtifactType.getSuperArtifactTypes()) {
- String superTypeName = xSuperType.getName();
- ArtifactType oseeSuperType = typeCache.getArtifactTypeCache().getUniqueByName(superTypeName);
- oseeSuperTypes.add(oseeSuperType);
- }
-
- if (!oseeSuperTypes.isEmpty()) {
- targetArtifactType.setSuperTypes(oseeSuperTypes);
- }
- }
-
- private Map<IOseeBranch, Collection<AttributeType>> getOseeAttributes(XArtifactType xArtifactType) throws OseeCoreException {
- Map<IOseeBranch, Collection<AttributeType>> validAttributes =
- new HashMap<IOseeBranch, Collection<AttributeType>>();
- for (XAttributeTypeRef xAttributeTypeRef : xArtifactType.getValidAttributeTypes()) {
- XAttributeType xAttributeType = xAttributeTypeRef.getValidAttributeType();
- IOseeBranch branch = getAttributeBranch(xAttributeTypeRef);
- AttributeType oseeAttributeType =
- typeCache.getAttributeTypeCache().getByGuid(HexUtil.toLong(xAttributeType.getUuid()));
- if (oseeAttributeType != null) {
- Collection<AttributeType> listOfAllowedAttributes = validAttributes.get(branch);
- if (listOfAllowedAttributes == null) {
- listOfAllowedAttributes = new HashSet<AttributeType>();
- validAttributes.put(branch, listOfAllowedAttributes);
- }
- listOfAllowedAttributes.add(oseeAttributeType);
- } else {
- System.out.println(String.format("Type was null for \"%s\"", xArtifactType.getName()));
- }
- }
- return validAttributes;
- }
-
- private IOseeBranch getAttributeBranch(XAttributeTypeRef xAttributeTypeRef) throws OseeCoreException {
- String branchGuid = xAttributeTypeRef.getBranchGuid();
- if (branchGuid == null) {
- return CoreBranches.SYSTEM_ROOT;
- } else {
- IOseeBranch branch = branchCache.getByGuid(branchGuid);
- if (branch == null) {
- branch = TokenFactory.createBranch(branchGuid, branchGuid);
- }
- return branch;
- }
- }
-
- private void translateXArtifactTypeOverride(XOseeArtifactTypeOverride xArtTypeOverride) {
- XArtifactType xArtifactType = xArtTypeOverride.getOverridenArtifactType();
- final EList<XAttributeTypeRef> validAttributeTypes = xArtifactType.getValidAttributeTypes();
- if (!xArtTypeOverride.isInheritAll()) {
- validAttributeTypes.clear();
- }
-
- OseeDslSwitch<Void> overrideVisitor = new OseeDslSwitch<Void>() {
-
- @Override
- public Void caseAddAttribute(AddAttribute addOption) {
- XAttributeTypeRef attributeRef = addOption.getAttribute();
- validAttributeTypes.add(attributeRef);
- return super.caseAddAttribute(addOption);
- }
-
- @Override
- public Void caseRemoveAttribute(RemoveAttribute removeOption) {
- XAttributeType attribute = removeOption.getAttribute();
- String guidToMatch = attribute.getUuid();
- List<XAttributeTypeRef> toRemove = new LinkedList<XAttributeTypeRef>();
- for (XAttributeTypeRef xAttributeTypeRef : validAttributeTypes) {
- String itemGuid = xAttributeTypeRef.getValidAttributeType().getUuid();
- if (guidToMatch.equals(itemGuid)) {
- toRemove.add(xAttributeTypeRef);
- }
- }
- validAttributeTypes.removeAll(toRemove);
- return super.caseRemoveAttribute(removeOption);
- }
-
- @Override
- public Void caseUpdateAttribute(UpdateAttribute updateAttribute) {
- XAttributeTypeRef refToUpdate = updateAttribute.getAttribute();
- String guidToMatch = refToUpdate.getValidAttributeType().getUuid();
- List<XAttributeTypeRef> toRemove = new LinkedList<XAttributeTypeRef>();
- for (XAttributeTypeRef xAttributeTypeRef : validAttributeTypes) {
- String itemGuid = xAttributeTypeRef.getValidAttributeType().getUuid();
- if (guidToMatch.equals(itemGuid)) {
- toRemove.add(xAttributeTypeRef);
- }
- }
- validAttributeTypes.removeAll(toRemove);
- validAttributeTypes.add(refToUpdate);
- return super.caseUpdateAttribute(updateAttribute);
- }
-
- };
-
- for (AttributeOverrideOption xOverrideOption : xArtTypeOverride.getOverrideOptions()) {
- overrideVisitor.doSwitch(xOverrideOption);
- }
- }
-
- private void translateXArtifactType(XArtifactType xArtifactType) throws OseeCoreException {
- String artifactTypeName = xArtifactType.getName();
-
- provider.getArtifactTypeFactory().createOrUpdate(typeCache.getArtifactTypeCache(),
- HexUtil.toLong(xArtifactType.getUuid()), xArtifactType.isAbstract(), artifactTypeName);
- }
-
- private void translateXEnumType(XOseeEnumType xEnumType) throws OseeCoreException {
- String enumTypeName = xEnumType.getName();
-
- OseeEnumType oseeEnumType =
- provider.getOseeEnumTypeFactory().createOrUpdate(typeCache.getEnumTypeCache(),
- HexUtil.toLong(xEnumType.getUuid()), enumTypeName);
-
- int lastOrdinal = 0;
- List<OseeEnumEntry> oseeEnumEntries = new ArrayList<OseeEnumEntry>();
- for (XOseeEnumEntry xEnumEntry : xEnumType.getEnumEntries()) {
- String entryName = xEnumEntry.getName();
- String ordinal = xEnumEntry.getOrdinal();
- if (Strings.isValid(ordinal)) {
- lastOrdinal = Integer.parseInt(ordinal);
- }
-
- String entryGuid = xEnumEntry.getEntryGuid();
- oseeEnumEntries.add(provider.getOseeEnumTypeFactory().createEnumEntry(entryGuid, entryName, lastOrdinal,
- xEnumEntry.getDescription()));
- lastOrdinal++;
- }
- oseeEnumType.setEntries(oseeEnumEntries);
- }
-
- private void translateXEnumOverride(XOseeEnumOverride xEnumOverride) {
- XOseeEnumType xEnumType = xEnumOverride.getOverridenEnumType();
- final EList<XOseeEnumEntry> enumEntries = xEnumType.getEnumEntries();
- if (!xEnumOverride.isInheritAll()) {
- enumEntries.clear();
- }
-
- OseeDslSwitch<Void> overrideVisitor = new OseeDslSwitch<Void>() {
-
- @Override
- public Void caseAddEnum(AddEnum addEnum) {
- String entryName = addEnum.getEnumEntry();
- String entryGuid = addEnum.getEntryGuid();
- String description = addEnum.getDescription();
- XOseeEnumEntry xEnumEntry = OseeDslFactory.eINSTANCE.createXOseeEnumEntry();
- xEnumEntry.setName(entryName);
- xEnumEntry.setEntryGuid(entryGuid);
- xEnumEntry.setDescription(description);
- enumEntries.add(xEnumEntry);
- return super.caseAddEnum(addEnum);
- }
-
- @Override
- public Void caseRemoveEnum(RemoveEnum removeEnum) {
- XOseeEnumEntry enumEntry = removeEnum.getEnumEntry();
- String guidToMatch = enumEntry.getEntryGuid();
- List<XOseeEnumEntry> toRemove = new LinkedList<XOseeEnumEntry>();
- for (XOseeEnumEntry item : enumEntries) {
- String itemGuid = item.getEntryGuid();
- if (guidToMatch.equals(itemGuid)) {
- toRemove.add(item);
- }
- }
- enumEntries.removeAll(toRemove);
- return super.caseRemoveEnum(removeEnum);
- }
-
- };
-
- for (OverrideOption xOverrideOption : xEnumOverride.getOverrideOptions()) {
- overrideVisitor.doSwitch(xOverrideOption);
- }
- }
-
- private void translateXAttributeType(XAttributeType xAttributeType) throws OseeCoreException {
- int min = Integer.parseInt(xAttributeType.getMin());
- int max = Integer.MAX_VALUE;
- if (!xAttributeType.getMax().equals("unlimited")) {
- max = Integer.parseInt(xAttributeType.getMax());
- }
- XOseeEnumType xEnumType = xAttributeType.getEnumType();
- OseeEnumType oseeEnumType = null;
- if (xEnumType != null) {
- oseeEnumType = typeCache.getEnumTypeCache().getByGuid(HexUtil.toLong(xEnumType.getUuid()));
- }
-
- AttributeTypeCache cache = typeCache.getAttributeTypeCache();
- provider.getAttributeTypeFactory().createOrUpdate(cache, //
- HexUtil.toLong(xAttributeType.getUuid()), //
- xAttributeType.getName(), //
- getQualifiedTypeName(xAttributeType.getBaseAttributeType()), //
- getQualifiedTypeName(xAttributeType.getDataProvider()), //
- xAttributeType.getFileExtension(), //
- xAttributeType.getDefaultValue(), //
- oseeEnumType, //
- min, //
- max, //
- xAttributeType.getDescription(), //
- xAttributeType.getTaggerId(),//
- xAttributeType.getMediaType());
- }
-
- private String getQualifiedTypeName(String id) {
- String value = id;
- if (!value.contains(".")) {
- value = "org.eclipse.osee.framework.skynet.core." + id;
- }
- return value;
- }
-
- private void translateXRelationType(XRelationType xRelationType) throws OseeCoreException {
- RelationTypeMultiplicity multiplicity =
- RelationTypeMultiplicity.getFromString(xRelationType.getMultiplicity().name());
-
- String sideATypeName = xRelationType.getSideAArtifactType().getName();
- String sideBTypeName = xRelationType.getSideBArtifactType().getName();
-
- ArtifactType sideAType = typeCache.getArtifactTypeCache().getUniqueByName(sideATypeName);
- ArtifactType sideBType = typeCache.getArtifactTypeCache().getUniqueByName(sideBTypeName);
-
- provider.getRelationTypeFactory().createOrUpdate(typeCache.getRelationTypeCache(), //
- HexUtil.toLong(xRelationType.getUuid()), //
- xRelationType.getName(), //
- xRelationType.getSideAName(), //
- xRelationType.getSideBName(), //
- sideAType, //
- sideBType, //
- multiplicity, //
- OseeUtil.orderTypeNameToGuid(xRelationType.getDefaultOrderType()) //
- );
- }
-}
diff --git a/plugins/org.eclipse.osee.orcs.test/src/org/eclipse/osee/orcs/OrcsIntegrationRule.java b/plugins/org.eclipse.osee.orcs.test/src/org/eclipse/osee/orcs/OrcsIntegrationRule.java
index 911b54421b..affc9c72da 100644
--- a/plugins/org.eclipse.osee.orcs.test/src/org/eclipse/osee/orcs/OrcsIntegrationRule.java
+++ b/plugins/org.eclipse.osee.orcs.test/src/org/eclipse/osee/orcs/OrcsIntegrationRule.java
@@ -12,7 +12,6 @@ package org.eclipse.osee.orcs;
import org.eclipse.osee.event.EventService;
import org.eclipse.osee.executor.admin.ExecutorAdmin;
-import org.eclipse.osee.framework.core.services.IOseeCachingService;
import org.eclipse.osee.framework.core.services.IOseeModelFactoryService;
import org.eclipse.osee.framework.core.services.IdentityService;
import org.eclipse.osee.framework.database.IOseeDatabaseService;
@@ -46,7 +45,6 @@ public final class OrcsIntegrationRule extends OsgiRule {
@OsgiService public IdentityService idService;
@OsgiService public IOseeDatabaseService dbService;
@OsgiService public IOseeModelFactoryService modelFactory;
- @OsgiService public IOseeCachingService cachingService;
// @formatter:on
}
diff --git a/plugins/org.eclipse.osee.orcs/src/org/eclipse/osee/orcs/OrcsTypes.java b/plugins/org.eclipse.osee.orcs/src/org/eclipse/osee/orcs/OrcsTypes.java
index 69ffe2b9f7..21182cd93f 100644
--- a/plugins/org.eclipse.osee.orcs/src/org/eclipse/osee/orcs/OrcsTypes.java
+++ b/plugins/org.eclipse.osee.orcs/src/org/eclipse/osee/orcs/OrcsTypes.java
@@ -16,18 +16,25 @@ import java.util.concurrent.Callable;
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.exception.OseeCoreException;
-import org.eclipse.osee.framework.core.model.OseeImportModelRequest;
-import org.eclipse.osee.framework.core.model.OseeImportModelResponse;
+import org.eclipse.osee.framework.resource.management.IResource;
+import org.eclipse.osee.orcs.data.ArtifactTypes;
+import org.eclipse.osee.orcs.data.AttributeTypes;
+import org.eclipse.osee.orcs.data.RelationTypes;
/**
* @author Roberto E. Escobar
*/
public interface OrcsTypes {
- void importOseeTypes(boolean isInitializing, OseeImportModelRequest request, OseeImportModelResponse response) throws OseeCoreException;
+ ArtifactTypes getArtifactTypes();
- void exportOseeTypes(OutputStream outputStream) throws OseeCoreException;
+ AttributeTypes getAttributeTypes();
+
+ RelationTypes getRelationTypes();
+
+ Callable<?> loadTypes(IResource resource, boolean isInitializing);
+
+ Callable<?> writeTypes(OutputStream outputStream);
Callable<?> purgeArtifactsByArtifactType(Collection<? extends IArtifactType> artifactTypes);
@@ -35,4 +42,6 @@ public interface OrcsTypes {
Callable<?> purgeRelationsByRelationType(Collection<? extends IRelationType> relationTypes);
+ void invalidateAll();
+
}
diff --git a/plugins/org.eclipse.osee.orcs/src/org/eclipse/osee/orcs/data/GraphReadable.java b/plugins/org.eclipse.osee.orcs/src/org/eclipse/osee/orcs/data/GraphReadable.java
index 12ee1ba6f0..112becdd50 100644
--- a/plugins/org.eclipse.osee.orcs/src/org/eclipse/osee/orcs/data/GraphReadable.java
+++ b/plugins/org.eclipse.osee.orcs/src/org/eclipse/osee/orcs/data/GraphReadable.java
@@ -13,17 +13,17 @@ package org.eclipse.osee.orcs.data;
import java.util.Collection;
import java.util.List;
import org.eclipse.osee.framework.core.data.IArtifactType;
+import org.eclipse.osee.framework.core.data.IRelationType;
import org.eclipse.osee.framework.core.data.IRelationTypeSide;
import org.eclipse.osee.framework.core.data.Readable;
import org.eclipse.osee.framework.core.enums.RelationSide;
import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.core.model.type.RelationType;
public interface GraphReadable extends Readable {
Collection<IRelationTypeSide> getExistingRelationTypes(ArtifactReadable art);
- List<RelationType> getValidRelationTypes(ArtifactReadable art) throws OseeCoreException;
+ List<IRelationType> getValidRelationTypes(ArtifactReadable art) throws OseeCoreException;
///////
ArtifactReadable getParent(ArtifactReadable art) throws OseeCoreException;
@@ -32,8 +32,7 @@ public interface GraphReadable extends Readable {
RelationsReadable getRelatedArtifacts(IRelationTypeSide relationTypeSide, ArtifactReadable art) throws OseeCoreException;
- RelationType getFullRelationType(IRelationTypeSide relationTypeSide) throws OseeCoreException;
-
- int getRelationSideMax(RelationType relationType, IArtifactType artifactType, RelationSide relationSide) throws OseeCoreException;
+ int getRelationSideMax(IRelationType relationType, IArtifactType artifactType, RelationSide relationSide) throws OseeCoreException;
+ RelationTypes getTypes();
}
diff --git a/plugins/org.eclipse.osee.orcs/src/org/eclipse/osee/orcs/utility/Providers.java b/plugins/org.eclipse.osee.orcs/src/org/eclipse/osee/orcs/utility/Providers.java
deleted file mode 100644
index 3799e1e5e0..0000000000
--- a/plugins/org.eclipse.osee.orcs/src/org/eclipse/osee/orcs/utility/Providers.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2013 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.orcs.utility;
-
-/**
- * @author Roberto E. Escobar
- */
-public final class Providers {
-
- private Providers() {
- // utility class
- }
-
- public static <T> ObjectProvider<T> returning(final T object) {
- return new ObjectProvider<T>() {
-
- @Override
- public T get() {
- return object;
- }
- };
- }
-
-}

Back to the top