Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMark Joy2016-11-30 14:44:20 -0500
committerDavid W. Miller2016-11-30 14:44:20 -0500
commitc75ba4ce25c0a7ce49962aadaeb37da06b6d25f2 (patch)
tree928ebe65a3a2b5e168fa21b5e2a5778f51100c5c
parent0ac1b1d081a8a2fac52df2a31af20cb58b456b34 (diff)
downloadorg.eclipse.osee-c75ba4ce25c0a7ce49962aadaeb37da06b6d25f2.tar.gz
org.eclipse.osee-c75ba4ce25c0a7ce49962aadaeb37da06b6d25f2.tar.xz
org.eclipse.osee-c75ba4ce25c0a7ce49962aadaeb37da06b6d25f2.zip
refactor: Remove TransactionFactory.createTransaction that takes a long for branch id
Change-Id: I020708f7882fc66de05c8529d59ff80cc4e131c6 Signed-off-by: Mark Joy <mark.joy@boeing.com>
-rw-r--r--plugins/org.eclipse.osee.ats.rest/src/org/eclipse/osee/ats/rest/internal/convert/AbstractConvertGuidToUuid.java3
-rw-r--r--plugins/org.eclipse.osee.disposition.rest/src/org/eclipse/osee/disposition/rest/internal/OrcsStorageImpl.java24
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/blam/operation/ReplaceArtifactWithBaselineOperation.java4
-rw-r--r--plugins/org.eclipse.osee.orcs.account.admin/src/org/eclipse/osee/orcs/account/admin/internal/oauth/ClientStorageProvider.java4
-rw-r--r--plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/transaction/TransactionFactoryImpl.java8
-rw-r--r--plugins/org.eclipse.osee.orcs.rest.model/src/org/eclipse/osee/orcs/rest/model/TransactionEndpoint.java3
-rw-r--r--plugins/org.eclipse.osee.orcs.rest/src/org/eclipse/osee/orcs/rest/internal/TransactionEndpointImpl.java3
-rw-r--r--plugins/org.eclipse.osee.orcs.rest/src/org/eclipse/osee/orcs/rest/internal/TypesEndpointImpl.java6
-rw-r--r--plugins/org.eclipse.osee.orcs/src/org/eclipse/osee/orcs/transaction/TransactionFactory.java4
9 files changed, 27 insertions, 32 deletions
diff --git a/plugins/org.eclipse.osee.ats.rest/src/org/eclipse/osee/ats/rest/internal/convert/AbstractConvertGuidToUuid.java b/plugins/org.eclipse.osee.ats.rest/src/org/eclipse/osee/ats/rest/internal/convert/AbstractConvertGuidToUuid.java
index 095fd49643..2be2d4b050 100644
--- a/plugins/org.eclipse.osee.ats.rest/src/org/eclipse/osee/ats/rest/internal/convert/AbstractConvertGuidToUuid.java
+++ b/plugins/org.eclipse.osee.ats.rest/src/org/eclipse/osee/ats/rest/internal/convert/AbstractConvertGuidToUuid.java
@@ -62,8 +62,7 @@ public abstract class AbstractConvertGuidToUuid implements IAtsDatabaseConversio
protected TransactionBuilder createTransactionBuilder() throws OseeCoreException {
TransactionFactory txFactory = getOrcsApi().getTransactionFactory();
Conditions.checkNotNull(txFactory, "transaction factory");
- return txFactory.createTransaction(COMMON, atsServer.getArtifactByGuid(SystemUser.OseeSystem.getGuid()),
- getName());
+ return txFactory.createTransaction(COMMON, SystemUser.OseeSystem, getName());
}
/**
diff --git a/plugins/org.eclipse.osee.disposition.rest/src/org/eclipse/osee/disposition/rest/internal/OrcsStorageImpl.java b/plugins/org.eclipse.osee.disposition.rest/src/org/eclipse/osee/disposition/rest/internal/OrcsStorageImpl.java
index fb3def3de7..46750e5afd 100644
--- a/plugins/org.eclipse.osee.disposition.rest/src/org/eclipse/osee/disposition/rest/internal/OrcsStorageImpl.java
+++ b/plugins/org.eclipse.osee.disposition.rest/src/org/eclipse/osee/disposition/rest/internal/OrcsStorageImpl.java
@@ -70,7 +70,6 @@ public class OrcsStorageImpl implements Storage {
this.orcsApi = orcsApi;
}
- @SuppressWarnings("unchecked")
private ArtifactReadable getDispoUser() throws OseeCoreException {
return getQuery().fromBranch(COMMON).andIds(SystemUser.OseeSystem).getResults().getExactlyOne();
}
@@ -122,7 +121,6 @@ public class OrcsStorageImpl implements Storage {
reloadTypes();
}
- @SuppressWarnings("unchecked")
@Override
public ArtifactReadable findUser() {
return getQuery().fromBranch(COMMON).andIds(SystemUser.OseeSystem).getResults().getExactlyOne();
@@ -231,7 +229,8 @@ public class OrcsStorageImpl implements Storage {
@Override
public Long createDispoSet(ArtifactReadable author, DispoProgram program, DispoSet descriptor) {
- TransactionBuilder tx = getTxFactory().createTransaction(program.getUuid(), author, "Create Dispo Set");
+ TransactionBuilder tx =
+ getTxFactory().createTransaction(BranchId.valueOf(program.getUuid()), author, "Create Dispo Set");
ArtifactId creatdArtId = tx.createArtifact(DispoConstants.DispoSet, descriptor.getName());
tx.setSoleAttributeFromString(creatdArtId, DispoConstants.ImportPath, descriptor.getImportPath());
tx.setSoleAttributeFromString(creatdArtId, DispoConstants.ImportState, descriptor.getImportState());
@@ -256,7 +255,8 @@ public class OrcsStorageImpl implements Storage {
boolean toReturn = false;
ArtifactReadable dispoArtifact = findDispoArtifact(program, entityId, type);
if (dispoArtifact != null) {
- TransactionBuilder tx = getTxFactory().createTransaction(program.getUuid(), author, "Delete Dispo Artifact");
+ TransactionBuilder tx =
+ getTxFactory().createTransaction(BranchId.valueOf(program.getUuid()), author, "Delete Dispo Artifact");
tx.deleteArtifact(dispoArtifact);
tx.commit();
toReturn = true;
@@ -278,7 +278,8 @@ public class OrcsStorageImpl implements Storage {
notesList = DispoUtil.noteListToJsonObj(newData.getNotesList());
}
- TransactionBuilder tx = getTxFactory().createTransaction(program.getUuid(), author, "Update Dispo Set");
+ TransactionBuilder tx =
+ getTxFactory().createTransaction(BranchId.valueOf(program.getUuid()), author, "Update Dispo Set");
if (name != null && !name.equals(origSetAs.getName())) {
tx.setName(dispoSet, name);
}
@@ -294,7 +295,8 @@ public class OrcsStorageImpl implements Storage {
@Override
public void createDispoItems(ArtifactReadable author, DispoProgram program, DispoSet parentSet, List<DispoItem> data) {
ArtifactReadable parentSetArt = findDispoArtifact(program, parentSet.getGuid(), DispoConstants.DispoSet);
- TransactionBuilder tx = getTxFactory().createTransaction(program.getUuid(), author, "Create Dispoable Item");
+ TransactionBuilder tx =
+ getTxFactory().createTransaction(BranchId.valueOf(program.getUuid()), author, "Create Dispoable Item");
for (DispoItem item : data) {
ArtifactId createdItem = tx.createArtifact(DispoConstants.DispoItem, item.getName());
@@ -427,7 +429,7 @@ public class OrcsStorageImpl implements Storage {
@Override
public void updateDispoItems(ArtifactReadable author, DispoProgram program, Collection<DispoItem> data, boolean resetRerunFlag, String operation) {
- TransactionBuilder tx = getTxFactory().createTransaction(program.getUuid(), author, operation);
+ TransactionBuilder tx = getTxFactory().createTransaction(BranchId.valueOf(program.getUuid()), author, operation);
for (DispoItem newItem : data) {
ArtifactReadable dispoItemArt = findDispoArtifact(program, newItem.getGuid(), DispoConstants.DispoItem);
@@ -502,15 +504,15 @@ public class OrcsStorageImpl implements Storage {
public String createDispoReport(DispoProgram program, ArtifactReadable author, String contents, String operationTitle) {
String toReturn = "";
- TransactionBuilder tx =
- getTxFactory().createTransaction(program.getUuid(), author, "Update Report: " + operationTitle);
+ TransactionBuilder tx = getTxFactory().createTransaction(BranchId.valueOf(program.getUuid()), author,
+ "Update Report: " + operationTitle);
ArtifactReadable reportArt =
getQuery().fromBranch(program.getUuid()).andNameEquals("Dispo_Report").getResults().getOneOrNull();
if (reportArt == null) {
TransactionBuilder txToCreate =
- getTxFactory().createTransaction(program.getUuid(), author, "Add Operation Report Art");
+ getTxFactory().createTransaction(BranchId.valueOf(program.getUuid()), author, "Add Operation Report Art");
txToCreate.createArtifact(CoreArtifactTypes.GeneralData, "Dispo_Report");
txToCreate.commit();
reportArt =
@@ -562,7 +564,7 @@ public class OrcsStorageImpl implements Storage {
OperationReport newReport = DispoUtil.cleanOperationReport(summary);
ArtifactReadable dispoSet = findDispoArtifact(program, set.getGuid(), DispoConstants.DispoSet);
TransactionBuilder tx =
- getTxFactory().createTransaction(program.getUuid(), author, "Update Dispo Operation Report");
+ getTxFactory().createTransaction(BranchId.valueOf(program.getUuid()), author, "Update Dispo Operation Report");
tx.setSoleAttributeFromString(dispoSet, DispoConstants.ImportState, newReport.getStatus().getName());
tx.setSoleAttributeFromString(dispoSet, DispoConstants.OperationSummary,
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/blam/operation/ReplaceArtifactWithBaselineOperation.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/blam/operation/ReplaceArtifactWithBaselineOperation.java
index e581828209..6e12e046d5 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/blam/operation/ReplaceArtifactWithBaselineOperation.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/blam/operation/ReplaceArtifactWithBaselineOperation.java
@@ -66,8 +66,8 @@ public class ReplaceArtifactWithBaselineOperation extends AbstractOperation {
if (sourceArtifact != null) {
String userId = ClientSessionManager.getCurrentUserToken().getUserId();
User user = UserManager.getUserByUserId(userId);
- txBuilder.replaceWithBaselineTxVersion(user.getGuid(), branch.getUuid(), txRecord,
- sourceArtifact.getArtId(), ReplaceArtifactWithBaselineOperation.class.getSimpleName());
+ txBuilder.replaceWithBaselineTxVersion(user.getGuid(), branch, txRecord, sourceArtifact.getArtId(),
+ ReplaceArtifactWithBaselineOperation.class.getSimpleName());
monitor.done();
} else {
artifact.deleteAndPersist();
diff --git a/plugins/org.eclipse.osee.orcs.account.admin/src/org/eclipse/osee/orcs/account/admin/internal/oauth/ClientStorageProvider.java b/plugins/org.eclipse.osee.orcs.account.admin/src/org/eclipse/osee/orcs/account/admin/internal/oauth/ClientStorageProvider.java
index c4e42bb181..8ca202dea4 100644
--- a/plugins/org.eclipse.osee.orcs.account.admin/src/org/eclipse/osee/orcs/account/admin/internal/oauth/ClientStorageProvider.java
+++ b/plugins/org.eclipse.osee.orcs.account.admin/src/org/eclipse/osee/orcs/account/admin/internal/oauth/ClientStorageProvider.java
@@ -63,8 +63,8 @@ public class ClientStorageProvider extends LazyObject<ClientStorage> {
InputSupplier<InputStream> newTypesSupplier = newTypesSupplier();
ArtifactReadable typeArt = (ArtifactReadable) clientStorage.storeTypes(newTypesSupplier);
- TransactionBuilder tx = orcsApi.getTransactionFactory().createTransaction(COMMON.getId(),
- SystemUser.OseeSystem, "Add OseeTypeDef OAuth Tuple to Common Branch");
+ TransactionBuilder tx = orcsApi.getTransactionFactory().createTransaction(COMMON, SystemUser.OseeSystem,
+ "Add OseeTypeDef OAuth Tuple to Common Branch");
tx.addTuple2(CoreTupleTypes.OseeTypeDef, OrcsTypesData.OSEE_TYPE_VERSION,
typeArt.getAttributes(CoreAttributeTypes.UriGeneralStringData).iterator().next());
diff --git a/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/transaction/TransactionFactoryImpl.java b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/transaction/TransactionFactoryImpl.java
index f17ee1552d..8847f864e5 100644
--- a/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/transaction/TransactionFactoryImpl.java
+++ b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/transaction/TransactionFactoryImpl.java
@@ -73,12 +73,6 @@ public class TransactionFactoryImpl implements TransactionFactory {
}
@Override
- public TransactionBuilder createTransaction(Long branchId, ArtifactId userArtifact, String comment) throws OseeCoreException {
- BranchId branch = BranchId.valueOf(branchId);
- return createTransaction(branch, userArtifact, comment);
- }
-
- @Override
public TransactionBuilder createTransaction(BranchId branch, ArtifactId author, String comment) throws OseeCoreException {
Conditions.checkNotNull(branch, "branch");
Conditions.checkNotNull(author, "author");
@@ -110,7 +104,7 @@ public class TransactionFactoryImpl implements TransactionFactory {
}
@Override
- public boolean replaceWithBaselineTxVersion(String userId, Long branchId, TransactionId txId, int artId, String comment) {
+ public boolean replaceWithBaselineTxVersion(String userId, BranchId branchId, TransactionId txId, int artId, String comment) {
boolean introduced = false;
ArtifactReadable userReadable =
queryFactory.fromBranch(CoreBranches.COMMON).andGuid(userId).getResults().getOneOrNull();
diff --git a/plugins/org.eclipse.osee.orcs.rest.model/src/org/eclipse/osee/orcs/rest/model/TransactionEndpoint.java b/plugins/org.eclipse.osee.orcs.rest.model/src/org/eclipse/osee/orcs/rest/model/TransactionEndpoint.java
index 16ddabc307..398e1ca734 100644
--- a/plugins/org.eclipse.osee.orcs.rest.model/src/org/eclipse/osee/orcs/rest/model/TransactionEndpoint.java
+++ b/plugins/org.eclipse.osee.orcs.rest.model/src/org/eclipse/osee/orcs/rest/model/TransactionEndpoint.java
@@ -19,6 +19,7 @@ import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
+import org.eclipse.osee.framework.core.data.BranchId;
import org.eclipse.osee.framework.core.data.TransactionId;
import org.eclipse.osee.framework.core.model.change.CompareResults;
@@ -55,5 +56,5 @@ public interface TransactionEndpoint {
@PUT
@Path("{user}/branch/{branch-id}/transaction/{tx-id}/artifact/{art-id}/comment")
- Response replaceWithBaselineTxVersion(@PathParam("user") String userId, @PathParam("branch-id") Long branchId, @PathParam("tx-id") TransactionId txId, @PathParam("art-id") int artId, String comment);
+ Response replaceWithBaselineTxVersion(@PathParam("user") String userId, @PathParam("branch-id") BranchId branchId, @PathParam("tx-id") TransactionId txId, @PathParam("art-id") int artId, String comment);
} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.orcs.rest/src/org/eclipse/osee/orcs/rest/internal/TransactionEndpointImpl.java b/plugins/org.eclipse.osee.orcs.rest/src/org/eclipse/osee/orcs/rest/internal/TransactionEndpointImpl.java
index 8d590378ee..9cc5fada50 100644
--- a/plugins/org.eclipse.osee.orcs.rest/src/org/eclipse/osee/orcs/rest/internal/TransactionEndpointImpl.java
+++ b/plugins/org.eclipse.osee.orcs.rest/src/org/eclipse/osee/orcs/rest/internal/TransactionEndpointImpl.java
@@ -15,6 +15,7 @@ import java.util.List;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.UriInfo;
+import org.eclipse.osee.framework.core.data.BranchId;
import org.eclipse.osee.framework.core.data.TransactionId;
import org.eclipse.osee.framework.core.model.change.CompareResults;
import org.eclipse.osee.orcs.OrcsApi;
@@ -71,7 +72,7 @@ public class TransactionEndpointImpl implements TransactionEndpoint {
}
@Override
- public Response replaceWithBaselineTxVersion(String userId, Long branchId, TransactionId txId, int artId, String comment) {
+ public Response replaceWithBaselineTxVersion(String userId, BranchId branchId, TransactionId txId, int artId, String comment) {
return OrcsRestUtil.asResponse(
orcsApi.getTransactionFactory().replaceWithBaselineTxVersion(userId, branchId, txId, artId, comment));
}
diff --git a/plugins/org.eclipse.osee.orcs.rest/src/org/eclipse/osee/orcs/rest/internal/TypesEndpointImpl.java b/plugins/org.eclipse.osee.orcs.rest/src/org/eclipse/osee/orcs/rest/internal/TypesEndpointImpl.java
index c1bcc3138e..e459346ab1 100644
--- a/plugins/org.eclipse.osee.orcs.rest/src/org/eclipse/osee/orcs/rest/internal/TypesEndpointImpl.java
+++ b/plugins/org.eclipse.osee.orcs.rest/src/org/eclipse/osee/orcs/rest/internal/TypesEndpointImpl.java
@@ -223,8 +223,8 @@ public class TypesEndpointImpl implements TypesEndpoint {
@Override
public Response importOrcsTypes(OrcsTypesData typesData) {
- TransactionBuilder tx = orcsApi.getTransactionFactory().createTransaction(COMMON.getId(), SystemUser.OseeSystem,
- "Add Types to Common Branch");
+ TransactionBuilder tx =
+ orcsApi.getTransactionFactory().createTransaction(COMMON, SystemUser.OseeSystem, "Add Types to Common Branch");
for (OrcsTypeSheet sheet : typesData.getSheets()) {
String guid = GUID.create();
if (Strings.isValid(sheet.getGuid())) {
@@ -240,7 +240,7 @@ public class TypesEndpointImpl implements TypesEndpoint {
}
tx.commit();
- tx = orcsApi.getTransactionFactory().createTransaction(COMMON.getId(), SystemUser.OseeSystem,
+ tx = orcsApi.getTransactionFactory().createTransaction(COMMON, SystemUser.OseeSystem,
"Add OseeTypeDef Tuples to Common Branch");
for (ArtifactReadable artifact : orcsApi.getQueryFactory().fromBranch(COMMON).andIsOfType(
CoreArtifactTypes.OseeTypeDefinition).getResults()) {
diff --git a/plugins/org.eclipse.osee.orcs/src/org/eclipse/osee/orcs/transaction/TransactionFactory.java b/plugins/org.eclipse.osee.orcs/src/org/eclipse/osee/orcs/transaction/TransactionFactory.java
index 02163787c2..aeba4837c4 100644
--- a/plugins/org.eclipse.osee.orcs/src/org/eclipse/osee/orcs/transaction/TransactionFactory.java
+++ b/plugins/org.eclipse.osee.orcs/src/org/eclipse/osee/orcs/transaction/TransactionFactory.java
@@ -27,8 +27,6 @@ public interface TransactionFactory {
TransactionBuilder createTransaction(BranchId branch, ArtifactId userArtifact, String comment) throws OseeCoreException;
- TransactionBuilder createTransaction(Long branchId, ArtifactId userArtifact, String comment) throws OseeCoreException;
-
Callable<Integer> purgeTransaction(Collection<? extends TransactionId> transactions);
int[] purgeUnusedBackingDataAndTransactions();
@@ -43,7 +41,7 @@ public interface TransactionFactory {
boolean setTxComment(TransactionId txId, String comment);
- boolean replaceWithBaselineTxVersion(String userId, Long branchId, TransactionId txId, int artId, String comment);
+ boolean replaceWithBaselineTxVersion(String userId, BranchId branchId, TransactionId txId, int artId, String comment);
boolean purgeTxs(String txIds);
} \ No newline at end of file

Back to the top