Пример #1
0
 public Builder taskSubresources(String processDefinitionKey, Task task, ViewContext context) {
   this.assignment =
       context != null && task != null && task.getTaskInstanceId() != null
           ? context.getApplicationUri(
               Task.Constants.ROOT_ELEMENT_NAME,
               processDefinitionKey,
               task.getTaskInstanceId(),
               "assign")
           : null;
   this.task = task;
   return this;
 }
Пример #2
0
 public Builder instanceSubresources(
     String processDefinitionKey,
     String processInstanceId,
     Set<Attachment> attachments,
     int attachmentCount,
     ViewContext context) {
   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 = attachmentCount;
   }
   return this;
 }
Пример #3
0
  private Form(Form.Builder builder, ViewContext context) {
    this.process = builder.process;
    this.formInstanceId = builder.formInstanceId;
    this.processInstanceId = builder.processInstanceId;
    this.submissionType = builder.submissionType;
    this.actionType = builder.actionType;
    this.layout = builder.layout;
    this.task = builder.task;
    this.container = builder.container;
    this.applicationStatusExplanation = builder.applicationStatusExplanation;
    this.explanation = builder.explanation;
    this.data = builder.data;
    this.validation = builder.validation;
    this.root =
        context != null
            ? context.getApplicationOrPublicUri(builder.anonymous, Constants.ROOT_ELEMENT_NAME)
            : null;
    this.action =
        context != null
            ? context.getApplicationOrPublicUri(
                builder.anonymous,
                Constants.ROOT_ELEMENT_NAME,
                builder.processDefinitionKey,
                builder.formInstanceId)
            : null;
    if (task != null && task.getTaskInstanceId() != null)
      this.link =
          context != null
              ? context.getApplicationOrPublicUri(
                      builder.anonymous, Constants.ROOT_ELEMENT_NAME, builder.processDefinitionKey)
                  + "?taskId="
                  + task.getTaskInstanceId()
              : null;
    else
      this.link =
          context != null
              ? context.getApplicationOrPublicUri(
                  builder.anonymous, Constants.ROOT_ELEMENT_NAME, builder.processDefinitionKey)
              : null;
    this.src =
        context != null
            ? context.getApplicationOrPublicUri(
                builder.anonymous, "resource", builder.processDefinitionKey, builder.formInstanceId)
            : null;
    this.staticRoot =
        context != null
            ? context.getApplicationOrPublicUri(
                builder.anonymous, "resource", "static", builder.processDefinitionKey)
            : null;
    this.assignment = builder.assignment;
    this.activation = builder.activation;
    this.attachment = builder.attachment;
    this.cancellation = builder.cancellation;

    this.history = builder.history;
    this.restart = builder.restart;
    this.suspension = builder.suspension;
    this.attachmentCount = builder.attachmentCount;
    this.attachments =
        builder.attachments != null
            ? Collections.unmodifiableList(builder.attachments)
            : Collections.<Attachment>emptyList();
    this.valid = builder.valid;
    this.external = builder.external;
    this.allowAttachments = builder.allowAttachments;
    this.anonymous = builder.anonymous;
    this.disposition = builder.disposition;
    this.currentUser = builder.currentUser;
    this.bucketUrl = builder.bucketUrl;
    this.bucketList = builder.bucketList;
  }