use of org.kie.workbench.common.stunner.core.backend.service.BackendFileSystemManager.Asset in project kie-wb-common by kiegroup.
the class WorkItemDefinitionRemoteDeployService method deploy.
void deploy(final Metadata metadata, final String url, final String names) {
if (null != url && url.trim().length() > 0) {
final Collection<WorkItemDefinition> items = remoteLookupService.execute(WorkItemDefinitionRemoteRequest.build(url, names));
final List<Asset> assets = items.stream().flatMap(this::toAssets).collect(Collectors.toList());
if (!assets.isEmpty()) {
// Deploy into file system.
backendFileSystemManager.deploy(resources.resolveResourcesPath(metadata), new Assets(assets), DEPLOY_MESSAGE + url);
// Install into current KIE runtime.
projectInstaller.install(items, metadata);
}
}
}
use of org.kie.workbench.common.stunner.core.backend.service.BackendFileSystemManager.Asset 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();
}
Aggregations