Package com.esri.gpt.framework.jsf

Examples of com.esri.gpt.framework.jsf.MessageBroker


*
* @return message broker
*/
public MessageBroker getMessageBroker() {
  _messageBroker = (_messageBroker != null) ? _messageBroker
      : new MessageBroker();
  return _messageBroker;
}
View Full Code Here


/**
* Gets the list of schema's that can be created with the editor.
* @return the list of schema's
*/
public List<SelectItem> getCreateSchemaItems() {
  MessageBroker msgBroker = extractMessageBroker();
  ArrayList<SelectItem> list = new ArrayList<SelectItem>();
  Schemas schemas = getConfiguredSchemas();
  for (Schema schema: schemas.values()) {
    if (schema.getEditable()) {
      String sKey = schema.getKey();
      String sLabel = schema.getKey();
      if (schema.getLabel() != null) {
        String sResKey = schema.getLabel().getResourceKey();
        if (sResKey.length() > 0) {
          sLabel = msgBroker.retrieveMessage(sResKey);
        }
      }
      list.add(new SelectItem(sKey,sLabel));
    }
  }
View Full Code Here

  // determine the schema to create
  String sCreateSchemaKey = getCreateSchemaKey();
  setOpenSchemaKey("");
  setOpenDocumentUuid("");
  if (sCreateSchemaKey.length() == 0) {
    MessageBroker msgBroker = extractMessageBroker();
    msgBroker.addErrorMessage("publication.createMetadata.err.noSchemaSelected");
  } else {
   
    // create the new schema
    MetadataDocument document = new MetadataDocument();
    Schema schema = document.prepareForCreate(context,sCreateSchemaKey);
View Full Code Here

                         boolean asDraft,
                         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());
  Publisher publisher = getSelectablePublishers().selectedAsPublisher(context,false);

  //  the document
 
  if (validateOnly) {
   
    // handle a validation only request
    ValidationRequest request = new ValidationRequest(context,null,sXml);
    request.verify();
    msgBroker.addSuccessMessage("catalog.publication.success.validated");
   
  } else {
   
    // publish the document
    EditorRequest request = new EditorRequest(context,publisher,sXml);
    request.getPublicationRecord().setUuid(getOpenDocumentUuid());
    if (asDraft) {
      request.getPublicationRecord().setApprovalStatus(MmdEnums.ApprovalStatus.draft.toString());
    }
    request.publish();
    setOpenDocumentUuid(request.getPublicationRecord().getUuid());
    if (asDraft) {
      msgBroker.addSuccessMessage("catalog.publication.success.draftSaved");
    } else {
      if (request.getPublicationRecord().getWasDocumentReplaced()) {
        msgBroker.addSuccessMessage("catalog.publication.success.replaced");
      } else {
        msgBroker.addSuccessMessage("catalog.publication.success.created");
     
    }
  }

}
View Full Code Here

  Publisher publisher = null;
  HttpClientRequest httpClient = HttpClientRequest.newRequest();
  ProcessingContext processingContext = new ProcessingContext(requestContext, publisher, httpClient, null, false);

  FacesContextBroker contextBroker = new FacesContextBroker();
  MessageBroker msgBroker = contextBroker.extractMessageBroker();
  processingContext.setMessageBroker(msgBroker);

  return processingContext;
}
View Full Code Here

public void execute(HttpServletRequest request, HttpServletResponse response,
    RequestContext context) throws Exception {
 
  LOG.finer("Handling rest query string=" + request.getQueryString());

  MessageBroker msgBroker = new FacesContextBroker(request, response)
      .extractMessageBroker();

  // parse the query
  RestQuery query = null;
  PrintWriter printWriter = null;
View Full Code Here

    // initialize
    if (context == null) {
      context = RequestContext.extract(servletRequest);
    }
    if (messageBroker == null) {
      messageBroker = new MessageBroker();
      messageBroker.setBundleBaseName("gpt.resources.gpt");
    }
    CatalogConfiguration catCfg = context.getCatalogConfiguration();
 
    // look for a configured class name for the resource link builder
View Full Code Here

  protected void execute(HttpServletRequest request,
          HttpServletResponse response,
          RequestContext context)
          throws Exception {
    getLogger().finer("Handling rest query string=" + request.getQueryString());
    MessageBroker msgBroker = new FacesContextBroker(request, response).extractMessageBroker();

    // extra params
    Map<String, String> extraMap = new HashMap<String, String>();
    extraMap.put(PARAM_KEY_SHOW_THUMBNAIL,
            request.getParameter(PARAM_KEY_SHOW_THUMBNAIL));
View Full Code Here

  private void process() throws IOException {
    LOGGER.info("Starting DCAT cache update process...");
    RestQuery query = new RestQuery();
    query.setResponseFormat("dcat");
    RequestContext context = RequestContext.extract(null);
    MessageBroker msgBroker = new MessageBroker();
    msgBroker.setBundleBaseName(MessageBroker.DEFAULT_BUNDLE_BASE_NAME);
   
    String baseContextPath = Val.chkStr(RequestContext.resolveBaseContextPath(null));
    if (baseContextPath.isEmpty()) {
      StringAttributeMap params = ApplicationContext.getInstance().getConfiguration().getCatalogConfiguration().getParameters();
      baseContextPath = Val.chkStr(params.getValue("reverseProxy.baseContextPath"));;
View Full Code Here

        while(iter1.hasNext()) {
          String key1 = iter1.next();
          if(key1.toLowerCase().equals(("key"))) {
            params1.put("id", params.get(key1));
          } else if (key1.toLowerCase().equals(("labelresourcekey"))) {
            MessageBroker messageBroker = new MessageBroker();
            messageBroker.setBundleBaseName("gpt.resources.gpt");
            params1.put("name",
                messageBroker.retrieveMessage(params.get(key1)));
          }
        }
        if(allowExt || key.toLowerCase().equals("local"))
          _searchRepos.put(key, params1);
        break;
View Full Code Here

TOP

Related Classes of com.esri.gpt.framework.jsf.MessageBroker

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.