use of com.emc.storageos.model.customconfig.PreviewVariableParam in project coprhd-controller by CoprHD.
the class CustomConfigService method getCustomConfigPreviewValue.
/**
* Get a config preview value.
*
* @param param create parameters
* @brief Get config preview value
* @return preview value
*/
@POST
@Path("/preview")
@Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
@CheckPermission(roles = { Role.SYSTEM_ADMIN, Role.RESTRICTED_SYSTEM_ADMIN })
public CustomConfigPreviewRep getCustomConfigPreviewValue(CustomConfigPreviewParam param) {
String configType = param.getConfigType();
String theVal = param.getValue();
ArgValidator.checkFieldNotEmpty(configType, CONFIG_TYPE);
ArgValidator.checkFieldNotEmpty(theVal, VALUE);
ScopeParam scopeParm = param.getScope();
StringMap scope = null;
if (scopeParm != null) {
scope = new StringMap();
scope.put(scopeParm.getType(), scopeParm.getValue());
}
List<PreviewVariableParam> variables = param.getPreviewVariables();
Map<String, String> variableValues = null;
if (variables != null && !variables.isEmpty()) {
variableValues = new HashMap<String, String>();
for (PreviewVariableParam variable : variables) {
variableValues.put(variable.getVariableName(), variable.getValue());
}
}
String result = customConfigHandler.getCustomConfigPreviewValue(configType, theVal, scope, variableValues);
CustomConfigPreviewRep preview = new CustomConfigPreviewRep(result);
return preview;
}
Aggregations