Package org.dspace.content

Examples of org.dspace.content.BitstreamFormat


        BitstreamFormat[] formats = BitstreamFormat.findNonInternal(context);

        request.setAttribute("bitstream.formats", formats);

        // What does the system think it is?
        BitstreamFormat guess = FormatIdentifier.guessFormat(context, subInfo
                .getBitstream());

        request.setAttribute("guessed.format", guess);

        // display choose file format JSP next
View Full Code Here


      String fn = swordService.getFilename(context, deposit, false);
      bs.setName(fn);

      swordService.message("File created in item with filename " + fn);

      BitstreamFormat bf = BitstreamFormat.findByMIMEType(context, deposit.getContentType());
      if (bf != null)
      {
        bs.setFormat(bf);
      }
View Full Code Here

      {
        return;
      }

      String bsurl = urlManager.getBitstreamUrl(this.bitstream);
      BitstreamFormat bf = this.bitstream.getFormat();
      String format = "application/octet-stream";
      if (bf != null)
      {
        format = bf.getMIMEType();
      }

      Content con = new Content();
      con.setType(format);
      con.setSource(bsurl);
View Full Code Here

    // get the things we need out of the service
    SWORDUrlManager urlManager = swordService.getUrlManager();

    String bsurl = urlManager.getBitstreamUrl(this.bitstream);
    BitstreamFormat bf = this.bitstream.getFormat();
    String format = "application/octet-stream";
    if (bf != null)
    {
      format = bf.getMIMEType();
    }

    Link link = new Link();
    link.setType(format);
    link.setHref(bsurl);
View Full Code Here

        b.setName(noPath);
        b.setSource(wrapper.getFilesystemName("file"));

        // Identify the format
        BitstreamFormat bf = FormatIdentifier.guessFormat(context, b);
        b.setFormat(bf);
        b.update();

        item.update();
View Full Code Here

          if (extensions[i].startsWith("."))
            extensions[i] = extensions[i].substring(1);
       
       
        // Get or create the format
        BitstreamFormat format;
    if (formatID >= 0)
      format = BitstreamFormat.find(context, formatID);
    else
      format = BitstreamFormat.create(context);
       
    // Update values
    format.setMIMEType(mimeType);
    if (formatID != 1) // don't change the unknow format.
      format.setShortDescription(shortDescription);
    format.setDescription(description);
    format.setSupportLevel(Integer.valueOf(supportLevel));
    if (internal == null)
      format.setInternal(false);
    else
      format.setInternal(true);
    format.setExtensions(extensions);

   
    // Commit the change
        format.update();
        context.commit();
   
    // Return status
        result.setContinue(true);
    result.setOutcome(true);
    result.setMessage(T_edit_bitstream_format_success_notice);
    result.setParameter("formatID",format.getID());
       
    return result;
  }
View Full Code Here

        FlowResult result = new FlowResult();
   
    int count = 0;
    for (String id : formatIDs)
      {
      BitstreamFormat format = BitstreamFormat.find(context,Integer.valueOf(id));
      format.delete();
          count++;
      }
   
    if (count > 0)
    {
View Full Code Here

    int bitstreamID = parameters.getParameterAsInteger("bitstreamID",-1);

    // Get the bitstream and all the various formats
                // Administrator is allowed to see internal formats too.
    Bitstream bitstream = Bitstream.find(context, bitstreamID);
    BitstreamFormat currentFormat = bitstream.getFormat();
                BitstreamFormat[] bitstreamFormats = AuthorizeManager.isAdmin(context) ?
                    BitstreamFormat.findAll(context) :
                    BitstreamFormat.findNonInternal(context);
   
    boolean primaryBitstream = false;
    Bundle[] bundles = bitstream.getBundles();
    if (bundles != null && bundles.length > 0)
    {
      if (bitstreamID == bundles[0].getPrimaryBitstreamID())
      {
        primaryBitstream = true;
      }
    }

    // File name & url
    String fileUrl = contextPath + "/bitstream/id/" +bitstream.getID() + "/" + bitstream.getName();
    String fileName = bitstream.getName();




    // DIVISION: main
    Division div = body.addInteractiveDivision("edit-bitstream", contextPath+"/admin/item", Division.METHOD_MULTIPART, "primary administrative item");     
    div.setHead(T_head1);


    // LIST: edit form
    List edit = div.addList("edit-bitstream-list", List.TYPE_FORM);

    edit.addLabel(T_file_label);
    edit.addItem().addXref(fileUrl, fileName);

   
    Select primarySelect = edit.addItem().addSelect("primary");
    primarySelect.setLabel(T_primary_label);
    primarySelect.addOption(primaryBitstream,"yes",T_primary_option_yes);
    primarySelect.addOption(!primaryBitstream,"no",T_primary_option_no);
   
    Text description = edit.addItem().addText("description");
    description.setLabel(T_description_label);
    description.setHelp(T_description_help);
    description.setValue(bitstream.getDescription());

    edit.addItem(T_para1);

    // System supported formats
    Select format = edit.addItem().addSelect("formatID");
    format.setLabel(T_format_label);

                // load the options menu, skipping the "Unknown" format since "Not on list" takes its place
                int unknownFormatID = BitstreamFormat.findUnknown(context).getID();
    format.addOption(-1,T_format_default);
    for (BitstreamFormat bitstreamFormat : bitstreamFormats)
    {
                        if (bitstreamFormat.getID() == unknownFormatID)
                            continue;
      String supportLevel = "Unknown";
      if (bitstreamFormat.getSupportLevel() == BitstreamFormat.KNOWN)
        supportLevel = "known";
      else if (bitstreamFormat.getSupportLevel() == BitstreamFormat.SUPPORTED)
        supportLevel = "Supported";
      String name = bitstreamFormat.getShortDescription()+" ("+supportLevel+")";
                        if (bitstreamFormat.isInternal())
                            name += " (Internal)";
      int id = bitstreamFormat.getID();

      format.addOption(id,name);
    }
    if (currentFormat != null)
    {
      format.setOptionSelected(currentFormat.getID());
    }
    else
    {
      format.setOptionSelected(-1);
    }
View Full Code Here

        logoBS.setName(noPath);
        logoBS.setSource(wrapper.getFilesystemName("file"));

        // Identify the format
        BitstreamFormat bf = FormatIdentifier.guessFormat(context, logoBS);
        logoBS.setFormat(bf);
        AuthorizeManager.addPolicy(context, logoBS, Constants.WRITE, context
                .getCurrentUser());
        logoBS.update();
View Full Code Here

          name = shortName;
        }
       
        String description = bitstream.getDescription();
        String format = null;
        BitstreamFormat bitstreamFormat = bitstream.getFormat();
        if (bitstreamFormat != null)
          format = bitstreamFormat.getShortDescription();
        String editURL = contextPath + "/admin/item?administrative-continue="+knot.getId()+"&bitstreamID="+bitstream.getID()+"&submit_edit";
        String viewURL = contextPath + "/bitstream/id/"+bitstream.getID()+"/"+bitstream.getName();


        Row row = files.addRow();
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.