default void archive(SchemaVersionLifecycleContext schemaVersionLifecycleContext) throws SchemaLifecycleException, SchemaNotFoundException { throw new SchemaLifecycleException(" This operation is not supported for this instance: " + this); }
default void startReview(SchemaVersionLifecycleContext schemaVersionLifecycleContext) throws SchemaLifecycleException, SchemaNotFoundException { throw new SchemaLifecycleException(" This operation is not supported for this instance: " + this); }
default void enable(SchemaVersionLifecycleContext schemaVersionLifecycleContext) throws SchemaLifecycleException, IncompatibleSchemaException, SchemaNotFoundException, SchemaBranchNotFoundException { throw new SchemaLifecycleException(" This operation is not supported for this instance: " + this); }
default void disable(SchemaVersionLifecycleContext schemaVersionLifecycleContext) throws SchemaLifecycleException, SchemaNotFoundException { throw new SchemaLifecycleException(" This operation is not supported for this instance: " + this); }
default void delete(SchemaVersionLifecycleContext schemaVersionLifecycleContext) throws SchemaLifecycleException, SchemaNotFoundException { throw new SchemaLifecycleException(" This operation is not supported for this instance: " + this); }
default void enable(SchemaVersionLifecycleContext schemaVersionLifecycleContext) throws SchemaLifecycleException, IncompatibleSchemaException, SchemaNotFoundException, SchemaBranchNotFoundException { throw new SchemaLifecycleException(" This operation is not supported for this instance: " + this); }
default void archive(SchemaVersionLifecycleContext schemaVersionLifecycleContext) throws SchemaLifecycleException, SchemaNotFoundException { throw new SchemaLifecycleException(" This operation is not supported for this instance: " + this); }
default void delete(SchemaVersionLifecycleContext schemaVersionLifecycleContext) throws SchemaLifecycleException, SchemaNotFoundException { throw new SchemaLifecycleException(" This operation is not supported for this instance: " + this); }
default void startReview(SchemaVersionLifecycleContext schemaVersionLifecycleContext) throws SchemaLifecycleException, SchemaNotFoundException { throw new SchemaLifecycleException(" This operation is not supported for this instance: " + this); }
private void handleDeleteSchemaResponse(Response response) throws SchemaNotFoundException, SchemaLifecycleException { String msg = response.readEntity(String.class); switch (Response.Status.fromStatusCode(response.getStatus())) { case NOT_FOUND: throw new SchemaNotFoundException(msg); case BAD_REQUEST: throw new SchemaLifecycleException(msg); case INTERNAL_SERVER_ERROR: throw new RuntimeException(msg); } }
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> 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> createDeleteTransitionActionPair( Byte sourceStateId) { return Pair.of(new SchemaVersionLifecycleStateTransition(sourceStateId, DELETED.getId(), "Delete", "Deletes the schema version"), context -> { try { transitionToDeleteState(context); } catch (SchemaNotFoundException 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); } }); }
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); } }); }
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 void transitionToState(SchemaVersionLifecycleContext context, SchemaVersionLifecycleState targetState) throws SchemaLifecycleException { if (context.getDetails() == null || context.getDetails().length == 0) throw new RuntimeException("This state transition should not be triggered through UI"); context.setState(targetState); try { context.updateSchemaVersionState(); } catch (SchemaNotFoundException e) { throw new SchemaLifecycleException(e); } }
private InReviewState(final SchemaVersionLifecycleState targetState) { super("InReview", (byte) 32, "Finish the schema version." ); SchemaVersionLifecycleStateTransition stateTransition = new SchemaVersionLifecycleStateTransition(getId(), targetState.getId(), "FinishReview", "Finish schema review process"); SchemaVersionLifecycleStateAction stateAction = context -> { context.setState(targetState); try { context.updateSchemaVersionState(); } catch (SchemaNotFoundException e) { throw new SchemaLifecycleException(e); } }; transitionActionPair = Collections.singletonList(Pair.of(stateTransition, stateAction)); }