当前位置: 首页>>代码示例>>Java>>正文


Java XmlObject类代码示例

本文整理汇总了Java中com.sforce.ws.bind.XmlObject的典型用法代码示例。如果您正苦于以下问题:Java XmlObject类的具体用法?Java XmlObject怎么用?Java XmlObject使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


XmlObject类属于com.sforce.ws.bind包,在下文中一共展示了XmlObject类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: loadBatch

import com.sforce.ws.bind.XmlObject; //导入依赖的package包/类
private List<List<Object>> loadBatch(QueryResult queryResult) {
	List<List<Object>> batch = new ArrayList<List<Object>>();
	for(SObject sObject : queryResult.getRecords()) {
		Iterator<XmlObject> fields = sObject.getChildren();
		List<Object> row = new ArrayList<Object>();
		while (fields.hasNext())  {
			XmlObject elem = fields.next();
			if (elem.getName().getLocalPart().equals("type")) { //$NON-NLS-1$
				continue;
			}
			Object value = elem.getValue();
			row.add(value);
		}
		batch.add(row);
	}
	return batch;
}
 
开发者ID:kenweezy,项目名称:teiid,代码行数:18,代码来源:DirectQueryExecution.java

示例2: getObjectData

import com.sforce.ws.bind.XmlObject; //导入依赖的package包/类
private List<Object[]> getObjectData(SObject sObject) throws TranslatorException {
	Iterator<XmlObject> topFields = sObject.getChildren();
	ArrayList<XmlObject> children = new ArrayList<XmlObject>();
	while (topFields.hasNext()) {
		children.add(topFields.next());
	}
	logAndMapFields(sObject.getType(), children);
	List<Object[]> result = new ArrayList<Object[]>();
	if(visitor instanceof JoinQueryVisitor) {
		for(int i = 0; i < children.size(); i++) {
			XmlObject element = children.get(i);
			extactJoinResults(element, result);
		}
	}
	return extractDataFromFields(sObject, children, result);

}
 
开发者ID:kenweezy,项目名称:teiid,代码行数:18,代码来源:QueryExecutionImpl.java

示例3: extractValuesFromElement

import com.sforce.ws.bind.XmlObject; //导入依赖的package包/类
private List<Object[]> extractValuesFromElement(XmlObject sObject,
		List<Object[]> result, String sObjectName) throws TranslatorException {
	Object[] row = new Object[visitor.getSelectSymbolCount()];
	for (int j = 0; j < visitor.getSelectSymbolCount(); j++) {
		//must be a column reference as we won't allow an agg over a join
		Column element = ((ColumnReference)visitor.getSelectSymbolMetadata(j)).getMetadataObject();
		AbstractMetadataRecord table = element.getParent();
		if(table.getSourceName().equals(sObjectName)) {
			XmlObject child = sObject.getChild(element.getSourceName());
			Object cell = getCellDatum(element.getSourceName(), element.getJavaType(), child);
			setValueInColumn(j, cell, result);
			setElementValueInColumn(j, cell, row);
		}
	}
	result.add(row);
	return result;
}
 
开发者ID:kenweezy,项目名称:teiid,代码行数:18,代码来源:QueryExecutionImpl.java

示例4: getCellDatum

import com.sforce.ws.bind.XmlObject; //导入依赖的package包/类
/**
 * TODO: the logic here should be aware of xsi:type information and use a standard conversion
 * library.  Conversion to teiid types should then be a secondary effort - and will be automatically handled above here.
 */
private Object getCellDatum(String name, Class<?> type, XmlObject elem) throws TranslatorException {
	if(!name.equals(elem.getName().getLocalPart())) {
		throw new TranslatorException(SalesForcePlugin.Util.getString("SalesforceQueryExecutionImpl.column.mismatch1") + name + SalesForcePlugin.Util.getString("SalesforceQueryExecutionImpl.column.mismatch2") + elem.getName().getLocalPart()); //$NON-NLS-1$ //$NON-NLS-2$
	}
	Object value = elem.getValue();
	if (value == null) {
		return null;
	}
	if (value instanceof String && (((String) value).isEmpty())) {
		if (type == String.class) {
			return value;
		}
		return null;
	} else if (type.equals(java.sql.Timestamp.class) || type.equals(java.sql.Time.class) && !(value instanceof Date)) {
		if (cal == null) {
			cal = Calendar.getInstance();
		}
		return parseDateTime(value.toString(), type, cal);
	}
	return value;
}
 
