private static String toString(Object[] objects, boolean isUpdate, CalendarCodec cCodec) { StringBuilder sb = new StringBuilder(objects.length * 40); sb.append("["); for (Object obj : objects) { if (sb.length() > 1) sb.append(", "); if (obj instanceof SObject) { SObject s = (SObject) obj; sb.append("entity: ").append(s.getType()); if (isUpdate) { sb.append(" id: ").append(s.getId()); } } else if (obj instanceof SaveResult) { sb.append(((SaveResult) obj).getId()); } else if (obj instanceof Calendar) { sb.append(cCodec.getValueAsString(obj)); } } sb.append("]"); return sb.toString(); } }
private static String toString(Object[] objects, boolean isUpdate, CalendarCodec cCodec) { StringBuilder sb = new StringBuilder(objects.length * 40); sb.append("["); for (Object obj : objects) { if (sb.length() > 1) sb.append(", "); if (obj instanceof SObject) { SObject s = (SObject) obj; sb.append("entity: ").append(s.getType()); if (isUpdate) { sb.append(" id: ").append(s.getId()); } } else if (obj instanceof SaveResult) { sb.append(((SaveResult) obj).getId()); } else if (obj instanceof Calendar) { sb.append(cCodec.getValueAsString(obj)); } } sb.append("]"); return sb.toString(); } }
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); }
public SObjectIndexedRecord(SObject value) { rootType = value.getType(); Iterator<XmlObject> fields = value.getChildren(); 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 { processXmlObject(field, rootType); } } }
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); } } }
public synchronized boolean equals(java.lang.Object obj) { if (!(obj instanceof SObject)) return false; SObject other = (SObject) obj; if (obj == null) return false; if (this == obj) return true; if (__equalsCalc != null) { return (__equalsCalc == obj); } __equalsCalc = obj; boolean _equals; _equals = true && ((this.type == null && other.getType() == null) || (this.type != null && this.type.equals(other.getType()))) && ((this.fieldsToNull == null && other.getFieldsToNull() == null) || (this.fieldsToNull != null && java.util.Arrays.equals(this.fieldsToNull, other.getFieldsToNull()))) && ((this.id == null && other.getId() == null) || (this.id != null && this.id.equals(other.getId()))) && ((this._any == null && other.get_any() == null) || (this._any != null && java.util.Arrays.equals(this._any, other.get_any()))); __equalsCalc = null; return _equals; }
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); } } }
private List<Object[]> extractDataFromFields(SObject sObject, List<XmlObject> fields, List<Object[]> result) throws TranslatorException { Map<String,Integer> fieldToIndexMap = sObjectToResponseField.get(sObject.getType()); int aggCount = 0; for (int j = 0; j < visitor.getSelectSymbolCount(); j++) { Expression ex = visitor.getSelectSymbolMetadata(j); if (ex instanceof ColumnReference) { Column element = ((ColumnReference)ex).getMetadataObject(); Table table = (Table)element.getParent(); if(table.getSourceName().equals(sObject.getType()) || AGGREGATE_RESULT.equalsIgnoreCase(sObject.getType())) { Integer index = fieldToIndexMap.get(element.getSourceName()); if (null == index) { throw new TranslatorException(SalesForcePlugin.Util.getString("SalesforceQueryExecutionImpl.missing.field")+ element.getSourceName()); //$NON-NLS-1$ } Object cell = getCellDatum(element.getSourceName(), element.getJavaType(), fields.get(index)); setValueInColumn(j, cell, result); } } else if (ex instanceof AggregateFunction) { String name = SelectVisitor.AGG_PREFIX + (aggCount++); Integer index = fieldToIndexMap.get(name); if (null == index) { throw new TranslatorException(SalesForcePlugin.Util.getString("SalesforceQueryExecutionImpl.missing.field")+ ex); //$NON-NLS-1$ } Object cell = getCellDatum(name, ex.getType(), fields.get(index)); setValueInColumn(j, cell, result); } } return result; }
SObject result = executeQueryFirstRow(c, query, partnerId); if (result != null) { Map<String, Field> fields = describeObject(c, result.getType()); for (MessageElement column : result.get_any()) { String nm = column.getName();
if (firstBatch && firstRow) { SObject hdr = sObjects[0]; Map<String, Field> fields = describeObject(c, hdr.getType()); MessageElement[] frCols = hdr.get_any(); colTypes = new String[frCols.length];
if (LOGGER.isDebugEnabled()) { if (fieldNumbers != null) { LOGGER.debug("Updating object: " + toSave.getType() + " id: " + toSave.getId()); } else { LOGGER.debug("Creating object: " + toSave.getType()); LOGGER.debug("Queuing for A-O-N update object: " + toSave.getType() + " id: " + toSave.getId()); } else { LOGGER.debug("Queuing for A-O-N create object: " + toSave.getType());
if (LOGGER.isDebugEnabled()) { if (fieldNumbers != null) { LOGGER.debug("Updating object: " + toSave.getType() + " id: " + toSave.getId()); } else { LOGGER.debug("Creating object: " + toSave.getType()); LOGGER.debug("Queuing for A-O-N update object: " + toSave.getType() + " id: " + toSave.getId()); } else { LOGGER.debug("Queuing for A-O-N create object: " + toSave.getType());