class InputValidator {

    static public Status validateStatusAndCheckNotDeleted(
            String className,
            String actionDescription,
            String statusName) throws InvalidParameterException {
        Status newStatus = null;
        try {
            newStatus = Status.valueOf(statusName);
        } catch (Exception e) {
            ExceptionMessageDefinition messageDefinition = SubjectAreaErrorCode.INVALID_STATUS_VALUE_SUPPLIED.getMessageDefinition();
            String invalidPropertyName = "status";
            messageDefinition.setMessageParameters(invalidPropertyName, null);
            throw new InvalidParameterException(messageDefinition,
                                                className,
                                                actionDescription,
                                                invalidPropertyName,
                                                statusName);

        }
        if (Status.DELETED == newStatus) {

            ExceptionMessageDefinition messageDefinition = SubjectAreaErrorCode.STATUS_UPDATE_TO_DELETED_NOT_ALLOWED.getMessageDefinition();
            String invalidPropertyName = "status";
            messageDefinition.setMessageParameters(invalidPropertyName, null);
            throw new InvalidParameterException(messageDefinition,
                                                className,
                                                actionDescription,
                                                invalidPropertyName,
                                                statusName);

        }

        return newStatus;
    }

}