Package org.dspace.content

Examples of org.dspace.content.Bitstream


     
      XMLOutputter outputter = new XMLOutputter();
      String OREString = outputter.outputString(oreREM);
      ByteArrayInputStream OREStream = new ByteArrayInputStream(OREString.getBytes());
     
      Bitstream OREBitstream = OREBundle.createBitstream(OREStream);
      OREBitstream.setName("ORE.xml");

      BitstreamFormat bf = FormatIdentifier.guessFormat(ourContext, OREBitstream);
      OREBitstream.setFormat(bf);
      OREBitstream.update();
     
      OREBundle.addBitstream(OREBitstream);
      OREBundle.update();
    }
   
View Full Code Here


            objectURL = resolveURL(request, null);
            logoURL = ConfigurationManager.getProperty("webui.feed.logo.url");
        }
        else
        {
            Bitstream logo = null;
            if (dso.getType() == Constants.COLLECTION)
            {
                Collection col = (Collection)dso;
                defaultTitle = col.getMetadata("name");
                feed.setDescription(col.getMetadata("short_description"));
View Full Code Here

{
    public static Thumbnail getThumbnail(Context context, int itemId, boolean requireOriginal) throws SQLException
    {
        ItemDAO dao = ItemDAOFactory.getInstance(context);

        Bitstream thumbBitstream = null;
        Bitstream primaryBitstream = dao.getPrimaryBitstream(itemId, "ORIGINAL");
        if (primaryBitstream != null)
        {
            if (primaryBitstream.getFormat().getMIMEType().equals("text/html"))
                return null;

            thumbBitstream = dao.getNamedBitstream(itemId, "THUMBNAIL", primaryBitstream.getName() + ".jpg");
        }
        else
        {
            if (requireOriginal)
                primaryBitstream = dao.getFirstBitstream(itemId, "ORIGINAL");
View Full Code Here

        {
            value = canonicalizeHandle(this.collection.getHandle());
        }
        else if (elementsEqualIsh(property, logoProperty))
        {
            Bitstream lbs = this.collection.getLogo();
            Element le;
            if (lbs != null
                    && (le = DAVBitstream.makeXmlBitstream(lbs, this)) != null)
            {
                Element p = new Element("logo", DAV.NS_DSPACE);
View Full Code Here

                    if (bis == null || bsf == null)
                    {
                        throw new DAVStatusException(DAV.SC_CONFLICT,
                                "Unacceptable value for logo property.");
                    }
                    Bitstream nbs = this.collection.setLogo(bis);
                    nbs.setFormat(bsf);
                    nbs.update();
                }
                else
                {
                    throw new DAVStatusException(DAV.SC_CONFLICT,
                            "No <bitstream> element value found for logo property.");
View Full Code Here

        }

        // special case, value is XML, not string:
        else if (elementsEqualIsh(property, logoProperty))
        {
            Bitstream lbs = this.community.getLogo();
            Element le;
            if (lbs != null
                    && (le = DAVBitstream.makeXmlBitstream(lbs, this)) != null)
            {
                Element p = new Element("logo", DAV.NS_DSPACE);
View Full Code Here

                    if (bis == null || bsf == null)
                    {
                        throw new DAVStatusException(DAV.SC_CONFLICT,
                                "Unacceptable value for logo property.");
                    }
                    Bitstream nbs = this.community.setLogo(bis);
                    nbs.setFormat(bsf);
                    nbs.update();
                }
                else
                {
                    throw new DAVStatusException(DAV.SC_CONFLICT,
                            "No <bitstream> element value found for logo property.");
View Full Code Here

                            HttpServletResponse.SC_NOT_FOUND, "Item with ID="
                                    + String.valueOf(id) + " not found.");
                }
                if (bsElt != null)
                {
                    Bitstream bs = DAVBitstream.findBitstream(context, item,
                            bsElt);
                    if (bs == null)
                    {
                        throw new DAVStatusException(
                                HttpServletResponse.SC_NOT_FOUND,
View Full Code Here

            AuthorizeException, IOException
    {
        Bundle lb[] = this.item.getBundles(Constants.LICENSE_BUNDLE_NAME);
        for (Bundle element : lb)
        {
            Bitstream lbs = element.getBitstreamByName("license.txt");
            if (lbs != null)
            {
                ByteArrayOutputStream baos = new ByteArrayOutputStream(
                        (int) lbs.getSize());
                Utils.copy(lbs.retrieve(), baos);
                return baos.toString();
            }
        }
        return null;
    }
View Full Code Here

        Context context = null;
        try {
            context = new Context();
            refreshParams(context);

            Bitstream bst = Bitstream.find(context, Integer.parseInt(reference.getId()));

            if (bst != null) {
                HttpServletResponse response = this.entityProviderManager.getRequestGetter().getResponse();
                ServletOutputStream stream = response.getOutputStream();
                response.setContentType(bst.getFormat().getMIMEType());
                response.addHeader("Content-Disposition", "attachment; filename=" + bst.getName());
                response.setContentLength((int) bst.getSize());
                BufferedInputStream buf = new BufferedInputStream(bst.retrieve());

                int readBytes;
                while ((readBytes = buf.read()) != -1) {
                    stream.write(readBytes);
                }
View Full Code Here

TOP

Related Classes of org.dspace.content.Bitstream

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.