Codota Logo
org.flowable.content.api
Code IndexAdd Codota to your IDE (free)

How to use org.flowable.content.api

Best Java code snippets using org.flowable.content.api (Showing top 20 results out of 315)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
Point p =
  • Codota Iconnew Point(x, y)
  • Codota Iconnew Point()
  • Codota IconMouseEvent e;e.getPoint()
  • Smart code suggestions by Codota
}
origin: org.flowable/flowable-content-engine

@Override
public InputStream getContent() {
  if (inputStream == null) {
    try {
      inputStream = new FileInputStream(file);
    } catch (FileNotFoundException e) {
      throw new ContentStorageException("Error while opening file stream", e);
    }
  }
  return inputStream;
}
origin: org.flowable/flowable-content-rest

  protected ContentItem getContentItemFromRequest(String contentItemId) {
    ContentItem contentItem = contentService.createContentItemQuery().id(contentItemId).singleResult();
    if (contentItem == null) {
      throw new FlowableObjectNotFoundException("Could not find a content item with id '" + contentItemId + "'.", ContentItem.class);
    }
    
    if (restApiInterceptor != null) {
      restApiInterceptor.accessContentItemInfoById(contentItem);
    }
    
    return contentItem;
  }
}
origin: org.flowable/flowable-ui-task-rest

public ResultListDataRepresentation getContentItemsForCase(String caseInstanceId) {
  permissionService.hasReadPermissionOnCase(SecurityUtils.getCurrentUserObject(), caseInstanceId);
  return createResultRepresentation(contentService.createContentItemQuery().scopeType("cmmn").scopeId(caseInstanceId).list());
}
origin: org.flowable/flowable-content-rest

protected ContentItemResponse createSimpleContentItem(ContentItemRequest contentItemRequest) {
  if (contentItemRequest.getName() == null) {
    throw new FlowableIllegalArgumentException("Content item name is required.");
  }
  ContentItem contentItem = contentService.newContentItem();
  contentItem.setName(contentItemRequest.getName());
  contentItem.setMimeType(contentItemRequest.getMimeType());
  contentItem.setTaskId(contentItemRequest.getTaskId());
  contentItem.setProcessInstanceId(contentItemRequest.getProcessInstanceId());
  contentItem.setContentStoreId(contentItemRequest.getContentStoreId());
  contentItem.setContentStoreName(contentItemRequest.getContentStoreName());
  contentItem.setField(contentItemRequest.getField());
  contentItem.setCreatedBy(contentItemRequest.getCreatedBy());
  contentItem.setLastModifiedBy(contentItemRequest.getLastModifiedBy());
  contentItem.setTenantId(contentItemRequest.getTenantId());
  
  if (restApiInterceptor != null) {
    restApiInterceptor.createNewContentItem(contentItem);
  }
  
  contentService.saveContentItem(contentItem);
  return contentRestResponseFactory.createContentItemResponse(contentItem);
}
origin: org.flowable/flowable-content-rest

public ContentItemResponse(ContentItem contentItem, String url) {
  setId(contentItem.getId());
  setName(contentItem.getName());
  setMimeType(contentItem.getMimeType());
  setTaskId(contentItem.getTaskId());
  setProcessInstanceId(contentItem.getProcessInstanceId());
  setContentStoreId(contentItem.getContentStoreId());
  setContentStoreName(contentItem.getContentStoreName());
  setContentAvailable(contentItem.isContentAvailable());
  setTenantId(contentItem.getTenantId());
  setCreated(contentItem.getCreated());
  setCreatedBy(contentItem.getCreatedBy());
  setLastModified(contentItem.getLastModified());
  setLastModifiedBy(contentItem.getLastModifiedBy());
  setUrl(url);
}
origin: org.flowable/flowable-ui-task-rest

