Package org.dspace.app.cris.statistics

Examples of org.dspace.app.cris.statistics.SummaryStatBean


        int type = UIUtil.getIntParameter(arg0, "type");
        String feedType = arg0.getParameter("feedtype");
        Context context = UIUtil.obtainContext(arg0);
        int numsFeed = ConfigurationManager.getIntProperty("webui.feed.stats",
                4);
        SummaryStatBean summary = statSubscribeService.getStatBean(context,
                uid, type, freq, numsFeed);
        StatSyndicationFeed feed = new StatSyndicationFeed();

        if (StringUtils.isEmpty(feedType) || !formats.contains(feedType))
        {
View Full Code Here


        {
            throw new IllegalArgumentException(
                    "UUID not specified");
        }

        SummaryStatBean statBean = new SummaryStatBean();
        statBean.setFreq(freq);
        String dateType = null;
        String dateStart = null;
        String dateEnd = null;
        int gap = 1;
        context.setAutoCommit(false);
        for (int i = 0; i < num; i++)
        {
            switch (freq)
            {
            case StatSubscription.FREQUENCY_DAILY:
                dateType = "DAY";
                dateStart = "-" + (num - i);
                dateEnd = "-" + (num - 1 - i);
                break;

            case StatSubscription.FREQUENCY_WEEKLY:
                Calendar c = Calendar.getInstance();
                int dayOfWeek = c.get(Calendar.DAY_OF_WEEK);

                // se domenica allora vale 1
                // se lunedi' vale vale 2, etc
                // sabato 7
                dateType = "DAY";
                gap = 7;
                dateStart = "-"
                        + (7 * (num - i) + (dayOfWeek - 1 > 0 ? dayOfWeek - 1
                                : dayOfWeek - 1 + 7));
                dateEnd = "-"
                        + (7 * (num - i - 1) + (dayOfWeek - 1 > 0 ? dayOfWeek - 1
                                : dayOfWeek - 1 + 7));
                break;

            case StatSubscription.FREQUENCY_MONTHLY:
                dateType = "MONTH";
                dateStart = "-" + (num - i);
                dateEnd = "-" + (num - 1 - i);
                break;
            default:
                throw new IllegalArgumentException("Unknow frequency " + freq);
            }
           
            Researcher researcher = new Researcher();
            Map<String, Map<String,ObjectCount[]>> selectedObject = new HashMap<String, Map<String,ObjectCount[]>>();
            Map<String, Map<String,ObjectCount[]>> topObject = new TreeMap<String, Map<String,ObjectCount[]>>();
            if (type >= 9)
            {

                ACrisObject object = as.getEntityByUUID(uuid);
                String persistentIdentifier = ResearcherPageUtils
                        .getPersistentIdentifier(object);

                statBean.setObject(object);
                statBean.setObjectName(object.getName());

                statBean.setObjectURL(ConfigurationManager
                        .getProperty("dspace.url")
                        + "/cris/"
                        + object.getPublicPath() + "/" + persistentIdentifier);
                statBean.setStatURL(ConfigurationManager
                        .getProperty("dspace.url")
                        + "/cris/stats/"
                        + object.getPublicPath()
                        + ".html?id="
                        + object.getUuid());

                statBean.setType(object.getType());
                               
                selectedObject = new HashMap<String, Map<String,ObjectCount[]>>();
               
                CrisStatComponentsService statsComponentsService = null;
                switch (type)
                {
                case 9:
                    statsComponentsService = researcher.getRPStatsComponents();
                    break;
                case 10:
                    statsComponentsService = researcher.getPJStatsComponents();
                    break;
                case 11:
                    statsComponentsService = researcher.getOUStatsComponents();
                    break;
                default:
                    break;
                }
                selectedObject.put(AStatComponentService._SELECTED_OBJECT, statsComponentsService.getSelectedObjectComponent().getStatsViewComponent().queryFacetDate(statsLogger, object, dateType, dateStart, dateEnd, gap));
                selectedObject.get(AStatComponentService._SELECTED_OBJECT).putAll(statsComponentsService.getSelectedObjectComponent().getStatsDownloadComponent().queryFacetDate(statsLogger, object, dateType, dateStart, dateEnd, gap));               
                for(String key : statsComponentsService.getComponents().keySet()) {
                    IStatsComponent dual = statsComponentsService.getComponents().get(key).getStatsViewComponent();
                    topObject.put(key, dual.queryFacetDate(statsLogger, object, dateType, dateStart, dateEnd, gap));
                    dual = statsComponentsService.getComponents().get(key).getStatsDownloadComponent();
                    topObject.get(key).putAll(dual.queryFacetDate(statsLogger, object, dateType, dateStart, dateEnd, gap));
                }
            }
            else
            {
               
                DSpaceObject dso = HandleManager.resolveToObject(context,
                        uuid);
                if (dso == null)
                {
                    throw new IllegalArgumentException("Invalid handle: "
                            + uuid + " DSpace object not found");
                }

                statBean.setObject(dso);
                statBean.setObjectName(dso.getName());
                statBean.setObjectURL(ConfigurationManager
                        .getProperty("dspace.url") + "/handle/" + uuid);
                statBean.setType(dso.getType());
                switch (dso.getType())
                {
                case Constants.ITEM:
                   
                    StatComponentsService serviceItem = researcher.getItemStatsComponents();
                    retrieveResults(dateType, dateStart, dateEnd, gap,
                            selectedObject, topObject, dso, serviceItem);
               
                    statBean.setStatURL(ConfigurationManager
                            .getProperty("dspace.url")
                            + "/cris/stats/item.html?handle=" + uuid);
                    break;

                case Constants.COLLECTION:

                    StatComponentsService serviceColl = researcher.getCollectionStatsComponents();
                    retrieveResults(dateType, dateStart, dateEnd, gap,
                            selectedObject, topObject, dso, serviceColl);
                 
                    statBean.setStatURL(ConfigurationManager
                            .getProperty("dspace.url")
                            + "/cris/stats/collection.html?handle=" + uuid);
                    break;

                case Constants.COMMUNITY:
                   
                    StatComponentsService serviceComm = researcher.getCommunityStatsComponents();
                    retrieveResults(dateType, dateStart, dateEnd, gap,
                            selectedObject, topObject, dso, serviceComm);
                   
                    statBean.setStatURL(ConfigurationManager
                            .getProperty("dspace.url")
                            + "/cris/stats/community.html?handle=" + uuid);
                    break;

                default:
View Full Code Here

                {
                    changedType = true;
                    r = 0;
                }
                oldType = statSub.getTypeDef();
                SummaryStatBean statdetails = getStatBean(context, service,
                        statSub);

                r++;
                if (statdetails == null)
                    continue;

                SummaryStatBean.StatDataBean statDataBean = statdetails
                        .getData().get(0);

                if (changedType)
                {
                    sheet = workbook.createSheet(I18nUtil.getMessage("it.cilea.hku.statistics.Subscribe.sheet." + statdetails.getType()),
                            sheetNumber);
                    WritableFont labelFont = new WritableFont(
                            WritableFont.ARIAL, 10, WritableFont.BOLD);
                    WritableCellFormat cfobj = new WritableCellFormat(labelFont);
                    sheet.addCell(new Label(
                            0,
                            0,
                            I18nUtil.getMessage("it.cilea.hku.statistics.Subscribe.type"),
                            cfobj));
                    sheet.addCell(new Label(
                            1,
                            0,
                            I18nUtil.getMessage("it.cilea.hku.statistics.Subscribe.name"),
                            cfobj));
                    sheet.addCell(new Label(
                            2,
                            0,
                            I18nUtil.getMessage("it.cilea.hku.statistics.Subscribe.url"),
                            cfobj));
                    sheet.addCell(new Label(
                            3,
                            0,
                            I18nUtil.getMessage("it.cilea.hku.statistics.Subscribe.totalView"),
                            cfobj));
                    sheet.addCell(new Label(4, 0, I18nUtil
                            .getMessage("it.cilea.hku.statistics.Subscribe."
                                    + sfreq + "View"), cfobj));

                    int headerCell = 4;
                    if (statDataBean.isShowSelectedObjectDownload())
                    {
                        sheet.addCell(new Label(
                                ++headerCell,
                                0,
                                I18nUtil.getMessage("it.cilea.hku.statistics.Subscribe.totalDownload"),
                                cfobj));
                        sheet.addCell(new Label(++headerCell, 0, I18nUtil
                                .getMessage("it.cilea.hku.statistics.Subscribe."
                                        + sfreq + "Download"), cfobj));
                    }
                    for (String topKey : statDataBean
                            .getPeriodAndTotalTopView().keySet())
                    {
                        if (!statDataBean.getPeriodAndTotalTopView()
                                .get(topKey).isEmpty())
                        {
                            sheet.addCell(new Label(
                                    ++headerCell,
                                    0,
                                    I18nUtil.getMessage("it.cilea.hku.statistics.Subscribe.total"
                                            + topKey + "View"), cfobj));
                            sheet.addCell(new Label(
                                    ++headerCell,
                                    0,
                                    I18nUtil.getMessage("it.cilea.hku.statistics.Subscribe."
                                            + sfreq + topKey + "View"), cfobj));
                        }
                    }
                    for (String topKey : statDataBean
                            .getPeriodAndTotalTopDownload().keySet())
                    {
                        if (!statDataBean.getPeriodAndTotalTopDownload()
                                .get(topKey).isEmpty())
                        {
                            sheet.addCell(new Label(
                                    ++headerCell,
                                    0,
                                    I18nUtil.getMessage("it.cilea.hku.statistics.Subscribe.total"
                                            + topKey + "Download"), cfobj));
                            sheet.addCell(new Label(
                                    ++headerCell,
                                    0,
                                    I18nUtil.getMessage("it.cilea.hku.statistics.Subscribe."
                                            + sfreq + topKey + "Download"), cfobj));
                        }
                    }
                    for (int i = 0; i < headerCell; i++)
                    {
                        final CellView view = sheet.getColumnView(i);
                        view.setAutosize(true);
                        sheet.setColumnView(i, view);
                    }
                    sheetNumber++;
                }
                sheet.addCell(new Label(0, r, I18nUtil
                        .getMessage("it.cilea.hku.statistics.Subscribe.type."
                                + statdetails.getType())));
                sheet.addCell(new Label(1, r, statdetails.getObjectName()));
                sheet.addCell(new Label(2, r, statdetails.getObjectURL()));
                if (statDataBean.getTotalSelectedView() == -1)
                {
                    sheet.addCell(new Label(3, r, I18nUtil
                            .getMessage("it.cilea.hku.statistics.Subscribe.na")));
                }
View Full Code Here

TOP

Related Classes of org.dspace.app.cris.statistics.SummaryStatBean

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.