private static void transitionToStartReview(SchemaVersionLifecycleContext context) throws SchemaLifecycleException, SchemaNotFoundException { context.setState(START_REVIEW); // execute start review process, updation of the state should be done by schemaReviewExecutor context.getCustomSchemaStateExecutor().executeReviewState(context); }
private static void transitionToDeleteState(SchemaVersionLifecycleContext context) throws SchemaLifecycleException, SchemaNotFoundException { context.setState(DELETED); context.updateSchemaVersionState(); context.getSchemaVersionService().deleteSchemaVersion(context.getSchemaVersionId()); }
@Override public void executeReviewState(SchemaVersionLifecycleContext schemaVersionLifecycleContext) throws SchemaLifecycleException, SchemaNotFoundException { schemaVersionLifecycleContext.setState(inReviewState); schemaVersionLifecycleContext.updateSchemaVersionState(); }
private static Pair<SchemaVersionLifecycleStateTransition, SchemaVersionLifecycleStateAction> createStartReviewTransitionActionPair(Byte sourceStateId) { return Pair.of(new SchemaVersionLifecycleStateTransition(sourceStateId, START_REVIEW.getId(), "StartReview", "Starts review state"), context -> { try { transitionToStartReview(context); } catch (SchemaNotFoundException e) { throw new SchemaLifecycleException(e); } }); }
private static Pair<SchemaVersionLifecycleStateTransition, SchemaVersionLifecycleStateAction> createArchiveTransitionAction(Byte sourceStateId) { return Pair.of(new SchemaVersionLifecycleStateTransition(sourceStateId, ARCHIVED.getId(), "Archive", "Archives the schema version"), context -> { try { transitionToArchiveState(context); } catch (SchemaNotFoundException e) { throw new SchemaLifecycleException(e); } }); }
private static Pair<SchemaVersionLifecycleStateTransition, SchemaVersionLifecycleStateAction> createEnableTransitionAction(Byte sourceStateId) { return Pair.of(new SchemaVersionLifecycleStateTransition(sourceStateId, ENABLED.getId(), "Enable", "Enables the schema version"), context -> { try { transitionToEnableState(context); } catch (SchemaNotFoundException | IncompatibleSchemaException | SchemaBranchNotFoundException e) { throw new SchemaLifecycleException(e); } }); }
private static Pair<SchemaVersionLifecycleStateTransition, SchemaVersionLifecycleStateAction> createDisableAction(Byte sourceStateId) { return Pair.of(new SchemaVersionLifecycleStateTransition(sourceStateId, DISABLED.getId(), "Disable", "Disables the schema version"), context -> { try { transitionToDisableState(context); } catch (SchemaNotFoundException e) { throw new SchemaLifecycleException(e); } }); }
public SchemaVersion(String schemaText, String description, Byte initialState, byte [] stateDetails) { this.description = description; this.schemaText = schemaText; this.initialState = initialState != null ? initialState : SchemaVersionLifecycleStates.ENABLED.getId(); this.stateDetails = stateDetails; }
public SchemaVersionLifecycleStatePojo(SchemaVersionLifecycleState schemaVersionLifecycleState) { this.id = schemaVersionLifecycleState.getId(); this.name = schemaVersionLifecycleState.getName(); this.description = schemaVersionLifecycleState.getDescription(); }
@Override public String toString() { return "InitiatedState{" + super.toString() + "}"; } }
@Override public void enable(SchemaVersionLifecycleContext context) throws SchemaLifecycleException, IncompatibleSchemaException, SchemaNotFoundException, SchemaBranchNotFoundException { transitionToEnableState(context); }
/** * Updates the current context into the schema version state storage. * * @throws SchemaLifecycleException when any error occurs while updating the state. * @throws SchemaNotFoundException when there is no schema/version found with the given {@code schemaVersionId}. */ public void updateSchemaVersionState() throws SchemaLifecycleException, SchemaNotFoundException { schemaVersionService.updateSchemaVersionState(this); }
private static Pair<SchemaVersionLifecycleStateTransition, SchemaVersionLifecycleStateAction> createStartReviewTransitionActionPair(Byte sourceStateId) { return Pair.of(new SchemaVersionLifecycleStateTransition(sourceStateId, START_REVIEW.getId(), "StartReview", "Starts review state"), context -> { try { transitionToStartReview(context); } catch (SchemaNotFoundException e) { throw new SchemaLifecycleException(e); } }); }
private static void transitionToDeleteState(SchemaVersionLifecycleContext context) throws SchemaLifecycleException, SchemaNotFoundException { context.setState(DELETED); context.updateSchemaVersionState(); context.getSchemaVersionService().deleteSchemaVersion(context.getSchemaVersionId()); }
@Override public void executeReviewState(SchemaVersionLifecycleContext schemaVersionLifecycleContext) throws SchemaLifecycleException, SchemaNotFoundException { schemaVersionLifecycleContext.setState(CustomReviewCycleStates.PEER_REVIEW_STATE); schemaVersionLifecycleContext.updateSchemaVersionState(); } }
private static void transitionToStartReview(SchemaVersionLifecycleContext context) throws SchemaLifecycleException, SchemaNotFoundException { context.setState(START_REVIEW); // execute start review process, updation of the state should be done by schemaReviewExecutor context.getCustomSchemaStateExecutor().executeReviewState(context); }
public SchemaVersion(String schemaText, String description, Byte initialState, byte [] stateDetails) { this.description = description; this.schemaText = schemaText; this.initialState = initialState != null ? initialState : SchemaVersionLifecycleStates.ENABLED.getId(); this.stateDetails = stateDetails; }
@Override public String toString() { return "InitiatedState{" + super.toString() + "}"; } }
@Override public void enable(SchemaVersionLifecycleContext context) throws SchemaLifecycleException, IncompatibleSchemaException, SchemaNotFoundException, SchemaBranchNotFoundException { transitionToEnableState(context); }
@Override public String toString() { return "StartReviewState{" + super.toString() + "}"; }