/**
   * Overrides the java.lang.Object.hashCode method.
   *
   * <p>The following steps came from <b>Effective Java Programming Language Guide</b> by Joshua
   * Bloch, Chapter 3
   *
   * @return a hash code value for the object.
   */
  public int hashCode() {
    int result = 17;

    long tmp;
    if (_systemId != null && !org.castor.core.util.CycleBreaker.startingToCycle(_systemId)) {
      result = 37 * result + _systemId.hashCode();
      org.castor.core.util.CycleBreaker.releaseCycleHandle(_systemId);
    }
    if (_unitId != null && !org.castor.core.util.CycleBreaker.startingToCycle(_unitId)) {
      result = 37 * result + _unitId.hashCode();
      org.castor.core.util.CycleBreaker.releaseCycleHandle(_unitId);
    }
    if (_userId != null && !org.castor.core.util.CycleBreaker.startingToCycle(_userId)) {
      result = 37 * result + _userId.hashCode();
      org.castor.core.util.CycleBreaker.releaseCycleHandle(_userId);
    }
    if (_esfKey != null && !org.castor.core.util.CycleBreaker.startingToCycle(_esfKey)) {
      result = 37 * result + _esfKey.hashCode();
      org.castor.core.util.CycleBreaker.releaseCycleHandle(_esfKey);
    }
    if (_action != null && !org.castor.core.util.CycleBreaker.startingToCycle(_action)) {
      result = 37 * result + _action.hashCode();
      org.castor.core.util.CycleBreaker.releaseCycleHandle(_action);
    }
    if (_reason != null && !org.castor.core.util.CycleBreaker.startingToCycle(_reason)) {
      result = 37 * result + _reason.hashCode();
      org.castor.core.util.CycleBreaker.releaseCycleHandle(_reason);
    }

    return result;
  }
Example #2
0
 public int serializationLength() {
   int __l = 0;
   __l += 8; // error_id
   __l += 4 + node_name.length();
   __l += 4 + error_description.length();
   return __l;
 }
  /** Util method to write an attribute without the ns prefix */
  private void writeQNameAttribute(
      java.lang.String namespace,
      java.lang.String attName,
      javax.xml.namespace.QName qname,
      javax.xml.stream.XMLStreamWriter xmlWriter)
      throws javax.xml.stream.XMLStreamException {

    java.lang.String attributeNamespace = qname.getNamespaceURI();
    java.lang.String attributePrefix = xmlWriter.getPrefix(attributeNamespace);
    if (attributePrefix == null) {
      attributePrefix = registerPrefix(xmlWriter, attributeNamespace);
    }
    java.lang.String attributeValue;
    if (attributePrefix.trim().length() > 0) {
      attributeValue = attributePrefix + ":" + qname.getLocalPart();
    } else {
      attributeValue = qname.getLocalPart();
    }

    if (namespace.equals("")) {
      xmlWriter.writeAttribute(attName, attributeValue);
    } else {
      registerPrefix(xmlWriter, namespace);
      xmlWriter.writeAttribute(namespace, attName, attributeValue);
    }
  }
  /**
   * Establece un nuevo valor para la propiedad <code>idUsuarioModificacion</code>.
   *
   * @param idUsuarioModificacion1 El valor a establecer para la propiedad <code>
   *     idUsuarioModificacion</code>.
   */
  public void setIdUsuarioModificacion(String idUsuarioModificacion1) {
    this.idUsuarioModificacion = idUsuarioModificacion1;

    if (idUsuarioModificacion != null && idUsuarioModificacion.length() > 32) {
      idUsuarioModificacion = idUsuarioModificacion.substring(0, 32);
    }
  }
  /** Register a namespace prefix */
  private java.lang.String registerPrefix(
      javax.xml.stream.XMLStreamWriter xmlWriter, java.lang.String namespace)
      throws javax.xml.stream.XMLStreamException {
    java.lang.String prefix = xmlWriter.getPrefix(namespace);

    if (prefix == null) {
      prefix = generatePrefix(namespace);

      javax.xml.namespace.NamespaceContext nsContext = xmlWriter.getNamespaceContext();

      while (true) {
        java.lang.String uri = nsContext.getNamespaceURI(prefix);

        if ((uri == null) || (uri.length() == 0)) {
          break;
        }

        prefix = org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix();
      }

      xmlWriter.writeNamespace(prefix, namespace);
      xmlWriter.setPrefix(prefix, namespace);
    }

    return prefix;
  }
  /**
   * Validate the CDXRefData instance
   *
   * @return TRUE if successful
   */
  public boolean validate() {
    if (null == _strCurveID
        || _strCurveID.isEmpty()
        || null == _strSPN
        || _strSPN.isEmpty()
        || null == _strIndexLabel
        || _strIndexLabel.isEmpty()
        || null == _strIndexName
        || _strIndexName.isEmpty()
        || null == _strCurveName
        || _strCurveName.isEmpty()
        || null == _dtIssue
        || null == _dtMaturity
        || _dtIssue.getJulian() >= _dtMaturity.getJulian()
        || !org.drip.quant.common.NumberUtil.IsValid(_dblCoupon)
        || null == _strCurrency
        || _strCurrency.isEmpty()
        || null == _strDayCount
        || _strDayCount.isEmpty()
        || !org.drip.quant.common.NumberUtil.IsValid(_dblRecovery)
        || null == _strRedID
        || _strRedID.isEmpty()
        || null == _strIndexClass
        || _strIndexClass.isEmpty()
        || null == _strIndexGroupName
        || _strIndexGroupName.isEmpty()) return false;

    return true;
  }
