@Test(expected = CompileException.class) public void testMissingCustomDataTypeDefinition() { List<String> defStrings = new ArrayList<>(); defStrings.add(loadFile("missingCustomDataTypeDefinition.wid")); WorkDefinitionsParser.parse(defStrings); }
@SuppressWarnings({"unchecked", "rawtypes"}) public static Map<String, WorkDefinition> parse(final List<String> workItemDefinitions) { final Map<String, WorkDefinition> workDefinitions = new HashMap<String, WorkDefinition>(); final ParserContext context = new ParserContext(); for (String workItemDefinition : workItemDefinitions) { final List<Map<String, Object>> workDefinitionsMap = (List<Map<String, Object>>) WidMVELEvaluator.eval(workItemDefinition); if (workDefinitionsMap != null) { for (Map<String, Object> workDefinitionMap : workDefinitionsMap) { if (workDefinitionMap != null) { final WorkDefinitionImpl workDefinition = new WorkDefinitionImpl(); workDefinition.setName((String) workDefinitionMap.get("name")); workDefinition.setDisplayName((String) workDefinitionMap.get("displayName")); workDefinition.setIcon((String) workDefinitionMap.get("icon")); workDefinition.setCustomEditor((String) workDefinitionMap.get("customEditor")); final Set<ParameterDefinition> parameters = new HashSet<ParameterDefinition>(); if (workDefinitionMap.get("parameters") != null) { final Map<String, DataType> parameterMap = (Map<String, DataType>) workDefinitionMap.get("parameters"); if (parameterMap != null) { for (Map.Entry<String, DataType> entry : parameterMap.entrySet()) { parameters.add(new ParameterDefinitionImpl(entry.getKey(), entry.getValue())); } } workDefinition.setParameters(parameters); } if (workDefinitionMap.get("parameterValues") != null) { workDefinition.setParameterValues((Map<String, Object>) workDefinitionMap.get("parameterValues")); } if (workDefinitionMap.get("results") != null) { final Set<ParameterDefinition> results = new HashSet<ParameterDefinition>(); final Map<String, DataType> resultMap = (Map<String, DataType>) workDefinitionMap.get("results"); if (resultMap != null) { for (Map.Entry<String, DataType> entry : resultMap.entrySet()) { results.add(new ParameterDefinitionImpl(entry.getKey(), entry.getValue())); } } workDefinition.setResults(results); } if (workDefinitionMap.get("defaultHandler") != null) { workDefinition.setDefaultHandler((String) workDefinitionMap.get("defaultHandler")); } if (workDefinitionMap.get("dependencies") != null) { workDefinition.setDependencies(((List<String>) workDefinitionMap.get("dependencies")).toArray(new String[0])); } if (workDefinitionMap.get("documentation") != null) { workDefinition.setDocumentation((String) workDefinitionMap.get("documentation")); } if (workDefinitionMap.get("version") != null) { workDefinition.setVersion((String) workDefinitionMap.get("version")); } if (workDefinitionMap.get("description") != null) { workDefinition.setDescription((String) workDefinitionMap.get("description")); } if (workDefinitionMap.get("mavenDependencies") != null) { workDefinition.setMavenDependencies(((List<String>) workDefinitionMap.get("mavenDependencies")).toArray(new String[0])); } workDefinitions.put(workDefinition.getName(), workDefinition); } } } } return workDefinitions; }
WorkDefinitionsParser { @SuppressWarnings({"unchecked", "rawtypes"}) public static Map<String, WorkDefinition> parse(final List<String> workItemDefinitions) { final Map<String, WorkDefinition> workDefinitions = new HashMap<String, WorkDefinition>(); final ParserContext context = new ParserContext(); for (String workItemDefinition : workItemDefinitions) { final List<Map<String, Object>> workDefinitionsMap = (List<Map<String, Object>>) WidMVELEvaluator.eval(workItemDefinition); if (workDefinitionsMap != null) { for (Map<String, Object> workDefinitionMap : workDefinitionsMap) { if (workDefinitionMap != null) { final WorkDefinitionImpl workDefinition = new WorkDefinitionImpl(); workDefinition.setName((String) workDefinitionMap.get("name")); workDefinition.setDisplayName((String) workDefinitionMap.get("displayName")); workDefinition.setIcon((String) workDefinitionMap.get("icon")); workDefinition.setCustomEditor((String) workDefinitionMap.get("customEditor")); final Set<ParameterDefinition> parameters = new HashSet<ParameterDefinition>(); if (workDefinitionMap.get("parameters") != null) { final Map<String, DataType> parameterMap = (Map<String, DataType>) workDefinitionMap.get("parameters"); if (parameterMap != null) { for (Map.Entry<String, DataType> entry : parameterMap.entrySet()) { parameters.add(new ParameterDefinitionImpl(entry.getKey(), entry.getValue())); } } workDefinition.setParameters(parameters); } if (workDefinitionMap.get("parameterValues") != null) { workDefinition.setParameterValues((Map<String, Object>) workDefinitionMap.get("parameterValues")); } if (workDefinitionMap.get("results") != null) { final Set<ParameterDefinition> results = new HashSet<ParameterDefinition>(); final Map<String, DataType> resultMap = (Map<String, DataType>) workDefinitionMap.get("results"); if (resultMap != null) { for (Map.Entry<String, DataType> entry : resultMap.entrySet()) { results.add(new ParameterDefinitionImpl(entry.getKey(), entry.getValue())); } } workDefinition.setResults(results); } if (workDefinitionMap.get("defaultHandler") != null) { workDefinition.setDefaultHandler((String) workDefinitionMap.get("defaultHandler")); } if (workDefinitionMap.get("dependencies") != null) { workDefinition.setDependencies(((List<String>) workDefinitionMap.get("dependencies")).toArray(new String[0])); } if (workDefinitionMap.get("documentation") != null) { workDefinition.setDocumentation((String) workDefinitionMap.get("documentation")); } if (workDefinitionMap.get("version") != null) { workDefinition.setVersion((String) workDefinitionMap.get("version")); } if (workDefinitionMap.get("description") != null) { workDefinition.setDescription((String) workDefinitionMap.get("description")); } if (workDefinitionMap.get("mavenDependencies") != null) { workDefinition.setMavenDependencies(((List<String>) workDefinitionMap.get("mavenDependencies")).toArray(new String[0])); } workDefinitions.put(workDefinition.getName(), workDefinition); } } } } return workDefinitions; } }
WorkDefinitionsParser { @SuppressWarnings({"unchecked", "rawtypes"}) public static Map<String, WorkDefinition> parse(final List<String> workItemDefinitions) { final Map<String, WorkDefinition> workDefinitions = new HashMap<String, WorkDefinition>(); final ParserContext context = new ParserContext(); for (String workItemDefinition : workItemDefinitions) { final List<Map<String, Object>> workDefinitionsMap = (List<Map<String, Object>>) WidMVELEvaluator.eval(workItemDefinition); if (workDefinitionsMap != null) { for (Map<String, Object> workDefinitionMap : workDefinitionsMap) { if (workDefinitionMap != null) { final WorkDefinitionImpl workDefinition = new WorkDefinitionImpl(); workDefinition.setName((String) workDefinitionMap.get("name")); workDefinition.setDisplayName((String) workDefinitionMap.get("displayName")); workDefinition.setIcon((String) workDefinitionMap.get("icon")); workDefinition.setCustomEditor((String) workDefinitionMap.get("customEditor")); final Set<ParameterDefinition> parameters = new HashSet<ParameterDefinition>(); if (workDefinitionMap.get("parameters") != null) { final Map<String, DataType> parameterMap = (Map<String, DataType>) workDefinitionMap.get("parameters"); if (parameterMap != null) { for (Map.Entry<String, DataType> entry : parameterMap.entrySet()) { parameters.add(new ParameterDefinitionImpl(entry.getKey(), entry.getValue())); } } workDefinition.setParameters(parameters); } if (workDefinitionMap.get("parameterValues") != null) { workDefinition.setParameterValues((Map<String, Object>) workDefinitionMap.get("parameterValues")); } if (workDefinitionMap.get("results") != null) { final Set<ParameterDefinition> results = new HashSet<ParameterDefinition>(); final Map<String, DataType> resultMap = (Map<String, DataType>) workDefinitionMap.get("results"); if (resultMap != null) { for (Map.Entry<String, DataType> entry : resultMap.entrySet()) { results.add(new ParameterDefinitionImpl(entry.getKey(), entry.getValue())); } } workDefinition.setResults(results); } if (workDefinitionMap.get("defaultHandler") != null) { workDefinition.setDefaultHandler((String) workDefinitionMap.get("defaultHandler")); } if (workDefinitionMap.get("dependencies") != null) { workDefinition.setDependencies(((List<String>) workDefinitionMap.get("dependencies")).toArray(new String[0])); } if (workDefinitionMap.get("documentation") != null) { workDefinition.setDocumentation((String) workDefinitionMap.get("documentation")); } if (workDefinitionMap.get("version") != null) { workDefinition.setVersion((String) workDefinitionMap.get("version")); } if (workDefinitionMap.get("description") != null) { workDefinition.setDescription((String) workDefinitionMap.get("description")); } if (workDefinitionMap.get("mavenDependencies") != null) { workDefinition.setMavenDependencies(((List<String>) workDefinitionMap.get("mavenDependencies")).toArray(new String[0])); } workDefinitions.put(workDefinition.getName(), workDefinition); } } } } return workDefinitions; }  }
WorkDefinitionsParser { @SuppressWarnings({"unchecked", "rawtypes"}) public static Map<String, WorkDefinition> parse(final List<String> workItemDefinitions) { final Map<String, WorkDefinition> workDefinitions = new HashMap<String, WorkDefinition>(); final ParserContext context = new ParserContext(); for (String workItemDefinition : workItemDefinitions) { final List<Map<String, Object>> workDefinitionsMap = (List<Map<String, Object>>) WidMVELEvaluator.eval(workItemDefinition); if (workDefinitionsMap != null) { for (Map<String, Object> workDefinitionMap : workDefinitionsMap) { if (workDefinitionMap != null) { final WorkDefinitionImpl workDefinition = new WorkDefinitionImpl(); workDefinition.setName((String) workDefinitionMap.get("name")); workDefinition.setDisplayName((String) workDefinitionMap.get("displayName")); workDefinition.setIcon((String) workDefinitionMap.get("icon")); workDefinition.setCustomEditor((String) workDefinitionMap.get("customEditor")); final Set<ParameterDefinition> parameters = new HashSet<ParameterDefinition>(); if (workDefinitionMap.get("parameters") != null) { final Map<String, DataType> parameterMap = (Map<String, DataType>) workDefinitionMap.get("parameters"); if (parameterMap != null) { for (Map.Entry<String, DataType> entry : parameterMap.entrySet()) { parameters.add(new ParameterDefinitionImpl(entry.getKey(), entry.getValue())); } } workDefinition.setParameters(parameters); } if (workDefinitionMap.get("parameterValues") != null) { workDefinition.setParameterValues((Map<String, Object>) workDefinitionMap.get("parameterValues")); } if (workDefinitionMap.get("results") != null) { final Set<ParameterDefinition> results = new HashSet<ParameterDefinition>(); final Map<String, DataType> resultMap = (Map<String, DataType>) workDefinitionMap.get("results"); if (resultMap != null) { for (Map.Entry<String, DataType> entry : resultMap.entrySet()) { results.add(new ParameterDefinitionImpl(entry.getKey(), entry.getValue())); } } workDefinition.setResults(results); } if (workDefinitionMap.get("defaultHandler") != null) { workDefinition.setDefaultHandler((String) workDefinitionMap.get("defaultHandler")); } if (workDefinitionMap.get("dependencies") != null) { workDefinition.setDependencies(((List<String>) workDefinitionMap.get("dependencies")).toArray(new String[0])); } if (workDefinitionMap.get("documentation") != null) { workDefinition.setDocumentation((String) workDefinitionMap.get("documentation")); } if (workDefinitionMap.get("version") != null) { workDefinition.setVersion((String) workDefinitionMap.get("version")); } if (workDefinitionMap.get("description") != null) { workDefinition.setDescription((String) workDefinitionMap.get("description")); } if (workDefinitionMap.get("mavenDependencies") != null) { workDefinition.setMavenDependencies(((List<String>) workDefinitionMap.get("mavenDependencies")).toArray(new String[0])); } workDefinitions.put(workDefinition.getName(), workDefinition); } } } } return workDefinitions; }  @SuppressWarnings({"unchecked", "rawtypes"}) static Map<String, WorkDefinition> parse(final List<String> workItemDefinitions); }
WorkDefinitionsParser { @SuppressWarnings({"unchecked", "rawtypes"}) public static Map<String, WorkDefinition> parse(final List<String> workItemDefinitions) { final Map<String, WorkDefinition> workDefinitions = new HashMap<String, WorkDefinition>(); final ParserContext context = new ParserContext(); for (String workItemDefinition : workItemDefinitions) { final List<Map<String, Object>> workDefinitionsMap = (List<Map<String, Object>>) WidMVELEvaluator.eval(workItemDefinition); if (workDefinitionsMap != null) { for (Map<String, Object> workDefinitionMap : workDefinitionsMap) { if (workDefinitionMap != null) { final WorkDefinitionImpl workDefinition = new WorkDefinitionImpl(); workDefinition.setName((String) workDefinitionMap.get("name")); workDefinition.setDisplayName((String) workDefinitionMap.get("displayName")); workDefinition.setIcon((String) workDefinitionMap.get("icon")); workDefinition.setCustomEditor((String) workDefinitionMap.get("customEditor")); final Set<ParameterDefinition> parameters = new HashSet<ParameterDefinition>(); if (workDefinitionMap.get("parameters") != null) { final Map<String, DataType> parameterMap = (Map<String, DataType>) workDefinitionMap.get("parameters"); if (parameterMap != null) { for (Map.Entry<String, DataType> entry : parameterMap.entrySet()) { parameters.add(new ParameterDefinitionImpl(entry.getKey(), entry.getValue())); } } workDefinition.setParameters(parameters); } if (workDefinitionMap.get("parameterValues") != null) { workDefinition.setParameterValues((Map<String, Object>) workDefinitionMap.get("parameterValues")); } if (workDefinitionMap.get("results") != null) { final Set<ParameterDefinition> results = new HashSet<ParameterDefinition>(); final Map<String, DataType> resultMap = (Map<String, DataType>) workDefinitionMap.get("results"); if (resultMap != null) { for (Map.Entry<String, DataType> entry : resultMap.entrySet()) { results.add(new ParameterDefinitionImpl(entry.getKey(), entry.getValue())); } } workDefinition.setResults(results); } if (workDefinitionMap.get("defaultHandler") != null) { workDefinition.setDefaultHandler((String) workDefinitionMap.get("defaultHandler")); } if (workDefinitionMap.get("dependencies") != null) { workDefinition.setDependencies(((List<String>) workDefinitionMap.get("dependencies")).toArray(new String[0])); } if (workDefinitionMap.get("documentation") != null) { workDefinition.setDocumentation((String) workDefinitionMap.get("documentation")); } if (workDefinitionMap.get("version") != null) { workDefinition.setVersion((String) workDefinitionMap.get("version")); } if (workDefinitionMap.get("description") != null) { workDefinition.setDescription((String) workDefinitionMap.get("description")); } if (workDefinitionMap.get("mavenDependencies") != null) { workDefinition.setMavenDependencies(((List<String>) workDefinitionMap.get("mavenDependencies")).toArray(new String[0])); } workDefinitions.put(workDefinition.getName(), workDefinition); } } } } return workDefinitions; }  @SuppressWarnings({"unchecked", "rawtypes"}) static Map<String, WorkDefinition> parse(final List<String> workItemDefinitions);  }