diff options
author | Ryan D. Brooks | 2015-10-08 23:48:50 +0000 |
---|---|---|
committer | Ryan D. Brooks | 2020-12-15 22:28:24 +0000 |
commit | 81920feadc87c7408e28f685afbd2ece9c20c499 (patch) | |
tree | 2af837642888a5ae2398c384bb594bd020f968f6 | |
parent | 517047c0ca267440b393fab70978a29326ab5af6 (diff) | |
download | org.eclipse.osee-81920feadc87c7408e28f685afbd2ece9c20c499.tar.gz org.eclipse.osee-81920feadc87c7408e28f685afbd2ece9c20c499.tar.xz org.eclipse.osee-81920feadc87c7408e28f685afbd2ece9c20c499.zip |
refactor: Use authorId directly
Change-Id: I779ed9a2d2bce0dd54ab8e3dd6d5dec2efe90d25
4 files changed, 26 insertions, 8 deletions
diff --git a/plugins/org.eclipse.osee.orcs.core.test/src/org/eclipse/osee/orcs/core/internal/transaction/TransactionFactoryImplTest.java b/plugins/org.eclipse.osee.orcs.core.test/src/org/eclipse/osee/orcs/core/internal/transaction/TransactionFactoryImplTest.java index 81a0a5904b0..da39a59becd 100644 --- a/plugins/org.eclipse.osee.orcs.core.test/src/org/eclipse/osee/orcs/core/internal/transaction/TransactionFactoryImplTest.java +++ b/plugins/org.eclipse.osee.orcs.core.test/src/org/eclipse/osee/orcs/core/internal/transaction/TransactionFactoryImplTest.java @@ -59,6 +59,8 @@ public class TransactionFactoryImplTest { @Mock private TxData txData; @Mock private QueryFactory queryFactory; @Mock private BranchQuery branchQuery; + + private final Long author = 2L; // @formatter:on private final BranchId expectedBranch = CoreBranches.COMMON; @@ -73,13 +75,14 @@ public class TransactionFactoryImplTest { when(branchQuery.exists()).thenReturn(true); factory = new TransactionFactoryImpl(session, txDataManager, txCallableFactory, orcsApi, orcsBranch, keyValueOps, txDataStore); + when(expectedAuthor.getLocalId()).thenReturn(5L); } @Test public void testNullAuthor() { thrown.expect(OseeArgumentException.class); thrown.expectMessage("author cannot be null"); - factory.createTransaction(expectedBranch, null, "my comment"); + factory.createTransaction(expectedBranch, (Long) null, "my comment"); } @Test @@ -101,7 +104,7 @@ public class TransactionFactoryImplTest { String expectedComment = "This is my comment"; when(txDataManager.createTxData(session, expectedBranch)).thenReturn(txData); - when(txData.getAuthor()).thenReturn(expectedAuthor); + when(txData.getAuthor()).thenReturn(author); when(txData.getBranch()).thenReturn(expectedBranch); when(txData.getComment()).thenReturn(expectedComment); diff --git a/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/proxy/impl/ArtifactReadOnlyImpl.java b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/proxy/impl/ArtifactReadOnlyImpl.java index 3ba1546ab30..c96604333bb 100644 --- a/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/proxy/impl/ArtifactReadOnlyImpl.java +++ b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/proxy/impl/ArtifactReadOnlyImpl.java @@ -53,7 +53,7 @@ import org.eclipse.osee.orcs.data.AttributeReadable; /** * @author Megumi Telles */ -public class ArtifactReadOnlyImpl extends AbstractProxied<Artifact> implements ArtifactReadable { +public class ArtifactReadOnlyImpl extends AbstractProxied<Artifact>implements ArtifactReadable { private final RelationManager relationManager; private final ArtifactTypeToken artifactType; 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 6d225c45eca..19b1fbb8673 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 @@ -95,6 +95,21 @@ public class TransactionFactoryImpl implements TransactionFactory { } @Override + public TransactionBuilder createTransaction(BranchId branch, ArtifactReadable author, String comment) throws OseeCoreException { + return createTransaction(branch, author.getLocalId(), comment); + } + + @Override + public TransactionBuilder createTransaction(Long branchId, ArtifactReadable author, String comment) throws OseeCoreException { + return createTransaction(branchId, author.getLocalId(), comment); + } + + @Override + public TransactionBuilder createTransaction(Long branchId, Long author, String comment) throws OseeCoreException { + return createTransaction(TokenFactory.createBranch(branchId, ""), author, comment); + } + + @Override public Callable<Void> setTransactionComment(TransactionId transaction, String comment) { return txCallableFactory.setTransactionComment(session, transaction, comment); } diff --git a/plugins/org.eclipse.osee.orcs.rest.model/src/org/eclipse/osee/orcs/rest/model/NewTransaction.java b/plugins/org.eclipse.osee.orcs.rest.model/src/org/eclipse/osee/orcs/rest/model/NewTransaction.java index 230df71b203..a36a9c9931d 100644 --- a/plugins/org.eclipse.osee.orcs.rest.model/src/org/eclipse/osee/orcs/rest/model/NewTransaction.java +++ b/plugins/org.eclipse.osee.orcs.rest.model/src/org/eclipse/osee/orcs/rest/model/NewTransaction.java @@ -22,22 +22,22 @@ import javax.xml.bind.annotation.XmlRootElement; public class NewTransaction { private String comment; - private String authorId; + private String author; public String getComment() { return comment; } - public String getAuthorId() { - return authorId; + public String getAuthor() { + return author; } public void setComment(String comment) { this.comment = comment; } - public void setAuthorId(String authorId) { - this.authorId = authorId; + public void setAuthor(String author) { + this.author = author; } } |