Example #7
0
 /**
  * Build a {@PListObject} from a string that matches one of the tags defined in {@link Constants}.
  *
  * @param tag
  * @param value can be null if tag equals {@link Constants#TAG_BOOL_FALSE} or {@link
  *     Constants#TAG_BOOL_TRUE}.
  * @throws Exception
  * @todo replace with factory for PListObject
  */
 public PListObject buildObject(java.lang.String tag, java.lang.String value) throws Exception {
   if (null == tag) {
     throw new Exception("Cannot add a child with a null tag to a PList.");
   }
   PListObject ret = null;
   if (tag.equalsIgnoreCase(Constants.TAG_INTEGER)) {
     ret = new Integer();
     ((Integer) ret).setValue(value);
   } else if (tag.equalsIgnoreCase(Constants.TAG_STRING)) {
     ret = new String();
     ((String) ret).setValue(value);
   } else if (tag.equalsIgnoreCase(Constants.TAG_REAL)) {
     ret = new Real();
     ((Real) ret).setValue(value);
   } else if (tag.equalsIgnoreCase(Constants.TAG_DATE)) {
     ret = new Date();
     ((Date) ret).setValue(value);
   } else if (tag.equalsIgnoreCase(Constants.TAG_BOOL_FALSE)) {
     ret = new False();
   } else if (tag.equalsIgnoreCase(Constants.TAG_BOOL_TRUE)) {
     ret = new True();
   } else if (tag.equalsIgnoreCase(Constants.TAG_DATA)) {
     ret = new Data();
     ((Data) ret).setValue(value.trim(), true);
   } else if (tag.equalsIgnoreCase(Constants.TAG_DICT)) {
     ret = new Dict();
   } else if (tag.equalsIgnoreCase(Constants.TAG_PLIST_ARRAY)) {
     ret = new Array();
   }
   return ret;
 }
Example #8
0
  @Override
  public java.lang.Object __hx_setField(
      java.lang.String field, java.lang.Object value, boolean handleProperties) {
    {
      boolean __temp_executeDef57 = true;
      switch (field.hashCode()) {
        case 3076014:
          {
            if (field.equals("date")) {
              __temp_executeDef57 = false;
              this.date = ((java.util.Date) (value));
              return value;
            }

            break;
          }
      }

      if (__temp_executeDef57) {
        return super.__hx_setField(field, value, handleProperties);
      } else {
        throw null;
      }
    }
  }
