org.jbpm.document.Document.setLastModified()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(5.4k)|赞(0)|评价(0)|浏览(99)

本文整理了Java中org.jbpm.document.Document.setLastModified()方法的一些代码示例,展示了Document.setLastModified()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Document.setLastModified()方法的具体详情如下:
包路径:org.jbpm.document.Document
类名称:Document
方法名:setLastModified

Document.setLastModified介绍

暂无

代码示例

代码示例来源:origin: kiegroup/jbpm

private Document getDocument(String documentName) {
  Document documentOne = new DocumentImpl();
  documentOne.setIdentifier(documentName);
  documentOne.setLastModified(new Date());
  documentOne.setLink("http://" +  documentName);
  documentOne.setName(documentName + " Name");
  documentOne.setSize(1);
  documentOne.setContent(documentName.getBytes());
  return documentOne;
}

代码示例来源:origin: org.jbpm/jbpm-console-ng-documents-backend

@Override
public Object read(ObjectInputStream os) throws IOException,
    ClassNotFoundException {
  String objectId = os.readUTF();
  String canonicalName = os.readUTF();
  String link = os.readUTF();
  try {
    DocumentSummary doc = (DocumentSummary)this.documentService.getDocument(objectId);
    Document document = (Document) Class.forName(canonicalName).newInstance();
    document.setIdentifier(objectId);
    document.setLink(link);
    document.setName(doc.getName());
    document.setSize(10);
    document.setLastModified(new Date());
    document.setAttributes(new HashMap<String, String>());
    document.setContent(doc.getContent());
    return document;
  } catch(Exception e) {
    throw new RuntimeException("Cannot read document", e);
  }
}

代码示例来源:origin: org.jbpm.contrib/pdf-workitem

document.setLastModified(new Date());

代码示例来源:origin: org.jbpm/jbpm-console-ng-documents-backend

@Override
public Object unmarshal(Context context,
    ObjectInputStream objectInputStream, byte[] object,
    ClassLoader classLoader) throws IOException, ClassNotFoundException {
  DroolsObjectInputStream is = new DroolsObjectInputStream(
      new ByteArrayInputStream(object), classLoader);
  // first we read out the object id and class name we stored during
  // marshaling
  String objectId = is.readUTF();
  String canonicalName = is.readUTF();
  String link = is.readUTF();
  Document document = null;
  try {
    document = (Document) Class.forName(canonicalName).newInstance();
    DocumentSummary storedDoc = (DocumentSummary)this.documentService.getDocument(objectId);
    document.setIdentifier(storedDoc.getId());
    document.setName(storedDoc.getName());
    document.setLink(link);
    document.setLastModified(new Date());
    document.setSize(10);
    document.setAttributes(new HashMap<String, String>());
    InputStream stream = this.documentService.getDocumentContent(objectId);
    byte[] content = IOUtils.toByteArray(stream);
    document.setContent(content);
  } catch (Exception e) {
    throw new RuntimeException(
        "Cannot read document from storage service", e);
  }
  return document;
}

代码示例来源:origin: org.jbpm.contrib/google-drive-workitem

public void executeWorkItem(WorkItem workItem,
              WorkItemManager workItemManager) {
  Map<String, Object> results = new HashMap<String, Object>();
  String documentPath = (String) workItem.getParameter("DocumentPath");
  try {
    RequiredParameterValidator.validate(this.getClass(),
                      workItem);
    Drive drive = auth.getDriveService(appName,
                      clientSecret);
    Drive.Files.Get request = drive.files().get(documentPath);
    request.getMediaHttpDownloader().setProgressListener(new MediaDownloadProgressListener());
    request.getMediaHttpDownloader().setDirectDownloadEnabled(true);
    InputStream docInputStream = request.executeMediaAsInputStream();
    Document doc = new DocumentImpl();
    String docBaseName = FilenameUtils.getBaseName(documentPath);
    String docExtension = FilenameUtils.getExtension(documentPath);
    doc.setName(docBaseName + "." + docExtension);
    doc.setIdentifier(documentPath);
    doc.setLastModified(new Date());
    doc.setContent(IOUtils.toByteArray(docInputStream));
    results.put(RESULTS_DOCUMENT,
          doc);
    workItemManager.completeWorkItem(workItem.getId(),
                     results);
  } catch (Exception e) {
    handleException(e);
  }
}

代码示例来源:origin: org.jbpm.contrib/dropbox-workitem

@Before
public void setUp() {
  try {
    testDoc = new DocumentImpl();
    testDoc.setName("testDoc.txt");
    testDoc.setIdentifier("testDoc");
    testDoc.setLastModified(new Date());
    testDoc.setContent(new String("test doc content").getBytes());
    InputStream testInputStream =
        IOUtils.toInputStream("test doc content",
                   "UTF-8");
    when(auth.authorize(anyString(),
              anyString())).thenReturn(client);
    when(client.files()).thenReturn(fileRequests);
    // upload
    when(fileRequests.uploadBuilder(anyString())).thenReturn(uploadBuilder);
    when(uploadBuilder.withMode(any(WriteMode.class))).thenReturn(uploadBuilder);
    when(uploadBuilder.withClientModified(any(Date.class))).thenReturn(uploadBuilder);
    when(uploadBuilder.uploadAndFinish(any(java.io.InputStream.class))).thenReturn(metaData);
    // download
    when(fileRequests.downloadBuilder(anyString())).thenReturn(downloadBuilder);
    when(downloadBuilder.start()).thenReturn(downloader);
    when(downloader.getInputStream()).thenReturn(testInputStream);
  } catch (Exception e) {
    fail(e.getMessage());
  }
}

代码示例来源:origin: org.jbpm/jbpm-document

private Document getDocument(String documentName) {
  Document documentOne = new DocumentImpl();
  documentOne.setIdentifier(documentName);
  documentOne.setLastModified(new Date());
  documentOne.setLink("http://" +  documentName);
  documentOne.setName(documentName + " Name");
  documentOne.setSize(1);
  documentOne.setContent(documentName.getBytes());
  return documentOne;
}

代码示例来源:origin: mswiderski/jbpm-examples

document.setLastModified(doc.getLastModificationDate().getTime());
document.setSize(doc.getContentStreamLength());
document.addAttribute("location", getFolderName(doc.getParents()) + getPathAsString(doc.getPaths()));

相关文章