Package org.dspace.content

Examples of org.dspace.content.MetadataSchema


        }

        System.out.print("Registering Schema: " + name + " - " + namespace + " ... ");
       
        // check to see if the schema already exists
        MetadataSchema s = MetadataSchema.find(context, name);
       
        if (s == null)
        {
            // Schema does not exist - create
            MetadataSchema schema = new MetadataSchema(namespace, name);
            schema.create(context);
            System.out.println("created");
        }
        else
        {
            // Schema exists - if it's the same namespace, allow the type imports to continue
View Full Code Here


        }

        System.out.print("Registering Metadata: " + schema + "." + element + "." + qualifier + " ... ");
       
        // Find the matching schema object
        MetadataSchema schemaObj = MetadataSchema.find(context, schema);
       
        if (schemaObj == null)
        {
            throw new RegistryImportException("Schema '" + schema + "' is not registered");
        }
       
        MetadataField mf = MetadataField.findByElement(context, schemaObj.getSchemaID(), element, qualifier);
        if (mf != null)
        {
            System.out.println("already exists, skipping");
            return;
        }
       
        MetadataField field = new MetadataField();
        field.setSchemaID(schemaObj.getSchemaID());
        field.setElement(element);
        field.setQualifier(qualifier);
        field.setScopeNote(scopeNote);
        field.create(context);
        System.out.println("created");
View Full Code Here

            i.addMetadata(schema, element, qualifier, language, value);
        }
        else
        {
            // If we're just test the import, let's check that the actual metadata field exists.
          MetadataSchema foundSchema = MetadataSchema.find(c,schema);
         
          if (foundSchema == null)
          {
            System.out.println("ERROR: schema '"+schema+"' was not found in the registry.");
            return;
          }
         
          int schemaID = foundSchema.getSchemaID();
          MetadataField foundField = MetadataField.findByElement(c, schemaID, element, qualifier);
         
          if (foundField == null)
          {
            System.out.println("ERROR: Metadata field: '"+schema+"."+element+"."+qualifier+"' was not found in the registry.");
View Full Code Here

            String lang = request.getParameter("lang_" + i);

            if ((dcTypeID != -1) && (value != null) && !value.equals(""))
            {
                MetadataField field = MetadataField.find(context,dcTypeID);
                MetadataSchema schema = MetadataSchema.find(context,field.getSchemaID());
                item.addMetadata(schema.getName(),field.getElement(), field.getQualifier(), lang, value);
            }
        }

        item.update();
View Full Code Here

    String idsString = parameters.getParameter("schemaIDs", null);
   
    ArrayList<MetadataSchema> schemas = new ArrayList<MetadataSchema>();
    for (String id : idsString.split(","))
    {
      MetadataSchema schema = MetadataSchema.find(context,Integer.valueOf(id));
      schemas.add(schema);
    }
    // DIVISION: metadata-schema-confirm-delete
      Division deleted = body.addInteractiveDivision("metadata-schema-confirm-delete",contextPath+"/admin/metadata-registry",Division.METHOD_POST,"primary administrative metadata-registry");
      deleted.setHead(T_head);
      deleted.addPara(T_para1);
      Para warning = deleted.addPara();
      warning.addHighlight("bold").addContent(T_warning);
      warning.addContent(T_para2);
     
      Table table = deleted.addTable("schema-confirm-delete",schemas.size() + 1, 3);
        Row header = table.addRow(Row.ROLE_HEADER);
        header.addCell().addContent(T_column1);
        header.addCell().addContent(T_column2);
        header.addCell().addContent(T_column3);
     
      for (MetadataSchema schema : schemas)
      {
        Row row = table.addRow();
        row.addCell().addContent(schema.getSchemaID());
          row.addCell().addContent(schema.getNamespace());
          row.addCell().addContent(schema.getName());
      }
      Para buttons = deleted.addPara();
      buttons.addButton("submit_confirm").setValue(T_submit_delete);
      buttons.addButton("submit_cancel").setValue(T_submit_cancel);
     
View Full Code Here

  {
    // Get our parameters & state
    int schemaID = parameters.getParameterAsInteger("schemaID",-1);
    int updateID = parameters.getParameterAsInteger("updateID",-1);
    int highlightID = parameters.getParameterAsInteger("highlightID",-1);
    MetadataSchema schema = MetadataSchema.find(context,schemaID);
    MetadataField[] fields = MetadataField.findAllInSchema(context, schemaID);
    String schemaName = schema.getName();
    String schemaNamespace = schema.getNamespace();
   
    String errorString = parameters.getParameter("errors",null);
    ArrayList<String> errors = new ArrayList<String>();
    if (errorString != null)
    {
View Full Code Here

            if (elt.getName().equals("field") && elt.getNamespace().equals(DIM_NS))
            {
                String schema = elt.getAttributeValue("mdschema");
                String element = elt.getAttributeValue("element");
                String qualifier = elt.getAttributeValue("qualifier");
                MetadataSchema ms = MetadataSchema.find(context, schema);
                if (ms == null )
                {
                    System.err.println("DIM Error, Cannot find metadata schema for: schema=\""+schema+
                        "\" (... element=\""+element+"\", qualifier=\""+qualifier+"\")");
    }
                else
                {
                    if (qualifier != null && qualifier.equals(""))
                    {
                        System.err.println("DIM Warning, qualifier is empty string: "+
                              " schema=\""+schema+"\", element=\""+element+"\", qualifier=\""+qualifier+"\"");
                        qualifier = null;
                    }
                    MetadataField mf = MetadataField.findByElement(context,
                                  ms.getSchemaID(), element, qualifier);
                    if (mf == null)
                        System.err.println("DIM Error, Cannot find metadata field for: schema=\""+schema+
                            "\", element=\""+element+"\", qualifier=\""+qualifier+"\"");
                }
            }
View Full Code Here

        {
            schema = MetadataSchema.DC_SCHEMA;
        }

        // Find the matching schema object
        MetadataSchema schemaObj = MetadataSchema.find(context, schema);
       
        MetadataField field = new MetadataField();
        field.setSchemaID(schemaObj.getSchemaID());
        field.setElement(element);
        field.setQualifier(qualifier);
        field.setScopeNote(scopeNote);
        field.create(context);
    }
View Full Code Here

        MetadataField[] types = MetadataField
                .findAllInSchema(context, schemaID);
        request.setAttribute("types", types);

        // Pull the metadata schema object as well
        MetadataSchema schema = MetadataSchema.find(context, schemaID);
        request.setAttribute("schema", schema);

        // Pull all metadata schemas for the pulldown
        MetadataSchema[] schemas = MetadataSchema.findAll(context);
        request.setAttribute("schemas", schemas);
View Full Code Here

        // If a single schema has been specified
        if (schema != null && !"".equals(schema))
        {
            // Get the id of that schema
            MetadataSchema mdSchema = MetadataSchema.find(context, schema);
            if (mdSchema == null)
            {
                throw new RegistryExportException("no schema to export");
            }
           
            // Get the metadata fields only for the specified schema
            mdFields = MetadataField.findAllInSchema(context, mdSchema.getSchemaID());
        }
        else
        {
            // Get the metadata fields for all the schemas
            mdFields = MetadataField.findAll(context);
View Full Code Here

TOP

Related Classes of org.dspace.content.MetadataSchema

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.