Example #9
0
  @Override
  public java.lang.Object __hx_invokeField(java.lang.String field, haxe.root.Array dynargs) {
    {
      boolean __temp_executeDef59 = true;
      switch (field.hashCode()) {
        case -1776922004:
          {
            if (field.equals("toString")) {
              __temp_executeDef59 = false;
              return this.toString();
            }

            break;
          }

        case -201721364:
          {
            if (field.equals("timezoneOffset")) {
              __temp_executeDef59 = false;
              return this.timezoneOffset();
            }

            break;
          }
      }

      if (__temp_executeDef59) {
        return super.__hx_invokeField(field, dynargs);
      } else {
        throw null;
      }
    }
  }
  public void test19() throws Throwable {

    if (debug) System.out.printf("%nRandoopTest0.test19");

    com.es.zumeh.client.model.Password var0 = new com.es.zumeh.client.model.Password();
    boolean var2 = var0.checkPasswords("");
    boolean var4 = var0.checkPasswords("");
    java.lang.String var5 = var0.getPassword();
    // The following exception was thrown during execution.
    // This behavior will recorded for regression testing.
    try {
      var0.setPassword("");
      fail("Expected exception of type java.lang.Exception");
    } catch (java.lang.Exception e) {
      // Expected exception.
    }

    // Regression assertion (captures the current behavior of the code)
    assertTrue(var2 == false);

    // Regression assertion (captures the current behavior of the code)
    assertTrue(var4 == false);

    // Regression assertion (captures the current behavior of the code)
    assertTrue("'" + var5 + "' != '" + "" + "'", var5.equals(""));
  }
  private org.apache.struts.action.ActionForward __analizaValidacion(
      org.apache.struts.action.ActionMapping mapping,
      org.apache.struts.action.ActionForm form,
      javax.servlet.http.HttpServletRequest request,
      javax.servlet.http.HttpServletResponse response)
      throws java.lang.Exception {
    final java.lang.String value =
        java.lang.String.valueOf(
            es.pode
                .administracion
                .presentacion
                .categorias
                .modificarCategoriaNoticia
                .ModificarCategoriaNoticiaControllerFactory
                .getModificarCategoriaNoticiaControllerInstance()
                .analizaValidacion(
                    mapping,
                    (FormularioModCategoriasNotiValidarFormularioFormImpl) form,
                    request,
                    response));

    if (value.equals("TRUE")) {
      return _modificarCategoria(mapping, form, request, response);
    }
    if (value.equals("FALSE")) {
      return _recuperarIdentificador(mapping, form, request, response);
    }

    // we take the last action in case we have an invalid return value from the controller
    return _recuperarIdentificador(mapping, form, request, response);
  }
  private static final int[] GetIntArrayTagValue(
      final org.w3c.dom.Element eTag, final java.lang.String strTag) {
    if (null == eTag || null == strTag || null == eTag.getElementsByTagName(strTag)) return null;

    org.w3c.dom.NodeList nl = eTag.getElementsByTagName(strTag);

    if (!(nl.item(0) instanceof org.w3c.dom.Element)) return null;

    org.w3c.dom.Element elem = (org.w3c.dom.Element) nl.item(0);

    if (null == elem
        || null == elem.getChildNodes()
        || null == elem.getChildNodes().item(0)
        || !(elem.getChildNodes().item(0) instanceof org.w3c.dom.Node)) return null;

    java.lang.String strValue = elem.getChildNodes().item(0).getNodeValue();

    if (null == strValue || strValue.isEmpty()) return null;

    java.lang.String[] astrValue = strValue.split(",");

    int[] ai = new int[astrValue.length];

    for (int i = 0; i < astrValue.length; ++i)
      ai[i] = new java.lang.Integer(astrValue[i]).intValue();

    return ai;
  }
  /**
   * Checks if java object is null.
   *
   * @param p0 the category items
   * @return true if the java object is null; false otherwise
   */
  static boolean is_java_object_null(java.lang.Object p0) {

    boolean b = false;
    org.apache.xerces.dom.NodeImpl n = (org.apache.xerces.dom.NodeImpl) p0;

    if (n != null) {

      LogHandler.log(LogHandler.INFO_LOG_LEVEL, "Check if java object is null.");
      org.apache.xerces.dom.NamedNodeMapImpl m =
          (org.apache.xerces.dom.NamedNodeMapImpl) n.getAttributes();
      java.lang.String a =
          (java.lang.String) CategoryHandler.read_attribute(m, CategoryHandler.CATEGORY);

      if (a.equals(CategoryHandler.NULL)) {

        b = true;
      }

    } else {

      LogHandler.log(
          LogHandler.WARNING_LOG_LEVEL,
          "Could not initialize java object. The java object node is null.");
    }

    return b;
  }
  public void endElement(java.lang.String uri, java.lang.String localName, java.lang.String qName)
      throws SAXException {

    try {
      if (qName.equals("p") || qName.equals("description")) {
        writer.write(getText());
        accumulator.setLength(0);
      }

      if (qName.equals("description")) {
        counting = false;
      }

      if (!counting) {
        writer.write(getText());
        accumulator.setLength(0);
        writer.write("</" + qName + ">\n");
      } else {
        if (qName.equals("row")) {
          accumulator.append(" ");
        }
        if (qName.equals("p")) {
          writer.write("\n");
          accumulator.append(" ");
        }
      }
    } catch (Exception e) {
      //		    e.printStackTrace();
      throw new GrobidException("An exception occured while running Grobid.", e);
    }
  }
