Package org.apache.stratos.usage.beans

Examples of org.apache.stratos.usage.beans.PaginatedInstanceUsage


     */
    public PaginatedInstanceUsage retrievePaginatedInstanceUsage(String yearMonth, int pageNumber,
                                                                 int entriesPerPage) throws Exception {
        InstanceUsageStatics[] instanceUsages = retrieveInstanceUsage();
        List<InstanceUsageStatics> instanceUsagesList = new ArrayList<InstanceUsageStatics>();
        PaginatedInstanceUsage paginatedInstanceUsages = new PaginatedInstanceUsage();
        int i = 0;
        int numberOfPages = 0;
        if (instanceUsages != null && instanceUsages.length > 0) {
            for (InstanceUsageStatics usage : instanceUsages) {
                InstanceUsageStatics instance = getValidUsageEntry(usage, yearMonth);
                if (instance != null) {
                    if (i % entriesPerPage == 0) {
                        numberOfPages++;
                    }
                }
            }

            paginatedInstanceUsages.setInstanceUsages(
                instanceUsagesList.toArray(new InstanceUsageStatics[instanceUsagesList.size()]));
        } else {
            paginatedInstanceUsages.setInstanceUsages(null);
        }

        paginatedInstanceUsages.setNumberOfPages(numberOfPages);
        paginatedInstanceUsages.setPageNumber(pageNumber);
        return paginatedInstanceUsages;
    }
View Full Code Here

TOP

Related Classes of org.apache.stratos.usage.beans.PaginatedInstanceUsage

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.