Search in sources :

Example 1 with AssetBuilder

use of org.kie.workbench.common.stunner.core.backend.service.BackendFileSystemManager.AssetBuilder in project kie-wb-common by kiegroup.

the class WorkItemDefinitionRemoteDeployService method createIconAsset.

private static Optional<Asset> createIconAsset(final WorkItemDefinition item) {
    final IconDefinition icon = item.getIconDefinition();
    if (null != icon && null != icon.getUri()) {
        final String path = parsePath(item.getUri());
        final String iconUri = icon.getUri();
        final Asset iconAsset;
        try {
            iconAsset = new AssetBuilder().setFileName(parseFileName(iconUri)).binaryFromURI(path + "/" + iconUri).build();
            return Optional.of(iconAsset);
        } catch (IOException e) {
            LOG.error("Error reading work item definition asset from URL [" + item.getUri() + "]", e);
        }
    }
    return Optional.empty();
}
Also used : AssetBuilder(org.kie.workbench.common.stunner.core.backend.service.BackendFileSystemManager.AssetBuilder) Asset(org.kie.workbench.common.stunner.core.backend.service.BackendFileSystemManager.Asset) IOException(java.io.IOException) IconDefinition(org.kie.workbench.common.stunner.bpmn.workitem.IconDefinition)

Aggregations

IOException (java.io.IOException)1 IconDefinition (org.kie.workbench.common.stunner.bpmn.workitem.IconDefinition)1 Asset (org.kie.workbench.common.stunner.core.backend.service.BackendFileSystemManager.Asset)1 AssetBuilder (org.kie.workbench.common.stunner.core.backend.service.BackendFileSystemManager.AssetBuilder)1