public static String getExceptionStacktrace(ByteArrayEntity byteArray) { String result = null; if(byteArray != null) { result = StringUtil.fromBytes(byteArray.getBytes()); } return result; }
protected byte[] getSerializedBytesValue(String serializedStringValue) { if(serializedStringValue != null) { byte[] serializedByteValue = StringUtil.toByteArray(serializedStringValue); if (!isSerializationTextBased()) { serializedByteValue = Base64.decodeBase64(serializedByteValue); } return serializedByteValue; } else { return null; } }
private void validateResouceName(String resourceName, String[] resourceSuffixes) { if (!StringUtil.hasAnySuffix(resourceName, resourceSuffixes)) { LOG.warnDeploymentResourceHasWrongName(resourceName, resourceSuffixes); } }
protected Map<String, byte[]> getDeploymentResources(ProcessArchiveXml processArchive, DeploymentUnit deploymentUnit, VirtualFile processesXmlFile) { final Module module = deploymentUnit.getAttachment(MODULE); Map<String, byte[]> resources = new HashMap<String, byte[]>(); // first, add all resources listed in the processe.xml List<String> process = processArchive.getProcessResourceNames(); ModuleClassLoader classLoader = module.getClassLoader(); for (String resource : process) { InputStream inputStream = null; try { inputStream = classLoader.getResourceAsStream(resource); resources.put(resource, IoUtil.readInputStream(inputStream, resource)); } finally { IoUtil.closeSilently(inputStream); } } // scan for process definitions if(PropertyHelper.getBooleanProperty(processArchive.getProperties(), ProcessArchiveXml.PROP_IS_SCAN_FOR_PROCESS_DEFINITIONS, process.isEmpty())) { //always use VFS scanner on JBoss final VfsProcessApplicationScanner scanner = new VfsProcessApplicationScanner(); String resourceRootPath = processArchive.getProperties().get(ProcessArchiveXml.PROP_RESOURCE_ROOT_PATH); String[] additionalResourceSuffixes = StringUtil.split(processArchive.getProperties().get(ProcessArchiveXml.PROP_ADDITIONAL_RESOURCE_SUFFIXES), ProcessArchiveXml.PROP_ADDITIONAL_RESOURCE_SUFFIXES_SEPARATOR); URL processesXmlUrl = vfsFileAsUrl(processesXmlFile); resources.putAll(scanner.findResources(classLoader, resourceRootPath, processesXmlUrl, additionalResourceSuffixes)); } return resources; }
if (StringUtil.isExpression(retryIntervals)) { ExpressionManager expressionManager = Context.getProcessEngineConfiguration().getExpressionManager(); Expression expression = expressionManager.createExpression(retryIntervals); String[] intervals = StringUtil.split(retryIntervals, ","); int retries = intervals.length + 1;
public static String joinProcessElementInstanceIds(Collection<? extends ProcessElementInstance> processElementInstances) { final Iterator<? extends ProcessElementInstance> iterator = processElementInstances.iterator(); return join(new StringIterator<ProcessElementInstance>(iterator) { public String next() { return iterator.next().getId(); } }); }
/** * Checks if the value is an expression for a dynamic script source or resource. * * @param language the language of the script * @param value the value to check * @return true if the value is an expression for a dynamic script source/resource, otherwise false */ public static boolean isDynamicScriptExpression(String language, String value) { return StringUtil.isExpression(value) && (language != null && !JuelScriptEngineFactory.names.contains(language.toLowerCase())); }
protected ParameterValueProvider createParameterValueProvider(String value, ExpressionManager expressionManager) { if (value == null) { return new NullValueProvider(); } else if (isCompositeExpression(value, expressionManager)) { Expression expression = expressionManager.createExpression(value); return new ElValueProvider(expression); } else { return new ConstantValueProvider(value); } }
public void ensureNoEntitiesAreLeft(String entityName, Collection<? extends DbEntity> dbEntities, MigratingProcessInstanceValidationReportImpl processInstanceReport) { if (!dbEntities.isEmpty()) { processInstanceReport.addFailure("Process instance contains not migrated " + entityName + ": [" + StringUtil.joinDbEntityIds(dbEntities) + "]"); } }
protected Map<String, byte[]> getDeploymentResources(ProcessArchiveXml processArchive, DeploymentUnit deploymentUnit, VirtualFile processesXmlFile) { final Module module = deploymentUnit.getAttachment(MODULE); Map<String, byte[]> resources = new HashMap<String, byte[]>(); // first, add all resources listed in the processe.xml List<String> process = processArchive.getProcessResourceNames(); ModuleClassLoader classLoader = module.getClassLoader(); for (String resource : process) { InputStream inputStream = null; try { inputStream = classLoader.getResourceAsStream(resource); resources.put(resource, IoUtil.readInputStream(inputStream, resource)); } finally { IoUtil.closeSilently(inputStream); } } // scan for process definitions if(PropertyHelper.getBooleanProperty(processArchive.getProperties(), ProcessArchiveXml.PROP_IS_SCAN_FOR_PROCESS_DEFINITIONS, process.isEmpty())) { //always use VFS scanner on JBoss final VfsProcessApplicationScanner scanner = new VfsProcessApplicationScanner(); String resourceRootPath = processArchive.getProperties().get(ProcessArchiveXml.PROP_RESOURCE_ROOT_PATH); String[] additionalResourceSuffixes = StringUtil.split(processArchive.getProperties().get(ProcessArchiveXml.PROP_ADDITIONAL_RESOURCE_SUFFIXES), ProcessArchiveXml.PROP_ADDITIONAL_RESOURCE_SUFFIXES_SEPARATOR); URL processesXmlUrl = vfsFileAsUrl(processesXmlFile); resources.putAll(scanner.findResources(classLoader, resourceRootPath, processesXmlUrl, additionalResourceSuffixes)); } return resources; }
if (StringUtil.isExpression(retryIntervals)) { ExpressionManager expressionManager = Context.getProcessEngineConfiguration().getExpressionManager(); Expression expression = expressionManager.createExpression(retryIntervals); String[] intervals = StringUtil.split(retryIntervals, ","); int retries = intervals.length + 1;
public static String joinProcessElementInstanceIds(Collection<? extends ProcessElementInstance> processElementInstances) { final Iterator<? extends ProcessElementInstance> iterator = processElementInstances.iterator(); return join(new StringIterator<ProcessElementInstance>(iterator) { public String next() { return iterator.next().getId(); } }); }
/** * Checks if the value is an expression for a dynamic script source or resource. * * @param language the language of the script * @param value the value to check * @return true if the value is an expression for a dynamic script source/resource, otherwise false */ public static boolean isDynamicScriptExpression(String language, String value) { return StringUtil.isExpression(value) && (language != null && !JuelScriptEngineFactory.names.contains(language.toLowerCase())); }
protected ParameterValueProvider createParameterValueProvider(String value, ExpressionManager expressionManager) { if (value == null) { return new NullValueProvider(); } else if (isCompositeExpression(value, expressionManager)) { Expression expression = expressionManager.createExpression(value); return new ElValueProvider(expression); } else { return new ConstantValueProvider(value); } }
public void ensureNoEntitiesAreLeft(String entityName, Collection<? extends DbEntity> dbEntities, MigratingProcessInstanceValidationReportImpl processInstanceReport) { if (!dbEntities.isEmpty()) { processInstanceReport.addFailure("Process instance contains not migrated " + entityName + ": [" + StringUtil.joinDbEntityIds(dbEntities) + "]"); } }
public static String getExceptionStacktrace(ByteArrayEntity byteArray) { String result = null; if(byteArray != null) { result = StringUtil.fromBytes(byteArray.getBytes()); } return result; }
protected Map<String, byte[]> getDeploymentResources(ProcessArchiveXml processArchive, DeploymentUnit deploymentUnit, VirtualFile processesXmlFile) { final Module module = deploymentUnit.getAttachment(MODULE); Map<String, byte[]> resources = new HashMap<String, byte[]>(); // first, add all resources listed in the processe.xml List<String> process = processArchive.getProcessResourceNames(); ModuleClassLoader classLoader = module.getClassLoader(); for (String resource : process) { InputStream inputStream = null; try { inputStream = classLoader.getResourceAsStream(resource); resources.put(resource, IoUtil.readInputStream(inputStream, resource)); } finally { IoUtil.closeSilently(inputStream); } } // scan for process definitions if(PropertyHelper.getBooleanProperty(processArchive.getProperties(), ProcessArchiveXml.PROP_IS_SCAN_FOR_PROCESS_DEFINITIONS, process.isEmpty())) { //always use VFS scanner on JBoss final VfsProcessApplicationScanner scanner = new VfsProcessApplicationScanner(); String resourceRootPath = processArchive.getProperties().get(ProcessArchiveXml.PROP_RESOURCE_ROOT_PATH); String[] additionalResourceSuffixes = StringUtil.split(processArchive.getProperties().get(ProcessArchiveXml.PROP_ADDITIONAL_RESOURCE_SUFFIXES), ProcessArchiveXml.PROP_ADDITIONAL_RESOURCE_SUFFIXES_SEPARATOR); URL processesXmlUrl = vfsFileAsUrl(processesXmlFile); resources.putAll(scanner.findResources(classLoader, resourceRootPath, processesXmlUrl, additionalResourceSuffixes)); } return resources; }
protected byte[] getSerializedBytesValue(String serializedStringValue) { if(serializedStringValue != null) { byte[] serializedByteValue = StringUtil.toByteArray(serializedStringValue); if (!isSerializationTextBased()) { serializedByteValue = Base64.decodeBase64(serializedByteValue); } return serializedByteValue; } else { return null; } }
if (StringUtil.isExpression(retryIntervals)) { ExpressionManager expressionManager = Context.getProcessEngineConfiguration().getExpressionManager(); Expression expression = expressionManager.createExpression(retryIntervals); String[] intervals = StringUtil.split(retryIntervals, ","); int retries = intervals.length + 1;
public static String joinDbEntityIds(Collection<? extends DbEntity> dbEntities) { return join(new StringIterator<DbEntity>(dbEntities.iterator()) { public String next() { return iterator.next().getId(); } }); }