Example #15
0
 private int fetchScore(net.heinke.cbingutter.game.player.Player p) {
   boolean success = false;
   java.lang.String input = null;
   while (!success) {
     System.out.print(p.getPlayerName() + " Enter score: ");
     java.io.BufferedReader br =
         new java.io.BufferedReader(new java.io.InputStreamReader(System.in));
     try {
       input = br.readLine().trim();
       if (Validator.validateScore(input, p)) {
         success = true;
       }
     } catch (java.io.IOException e) {
       continue;
     }
   }
   if (input.equalsIgnoreCase("X")) {
     return Constants.MAX_PINS_PER_FRAME;
   } else {
     if (input.equals("/")) {
       net.heinke.cbingutter.game.frame.Frame f = p.getCurrentFrame();
       return f.pinsRemaining();
     }
   }
   return Integer.parseInt(input);
 }
Example #16
0
 public boolean equals(java.lang.Object obj) {
   if (this == obj) {
     return true;
   }
   if ((null == obj) || (!(obj instanceof org.uniprot.uniprot.PositionType))) {
     return false;
   }
   org.uniprot.uniprot.impl.PositionTypeImpl target =
       ((org.uniprot.uniprot.impl.PositionTypeImpl) obj);
   {
     java.lang.String value = this.getStatus();
     java.lang.String targetValue = target.getStatus();
     if (!((value == targetValue) || ((value != null) && value.equals(targetValue)))) {
       return false;
     }
   }
   {
     java.math.BigInteger value = this.getPosition();
     java.math.BigInteger targetValue = target.getPosition();
     if (!((value == targetValue) || ((value != null) && value.equals(targetValue)))) {
       return false;
     }
   }
   {
     java.util.List value = this.getEvidence();
     java.util.List targetValue = target.getEvidence();
     if (!((value == targetValue) || ((value != null) && value.equals(targetValue)))) {
       return false;
     }
   }
   return true;
 }
  @Override
  public byte[] serialize() {
    java.lang.StringBuffer sb = new java.lang.StringBuffer();

    sb.append(org.drip.service.stream.Serializer.VERSION + getFieldDelimiter());

    sb.append(_dblNotional + getFieldDelimiter());

    sb.append(_dblSpread + getFieldDelimiter());

    if (null == _strIR || _strIR.isEmpty())
      sb.append(org.drip.service.stream.Serializer.NULL_SER_STRING + getFieldDelimiter());
    else sb.append(_strIR + getFieldDelimiter());

    if (null == _strCode || _strCode.isEmpty())
      sb.append(org.drip.service.stream.Serializer.NULL_SER_STRING + getFieldDelimiter());
    else sb.append(_strCode + getFieldDelimiter());

    sb.append(_bApplyAccEOMAdj + getFieldDelimiter());

    sb.append(_bApplyCpnEOMAdj + getFieldDelimiter());

    sb.append(_dblMaturity + getFieldDelimiter());

    sb.append(_dblEffective + getFieldDelimiter());

    if (null == _fri)
      sb.append(org.drip.service.stream.Serializer.NULL_SER_STRING + getFieldDelimiter());
    else sb.append(new java.lang.String(_fri.serialize()) + getFieldDelimiter());

    if (null == _notlSchedule)
      sb.append(org.drip.service.stream.Serializer.NULL_SER_STRING + getFieldDelimiter());
    else sb.append(new java.lang.String(_notlSchedule.serialize()) + getFieldDelimiter());

    if (null == _settleParams)
      sb.append(org.drip.service.stream.Serializer.NULL_SER_STRING + getFieldDelimiter());
    else sb.append(new java.lang.String(_settleParams.serialize()) + getFieldDelimiter());

    if (null == _lsCouponPeriod) sb.append(org.drip.service.stream.Serializer.NULL_SER_STRING);
    else {
      boolean bFirstEntry = true;

      java.lang.StringBuffer sbPeriods = new java.lang.StringBuffer();

      for (org.drip.analytics.period.CashflowPeriod p : _lsCouponPeriod) {
        if (null == p) continue;

        if (bFirstEntry) bFirstEntry = false;
        else sbPeriods.append(getCollectionRecordDelimiter());

        sbPeriods.append(new java.lang.String(p.serialize()));
      }

      if (sbPeriods.toString().isEmpty())
        sb.append(org.drip.service.stream.Serializer.NULL_SER_STRING);
      else sb.append(sbPeriods.toString());
    }

    return sb.append(getObjectTrailer()).toString().getBytes();
  }
