@Override public List<IOseeBranch> call() throws Exception { Collection<BranchReadable> branchesToPurge = getBranchesToPurge(); Conditions.checkNotNull(branchesToPurge, "branchesToPurge"); if (branchesToPurge.isEmpty()) { console.writeln("no branches matched specified criteria"); } else { List<BranchReadable> orderedBranches = BranchUtil.orderByParentReadable(queryFactory, branchesToPurge); for (IOseeBranch toPurge : orderedBranches) { console.writeln( "Branch [%s] guid [%s] will be purged!", toPurge.getName(), toPurge.getGuid()); } List<IOseeBranch> purged = new LinkedList<IOseeBranch>(); if (runPurge) { int size = orderedBranches.size(); int count = 0; for (IOseeBranch aBranch : orderedBranches) { console.writeln("Purging Branch [%s of %s]: [%s]", ++count, size, aBranch); Callable<List<IOseeBranch>> callable = orcsBranch.purgeBranch(aBranch, false); purged.addAll(callable.call()); } } return purged; } return null; }
private void updateDataForIntroduce(IOseeBranch destination, OrcsData data) throws OseeCoreException { VersionData version = data.getVersion(); version.setBranchId(destination.getUuid()); version.setHistorical(false); version.setTransactionId(RelationalConstants.TRANSACTION_SENTINEL); // do not clear gammaId for introduce case so we reuse the same version }
private void updateDataForCopy(IOseeBranch destination, OrcsData data) throws OseeCoreException { VersionData version = data.getVersion(); version.setBranchId(destination.getUuid()); version.setTransactionId(RelationalConstants.TRANSACTION_SENTINEL); version.setStripeId(RelationalConstants.TRANSACTION_SENTINEL); version.setHistorical(false); version.setGammaId(RelationalConstants.GAMMA_SENTINEL); data.setModType(ModificationType.NEW); }
@Before public void init() throws OseeCoreException { MockitoAnnotations.initMocks(this); txDataManager = new TxDataManager(proxyManager, artifactFactory, relationManager, loader); guid = GUID.create(); when(artifact1.getExistingAttributeTypes()).thenAnswer(answerValue(types)); when(proxyManager.asInternalArtifact(readable1)).thenReturn(artifact1); when(proxyManager.asExternalArtifact(session, artifact1)).thenReturn(readable1); when(branch.getUuid()).thenReturn(111L); when(provider.getBranch(111L)).thenReturn(branch); when(txData.getSession()).thenReturn(session); when(txData.getBranch()).thenReturn(branch); when(txData.getGraph()).thenReturn(graph); r1Guid = GUID.create(); r2Guid = GUID.create(); r3Guid = GUID.create(); when(artifactId1.getGuid()).thenReturn(r1Guid); when(artifactId2.getGuid()).thenReturn(r2Guid); when(artifactId3.getGuid()).thenReturn(r3Guid); when(readable1.getGuid()).thenReturn(r1Guid); when(readable2.getGuid()).thenReturn(r2Guid); when(readable3.getGuid()).thenReturn(r3Guid); when(readable1.getBranch()).thenReturn(branch); when(readable2.getBranch()).thenReturn(branch); when(readable3.getBranch()).thenReturn(branch); when(artifact1.getGuid()).thenReturn(r1Guid); when(artifact2.getGuid()).thenReturn(r2Guid); when(artifact3.getGuid()).thenReturn(r3Guid); when(artifact1.getBranch()).thenReturn(branch); when(artifact2.getBranch()).thenReturn(branch); when(artifact3.getBranch()).thenReturn(branch); }
@Override public RelationData createRelationData( IRelationType relationType, IOseeBranch branch, HasLocalId<Integer> aArt, HasLocalId<Integer> bArt, String rationale) throws OseeCoreException { VersionData version = objectFactory.createDefaultVersionData(); version.setBranchId(branch.getUuid()); ModificationType modType = RelationalConstants.DEFAULT_MODIFICATION_TYPE; Integer relationId = RelationalConstants.DEFAULT_ITEM_ID; return objectFactory.createRelationData( version, relationId, relationType, modType, aArt.getLocalId(), bArt.getLocalId(), rationale); }
@Override public ArtifactData create(IOseeBranch branch, IArtifactType token, String guid, long uuid) throws OseeCoreException { Conditions.checkNotNull(branch, "branch"); Conditions.checkExpressionFailOnTrue( artifactCache.isAbstract(token), "Cannot create an instance of abstract type [%s]", token); String guidToSet = idFactory.getUniqueGuid(guid); Conditions.checkExpressionFailOnTrue( !GUID.isValid(guidToSet), "Invalid guid [%s] during artifact creation [type: %s]", guidToSet, token); VersionData version = objectFactory.createDefaultVersionData(); version.setBranchId(branch.getUuid()); ModificationType modType = RelationalConstants.DEFAULT_MODIFICATION_TYPE; ArtifactData artifactData = objectFactory.createArtifactData(version, (int) uuid, token, modType, guidToSet); return artifactData; }
public static void storeAtsBranch(IOseeBranch branch, String name) { AtsPreferencesService.get().put(ATS_BRANCH_UUID, String.valueOf(branch.getUuid())); AtsPreferencesService.get().put(ATS_BRANCH_NAME, name); }