Package com.esri.gpt.catalog.schema

Examples of com.esri.gpt.catalog.schema.Schema


    String sXml = Val.chkStr(Val.removeBOM(xml));
    if (sXml.length() == 0) {
      throw new UnrecognizedSchemaException("Unrecognized metadata schema.");
    } else {
      MetadataDocument document = new MetadataDocument();
      Schema schema = document.prepareForView(context,sXml);
      return schema;
    }
  } 
View Full Code Here


      GxeDefinition definition = null;
      String key = Val.chkStr(request.getParameter("key"));
      String loc = Val.chkStr(request.getParameter("loc"));
      if (key.length() > 0) {
        Schemas schemas = context.getCatalogConfiguration().getConfiguredSchemas();
        Schema schema = schemas.get(key);
        if (schema != null) {
          definition = schema.getGxeEditorDefinition();
        }
      } else if (loc.length() > 0) {
        definition = new GxeDefinition();
        definition.setFileLocation(loc);
      } else {
       
        String xml = null;
        try {
          xml = this.readInputCharacters(request);
        } catch (IOException e) {
          LOGGER.log(Level.WARNING,"Error processing request.",e);
          throw new ServletException("400: IOException while reading request body.");
        }
        xml = Val.chkStr(Val.removeBOM(xml));
        if (xml.length() > 0) {
          MetadataDocument document = new MetadataDocument();
          Schema schema = document.prepareForView(context,xml);
          if (schema != null) {
            definition = schema.getGxeEditorDefinition();
          }
        }
       
      }
      if (definition != null) {
View Full Code Here

    msgBroker.addErrorMessage("publication.createMetadata.err.noSchemaSelected");
  } else {
   
    // create the new schema
    MetadataDocument document = new MetadataDocument();
    Schema schema = document.prepareForCreate(context,sCreateSchemaKey);
    setOpenSchemaKey(schema.getKey());
   
    // check for a defined GXE based Geoportal XML editor
    GxeDefinition gxeDefinition = schema.getGxeEditorDefinition();
    if (gxeDefinition != null) {
      context.getServletRequest().setAttribute("gxeDefinitionKey",gxeDefinition.getKey());
      context.getServletRequest().setAttribute("gxeDefinitionLocation",gxeDefinition.getFileLocation());
      context.getServletRequest().setAttribute("gxeOpenDocumentId",this.getOpenDocumentUuid());
      setNavigationOutcome("catalog.publication.gxeEditor");
View Full Code Here

  getSelectablePublishers().setSelectedKey(getOnBehalfOf());
  Publisher publisher = getSelectablePublishers().selectedAsPublisher(context,false);
 
  // prepare the schema for edit
  MetadataDocument document = new MetadataDocument();
  Schema schema = document.prepareForEdit(context,publisher,sOpenDocumentUuid);
  setOpenSchemaKey(schema.getKey());
 
  // check for a defined GXE based Geoportal XML editor
  GxeDefinition gxeDefinition = schema.getGxeEditorDefinition();
  if (gxeDefinition != null) {
    context.getServletRequest().setAttribute("gxeDefinitionKey",gxeDefinition.getKey());
    context.getServletRequest().setAttribute("gxeDefinitionLocation",gxeDefinition.getFileLocation());
    context.getServletRequest().setAttribute("gxeOpenDocumentId",this.getOpenDocumentUuid());
    setNavigationOutcome("catalog.publication.gxeEditor");
View Full Code Here

                         boolean validateOnly)
  throws Exception  {
 
  // initialize
  MessageBroker msgBroker = extractMessageBroker();
  Schema schema = null;
 
  // find the metadata editor form
  UIViewRoot root = getContextBroker().extractViewRoot();
  UIComponent editorForm = root.findComponent("mdEditor");
  if (editorForm == null) {
    String sMsg = "Programming error: The mdEditor form connot be located.";
    throw new SchemaException(sMsg);
  }
 
  // determine the currently open schema
  String sOpenSchemaKey = getOpenSchemaKey();
  if (sOpenSchemaKey.length() == 0) {
    String sMsg = "Programming error: The openSchemaKey was not specified.";
    throw new SchemaException(sMsg);
  } else {
    MetadataDocument document = new MetadataDocument();
    schema = document.prepareForCreate(context,sOpenSchemaKey);
  }
 
  // un-bind editor values, validate the input
  UiContext uiContext = new UiContext();
  schema.unBind(uiContext,editorForm);

  try {
    if (!asDraft) schema.validate();
  } catch (ValidationException e) {
    for (ValidationError error: e.getValidationErrors()) {
      if (error.getSection() != null) {
        if (!error.getSection().getOpen()) {
          error.getSection().forceOpen(editorForm);
        }
      }
    }
    throw e;
  }
   
  // update the document
  Document dom = schema.loadTemplate();
  schema.update(dom);
  String sXml = XmlIoUtil.domToString(dom);
  getLogger().finer("Updated template xml:\n"+sXml);
 
  // prepare the publisher
  getSelectablePublishers().setSelectedKey(getOnBehalfOf());
View Full Code Here

    }
  } catch (ValidationException e) {
    String sKey = e.getKey();
    if (sKey.length() > 0) {
      String sMsg = sKey;
      Schema schema = getConfiguredSchemas().get(sKey);
      if (schema != null) {
        if (schema.getLabel() != null) {
          String sResKey = schema.getLabel().getResourceKey();
          if (sResKey.length() > 0) {
            sMsg = extractMessageBroker().retrieveMessage(sResKey)+" ("+sKey+")";
          }
        }
      }
View Full Code Here

    } catch (ValidationException e) {
      String sKey = e.getKey();
      if (sKey.length() > 0) {
        String sMsg = sKey;
        Schema schema = context.getCatalogConfiguration().getConfiguredSchemas().get(sKey);
        if (schema != null) {
          if (schema.getLabel() != null) {
            String sResKey = schema.getLabel().getResourceKey();
            if (sResKey.length() > 0) {
              sMsg = extractMessageBroker().retrieveMessage(sResKey) + " (" + sKey + ")";
            }
          }
        }
View Full Code Here

              }
              String sXml = Val.chkStr(this.readXml(uuid));
              if (sXml.length() > 0) {
                info.numRequiringUpdate++;
                MetadataDocument mdDoc = new MetadataDocument();
                Schema schema = mdDoc.prepareForView(this.context,sXml);
                this.adapter.publishDocument(uuid,tsDbModified,schema,sDbAcl);
                info.numDocsUpdated++;
              }
            } catch (SchemaException se) {
             
View Full Code Here

         
          try {
            String sXml = Val.chkStr(dao.readXml(uuid));
            if (sXml.length() > 0) {
              MetadataDocument mdDoc = new MetadataDocument();
              Schema schema = mdDoc.prepareForView(context,sXml);
              adapter.publishDocument(uuid,tsDbModified,schema,sDbAcl);
            }
          } catch (SchemaException se) {
           
            // don't allow the entire process to fail over one bad xml
View Full Code Here

   */
  protected void onRecordUpdated(String xml) {
    if (!this.isActive()) return;
    try {
      MetadataDocument mdDoc = new MetadataDocument();
      Schema schema = mdDoc.prepareForView(requestContext,xml);
      xml = mdDoc.prepareForFullViewing(xml);
      publish(schema,xml);
    } catch (Exception e) {
      LOGGER.log(Level.SEVERE,"Publication to remote service failed.",e);
    }
View Full Code Here

TOP

Related Classes of com.esri.gpt.catalog.schema.Schema

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.