public Builder instance(ProcessInstance instance, ViewContext context) { if (instance != null) { String processDefinitionKey = instance.getProcessDefinitionKey(); String processInstanceId = instance.getProcessInstanceId(); Set<Attachment> attachments = instance.getAttachments(); this.processInstanceId = processInstanceId; this.activation = context.getApplicationUri( ProcessInstance.Constants.ROOT_ELEMENT_NAME, processDefinitionKey, processInstanceId, "activation"); this.attachment = context.getApplicationUri( ProcessInstance.Constants.ROOT_ELEMENT_NAME, processDefinitionKey, processInstanceId, Attachment.Constants.ROOT_ELEMENT_NAME); this.cancellation = context.getApplicationUri( ProcessInstance.Constants.ROOT_ELEMENT_NAME, processDefinitionKey, processInstanceId, "cancellation"); this.history = context.getApplicationUri( ProcessInstance.Constants.ROOT_ELEMENT_NAME, processDefinitionKey, processInstanceId, History.Constants.ROOT_ELEMENT_NAME); this.restart = context.getApplicationUri( ProcessInstance.Constants.ROOT_ELEMENT_NAME, processDefinitionKey, processInstanceId, "restart"); this.suspension = context.getApplicationUri( ProcessInstance.Constants.ROOT_ELEMENT_NAME, processDefinitionKey, processInstanceId, "suspension"); this.bucketUrl = context.getApplicationUri( ProcessInstance.Constants.ROOT_ELEMENT_NAME, processDefinitionKey, processInstanceId, "value/Bucket"); if (attachments != null && !attachments.isEmpty()) { PassthroughSanitizer passthroughSanitizer = new PassthroughSanitizer(); this.attachmentCount = attachments.size(); this.attachments = new ArrayList<Attachment>(attachments.size()); for (Attachment attachment : attachments) { this.attachments.add( new Attachment.Builder(attachment, passthroughSanitizer) .processDefinitionKey(processDefinitionKey) .processInstanceId(processInstanceId) .build(context)); } } else { this.attachmentCount = instance.getAttachmentIds().size(); } } return this; }