congrats Icon
New! Announcing Tabnine Chat Beta
Learn More
Tabnine Logo
DocumentDownloadLinkGenerator.generateDownloadLink
Code IndexAdd Tabnine to your IDE (free)

How to use
generateDownloadLink
method
in
org.jbpm.document.service.impl.util.DocumentDownloadLinkGenerator

Best Java code snippets using org.jbpm.document.service.impl.util.DocumentDownloadLinkGenerator.generateDownloadLink (Showing top 14 results out of 315)

origin: kiegroup/jbpm

@Test
public void testLinkGenerationFailure() {
  Assertions.assertThatThrownBy(() -> DocumentDownloadLinkGenerator.generateDownloadLink(null,
                                              DOC_ID))
      .isInstanceOf(IllegalArgumentException.class)
      .hasMessageContaining("ServerTemplateId cannot be null");
  Assertions.assertThatThrownBy(() -> DocumentDownloadLinkGenerator.generateDownloadLink(TEMPLATE_ID,
                                              null))
      .isInstanceOf(IllegalArgumentException.class)
      .hasMessageContaining("DocumentIdentifier cannot be null");
}
origin: kiegroup/jbpm

  @Test
  public void testLinkGeneration() {
    Assertions.assertThat(DocumentDownloadLinkGenerator.generateDownloadLink(TEMPLATE_ID,
                                         DOC_ID))
        .doesNotContain(DocumentDownloadLinkGenerator.TEMPLATE_ID_TOKEN)
        .doesNotContain(DocumentDownloadLinkGenerator.DOCUMENT_ID_TOKEN)
        .contains(TEMPLATE_ID)
        .contains(DOC_ID);
  }
}
origin: kiegroup/jbpm-wb

private List<DocumentSummary> getDocuments(QueryFilter filter) throws NumberFormatException {
  String serverTemplateId = (String) filter.getParams().get("serverTemplateId");
  Collection<ProcessVariableSummary> processVariables = processVariablesService.getData(filter).getPageRowList();
  SimpleDateFormat sdf = new SimpleDateFormat(Document.DOCUMENT_DATE_PATTERN);
  List<DocumentSummary> documents = new ArrayList<DocumentSummary>();
  for (ProcessVariableSummary pv : processVariables) {
    if (JBPM_DOCUMENT.equals(pv.getType()) &&
        pv.getNewValue() != null && !pv.getNewValue().isEmpty()) {
      String[] values = pv.getNewValue().split(Document.PROPERTIES_SEPARATOR);
      if (values.length == 4) {
        Date lastModified = null;
        try {
          lastModified = sdf.parse(values[2]);
        } catch (ParseException ex) {
          logger.error("Can not parse last modified date!",
                 ex);
        }
        documents.add(new DocumentSummary(values[0],
                         lastModified,
                         Long.valueOf(values[1]),
                         DocumentDownloadLinkGenerator.generateDownloadLink(serverTemplateId,
                                                   values[3])));
      }
    }
  }
  return documents;
}
origin: org.jbpm/jbpm-wb-process-runtime-backend

private List<DocumentSummary> getDocuments(QueryFilter filter) throws NumberFormatException {
  String serverTemplateId = (String) filter.getParams().get("serverTemplateId");
  Collection<ProcessVariableSummary> processVariables = processVariablesService.getData(filter).getPageRowList();
  SimpleDateFormat sdf = new SimpleDateFormat(Document.DOCUMENT_DATE_PATTERN);
  List<DocumentSummary> documents = new ArrayList<DocumentSummary>();
  for (ProcessVariableSummary pv : processVariables) {
    if (JBPM_DOCUMENT.equals(pv.getType()) &&
        pv.getNewValue() != null && !pv.getNewValue().isEmpty()) {
      String[] values = pv.getNewValue().split(Document.PROPERTIES_SEPARATOR);
      if (values.length == 4) {
        Date lastModified = null;
        try {
          lastModified = sdf.parse(values[2]);
        } catch (ParseException ex) {
          logger.error("Can not parse last modified date!",
                 ex);
        }
        documents.add(new DocumentSummary(values[0],
                         lastModified,
                         Long.valueOf(values[1]),
                         DocumentDownloadLinkGenerator.generateDownloadLink(serverTemplateId,
                                                   values[3])));
      }
    }
  }
  return documents;
}
origin: org.jbpm/jbpm-document

@Test
public void testLinkGenerationFailure() {
  Assertions.assertThatThrownBy(() -> DocumentDownloadLinkGenerator.generateDownloadLink(null,
                                              DOC_ID))
      .isInstanceOf(IllegalArgumentException.class)
      .hasMessageContaining("ServerTemplateId cannot be null");
  Assertions.assertThatThrownBy(() -> DocumentDownloadLinkGenerator.generateDownloadLink(TEMPLATE_ID,
                                              null))
      .isInstanceOf(IllegalArgumentException.class)
      .hasMessageContaining("DocumentIdentifier cannot be null");
}
origin: org.kie.workbench.forms/kie-wb-common-forms-jbpm-integration-backend