Example #18
0
 @Override
 public boolean equals(Object obj) {
   if (this == obj) return true;
   if (obj == null) return false;
   if (getClass() != obj.getClass()) return false;
   Contact other = (Contact) obj;
   if (name == null) {
     if (other.name != null) return false;
   } else if (!name.equals(other.name)) return false;
   if (emailAddress == null) {
     if (other.emailAddress != null) return false;
   } else if (!emailAddress.equals(other.emailAddress)) return false;
   if (phone == null) {
     if (other.phone != null) return false;
   } else if (!phone.equals(other.phone)) return false;
   if (mobile == null) {
     if (other.mobile != null) return false;
   } else if (!mobile.equals(other.mobile)) return false;
   if (iconUrl == null) {
     if (other.iconUrl != null) return false;
   } else if (!iconUrl.equals(other.iconUrl)) return false;
   if (groups == null) {
     if (other.groups != null) return false;
   } else if (!groups.equals(other.groups)) return false;
   return true;
 }
Example #19
0
  /**
   * Overrides the java.lang.Object.hashCode method.
   *
   * <p>The following steps came from <b>Effective Java Programming Language Guide</b> by Joshua
   * Bloch, Chapter 3
   *
   * @return a hash code value for the object.
   */
  public int hashCode() {
    int result = 17;

    long tmp;
    if (_name != null) {
      result = 37 * result + _name.hashCode();
    }
    if (_description != null) {
      result = 37 * result + _description.hashCode();
    }
    if (_schedule != null) {
      result = 37 * result + _schedule.hashCode();
    }
    if (_retainInterval != null) {
      result = 37 * result + _retainInterval.hashCode();
    }
    if (_status != null) {
      result = 37 * result + _status.hashCode();
    }
    if (_parameterList != null) {
      result = 37 * result + _parameterList.hashCode();
    }

    return result;
  }
