Exemplo n.º 1
0
  public Node getTransactionInfo(Node n) {

    if (XMLUtil.getNode(n, "descendant::receivedPedigree") != null) {
      return XMLUtil.getNode(n, "descendant::shippedPedigree/transactionInfo");
    } else {
      return XMLUtil.getNode(n, "descendant::initialPedigree/transactionInfo");
    }
  }
Exemplo n.º 2
0
  public boolean checkManufacturer(String str) {

    Node n1 = XMLUtil.parse(str);
    Node n2 = XMLUtil.getNode(n1, "descendant::repackagedPedigree");

    if ((XMLUtil.getNode(n2, "descendant::receivedPedigree")) == null) {
      if ((XMLUtil.getNode(n2, "descendant::altPedigree")) == null) {
        return true;
      } else {
        String str1 = XMLUtil.getValue(n2, "descendant::altPedigree/data");
        System.out.println("+++++++++++++++++++altPedigreeee Dataaaaaaaaa: +++++++++++++++" + str1);
        if (str1 == null || str1.trim().equals("")) {
          return true;
        }
      }
    }

    return false;
  }
Exemplo n.º 3
0
 /**
  * Similar to getNode but parses an xmlString and returns node for the path
  *
  * @param xmlString
  * @param xpath
  * @return
  */
 public static Node parse(String xmlString, String xpath) {
   Node node = null;
   try {
     Node nd = XMLUtil.parse(xmlString);
     node = jaxenXPath.getSingleNode(nd, xpath);
   } catch (Exception e) {
     e.printStackTrace();
   }
   return node;
 }
Exemplo n.º 4
0
  public String[] createPDF(String pedigreeID) {

    String[] filePath = new String[2];
    try {

      String query = "tlsp:getRepackagedInfo_MD('" + pedigreeID + "')";
      System.out.println("query in sendPDF method : " + query);
      String str = queryRunner.returnExecuteQueryStringsAsString(query);
      System.out.println("REsult in sendPDF method : " + str);

      if (str != null) {
        Node n1 = XMLUtil.parse(str);
        System.out.println("-------ni is-----" + n1);

        Node n2 = XMLUtil.getNode(n1, "/shippedPedigree");
        Node n3 = XMLUtil.getNode(n2, "descendant::repackagedPedigree");

        if (n3 != null) {
          String f = createRepackagePDF(pedigreeID, str);
          if (f == null) throw new Exception();
          filePath[0] = f;
        } else {
          filePath[0] = createInitialPDF(str, pedigreeID);
        }
      }
    } catch (Exception e) {
      // TODO Auto-generated catch block
      try {
        System.out.println("IN CATCH BLOCK 343");
        /*SendDHFormEmail.sendMailToSupport("*****@*****.**","*****@*****.**","smarthost.coxmail.com",
                         "Error in Create PDF",e.getMessage(),"*****@*****.**","60empire");
        e.printStackTrace();*/
      } catch (Exception ex) {
      }
      e.printStackTrace();
    }

    return filePath;
  }
