Package org.drools.guvnor.server.contenthandler

Examples of org.drools.guvnor.server.contenthandler.ContentHandler


                                                 newName );
    }

    protected BuilderResult validateAsset(RuleAsset asset) {
        try {
            ContentHandler handler = ContentManager
                    .getHandler( asset.metaData.format );
            AssetItem item = getRulesRepository().loadAssetByUUID( asset.uuid );

            handler.storeAssetContent( asset,
                                       item );

            AssetItemValidator assetItemValidator = new AssetItemValidator( handler,
                                                                            item );
            return assetItemValidator.validate();
View Full Code Here


        repoAsset.updateDateExpired( dateToCalendar( meta.getDateExpired() ) );

        repoAsset.updateCategoryList( meta.getCategories() );
        repoAsset.updateDescription( asset.getDescription() );

        ContentHandler handler = ContentManager.getHandler( repoAsset.getFormat() );
        handler.storeAssetContent( asset,
                                   repoAsset );

        if ( !(asset.getMetaData().getFormat().equals( AssetFormats.TEST_SCENARIO )) || asset.getMetaData().getFormat().equals( AssetFormats.ENUMERATION ) ) {
            PackageItem pkg = repoAsset.getPackage();
            pkg.updateBinaryUpToDate( false );
View Full Code Here

                                          numRows );
    }

    // TODO: Very hard to unit test -> needs refactoring
    protected String buildAssetSource(RuleAsset asset) throws SerializationException {
        ContentHandler handler = ContentManager.getHandler( asset.getMetaData().getFormat() );

        StringBuilder stringBuilder = new StringBuilder();
        if ( handler.isRuleAsset() ) {
            BRMSPackageBuilder builder = new BRMSPackageBuilder();
            // now we load up the DSL files
            PackageItem packageItem = getRulesRepository().loadPackage( asset.getMetaData().getPackageName() );
            builder.setDSLFiles( DSLLoader.loadDSLMappingFiles( packageItem ) );
            if ( asset.getMetaData().isBinary() ) {
                AssetItem item = getRulesRepository().loadAssetByUUID(
                                                                       asset.getUuid() );

                handler.storeAssetContent( asset,
                                           item );
                ((IRuleAsset) handler).assembleDRL( builder,
                                                    item,
                                                    stringBuilder );
            } else {
View Full Code Here

        asset.setDateCreated( item.getCreatedDate().getTime() );
        asset.setCheckinComment( item.getCheckinComment() );
        asset.setVersionNumber( item.getVersionNumber() );

        asset.setMetaData( populateMetaData( item ) );
        ContentHandler handler = ContentManager.getHandler( asset.getMetaData().getFormat() );
        handler.retrieveAssetContent( asset,
                                      item );

        return asset;
    }
View Full Code Here

    }


    private AssetItem getAssetItem(RuleAsset asset) throws SerializationException {
        AssetItem assetItem = getAssetService().getRulesRepository().loadAssetByUUID(asset.uuid);
        ContentHandler contentHandler = ContentManager.getHandler(asset.metaData.format);
        contentHandler.storeAssetContent(asset, assetItem);
        return assetItem;
    }
View Full Code Here

    /**
     * Builds assets that are "rule" assets (ie things that are not functions
     * etc).
     */
    protected void buildAsset(AssetItem asset) {
        ContentHandler contentHandler = ContentManager.getHandler( asset.getFormat() );

        if ( contentHandler instanceof ICompilable && !asset.getDisabled() ) {
            try {
                compile( asset,
                         (ICompilable) contentHandler );
View Full Code Here

    private PackageItem handlePackageItem(AssetItem item,
                                          RuleAsset asset) throws SerializationException {
        PackageItem packageItem = item.getPackage();

        ContentHandler handler = ContentManager.getHandler(asset.getMetaData().getFormat());
        handler.retrieveAssetContent(asset,
                item);

        asset.setReadonly(asset.getMetaData().isHasSucceedingVersion());

        if (packageItem.isSnapshot()) {
View Full Code Here

            }

            log.info("USER:" + getCurrentUserName() + " ARCHIVING asset: [" + item.getName() + "] UUID: [" + item.getUUID() + "] ");

            try {
                ContentHandler handler = getContentHandler(item);
                if (handler instanceof ICanHasAttachment) {
                    ((ICanHasAttachment) handler).onAttachmentRemoved(item);
                }
            } catch (IOException e) {
                log.error("Unable to remove asset attachment",
View Full Code Here

        }
    }

    private void addRuleAsset(AssetItem asset) {
        if (!asset.isArchived() && !asset.getDisabled()) {
            ContentHandler handler = ContentManager.getHandler(asset.getFormat());
            if (handler.isRuleAsset()) {
                IRuleAsset ruleAsset = (IRuleAsset) handler;
                ruleAsset.assembleDRL(builder,
                        asset,
                        src);
            }
View Full Code Here

        item.updateBinaryContentAttachmentFileName( fileName );
        item.getPackage().updateBinaryUpToDate( false );
        item.checkin( "Attached file: " + fileName );

        // Special treatment for model and ruleflow attachments.
        ContentHandler handler = ContentManager.getHandler( item.getFormat() );
        if ( handler instanceof ICanHasAttachment ) {
            ((ICanHasAttachment) handler).onAttachmentAdded( item );
        }

    }
View Full Code Here

TOP

Related Classes of org.drools.guvnor.server.contenthandler.ContentHandler

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.