Package org.dspace.app.xmlui.utils

Examples of org.dspace.app.xmlui.utils.DSpaceValidity


    {
      if (this.validity == null)
      {
          try
          {
              DSpaceValidity validity = new DSpaceValidity();
             
              DSpaceObject scope = getScope();
              validity.add(scope);
             
              performSearch();

                validity.add("total:"+queryResults.getHitCount());
                validity.add("start:"+queryResults.getStart());
             
              @SuppressWarnings("unchecked") // This cast is correct
              java.util.List<String> handles = queryResults.getHitHandles();
              for (String handle : handles)
              {
                  DSpaceObject resultDSO = HandleManager.resolveToObject(context, handle);
                  validity.add(resultDSO);
              }
             
              this.validity = validity.complete();
            }
            catch (RuntimeException re)
            {
                throw re;
            }
View Full Code Here


                    return null;
                }
 
              collection = (Collection) dso;
 
              DSpaceValidity validity = new DSpaceValidity();
             
              // Add the actual collection;
              validity.add(collection);
 
              this.validity = validity.complete();
          }
          catch (Exception e)
          {
              // Just ignore all errors and return an invalid cache.
          }
View Full Code Here

                    return null;
                }

              collection = (Collection) dso;

              DSpaceValidity validity = new DSpaceValidity();

              // Add the actual collection;
              validity.add(collection);

              // add recently submitted items
              for(BrowseItem item : getRecentlySubmittedItems(collection))
              {
                  validity.add(item);
              }

              this.validity = validity.complete();
          }
          catch (Exception e)
          {
              // Just ignore all errors and return an invalid cache.
          }
View Full Code Here

                    return null;
                }
             
              community = (Community) dso;
             
              DSpaceValidity validity = new DSpaceValidity();
              validity.add(community);
             
              Community[] subCommunities = community.getSubcommunities();
              Collection[] collections = community.getCollections();
              // Sub communities
              for (Community subCommunity : subCommunities)
              {
                  validity.add(subCommunity);
                 
                  // Include the item count in the validity, only if the value is shown.
                  boolean showCount = ConfigurationManager.getBooleanProperty("webui.strengths.show");
                  if (showCount)
              {
                      try
                        int size = new ItemCounter(context).getCount(subCommunity);
                        validity.add("size:"+size);
                      } catch(ItemCountException e) { /* ignore */ }
              }
              }
              // Sub collections
              for (Collection collection : collections)
              {
                  validity.add(collection);
                 
                  // Include the item count in the validity, only if the value is shown.
                  boolean showCount = ConfigurationManager.getBooleanProperty("webui.strengths.show");
                  if (showCount)
              {
                      try {
                        int size = new ItemCounter(context).getCount(collection);
                        validity.add("size:"+size);
                      } catch(ItemCountException e) { /* ignore */ }
              }
              }

              this.validity = validity.complete();
          }
          catch (Exception e)
          {
              // Ignore all errors and invalidate the cache.
          }