开发者ID:kenweezy,项目名称:teiid,代码行数:26,代码来源:QueryExecutionImpl.java

示例5: SObjectIndexedRecord

import com.sforce.ws.bind.XmlObject; //导入依赖的package包/类
public SObjectIndexedRecord(SObject value) {
    rootType = value.getType();
    isAggregateResult = "AggregateResult".equals(rootType);
    init();

    Iterator<XmlObject> fields = value.getChildren();
    // Ignore "type" element when find firstly
    int typeCount = 0;
    while (fields.hasNext()) {
        XmlObject field = fields.next();
        if (valueMap != null && (valueMap.containsKey(field.getName().getLocalPart()) || valueMap.containsKey(rootType
                + schema.getProp(SalesforceSchemaConstants.COLUMNNAME_DELIMTER) + field.getName().getLocalPart()))) {
            continue;
        } else {
            if ("type".equals(field.getName().getLocalPart()) && typeCount == 0) {
                typeCount++;
                continue;
            }
            processXmlObject(field, rootType, null);
        }
    }
}
 
开发者ID:Talend,项目名称:components,代码行数:23,代码来源:SObjectAdapterFactory.java

示例6: placeValueInFieldMap

import com.sforce.ws.bind.XmlObject; //导入依赖的package包/类
/**
 * Puts parsed values into value map by column names or complex column names.<br/>
 * For <b>Parent-to-Child</b> relation stores duplicates to grant a possibility<br/>
 * to get values by such column names in child table:
 * <code>Contact.Name, Contact.Account.Name</code>
 *
 * @param prefixName - name to be appended to column name.
 * @param xo - XML object that contains column value.
 */
private void placeValueInFieldMap(String prefixName, XmlObject xo) {
    Object value = xo.getValue();
    if (value == null || "".equals(value)) {
        return;
    }

    String columnName = null;
    if (prefixName != null && prefixName.length() > 0) {
        columnName = prefixName + schema.getProp(SalesforceSchemaConstants.COLUMNNAME_DELIMTER)
                + xo.getName().getLocalPart();
    } else {
        columnName = xo.getName().getLocalPart();
    }

    if (valueMap.get(columnName) == null) {
        valueMap.put(columnName, formatIfNecessary(value, columnName));
    } else {
        if (!columnName.equals(xo.getName().getLocalPart())) {
            valueMap.put(columnName, valueMap.get(columnName) + schema.getProp(SalesforceSchemaConstants.VALUE_DELIMITER)
                    + formatIfNecessary(value, columnName));
        }
    }
}
 
开发者ID:Talend,项目名称:components,代码行数:33,代码来源:SObjectAdapterFactory.java

示例7: prepareRecordRows

import com.sforce.ws.bind.XmlObject; //导入依赖的package包/类
private void prepareRecordRows(QueryResult qr) {
    if (qr == null) {
        logger.warn("Unable to prepare schema browser rows - query result is null");
        return;
    }

    DataRow task;

    SObject[] records = qr.getRecords();
    if (records == null) {
        logger.warn("Unable to prepare schema browser rows - returned record array null");
        return;
    }

    for (SObject sobject : records) {
        Vector<XmlObject> record = recordToVector(sobject);
        task = new DataRow(record);
        // task.setOwner(OWNERS_ARRAY[i % 3]);
        dataRows.add(task);
    }
}
 
开发者ID:forcedotcom,项目名称:idecore,代码行数:22,代码来源:DataRowList.java

示例8: parseInput

import com.sforce.ws.bind.XmlObject; //导入依赖的package包/类
public void parseInput(SObject sobject) {
    Iterator<XmlObject> iter = sobject.getChildren();
    while (iter.hasNext()) {
        XmlObject field = iter.next();
        String fieldName = field.getName().getLocalPart();
        String fieldValue = (String) field.getValue();

        if ("Id".equals(fieldName)) {
            setId(fieldValue);
        } else if ("Name".equals(fieldName)) {
            setName(fieldValue);
        } else if ("Description".equals(fieldName)) {
            setDescription(fieldValue);
        } else if ("IsManaged".equals(fieldName)) {
            setManaged(fieldValue);
        } else if ("VersionName".equals(fieldName)) {
            setInstalled(true); // version name is required field when upload package
            setVersionName(fieldValue);
        }
    }
}
 
