Package com.esri.gpt.framework.jsf

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


    sb.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
    sb.append("<ARCXML version=\"1.1\"><RESPONSE><ERROR>");

    boolean bProcessMessages = true;
    if (bProcessMessages) {
      MessageBroker messageBroker = new MessageBroker();
      messageBroker.setBundleBaseName("gpt.resources.gpt");
      ArrayList<String> messages = new ArrayList<String>();
      e.getValidationErrors().buildMessages(messageBroker, messages, true);
      sb.append("ValidationError:Metadata publication failed.");
      boolean bFirst = true;
      for (String error : messages) {
View Full Code Here


        tSummary.setTotalUpdated(tSummary.getTotalUpdated() + 1);
      } else {
        tSummary.setTotalInserted(tSummary.getTotalInserted() + 1);
      }
    } catch (ValidationException e) {
      MessageBroker msgBroker = new MessageBroker();
      msgBroker.setBundleBaseName(MessageBroker.DEFAULT_BUNDLE_BASE_NAME);
      ArrayList<String> messages = new ArrayList<String>();
      e.getValidationErrors().buildMessages(msgBroker,messages,true);     
     
      StringBuilder sb = new StringBuilder();
      sb.append("<![CDATA[");
View Full Code Here

    // inform the Lucene index adapter
    LuceneIndexAdapter.onContextInit(appCtx);

    //// create harvester engine
    // create message broker
    MessageBroker messageBroker = new MessageBroker();
    messageBroker.setBundleBaseName(MessageBroker.DEFAULT_BUNDLE_BASE_NAME);

    // create web harvester
    Harvester harvester = new Harvester(messageBroker, appCtx.getConfiguration().getHarvesterConfiguration());
    appCtx.setHarvestingEngine(harvester);
   
View Full Code Here

* @param applyToAll <code>true</code> to apply action to current set
* @throws Exception if an exception occurs
*/
private void executeAction(ActionEvent event, final RequestContext context,
    MmdActionCriteria actionCriteria, Publisher publisher, boolean applyToAll) throws Exception {
  MessageBroker msgBroker = extractMessageBroker();

  // check to ensure that records were selected
  if (actionCriteria.getSelectedRecordIdSet().size() == 0 && applyToAll==false) {
    msgBroker.addErrorMessage("catalog.publication.manageMetadata.action.err.noneSelected");
  } else {

    // check the publisher
    Publisher publisherForAction = publisher;
    if (!publisher.getIsAdministrator()) {
      String sOwner = getQueryCriteria().getOwner();
      if (sOwner.length() == 0) {
        sOwner = publisher.getKey();
      }
      if (!sOwner.equalsIgnoreCase(publisher.getKey())) {
        if (!Publisher.buildSelectablePublishers(context, true).containsKey(sOwner)) {
          throw new NotAuthorizedException("Not authorized.");
        } else {
          publisherForAction = new Publisher(context, sOwner);
        }
      }
    }

    // execute the request
    MmdCriteria criteria = new MmdCriteria();
    criteria.setActionCriteria(actionCriteria);

    if (_metadataAccessPolicyConfig==null) {
      getSelectablePublishers().build(context, true);
      prepareAccessPolicyConfig(context);
      prepareGroups(context);
      prepareActionCriteria(context);
    }
   
    String defaultGroup = _metadataAccessPolicyConfig.getAccessToGroupDN();
    if (defaultGroup != null && defaultGroup.trim().length() > 0) {
      ArrayList<String> defaultAcl = new ArrayList<String>();
      defaultAcl.add(getActionCriteria().getToggleMetadataAccessPolicy());
      criteria.getActionCriteria().setMetadataAccessPolicy(defaultAcl);
    }

    MmdActionRequest request = new MmdActionRequest(context,publisherForAction,criteria,getResult());
    if (!applyToAll) {
      request.execute();
    } else {
      if (!_queryCriteriaForAction.getIsEmpty()) {
        request.execute(_queryCriteriaForAction);
      }
    }

    // set the success message
    int nModified = getActionResult().getNumberOfRecordsModified();
    if (nModified > 0) {
      String sKey = "catalog.publication.manageMetadata.action.success";
      if (actionCriteria.getActionKey().equalsIgnoreCase("delete")) {
        sKey += ".delete";
      }
      String[] args = new String[1];
      args[0] = "" + nModified;
      msgBroker.addSuccessMessage(sKey, args);
    }
    if (request.hadUnalteredDraftDocuments()) {
      msgBroker.addErrorMessage("catalog.publication.manageMetadata.action.err.draftUnaltered");
    }
  }
}
View Full Code Here

  String absKey = null;
  if(map != null) {
     absKey = map.get("abstractResourceKey");
  }
  MessageBroker bundle = new MessageBroker();
  bundle.setBundleBaseName(MessageBroker.DEFAULT_BUNDLE_BASE_NAME);
  return bundle.retrieveMessage(absKey);
}
View Full Code Here

