public static void addAttributeDefaultValues(String serviceName,String subSchemaName,String schemaType,String attributeName,Set defaultValues) throws UpgradeException {
  String classMethod="UpgradeUtils:addAttributeDefaultValues : ";
  if (debug.messageEnabled()) {
    debug.message(classMethod + "Updating attribute default values");
    debug.message("in :" + serviceName + "for attribute: "+ attributeName);
  }
  ServiceSchema ss=getServiceSchema(serviceName,subSchemaName,schemaType);
  try {
    Map attributeDefaults=ss.getAttributeDefaults();
    Set oldAttrValues=(Set)attributeDefaults.get(attributeName);
    Set newAttrValues=((oldAttrValues == null) || oldAttrValues.isEmpty()) ? new HashSet() : new HashSet(oldAttrValues);
    newAttrValues.addAll(defaultValues);
    ss.setAttributeDefaults(attributeName,newAttrValues);
  }
 catch (  SSOException ssoe) {
    throw new UpgradeException("Invalid SSOToken");
  }
catch (  SMSException sme) {
    throw new UpgradeException("Failed to add attribute default " + "values");
  }
}

public static void addAttributeDefaultValues ( String serviceName , String subSchemaName , String schemaType , String attributeName , Set defaultValues ) throws UpgradeException { String classMethod = "UpgradeUtils:addAttributeDefaultValues : " ; if ( debug . messageEnabled ( ) ) { debug . message ( classMethod + "Updating attribute default values" ) ; debug . message ( "in :" + serviceName + "for attribute: " + attributeName ) ; } ServiceSchema ss = getServiceSchema ( serviceName , subSchemaName , schemaType ) ; try { Map attributeDefaults = ss . getAttributeDefaults ( ) ; Set oldAttrValues = ( Set ) attributeDefaults . get ( attributeName ) ; Set newAttrValues = ( ( oldAttrValues == null ) || oldAttrValues . isEmpty ( ) ) ? new HashSet ( ) : new HashSet ( oldAttrValues ) ; newAttrValues . addAll ( defaultValues ) ; ss . setAttributeDefaults ( attributeName , newAttrValues ) ; } catch ( SSOException ssoe ) { throw new UpgradeException ( "Invalid SSOToken" ) ; } catch ( SMSException sme ) { throw new UpgradeException ( "Failed to add attribute default " + "values" ) ; } }
adds default values to an existing attribute . the existing values in the attribute will be updated with new values .