开发者ID:forcedotcom,项目名称:idecore,代码行数:22,代码来源:ProjectPackage.java

示例9: getRecordValue

import com.sforce.ws.bind.XmlObject; //导入依赖的package包/类
public String getRecordValue( SObject con, String fieldname ) throws KettleException {
  String[] fieldHierarchy = fieldname.split( "\\." );
  if ( con == null ) {
    return null;
  } else {
    XmlObject element = getMessageElementForHierarchy( con, fieldHierarchy );
    if ( element != null ) {
      Object object = element.getValue();
      if ( object != null ) {
        if ( object instanceof QueryResult ) {
          return buildJsonQueryResult( (QueryResult) object );
        }
        return String.valueOf( object );
      } else {
        return (String) element.getValue();
      }
    }
  }
  return null;
}
 
开发者ID:pentaho,项目名称:pentaho-kettle,代码行数:21,代码来源:SalesforceConnection.java

示例10: getChildren

import com.sforce.ws.bind.XmlObject; //导入依赖的package包/类
public static XmlObject[] getChildren( SObject object ) {
  List<String> reservedFieldNames = Arrays.asList( "type", "fieldsToNull" );
  if ( object == null ) {
    return null;
  }
  List<XmlObject> children = new ArrayList<>();
  Iterator<XmlObject> iterator = object.getChildren();
  while ( iterator.hasNext() ) {
    XmlObject child = iterator.next();
    if ( child.getName().getNamespaceURI().equals( Constants.PARTNER_SOBJECT_NS )
        && reservedFieldNames.contains( child.getName().getLocalPart() ) ) {
      continue;
    }
    children.add( child );
  }
  if ( children.size() == 0 ) {
    return null;
  }
  return children.toArray( new XmlObject[children.size()] );
}
 
开发者ID:pentaho,项目名称:pentaho-kettle,代码行数:21,代码来源:SalesforceConnection.java

示例11: addFields

import com.sforce.ws.bind.XmlObject; //导入依赖的package包/类
void addFields( String prefix, Set<String> fieldNames, XmlObject field ) {
  //Salesforce SOAP Api sends IDs always in the response, even if we don't request it in SOQL query and
  //the id's value is null in this case. So, do not add this Id to the fields list
  if ( isNullIdField( field ) ) {
    return;
  }
  String fieldname = prefix + field.getName().getLocalPart();
  if ( field instanceof SObject ) {
    SObject sobject = (SObject) field;
    for ( XmlObject element : SalesforceConnection.getChildren( sobject ) ) {
      addFields( fieldname + ".", fieldNames, element );
    }
  } else {
    addField( fieldname, fieldNames, (String) field.getValue() );
  }
}
 
开发者ID:pentaho,项目名称:pentaho-kettle,代码行数:17,代码来源:SalesforceInputDialog.java

示例12: testWriteToSalesForcePentahoIntegerValue

import com.sforce.ws.bind.XmlObject; //导入依赖的package包/类
@Test
public void testWriteToSalesForcePentahoIntegerValue() throws Exception {
  SalesforceUpsert sfInputStep =
    new SalesforceUpsert( smh.stepMeta, smh.stepDataInterface, 0, smh.transMeta, smh.trans );
  SalesforceUpsertMeta meta =
    generateSalesforceUpsertMeta( new String[] { ACCOUNT_ID }, new Boolean[] { false } );
  SalesforceUpsertData data = generateSalesforceUpsertData();
  sfInputStep.init( meta, data );

  RowMeta rowMeta = new RowMeta();
  ValueMetaBase valueMeta = new ValueMetaInteger( "IntValue" );
  rowMeta.addValueMeta( valueMeta );
  smh.initStepDataInterface.inputRowMeta = rowMeta;

  sfInputStep.writeToSalesForce( new Object[] { 1L } );
  XmlObject sObject = data.sfBuffer[ 0 ].getChild( ACCOUNT_ID );
  Assert.assertEquals( sObject.getValue(), 1 );
}
 
