private void makeChanges7(TeamWorkFlowArtifact teamArt) throws OseeCoreException { SkynetTransaction transaction = TransactionManager.createTransaction(AtsUtil.getAtsBranch(), "Remote Event Test"); TransitionHelper helper = new TransitionHelper( "Remote Event Test", Arrays.asList(teamArt), TeamState.Analyze.getName(), Collections.singleton(AtsClientService.get().getUserAdmin().getCurrentUser()), null, TransitionOption.None); TransitionManager transitionMgr = new TransitionManager(helper, transaction); TransitionResults results = transitionMgr.handleAll(); if (!results.isEmpty()) { throw new OseeStateException(results.toString()); } transaction.execute(); }
/** * Create a new decision review configured and transitioned to handle action validation * * @param force will force the creation of the review without checking that a review should be * created */ public static DecisionReviewArtifact createValidateReview( TeamWorkFlowArtifact teamArt, boolean force, Date createdDate, IAtsUser createdBy, SkynetTransaction transaction) throws OseeCoreException { // If not validate page, don't do anything if (!force && !isValidatePage(teamArt.getStateDefinition())) { return null; } // If validate review already created for this state, return if (!force && ReviewManager.getReviewsFromCurrentState(teamArt).size() > 0) { for (AbstractReviewArtifact rev : ReviewManager.getReviewsFromCurrentState(teamArt)) { if (rev.getName().equals(VALIDATE_REVIEW_TITLE)) { return null; } } } // Create validate review try { DecisionReviewArtifact decRev = DecisionReviewManager.createNewDecisionReview( teamArt, isValidateReviewBlocking(teamArt.getStateDefinition()) ? ReviewBlockType.Transition : ReviewBlockType.None, true, createdDate, createdBy); decRev.setName(VALIDATE_REVIEW_TITLE); decRev.setSoleAttributeValue( AtsAttributeTypes.DecisionReviewOptions, "No;Followup;" + getValidateReviewFollowupUsersStr(teamArt) + "\n" + "Yes;Completed;"); TransitionHelper helper = new TransitionHelper( "Transition to Decision", Arrays.asList(decRev), DecisionReviewState.Decision.getName(), Arrays.asList(teamArt.getCreatedBy()), null, TransitionOption.None); TransitionManager transitionMgr = new TransitionManager(helper, transaction); TransitionResults results = transitionMgr.handleAll(); if (!results.isEmpty()) { OseeLog.logf( Activator.class, OseeLevel.SEVERE_POPUP, "Error transitioning Decision review [%s] to Decision %s", decRev.toStringWithId(), results); } return decRev; } catch (Exception ex) { OseeLog.log(Activator.class, OseeLevel.SEVERE_POPUP, ex); } return null; }