View Full Code Here

        if (this.validity == null)
      {
          try {
              dso = HandleUtil.obtainHandle(objectModel);

              DSpaceValidity validity = new DSpaceValidity();
              validity.add(dso);
              this.validity =  validity.complete();
          }
          catch (Exception e)
          {
              // Ignore all errors and just invalidate the cache.
          }
View Full Code Here

    public SourceValidity getValidity()
    {
      if (validity == null)
      {
          try {
              DSpaceValidity validity = new DSpaceValidity();
             
              TreeNode root = buildTree(Community.findAllTop(context));
             
              Stack<TreeNode> stack = new Stack<TreeNode>();
              stack.push(root);
             
              while (!stack.empty())
              {
                  TreeNode node = stack.pop();
                 
                  validity.add(node.getDSO());
                 
                  // If we are configured to use collection strengths (i.e. item counts) then include that number in the validity.
                  boolean showCount = ConfigurationManager.getBooleanProperty("webui.strengths.show");
                  if (showCount)
              {
                      try
                      //try to determine Collection size (i.e. # of items)
                       
                        int size = new ItemCounter(context).getCount(node.getDSO());
                        validity.add("size:"+size);
                      }
                      catch(ItemCountException e) { /* ignore */ }
              }
                 
                 
                  for (TreeNode child : node.getChildren())
                  {
                      stack.push(child);
                  }
              }
             
              // Check if we are configured to assume validity.
              String assumeCacheValidity = ConfigurationManager.getProperty("xmlui.community-list.cache");
              if (assumeCacheValidity != null)
                {
                    validity.setAssumedValidityDelay(assumeCacheValidity);
                }
             
              this.validity = validity.complete();
          }
          catch (SQLException sqle)
          {
              // ignore all errors and return an invalid cache.
          }
View Full Code Here

     */
    public SourceValidity getValidity() {
        if (this.validity == null) {

            try {
                DSpaceValidity validity = new DSpaceValidity();

                DSpaceObject dso = HandleUtil.obtainHandle(objectModel);

                if (dso != null) {
                    // Add the actual collection;
                    validity.add(dso);
                }

                // add recently submitted items, serialize solr query contents.
                DiscoverResult response = getQueryResponse(dso);

                validity.add("numFound:" + response.getDspaceObjects().size());

                for (DSpaceObject resultDso : response.getDspaceObjects()) {
                    validity.add(resultDso);
                }

                for (String facetField : response.getFacetResults().keySet()) {
                    validity.add(facetField);

                    List<DiscoverResult.FacetResult> facetValues = response.getFacetResults().get(facetField);
                    for (DiscoverResult.FacetResult facetValue : facetValues) {
                        validity.add(facetValue.getAsFilterQuery() + facetValue.getCount());
                    }
                }


                this.validity = validity.complete();
            }
            catch (Exception e) {
                // Just ignore all errors and return an invalid cache.
            }

View Full Code Here

  public SourceValidity getValidity() {
    if (this.validity == null) {
      // Only use the DSpaceValidity object is someone is logged in.
      if (context.getCurrentUser() != null) {
        try {
          DSpaceValidity validity = new DSpaceValidity();

          validity.add(eperson);

          Group[] groups = Group.allMemberGroups(context, eperson);
          for (Group group : groups) {
            validity.add(group);
          }

          this.validity = validity.complete();
        } catch (SQLException sqle) {
          // Just ignore it and return invalid.
        }
      } else {
        this.validity = NOPValidity.SHARED_INSTANCE;
View Full Code Here

    {
        if (validity == null)
        {
            try
            {
                DSpaceValidity newValidity = new DSpaceValidity();
                DSpaceObject dso = HandleUtil.obtainHandle(objectModel);

                if (dso != null)
                {
                    newValidity.add(dso);
                }

                BrowseInfo info = getBrowseInfo();

                // Are we browsing items, or unique metadata?
                if (isItemBrowse(info))
                {
                    // Add the browse items to the validity
                    for (BrowseItem item : (java.util.List<BrowseItem>) info.getResults())
                    {
                        newValidity.add(item);
                    }
                }
                else
                {
                    // Add the metadata to the validity
                    for (String[] singleEntry : browseInfo.getStringResults())
                    {
                        newValidity.add(singleEntry[0]+"#"+singleEntry[1]);
                    }
                }

                validity = newValidity;
            }
View Full Code Here

    public SourceValidity getValidity() {
        if (this.validity == null) {

            try {
                DSpaceObject dso = HandleUtil.obtainHandle(objectModel);
                DSpaceValidity val = new DSpaceValidity();

                // Retrieve any facet results to add to the validity key
                performSearch();

                // Add the actual collection;
                if (dso != null)
                {
                    val.add(dso);
                }

                val.add("numFound:" + queryResults.getDspaceObjects().size());

                for (DSpaceObject resultDso : queryResults.getDspaceObjects()) {
                    val.add(resultDso);
                }

                for (String facetField : queryResults.getFacetResults().keySet()) {
                    val.add(facetField);

                    java.util.List<DiscoverResult.FacetResult> facetValues = queryResults.getFacetResults().get(facetField);
                    for (DiscoverResult.FacetResult facetValue : facetValues) {
                        val.add(facetField + facetValue.getAsFilterQuery() + facetValue.getCount());
                    }
                }

                this.validity = val.complete();
            }
            catch (Exception e) {
                log.error(e.getMessage(),e);
            }
            //TODO: dependent on tags as well :)
View Full Code Here

TOP

Related Classes of org.dspace.app.xmlui.utils.DSpaceValidity

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.