use of com.centurylink.mdw.common.service.ActionRequest in project mdw-designer by CenturyLinkCloud.
the class WorkflowAccessRest method updateAttributes.
public void updateAttributes(String ownerType, long ownerId, Map<String, String> attributes) throws DataAccessException {
try {
JSONObject attrsJson = new JSONObject();
for (String name : attributes.keySet()) attrsJson.put(name, attributes.get(name));
if (getServer().getSchemaVersion() >= 6000) {
try {
getServer().post("Attributes/" + ownerType + "/" + ownerId, attrsJson.toString(2));
} catch (IOException ex) {
throw new DataAccessOfflineException("Unable to connect to " + getServer().getServiceUrl(), ex);
}
} else {
Map<String, String> params = getStandardParams();
params.put("ownerType", ownerType);
params.put("ownerId", String.valueOf(ownerId));
ActionRequest actionRequest = new ActionRequest("UpdateAttributes", params);
actionRequest.addJson("attributes", attrsJson);
invokeActionService(actionRequest.getJson().toString(2));
}
} catch (JSONException ex) {
throw new DataAccessException(ex.getMessage(), ex);
}
}
Aggregations