/** Sets ith "IdentificationJurisdiction" element */
 public void setIdentificationJurisdictionArray(
     int i, org.apache.xmlbeans.XmlObject identificationJurisdiction) {
   synchronized (monitor()) {
     check_orphaned();
     org.apache.xmlbeans.XmlObject target = null;
     target =
         (org.apache.xmlbeans.XmlObject)
             get_store().find_element_user(IDENTIFICATIONJURISDICTION$11, i);
     if (target == null) {
       throw new IndexOutOfBoundsException();
     }
     target.set(identificationJurisdiction);
   }
 }
 /** Sets ith "PDMessageMetadataExtensionAbstract" element */
 public void setPDMessageMetadataExtensionAbstractArray(
     int i, org.apache.xmlbeans.XmlObject pdMessageMetadataExtensionAbstract) {
   synchronized (monitor()) {
     check_orphaned();
     org.apache.xmlbeans.XmlObject target = null;
     target =
         (org.apache.xmlbeans.XmlObject)
             get_store().find_element_user(PDMESSAGEMETADATAEXTENSIONABSTRACT$1, i);
     if (target == null) {
       throw new IndexOutOfBoundsException();
     }
     target.set(pdMessageMetadataExtensionAbstract);
   }
 }
 /** Sets the "DataItemStatusAbstract" element */
 public void setDataItemStatusAbstract(org.apache.xmlbeans.XmlObject dataItemStatusAbstract) {
   synchronized (monitor()) {
     check_orphaned();
     org.apache.xmlbeans.XmlObject target = null;
     target =
         (org.apache.xmlbeans.XmlObject)
             get_store().find_element_user(DATAITEMSTATUSABSTRACT$1, 0);
     if (target == null) {
       target =
           (org.apache.xmlbeans.XmlObject) get_store().add_element_user(DATAITEMSTATUSABSTRACT$0);
     }
     target.set(dataItemStatusAbstract);
   }
 }
  @Override
  public Message<?> preSend(Message<?> message, MessageChannel channel) {

    XmlObject payload = (XmlObject) message.getPayload();
    if (payload instanceof SubmitJobRequestDocument) {
      SubmitJobRequestDocument document = (SubmitJobRequestDocument) payload;
      SubmitJobRequest request = document.getSubmitJobRequest();
      List<SourceTargetType> sourceAndTargets = getAllSourceOrTarget(request);
      for (SourceTargetType sourceOrTarget : sourceAndTargets) {
        if (sourceOrTarget instanceof MinxSourceTargetType) {
          MinxSourceTargetType minxSourceTarget = (MinxSourceTargetType) sourceOrTarget;
          CredentialType credential = minxSourceTarget.getCredential();
          if (credential != null) {
            if (credential.getMyProxyToken() != null) {
              throw new UnsupportedOperationException("MyProxy not yet supported");

            }
            // at the moment we're only supporting u/p credentials
            else if (credential.getUsernameToken() != null) {
              XmlObject element =
                  XmlBeansUtils.selectAnyElement(
                      credential.getUsernameToken(), PASSWORD_STRING_QNAME);
              final String encryptedPassword =
                  element == null ? EMPTY : mEncrypter.encrypt(extractElementTextAsString(element));
              LOG.debug("Encrypted password: "******"Other Credential Type not yet supported");
            }
          }
        }
      }
    }

    return message;
  }