Package org.dspace.content

Examples of org.dspace.content.DSpaceObject


     * The validity object will include the item being viewed,
     * along with all bundles & bitstreams.
     */
    public SourceValidity getValidity()
    {
        DSpaceObject dso = null;

        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.
          }

            // add log message that we are viewing the item
            // done here, as the serialization may not occur if the cache is valid
            log.info(LogManager.getHeader(context, "view_item", "handle=" + (dso == null ? "" : dso.getHandle())));
      }
      return this.validity;
    }
View Full Code Here


    @Override
    public void addPageMeta(PageMeta pageMeta) throws SAXException,
            WingException, UIException, SQLException, IOException,
            AuthorizeException
    {
        DSpaceObject dso = HandleUtil.obtainHandle(objectModel);
        if (!(dso instanceof Item))
            return;
        Item item = (Item) dso;

        // Set the page title
View Full Code Here

     */
    public void addBody(Body body) throws SAXException, WingException,
            UIException, SQLException, IOException, AuthorizeException
    {

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

        // Build the item viewer division.
View Full Code Here

     */
    public void addBody(Body body) throws SAXException, WingException,
            UIException, SQLException, IOException, AuthorizeException
    {

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

        // Set up the major variables
        Community community = (Community) dso;
View Full Code Here

     */
  public String getObjectURL(Object object) throws WingException
  {
    if (object instanceof DSpaceObject)
    {
      DSpaceObject dso = (DSpaceObject) object;
      String handle = dso.getHandle();
     
      // If the object has a handle then refrence it by it's handle.
      if (handle != null)
      {
        return "/metadata/handle/" + handle + "/mets.xml";
      }
      else
      {
        // No handle then refrence it by an internal ID.
        if (dso instanceof Item || dso instanceof BrowseItem)
          {
            return "/metadata/internal/item/" + dso.getID() + "/mets.xml";
          }
          else if (object instanceof Collection)
          {
            return "/metadata/internal/collection/" + dso.getID() + "/mets.xml";
          }
          else if (object instanceof Community)
          {
            return "/metadata/internal/community/" + dso.getID() + "/mets.xml";
          }
      }
    }
   
    return null;
View Full Code Here

    public static DSpaceObject obtainHandle(Map objectModel)
            throws SQLException
    {
        Request request = ObjectModelHelper.getRequest(objectModel);

        DSpaceObject dso = (DSpaceObject) request.getAttribute(DSPACE_OBJECT);

        if (dso == null)
        {
            String uri = request.getSitemapURI();
View Full Code Here

     */
    public static boolean inheritsFrom(DSpaceObject dso, String parent)
            throws SQLException
    {

        DSpaceObject current = dso;

        while (current != null)
        {

            // Check if the current object has the handle we are looking for.
            if (current.getHandle().equals(parent))
                return true;

            if (current.getType() == Constants.ITEM)
            {
                current = ((Item) current).getOwningCollection();
            }
            else if (current.getType() == Constants.COLLECTION)
            {
                current = ((Collection) current).getCommunities()[0];
            }
            else if (current.getType() == Constants.COMMUNITY)
            {
                current = ((Community) current).getParentCommunity();
            }
        }

View Full Code Here

            }
        }

        while (!stack.empty())
        {
            DSpaceObject pop = stack.pop();
           
            if (pop instanceof Collection)
            {
              Collection collection = (Collection) pop;
              String name = collection.getMetadata("name");
              if (name == null || name.length() == 0)
                pageMeta.addTrailLink(contextPath + "/handle/" + pop.getHandle(), new Message("default","xmlui.general.untitled") );
              else
                pageMeta.addTrailLink(contextPath + "/handle/" + pop.getHandle(), name);
            }
            else if (pop instanceof Community)
            {
              Community community = (Community) pop;
              String name = community.getMetadata("name");
              if (name == null || name.length() == 0)
                pageMeta.addTrailLink(contextPath + "/handle/" + pop.getHandle(), new Message("default","xmlui.general.untitled") );
              else
                pageMeta.addTrailLink(contextPath + "/handle/" + pop.getHandle(), name);
            }

        }
    }
View Full Code Here

    String[] rft_ids = request.getParameterValues("rft_id");

    if(rft_ids != null)
    {
      for (String rft_id : rft_ids) {
        DSpaceObject obj = HandleManager.resolveToObject(context, rft_id);
        if (obj != null) {
          httpResponse.sendRedirect(httpResponse
              .encodeRedirectURL(request.getContextPath()
                  + "/handle/" + obj.getHandle()));
          return;
        }
      }
    }
   
View Full Code Here

     * This key must be unique inside the space of this component.
     */
    @Override
    public Serializable getKey() {
        try {
            DSpaceObject dso = HandleUtil.obtainHandle(objectModel);

            if (dso == null) {
                return "0";
            }

            return HashUtil.hash(dso.getHandle());
        } catch (SQLException sqle) {
            // Ignore all errors and just return that the component is not
            // cachable.
            return "0";
        }
View Full Code Here

TOP

Related Classes of org.dspace.content.DSpaceObject

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.