Example #20
0
  private org.apache.struts.action.ActionForward __esValidoGeneral(
      org.apache.struts.action.ActionMapping mapping,
      org.apache.struts.action.ActionForm form,
      javax.servlet.http.HttpServletRequest request,
      javax.servlet.http.HttpServletResponse response)
      throws java.lang.Exception {
    final java.lang.String value =
        java.lang.String.valueOf(
            es.pode
                .catalogadorWeb
                .presentacion
                .categoriasAvanzado
                .general
                .GeneralControllerFactory
                .getGeneralControllerInstance()
                .esValidoGeneral(mapping, (GeneralFormSubmitFormImpl) form, request, response));

    if (value.equals("true")) {
      return mapping.findForward("valido.general");
    }
    if (value.equals("false")) {
      return mapping.findForward("no.valido.general");
    }

    // we take the last action in case we have an invalid return value from the controller
    return mapping.findForward("no.valido.general");
  }
  /**
   * Establece un nuevo valor para la propiedad <code>idUsuarioRegistro</code> .
   *
   * @param idUsuarioRegistro1 El valor a establecer para la propiedad <code>idUsuarioRegistro
   *     </code>.
   */
  public void setIdUsuarioRegistro(String idUsuarioRegistro1) {
    this.idUsuarioRegistro = idUsuarioRegistro1;

    if (idUsuarioRegistro != null && idUsuarioRegistro.length() > 32) {
      idUsuarioRegistro = idUsuarioRegistro.substring(0, 32);
    }
  }
Example #22
0
  /**
   * Flatten an input 2D string/double map into a delimited string array
   *
   * @param map2DSD 2D String/Double map
   * @param strKVDelimiter Element delimiter
   * @param strRecordDelimiter Record delimiter
   * @return Flattened map string
   */
  public static final java.lang.String TwoDSDMapToFlatString(
      final org.drip.analytics.support.CaseInsensitiveTreeMap<java.lang.Double> map2DSD,
      final java.lang.String strKVDelimiter,
      final java.lang.String strRecordDelimiter) {
    if (null == map2DSD
        || 0 == map2DSD.size()
        || null == map2DSD.entrySet()
        || null == strKVDelimiter
        || strKVDelimiter.isEmpty()
        || null == strRecordDelimiter
        || strRecordDelimiter.isEmpty()) return "";

    boolean bFirstEntry = true;

    java.lang.StringBuffer sb = new java.lang.StringBuffer();

    for (java.util.Map.Entry<java.lang.String, java.lang.Double> me : map2DSD.entrySet()) {
      if (null == me || null == me.getKey() || me.getKey().isEmpty()) continue;

      if (bFirstEntry) bFirstEntry = false;
      else sb.append(strRecordDelimiter);

      sb.append(me.getKey() + strKVDelimiter + me.getValue());
    }

    return sb.toString();
  }
  /**
   * Establece un nuevo valor para la propiedad <code>estado</code>.
   *
   * @param estado1 El valor a establecer para la propiedad <code>estado</code>.
   */
  public void setEstado(String estado1) {
    this.estado = estado1;

    if (estado != null && estado.length() > 1) {
      estado = estado.substring(0, 1);
    }
  }
