Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrescobar2011-04-19 21:35:22 +0000
committerRyan D. Brooks2011-04-19 21:35:22 +0000
commit026a9005c44a18f7b3eb68199b5bc7a517eeae03 (patch)
tree4057ed9bf8b20d801a1c92db712351eff035ab37 /plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework
parent0506c439cef8015ec648b71123a1f3f6e8e16de0 (diff)
downloadorg.eclipse.osee-026a9005c44a18f7b3eb68199b5bc7a517eeae03.tar.gz
org.eclipse.osee-026a9005c44a18f7b3eb68199b5bc7a517eeae03.tar.xz
org.eclipse.osee-026a9005c44a18f7b3eb68199b5bc7a517eeae03.zip
refactor: Remove ArtifactProcessor
Remove ArtifactProcessor interface from ArtifactFactory Clean up ArtifactTypeManager.addArtifact API
Diffstat (limited to 'plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework')
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/Artifact.java4
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/ArtifactFactory.java9
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/ArtifactProcessor.java21
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/ArtifactTypeManager.java45
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/importing/resolvers/NewArtifactImportResolver.java12
5 files changed, 18 insertions, 73 deletions
diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/Artifact.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/Artifact.java
index c0f3383001e..5a3761d6f36 100644
--- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/Artifact.java
+++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/Artifact.java
@@ -425,7 +425,7 @@ public class Artifact extends NamedIdentity implements IArtifact, IAdaptable, IB
}
public final Artifact addNewChild(IRelationSorterId sorterId, IArtifactType artifactType, String name) throws OseeCoreException {
- Artifact child = ArtifactTypeManager.makeNewArtifact(artifactType, branch);
+ Artifact child = ArtifactTypeManager.addArtifact(artifactType, branch);
child.setName(name);
addChild(sorterId, child);
return child;
@@ -1332,7 +1332,7 @@ public class Artifact extends NamedIdentity implements IArtifact, IAdaptable, IB
}
public final Artifact duplicate(IOseeBranch branch, Collection<IAttributeType> excudeAttributeTypes) throws OseeCoreException {
- Artifact newArtifact = ArtifactTypeManager.makeNewArtifact(artifactType, branch);
+ Artifact newArtifact = ArtifactTypeManager.addArtifact(artifactType, branch);
// we do this because attributes were added on creation to meet the
// minimum attribute requirements
newArtifact.attributes.clear();
diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/ArtifactFactory.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/ArtifactFactory.java
index ae49b107335..8b2d1ff53cb 100644
--- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/ArtifactFactory.java
+++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/ArtifactFactory.java
@@ -40,14 +40,14 @@ public abstract class ArtifactFactory {
}
}
- public Artifact makeNewArtifact(IOseeBranch branch, IArtifactType artifactTypeToken, String guid, String humandReadableId, ArtifactProcessor earlyArtifactInitialization) throws OseeCoreException {
- return makeNewArtifact(branch, artifactTypeToken, null, guid, humandReadableId, earlyArtifactInitialization);
+ public Artifact makeNewArtifact(IOseeBranch branch, IArtifactType artifactTypeToken, String guid, String humandReadableId) throws OseeCoreException {
+ return makeNewArtifact(branch, artifactTypeToken, null, guid, humandReadableId);
}
/**
* Used to create a new artifact (one that has never been saved into the datastore)
*/
- public Artifact makeNewArtifact(IOseeBranch branch, IArtifactType artifactTypeToken, String artifactName, String guid, String humanReadableId, ArtifactProcessor earlyArtifactInitialization) throws OseeCoreException {
+ public Artifact makeNewArtifact(IOseeBranch branch, IArtifactType artifactTypeToken, String artifactName, String guid, String humanReadableId) throws OseeCoreException {
ArtifactType artifactType = ArtifactTypeManager.getType(artifactTypeToken);
Conditions.checkExpressionFailOnTrue(artifactType.isAbstract(),
@@ -72,9 +72,6 @@ public abstract class ArtifactFactory {
Artifact artifact = getArtifactInstance(guid, humanReadableId, BranchManager.getBranch(branch), artifactType);
artifact.setArtId(ConnectionHandler.getSequence().getNextArtifactId());
- if (earlyArtifactInitialization != null) {
- earlyArtifactInitialization.run(artifact);
- }
artifact.meetMinimumAttributeCounts(true);
ArtifactCache.cache(artifact);
artifact.setLinksLoaded(true);
diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/ArtifactProcessor.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/ArtifactProcessor.java
deleted file mode 100644
index 79531c6ff84..00000000000
--- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/ArtifactProcessor.java
+++ /dev/null
@@ -1,21 +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.framework.skynet.core.artifact;
-
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-
-/**
- * @author Andrew M. Finkbeiner
- */
-public interface ArtifactProcessor {
- void run(Artifact artifact) throws OseeCoreException;
-}
diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/ArtifactTypeManager.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/ArtifactTypeManager.java
index 2ee8be947b6..017e435d64d 100644
--- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/ArtifactTypeManager.java
+++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/ArtifactTypeManager.java
@@ -50,11 +50,11 @@ public class ArtifactTypeManager {
private final static ArtifactFactoryManager factoryManager = new ArtifactFactoryManager();
- public static ArtifactTypeCache getCache() {
+ private static ArtifactTypeCache getCache() {
return getCacheService().getArtifactTypeCache();
}
- public static IOseeCachingService getCacheService() {
+ private static IOseeCachingService getCacheService() {
return Activator.getInstance().getOseeCacheService();
}
@@ -151,14 +151,14 @@ public class ArtifactTypeManager {
* Get a new instance of type artifactTypeName
*/
public static Artifact addArtifact(IArtifactType artifactType, IOseeBranch branch) throws OseeCoreException {
- return makeNewArtifact(artifactType, branch);
+ return getFactory(artifactType).makeNewArtifact(branch, artifactType, null, null, null);
}
/**
* Get a new instance of type artifactTypeName and set it's name.
*/
public static Artifact addArtifact(IArtifactType artifactType, IOseeBranch branch, String name) throws OseeCoreException {
- Artifact artifact = makeNewArtifact(artifactType, branch);
+ Artifact artifact = addArtifact(artifactType, branch);
artifact.setName(name);
return artifact;
}
@@ -167,12 +167,14 @@ public class ArtifactTypeManager {
* Get a new instance of the type of artifact. This is just a convenience method that calls makeNewArtifact on the
* known factory with this descriptor for the descriptor parameter, and the supplied branch.
*
- * @param branch branch on which artifact will be created
- * @return Return artifact reference
* @see ArtifactFactory#makeNewArtifact(Branch, IArtifactType, String, String, ArtifactProcessor)
*/
- public static Artifact addArtifact(IArtifactType artifactType, Branch branch, String guid, String humandReadableId) throws OseeCoreException {
- return makeNewArtifact(artifactType, branch, guid, humandReadableId);
+ public static Artifact addArtifact(IArtifactType artifactType, IOseeBranch branch, String guid, String humandReadableId) throws OseeCoreException {
+ return getFactory(artifactType).makeNewArtifact(branch, artifactType, guid, humandReadableId);
+ }
+
+ public static Artifact addArtifact(IArtifactType artifactType, IOseeBranch branch, String name, String guid, String humandReadableId) throws OseeCoreException {
+ return getFactory(artifactType).makeNewArtifact(branch, artifactType, name, guid, humandReadableId);
}
public static Artifact addArtifact(IArtifactToken artifactToken, IOseeBranch branch) throws OseeCoreException {
@@ -266,33 +268,6 @@ public class ArtifactTypeManager {
}
/**
- * Get a new instance of the type of artifact described by this descriptor. This is just a convenience method that
- * calls makeNewArtifact on the known factory with this descriptor for the descriptor parameter, and the supplied
- * branch.
- *
- * @return Return artifact reference
- * @see ArtifactFactory#makeNewArtifact(IArtifactType, IOseeBranch)
- * @use {@link ArtifactTypeManager}.addArtifact
- */
- public static Artifact makeNewArtifact(IArtifactType artifactType, IOseeBranch branch) throws OseeCoreException {
- return getFactory(artifactType).makeNewArtifact(branch, artifactType, null, null, null);
- }
-
- /**
- * Get a new instance of the type of artifact described by this descriptor. This is just a convenience method that
- * calls makeNewArtifact on the known factory with this descriptor for the descriptor parameter, and the supplied
- * branch.
- *
- * @param branch branch on which artifact will be created
- * @return Return artifact reference
- * @see ArtifactFactory#makeNewArtifact(Branch, IArtifactType, String, String, ArtifactProcessor)
- * @use {@link ArtifactTypeManager}.addArtifact
- */
- public static Artifact makeNewArtifact(IArtifactType artifactType, Branch branch, String guid, String humandReadableId) throws OseeCoreException {
- return getFactory(artifactType).makeNewArtifact(branch, artifactType, guid, humandReadableId, null);
- }
-
- /**
* @return Returns the ArtifactType factory.
*/
public static ArtifactFactory getFactory(IArtifactType artifactType) throws OseeCoreException {
diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/importing/resolvers/NewArtifactImportResolver.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/importing/resolvers/NewArtifactImportResolver.java
index 7f3bed46e85..93548026981 100644
--- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/importing/resolvers/NewArtifactImportResolver.java
+++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/importing/resolvers/NewArtifactImportResolver.java
@@ -17,7 +17,6 @@ import org.eclipse.osee.framework.core.exception.OseeCoreException;
import org.eclipse.osee.framework.core.model.Branch;
import org.eclipse.osee.framework.logging.OseeLog;
import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
-import org.eclipse.osee.framework.skynet.core.artifact.ArtifactProcessor;
import org.eclipse.osee.framework.skynet.core.artifact.ArtifactTypeManager;
import org.eclipse.osee.framework.skynet.core.importing.RoughArtifact;
import org.eclipse.osee.framework.skynet.core.importing.RoughArtifactKind;
@@ -42,14 +41,9 @@ public class NewArtifactImportResolver implements IArtifactImportResolver {
roughArtifact, roughArtifact.getAttributes());
Artifact realArtifact =
- ArtifactTypeManager.getFactory(artifactType).makeNewArtifact(branch, artifactType, roughArtifact.getGuid(),
- roughArtifact.getHumanReadableId(), new ArtifactProcessor() {
- @Override
- public void run(Artifact artifact) throws OseeCoreException {
- roughArtifact.translateAttributes(artifact);
- }
- });
-
+ ArtifactTypeManager.addArtifact(artifactType, branch, roughArtifact.getGuid(),
+ roughArtifact.getHumanReadableId());
+ roughArtifact.translateAttributes(realArtifact);
return realArtifact;
}

Back to the top