Search in sources :

Example 16 with PropertyMetadata

use of com.emc.storageos.model.property.PropertyMetadata in project coprhd-controller by CoprHD.

the class DefaultUpdateHandler method isPropertyChanged.

/**
 * check if the value of specified property get changed.
 *
 * @param oldProps
 * @param newProps
 * @param property
 * @return
 */
public boolean isPropertyChanged(PropertyInfoRestRep oldProps, PropertyInfoRestRep newProps, String property) {
    String oldValue = oldProps.getProperty(property);
    String newValue = newProps.getProperty(property);
    if (newValue == null) {
        return false;
    }
    if (oldValue == null) {
        Map<String, PropertyMetadata> metadata = PropertiesMetadata.getGlobalMetadata();
        // no metadata, that is, this property is not defined
        if (metadata == null) {
            return false;
        }
        final PropertyMetadata propertyMetadata = metadata.get(property);
        if (propertyMetadata != null) {
            oldValue = propertyMetadata.getValue();
        }
    }
    if (oldValue != null && oldValue.equals(newValue)) {
        return false;
    }
    return true;
}
Also used : PropertyMetadata(com.emc.storageos.model.property.PropertyMetadata)

Example 17 with PropertyMetadata

use of com.emc.storageos.model.property.PropertyMetadata in project coprhd-controller by CoprHD.

the class CreateISOTest method getPropsMetaData.

public Map<String, PropertyMetadata> getPropsMetaData() {
    Map<String, PropertyMetadata> metadata = new TreeMap<String, PropertyMetadata>();
    PropertyMetadata networkMetadata = setPropMetaData("server ip address", "ipaddress", "ipaddr", null, "Network", true, false, true, null, null, "", false);
    PropertyMetadata controlNodeOnlyMetadata = setPropMetaData("server ip address", "ipaddress", "ipaddr", null, "Network", true, false, true, null, null, "", true);
    PropertyMetadata iplistMetadata = setPropMetaData("server ip address", "ipaddress", "ipaddrlist", null, "Network", true, false, true, null, null, "", false);
    metadata.put("network_1_ipaddr", networkMetadata);
    metadata.put("network_2_ipaddr", networkMetadata);
    metadata.put("network_3_ipaddr", networkMetadata);
    metadata.put("network_dns_servers", iplistMetadata);
    metadata.put("network_ntp_servers", iplistMetadata);
    metadata.put("system_datanode_ipaddrs", iplistMetadata);
    metadata.put("network_gateway", controlNodeOnlyMetadata);
    metadata.put("system_upgrade_repo", controlNodeOnlyMetadata);
    return metadata;
}
Also used : PropertyMetadata(com.emc.storageos.model.property.PropertyMetadata) TreeMap(java.util.TreeMap)

Example 18 with PropertyMetadata

use of com.emc.storageos.model.property.PropertyMetadata in project coprhd-controller by CoprHD.

the class PropertyInfoExt method hasReconfigAttributeWithoutNotifiers.

public boolean hasReconfigAttributeWithoutNotifiers() {
    Map<String, PropertyMetadata> metadata = PropertiesMetadata.getGlobalMetadata();
    List<String> ret = new ArrayList<>();
    if (getProperties() == null || metadata == null) {
        // call the old-fashion reconfig() in this case
        return true;
    }
    for (Map.Entry<String, String> entry : getProperties().entrySet()) {
        final String key = entry.getKey();
        final PropertyMetadata propertyMetadata = metadata.get(key);
        if (propertyMetadata != null && propertyMetadata.getReconfigRequired() != null && propertyMetadata.getReconfigRequired().booleanValue() && (propertyMetadata.getNotifiers() == null || propertyMetadata.getNotifiers().length == 0)) {
            return true;
        }
    }
    return false;
}
Also used : ArrayList(java.util.ArrayList) PropertyMetadata(com.emc.storageos.model.property.PropertyMetadata) Map(java.util.Map)

Example 19 with PropertyMetadata

use of com.emc.storageos.model.property.PropertyMetadata in project coprhd-controller by CoprHD.

the class PropertyInfoExt method hasRebootProperty.

public boolean hasRebootProperty() {
    Map<String, PropertyMetadata> metadata = PropertiesMetadata.getGlobalMetadata();
    if (getProperties() == null || metadata == null) {
        return false;
    }
    for (Map.Entry<String, String> entry : getProperties().entrySet()) {
        final String key = entry.getKey();
        final PropertyMetadata propertyMetadata = metadata.get(key);
        if (propertyMetadata != null && propertyMetadata.getRebootRequired() != null && propertyMetadata.getRebootRequired().booleanValue()) {
            return true;
        }
    }
    return false;
}
Also used : PropertyMetadata(com.emc.storageos.model.property.PropertyMetadata) Map(java.util.Map)

Aggregations

PropertyMetadata (com.emc.storageos.model.property.PropertyMetadata)19 Map (java.util.Map)7 PropertyInfoExt (com.emc.storageos.coordinator.client.model.PropertyInfoExt)2 APIException (com.emc.storageos.svcs.errorhandling.resources.APIException)2 ArrayList (java.util.ArrayList)2 TreeMap (java.util.TreeMap)2 ConfigurationImpl (com.emc.storageos.coordinator.common.impl.ConfigurationImpl)1 CoordinatorException (com.emc.storageos.coordinator.exceptions.CoordinatorException)1 PropertyInfoRestRep (com.emc.storageos.model.property.PropertyInfoRestRep)1 CheckPermission (com.emc.storageos.security.authorization.CheckPermission)1 BadRequestException (com.emc.storageos.svcs.errorhandling.resources.BadRequestException)1 CoordinatorClientException (com.emc.storageos.systemservices.exceptions.CoordinatorClientException)1 InvalidLockOwnerException (com.emc.storageos.systemservices.exceptions.InvalidLockOwnerException)1 SyssvcException (com.emc.storageos.systemservices.exceptions.SyssvcException)1 IOException (java.io.IOException)1 ParseException (java.text.ParseException)1 HashMap (java.util.HashMap)1 Property (models.properties.Property)1