public void saveDeviceProfiles(String username,String realm,List<JsonValue> profiles) throws InternalServerErrorException {
  final AMIdentity identity=getIdentity(username,realm);
  Set<String> vals=new HashSet<>();
  try {
    final DeviceService deviceService=serviceFactory.create(realm);
    final DeviceSerialisation deviceSerialisation=deviceService.getDeviceSerialisationStrategy();
    final String attrName=deviceService.getConfigStorageAttributeName();
    for (    JsonValue profile : profiles) {
      vals.add(deviceSerialisation.deviceProfileToString(profile));
    }
    Map<String,Set> attrMap=new HashMap<>();
    attrMap.put(attrName,vals);
    identity.setAttributes(attrMap);
    identity.store();
  }
 catch (  SSOException|IdRepoException|SMSException e) {
    throw new InternalServerErrorException(e.getMessage(),e);
  }
}

public void saveDeviceProfiles ( String username , String realm , List < JsonValue > profiles ) throws InternalServerErrorException { final AMIdentity identity = getIdentity ( username , realm ) ; Set < String > vals = new HashSet < > ( ) ; try { final DeviceService deviceService = serviceFactory . create ( realm ) ; final DeviceSerialisation deviceSerialisation = deviceService . getDeviceSerialisationStrategy ( ) ; final String attrName = deviceService . getConfigStorageAttributeName ( ) ; for ( JsonValue profile : profiles ) { vals . add ( deviceSerialisation . deviceProfileToString ( profile ) ) ; } Map < String , Set > attrMap = new HashMap < > ( ) ; attrMap . put ( attrName , vals ) ; identity . setAttributes ( attrMap ) ; identity . store ( ) ; } catch ( SSOException | IdRepoException | SMSException e ) { throw new InternalServerErrorException ( e . getMessage ( ) , e ) ; } }
saves a user ' s device profiles .
