Package org.dspace.content

Examples of org.dspace.content.Community


        }
    }

    public Object getPolicies(EntityReference ref, UserRequestParams uparams, Context context) {
        try {
            Community res = Community.find(context, Integer.parseInt(ref.getId()));
//            AuthorizeManager.authorizeAction(context, res, Constants.READ);
            List<Object> entities = new ArrayList<Object>();

            List<ResourcePolicy> policies = AuthorizeManager.getPolicies(context, res);
            for (ResourcePolicy policy : policies) {
View Full Code Here


                return;
        }
      }
      JSPManager.showJSP(request, response, "/mydspace/task-complete.jsp");
    } else if (request.getParameter("community_id") != null) {
      Community com = null;
      try {
        com = Community.find(context, Integer.parseInt(request
            .getParameter("community_id")));
      } catch (Exception e) {
        log.warn(LogManager.getHeader(context, "integrity_error", UIUtil
View Full Code Here

            // Short circuit if we have reached our max depth.
            if (node.getLevel() >= this.depth)
                continue;

            // Only communities nodes are pushed on the stack.
            Community community = (Community) node.getDSO();

            for (Community subcommunity : community.getSubcommunities())
            {
                stack.push(node.addChild(subcommunity));
            }

            // Add any collections to the document.
            if (!excludeCollections)
            {
                for (Collection collection : community.getCollections())
                {
                    node.addChild(collection);
                }
            }
        }
View Full Code Here

            return collection;
        }
        else if (handletypeid == Constants.COMMUNITY)
        {
            Community community = Community.find(context, resourceID);

            if (log.isDebugEnabled())
            {
                log.debug("Resolved handle " + handle + " to community "
                        + ((community == null) ? (-1) : community.getID()));
            }

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

        // 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(" ");
            para.addText("query");
            para.addContent(" ");
            para.addButton("submit").setValue(T_go);
            query.addPara().addXref(contextPath + "/handle/" + community.getHandle() + "/advanced-search", T_advanced_search_link);

            // Browse by list
            Division browseDiv = search.addDivision("community-browse","secondary browse");
            List browse = browseDiv.addList("community-browse", List.TYPE_SIMPLE,
                    "community-browse");
            browse.setHead(T_head_browse);
            String url = contextPath + "/handle/" + community.getHandle();

            try
            {
                // Get a Map of all the browse tables
                BrowseIndex[] bis = BrowseIndex.getBrowseIndices();
View Full Code Here

        /*
         * Most of the forms supply one or more of these values. Since we just
         * get null if we try and find something with ID -1, we'll just try and
         * find both here to save hassle later on
         */
        Community community = Community.find(context, UIUtil.getIntParameter(
                request, "community_id"));
        Community parentCommunity = Community.find(context, UIUtil
                .getIntParameter(request, "parent_community_id"));
        Collection collection = Collection.find(context, UIUtil
                .getIntParameter(request, "collection_id"));

        // Just about every JSP will need the values we received
        request.setAttribute("community", community);
        request.setAttribute("parent", parentCommunity);
        request.setAttribute("collection", collection);

        /*
         * First we check for a "cancel" button - if it's been pressed, we
         * simply return to the main control page
         */
        if (request.getParameter("submit_cancel") != null)
        {
            showControls(context, request, response);

            return;
        }

        // Now proceed according to "action" parameter
        switch (action)
        {
        case START_EDIT_COMMUNITY:
            storeAuthorizeAttributeCommunityEdit(context, request, community);
           
            // Display the relevant "edit community" page
            JSPManager.showJSP(request, response, "/tools/edit-community.jsp");

            break;

        case START_DELETE_COMMUNITY:

            // Show "confirm delete" page
            JSPManager.showJSP(request, response,
                    "/tools/confirm-delete-community.jsp");

            break;

        case START_CREATE_COMMUNITY:
            // no authorize attribute will be given to the jsp so a "clean" creation form
            // will be always supplied, advanced setting on policies and admin group creation
            // will be possible after to have completed the community creation

            // Display edit community page with empty fields + create button
            JSPManager.showJSP(request, response, "/tools/edit-community.jsp");

            break;

        case START_EDIT_COLLECTION:
         
          HarvestedCollection hc = HarvestedCollection.find(context, UIUtil.
                getIntParameter(request, "collection_id"));
          request.setAttribute("harvestInstance", hc);
         
          storeAuthorizeAttributeCollectionEdit(context, request, collection);
         
            // Display the relevant "edit collection" page
            JSPManager.showJSP(request, response, "/tools/edit-collection.jsp");

            break;

        case START_DELETE_COLLECTION:

            // Show "confirm delete" page
            JSPManager.showJSP(request, response,
                    "/tools/confirm-delete-collection.jsp");

            break;

        case START_CREATE_COLLECTION:

            // Forward to collection creation wizard
            response.sendRedirect(response.encodeRedirectURL(request
                    .getContextPath()
                    + "/tools/collection-wizard?community_id="
                    + community.getID()));

            break;

        case CONFIRM_EDIT_COMMUNITY:

            // Edit or creation of a community confirmed
            processConfirmEditCommunity(context, request, response, community);

            break;

        case CONFIRM_DELETE_COMMUNITY:

            // remember the parent community, if any
            Community parent = community.getParentCommunity();

            // Delete the community
            community.delete();

            // if community was top-level, redirect to community-list page
            if (parent == null)
            {
                response.sendRedirect(response.encodeRedirectURL(request
                        .getContextPath()
                        + "/community-list"));
            }
            else
            // redirect to parent community page
            {
                response.sendRedirect(response.encodeRedirectURL(request
                        .getContextPath()
                        + "/handle/" + parent.getHandle()));
            }

            // Show main control page
            //showControls(context, request, response);
            // Commit changes to DB
View Full Code Here

            SQLException, AuthorizeException
    {
        // new approach - eliminate the 'list-communities' page in favor of the
        // community home page, enhanced with admin controls. If no community,
        // or no parent community, just fall back to the community-list page
        Community community = (Community) request.getAttribute("community");
        Collection collection = (Collection) request.getAttribute("collection");
       
        if (collection != null)
        {
            response.sendRedirect(response.encodeRedirectURL(request
                    .getContextPath()
                    + "/handle/" + collection.getHandle()));
        }
        else if (community != null)
        {
            response.sendRedirect(response.encodeRedirectURL(request
                    .getContextPath()
                    + "/handle/" + community.getHandle()));
        }
        else
        {
            // see if a parent community was specified
            Community parent = (Community) request.getAttribute("parent");

            if (parent != null)
            {
                response.sendRedirect(response.encodeRedirectURL(request
                        .getContextPath()
                        + "/handle/" + parent.getHandle()));
            }
            else
            {
                // fall back on community-list page
                response.sendRedirect(response.encodeRedirectURL(request
View Full Code Here

            int parentCommunityID = UIUtil.getIntParameter(request,
                    "parent_community_id");

            if (parentCommunityID != -1)
            {
                Community parent = Community.find(context, parentCommunityID);

                if (parent != null)
                {
                    community = parent.createSubcommunity();
                }
            }
            else
            {
                community = Community.create(null, context);
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.