Package org.dspace.content

Examples of org.dspace.content.Community


        }
      }
      if (errors.size() <= 0)
        message = T_col_export_success;
    } else if (request.getParameter("communityID") != null) {
      Community com = null;
      try {
        com = Community.find(context, Integer.parseInt(request
            .getParameter("communityID")));
      } catch (Exception e) {
        errors.add(T_export_bad_community_id);
View Full Code Here


    }
 
  public void addBody(Body body) throws WingException, SQLException, AuthorizeException
  {
    int communityID = parameters.getParameterAsInteger("communityID", -1);
    Community parentCommunity = Community.find(context, communityID);
   
    // DIVISION: main
      Division main = body.addInteractiveDivision("create-collection",contextPath+"/admin/collection",Division.METHOD_MULTIPART,"primary administrative collection");
      main.setHead(T_main_head.parameterize(parentCommunity.getMetadata("name")));
         
     
      // The grand list of metadata options
      List metadataList = main.addList("metadataList", "form");
     
View Full Code Here

                   
                    int topCommID = 1;
                    String topCommName = "m1";
                    boolean curSelectedIsTop = curCommCollSelectedName.equals(topCommName) ? true : false;
                   
                    Community mtop = Community.find(context, topCommID);
                    sortedHandleWithSolrName.put(Integer.parseInt(mtop.getHandle().split("/")[1]), topCommName);
                    sortedSolrNameWithDSpaceObject.put(topCommName, mtop);

                    Collection[] collections = mtop.getCollections();
                    for (Collection l : collections) {
                        String solrName = "l" + l.getID();
                        if (solrName.equals(curCommCollSelectedName))
                            curSelectedIsTop = true;
                        sortedHandleWithSolrName.put(Integer.parseInt(l.getHandle().split("/")[1]), solrName);
                        sortedSolrNameWithDSpaceObject.put(solrName, l);
                    }

                    Community[] communities = mtop.getSubcommunities();
                    for (Community mm : communities) {
                        String solrName = "m" + mm.getID();
                        if (solrName.equals(curCommCollSelectedName))
                            curSelectedIsTop = true;
                        sortedHandleWithSolrName.put(Integer.parseInt(mm.getHandle().split("/")[1]), solrName);
                        sortedSolrNameWithDSpaceObject.put(solrName, mm);
                    }
                    if (curSelectedIsTop == false) {
                        if (curCommCollSelectedType == Constants.COMMUNITY) {
                            Community msel = Community.find(context, curCommCollSelectedID);
                            Community[] parents = msel.getAllParents();
                            if (parents.length < 2) {
                                log.error("Something is wrong: this should not happen.");
                            }
                            Community topParent = parents[parents.length - 2];
                            curCommCollSelectedName = "m" + topParent.getID();
                        } else {
                            // Supposing Constants.COLLECTION
                            Collection lsel = Collection.find(context, curCommCollSelectedID);
                            Community firstParent = lsel.getCommunities()[0];
                            Community[] parents = firstParent.getAllParents();
                            if (parents.length == 0) {
                                //log.error("Something is wrong: this should not happen.");
                                //firstParent is a top community.
                                curCommCollSelectedName = "m" + firstParent.getID();
                            } else if (parents.length == 1) {
                                //firstParent is a second level community.
                                curCommCollSelectedName = "m" + firstParent.getID();
                            } else {
                                // get second level parent
                                Community topParent = parents[parents.length - 2];
                                curCommCollSelectedName = "m" + topParent.getID();
                            }
                        }
                    }
                    //                            Iterator<FacetField.Count> iter = sortedValues.values().iterator();
                    Iterator<String> iter = sortedHandleWithSolrName.values().iterator();
View Full Code Here

                            + collectionID);
        }
        else
        {
            // gather info for JSP page
            Community com = UIUtil.getCommunityLocation(request);

            Collection[] collections;

            if (com != null)
            {
View Full Code Here

        {
          this.validityKey.append("null")
        }
        else if (dso instanceof Community)
        {
            Community community = (Community) dso;

            validityKey.append("Community:");
            validityKey.append(community.getHandle());
            validityKey.append(community.getMetadata("introductory_text"));
            validityKey.append(community.getMetadata("short_description"));
            validityKey.append(community.getMetadata("side_bar_text"));
            validityKey.append(community.getMetadata("copyright_text"));
            validityKey.append(community.getMetadata("name"));
           
            // Add the communities logo
            this.add(community.getLogo());

        }
        else if (dso instanceof Collection)
        {
            Collection collection = (Collection) dso;
View Full Code Here

     */
    public SourceValidity getValidity()
    {
        if (this.validity == null)
      {
            Community community = null;
          try {
              DSpaceObject dso = HandleUtil.obtainHandle(objectModel);
             
              if (dso == null)
                  return null;
             
              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);
                }
             
              this.validity = validity.complete();

          }
          catch (Exception e)
          {
              // Ignore all errors and invalidate the cache.
          }

            log.info(LogManager.getHeader(context, "view_community", "community_id=" + (community == null ? "" : community.getID())));

        }


        return this.validity;
View Full Code Here

        DSpaceObject dso = HandleUtil.obtainHandle(objectModel);
        if (!(dso instanceof Community))
            return;

        // Set up the major variables
        Community community = (Community) dso;
        // Set the page title
        String name = community.getMetadata("name");
        if (name == null || name.length() == 0)
          pageMeta.addMetadata("title").addContent(T_untitled);
        else
          pageMeta.addMetadata("title").addContent(name);

        // Add the trail back to the repository root.
        pageMeta.addTrailLink(contextPath + "/",T_dspace_home);
        HandleUtil.buildHandleTrail(community, pageMeta,contextPath);
       
        // Add RSS links if available
        String formats = ConfigurationManager.getProperty("webui.feed.formats");
    if ( formats != null )
    {
      for (String format : formats.split(","))
      {
        // Remove the protocol number, i.e. just list 'rss' or' atom'
        String[] parts = format.split("_");
        if (parts.length < 1)
          continue;
       
        String feedFormat = parts[0].trim()+"+xml";
         
        String feedURL = contextPath+"/feed/"+format.trim()+"/"+community.getHandle();
        pageMeta.addMetadata("feed", feedFormat).addContent(feedURL);
      }
    }
    }
View Full Code Here

        DSpaceObject dso = HandleUtil.obtainHandle(objectModel);
        if (!(dso instanceof Community))
            return;

        // Set up the major variables
        Community community = (Community) dso;
        Community[] subCommunities = community.getSubcommunities();
        Collection[] collections = community.getCollections();


        // Build the community viewer division.
        Division home = body.addDivision("community-home", "primary repository community");
        String name = community.getMetadata("name");
        if (name == null || name.length() == 0)
          home.setHead(T_untitled);
        else
          home.setHead(name);
View Full Code Here

     */
    public SourceValidity getValidity()
    {
        if (this.validity == null)
      {
            Community community = null;
          try {
              DSpaceObject dso = HandleUtil.obtainHandle(objectModel);

              if (dso == null)
                  return null;

              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);
              }

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

            log.info(LogManager.getHeader(context, "view_community", "community_id=" + (community == null ? "" : community.getID())));
      }
        return this.validity;
    }
View Full Code Here

        if (!(dso instanceof Community))
            return;

        // Set up the major variables
        Community community = (Community) dso;

        // Build the community viewer division.
        Division home = body.addDivision("community-home", "primary repository community");
        String name = community.getMetadata("name");
        if (name == null || name.length() == 0)
          home.setHead(T_untitled);
        else
          home.setHead(name);

        // The search / browse box.

        {
            Division search = home.addDivision("community-search-browse",
                    "secondary search-browse");

            // Search query
            Division query = search.addInteractiveDivision("community-search",
                    contextPath + "/handle/" + community.getHandle() + "/search",
                    Division.METHOD_POST, "secondary search");

            Para para = query.addPara("search-query", null);
            para.addContent(T_full_text_search);
            para.addContent(" ");
View Full Code Here

TOP

Related Classes of org.dspace.content.Community

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.