@Test public void testValidateNodeType() throws InvalidParameterException { NodeType nodetype = NodeType.Glossary; validateNodeTypeforGlossary(NodeType.Glossary); validateNodeTypeforGlossary(NodeType.Taxonomy); validateNodeTypeforGlossary(NodeType.TaxonomyAndCanonicalGlossary); validateNodeTypeforGlossary(NodeType.CanonicalGlossary); validateNodeTypeforGlossary(null); try { validateNodeTypeforGlossary(NodeType.Term); assertFalse(false, "Error incorrect nodetype accepted"); } catch (InvalidParameterException e) { } }
public static void validateNodeType(Object... args) throws InvalidParameterException { if (args.length < 4) return; boolean isValid = false; String className = (String) args[0]; String actionDescription = (String) args[1]; NodeType nodeTypeToCheck = (NodeType) args[2]; if (nodeTypeToCheck != null) { for (int i = 3; i < args.length; i++) { if (nodeTypeToCheck.equals(args[i])) { isValid = true; } } if (!isValid) { ExceptionMessageDefinition messageDefinition = SubjectAreaErrorCode.INVALID_NODETYPE.getMessageDefinition(); String invalidPropertyName = "nodeType"; messageDefinition.setMessageParameters(invalidPropertyName, null); throw new InvalidParameterException(messageDefinition, className, actionDescription, invalidPropertyName, nodeTypeToCheck.name()); } } }
InputValidator { public static void validateNodeType(Object... args) throws InvalidParameterException { if (args.length < 4) return; boolean isValid = false; String className = (String) args[0]; String actionDescription = (String) args[1]; NodeType nodeTypeToCheck = (NodeType) args[2]; if (nodeTypeToCheck != null) { for (int i = 3; i < args.length; i++) { if (nodeTypeToCheck.equals(args[i])) { isValid = true; } } if (!isValid) { ExceptionMessageDefinition messageDefinition = SubjectAreaErrorCode.INVALID_NODETYPE.getMessageDefinition(); String invalidPropertyName = "nodeType"; messageDefinition.setMessageParameters(invalidPropertyName, null); throw new InvalidParameterException(messageDefinition, className, actionDescription, invalidPropertyName, nodeTypeToCheck.name()); } } } }
InputValidator { public static void validateNodeType(Object... args) throws InvalidParameterException { if (args.length < 4) return; boolean isValid = false; String className = (String) args[0]; String actionDescription = (String) args[1]; NodeType nodeTypeToCheck = (NodeType) args[2]; if (nodeTypeToCheck != null) { for (int i = 3; i < args.length; i++) { if (nodeTypeToCheck.equals(args[i])) { isValid = true; } } if (!isValid) { ExceptionMessageDefinition messageDefinition = SubjectAreaErrorCode.INVALID_NODETYPE.getMessageDefinition(); String invalidPropertyName = "nodeType"; messageDefinition.setMessageParameters(invalidPropertyName, null); throw new InvalidParameterException(messageDefinition, className, actionDescription, invalidPropertyName, nodeTypeToCheck.name()); } } }  }
InputValidator { public static void validateNodeType(Object... args) throws InvalidParameterException { if (args.length < 4) return; boolean isValid = false; String className = (String) args[0]; String actionDescription = (String) args[1]; NodeType nodeTypeToCheck = (NodeType) args[2]; if (nodeTypeToCheck != null) { for (int i = 3; i < args.length; i++) { if (nodeTypeToCheck.equals(args[i])) { isValid = true; } } if (!isValid) { ExceptionMessageDefinition messageDefinition = SubjectAreaErrorCode.INVALID_NODETYPE.getMessageDefinition(); String invalidPropertyName = "nodeType"; messageDefinition.setMessageParameters(invalidPropertyName, null); throw new InvalidParameterException(messageDefinition, className, actionDescription, invalidPropertyName, nodeTypeToCheck.name()); } } }  static void validateRemoteServerURLNotNull(String className, String actionDescription, String omasServerURL); static void validateRemoteServerNameNotNull(String className, String actionDescription, String omasServerName); static void validateUserIdNotNull(
            String className,
            String actionDescription,
            String userId); static Status validateStatusAndCheckNotDeleted(
            String className,
            String actionDescription,
            String statusName); static void validateGUIDNotNull(
            String className,
            String actionDescription,
            String guid,
            String guidParameter); static void validateNameNotNull(String className,
                                           String actionDescription,
                                           String name,
                                           String nameParameter
                                          ); static void validateNodeType(Object... args); }
InputValidator { public static void validateNodeType(Object... args) throws InvalidParameterException { if (args.length < 4) return; boolean isValid = false; String className = (String) args[0]; String actionDescription = (String) args[1]; NodeType nodeTypeToCheck = (NodeType) args[2]; if (nodeTypeToCheck != null) { for (int i = 3; i < args.length; i++) { if (nodeTypeToCheck.equals(args[i])) { isValid = true; } } if (!isValid) { ExceptionMessageDefinition messageDefinition = SubjectAreaErrorCode.INVALID_NODETYPE.getMessageDefinition(); String invalidPropertyName = "nodeType"; messageDefinition.setMessageParameters(invalidPropertyName, null); throw new InvalidParameterException(messageDefinition, className, actionDescription, invalidPropertyName, nodeTypeToCheck.name()); } } }  static void validateRemoteServerURLNotNull(String className, String actionDescription, String omasServerURL); static void validateRemoteServerNameNotNull(String className, String actionDescription, String omasServerName); static void validateUserIdNotNull(
            String className,
            String actionDescription,
            String userId); static Status validateStatusAndCheckNotDeleted(
            String className,
            String actionDescription,
            String statusName); static void validateGUIDNotNull(
            String className,
            String actionDescription,
            String guid,
            String guidParameter); static void validateNameNotNull(String className,
                                           String actionDescription,
                                           String name,
                                           String nameParameter
                                          ); static void validateNodeType(Object... args);  }