Example #24
0
  @Override
  public java.lang.Object __hx_invokeField(java.lang.String field, haxe.root.Array dynargs) {
    {
      boolean __temp_executeDef3284 = true;
      switch (field.hashCode()) {
        case -1776922004:
          {
            if (field.equals("toString")) {
              __temp_executeDef3284 = false;
              return this.toString();
            }

            break;
          }

        case 96417:
          {
            if (field.equals("add")) {
              __temp_executeDef3284 = false;
              this.add(dynargs.__get(0));
            }

            break;
          }
      }

      if (__temp_executeDef3284) {
        return super.__hx_invokeField(field, dynargs);
      }
    }

    return null;
  }
  public void serialize(
      final javax.xml.namespace.QName parentQName,
      javax.xml.stream.XMLStreamWriter xmlWriter,
      boolean serializeType)
      throws javax.xml.stream.XMLStreamException, org.apache.axis2.databinding.ADBException {

    java.lang.String prefix = null;
    java.lang.String namespace = null;

    prefix = parentQName.getPrefix();
    namespace = parentQName.getNamespaceURI();
    writeStartElement(prefix, namespace, parentQName.getLocalPart(), xmlWriter);

    if (serializeType) {

      java.lang.String namespacePrefix = registerPrefix(xmlWriter, "http://bam.carbon.wso2.org");
      if ((namespacePrefix != null) && (namespacePrefix.trim().length() > 0)) {
        writeAttribute(
            "xsi",
            "http://www.w3.org/2001/XMLSchema-instance",
            "type",
            namespacePrefix + ":getServerListForActivity",
            xmlWriter);
      } else {
        writeAttribute(
            "xsi",
            "http://www.w3.org/2001/XMLSchema-instance",
            "type",
            "getServerListForActivity",
            xmlWriter);
      }
    }

    xmlWriter.writeEndElement();
  }
Example #26
0
  @Override
  public java.lang.Object __hx_setField(
      java.lang.String field, java.lang.Object value, boolean handleProperties) {
    {
      boolean __temp_executeDef3282 = true;
      switch (field.hashCode()) {
        case 98:
          {
            if (field.equals("b")) {
              __temp_executeDef3282 = false;
              this.b = ((java.lang.StringBuilder) (value));
              return value;
            }

            break;
          }
      }

      if (__temp_executeDef3282) {
        return super.__hx_setField(field, value, handleProperties);
      } else {
        throw null;
      }
    }
  }
Example #27
0
  public void serialize(
      final javax.xml.namespace.QName parentQName,
      final org.apache.axiom.om.OMFactory factory,
      org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter,
      boolean serializeType)
      throws javax.xml.stream.XMLStreamException, org.apache.axis2.databinding.ADBException {

    java.lang.String prefix = null;
    java.lang.String namespace = null;

    prefix = parentQName.getPrefix();
    namespace = parentQName.getNamespaceURI();

    if ((namespace != null) && (namespace.trim().length() > 0)) {
      java.lang.String writerPrefix = xmlWriter.getPrefix(namespace);
      if (writerPrefix != null) {
        xmlWriter.writeStartElement(namespace, parentQName.getLocalPart());
      } else {
        if (prefix == null) {
          prefix = generatePrefix(namespace);
        }

        xmlWriter.writeStartElement(prefix, parentQName.getLocalPart(), namespace);
        xmlWriter.writeNamespace(prefix, namespace);
        xmlWriter.setPrefix(prefix, namespace);
      }
    } else {
      xmlWriter.writeStartElement(parentQName.getLocalPart());
    }

    if (serializeType) {

      java.lang.String namespacePrefix =
          registerPrefix(xmlWriter, "http://schemas.xmlsoap.org/soap/encoding/");
      if ((namespacePrefix != null) && (namespacePrefix.trim().length() > 0)) {
        writeAttribute(
            "xsi",
            "http://www.w3.org/2001/XMLSchema-instance",
            "type",
            namespacePrefix + ":dateTime",
            xmlWriter);
      } else {
        writeAttribute(
            "xsi", "http://www.w3.org/2001/XMLSchema-instance", "type", "dateTime", xmlWriter);
      }
    }

    if (localDateTime == null) {
      // write the nil attribute

      throw new org.apache.axis2.databinding.ADBException("dateTime cannot be null!!");

    } else {

      xmlWriter.writeCharacters(
          org.apache.axis2.databinding.utils.ConverterUtil.convertToString(localDateTime));
    }

    xmlWriter.writeEndElement();
  }
