congrats Icon
New! Announcing Tabnine Chat Beta
Learn More
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

  • Start an intent from android
  • orElseThrow (Optional)
    Return the contained value, if present, otherwise throw an exception to be created by the provided s
  • addToBackStack (FragmentTransaction)
  • putExtra (Intent)
  • File (java.io)
    An "abstract" representation of a file system entity identified by a pathname. The pathname may be a
  • HashSet (java.util)
    HashSet is an implementation of a Set. All optional operations (adding and removing) are supported.
  • Hashtable (java.util)
    A plug-in replacement for JDK1.5 java.util.Hashtable. This version is based on org.cliffc.high_scale
  • TreeMap (java.util)
    Walk the nodes of the tree left-to-right or right-to-left. Note that in descending iterations, next
  • Reference (javax.naming)
  • Option (scala)
  • Best plugins for Eclipse
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