return createRestIdentityLink(link.getType(), link.getUserId(), link.getGroupId(), link.getTaskId(),
link.getProcessDefinitionId(), link.getProcessInstanceId(), serverRootUrl);
}
public RestIdentityLink createRestIdentityLink(String type, String userId, String groupId, String taskId, String processDefinitionId, String processInstanceId, String serverRootUrl) {
RestIdentityLink result = new RestIdentityLink();
result.setUser(userId);
result.setGroup(groupId);
result.setType(type);
String family = null;
if (userId != null) {
family = RestUrls.SEGMENT_IDENTITYLINKS_FAMILY_USERS;
} else {
family = RestUrls.SEGMENT_IDENTITYLINKS_FAMILY_GROUPS;
}
if (processDefinitionId != null) {
result.setUrl(formatUrl(serverRootUrl, RestUrls.URL_PROCESS_DEFINITION_IDENTITYLINK, processDefinitionId, family, (userId != null ? userId : groupId)));
} else if(taskId != null){
result.setUrl(formatUrl(serverRootUrl, RestUrls.URL_TASK_IDENTITYLINK, taskId, family, (userId != null ? userId : groupId), type));
} else {
result.setUrl(formatUrl(serverRootUrl, RestUrls.URL_PROCESS_INSTANCE_IDENTITYLINK, processInstanceId, (userId != null ? userId : groupId), type));
}
return result;
}