Exemplo n.º 5
0
  public boolean compare(Node n1) {

    Node businessAddress = XMLUtil.getNode(n1, "transactionInfo/senderInfo/businessAddress");
    Node shippingAddress = XMLUtil.getNode(n1, "transactionInfo/senderInfo/shippingAddress");

    if (businessAddress != null && shippingAddress != null) {
      /*if(XMLUtil.getValue(businessAddress,"businessName").equals(XMLUtil.getValue(shippingAddress,"businessName"))){
      	if(XMLUtil.getValue(businessAddress,"street1").equals(XMLUtil.getValue(shippingAddress,"street1"))){
      		if(XMLUtil.getValue(businessAddress,"street2").equals(XMLUtil.getValue(shippingAddress,"street2"))){
      			if(XMLUtil.getValue(businessAddress,"city").equals(XMLUtil.getValue(shippingAddress,"city"))){
      				if(XMLUtil.getValue(businessAddress,"stateOrRegion").equals(XMLUtil.getValue(shippingAddress,"stateOrRegion"))){
      					if(XMLUtil.getValue(businessAddress,"postalCode").equals(XMLUtil.getValue(shippingAddress,"postalCode"))){
      						if(XMLUtil.getValue(businessAddress,"country").equals(XMLUtil.getValue(shippingAddress,"country"))){
      							return true;
      						}
      					}

      				}
      			}
      		}
      	}
      }*/

      if (check(
          XMLUtil.getValue(businessAddress, "businessName"),
          (XMLUtil.getValue(shippingAddress, "businessName")))) {
        if (check(
            XMLUtil.getValue(businessAddress, "street1"),
            (XMLUtil.getValue(shippingAddress, "street1")))) {
          if (check(
              XMLUtil.getValue(businessAddress, "street2"),
              (XMLUtil.getValue(shippingAddress, "street2")))) {
            if (check(
                XMLUtil.getValue(businessAddress, "city"),
                (XMLUtil.getValue(shippingAddress, "city")))) {
              if (check(
                  XMLUtil.getValue(businessAddress, "stateOrRegion"),
                  (XMLUtil.getValue(shippingAddress, "stateOrRegion")))) {
                if (check(
                    XMLUtil.getValue(businessAddress, "postalCode"),
                    (XMLUtil.getValue(shippingAddress, "postalCode")))) {
                  if (check(
                      XMLUtil.getValue(businessAddress, "country"),
                      (XMLUtil.getValue(shippingAddress, "country")))) {
                    return true;
                  }
                }
              }
            }
          }
        }
      }
    }
    if (shippingAddress == null) {
      return true;
    }
    return false;
  }
