use of com.emc.storageos.db.client.model.CustomConfig in project coprhd-controller by CoprHD.
the class CustomConfigService method updateCustomConfig.
/**
* Modify a config.
*
* @param id URN of the config
* @param param create parameters
* @brief Modify config
* @return NamedRelatedResourceRep
*/
@PUT
@Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
@Path("/{id}")
@CheckPermission(roles = { Role.SYSTEM_ADMIN, Role.RESTRICTED_SYSTEM_ADMIN })
public CustomConfigRestRep updateCustomConfig(@PathParam("id") URI id, CustomConfigUpdateParam param) {
CustomConfig config = getCustomConfigById(id, true);
if (config.getSystemDefault()) {
// system default could not be modified
throw APIException.badRequests.systemDefaultConfigCouldNotBeModifiedOrDeactivated(config.getId());
}
customConfigHandler.validate(config.getConfigType(), config.getScope(), param.getValue(), false);
if (param.getValue() != null && !param.getValue().isEmpty()) {
config.setValue(param.getValue());
}
_dbClient.updateAndReindexObject(config);
auditOp(OperationTypeEnum.UPDATE_CONFIG, true, null, config.getId().toString(), config.getLabel(), config.getScope());
return DbObjectMapper.map(config);
}
use of com.emc.storageos.db.client.model.CustomConfig in project coprhd-controller by CoprHD.
the class CustomConfigService method getCustomConfigs.
/**
* List custom configurations.
*
* @brief List config names and ids
* @return A reference to a CustomConfigList.
*/
@GET
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
@CheckPermission(roles = { Role.SYSTEM_ADMIN, Role.SYSTEM_MONITOR })
public CustomConfigList getCustomConfigs() {
CustomConfigList configList = new CustomConfigList();
List<URI> ids = _dbClient.queryByType(CustomConfig.class, true);
Iterator<CustomConfig> iter = _dbClient.queryIterativeObjects(CustomConfig.class, ids);
while (iter.hasNext()) {
configList.getCustomConfigs().add(toNamedRelatedResource(iter.next()));
}
return configList;
}
use of com.emc.storageos.db.client.model.CustomConfig in project coprhd-controller by CoprHD.
the class IsilonCommunicationInterface method getCustomConfigPath.
private String getCustomConfigPath() {
String custompath = "";
URIQueryResultList results = new URIQueryResultList();
_dbClient.queryByConstraint(AlternateIdConstraint.Factory.getCustomConfigByConfigType(ISILON_PATH_CUSTOMIZATION), results);
Iterator<URI> iter = results.iterator();
List<CustomConfig> configList = new ArrayList<>();
while (iter.hasNext()) {
CustomConfig config = _dbClient.queryObject(CustomConfig.class, iter.next());
if (config != null && !config.getInactive()) {
configList.add(config);
_log.info("Getting custom Config {} ", config.getLabel());
}
}
// only 1 config value means only default
if (configList.size() == 1) {
custompath = configList.get(0).getValue();
_log.info("Selecting custom Config {} with value: {} ", configList.get(0).getLabel(), configList.get(0).getValue());
// More than 1 config means return the custom one, NOT the default one..
} else {
for (CustomConfig conf : configList) {
if (conf.getSystemDefault()) {
continue;
} else {
custompath = conf.getValue();
_log.info("Selecting custom Config {} with value: {} ", conf.getLabel(), conf.getValue());
}
}
}
return custompath;
}
Aggregations