Package org.drools.repository

Examples of org.drools.repository.AssetHistoryIterator


            } else {
                base = uriInfo.getBaseUriBuilder().path("packages").path(asset.getPackageName()).path("assets").path(asset.getName()).path("versions");
            }
            f.setBaseUri(base.build().toString());
                       
            AssetHistoryIterator it = asset.getHistory();
            while (it.hasNext()) {
                    AssetItem historicalAsset = it.next();
                    if (historicalAsset.getVersionNumber() != 0) {
                        Entry e = factory.getAbdera().newEntry();
                        e.setTitle(Long.toString(historicalAsset
                                .getVersionNumber()));
                        e.setUpdated(historicalAsset.getLastModified().getTime());
View Full Code Here


          Text r = new Text();
          r.data = "";
          return r;
        }
        if (version.equals("all")) {
          AssetHistoryIterator it =  asset.getHistory();
          StringBuilder buf = new StringBuilder();
          while(it.hasNext()) {

            AssetItem h = it.next();

            if (h.getVersionNumber() != 0) {
              String checkinComment = h.getCheckinComment();
              //String lastMo ... hmm what is needed?
              String lastMofiedBy = h.getLastContributor();
              if (lastMofiedBy == null || lastMofiedBy.equals("")) {
                lastMofiedBy = asset.getCreator();
              }
              SimpleDateFormat sdf = getISODateFormat();
              Calendar lastModDate = h.getLastModified();
              if (lastModDate == null ) {
                lastModDate = asset.getCreatedDate();
              }
              String lastModifiedOn = sdf.format(lastModDate.getTime());
              buf.append(h.getVersionNumber());
              buf.append("=");
              buf.append(lastModifiedOn + "," + lastMofiedBy + "," + checkinComment);
              if (it.hasNext()) {
                buf.append('\n');
              }
            }

          }
          Text r = new Text();
          r.lastModified = asset.getLastModified();
          r.data = buf.toString();
          return r;
        } else {
          long versionNumber = Long.parseLong(version);
          AssetHistoryIterator it =  asset.getHistory();
          while (it.hasNext()) {
            AssetItem h = it.next();
            if (h.getVersionNumber() == versionNumber) {
              return buildAssetContentResponse(pkg, h);
            }
          }
          //hmm... we didn't find it
View Full Code Here

                        .path("packages/{packageName}/assets/{assetName}/versions")
                        .build(asset.getModuleName(), asset.getName());
            }
            f.setBaseUri(base.toString());
                       
            AssetHistoryIterator it = asset.getHistory();
            while (it.hasNext()) {
                    AssetItem historicalAsset = it.next();
                    if (historicalAsset.getVersionNumber() != 0) {
                        Entry e = factory.getAbdera().newEntry();
                        e.setTitle(Long.toString(historicalAsset
                                .getVersionNumber()));
                        e.setUpdated(historicalAsset.getLastModified().getTime());
View Full Code Here

          Text r = new Text();
          r.data = "";
          return r;
        }
        if (version.equals("all")) {
          AssetHistoryIterator it =  asset.getHistory();
          StringBuilder buf = new StringBuilder();
          while(it.hasNext()) {

            AssetItem h = it.next();

            if (h.getVersionNumber() != 0) {
              String checkinComment = h.getCheckinComment();
              //String lastMo ... hmm what is needed?
              String lastMofiedBy = h.getLastContributor();
              if (lastMofiedBy == null || lastMofiedBy.equals("")) {
                lastMofiedBy = asset.getCreator();
              }
              SimpleDateFormat sdf = getISODateFormat();
              Calendar lastModDate = h.getLastModified();
              if (lastModDate == null ) {
                lastModDate = asset.getCreatedDate();
              }
              String lastModifiedOn = sdf.format(lastModDate.getTime());
              buf.append(h.getVersionNumber());
              buf.append("=");
              buf.append(lastModifiedOn + "," + lastMofiedBy + "," + checkinComment);
              if (it.hasNext()) {
                buf.append('\n');
              }
            }

          }
          Text r = new Text();
          r.lastModified = asset.getLastModified();
          r.data = buf.toString();
          return r;
        } else {
          long versionNumber = Long.parseLong(version);
          AssetHistoryIterator it =  asset.getHistory();
          while (it.hasNext()) {
            AssetItem h = it.next();
            if (h.getVersionNumber() == versionNumber) {
              return buildAssetContentResponse(pkg, h);
            }
          }
          //hmm... we didn't find it
View Full Code Here

                        .path("packages/{packageName}/assets/{assetName}/versions")
                        .build(asset.getModuleName(), asset.getName());
            }
            f.setBaseUri(base.toString());
                       
            AssetHistoryIterator it = asset.getHistory();
            while (it.hasNext()) {
                    AssetItem historicalAsset = it.next();
                    if (historicalAsset.getVersionNumber() != 0) {
                        Entry e = factory.getAbdera().newEntry();
                        e.setTitle(Long.toString(historicalAsset
                                .getVersionNumber()));
                        e.setUpdated(historicalAsset.getLastModified().getTime());
View Full Code Here

        RepositoryAssetOperations repositoryAssetOperations = new RepositoryAssetOperations();
        repositoryAssetOperations.setRulesRepository( rulesRepository );

        AssetItem assetItem = mock( AssetItem.class );

        AssetHistoryIterator assetHistoryIterator = mock( AssetHistoryIterator.class );
        when( assetItem.getHistory() ).thenReturn( assetHistoryIterator );
        Calendar calendar = GregorianCalendar.getInstance();
        when( assetItem.getLastModified() ).thenReturn( calendar );

        TableDataResult result = repositoryAssetOperations.loadItemHistory( assetItem );
View Full Code Here

        RepositoryAssetOperations repositoryAssetOperations = new RepositoryAssetOperations();
        repositoryAssetOperations.setRulesRepository( rulesRepository );

        AssetItem assetItem = initializeAssetItemMockForLoadAssetHistory();

        AssetHistoryIterator assetHistoryIterator = mock( AssetHistoryIterator.class );
        when( assetItem.getHistory() ).thenReturn( assetHistoryIterator );
        when( assetHistoryIterator.hasNext() ).thenReturn( true,
                                                           false );
        AssetItem historicalAssetItem = initializeAssetItemHistoryMockForLoadAssetHistory( assetHistoryIterator );
        when( historicalAssetItem.getVersionNumber() ).thenReturn( 1324567L );
        Calendar calendar = GregorianCalendar.getInstance();
        when( historicalAssetItem.getLastModified() ).thenReturn( calendar );
View Full Code Here

        RepositoryAssetOperations repositoryAssetOperations = new RepositoryAssetOperations();
        repositoryAssetOperations.setRulesRepository( rulesRepository );

        AssetItem assetItem = initializeAssetItemMockForLoadAssetHistory();

        AssetHistoryIterator assetHistoryIterator = mock( AssetHistoryIterator.class );
        when( assetItem.getHistory() ).thenReturn( assetHistoryIterator );
        when( assetHistoryIterator.hasNext() ).thenReturn( true,
                                                           false );

        AssetItem historicalAssetItem = initializeAssetItemHistoryMockForLoadAssetHistory( assetHistoryIterator );
        when( historicalAssetItem.getVersionNumber() ).thenReturn( 123456L );
View Full Code Here

                    Text r = new Text();
                    r.data = "";
                    return r;
                }
                if (version.equals("all")) {
                    AssetHistoryIterator it =  asset.getHistory();
                    StringBuilder buf = new StringBuilder();
                    while(it.hasNext()) {

                        AssetItem h = it.next();

                        if (h.getVersionNumber() != 0) {
                            String checkinComment = h.getCheckinComment();
                            //String lastMo ... hmm what is needed?
                            String lastMofiedBy = h.getLastContributor();
                            if (lastMofiedBy == null || lastMofiedBy.equals("")) {
                                lastMofiedBy = asset.getCreator();
                            }
                            SimpleDateFormat sdf = getISODateFormat();
                            Calendar lastModDate = h.getLastModified();
                            if (lastModDate == null ) {
                                lastModDate = asset.getCreatedDate();
                            }
                            String lastModifiedOn = sdf.format(lastModDate.getTime());
                            buf.append(h.getVersionNumber());
                            buf.append("=");
                            buf.append(lastModifiedOn + "," + lastMofiedBy + "," + checkinComment);
                            if (it.hasNext()) {
                                buf.append('\n');
                            }
                        }

                    }
                    Text r = new Text();
                    r.lastModified = asset.getLastModified();
                    r.data = buf.toString();
                    return r;
                } else {
                    long versionNumber = Long.parseLong(version);
                    AssetHistoryIterator it =  asset.getHistory();
                    while (it.hasNext()) {
                        AssetItem h = it.next();
                        if (h.getVersionNumber() == versionNumber) {
                            return buildAssetContentResponse(pkg, h);
                        }
                    }
                    //hmm... we didn't find it
View Full Code Here

                        .path("packages/{packageName}/assets/{assetName}/versions")
                        .build(asset.getPackageName(), asset.getName());
            }
            f.setBaseUri(base.toString());
                       
            AssetHistoryIterator it = asset.getHistory();
            while (it.hasNext()) {
                    AssetItem historicalAsset = it.next();
                    if (historicalAsset.getVersionNumber() != 0) {
                        Entry e = factory.getAbdera().newEntry();
                        e.setTitle(Long.toString(historicalAsset
                                .getVersionNumber()));
                        e.setUpdated(historicalAsset.getLastModified().getTime());
View Full Code Here

TOP

Related Classes of org.drools.repository.AssetHistoryIterator

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.