Exemplo n.º 6
0
  public String getRepackageXSLString(String str, String pedigreeID, String uri) throws Exception {

    StringBuffer buffer = new StringBuffer("<shippedPedigree>");

    Node n1 = XMLUtil.parse(str);
    Node n2 = XMLUtil.getNode(n1, "/shippedPedigree");

    String strName = XMLUtil.getValue(n2, "signatureInfo/signerInfo/name");
    String signEmail = XMLUtil.getValue(n2, "signatureInfo/signerInfo/email");

    // adding business name
    buffer.append(
        XMLUtil.convertToString(
            XMLUtil.getNode(n2, "transactionInfo/senderInfo/businessAddress/businessName"), true));

    buffer.append(
        XMLUtil.convertToString(
            XMLUtil.getNode(n2, "descendant::repackagedPedigree/productInfo/drugName"), true));
    buffer.append(
        XMLUtil.convertToString(
            XMLUtil.getNode(n2, "descendant::repackagedPedigree/productInfo/strength"), true));
    buffer.append(
        XMLUtil.convertToString(
            XMLUtil.getNode(n2, "descendant::repackagedPedigree/productInfo/dosageForm"), true));
    buffer.append(
        XMLUtil.convertToString(
            XMLUtil.getNode(n2, "descendant::repackagedPedigree/productInfo/containerSize"), true));
    buffer.append(
        XMLUtil.convertToString(
            XMLUtil.getNode(n2, "descendant::repackagedPedigree/productInfo/productCode"), true));
    if ((XMLUtil.getNode(n2, "descendant::repackagedPedigree/productInfo/manufacturer")) != null) {
      buffer.append(
          XMLUtil.convertToString(
              XMLUtil.getNode(n2, "descendant::repackagedPedigree/productInfo/manufacturer"),
              true));
    }
    buffer.append(XMLUtil.convertToString(XMLUtil.getNode(n2, "signatureInfo/signerInfo"), true));

    Node n3 = XMLUtil.getNode(n2, "descendant::repackagedPedigree");
    // to check if any altPedigree exists
    if ((XMLUtil.getNode(n3, "descendant::altPedigree")) != null) {
      buffer.append("<altPedigree>yes</altPedigree>");
    }

    int i = 0;
    List ls = new ArrayList();
    Iterator it = XMLUtil.executeQuery(n2, "itemInfo").iterator();
    // Iterator it=XMLUtil.executeQuery(n3,"itemInfo").iterator();
    while (it.hasNext()) {

      Node n4 = (Node) it.next();

      buffer.append(XMLUtil.convertToString(n4, true));
      i++;
    }

    // adding new code here...

    if (i == 0) {
      Node shippedNode = XMLUtil.getNode(n2, "child::*/child::shippedPedigree");

      while (true) {

        if (shippedNode != null) {
          Iterator itemIterator = XMLUtil.executeQuery(shippedNode, "itemInfo").iterator();
          // Iterator it=XMLUtil.executeQuery(n3,"itemInfo").iterator();
          while (it.hasNext()) {

            Node itemNode = (Node) itemIterator.next();

            buffer.append(XMLUtil.convertToString(itemNode, true));
            i++;
          }
          shippedNode = XMLUtil.getNode(shippedNode, "child::*/child::shippedPedigree");
        }

        if (i > 0 || shippedNode == null) break;
      }
      if (i == 0) {

        Iterator initialItemInfoIt = XMLUtil.executeQuery(n3, "itemInfo").iterator();
        // Iterator it=XMLUtil.executeQuery(n3,"itemInfo").iterator();
        while (initialItemInfoIt.hasNext()) {

          Node n4 = (Node) initialItemInfoIt.next();

          buffer.append(XMLUtil.convertToString(n4, true));
        }
      }
    }

    buffer.append(
        XMLUtil.convertToString(XMLUtil.getNode(n2, "transactionInfo/transactionDate"), true));
    buffer.append(
        XMLUtil.convertToString(
            XMLUtil.getNode(n2, "transactionInfo/transactionIdentifier/identifier"), true));
    buffer.append(
        XMLUtil.convertToString(
            XMLUtil.getNode(n2, "transactionInfo/transactionIdentifier/identifierType"), true));

    Iterator it1 =
        XMLUtil.executeQuery(n2, "descendant::repackagedPedigree/previousProducts").iterator();
    while (it1.hasNext()) {
      Node n4 = (Node) it1.next();
      buffer.append(XMLUtil.convertToString(n4, true));
    }

    buffer.append("<custodyChain>");
    String serialNumber = "";
    Node intialShipped = XMLUtil.getNode(n2, "descendant-or-self::*[repackagedPedigree]");

    Node repackTransactionInfo = getTransactionInfo(n3);

    if (intialShipped != null) {
      buffer.append("<transactionInfo>");
      boolean flag = compare(intialShipped);

      serialNumber = XMLUtil.getValue(intialShipped, "documentInfo/serialNumber");
      buffer.append(
          XMLUtil.convertToString(
              XMLUtil.getNode(intialShipped, "transactionInfo/senderInfo/businessAddress"), true));
      // Setting the business Address
      /*buffer.append(XMLUtil.convertToString(XMLUtil.getNode(intialShipped,"transactionInfo/transactionIdentifier/identifier"),true));
      buffer.append(XMLUtil.convertToString(XMLUtil.getNode(intialShipped,"transactionInfo/transactionIdentifier/identifierType"),true));
      buffer.append(XMLUtil.convertToString(XMLUtil.getNode(intialShipped,"transactionInfo/transactionDate"),true));
      */
      if (repackTransactionInfo != null) {
        buffer.append(
            XMLUtil.convertToString(
                XMLUtil.getNode(repackTransactionInfo, "transactionIdentifier/identifier"), true));
        buffer.append(
            XMLUtil.convertToString(
                XMLUtil.getNode(repackTransactionInfo, "transactionIdentifier/identifierType"),
                true));
        buffer.append(
            XMLUtil.convertToString(
                XMLUtil.getNode(repackTransactionInfo, "transactionDate"), true));
      }

      if ((XMLUtil.getNode(intialShipped, "transactionInfo/senderInfo/contactInfo")) != null) {
        buffer.append(
            XMLUtil.convertToString(
                XMLUtil.getNode(intialShipped, "transactionInfo/senderInfo/contactInfo"), true));
      }
      buffer.append(
          XMLUtil.convertToString(
              XMLUtil.getNode(intialShipped, "transactionInfo/recipientInfo"), true));
      buffer.append(
          XMLUtil.convertToString(
              XMLUtil.getNode(intialShipped, "signatureInfo/signerInfo"), true));

      if (!flag) {
        buffer.append(
            XMLUtil.convertToString(
                XMLUtil.getNode(intialShipped, "transactionInfo/senderInfo/shippingAddress"),
                true));
      }
      buffer.append("</transactionInfo>");
    }

    if (!(pedigreeID.equals(serialNumber))) {

      Node shippedNode = XMLUtil.getNode(intialShipped, "ancestor::shippedPedigree");
      Node testNode = intialShipped;
      while (true) {

        // Node shippedNode =
        // XMLUtil.getNode(n2,".[descendant-or-self::*/shippedPedigree/documentInfo/serialNumber='"+serialNumber+"']");

        if (shippedNode != null) {

          buffer.append("<transactionInfo>");
          boolean flag = compare(shippedNode);

          serialNumber = XMLUtil.getValue(shippedNode, "documentInfo/serialNumber");

          buffer.append(
              XMLUtil.convertToString(
                  XMLUtil.getNode(shippedNode, "transactionInfo/senderInfo/businessAddress"),
                  true));
          // Setting the business Address
          /*buffer.append(XMLUtil.convertToString(XMLUtil.getNode(shippedNode,"transactionInfo/transactionIdentifier/identifier"),true));
          buffer.append(XMLUtil.convertToString(XMLUtil.getNode(shippedNode,"transactionInfo/transactionIdentifier/identifierType"),true));
          buffer.append(XMLUtil.convertToString(XMLUtil.getNode(shippedNode,"transactionInfo/transactionDate"),true));
          */
          buffer.append(
              XMLUtil.convertToString(
                  XMLUtil.getNode(testNode, "transactionInfo/transactionIdentifier/identifier"),
                  true));
          buffer.append(
              XMLUtil.convertToString(
                  XMLUtil.getNode(testNode, "transactionInfo/transactionIdentifier/identifierType"),
                  true));
          buffer.append(
              XMLUtil.convertToString(
                  XMLUtil.getNode(testNode, "transactionInfo/transactionDate"), true));

          buffer.append(
              XMLUtil.convertToString(
                  XMLUtil.getNode(shippedNode, "transactionInfo/senderInfo/contactInfo"), true));

          buffer.append(
              XMLUtil.convertToString(
                  XMLUtil.getNode(shippedNode, "transactionInfo/recipientInfo"), true));

          buffer.append(
              XMLUtil.convertToString(
                  XMLUtil.getNode(shippedNode, "signatureInfo/signerInfo"), true));

          // Setting the Shipping Address

          if (!flag) {
            buffer.append(
                XMLUtil.convertToString(
                    XMLUtil.getNode(shippedNode, "transactionInfo/senderInfo/shippingAddress"),
                    true));
          }

          testNode = shippedNode;
          shippedNode = XMLUtil.getNode(shippedNode, "ancestor::shippedPedigree");

          buffer.append("</transactionInfo>");
        }

        if (pedigreeID.equals(serialNumber) || shippedNode == null) break;
      }
    }

    buffer.append("</custodyChain>");

    buffer.append("<date>" + CommonUtil.dateToString(new Date()) + "</date>");
    buffer.append("<path>" + uri + "</path>");
    buffer.append("<signPath>" + uri + "</signPath>");
    buffer.append("</shippedPedigree>");
    log.info("XML :" + buffer.toString());
    getSignatureImage1(strName, signEmail);
    return buffer.toString();
  }
