Package org.dspace.app.xmlui.wing

Examples of org.dspace.app.xmlui.wing.AttributeMap


     *  </mdWrap>
     * </amdSec>
     */
    protected void renderAdministrativeSection() throws WingException, SAXException, CrosswalkException, IOException, SQLException
    {
        AttributeMap attributes;
        String groupID;

        //Only create an <amdSec>, if we have amdTypes (or sub-sections) specified...
        // (this keeps our METS file small, by default, and hides all our admin metadata)
        if(amdTypes.size() > 0)
        {
          ////////////////////////////////
          // Start an administrative wrapper

          // Administrative element's ID
          String amdID = getGenericID("amd_");
          attributes = new AttributeMap();
          attributes.put("ID", amdID);
          startElement(METS, "amdSec", attributes);

          groupID = getGenericID("group_amd_");
          attributes.put("GROUPID", groupID);
        }

        // For each administrative metadata section specified
        for (String amdSecName : amdTypes.keySet())
        {
View Full Code Here


            throws WingException, SAXException, CrosswalkException, IOException, SQLException
    {
        /////////////////////////////////
        // Start administrative metadata section wrapper
        String amdSecID = getAmdSecID(amdSecName, mdType, dso);
        AttributeMap attributes = new AttributeMap();
        attributes.put("ID", amdSecID);
        startElement(METS, amdSecName, attributes);

        //If this is a bitstream
        if (dso.getType() == Constants.BITSTREAM)
        {
          // Add this to our list of each file's administrative section IDs
          String fileID = getFileID((Bitstream) dso);
          if(fileAmdSecIDs.containsKey(fileID))
            fileAmdSecIDs.get(fileID).append(" " + amdSecID);
          else
            fileAmdSecIDs.put(fileID, new StringBuffer(amdSecID));
        }//else if an Item
        else if (dso.getType() == Constants.ITEM)
        {
           //Add this to our list of item's administrative section IDs
           if(amdSecIDS==null)
             amdSecIDS = new StringBuffer(amdSecID);
           else
             amdSecIDS.append(" " + amdSecID);
        }

        ////////////////////////////////
        // Start a metadata wrapper
        attributes = new AttributeMap();
        if (isDefinedMETStype(mdType))
        {
            attributes.put("MDTYPE", mdType);
        }
        else
        {
            attributes.put("MDTYPE","OTHER");
            attributes.put("OTHERMDTYPE", mdType);
        }
        startElement(METS,"mdWrap",attributes);

        //////////////////////////////////
        // Start the xml data
View Full Code Here

     *   </fileGrp>
     * </fileSec>
     */
    protected void renderFileSection() throws SQLException, SAXException
    {
        AttributeMap attributes;
       
        // //////////////////////
        // Start a new file section
        startElement(METS,"fileSec");
       
        // Check if the user is requested a specific bundle or
        // the all bundles.
        List<Bundle> bundles = findEnabledBundles();

        // Suppress license?
        Boolean showLicense = ConfigurationManager.getBooleanProperty("webui.licence_bundle.show");
       
        // Loop over all requested bundles
        for (Bundle bundle : bundles)
        {

            // Use the bitstream's name as the use parameter unless we
            // are the original bundle. In this case rename it to
            // content.
            String use = bundle.getName();
            boolean isContentBundle = false; // remember the content bundle.
            boolean isDerivedBundle = false;
            if ("ORIGINAL".equals(use))
            {
                use = "CONTENT";
                isContentBundle = true;
            }
            if ("TEXT".equals(bundle.getName()) || "THUMBNAIL".equals(bundle.getName()))
            {
                isDerivedBundle = true;
            }
            if ("LICENSE".equals(bundle.getName()) && ! showLicense)
            {
                continue;
            }

            // ///////////////////
            // Start bundle's file group
            attributes = new AttributeMap();
            attributes.put("USE", use);
            startElement(METS,"fileGrp",attributes);
           
            for (Bitstream bitstream : bundle.getBitstreams())
            {
                // //////////////////////////////
View Full Code Here

     *   </div>
     * </structMap>
     */
    protected void renderStructureMap() throws SQLException, SAXException
    {
        AttributeMap attributes;
       
        // ///////////////////////
        // Start a new structure map
        attributes = new AttributeMap();
        attributes.put("TYPE", "LOGICAL");
        attributes.put("LABEL", "DSpace");
        startElement(METS,"structMap",attributes);

        // ////////////////////////////////
        // Start the special first division
        attributes = new AttributeMap();
        attributes.put("TYPE", "DSpace Item");
        // add references to the Descriptive metadata
        if (dmdSecIDS != null)
                attributes.put("DMDID", dmdSecIDS.toString());
        // add references to the Administrative metadata
        if (amdSecIDS != null)
                attributes.put("AMDID", amdSecIDS.toString());
        startElement(METS,"div",attributes);
       
        // add a fptr pointer to the primary bitstream.
        if (primaryBitstream != null)
        {
                // ////////////////////////////////
                // Start & end a refrence to the primary bistream.
                attributes = new AttributeMap();
                String fileID = getFileID(primaryBitstream);
                attributes.put("FILEID", fileID);
               
                startElement(METS,"fptr",attributes);
                endElement(METS,"fptr");
        }

        for (Bitstream bitstream : contentBitstreams)
        {
                // ////////////////////////////////////
                // Start a div for each publicaly viewable bitstream
                attributes = new AttributeMap();
                attributes.put("ID", getGenericID("div_"));
                attributes.put("TYPE", "DSpace Content Bitstream");
                startElement(METS,"div",attributes);

                // ////////////////////////////////
                // Start a the actualy pointer to the bitstream
                attributes = new AttributeMap();
                String fileID = getFileID(bitstream);
                attributes.put("FILEID", fileID);
               
                startElement(METS,"fptr",attributes);
                endElement(METS,"fptr");
               
                // ///////////////////////////////
View Full Code Here

     *  </mdWrap>
     * </dmdSec
     */
    protected void renderDescriptiveSection() throws WingException, SAXException, CrosswalkException, IOException, SQLException
    {
        AttributeMap attributes;
       
        String groupID = getGenericID("group_dmd_");
        dmdSecIDS = new StringBuffer();

        // Add DIM descriptive metadata if it was requested or if no metadata types
        // were specified. Furthermore, since this is the default type we also use a
        // faster rendering method that the crosswalk API.
        if(dmdTypes.size() == 0 || dmdTypes.contains("DIM"))
        {
            // Metadata element's ID
            String dmdID = getGenericID("dmd_");
           
            // Keep track of all descriptive sections
            dmdSecIDS.append(dmdID);
           
           
            // ////////////////////////////////
            // Start a new dmdSec for each crosswalk.
            attributes = new AttributeMap();
            attributes.put("ID", dmdID);
            attributes.put("GROUPID", groupID);
            startElement(METS,"dmdSec",attributes);
           
            // ////////////////////////////////
            // Start metadata wrapper
            attributes = new AttributeMap();
            attributes.put("MDTYPE", "OTHER");
            attributes.put("OTHERMDTYPE", "DIM");
            startElement(METS,"mdWrap",attributes);

            // ////////////////////////////////
            // Start the xml data
            startElement(METS,"xmlData");
           
           
            // ///////////////////////////////
            // Start the DIM element
            attributes = new AttributeMap();
            attributes.put("dspaceType", Constants.typeText[dso.getType()]);
            startElement(DIM,"dim",attributes);

            // Add each field for this collection
            if (dso.getType() == Constants.COLLECTION)
            {
                Collection collection = (Collection) dso;
               
                String description = collection.getMetadata("introductory_text");
                String description_abstract = collection.getMetadata("short_description");
                String description_table = collection.getMetadata("side_bar_text");
                String identifier_uri = "http://hdl.handle.net/" + collection.getHandle();
                String provenance = collection.getMetadata("provenance_description");
                String rights = collection.getMetadata("copyright_text");
                String rights_license = collection.getMetadata("license");
                String title = collection.getMetadata("name");
               
                createField("dc","description",null,null,description);
                createField("dc","description","abstract",null,description_abstract);
                createField("dc","description","tableofcontents",null,description_table);
                createField("dc","identifier","uri",null,identifier_uri);
                createField("dc","provenance",null,null,provenance);
                createField("dc","rights",null,null,rights);
                createField("dc","rights","license",null,rights_license);
                createField("dc","title",null,null,title);
               
                boolean showCount = ConfigurationManager.getBooleanProperty("webui.strengths.show");
                
                if (showCount)
                {
                    try
                    // try to determine Collection size (i.e. # of items)
                        int size = new ItemCounter(this.dspaceContext).getCount(collection);
                        createField("dc","format","extent",null, String.valueOf(size));
                    }
                    catch (ItemCountException e)
                    {
                        throw new IOException("Could not obtain Collection item count", e);
                    }
                }
            }
            else if (dso.getType() == Constants.COMMUNITY)
            {
                Community community = (Community) dso;
               
                String description = community.getMetadata("introductory_text");
                String description_abstract = community.getMetadata("short_description");
                String description_table = community.getMetadata("side_bar_text");
                String identifier_uri = "http://hdl.handle.net/" + community.getHandle();
                String rights = community.getMetadata("copyright_text");
                String title = community.getMetadata("name");
               
                createField("dc","description",null,null,description);
                createField("dc","description","abstract",null,description_abstract);
                createField("dc","description","tableofcontents",null,description_table);
                createField("dc","identifier","uri",null,identifier_uri);
                createField("dc","rights",null,null,rights);
                createField("dc","title",null,null,title);
               
                boolean showCount = ConfigurationManager.getBooleanProperty("webui.strengths.show");
           
                if (showCount)
                {
                    try
                    // try to determine Community size (i.e. # of items)
                        int size = new ItemCounter(this.dspaceContext).getCount(community);
                        createField("dc","format","extent",null, String.valueOf(size));
                    }
                    catch (ItemCountException e)
                    {
                        throw new IOException("Could not obtain Collection item count", e);
                    }
                }
            }
           
            // ///////////////////////////////
            // End the DIM element
            endElement(DIM,"dim");
           
            // ////////////////////////////////
            // End elements
            endElement(METS,"xmlData");
            endElement(METS,"mdWrap");
            endElement(METS, "dmdSec");
         
        }
       
      for (String dmdType : dmdTypes)
      {
        // If DIM was requested then it was generated above without using
        // the crosswalk API. So we can skip this one.
        if ("DIM".equals(dmdType))
            {
                continue;
            }
       
        DisseminationCrosswalk crosswalk = getDisseminationCrosswalk(dmdType);
       
        if (crosswalk == null)
            {
                continue;
            }
       
          String dmdID = getGenericID("dmd_");
         // Add our id to the list.
            dmdSecIDS.append(" ").append(dmdID);

            // ////////////////////////////////
            // Start a new dmdSec for each crosswalk.
            attributes = new AttributeMap();
            attributes.put("ID", dmdID);
            attributes.put("GROUPID", groupID);
            startElement(METS,"dmdSec",attributes);
           
            // ////////////////////////////////
            // Start metadata wrapper
            attributes = new AttributeMap();
            if (isDefinedMETStype(dmdType))
            {
              attributes.put("MDTYPE", dmdType);
            }
            else
            {
              attributes.put("MDTYPE", "OTHER");
              attributes.put("OTHERMDTYPE", dmdType);
            }
            startElement(METS,"mdWrap",attributes);

            // ////////////////////////////////
            // Start the xml data
View Full Code Here

     *   </fileGrp>
     * </fileSec>
     */
    protected void renderFileSection() throws SAXException
    {
      AttributeMap attributes;
     
        // Get the Community or Collection logo.
        Bitstream logo = getLogo();

        if (logo != null)
        {
            // ////////////////////////////////
            // Start the file section
          startElement(METS,"fileSec");

            // ////////////////////////////////
            // Start a new fileGrp for the logo.
            attributes = new AttributeMap();
            attributes.put("USE", "LOGO");
            startElement(METS,"fileGrp",attributes);
           
            // ////////////////////////////////
            // Add the actual file element
            String fileID = getFileID(logo);
View Full Code Here

     *   </div>
     * </structMap>
     */
    protected void renderStructureMap() throws SQLException, SAXException
    {
      AttributeMap attributes;
     
      // ///////////////////////
      // Start a new structure map
      attributes = new AttributeMap();
      attributes.put("TYPE", "LOGICAL");
      attributes.put("LABEL", "DSpace");
      startElement(METS,"structMap",attributes);

      // ////////////////////////////////
      // Start the special first division
      attributes = new AttributeMap();
      attributes.put("TYPE", getMETSLabel());
      // add references to the Descriptive metadata
      if (dmdSecIDS != null)
        {
            attributes.put("DMDID", dmdSecIDS.toString());
        }
      startElement(METS,"div",attributes);
     
     
      // add a fptr pointer to the logo.
        Bitstream logo = getLogo();
        if (logo != null)
        {
            // ////////////////////////////////
            // Add a reference to the logo as the primary bitstream.
            attributes = new AttributeMap();
            attributes.put("FILEID",getFileID(logo));
            startElement(METS,"fptr",attributes);
            endElement(METS,"fptr");
       
           
            // ///////////////////////////////////////////////
            // Add a div for the publicly viewable bitstreams (i.e. the logo)
            attributes = new AttributeMap();
            attributes.put("ID", getGenericID("div_"));
            attributes.put("TYPE", "DSpace Content Bitstream");
            startElement(METS,"div",attributes);
         
            // ////////////////////////////////
            // Add a reference to the logo as the primary bitstream.
            attributes = new AttributeMap();
            attributes.put("FILEID",getFileID(logo));
            startElement(METS,"fptr",attributes);
            endElement(METS,"fptr");
         
            // //////////////////////////
            // End the logo division
View Full Code Here

     */
    private void createField(String schema, String element, String qualifier, String language, String value) throws SAXException
    {
      // ///////////////////////////////
      // Field element for each metadata field.
      AttributeMap attributes = new AttributeMap();
    attributes.put("mdschema",schema);
    attributes.put("element", element);
    if (qualifier != null)
        {
            attributes.put("qualifier", qualifier);
        }
    if (language != null)
        {
            attributes.put("language", language);
        }
    startElement(DIM,"field",attributes);
   
    // Only try and add the metadata value, but only if it is non-null.
      if (value != null)
View Full Code Here

     * default language.
     *
     */
  protected void renderDescriptiveSection() throws SAXException
    {
      AttributeMap attributes;
     
      // Generate our ids
        String dmdID = getGenericID("dmd_");
        String groupID = getGenericID("group_dmd_");

        // ////////////////////////////////
        // Start a single dmdSec
        attributes = new AttributeMap();
        attributes.put("ID", dmdID);
        attributes.put("GROUPID", groupID);
        startElement(METS,"dmdSec",attributes);

        // ////////////////////////////////
        // Start a metadata wrapper (hardcoded to mods)
        attributes = new AttributeMap();
        attributes.put("MDTYPE", "OTHER");
        attributes.put("OTHERMDTYPE", "DIM");
        startElement(METS,"mdWrap",attributes);

        // ////////////////////////////////
        // Start the xml data
        startElement(METS,"xmlData");
       
        /////////////////////////////////
    // Start the DIM element     
    attributes = new AttributeMap();
    attributes.put("dspaceType", Constants.typeText[Constants.SITE]);
    startElement(DIM,"dim",attributes);
   
    // Entry for dspace.name
    attributes = new AttributeMap();
    attributes.put("mdschema","dspace");
    attributes.put("element", "name");
    startElement(DIM,"field",attributes);
    sendCharacters(ConfigurationManager.getProperty("dspace.name"));
    endElement(DIM,"field");
   
    // Entry for dspace.hostname
    attributes = new AttributeMap();
    attributes.put("mdschema","dspace");
    attributes.put("element", "hostname");
    startElement(DIM,"field",attributes);
    sendCharacters(ConfigurationManager.getProperty("dspace.hostname"));
    endElement(DIM,"field");
   
    // Entry for handle.prefix
    attributes = new AttributeMap();
    attributes.put("mdschema","dspace");
    attributes.put("element", "handle");
    startElement(DIM,"field",attributes);
    sendCharacters(HandleManager.getPrefix());
    endElement(DIM,"field");
   
    // Entry for default.language
    attributes = new AttributeMap();
    attributes.put("mdschema","dspace");
    attributes.put("element", "default");
    attributes.put("qualifier", "language");
    startElement(DIM,"field",attributes);
    sendCharacters(ConfigurationManager.getProperty("default.language"));
    endElement(DIM,"field");
   
        // ///////////////////////////////
View Full Code Here

     * all the community and collection objects showing how they are related to
     * one another.
     */
  protected void renderStructureMap() throws SQLException, SAXException
    {
      AttributeMap attributes;
       
      // //////////////////////////
      // Start the new struct map
        attributes = new AttributeMap();
        attributes.put("TYPE", "LOGICAL");
        attributes.put("LABEL", "DSpace");
        startElement(METS,"structMap",attributes);
       
        // ////////////////////////////////
        // Start the special first division
        attributes = new AttributeMap();
        attributes.put("TYPE", "DSpace Repository");
        // add references to the Descriptive metadata
        if (dmdSecIDS != null)
        {
            attributes.put("DMDID", dmdSecIDS);
        }
        startElement(METS,"div",attributes);

        // Put each root level node into the document.
        for (Community community : Community.findAllTop(context))
View Full Code Here

TOP

Related Classes of org.dspace.app.xmlui.wing.AttributeMap

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.