private void registerInBuiltStates() { List<Pair<SchemaVersionLifecycleStateTransition, SchemaVersionLifecycleStateAction>> transitionActions = new ArrayList<>(); Field[] declaredFields = SchemaVersionLifecycleStates.class.getDeclaredFields(); for (Field field : declaredFields) { if (Modifier.isFinal(field.getModifiers()) && Modifier.isStatic(field.getModifiers()) && InbuiltSchemaVersionLifecycleState.class.isAssignableFrom(field.getType())) { InbuiltSchemaVersionLifecycleState state = null; try { state = (InbuiltSchemaVersionLifecycleState) field.get(null); } catch (IllegalAccessException e) { throw new RuntimeException(e); } register(state); transitionActions.addAll(state.getTransitionActions()); } } // register transitions for inbuilt states for (Pair<SchemaVersionLifecycleStateTransition, SchemaVersionLifecycleStateAction> transitionAction : transitionActions) { transition(transitionAction.getLeft(), transitionAction.getRight()); } }
private void registerInBuiltStates() { List<Pair<SchemaVersionLifecycleStateTransition, SchemaVersionLifecycleStateAction>> transitionActions = new ArrayList<>(); Field[] declaredFields = SchemaVersionLifecycleStates.class.getDeclaredFields(); for (Field field : declaredFields) { if (Modifier.isFinal(field.getModifiers()) && Modifier.isStatic(field.getModifiers()) && InbuiltSchemaVersionLifecycleState.class.isAssignableFrom(field.getType())) { InbuiltSchemaVersionLifecycleState state = null; try { state = (InbuiltSchemaVersionLifecycleState) field.get(null); } catch (IllegalAccessException e) { throw new RuntimeException(e); } register(state); transitionActions.addAll(state.getTransitionActions()); } } // register transitions for inbuilt states for (Pair<SchemaVersionLifecycleStateTransition, SchemaVersionLifecycleStateAction> transitionAction : transitionActions) { transition(transitionAction.getLeft(), transitionAction.getRight()); } }
@Override public void init(SchemaVersionLifecycleStateMachine.Builder builder, Byte successStateId, Byte retryStateId, Map<String, ?> props) { this.successState = builder.getStates().get(successStateId); this.retryState = builder.getStates().get(retryStateId); inReviewState = new InReviewState(successState); builder.register(inReviewState); for (Pair<SchemaVersionLifecycleStateTransition, SchemaVersionLifecycleStateAction> pair : inReviewState .getTransitionActions()) { builder.transition(pair.getLeft(), pair.getRight()); } }
@Override public void init(SchemaVersionLifecycleStateMachine.Builder builder, Byte successStateId, Byte retryStateId, Map<String, ?> props) { this.successState = builder.getStates().get(successStateId); this.retryState = builder.getStates().get(retryStateId); inReviewState = new InReviewState(successState); builder.register(inReviewState); for (Pair<SchemaVersionLifecycleStateTransition, SchemaVersionLifecycleStateAction> pair : inReviewState .getTransitionActions()) { builder.transition(pair.getLeft(), pair.getRight()); } }
public void registerPeerReviewState(SchemaVersionLifecycleStateMachine.Builder builder) { builder.register(CustomReviewCycleStates.PEER_REVIEW_STATE); }
public void registerRejectedState(SchemaVersionLifecycleStateMachine.Builder builder) { builder.register(CustomReviewCycleStates.REJECTED_REVIEW_STATE); builder.transition(new SchemaVersionLifecycleStateTransition(CustomReviewCycleStates.PEER_REVIEW_STATE.getId(), CustomReviewCycleStates.REJECTED_REVIEW_STATE.getId(), CustomReviewCycleStates.REJECTED_REVIEW_STATE.getName(), CustomReviewCycleStates.REJECTED_REVIEW_STATE.getDescription()), (SchemaVersionLifecycleContext context) -> { // Plugin a custom code to trigger as a part of the state transition, here we just record the state change in the database LOG.debug("Making a transition from 'PEER REVIEW' to 'REJECTED' state"); transitionToState(context, CustomReviewCycleStates.REJECTED_REVIEW_STATE); }); builder.transition(new SchemaVersionLifecycleStateTransition(CustomReviewCycleStates.TECHNICAL_LEAD_REVIEW_STATE.getId(), CustomReviewCycleStates.REJECTED_REVIEW_STATE.getId(), CustomReviewCycleStates.REJECTED_REVIEW_STATE.getName(), CustomReviewCycleStates.REJECTED_REVIEW_STATE.getDescription()), (SchemaVersionLifecycleContext context) -> { // Plugin a custom code to trigger as a part of the state transition, here we just record the state change in the database LOG.debug("Making a transition from 'TECHNICAL LEAD REVIEW' to 'REJECTED' state"); transitionToState(context, CustomReviewCycleStates.REJECTED_REVIEW_STATE); }); }
public void registerTechnicalLeadReviewState(SchemaVersionLifecycleStateMachine.Builder builder) { builder.register(CustomReviewCycleStates.TECHNICAL_LEAD_REVIEW_STATE); builder.transition(new SchemaVersionLifecycleStateTransition(CustomReviewCycleStates.PEER_REVIEW_STATE.getId(), CustomReviewCycleStates.TECHNICAL_LEAD_REVIEW_STATE.getId(), CustomReviewCycleStates.TECHNICAL_LEAD_REVIEW_STATE.getName(), CustomReviewCycleStates.TECHNICAL_LEAD_REVIEW_STATE.getDescription()), (SchemaVersionLifecycleContext context) -> { // Plugin a custom code to trigger as a part of the state transition, here we just record the state change in the database LOG.debug("Making a transition from 'PEER REVIEW' to 'TECHNICAL LEAD REVIEW' state"); transitionToState(context, CustomReviewCycleStates.TECHNICAL_LEAD_REVIEW_STATE); }); }