Package org.dspace.content

Examples of org.dspace.content.BitstreamFormat


            if (bundles.length > 0)
            {
              Bitstream[] bss = bundles[0].getBitstreams();
              for (int i = 0; i < bss.length; i++)
              {
                BitstreamFormat bf = bss[i].getFormat();
                String format = "application/octet-stream";
                if (bf != null)
                {
                  format = bf.getMIMEType();
                }
                con.setType(format);

                // calculate the bitstream link.
                String bsLink = urlManager.getBitstreamUrl(bss[i]);
View Full Code Here


          Link link = new Link();
          String url = urlManager.getBitstreamUrl(bss[j]);
          link.setHref(url);
          link.setRel("part");

          BitstreamFormat bsf = bss[j].getFormat();
          if (bsf != null)
          {
            link.setType(bsf.getMIMEType());
          }

          entry.addLink(link);
        }
      }
View Full Code Here

          bs = targetBundle.createBitstream(bis)
          bs.setName(ce.filename);
 
          // Identify the format
          // FIXME - guessing format guesses license.txt incorrectly as a text file format!
          BitstreamFormat fmt = FormatIdentifier.guessFormat(context, bs);
        bs.setFormat(fmt);
       
          if (ce.description != null)
          {
            bs.setDescription(ce.description);
View Full Code Here

        String button = UIUtil.getSubmitButton(request, "submit");

        if (button.equals("submit_update"))
        {
            // Update the metadata for a bitstream format
            BitstreamFormat bf = BitstreamFormat.find(context, UIUtil
                    .getIntParameter(request, "format_id"));

            bf.setMIMEType(request.getParameter("mimetype"));
            bf.setShortDescription(request.getParameter("short_description"));
            bf.setDescription(request.getParameter("description"));
            bf
                    .setSupportLevel(UIUtil.getIntParameter(request,
                            "support_level"));
            bf.setInternal((request.getParameter("internal") != null)
                    && request.getParameter("internal").equals("true"));

            // Separate comma-separated extensions
            List extensions = new LinkedList();
            String extParam = request.getParameter("extensions");

            while (extParam.length() > 0)
            {
                int c = extParam.indexOf(',');

                if (c > 0)
                {
                    extensions.add(extParam.substring(0, c).trim());
                    extParam = extParam.substring(c + 1).trim();
                }
                else
                {
                    if (extParam.trim().length() > 0)
                    {
                        extensions.add(extParam.trim());
                        extParam = "";
                    }
                }
            }

            // Set extensions in the format - convert to array
            String[] extArray = (String[]) extensions
                    .toArray(new String[extensions.size()]);
            bf.setExtensions(extArray);

            bf.update();

            showFormats(context, request, response);
            context.complete();
        }
        else if (button.equals("submit_add"))
        {
            // Add a new bitstream - simply add to the list, and let the user
            // edit with the main form
            BitstreamFormat bf = BitstreamFormat.create(context);

            // We set the "internal" flag to true, so that the empty bitstream
            // format doesn't show up in the submission UI yet
            bf.setInternal(true);
            bf.update();

            showFormats(context, request, response);
            context.complete();
        }
        else if (button.equals("submit_delete"))
        {
            // Start delete process - go through verification step
            BitstreamFormat bf = BitstreamFormat.find(context, UIUtil
                    .getIntParameter(request, "format_id"));
            request.setAttribute("format", bf);
            JSPManager.showJSP(request, response,
                    "/dspace-admin/confirm-delete-format.jsp");
        }
        else if (button.equals("submit_confirm_delete"))
        {
            // User confirms deletion of format
            BitstreamFormat bf = BitstreamFormat.find(context, UIUtil
                    .getIntParameter(request, "format_id"));
            bf.delete();

            showFormats(context, request, response);
            context.complete();
        }
        else
View Full Code Here

    header.addCellContent(T_column3);

    for (Bitstream bitstream : bitstreams)
    {
      String format = null;
      BitstreamFormat bitstreamFormat = bitstream.getFormat();
      if (bitstreamFormat != null)
        format = bitstreamFormat.getShortDescription();

      Row row = table.addRow();
      row.addCell().addContent(bitstream.getName());
      row.addCell().addContent(bitstream.getDescription());
      row.addCell().addContent(format);
View Full Code Here

      bitstream.setName(name);
      bitstream.setSource(filePart.getUploadName());
      bitstream.setDescription(request.getParameter("description"));

      // Identify the format
      BitstreamFormat format = FormatIdentifier.guessFormat(context, bitstream);
      bitstream.setFormat(format);

      // Update to DB
      bitstream.update();
      item.update();
View Full Code Here

  {
    FlowResult result = new FlowResult();
    result.setContinue(false);
   
    Bitstream bitstream = Bitstream.find(context, bitstreamID);
    BitstreamFormat currentFormat = bitstream.getFormat();

    //Step 1:
    // Update the bitstream's description
    if (description != null)
    {
      bitstream.setDescription(description);
    }
   
    //Step 2:
    // Check if the primary bitstream status has changed
    Bundle[] bundles = bitstream.getBundles();
    if (bundles != null && bundles.length > 0)
    {
      if (bitstreamID == bundles[0].getPrimaryBitstreamID())
      {
        // currently the bitstream is primary
        if ("no".equals(primary))
        {
          // However the user has removed this bitstream as a primary bitstream.
          bundles[0].unsetPrimaryBitstreamID();
          bundles[0].update();
        }
      }
      else
      {
        // currently the bitstream is non-primary
        if ("yes".equals(primary))
        {
          // However the user has set this bitstream as primary.
          bundles[0].setPrimaryBitstreamID(bitstreamID);
          bundles[0].update();
        }
      }
    }
   
   
    //Step 2:
    // Update the bitstream's format
    if (formatID > 0)
    {
      if (currentFormat == null || currentFormat.getID() != formatID)
      {
        BitstreamFormat newFormat = BitstreamFormat.find(context, formatID);
        if (newFormat != null)
        {
          bitstream.setFormat(newFormat);
        }
      }
View Full Code Here

        if (c != null)
        {
            String ctype = c.getAttributeValue("contenttype");
            if (ctype != null)
            {
                BitstreamFormat af[] = BitstreamFormat.findAll(context);
                for (BitstreamFormat element : af)
                {
                    if (ctype.equals(element.getMIMEType()))
                    {
                        return element;
View Full Code Here

        {
            value = this.bitstream.getDescription();
        }
        else if (elementsEqualIsh(property, formatProperty))
        {
            BitstreamFormat bsf = this.bitstream.getFormat();
            value = bsf == null ? null : bsf.getShortDescription();
        }
        else if (elementsEqualIsh(property, format_descriptionProperty))
        {
            value = this.bitstream.getFormatDescription();
        }
View Full Code Here

            if (action == DAV.PROPPATCH_REMOVE)
            {
                throw new DAVStatusException(DAV.SC_CONFLICT,
                        "The format property cannot be removed.");
            }
            BitstreamFormat bsf = BitstreamFormat.findByShortDescription(
                    this.context, newValue);
            if (bsf == null)
            {
                throw new DAVStatusException(DAV.SC_CONFLICT,
                        "Cannot set format, no such Bitstream Format: "
View Full Code Here

TOP

Related Classes of org.dspace.content.BitstreamFormat

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.