Package org.drools.repository

Examples of org.drools.repository.PackageItem.listAssetsByFormat()


    api.post("packages/testRestDelete/asset1.drl", new ByteArrayInputStream("123".getBytes()), "new comment");
    AssetItem ass = pkg.loadAsset("asset1");
    assertEquals("123", ass.getContent());
    assertEquals("new comment", ass.getCheckinComment());
    assertFalse(ass.isArchived());
    l = RulesRepositoryTest.iteratorToList(pkg.listAssetsByFormat(new String[] {"drl"}));
    assertEquals(1, l.size());

    try {
      api.post("packages/testRestDelete/asset1.drl", new ByteArrayInputStream("123".getBytes())"new comment");
      fail("this should be rejected as its not archived.");
View Full Code Here


        asset1.checkin("");

        RestAPI api = new RestAPI(repo);
        api.delete("packages/testRestDelete/asset1.drl");

        List l = RulesRepositoryTest.iteratorToList(pkg.listAssetsByFormat(new String[] {"drl"}));
        assertEquals(0, l.size());

        l = RulesRepositoryTest.iteratorToList(pkg.listArchivedAssets());
        assertEquals(1, l.size());
View Full Code Here

        api.post("packages/testRestDelete/asset1.drl", new ByteArrayInputStream("123".getBytes()), "new comment");
        AssetItem ass = pkg.loadAsset("asset1");
        assertEquals("123", ass.getContent());
        assertEquals("new comment", ass.getCheckinComment());
        assertFalse(ass.isArchived());
        l = RulesRepositoryTest.iteratorToList(pkg.listAssetsByFormat(new String[] {"drl"}));
        assertEquals(1, l.size());

        try {
            api.post("packages/testRestDelete/asset1.drl", new ByteArrayInputStream("123".getBytes())"new comment");
            fail("this should be rejected as its not archived.");
View Full Code Here

                //no format specified? Return all assets
                iter = p.getAssets();
            }else{
                //if the format is specified, return only the assets of
                //the specified formats.
                iter = p.listAssetsByFormat(formats);
            }
           
            while (iter.hasNext())
                feed.addEntry(toAssetEntryAbdera(iter.next(), uriInfo));
            return feed;
View Full Code Here

                //no format specified? Return all assets
                iter = p.getAssets();
            }else{
                //if the format is specified, return only the assets of
                //the specified formats.
                iter = p.listAssetsByFormat(formats);
            }
           
            while (iter.hasNext()) {
                ret.add(toAsset(iter.next(), uriInfo));
            }
View Full Code Here

    public String[] listTypesInPackage(String packageUUID) throws SerializationException {
        serviceSecurity.checkSecurityPackageReadOnlyWithPackageUuid( packageUUID );

        PackageItem pkg = this.rulesRepository.loadPackageByUUID( packageUUID );
        List<String> res = new ArrayList<String>();
        AssetItemIterator it = pkg.listAssetsByFormat( AssetFormats.MODEL,
                                                       AssetFormats.DRL_MODEL );

        JarInputStream jis = null;

        try {
View Full Code Here

                                            xml += "    </add>\n";
                                            xml += "</change-set>";
                                            out.write( xml.getBytes() );
                                        } else if ( req.getRequestURI().endsWith( "MODEL" ) ) {
                                            PackageItem pkg = fm.getRepository().loadPackage( helper.getPackageName() );
                                            AssetItemIterator it = pkg.listAssetsByFormat( AssetFormats.MODEL );
                                            BufferedInputStream inputFile = null;
                                            byte[] data = new byte[1000];
                                            int count = 0;
                                            int numberOfAssets = 0;
                                            while ( it.hasNext() ) {
View Full Code Here

        AssetItemIterator it;
        if ( request.getFormatInList() != null ) {
            if ( request.getFormatIsRegistered() != null ) {
                throw new IllegalArgumentException( "Combining formatInList and formatIsRegistered is not yet supported." );
            } else {
                it = packageItem.listAssetsByFormat( request.getFormatInList() );
            }
        } else {
            if ( request.getFormatIsRegistered() != null ) {
                it = packageItem.listAssetsNotOfFormat( AssetFormatHelper.listRegisteredTypes() );
            } else {
View Full Code Here

        }
        long start = System.currentTimeMillis();
        PackageItem pkg = repository.loadPackageByUUID( packageUuid );
        AssetItemIterator it;
        if ( formats.length > 0 ) {
            it = pkg.listAssetsByFormat( formats );
        } else {
            it = pkg.listAssetsNotOfFormat( AssetFormatHelper.listRegisteredTypes() );
        }
        TableDisplayHandler handler = new TableDisplayHandler( tableConfig );
        log.debug( "time for asset list load: " + (System.currentTimeMillis() - start) );
View Full Code Here

            Identity.instance().checkPermission( new PackageUUIDType( packageUUID ), "package.readoly" );
        }

        PackageItem pkg = this.repository.loadPackageByUUID( packageUUID );
        List<String> res = new ArrayList<String>();
        AssetItemIterator it = pkg.listAssetsByFormat( new String[]{AssetFormats.MODEL, AssetFormats.DRL_MODEL} );

        JarInputStream jis = null;

        try {
            while ( it.hasNext() ) {
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.