public static void checkAnnotations(Map<String, Variable> variableMap, Map<String, Object> annotations) throws CatalogException { for (Map.Entry<String, Object> entry : annotations.entrySet()) { String id = entry.getKey(); if (!variableMap.containsKey(id)) { throw new CatalogException("Annotation id '" + id + "' is not an accepted id"); } else { Variable variable = variableMap.get(id); annotations.put(id, getValue(variable.getType(), entry.getValue())); checkAllowedValue(variable, entry.getValue(), "Annotation"); } } }
Variable.VariableType variableType = variable.getType(); if (variable.getType() == Variable.VariableType.OBJECT) { String[] routes = route.split("\\."); for (String r : routes) { if (variable.getType() != Variable.VariableType.OBJECT) { throw new CatalogDBException("Unable to query variable " + split[0]); if (subVariableMap.containsKey(r)) { variable = subVariableMap.get(r); variableType = variable.getType();
throw new CatalogDBException("Variable \"" + variableId + "\" not found in variableSet "); Variable.VariableType variableType = variable.getType(); if (variable.getType() == Variable.VariableType.OBJECT) { String[] routes = route.split("\\."); for (String r : routes) { if (variable.getType() != Variable.VariableType.OBJECT) { throw new CatalogDBException("Unable to query variable " + annotationKey); if (subVariableMap.containsKey(r)) { variable = subVariableMap.get(r); variableType = variable.getType();
Variable variable = variableDepthMap.getVariable(); if (variable.getType() == Variable.VariableType.OBJECT) { if (variable.getVariableSet() != null) { switch (variable.getType()) { case BOOLEAN: if (variable.isMultiValue()) { case OBJECT: default: throw new CatalogDBException("Unexpected variable type detected: " + variable.getType());
VariableLevel variableLevel = queue.remove(); switch (variableLevel.getVariable().getType()) { case BOOLEAN: case CATEGORICAL:
if (variable.getType() == null) { throw new CatalogException("VariableType is null"); if (variable.getVariableSet() != null && variable.getType() != Variable.VariableType.OBJECT) { throw new CatalogException("Only variables with type \"OBJECT\" can define an internal variableSet"); switch (variable.getType()) { case BOOLEAN: if (!variable.getAllowedValues().isEmpty()) { throw new CatalogException("Unknown VariableType " + variable.getType().name()); variable.setDefaultValue(getValue(variable.getType(), variable.getDefaultValue())); if (variable.getDefaultValue() != null) { checkAllowedValue(variable, variable.getDefaultValue(), "Default");
private static void checkAllowedValue(Variable variable, Object value, String message) throws CatalogException { Object realValue = getValue(variable.getType(), value); if (realValue == null) { if (variable.isRequired()) { switch (variable.getType()) { case BOOLEAN: break; throw new CatalogException("Unknown VariableType " + variable.getType().name());
switch (variable.getType()) { case BOOLEAN: auxVariableMap.put("type", isParentArray || variable.isMultiValue()
ParamUtils.checkObj(variable.getType(), "variable Type"); variable.setAllowedValues(ParamUtils.defaultObject(variable.getAllowedValues(), Collections.emptyList())); variable.setAttributes(ParamUtils.defaultObject(variable.getAttributes(), Collections.emptyMap()));