public void deleteContent(String contentId, HttpServletResponse response) {
  ContentItem contentItem = contentService.createContentItemQuery().id(contentId).singleResult();
  if (contentItem == null) {
    throw new NotFoundException("No content found with id: " + contentId);
  }
  if (!permissionService.hasWritePermissionOnRelatedContent(SecurityUtils.getCurrentUserObject(), contentItem)) {
    throw new NotPermittedException("You are not allowed to delete the content with id: " + contentId);
  }
  if (contentItem.getField() != null) {
    // Not allowed to delete content that has been added as part of a form
    throw new NotPermittedException("You are not allowed to delete the content with id: " + contentId);
  }
  contentService.deleteContentItem(contentItem.getId());
}
origin: org.flowable/flowable-ui-task-rest

public ResultListDataRepresentation getContentItemsForTask(String taskId) {
  permissionService.validateReadPermissionOnTask(SecurityUtils.getCurrentUserObject(), taskId);
  return createResultRepresentation(contentService.createContentItemQuery().taskId(taskId).list());
}
origin: org.flowable/flowable-ui-task-rest

public ResultListDataRepresentation getContentItemsForProcessInstance(String processInstanceId) {
  // TODO: check if process exists
  if (!permissionService.hasReadPermissionOnProcessInstance(SecurityUtils.getCurrentUserObject(), processInstanceId)) {
    throw new NotPermittedException("You are not allowed to read the process with id: " + processInstanceId);
  }
  return createResultRepresentation(contentService.createContentItemQuery().processInstanceId(processInstanceId).list());
}
origin: org.flowable/flowable-content-engine

/**
 * Each test is assumed to clean up all DB content it entered. After a test method executed, this method scans all tables to see if the DB is completely clean. It throws AssertionFailed in case
 * the DB is not clean. If the DB is not clean, it is cleaned by performing a create a drop.
 */
public static void assertAndEnsureCleanDb(ContentEngine contentEngine) {
  LOGGER.debug("verifying that db is clean after test");
  ContentService contentService = contentEngine.getContentEngineConfiguration().getContentService();
  List<ContentItem> items = contentService.createContentItemQuery().list();
  if (items != null && !items.isEmpty()) {
    throw new AssertionError("ContentItem is not empty");
  }
}
origin: org.flowable/flowable-content-engine

@Override
public InputStream execute(CommandContext commandContext) {
  if (contentItemId == null) {
    throw new FlowableIllegalArgumentException("contentItemId is null");
  }
  ContentItem contentItem = CommandContextUtil.getContentItemEntityManager().findById(contentItemId);
  if (contentItem == null) {
    throw new FlowableObjectNotFoundException("content item could not be found with id " + contentItemId);
  }
  ContentStorage contentStorage = CommandContextUtil.getContentEngineConfiguration().getContentStorage();
  ContentObject contentObject = contentStorage.getContentObject(contentItem.getContentStoreId());
  return contentObject.getContent();
}
origin: org.flowable/flowable-content-rest

public ContentItemResponse createContentItemResponse(ContentItem contentItem, ContentRestUrlBuilder urlBuilder) {
  ContentItemResponse response = new ContentItemResponse(contentItem,
      urlBuilder.buildUrl(ContentRestUrls.URL_CONTENT_ITEM, contentItem.getId()));
  return response;
}
origin: org.flowable/flowable-engine

public static ContentService getContentService(AbstractEngineConfiguration engineConfiguration) {
  ContentService contentService = null;
  ContentEngineConfigurationApi contentEngineConfiguration = getContentEngineConfiguration(engineConfiguration);
  if (contentEngineConfiguration != null) {
    contentService = contentEngineConfiguration.getContentService();
  }
  
  return contentService;
}
origin: org.flowable/flowable-content-engine

/**
 * @return a file reference for the given id, checking for existence based on the given flag.
 */
protected File getFileForId(String id, boolean shouldExist) {
  BigInteger idValue = null;
  try {
    idValue = new BigInteger(id);
  } catch (NumberFormatException nfe) {
    throw new ContentStorageException("Illegal ID value, only positive numbers are supported: " + id, nfe);
  }
  File path = converter.getPathForId(idValue);
  File file = new File(rootFolder, path.getPath());
  if (shouldExist != file.exists()) {
    if (shouldExist) {
      throw new ContentNotFoundException("Content with id: " + id + " was not found (path: " + file.toString() + ")");
    } else {
      throw new ContentNotFoundException("Content with id: " + id + " already exists.");
    }
  }
  return file;
}
origin: org.flowable/flowable-ui-task-rest

