Package org.dspace.app.xmlui.utils

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


     * DSpaceValidity object.
     */
    public SourceValidity getValidity() {
        if (this.validity == null) {
            try {
                DSpaceValidity validity = new DSpaceValidity();

                DSpaceObject scope = getScope();
                validity.add(scope);

                performSearch(scope);

                SolrDocumentList results = this.queryResults.getResults();

                if (results != null) {
                    validity.add("size:" + results.size());

                    for (SolrDocument result : results) {
                        validity.add(result.toString());
                    }
                }

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

View Full Code Here


    @Override
    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 reciently submitted items, serialize solr query contents.
//                QueryResponse response = getQueryResponse(dso);

//                validity.add("numFound:" + response.getResults().getNumFound());

//                for (SolrDocument doc : response.getResults()) {
//                    validity.add(doc.toString());
//                }
//
//                for (FacetField field : response.getFacetFields()) {
//                    validity.add(field.getName());
//
//                    for (FacetField.Count count : field.getValues()) {
//                        validity.add(count.getName() + "#" + count.getCount());
//                    }
//                }
//

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

            //TODO: dependent on tags as well :)
View Full Code Here

    {
        if (this.validity == null)
        {
            try
            {
                DSpaceValidity validity = new FeedValidity();
               
                Context context = ContextUtil.obtainContext(objectModel);

                DSpaceObject dso = null;
               
                if (handle != null && !handle.contains("site"))
                    dso = HandleManager.resolveToObject(context, handle);
               
                validity.add(dso);
               
                // add reciently submitted items
                for(Item item : getRecentlySubmittedItems(context,dso))
                {
                    validity.add(item);
                }

                this.validity = validity.complete();
            }
            catch (Exception e)
            {
                // Just ignore all errors and return an invalid 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);
             
              int objectCount = 0;
              while (!stack.empty())
              {
                objectCount++;
                  TreeNode node = stack.pop();
                 
                  validity.add(node.getDSO());
                 
                  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

    {
      if (this.validity == null)
      {
          try
          {
              DSpaceValidity validity = new DSpaceValidity();
             
              DSpaceObject scope = getScope();
              validity.add(scope);
             
              performSearch();
             
              @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 (Exception e)
          {
              // Just ignore all errors and return an invalid 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

      {
        // 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.
            }
View Full Code Here

      {
        // 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.
            }
View Full Code Here

              if (!(dso instanceof Community))
                  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);
              }
              // Sub collections
              for (Collection collection : collections)
              {
                  validity.add(collection);
              }
 
              // Recently submitted items
              for (BrowseItem item : getRecentlySubmittedIems(community))
              {
                  validity.add(item);
              }
             
              this.validity = validity.complete();
          }
          catch (Exception e)
          {
              // Ignore all errors and invalidate the cache.
          }
View Full Code Here

              if (!(dso instanceof Collection))
                  return null;
 
              Collection collection = (Collection) dso;
 
              DSpaceValidity validity = new DSpaceValidity();
             
              // Add the actual collection;
              validity.add(collection);
             
              // Add the eperson viewing the collection
              validity.add(eperson);
             
              // Include any groups they are a member of
              Group[] groups = Group.allMemberGroups(context, eperson);
              for (Group group : groups)
              {
                validity.add(group);
              }
             
              this.validity = validity.complete();
          }
          catch (Exception e)
          {
              // Just ignore all errors and return an invalid cache.
          }
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.