@Override public void changeModuleStatus(String moduleId, String ownerId, String entityId, String action) throws InvalidDataException { // valueOf will throw IllegalArgumentException if the value doesn't belong in enum, // however the use of the contains, allows for overwriting getSupportedActions to narrow down // the list of available actions for this particular implementation if (action == null || !getSupportedActions().contains(ModuleAction.valueOf(action.toUpperCase()))) { throw new InvalidDataException("unknown action: " + action); } EntityModuleStatus moduleStatus = null; if (ModuleAction.SUBMIT.toString().equals(action.toUpperCase())) { if (isSubmittable(moduleId, ownerId)) { moduleStatus = EntityModuleStatus.SUBMITTED; } else { throw new InvalidDataException( "Cannot submit the module because it is not in submittable state"); } } moduleManager.updateEntityModuleStatus(ownerId, moduleId, entityId, moduleStatus.toString()); }