Search in sources :

Example 6 with ScopeParam

use of com.emc.storageos.model.customconfig.ScopeParam in project coprhd-controller by CoprHD.

the class CustomConfigs method update.

@FlashException
public static void update(String id, String configType, String scopeType, String scopeValue, String value) {
    CustomConfigRestRep customConfig = CustomConfigUtils.getCustomConfig(uri(id));
    ScopeParam scope = customConfig.getScope();
    try {
        if (!scope.getType().equals(scopeType) || !scope.getValue().equals(scopeValue)) {
            CustomConfigUtils.deleteCustomConfig(uri(id));
            CustomConfigUtils.createCustomConfig(configType, scopeType, scopeValue, value);
        } else {
            CustomConfigUtils.updateCustomConfig(uri(id), value);
        }
    } catch (ServiceErrorException ex) {
        flash.error(MessagesUtils.get("CustomConfigs.error.update", value, MessagesUtils.get("CustomConfigs.configType." + configType)));
    }
}
Also used : CustomConfigRestRep(com.emc.storageos.model.customconfig.CustomConfigRestRep) ConfigTypeScopeParam(com.emc.storageos.model.customconfig.ConfigTypeScopeParam) ScopeParam(com.emc.storageos.model.customconfig.ScopeParam) ServiceErrorException(com.emc.vipr.client.exceptions.ServiceErrorException) FlashException(controllers.util.FlashException)

Aggregations

ScopeParam (com.emc.storageos.model.customconfig.ScopeParam)6 StringMap (com.emc.storageos.db.client.model.StringMap)3 ConfigTypeScopeParam (com.emc.storageos.model.customconfig.ConfigTypeScopeParam)3 CustomConfigRestRep (com.emc.storageos.model.customconfig.CustomConfigRestRep)2 CheckPermission (com.emc.storageos.security.authorization.CheckPermission)2 Consumes (javax.ws.rs.Consumes)2 POST (javax.ws.rs.POST)2 Produces (javax.ws.rs.Produces)2 MapCustomConfig (com.emc.storageos.api.mapper.functions.MapCustomConfig)1 CustomConfig (com.emc.storageos.db.client.model.CustomConfig)1 NamedURI (com.emc.storageos.db.client.model.NamedURI)1 RestLinkRep (com.emc.storageos.model.RestLinkRep)1 CustomConfigCreateParam (com.emc.storageos.model.customconfig.CustomConfigCreateParam)1 CustomConfigPreviewParam (com.emc.storageos.model.customconfig.CustomConfigPreviewParam)1 CustomConfigPreviewRep (com.emc.storageos.model.customconfig.CustomConfigPreviewRep)1 PreviewVariableParam (com.emc.storageos.model.customconfig.PreviewVariableParam)1 RelatedConfigTypeRep (com.emc.storageos.model.customconfig.RelatedConfigTypeRep)1 ServiceErrorException (com.emc.vipr.client.exceptions.ServiceErrorException)1 FlashException (controllers.util.FlashException)1 URI (java.net.URI)1