开发者ID:pentaho,项目名称:pentaho-kettle,代码行数:19,代码来源:SalesforceUpsertTest.java

示例13: testSetFieldInSObjectForeignKey

import com.sforce.ws.bind.XmlObject; //导入依赖的package包/类
@Test
public void testSetFieldInSObjectForeignKey() throws Exception {
  SalesforceUpsert salesforceUpsert =
    new SalesforceUpsert( smh.stepMeta, smh.stepDataInterface, 0, smh.transMeta, smh.trans );

  SObject sobjPass = new SObject();
  XmlObject parentObject = new XmlObject();
  String parentParam = "parentParam";
  String parentValue = "parentValue";
  parentObject.setName( new QName( parentParam ) );
  parentObject.setValue( parentValue );

  String child = "child";
  String childParam = "childParam";
  String childValue = "childValue";

  XmlObject childObject = new XmlObject();
  childObject.setName( new QName( child ) );
  childObject.setField( childParam, childValue );

  salesforceUpsert.setFieldInSObject( sobjPass, parentObject );
  salesforceUpsert.setFieldInSObject( sobjPass, childObject );

  Assert.assertEquals( parentValue, sobjPass.getField( parentParam ) );
  Assert.assertEquals( childValue, ( (SObject) sobjPass.getField( child ) ).getField( childParam ) );
}
 
开发者ID:pentaho,项目名称:pentaho-kettle,代码行数:27,代码来源:SalesforceUpsertTest.java

示例14: testGetRecordValue

import com.sforce.ws.bind.XmlObject; //导入依赖的package包/类
@Test //PDI-15973
public void testGetRecordValue() throws Exception {  //PDI-15973
  SalesforceConnection conn = mock( SalesforceConnection.class, Mockito.CALLS_REAL_METHODS );
  SObject sObject = new SObject();
  sObject.setName( new QName( Constants.PARTNER_SOBJECT_NS, "sObject" ) );

  SObject testObject = createObject( "field", "value" );
  sObject.addField( "field", testObject );
  assertEquals( "Get value of simple record", "value", conn.getRecordValue( sObject, "field" ) );

  SObject parentObject = createObject( "parentField", null );
  sObject.addField( "parentField", parentObject );
  SObject childObject = createObject( "subField", "subValue" );
  parentObject.addField( "subField", childObject );
  assertEquals( "Get value of record with hierarchy", "subValue", conn.getRecordValue( sObject, "parentField.subField" ) );

  XmlObject nullObject = new XmlObject( new QName( "nullField" ) );
  sObject.addField( "nullField", nullObject );
  assertEquals( "Get null value when relational query id is null", null, conn.getRecordValue( sObject, "nullField.childField" ) );
}
 
开发者ID:pentaho,项目名称:pentaho-kettle,代码行数:21,代码来源:SalesforceConnectionTest.java

示例15: testWriteToSalesForcePentahoIntegerValue

import com.sforce.ws.bind.XmlObject; //导入依赖的package包/类
@Test
public void testWriteToSalesForcePentahoIntegerValue() throws Exception {
  SalesforceInsert sfInputStep =
    new SalesforceInsert( smh.stepMeta, smh.stepDataInterface, 0, smh.transMeta, smh.trans );
  SalesforceInsertMeta meta =
    generateSalesforceInsertMeta( new String[] { ACCOUNT_ID }, new Boolean[] { false } );
  SalesforceInsertData data = generateSalesforceInsertData();
  sfInputStep.init( meta, data );

  RowMeta rowMeta = new RowMeta();
  ValueMetaBase valueMeta = new ValueMetaInteger( "IntValue" );
  rowMeta.addValueMeta( valueMeta );
  smh.initStepDataInterface.inputRowMeta = rowMeta;

  sfInputStep.writeToSalesForce( new Object[] { 1L } );
  XmlObject sObject = data.sfBuffer[ 0 ].getChild( ACCOUNT_ID );
  Assert.assertEquals( sObject.getValue(), 1 );
}
 
开发者ID:pentaho,项目名称:pentaho-kettle,代码行数:19,代码来源:SalesforceInsertTest.java


注:本文中的com.sforce.ws.bind.XmlObject类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。