Package org.dspace.utils

Examples of org.dspace.utils.DSpace


                bitstreamName = "bitstream";
            }
           
            // Log that the bitstream has been viewed, this is none-cached and the complexity
            // of adding it to the sitemap for every possible bitstre uri is not very tractable
            new DSpace().getEventService().fireEvent(
                                new UsageEvent(
                                                UsageEvent.Action.VIEW,
                                                ObjectModelHelper.getRequest(objectModel),
                                                ContextUtil.obtainContext(ObjectModelHelper.getRequest(objectModel)),
                                                bitstream));
View Full Code Here


    private SearchService searchService = null;

   
    public BrowseFacet() {

        DSpace dspace = new DSpace();
        config = dspace.getConfigurationService();
        searchService = dspace.getServiceManager().getServiceByName(SearchService.class.getName(), SearchService.class);

    }
View Full Code Here

        /** Acquire from dspace-services in future */
        /**
         * new DSpace.getServiceManager().getServiceByName("org.dspace.discovery.SolrIndexer");
         */

        DSpace dspace = new DSpace();

        IndexingService indexer = dspace.getServiceManager().getServiceByName(IndexingService.class.getName(),IndexingService.class);

        if (line.hasOption("r")) {
            log.info("Removing " + line.getOptionValue("r") + " from Index");
            indexer.unIndexContent(context, line.getOptionValue("r"));
        } else if (line.hasOption("c")) {
View Full Code Here

        DatabaseManager.delete(ourContext, itemRow);
    }
   
    private void removeVersion() throws AuthorizeException, SQLException
    {
        VersioningService versioningService = new DSpace().getSingletonService(VersioningService.class);
        if(versioningService.getVersion(ourContext, this)!=null)
        {
            versioningService.removeVersion(ourContext, this);
        }else{
            IdentifierService identifierService = new DSpace().getSingletonService(IdentifierService.class);
            try {
                identifierService.delete(ourContext, this);
            } catch (IdentifierException e) {
                throw new RuntimeException(e);
            }
View Full Code Here

        if(dso == null)
            return;

        try {
         
      new DSpace().getEventService().fireEvent(
          new UsageEvent(
              UsageEvent.Action.VIEW,
              (HttpServletRequest)request,
              ContextUtil.obtainContext((HttpServletRequest)request),
              dso));
View Full Code Here

                "bitstream_id=" + bitstream.getID()));
       
        //new UsageEvent().fire(request, context, AbstractUsageEvent.VIEW,
    //    Constants.BITSTREAM, bitstream.getID());

        new DSpace().getEventService().fireEvent(
            new UsageEvent(
                UsageEvent.Action.VIEW,
                request,
                context,
                bitstream));
View Full Code Here

        // OK, we have a valid Handle. What is it?
        if (dso.getType() == Constants.ITEM)
        {
            Item item = (Item) dso;

            new DSpace().getEventService().fireEvent(
                new UsageEvent(
                    UsageEvent.Action.VIEW,
                    request,
                    context,
                    dso));
           
            // Only use last-modified if this is an anonymous access
            // - caching content that may be generated under authorisation
            //   is a security problem
            if (context.getCurrentUser() == null)
            {
                response.setDateHeader("Last-Modified", item
                        .getLastModified().getTime());

                // Check for if-modified-since header
                long modSince = request.getDateHeader("If-Modified-Since");

                if (modSince != -1 && item.getLastModified().getTime() < modSince)
                {
                    // Item has not been modified since requested date,
                    // hence bitstream has not; return 304
                    response.setStatus(HttpServletResponse.SC_NOT_MODIFIED);
                }
                else
                {
                    // Display the item page
                    displayItem(context, request, response, item, handle);
                }
            }
            else
            {
                // Display the item page
                displayItem(context, request, response, item, handle);
            }
        }
        else if (dso.getType() == Constants.COLLECTION)
        {
            Collection c = (Collection) dso;

            new DSpace().getEventService().fireEvent(
                new UsageEvent(
                    UsageEvent.Action.VIEW,
                    request,
                    context,
                    dso));
           
            //UsageEvent ue = new UsageEvent();
            //ue.fire(request, context, AbstractUsageEvent.VIEW,
            //        Constants.COLLECTION, dso.getID());

            // Store collection location in request
            request.setAttribute("dspace.collection", c);

            /*
             * Find the "parent" community the collection, mainly for
             * "breadcrumbs" FIXME: At the moment, just grab the first community
             * the collection is in. This should probably be more context
             * sensitive when we have multiple inclusion.
             */
            Community[] parents = c.getCommunities();
            request.setAttribute("dspace.community", parents[0]);

            /*
             * Find all the "parent" communities for the collection for
             * "breadcrumbs"
             */
            request.setAttribute("dspace.communities", getParents(parents[0],
                    true));

            // home page, or forward to another page?
            if ((extraPathInfo == null) || (extraPathInfo.equals("/")))
            {
                collectionHome(context, request, response, parents[0], c);
            }
            else
            {
                // Forward to another servlet
                request.getRequestDispatcher(extraPathInfo).forward(request,
                        response);
            }
        }
        else if (dso.getType() == Constants.COMMUNITY)
        {
            Community c = (Community) dso;

            new DSpace().getEventService().fireEvent(
                new UsageEvent(
                    UsageEvent.Action.VIEW,
                    request,
                    context,
                    dso));
View Full Code Here

        if (bitstream != null)
        {
            log.info(LogManager.getHeader(context, "view_bitstream",
                    "bitstream_id=" + bitstream.getID()));

            new DSpace().getEventService().fireEvent(
                new UsageEvent(
                    UsageEvent.Action.VIEW,
                    request,
                    context,
                    bitstream));
View Full Code Here

            //resourceIdentifier = requestUri.substring(requestUri.indexOf(RESOURCE) + RESOURCE.length() + 1);

            Context context = ContextUtil.obtainContext(request);

            IdentifierService dis = new DSpace().getSingletonService(IdentifierService.class);

            if (dis == null)
                throw new RuntimeException("Cannot instantiate IdentifierService. Problem with spring configuration!");

            DSpaceObject dso = dis.resolve(context, prefix);
View Full Code Here

            String resourceIdentifier = requestUri.substring(requestUri.indexOf(RESOURCE) + RESOURCE.length() + 1);
            resourceIdentifier = resourceIdentifier.substring(0, resourceIdentifier.indexOf(METS) - 1);

            Context context = ContextUtil.obtainContext(request);

            IdentifierService dis = new DSpace().getSingletonService(IdentifierService.class);

            DSpaceObject dso = dis.resolve(context, resourceIdentifier);

            if (dso == null) return null;
View Full Code Here

TOP

Related Classes of org.dspace.utils.DSpace

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.