String[] keysAndValues = bao.toString(GlobalContext.DATABASE_ENCODING).split(",");
if(keysAndValues.length==0)
return null;
RoleMapping roleMapping = RoleMapping.create();
for(int i=0; i<keysAndValues.length; i++){
String[] keyAndValue = keysAndValues[i].split("=");
if(keyAndValue==null || keyAndValue.length < 2){
continue;
}
String key = keyAndValue[0];
String value = keyAndValue[1];
if(!UEngineUtil.isNotEmpty(key) || !UEngineUtil.isNotEmpty(key)){
continue;
}
if(key.startsWith("ext_")){
key = key.substring("ext_".length()); //TODO: [performance]
roleMapping.setExtendedProperty(key, value);
}else{
if(key.equals("Endpoint")){
roleMapping.setEndpoint(value);
}else if(key.equals("EmailAddress")){
roleMapping.setEmailAddress(value);
}else if(key.equals("Name")){
roleMapping.setName(value);
}else if(key.equals("ResourceName")){
roleMapping.setResourceName(value);
}
}
}
return roleMapping;