congrats Icon
New! Tabnine Pro 14-day free trial
Start a free trial
Tabnine Logo
DocumentDownloadLinkGenerator
Code IndexAdd Tabnine to your IDE (free)

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

Best Java code snippets using org.jbpm.document.service.impl.util.DocumentDownloadLinkGenerator (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.utilDocumentDownloadLinkGenerator

Most used methods

  • generateDownloadLink

Popular in Java

  • Making http requests using okhttp
  • compareTo (BigDecimal)
  • getOriginalFilename (MultipartFile)
    Return the original filename in the client's filesystem.This may contain path information depending
  • getContentResolver (Context)
  • Selector (java.nio.channels)
    A controller for the selection of SelectableChannel objects. Selectable channels can be registered w
  • Comparator (java.util)
    A Comparator is used to compare two objects to determine their ordering with respect to each other.
  • Queue (java.util)
    A collection designed for holding elements prior to processing. Besides basic java.util.Collection o
  • StringTokenizer (java.util)
    Breaks a string into tokens; new code should probably use String#split.> // Legacy code: StringTo
  • Notification (javax.management)
  • Join (org.hibernate.mapping)
  • 21 Best IntelliJ Plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

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