Package org.jbpm.designer.repository.impl

Examples of org.jbpm.designer.repository.impl.AssetBuilder


    public void testGetAssetInfoById() throws Exception {

        Repository repository = new VFSRepository(producer.getIoService());
        ((VFSRepository)repository).setDescriptor(descriptor);
        profile.setRepository(repository);
        AssetBuilder builder = AssetBuilderFactory.getAssetBuilder(Asset.AssetType.Text);
        builder.content("custom editors content")
                .type("bpmn2")
                .name("testprocess")
                .location("/defaultPackage");
        String id = repository.createAsset(builder.getAsset());
        // setup parameters
        Map<String, String> params = new HashMap<String, String>();

        params.put("profile", "jbpm");
        params.put("action", "getassetinfo");
View Full Code Here


    public void testGetAssetInfoByPath() throws Exception {

        Repository repository = new VFSRepository(producer.getIoService());
        ((VFSRepository)repository).setDescriptor(descriptor);
        profile.setRepository(repository);
        AssetBuilder builder = AssetBuilderFactory.getAssetBuilder(Asset.AssetType.Text);
        builder.content("custom editors content")
                .type("bpmn2")
                .name("testprocess")
                .location("/defaultPackage");
        String id = repository.createAsset(builder.getAsset());
        // setup parameters
        Map<String, String> params = new HashMap<String, String>();

        params.put("profile", "jbpm");
        params.put("action", "getassetinfo");
View Full Code Here

    private String createAssetIfNotExisting(Repository repository, String location, String name, String type, byte[] content) {
        try {
            boolean assetExists = repository.assetExists(location + "/" + name + "." + type);
            if (!assetExists) {
                // create theme asset
                AssetBuilder assetBuilder = AssetBuilderFactory.getAssetBuilder(Asset.AssetType.Byte);
                assetBuilder.content(content)
                        .location(location)
                        .name(name)
                        .type(type)
                        .version("1.0");

                Asset<byte[]> customEditorsAsset = assetBuilder.getAsset();

                return repository.createAsset(customEditorsAsset);
            }

        } catch (Exception e) {
View Full Code Here

                    String[] fileParts = fileName.split("\\.");
                    String fileType = fileParts[fileParts.length-1];
                    String fileNameOnly = fileName.substring(0, fileName.length() - (fileType.length() + 1));

                    AssetBuilder assetBuilder = AssetBuilderFactory.getAssetBuilder(Asset.AssetType.Byte);
                    assetBuilder.content(os.toByteArray())
                            .location(current)
                            .name(fileNameOnly)
                            .type(fileType)
                            .version("1.0");
                    Asset newAsset = assetBuilder.getAsset();
                    profile.getRepository().createAsset(newAsset);
                    i++;
                }
            } catch (Exception e) {
                logger.error("Unable to upload file: " + e.getMessage());
View Full Code Here

        } else if(name.endsWith(("bpmn"))) {
            name = name.substring(0, name.length() - 5);
        }
        String fullName = name + ".bpmn2";

        AssetBuilder builder = AssetBuilderFactory.getAssetBuilder(Asset.AssetType.Text);
        builder.content("")
                .type("bpmn2")
                .name(name)
                .location(current);

        String newFileId = profile.getRepository().createAsset(builder.getAsset());
        if(newFileId == null) {
            logger.error("Unable to create asset: " + current + "/" + fullName);
        }

        JSONObject retObj = new JSONObject();
View Full Code Here

            JSONObject retObj = new JSONObject();

            repository.deleteAssetFromPath(taskForm.getPkgName() + "/" + taskForm.getId()+"." + FORMTEMPLATE_FILE_EXTENSION);

            // create the form meta form asset
            AssetBuilder builder = AssetBuilderFactory.getAssetBuilder(Asset.AssetType.Byte);
            builder.name(taskForm.getId())
                   .location(location)
                    .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)) {
View Full Code Here

        Asset<String> themeAsset = null;
        try {
            boolean themeExists = repository.assetExists(this.globalDir + "/" + THEME_NAME + THEME_EXT);
            if (!themeExists) {
                // create theme asset
                AssetBuilder assetBuilder = AssetBuilderFactory.getAssetBuilder(Asset.AssetType.Text);
                assetBuilder.content(new String(getBytesFromFile(new File(themeInfo)), "UTF-8"))
                        .location(this.globalDir)
                        .name(THEME_NAME)
                        .type("json")
                        .version("1.0");

                themeAsset = assetBuilder.getAsset();

                repository.createAsset(themeAsset);

            } else {
                themeAsset = repository.loadAssetFromPath(this.globalDir + "/" + THEME_NAME + THEME_EXT);
View Full Code Here

    private String createAssetIfNotExisting(Repository repository, String location, String name, String type, byte[] content) {
        try {
            boolean assetExists = repository.assetExists(location + "/" + name + "." + type);
            if (!assetExists) {
                // create theme asset
                AssetBuilder assetBuilder = AssetBuilderFactory.getAssetBuilder(Asset.AssetType.Byte);
                assetBuilder.content(content)
                        .location(location)
                        .name(name)
                        .type(type)
                        .version("1.0");

                Asset<byte[]> customEditorsAsset = assetBuilder.getAsset();

                return repository.createAsset(customEditorsAsset);
            }

        } catch (Exception e) {
View Full Code Here

        String name = path.getFileName();
        String processId = buildProcessId( location, name );

        String processContent = PROCESS_STUB.replaceAll( "\\$\\{processid\\}", processId.replaceAll("\\s", "") );

        AssetBuilder builder = AssetBuilderFactory.getAssetBuilder( name );
        builder.location( location ).content( processContent ).uniqueId( path.toURI() );
        Asset<String> processAsset = builder.getAsset();

        repository.createAsset( processAsset );
        return path;
    }
View Full Code Here



    public static AssetBuilder getAssetBuilder(Asset.AssetType type) {
        if(type == Asset.AssetType.Text) {
            return new AssetBuilder(new TextAsset());
        } else if(type == Asset.AssetType.Byte) {
            return new AssetBuilder(new BinaryAsset());
        } else {
            throw new IllegalArgumentException("Unknown asset type " + type);
        }
    }
View Full Code Here

TOP

Related Classes of org.jbpm.designer.repository.impl.AssetBuilder

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.