Package org.dspace.app.cris.statistics.bean

Examples of org.dspace.app.cris.statistics.bean.PieStatisticBean


    @Override
    public TwoKeyMap getLabels(Context context, String type) throws SQLException
    {
        TwoKeyMap labels = new TwoKeyMap();
        PieStatisticBean myvalue = (PieStatisticBean) statisticDatasBeans
                .get("top").get(type).get("id");
        if (myvalue != null)
        {
            if (myvalue.getLimitedDataTable() != null)
            {
                for (StatisticDatasBeanRow row : myvalue.getLimitedDataTable())
                {                  
                    DSpaceObject item = DSpaceObject.find(context, getRelationObjectType(), Integer.parseInt(row.getLabel()));
//                    if (item != null)
                    {
                        labels.addValue(type, row.getLabel(), item);
View Full Code Here


    @Override
    public TwoKeyMap getLabels(Context context, String type) throws SQLException
    {
       
        TwoKeyMap labels = new TwoKeyMap();
        PieStatisticBean myvalue = (PieStatisticBean) statisticDatasBeans
                .get("top").get(type).get("id");
        if (myvalue != null)
        {
            if (myvalue.getLimitedDataTable() != null)
            {
                for (StatisticDatasBeanRow row : myvalue.getLimitedDataTable())
                {                  
                    Item item = Item.find(context, Integer.parseInt(row.getLabel()));
//                    if (item != null)
                    {
                        labels.addValue(type, row.getLabel(), item);
View Full Code Here

        if(getRelationObjectType()==Constants.ITEM) {
            return super.getLabels(context, type);
        }
        TwoKeyMap labels = new TwoKeyMap();

        PieStatisticBean myvalue = (PieStatisticBean) statisticDatasBeans
                .get("top").get(type).get("id");
        if (myvalue != null)
        {
            if (myvalue.getLimitedDataTable() != null)
            {
                for (StatisticDatasBeanRow row : myvalue.getLimitedDataTable())
                {
                    String pkey = (String)row.getLabel();
                   
                    ACrisObject object = ResearcherPageUtils.getCrisObject(Integer.parseInt(pkey), getRelationObjectClass());
                   
View Full Code Here

    }

    public PieStatisticBean generateFacetFieldView(String key1, String key2,
            String key3, Integer hitsNumber)
    {
        PieStatisticBean pieStatisticBean = new PieStatisticBean(key1, key2,
                key3);
        pieStatisticBean.setName(key2);
        Collection<StatisticDatasBeanRow> fullData = new ArrayList<StatisticDatasBeanRow>();
        Collection<StatisticDatasBeanRow> limitedData = new ArrayList<StatisticDatasBeanRow>();
        try
        {
            NamedList result = (NamedList) ((SimpleOrderedMap) ((SimpleOrderedMap) solrResponse
                    .getResponse().get("facet_counts")).get("facet_fields"))
                    .get(key3);
            int limit = result.size();
            if (key3.equals(_CONTINENT) && hitsNumber != null && hitsNumber > 0)
            {
                limit = hitsNumber;
            }
            else if (key3.equals(_COUNTRY_CODE) && hitsNumber != null
                    && hitsNumber > 0)
            {
                limit = hitsNumber;
            }
            if (key3.equals(_CITY) && hitsNumber != null && hitsNumber > 0)
            {
                limit = hitsNumber;
            }

            Integer other = 0;

            for (int i = 0; i < result.size(); i++)
            {
                try
                {
                    if (result.getVal(i).getClass().equals(Integer.class))
                    {
                        String name = (String) result.getName(i);
                        if (StringUtils.isEmpty(name))
                            name = "Unknown";
                        // if (i<limit && (Integer)result.getVal(i)>0){
                        if (i < limit && !name.equals("Unknown"))
                        {
                            limitedData.add(new StatisticDatasBeanRow(name,
                                    result.getVal(i)));
                        }
                        else
                        {
                            other += (Integer) result.getVal(i);
                        }
                        fullData.add(new StatisticDatasBeanRow(name, result
                                .getVal(i)));
                    }

                }
                catch (Exception e)
                {
                    fullData.add(new StatisticDatasBeanRow(_NotAvailable, null));
                    limitedData.add(new StatisticDatasBeanRow(_NotAvailable,
                            null));
                    e.printStackTrace();
                }
            }
            if (result.size() > limit && other > 0)
            {
                limitedData.add(new StatisticDatasBeanRow(_OTHER, other));
            }
            pieStatisticBean.setHits(result.size());
            pieStatisticBean.setDataTable(fullData);
            pieStatisticBean.setLimitedDataTable(limitedData);
            try
            {
                pieStatisticBean.setPercentages();
            }
            catch (Exception e)
            {
                e.printStackTrace();
            }
View Full Code Here

    public PieStatisticBean generateCategoryView(SolrServer server,
            String key1, String key2, String key3, Integer hitsNumber,
            String query, Map<String, String> subQueries, String id)
    {
        PieStatisticBean pieStatisticBean = new PieStatisticBean(key1, key2,
                key3);
        pieStatisticBean.setName(key2);
        Collection<StatisticDatasBeanRow> fullData = new ArrayList<StatisticDatasBeanRow>();
        Collection<StatisticDatasBeanRow> limitedData = new ArrayList<StatisticDatasBeanRow>();
        try
        {
            int totalHit = 0;
            for (String key : subQueries.keySet())
            {
                String q = "";
                try
                {
                    String name = key;
                    SolrQuery solrQuery = new SolrQuery();
                    q = query + " AND ("
                            + MessageFormat.format(subQueries.get(key), null,
                                    id) + ")";
                    solrQuery.setQuery(q);
                    if (StringUtils.isEmpty(name))
                        name = "Unknown";

                    int count = new Long(server.query(solrQuery).getResults().getNumFound()).intValue();
                    limitedData.add(new StatisticDatasBeanRow(name, count));
                    totalHit += count;

                }
                catch (Exception e)
                {
                    limitedData.add(new StatisticDatasBeanRow(_NotAvailable,
                            null));
                    e.printStackTrace();
                }
            }

            pieStatisticBean.setHits(totalHit);
            pieStatisticBean.setDataTable(fullData);
            pieStatisticBean.setLimitedDataTable(limitedData);
            try
            {
                pieStatisticBean.setPercentages();
            }
            catch (Exception e)
            {
                e.printStackTrace();
            }
View Full Code Here

            throws SQLException
    {

        TwoKeyMap labels = new TwoKeyMap();

        PieStatisticBean myvalue = (PieStatisticBean) statisticDatasBeans
                .get("top").get(type).get("sectionid");
        if (myvalue != null)
        {
            if (myvalue.getLimitedDataTable() != null)
            {
                for (StatisticDatasBeanRow row : myvalue.getLimitedDataTable())
                {
                    String pkey = (String) row.getLabel();

                    PropertiesDefinition def = innerCall(Integer.parseInt(pkey));
View Full Code Here

            throws SQLException
    {

        TwoKeyMap labels = new TwoKeyMap();

        PieStatisticBean myvalue = (PieStatisticBean) statisticDatasBeans
                .get("selectedObject").get("geo").get("sectionid");
        if (myvalue != null)
        {
            if (myvalue.getLimitedDataTable() != null)
            {
                for (StatisticDatasBeanRow row : myvalue.getLimitedDataTable())
                {
                    String pkey = (String)row.getLabel();
                   
                    PropertiesDefinition def = innerCall(Integer.parseInt(pkey));
                          
View Full Code Here

    public TwoKeyMap getLabels(Context context, String type) throws SQLException
    {

        TwoKeyMap labels = new TwoKeyMap();

        PieStatisticBean myvalue = (PieStatisticBean) statisticDatasBeans
                .get("top").get(type).get("id");
        if (myvalue != null)
        {
            if (myvalue.getLimitedDataTable() != null)
            {
                for (StatisticDatasBeanRow row : myvalue.getLimitedDataTable())
                {
                    Bitstream bitstream = Bitstream.find(context,
                            Integer.parseInt(row.getLabel()));

                    SolrQuery solrQuery = new SolrQuery();
View Full Code Here

TOP

Related Classes of org.dspace.app.cris.statistics.bean.PieStatisticBean

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.