Example #28
0
  public static void textPack(byte packedData[], java.lang.String text) {
    if (text.length() > 80) text = text.substring(0, 80);
    text = text.toLowerCase();

    int carryOverNibble = -1;
    int ofs = 0;
    for (int idx = 0; idx < text.length(); idx++) {
      char c = text.charAt(idx);
      int tableIdx = 0;
      for (int i = 0; i < xlateTable.length; i++) {
        if (c == xlateTable[i]) {
          tableIdx = i;
          break;
        }
      }
      if (tableIdx > 12) tableIdx += 195;
      if (carryOverNibble == -1) {
        if (tableIdx < 13) carryOverNibble = tableIdx;
        else packedData[ofs++] = (byte) (tableIdx);
      } else if (tableIdx < 13) {
        packedData[ofs++] = (byte) ((carryOverNibble << 4) + tableIdx);
        carryOverNibble = -1;
      } else {
        packedData[ofs++] = (byte) ((carryOverNibble << 4) + (tableIdx >> 4));
        carryOverNibble = tableIdx & 0xf;
      }
    }

    if (carryOverNibble != -1) packedData[ofs++] = (byte) (carryOverNibble << 4);
  }
  /** method to handle Qnames */
  private void writeQName(
      javax.xml.namespace.QName qname, javax.xml.stream.XMLStreamWriter xmlWriter)
      throws javax.xml.stream.XMLStreamException {
    java.lang.String namespaceURI = qname.getNamespaceURI();
    if (namespaceURI != null) {
      java.lang.String prefix = xmlWriter.getPrefix(namespaceURI);
      if (prefix == null) {
        prefix = generatePrefix(namespaceURI);
        xmlWriter.writeNamespace(prefix, namespaceURI);
        xmlWriter.setPrefix(prefix, namespaceURI);
      }

      if (prefix.trim().length() > 0) {
        xmlWriter.writeCharacters(
            prefix + ":" + org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname));
      } else {
        // i.e this is the default namespace
        xmlWriter.writeCharacters(
            org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname));
      }

    } else {
      xmlWriter.writeCharacters(
          org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname));
    }
  }
Example #30
0
  static {
    java.util.Properties prop = System.getProperties();
    java.lang.String vendor = prop.getProperty("java.vendor");
    java.lang.String platform_class_name;
    java.lang.Class platform_class;

    if (vendor.equals("Oracle Corporation")) {
      platform_class_name = "python.platform.JavaPlatform";
    } else if (vendor.equals("The Android Project")) {
      platform_class_name = "python.platform.AndroidPlatform";
    } else {
      throw new org.python.exceptions.RuntimeError("Unknown platform vendor '" + vendor + "'");
    }

    try {
      platform_class = java.lang.Class.forName(platform_class_name);
      impl = (python.Platform) platform_class.getConstructor().newInstance();
    } catch (ClassNotFoundException e) {
      throw new org.python.exceptions.RuntimeError(
          "Unable to find platform '" + platform_class_name + "'");
    } catch (NoSuchMethodException e) {
      throw new org.python.exceptions.RuntimeError(
          "Unable to call constructor for plaform '" + platform_class_name + "'");
    } catch (InstantiationException e) {
      throw new org.python.exceptions.RuntimeError(
          "Unable to instantiate platform '" + platform_class_name + "'");
    } catch (IllegalAccessException e) {
      throw new org.python.exceptions.RuntimeError(
          "Unable to access constructor for platform '" + platform_class_name + "'");
    } catch (java.lang.reflect.InvocationTargetException e) {
      throw new org.python.exceptions.RuntimeError(
          "Unable to invoke constructor for platform '" + platform_class_name + "'");
    }
  }