コード例 #1
0
 @Transactional
 @Override
 public WorkProductList getHAVEMessages(String incidentID) {
   /*
    * Get a list of WP by Type from Work Product
    */
   try {
     List<WorkProduct> listOfProducts =
         getWorkProductService().getProductByTypeAndXQuery(HAVE_PRODUCT_TYPE, null, null);
     if (listOfProducts != null && listOfProducts.size() > 0) {
       return createWorkProductList(listOfProducts, incidentID);
     }
   } catch (InvalidXpathException e) {
     log.error("getRequestResources: " + e.getMessage());
   }
   return null;
 }
コード例 #2
0
  @Override
  public WorkProductDocument findHAVEMessage(String distributionReference) {
    WorkProductDocument workProduct = WorkProductDocument.Factory.newInstance();
    workProduct.addNewWorkProduct();

    String[] elements = distributionReference.split(",");
    if (elements.length == 3) {
      StringBuffer sb = new StringBuffer();
      String DID = "/de:EDXLDistribution[de:distributionID/text()='";
      // /urn:EdxlDeRequest/de:EDXLDistribution[de:distributionID='DE_DISTRIBUTION_ID']
      sb.append(DID);
      sb.append(elements[0]);
      sb.append("']");
      // and /urn:EdxlDeRequest/de:EDXLDistribution[de:senderID='RMApplication1@core1']
      sb.append("and /de:EDXLDistribution[de:senderID='");
      sb.append(elements[1]);
      sb.append("']");
      // /de:EDXLDistribution[de:dateTimeSent='2010-11-11T13:42:36.890-05:00']
      sb.append("and /de:EDXLDistribution[de:dateTimeSent='");
      sb.append(elements[2]);
      sb.append("']");
      Map<String, String> namespaceMap = new HashMap<String, String>();
      namespaceMap.put("de", "urn:oasis:names:tc:emergency:EDXL:DE:1.0");
      try {
        List<WorkProduct> list =
            workProductService.getProductByTypeAndXQuery(
                HAVE_PRODUCT_TYPE, sb.toString(), namespaceMap);
        if (list.size() == 1) {
          WorkProduct wp = list.get(0);
          workProduct.setWorkProduct(WorkProductHelper.toWorkProduct(wp));
        }
      } catch (InvalidXpathException e) {
        log.error("Invalid XPath expression finding HAVE message: " + e.getMessage());
      }
    }

    return workProduct;
  }