@Override
public DocumentData toFlatValue() {
  if (originalValue == null) {
    return null;
  }
  String templateId = (String) context.getAttributes().get(SERVER_TEMPLATE_ID);
  String link;
  if (!StringUtils.isEmpty(templateId) & !StringUtils.isEmpty(originalValue.getIdentifier())) {
    link = DocumentDownloadLinkGenerator.generateDownloadLink(templateId, originalValue.getIdentifier());
  } else {
    link = originalValue.getLink();
  }
  DocumentData data = new DocumentData(originalValue.getIdentifier(), originalValue.getName(), originalValue.getSize(), link);
  data.setStatus(DocumentStatus.STORED);
  return data;
}
origin: org.jbpm/jbpm-document

  @Test
  public void testLinkGeneration() {
    Assertions.assertThat(DocumentDownloadLinkGenerator.generateDownloadLink(TEMPLATE_ID,
                                         DOC_ID))
        .doesNotContain(DocumentDownloadLinkGenerator.TEMPLATE_ID_TOKEN)
        .doesNotContain(DocumentDownloadLinkGenerator.DOCUMENT_ID_TOKEN)
        .contains(TEMPLATE_ID)
        .contains(DOC_ID);
  }
}
origin: org.jbpm/jbpm-form-modeler-document

@Test
public void testGetInputHTMLReadOnly() {
  String result = handler.getInputHTML(document,
                     field,
                     FIELD_NAME,
                     NAMESPACE,
                     true);
  Assertions.assertThat(result).isNotNull()
      .isNotEmpty()
      .contains(FILE_INPUT)
      .contains("disabled=\"disabled\"")
      .contains(DocumentDownloadLinkGenerator.generateDownloadLink(SERVER_TEMPLATE_ID,
                                     DOC_ID));
}
origin: org.jbpm/jbpm-form-modeler-document

@Test
public void testGetInputHTML() {
  String result = handler.getInputHTML(document,
                     field,
                     FIELD_NAME,
                     NAMESPACE,
                     false);
  Assertions.assertThat(result).isNotNull()
      .isNotEmpty()
      .contains(FILE_INPUT)
      .contains(DocumentDownloadLinkGenerator.generateDownloadLink(SERVER_TEMPLATE_ID,
                                     DOC_ID));
}
origin: org.jbpm/jbpm-form-modeler-document

@Test
public void testGetShowHTML() {
  String result = handler.getShowHTML(document,
                    field,
                    FIELD_NAME,
                    NAMESPACE);
  Assertions.assertThat(result).isNotNull()
      .isNotEmpty()
      .doesNotContain(FILE_INPUT)
      .contains(DocumentDownloadLinkGenerator.generateDownloadLink(SERVER_TEMPLATE_ID,
                                     DOC_ID));
}
origin: org.jbpm/jbpm-form-modeler-document

@Test
public void testGetInputHTMLNullDocument() {
  String result = handler.getInputHTML(null,
                     field,
                     FIELD_NAME,
                     NAMESPACE,
                     false);
  Assertions.assertThat(result).isNotNull()
      .isNotEmpty()
      .contains(FILE_INPUT)
      .doesNotContain(DocumentDownloadLinkGenerator.generateDownloadLink(SERVER_TEMPLATE_ID,
                                        DOC_ID));
}
origin: org.jbpm/jbpm-form-modeler-document

@Test
public void testGetInputHTMLEmptyDocumentId() {
  document.setIdentifier(null);
  String result = handler.getInputHTML(document,
                     field,
                     FIELD_NAME,
                     NAMESPACE,
                     false);
  Assertions.assertThat(result).isNotNull()
      .isNotEmpty()
      .contains(FILE_INPUT)
      .doesNotContain(DocumentDownloadLinkGenerator.generateDownloadLink(SERVER_TEMPLATE_ID,
                                        DOC_ID));
}
origin: org.jbpm/jbpm-form-modeler-document

@Test
public void testGetShowHTMLNullDocument() {
  String result = handler.getShowHTML(null,
                    field,
                    FIELD_NAME,
                    NAMESPACE);
  Assertions.assertThat(result).isNotNull()
      .isNotEmpty()
      .doesNotContain(FILE_INPUT)
      .doesNotContain(DocumentDownloadLinkGenerator.generateDownloadLink(SERVER_TEMPLATE_ID,
                                        DOC_ID));
}
origin: org.jbpm/jbpm-form-modeler-document

  @Test
  public void testGetShowHTMLEmptyDocumentId() {

    document.setIdentifier(null);

    String result = handler.getShowHTML(document,
                      field,
                      FIELD_NAME,
                      NAMESPACE);

    Assertions.assertThat(result).isNotNull()
        .isNotEmpty()
        .doesNotContain(FILE_INPUT)
        .doesNotContain(DocumentDownloadLinkGenerator.generateDownloadLink(SERVER_TEMPLATE_ID,
                                          DOC_ID));
  }
}
org.jbpm.document.service.impl.utilDocumentDownloadLinkGeneratorgenerateDownloadLink

Popular methods of DocumentDownloadLinkGenerator

    Popular in Java

    • Reactive rest calls using spring rest template
    • putExtra (Intent)
    • requestLocationUpdates (LocationManager)
    • getResourceAsStream (ClassLoader)
    • GridLayout (java.awt)
      The GridLayout class is a layout manager that lays out a container's components in a rectangular gri
    • Runnable (java.lang)
      Represents a command that can be executed. Often used to run code in a different Thread.
    • Iterator (java.util)
      An iterator over a sequence of objects, such as a collection.If a collection has been changed since
    • Vector (java.util)
      Vector is an implementation of List, backed by an array and synchronized. All optional operations in
    • ThreadPoolExecutor (java.util.concurrent)
      An ExecutorService that executes each submitted task using one of possibly several pooled threads, n
    • Base64 (org.apache.commons.codec.binary)
      Provides Base64 encoding and decoding as defined by RFC 2045.This class implements section 6.8. Base
    • Best IntelliJ plugins
    Tabnine Logo
    • Products

      Search for Java codeSearch for JavaScript code
    • IDE Plugins

      IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
    • Company

      About UsContact UsCareers
    • Resources

      FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
    Get Tabnine for your IDE now