Package com.ebay.sdk.attributes.model

Examples of com.ebay.sdk.attributes.model.Value


        Element attrNode = XmlUtil.appendChildNode(doc, attrSetNode, ATTRIBUTE);
        XmlUtil.appendAttributeNode(attrNode, ID, attr.getAttributeID());

        Element valueElement;
        Value val;
        if (attr.getType() == AttributeTypes.ATTR_ID) {
          checkSingleValueListItem(attr);
          val = (Value) attr.getValue(0);

          valueElement = XmlUtil.appendChildNode(doc, attrNode, VALUE);
          XmlUtil.appendAttributeNode(valueElement, ID, val.getValueID().intValue());

          if (val.getValueID().intValue() == (int) ValueIds.OTHER && val.getValueLiteral() != null) {
            // Add one more Attribute node with the same id.
            Element attrOther = XmlUtil.appendChildNode(doc, attrSetNode,
                ATTRIBUTE);
            XmlUtil.appendAttributeNode(attrOther, ID, attr.getAttributeID());

            Node v_e = XmlUtil.appendChildNode(doc, attrOther, VALUE);
            XmlUtil.appendChildNode(doc, v_e, NAME, val.getValueLiteral());
          }
        } else if (attr.getType() == AttributeTypes.ATTR_IDS) {
          for (n = 0; n < attr.getValue().length; n++) {
            Value v_s = (Value) attr.getValue(n);
            valueElement = XmlUtil.appendChildNode(doc, attrNode, VALUE);
            XmlUtil.appendAttributeNode(valueElement, ID, v_s.getValueID().intValue());
          }
        } else if (attr.getType() == AttributeTypes.ATTR_TEXT) {
          checkSingleValueListItem(attr);
          val = (Value) attr.getValue(0);

          valueElement = XmlUtil.appendChildNode(doc, attrNode, VALUE);
          XmlUtil.appendChildNode(doc, valueElement, NAME, val.getValueLiteral());

          /*
                   if( val.ValueId == (int)ValueIds.OTHER )
                   {
                  // Add another attribute node with the same attribute Id
           Node attrOther = XmlUtil.AddChild(doc, attrSetNode, ATTRIBUTE);
           XmlUtil.AddAttributeNode(doc, attrOther, ID, attr.AttributeId.ToString());

                  valueElement = XmlUtil.AddChild(doc, attrOther, VALUE);
           XmlUtil.AddAttributeNode(doc, valueElement, ID, val.ValueId.ToString());
                   }
           */
        } else if (attr.getType() == AttributeTypes.ATTR_TEXT_DATE) {
          checkSingleValueListItem(attr);
          val = (Value) attr.getValue(0);

          valueElement = XmlUtil.appendChildNode(doc, attrNode, VALUE);
          XmlUtil.appendAttributeNode(valueElement, ID, val.getValueID().intValue());

          addDateToValueNode(valueElement, val.getValueLiteral());
        } else {
          // Unsupported attribute type.
          for (n = 0; n < attr.getValue().length; n++) {
          //foreach(IValue v_o in attr.ValueList )
            Value v_o = (Value) attr.getValue(n);
            valueElement = XmlUtil.appendChildNode(doc, attrNode, VALUE);
            XmlUtil.appendChildNode(doc, valueElement, NAME, v_o.getValueLiteral());
            if (v_o.getValueID() != null && v_o.getValueID().intValue() != 0) {
              XmlUtil.appendAttributeNode(valueElement, ID, v_o.getValueID().toString());
            }
          }
        }
      }
    }
View Full Code Here


      return ValueTypes.Text;
  }

  private static com.ebay.sdk.attributes.model.Attribute ExtractAttr(AttrInfo info)
  {
    Value val = null;
    com.ebay.sdk.attributes.model.Attribute attr = new com.ebay.sdk.attributes.model.Attribute();
    attr.setAttributeID(Integer.parseInt(info.attrId));
    attr.setType(info.typeId);

    //IValueList list = new ValueList();
    //attr.ValueList = list;

    int valType = AttrToValType(info.typeId);

    if (info.typeId == AttributeTypes.ATTR_ID)
    {
      val = new Value(valType);
      val.setValueID(new Integer(info.val[0]));
      attr.addValue(val);
      /*
      if (info.val.equals"-10"))
      {
              attr.SType = -1;
      }
      */
    }
    else if (info.typeId == AttributeTypes.ATTR_IDS)
    {
      for (int i = 0; i < info.val.length; i++)
      {
        val = new Value(valType);
        val.setValueID(new Integer(info.val[i]));
        attr.addValue(val);
      }
      /*
      if (info.val.indexOf("-10") > -1)
      {
              attr.SType = -1;
      }
      */
    }
    else
    {
      val = new Value(valType);
      val.setValueLiteral(info.val[0]);
      attr.addValue(val);
    }

    return attr;
  }
View Full Code Here

    //IValueList list = new ValueList();
    //attr.ValueList = list;
    attr.setAttributeID(Integer.parseInt(info1.attrId));
    attr.setType(info1.typeId);

    Value val = new Value();
    val.setValueID(new Integer(info1.val[0]));
    val.setValueLiteral(info2.val[0]);

    attr.addValue(val);

    return attr;
  }
View Full Code Here

    return attr;
  }

  private static com.ebay.sdk.attributes.model.Attribute ExtractAttr(AttrInfo [] infos)
  {
    Value val = null;
    com.ebay.sdk.attributes.model.Attribute attr = new com.ebay.sdk.attributes.model.Attribute();
    attr.setAttributeID(Integer.parseInt(infos[0].attrId));
    //IValueList list = new ValueList();
    //attr.ValueList = list;

    AttrInfo info;
    int cnt = infos.length;
    for (int i = 0; i < cnt; i ++)
    {
      info = infos[i];
      if (info.typeId == AttributeTypes.ATTR_ID)
      {
        val = new Value();
        val.setValueID(new Integer(info.val[0]));
        attr.addValue(val);
      }
      else if (info.typeId == AttributeTypes.ATTR_IDS)
      {
        for (int j = 0; j < info.val.length; j++)
        {
          val = new Value();
          val.setValueID(new Integer(info.val[j]));
          attr.addValue(val);
        }
      }
      else
      {
        val = new Value();
        val.setValueLiteral(info.val[0]);
        attr.addValue(val);
      }
    }

    return attr;
View Full Code Here

        throw new SdkException("Invalid group key.");

      SearchAttributeSet set = findAttributeSetByPFID(sets, Integer.parseInt((String)objPFID));
      SearchAttribute attr = new SearchAttribute();
      attr.setAttributeID(Integer.parseInt(aid));
      Value val = new Value();
      val.setValueID(new Integer(valStr));
      attr.addValue(val);
      set.add(attr);
    }

    return sets;
View Full Code Here

    // Decrement count of value list if value list contains -10.
    int passCount = attr.getValue().length;
    for(int i = 0; i < attr.getValue().length; i++ )
    {
      Value val = (Value)attr.getValue(i);
      if( val.getValueID().intValue() == (int)ValueIds.NONE )
      {
        passCount --;
        break;
      }
    }
View Full Code Here

TOP

Related Classes of com.ebay.sdk.attributes.model.Value

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.