Package org.jbpm.designer.repository

Examples of org.jbpm.designer.repository.Asset


        Collection<Asset> forms = repository.listAssets("/defaultPackage", new FilterByExtension("ftl"));
        assertNotNull(forms);
        assertEquals(2, forms.size());
        Iterator<Asset> assets = forms.iterator();
        Asset asset1 = assets.next();
        assertEquals("evaluate-taskform", asset1.getName());
        assertEquals("/defaultPackage", asset1.getAssetLocation());

        Asset asset2 = assets.next();
        assertEquals("testprocess-taskform", asset2.getName());
        assertEquals("/defaultPackage", asset2.getAssetLocation());

        Asset<String> form1 = repository.loadAsset(asset1.getUniqueId());
        assertNotNull(form1.getAssetContent());
        Asset<String> form2 = repository.loadAsset(asset2.getUniqueId());
        assertNotNull(form2.getAssetContent());
    }
View Full Code Here


        Collection<Asset> forms = repository.listAssets("/defaultPackage", new FilterByExtension("ftl"));
        assertNotNull(forms);
        assertEquals(1, forms.size());
        Iterator<Asset> assets = forms.iterator();

        Asset asset1 = assets.next();
        assertEquals("evaluate-taskform", asset1.getName());
        assertEquals("/defaultPackage", asset1.getAssetLocation());

        Asset<String> form1 = repository.loadAsset(asset1.getUniqueId());
        assertNotNull(form1.getAssetContent());
        assertEquals("this is simple task content", form1.getAssetContent());

    }
View Full Code Here

                .type(formType)
                .content(formValue.getBytes("UTF-8"));

        repository.createAsset(builder.getAsset());

        Asset newFormAsset =  repository.loadAssetFromPath(packageName + "/" + taskName + TASKFORM_NAME_EXTENSION + "." + formType);

        String uniqueId = newFormAsset.getUniqueId();
        if (Base64Backport.isBase64(uniqueId)) {
            byte[] decoded = Base64.decodeBase64(uniqueId);
            try {
                uniqueId =  new String(decoded, "UTF-8");
            } catch (UnsupportedEncodingException e) {
View Full Code Here

        Repository repository = profile.getRepository();

        String[] pkgassetinfo = new String[2];
        try {
        Asset asset = repository.loadAsset(uuid);

        pkgassetinfo[0] = asset.getAssetLocation();
        pkgassetinfo[1] = asset.getName();
        } catch (AssetNotFoundException e) {
            _logger.error("Asset " + uuid + " not found");
        }

        return pkgassetinfo;
View Full Code Here

        Repository repository = profile.getRepository();

        Collection<Asset> imageAssets = repository.listAssets(packageName, new FilterByFileName(processid + "-svg.svg"));
        if (imageAssets != null && imageAssets.size() > 0) {
            Asset image = imageAssets.iterator().next();
            try {
                Asset toGetAsset = profile.getRepository().loadAsset(image.getUniqueId());
                return  Base64.encodeBase64String( ((String) toGetAsset.getAssetContent()).getBytes("UTF-8") );
            } catch (Exception e) {
                _logger.error(e.getMessage());
                return "";
            }
        } else {
View Full Code Here

                UploadCommand command = new UploadCommand();
                command.init(request, response, profile, repository, requestParams, listFiles, listFileStreams);
                output(response, false, command.execute());
            } else if(cmd != null && cmd.equals("getsvg")) {
                try {
                    Asset asset = profile.getRepository().loadAssetFromPath((String) requestParams.get("current"));
                    if(asset != null && asset.getAssetContent() != null) {
                        outputPlain(response, false, (String) asset.getAssetContent(), "image/svg+xml");
                    } else {
                        outputPlain(response, true, "<p><b>Process image not available.</p><p>You can generate the process image in the process editor.</b></p>", null);
                    }
                } catch (AssetNotFoundException e) {
                    logger.warn("Error loading process image: " + e.getMessage());
View Full Code Here

                    .type(FORMTEMPLATE_FILE_EXTENSION)
                    .content(taskForm.getMetaOutput().getBytes("UTF-8"));

            repository.createAsset(builder.getAsset());

            Asset newFormAsset =  repository.loadAssetFromPath(taskForm.getPkgName() + "/" + taskForm.getId()+"." + FORMTEMPLATE_FILE_EXTENSION);

            String uniqueId = newFormAsset.getUniqueId();
            if (Base64Backport.isBase64(uniqueId)) {
                byte[] decoded = Base64.decodeBase64(uniqueId);
                try {
                    uniqueId =  new String(decoded, "UTF-8");
                } catch (UnsupportedEncodingException e) {
                    e.printStackTrace();
                }
            }
            retObj.put("ftluri", uniqueId);

            // create the modeler form asset
            repository.deleteAssetFromPath(taskForm.getPkgName() + "/" + taskForm.getId()+"." + FORMMODELER_FILE_EXTENSION);
            AssetBuilder modelerBuilder = AssetBuilderFactory.getAssetBuilder(Asset.AssetType.Byte);
            modelerBuilder.name(taskForm.getId())
                    .location(location)
                    .type(FORMMODELER_FILE_EXTENSION)
                    .content(taskForm.getModelerOutput().getBytes("UTF-8"));

            repository.createAsset(modelerBuilder.getAsset());

            Asset newModelerFormAsset =  repository.loadAssetFromPath(taskForm.getPkgName() + "/" + taskForm.getId()+"." + FORMMODELER_FILE_EXTENSION);

            String modelerUniqueId = newModelerFormAsset.getUniqueId();
            if (Base64Backport.isBase64(modelerUniqueId)) {
                byte[] decoded = Base64.decodeBase64(modelerUniqueId);
                try {
                    modelerUniqueId =  new String(decoded, "UTF-8");
                } catch (UnsupportedEncodingException e) {
View Full Code Here

    private Collection<Asset> getWorkitemConfigContent(Collection<Asset> widAssets, Repository repository) {
        List<Asset> loadedAssets = new ArrayList<Asset>();
        for (Asset widAsset : widAssets) {
            try {
                Asset assetWithContent = repository.loadAsset(widAsset.getUniqueId());
                loadedAssets.add(assetWithContent);
            } catch (AssetNotFoundException e) {
                _logger.error("Asset " + widAsset.getName() + " not found");
            }
        }
View Full Code Here

            }
        });
        Collection<Asset> foundDirectories = new ArrayList<Asset>();
        Iterator<Path> it = directories.iterator();
        while (it.hasNext()) {
            Asset asset = buildAsset(it.next(), false);
            foundDirectories.add(asset);
        }

        return foundDirectories;
    }
View Full Code Here

            }
        });
        Collection<Asset> foundDirectories = new ArrayList<Asset>();
        Iterator<Path> it = directories.iterator();
        while (it.hasNext()) {
            Asset asset = buildAsset(it.next(), false);
            foundDirectories.add(asset);
        }

        return foundDirectories;
    }
View Full Code Here

TOP

Related Classes of org.jbpm.designer.repository.Asset

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.