Java Code Examples for org.camunda.bpm.engine.impl.persistence.entity.ResourceEntity#setBytes()

The following examples show how to use org.camunda.bpm.engine.impl.persistence.entity.ResourceEntity#setBytes() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: XlsxDeployer.java    From camunda-dmn-xlsx with Apache License 2.0 6 votes vote down vote up
protected ResourceEntity generateDeploymentResource(DeploymentEntity deployment, DmnModelInstance dmnModel, String name) {
  ResourceEntity resource = new ResourceEntity();

  ByteArrayOutputStream byteStream = new ByteArrayOutputStream();
  Dmn.writeModelToStream(byteStream, dmnModel);
  byte[] bytes = byteStream.toByteArray();

  resource.setName(name);
  resource.setBytes(bytes);
  resource.setDeploymentId(deployment.getId());

  // Mark the resource as 'generated'
  resource.setGenerated(true);

  return resource;
}
 
Example 2
Source File: CmmnTransformerTest.java    From camunda-bpm-platform with Apache License 2.0 6 votes vote down vote up
protected List<CaseDefinitionEntity> transform() {
  // convert the model to the XML string representation
  OutputStream outputStream = new ByteArrayOutputStream();
  Cmmn.writeModelToStream(outputStream, modelInstance);
  InputStream inputStream = IoUtil.convertOutputStreamToInputStream(outputStream);

  byte[] model = org.camunda.bpm.engine.impl.util.IoUtil.readInputStream(inputStream, "model");

  ResourceEntity resource = new ResourceEntity();
  resource.setBytes(model);
  resource.setName("test");

  transformer.setResource(resource);
  List<CaseDefinitionEntity> definitions = transformer.transform();

  IoUtil.closeSilently(outputStream);
  IoUtil.closeSilently(inputStream);

  return definitions;
}
 
Example 3
Source File: DeploymentBuilderImpl.java    From camunda-bpm-platform with Apache License 2.0 5 votes vote down vote up
protected DeploymentBuilder addBytes(String resourceName, byte[] bytes) {
  ResourceEntity resource = new ResourceEntity();
  resource.setBytes(bytes);
  resource.setName(resourceName);
  deployment.addResource(resource);

  return this;
}
 
Example 4
Source File: CompetingLicenseKeyAccessTest.java    From camunda-bpm-platform with Apache License 2.0 5 votes vote down vote up
@Override
public Long execute(CommandContext commandContext) {
  ResourceEntity licenseKey = commandContext.getResourceManager().findLicenseKeyResource();
  assertNotNull("license key is expected to be not null", licenseKey);

  monitor.sync();

  licenseKey.setBytes("updatedTestLicenseKeyBySecondThread".getBytes());
  new SetLicenseKeyCmd(new String(licenseKey.getBytes())).execute(commandContext);
  return null;
}