Exemplo n.º 7
0
  public String getInitialXSLString(String str, String pedigreeID, String uri) throws Exception {

    StringBuffer buffer = new StringBuffer("<shippedPedigree>");

    Node n1 = XMLUtil.parse(str);
    Node n2 = XMLUtil.getNode(n1, "/shippedPedigree");

    String strName = XMLUtil.getValue(n2, "signatureInfo/signerInfo/name");
    String signEmail = XMLUtil.getValue(n2, "signatureInfo/signerInfo/email");
    // adding business name
    buffer.append(
        XMLUtil.convertToString(
            XMLUtil.getNode(n2, "transactionInfo/senderInfo/businessAddress/businessName"), true));

    buffer.append(
        XMLUtil.convertToString(
            XMLUtil.getNode(n2, "descendant::initialPedigree/productInfo/drugName"), true));
    buffer.append(
        XMLUtil.convertToString(
            XMLUtil.getNode(n2, "descendant::initialPedigree/productInfo/strength"), true));
    buffer.append(
        XMLUtil.convertToString(
            XMLUtil.getNode(n2, "descendant::initialPedigree/productInfo/dosageForm"), true));
    buffer.append(
        XMLUtil.convertToString(
            XMLUtil.getNode(n2, "descendant::initialPedigree/productInfo/containerSize"), true));
    buffer.append(
        XMLUtil.convertToString(
            XMLUtil.getNode(n2, "descendant::initialPedigree/productInfo/productCode"), true));

    Node n3 = XMLUtil.getNode(n2, "descendant::initialPedigree");
    System.out.println("Value of node ***** : " + n2 + " signer Name : " + str);
    if ((XMLUtil.getNode(n2, "descendant::initialPedigree/altPedigree")) != null) {
      buffer.append("<altPedigree>yes</altPedigree>");
    }

    int i = 0;
    List ls = new ArrayList();
    Iterator it = XMLUtil.executeQuery(n2, "itemInfo").iterator();
    // Iterator it=XMLUtil.executeQuery(n3,"itemInfo").iterator();
    while (it.hasNext()) {

      Node n4 = (Node) it.next();

      buffer.append(XMLUtil.convertToString(n4, true));
      i++;
      System.out.println("Value of i in iterator loop***** : " + i);
    }

    // adding new code here...
    System.out.println("Value of i ***** : " + i);
    if (i == 0) {
      Node shippedNode = XMLUtil.getNode(n2, "child::*/child::shippedPedigree");

      while (true) {

        if (shippedNode != null) {
          Iterator itemIterator = XMLUtil.executeQuery(shippedNode, "itemInfo").iterator();
          // Iterator it=XMLUtil.executeQuery(n3,"itemInfo").iterator();
          while (it.hasNext()) {

            Node itemNode = (Node) itemIterator.next();

            buffer.append(XMLUtil.convertToString(itemNode, true));
            i++;
          }
          shippedNode = XMLUtil.getNode(shippedNode, "child::*/child::shippedPedigree");
        }

        if (i > 0 || shippedNode == null) break;
      }

      if (i == 0) {

        Iterator initialItemInfoIt = XMLUtil.executeQuery(n3, "itemInfo").iterator();
        // Iterator it=XMLUtil.executeQuery(n3,"itemInfo").iterator();
        while (initialItemInfoIt.hasNext()) {

          Node n4 = (Node) initialItemInfoIt.next();

          buffer.append(XMLUtil.convertToString(n4, true));
        }
      }
    }

    buffer.append(
        XMLUtil.convertToString(XMLUtil.getNode(n2, "transactionInfo/transactionDate"), true));
    buffer.append(
        XMLUtil.convertToString(
            XMLUtil.getNode(n2, "transactionInfo/transactionIdentifier/identifier"), true));
    buffer.append(
        XMLUtil.convertToString(
            XMLUtil.getNode(n2, "transactionInfo/transactionIdentifier/identifierType"), true));

    buffer.append(XMLUtil.convertToString(XMLUtil.getNode(n3, "productInfo/manufacturer"), true));

    Node n5 = XMLUtil.getNode(n3, "descendant::transactionInfo");

    /*if(n3!=null && n5 != null){


    	boolean flag = compare(n3);

    	buffer.append("<initialTransaction>");
    	buffer.append(XMLUtil.convertToString(XMLUtil.getNode(n3,"transactionInfo/senderInfo/businessAddress"),true));
    	//Setting the business Address
    	buffer.append(XMLUtil.convertToString(XMLUtil.getNode(n3,"transactionInfo/transactionIdentifier/identifier"),true));
    	buffer.append(XMLUtil.convertToString(XMLUtil.getNode(n3,"transactionInfo/transactionIdentifier/identifierType"),true));
    	buffer.append(XMLUtil.convertToString(XMLUtil.getNode(n3,"transactionInfo/transactionDate"),true));

    	//buffer.append(XMLUtil.convertToString(XMLUtil.getNode(n3,"transactionInfo/senderInfo/contactInfo"),true));

    	buffer.append(XMLUtil.convertToString(XMLUtil.getNode(n3,"transactionInfo/recipientInfo"),true));
    	buffer.append(XMLUtil.convertToString(XMLUtil.getNode(n3,"transactionInfo/senderInfo/contactInfo"),true));




    	//Setting the Shipping Address
    	if(!flag){
    		buffer.append(XMLUtil.convertToString(XMLUtil.getNode(n3,"transactionInfo/senderInfo/shippingAddress"),true));

    	}
    	buffer.append("</initialTransaction>");
    }*/

    buffer.append("<custodyChain>");
    String serialNumber = "";
    Node intialShipped = XMLUtil.getNode(n2, "descendant-or-self::*[initialPedigree]");

    if (intialShipped != null) {
      buffer.append("<transactionInfo>");
      boolean flag = compare(intialShipped);

      serialNumber = XMLUtil.getValue(intialShipped, "documentInfo/serialNumber");

      buffer.append(
          XMLUtil.convertToString(
              XMLUtil.getNode(intialShipped, "transactionInfo/senderInfo/businessAddress"), true));

      // Setting the business Address
      /*buffer.append(XMLUtil.convertToString(XMLUtil.getNode(intialShipped,"transactionInfo/transactionIdentifier/identifier"),true));
      buffer.append(XMLUtil.convertToString(XMLUtil.getNode(intialShipped,"transactionInfo/transactionIdentifier/identifierType"),true));
      buffer.append(XMLUtil.convertToString(XMLUtil.getNode(intialShipped,"transactionInfo/transactionDate"),true));
      */

      if (n5 != null) {
        buffer.append(
            XMLUtil.convertToString(
                XMLUtil.getNode(n3, "transactionInfo/transactionIdentifier/identifier"), true));
        buffer.append(
            XMLUtil.convertToString(
                XMLUtil.getNode(n3, "transactionInfo/transactionIdentifier/identifierType"), true));
        buffer.append(
            XMLUtil.convertToString(XMLUtil.getNode(n3, "transactionInfo/transactionDate"), true));

      } else {
        buffer.append(
            XMLUtil.convertToString(
                XMLUtil.getNode(intialShipped, "transactionInfo/transactionIdentifier/identifier"),
                true));
        buffer.append(
            XMLUtil.convertToString(
                XMLUtil.getNode(
                    intialShipped, "transactionInfo/transactionIdentifier/identifierType"),
                true));
        buffer.append(
            XMLUtil.convertToString(
                XMLUtil.getNode(intialShipped, "transactionInfo/transactionDate"), true));
      }

      if (XMLUtil.getNode(intialShipped, "transactionInfo/senderInfo/contactInfo") != null)
        buffer.append(
            XMLUtil.convertToString(
                XMLUtil.getNode(intialShipped, "transactionInfo/senderInfo/contactInfo"), true));
      buffer.append(
          XMLUtil.convertToString(
              XMLUtil.getNode(intialShipped, "transactionInfo/recipientInfo"), true));
      buffer.append(
          XMLUtil.convertToString(
              XMLUtil.getNode(intialShipped, "signatureInfo/signerInfo"), true));

      if (!flag) {
        buffer.append(
            XMLUtil.convertToString(
                XMLUtil.getNode(intialShipped, "transactionInfo/senderInfo/shippingAddress"),
                true));
      }
      /*if((XMLUtil.getNode(n2,"descendant::initialPedigree/transactionInfo"))!=null){
      	buffer.append("<checkPedigree>yes</checkPedigree>");
      }*/
      if ((XMLUtil.getNode(n2, "descendant::initialPedigree/altPedigree")) != null) {
        buffer.append("<altPedigree>yes</altPedigree>");
      }

      buffer.append("</transactionInfo>");
    }

    // intialTransaction information inside the custody chain

    /*
    if(n5!=null){

    	buffer.append("<transactionInfo>");

    	buffer.append(XMLUtil.convertToString(XMLUtil.getNode(n3,"transactionInfo/transactionIdentifier/identifier"),true));
    	buffer.append(XMLUtil.convertToString(XMLUtil.getNode(n3,"transactionInfo/transactionIdentifier/identifierType"),true));
    	buffer.append(XMLUtil.convertToString(XMLUtil.getNode(n3,"transactionInfo/transactionDate"),true));

    	buffer.append("</transactionInfo>");


    }
    */

    if (!(pedigreeID.equals(serialNumber))) {

      Node shippedNode = XMLUtil.getNode(intialShipped, "ancestor::shippedPedigree");
      Node testNode = intialShipped;
      while (true) {

        // Node shippedNode =
        // XMLUtil.getNode(n2,".[descendant-or-self::*/shippedPedigree/documentInfo/serialNumber='"+serialNumber+"']");

        if (shippedNode != null) {

          buffer.append("<transactionInfo>");
          boolean flag = compare(shippedNode);

          serialNumber = XMLUtil.getValue(shippedNode, "documentInfo/serialNumber");

          buffer.append(
              XMLUtil.convertToString(
                  XMLUtil.getNode(shippedNode, "transactionInfo/senderInfo/businessAddress"),
                  true));
          // Setting the business Address
          /*buffer.append(XMLUtil.convertToString(XMLUtil.getNode(shippedNode,"transactionInfo/transactionIdentifier/identifier"),true));
          buffer.append(XMLUtil.convertToString(XMLUtil.getNode(shippedNode,"transactionInfo/transactionIdentifier/identifierType"),true));
          buffer.append(XMLUtil.convertToString(XMLUtil.getNode(shippedNode,"transactionInfo/transactionDate"),true));
          */

          if (n5 != null) {
            buffer.append(
                XMLUtil.convertToString(
                    XMLUtil.getNode(testNode, "transactionInfo/transactionIdentifier/identifier"),
                    true));
            buffer.append(
                XMLUtil.convertToString(
                    XMLUtil.getNode(
                        testNode, "transactionInfo/transactionIdentifier/identifierType"),
                    true));
            buffer.append(
                XMLUtil.convertToString(
                    XMLUtil.getNode(testNode, "transactionInfo/transactionDate"), true));

          } else {
            buffer.append(
                XMLUtil.convertToString(
                    XMLUtil.getNode(
                        shippedNode, "transactionInfo/transactionIdentifier/identifier"),
                    true));
            buffer.append(
                XMLUtil.convertToString(
                    XMLUtil.getNode(
                        shippedNode, "transactionInfo/transactionIdentifier/identifierType"),
                    true));
            buffer.append(
                XMLUtil.convertToString(
                    XMLUtil.getNode(shippedNode, "transactionInfo/transactionDate"), true));
          }

          if (XMLUtil.getNode(shippedNode, "transactionInfo/senderInfo/contactInfo") != null)
            buffer.append(
                XMLUtil.convertToString(
                    XMLUtil.getNode(shippedNode, "transactionInfo/senderInfo/contactInfo"), true));

          buffer.append(
              XMLUtil.convertToString(
                  XMLUtil.getNode(shippedNode, "transactionInfo/recipientInfo"), true));

          buffer.append(
              XMLUtil.convertToString(
                  XMLUtil.getNode(shippedNode, "signatureInfo/signerInfo"), true));

          // Setting the Shipping Address

          if (!flag) {
            buffer.append(
                XMLUtil.convertToString(
                    XMLUtil.getNode(shippedNode, "transactionInfo/senderInfo/shippingAddress"),
                    true));
          }

          /*if((XMLUtil.getNode(n2,"descendant::initialPedigree/transactionInfo"))!=null){
          	buffer.append("<checkPedigree>yes</checkPedigree>");
          }*/
          testNode = shippedNode;
          shippedNode = XMLUtil.getNode(shippedNode, "ancestor::shippedPedigree");

          buffer.append("</transactionInfo>");
        }

        if (pedigreeID.equals(serialNumber) || shippedNode == null) break;
      }
    }

    buffer.append("</custodyChain>");

    buffer.append(XMLUtil.convertToString(XMLUtil.getNode(n2, "signatureInfo/signerInfo"), true));
    buffer.append("<date>" + CommonUtil.dateToString(new Date()) + "</date>");
    // buffer.append("<path>C:\\Documents and Settings\\Ajay
    // Reddy\\workspace\\ePharma_SW\\xsl\\logo.gif</path>");
    buffer.append("<path>" + uri + "</path>");
    buffer.append("<signPath>" + uri + "</signPath>");
    buffer.append("</shippedPedigree>");
    log.info("XML :" + buffer.toString());

    getSignatureImage1(strName, signEmail);
    return buffer.toString();
  }
Exemplo n.º 8
0
 /**
  * Parse a file with provide fileName. (eg. c:/xmlfile.xml)
  *
  * @param fileName
  * @return Node representing a file
  */
 public static Node parseFile(String fileName) {
   File f = new File(fileName);
   return XMLUtil.parse(f);
 }