* @param publisher the publisher
* @throws Exception if an exception occurs
*/
private void executeSearch(ActionEvent event, RequestContext context,
    Publisher publisher) throws Exception {
  MessageBroker msgBroker = extractMessageBroker();

  // check the publisher
  if (!publisher.getIsAdministrator()) {
    if (getQueryCriteria().getOwner().length() == 0) {
      getQueryCriteria().setOwner(publisher.getKey());
    }
    String sOwner = getQueryCriteria().getOwner();
    if (!sOwner.equalsIgnoreCase(publisher.getKey())) {
      if (!Publisher.buildSelectablePublishers(context, true).containsKey(sOwner)) {
        getQueryCriteria().setOwner(publisher.getKey());
      }
    }
  }

  // execute the request
  MmdQueryRequest request;
  request = new MmdQueryRequest(context, publisher, getCriteria(), getResult());
  request.execute();
 
  // determine if collections are in use
  CollectionDao colDao = new CollectionDao(context);
  boolean useCollections = colDao.getUseCollections();

  // set the resource messages for the results
  String sMsg;
  String sValue;
  for (MmdRecord record : request.getQueryResult().getRecords()) {

    // lookup approval status
    sValue = record.getApprovalStatus();
    sMsg = msgBroker.retrieveMessage("catalog.publication.manageMetadata.status."+sValue);
    record.setApprovalStatusMsg(sMsg);

    // lookup publication method
    sValue = record.getPublicationMethod();
    sMsg = msgBroker.retrieveMessage("catalog.publication.manageMetadata.method."+sValue);
    record.setPublicationMethodMsg(sMsg);
   
    // collection membership
    if (useCollections) {
      sValue = Val.chkStr(record.getCollectionMembership());
      if (sValue.length() > 0) {
        Object[] p = new String[]{sValue};
        sMsg = msgBroker.retrieveMessage("catalog.publication.manageMetadata.sharing.collection.popup",p);
        record.setCollectionMembership(sMsg);
      }
    }
  }
}
View Full Code Here

* Gets protocols eligible to choose.
* @return collection of protocols eligible to choose
*/
public ArrayList<SelectItem> getProtocols() {
  ArrayList<SelectItem> protocols = new ArrayList<SelectItem>();
  MessageBroker msgBroker = getContextBroker().extractMessageBroker();
  ApplicationContext appCtx = ApplicationContext.getInstance();
  ApplicationConfiguration appCfg = appCtx.getConfiguration();
  ProtocolFactories protocolFactories = appCfg.getProtocolFactories();
  protocols.add(new SelectItem("", msgBroker.retrieveMessage("catalog.harvest.manage.edit.protocol.any")));
  for (String key: protocolFactories.getKeys()) {
    ProtocolFactory pf = protocolFactories.get(key);
    if (pf instanceof AgpProtocolFactory && !AGSProcessorConfig.isAvailable()) continue;
    String resourceKey = protocolFactories.getResourceKey(key);
    SelectItem item = new SelectItem(key.toLowerCase(), msgBroker.retrieveMessage(resourceKey));
    protocols.add(item);
  }
  return protocols;
}
View Full Code Here

    else {
      strMessage = e.getMessage();
      rethrowExcep = true;
    }

    MessageBroker broker = this.extractMessageBroker();
    if(broker != null) {
      FacesMessage message = new FacesMessage();
      message.setSummary(strMessage);
      message.setSeverity(FacesMessage.SEVERITY_ERROR);
      broker.addMessage(message);


    }
    if(rethrowExcep) {
      throw e;
View Full Code Here

    // check for a configured XSLT to generate the details page,
    // otherwise, generate the details page from the defined schema
    String htmlFragment = "";
    if (schema.getDetailsXslt().length() > 0) {
       try {
           MessageBroker broker = this.extractMessageBroker();
            htmlFragment = Val.chkStr(document.transformDetails(metadataXml,schema.getDetailsXslt(),broker));
      } catch (TransformerException e) {
        htmlFragment = "";
        LOG.log(Level.SEVERE,"Cannot transform metadata details: "+schema.getDetailsXslt(),e);
      }
View Full Code Here

protected String getRestSearchRequestUrl(String format) {
  SearchCriteria criteria = this.getSearchCriteria();
  RequestContext context =  this.getContextBroker().extractRequestContext();
  HttpServletRequest request = this.getContextBroker().extractHttpServletRequest();
 
  MessageBroker messageBroker = this.getContextBroker().extractMessageBroker();
  RestUrlBuilder builder = RestUrlBuilder.newBuilder(context,request,messageBroker);
  String params = builder.buildParameters(criteria,format,null);
  String url = request.getContextPath()+"/rest/find/document";
  if ((params != null) && (params.length() > 0)) {
    url += "?"+params;
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.