protected ContentItemRepresentation addContentItem(ContentItemRepresentation contentItemBody, String taskId, String processInstanceId, boolean isRelatedContent) {
  if (contentItemBody.getContentStoreId() == null || contentItemBody.getContentStoreName() == null || contentItemBody.getName() == null) {
    throw new BadRequestException("Name, source and sourceId are required parameters");
  }
  User user = SecurityUtils.getCurrentUserObject();
  ContentItem contentItem = contentService.newContentItem();
  contentItem.setName(contentItemBody.getName());
  contentItem.setProcessInstanceId(processInstanceId);
  contentItem.setTaskId(taskId);
  contentItem.setContentStoreId(contentItemBody.getContentStoreId());
  contentItem.setContentStoreName(contentItemBody.getContentStoreName());
  contentItem.setMimeType(contentItemBody.getMimeType());
  contentItem.setCreatedBy(user.getId());
  contentItem.setLastModifiedBy(user.getId());
  contentService.saveContentItem(contentItem);
  return createContentItemResponse(contentItem);
}
origin: org.flowable/flowable-ui-task-rest

public ContentItemRepresentation getContent(String contentId) {
  ContentItem contentItem = contentService.createContentItemQuery().id(contentId).singleResult();
  if (contentItem == null) {
    throw new NotFoundException("No content found with id: " + contentId);
  }
  if (!permissionService.canDownloadContent(SecurityUtils.getCurrentUserObject(), contentItem)) {
    throw new NotPermittedException("You are not allowed to view the content with id: " + contentId);
  }
  return createContentItemResponse(contentItem);
}
origin: org.flowable/flowable-cmmn-engine

public static ContentService getContentService(CommandContext commandContext) {
  ContentService contentService = null;
  ContentEngineConfigurationApi contentEngineConfiguration = getContentEngineConfiguration(commandContext);
  if (contentEngineConfiguration != null) {
    contentService = contentEngineConfiguration.getContentService();
  }
  return contentService;
}

origin: org.flowable/flowable-content-engine

@Override
public void deleteContentObject(String id) {
  try {
    File contentFile = getFileForId(id, true);
    contentFile.delete();
  } catch (Exception e) {
    throw new ContentStorageException("Error while deleting content", e);
  }
}
origin: org.flowable/flowable-engine

public static ContentService getContentService(CommandContext commandContext) {
  ContentService contentService = null;
  ContentEngineConfigurationApi contentEngineConfiguration = getContentEngineConfiguration(commandContext);
  if (contentEngineConfiguration != null) {
    contentService = contentEngineConfiguration.getContentService();
  }
  
  return contentService;
}

origin: org.flowable/flowable-content-engine

public BigInteger getIdForPath(File path) {
  BigInteger result = BigInteger.ZERO;
  BigInteger currentFactor = BigInteger.ONE;
  int depth = 0;
  File parent = path;
  while (parent != null && depth < iterationDepth) {
    try {
      result = result.add(new BigInteger(parent.getName()).multiply(currentFactor));
      // Move on to next iteration
      parent = parent.getParentFile();
      depth++;
      currentFactor = currentFactor.multiply(blockSize);
    } catch (NumberFormatException nfe) {
      throw new ContentStorageException("Illegal format of path segment: " + parent.getName(), nfe);
    }
  }
  return result;
}
origin: org.flowable/flowable-content-engine

@Override
public void deleteContentObject(String id) {
  try {
    File contentFile = getContentFile(id);
    File parentFile = contentFile.getParentFile();
    contentFile.delete();
    if (parentFile.listFiles().length == 0 && !id.startsWith(UNCATEGORIZED_PREFIX)) {
      parentFile.delete();
    }
  } catch (Exception e) {
    throw new ContentStorageException("Error while deleting content", e);
  }
}
org.flowable.content.api

Most used classes

  • ContentItem
    An object structure representing a piece of content.
  • ContentItemQuery
    Allows programmatic querying of ContentItems.
  • ContentService
  • ContentEngineConfigurationApi
  • ContentManagementService
  • ContentObject,
  • ContentStorage,
  • ContentStorageException
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now