Author: jdoyle
Date: 2009-04-24 16:16:30 -0400 (Fri, 24 Apr 2009)
New Revision: 843
Added:
trunk/connectors/connector-salesforce/src/main/java/com/metamatrix/connector/salesforce/execution/DeletedObject.java
trunk/connectors/connector-salesforce/src/main/java/com/metamatrix/connector/salesforce/execution/DeletedResult.java
trunk/connectors/connector-salesforce/src/main/java/com/metamatrix/connector/salesforce/execution/GetDeletedExecutionImpl.java
trunk/connectors/connector-salesforce/src/main/java/com/metamatrix/connector/salesforce/execution/GetUpdatedExecutionImpl.java
trunk/connectors/connector-salesforce/src/main/java/com/metamatrix/connector/salesforce/execution/ProcedureExecutionParent.java
trunk/connectors/connector-salesforce/src/main/java/com/metamatrix/connector/salesforce/execution/ProcedureExecutionParentImpl.java
trunk/connectors/connector-salesforce/src/main/java/com/metamatrix/connector/salesforce/execution/SalesforceProcedureExecution.java
trunk/connectors/connector-salesforce/src/main/java/com/metamatrix/connector/salesforce/execution/UpdatedResult.java
Modified:
trunk/connectors/connector-salesforce/src/main/java/com/metamatrix/connector/salesforce/ConnectorState.java
trunk/connectors/connector-salesforce/src/main/java/com/metamatrix/connector/salesforce/Util.java
trunk/connectors/connector-salesforce/src/main/java/com/metamatrix/connector/salesforce/connection/SalesforceConnection.java
trunk/connectors/connector-salesforce/src/main/java/com/metamatrix/connector/salesforce/connection/impl/ConnectionImpl.java
trunk/connectors/connector-salesforce/src/main/java/com/metamatrix/connector/salesforce/execution/visitors/CriteriaVisitor.java
trunk/connectors/connector-salesforce/src/main/java/com/metamatrix/connector/salesforce/execution/visitors/InsertVisitor.java
trunk/connectors/connector-salesforce/src/main/java/com/metamatrix/connector/salesforce/execution/visitors/SelectVisitor.java
Log:
TEIID-244
Adding getUpdated and getDeleted implementations.
Modified:
trunk/connectors/connector-salesforce/src/main/java/com/metamatrix/connector/salesforce/ConnectorState.java
===================================================================
---
trunk/connectors/connector-salesforce/src/main/java/com/metamatrix/connector/salesforce/ConnectorState.java 2009-04-24
16:12:37 UTC (rev 842)
+++
trunk/connectors/connector-salesforce/src/main/java/com/metamatrix/connector/salesforce/ConnectorState.java 2009-04-24
20:16:30 UTC (rev 843)
@@ -35,7 +35,6 @@
public static final String PASSWORD = "password";
public static final String URL = "URL";
- ConnectorLogger logger;
String username;
String password;
URL url;
@@ -45,7 +44,6 @@
if (logger == null) {
throw new ConnectorException("Internal Exception: logger is
null");
}
- this.logger = logger;
String username = props.getProperty(USERNAME);
if (username != null) {
Modified:
trunk/connectors/connector-salesforce/src/main/java/com/metamatrix/connector/salesforce/Util.java
===================================================================
---
trunk/connectors/connector-salesforce/src/main/java/com/metamatrix/connector/salesforce/Util.java 2009-04-24
16:12:37 UTC (rev 842)
+++
trunk/connectors/connector-salesforce/src/main/java/com/metamatrix/connector/salesforce/Util.java 2009-04-24
20:16:30 UTC (rev 843)
@@ -29,12 +29,6 @@
public class Util {
- public static boolean convertStringToBoolean(String value) {
- Boolean retval = (value == null ? Boolean.FALSE : new Boolean(value
- .equalsIgnoreCase(Boolean.TRUE.toString())));
- return retval.booleanValue();
- }
-
public static String stripQutes(String id) {
if((id.startsWith("'") && id.endsWith("'"))) {
id = id.substring(1,id.length()-1);
Modified:
trunk/connectors/connector-salesforce/src/main/java/com/metamatrix/connector/salesforce/connection/SalesforceConnection.java
===================================================================
---
trunk/connectors/connector-salesforce/src/main/java/com/metamatrix/connector/salesforce/connection/SalesforceConnection.java 2009-04-24
16:12:37 UTC (rev 842)
+++
trunk/connectors/connector-salesforce/src/main/java/com/metamatrix/connector/salesforce/connection/SalesforceConnection.java 2009-04-24
20:16:30 UTC (rev 843)
@@ -22,23 +22,29 @@
package com.metamatrix.connector.salesforce.connection;
import java.net.URL;
+import java.util.Calendar;
import java.util.List;
import org.teiid.connector.api.ConnectorEnvironment;
import org.teiid.connector.api.ConnectorException;
import org.teiid.connector.api.ExecutionContext;
+import org.teiid.connector.api.ProcedureExecution;
import org.teiid.connector.api.ResultSetExecution;
import org.teiid.connector.api.UpdateExecution;
import org.teiid.connector.basic.BasicConnection;
import org.teiid.connector.language.ICommand;
+import org.teiid.connector.language.IProcedure;
import org.teiid.connector.language.IQueryCommand;
import org.teiid.connector.metadata.runtime.RuntimeMetadata;
import com.metamatrix.connector.salesforce.Messages;
import com.metamatrix.connector.salesforce.connection.impl.ConnectionImpl;
import com.metamatrix.connector.salesforce.execution.DataPayload;
+import com.metamatrix.connector.salesforce.execution.DeletedResult;
+import com.metamatrix.connector.salesforce.execution.ProcedureExecutionParentImpl;
import com.metamatrix.connector.salesforce.execution.QueryExecutionImpl;
import com.metamatrix.connector.salesforce.execution.UpdateExecutionParent;
+import com.metamatrix.connector.salesforce.execution.UpdatedResult;
import com.sforce.soap.partner.QueryResult;
public class SalesforceConnection extends BasicConnection {
@@ -87,6 +93,13 @@
}
@Override
+ public ProcedureExecution createProcedureExecution(IProcedure command,
+ ExecutionContext executionContext, RuntimeMetadata metadata)
+ throws ConnectorException {
+ return new ProcedureExecutionParentImpl(command, this, metadata, executionContext,
connectorEnv);
+ }
+
+ @Override
public void close() {
}
@@ -124,4 +137,14 @@
public int update(List<DataPayload> updateDataList) throws ConnectorException {
return connection.update(updateDataList);
}
+
+ public UpdatedResult getUpdated(String objectName, Calendar startCalendar,
+ Calendar endCalendar) throws ConnectorException {
+ return connection.getUpdated(objectName, startCalendar, endCalendar);
+ }
+
+ public DeletedResult getDeleted(String objectName, Calendar startCalendar,
+ Calendar endCalendar) throws ConnectorException {
+ return connection.getDeleted(objectName, startCalendar, endCalendar);
+ }
}
Modified:
trunk/connectors/connector-salesforce/src/main/java/com/metamatrix/connector/salesforce/connection/impl/ConnectionImpl.java
===================================================================
---
trunk/connectors/connector-salesforce/src/main/java/com/metamatrix/connector/salesforce/connection/impl/ConnectionImpl.java 2009-04-24
16:12:37 UTC (rev 842)
+++
trunk/connectors/connector-salesforce/src/main/java/com/metamatrix/connector/salesforce/connection/impl/ConnectionImpl.java 2009-04-24
20:16:30 UTC (rev 843)
@@ -23,6 +23,8 @@
import java.net.URL;
import java.rmi.RemoteException;
+import java.util.ArrayList;
+import java.util.Calendar;
import java.util.List;
import javax.xml.rpc.ServiceException;
@@ -40,8 +42,14 @@
import org.teiid.connector.api.ConnectorLogger;
import com.metamatrix.connector.salesforce.execution.DataPayload;
+import com.metamatrix.connector.salesforce.execution.DeletedObject;
+import com.metamatrix.connector.salesforce.execution.DeletedResult;
+import com.metamatrix.connector.salesforce.execution.UpdatedResult;
import com.sforce.soap.partner.CallOptions;
import com.sforce.soap.partner.DeleteResult;
+import com.sforce.soap.partner.DeletedRecord;
+import com.sforce.soap.partner.GetDeletedResult;
+import com.sforce.soap.partner.GetUpdatedResult;
import com.sforce.soap.partner.LoginResult;
import com.sforce.soap.partner.QueryOptions;
import com.sforce.soap.partner.QueryResult;
@@ -50,6 +58,7 @@
import com.sforce.soap.partner.SforceServiceLocator;
import com.sforce.soap.partner.SoapBindingStub;
import com.sforce.soap.partner.fault.ApiFault;
+import com.sforce.soap.partner.fault.InvalidSObjectFault;
import com.sforce.soap.partner.fault.UnexpectedErrorFault;
import com.sforce.soap.partner.fault.InvalidQueryLocatorFault;
import com.sforce.soap.partner.sobject.SObject;
@@ -280,4 +289,49 @@
return results.length;
}
+ public UpdatedResult getUpdated(String objectType, Calendar startDate, Calendar endDate)
throws ConnectorException {
+ try {
+ GetUpdatedResult updated = binding.getUpdated(objectType, startDate, endDate);
+ UpdatedResult result = new UpdatedResult();
+ result.setLatestDateCovered(updated.getLatestDateCovered());
+ result.setIDs(updated.getIds());
+ return result;
+ } catch (InvalidSObjectFault e) {
+ throw new ConnectorException(e.getExceptionMessage());
+ } catch (UnexpectedErrorFault e) {
+ throw new ConnectorException(e.getMessage());
+ } catch (RemoteException e) {
+ throw new ConnectorException(e, e.getMessage());
+ }
+ }
+
+ public DeletedResult getDeleted(String objectName, Calendar startCalendar,
+ Calendar endCalendar) throws ConnectorException {
+ try {
+ GetDeletedResult deleted = binding.getDeleted(objectName, startCalendar,
endCalendar);
+ DeletedResult result = new DeletedResult();
+ result.setLatestDateCovered(deleted.getLatestDateCovered());
+ result.setEarliestDateAvailable(deleted.getEarliestDateAvailable());
+ DeletedRecord[] records = deleted.getDeletedRecords();
+ List<DeletedObject> resultRecords = new ArrayList<DeletedObject>();
+ DeletedObject object;
+ if(null !=records) {
+ for (int i = 0; i < records.length; i++) {
+ DeletedRecord record = records[i];
+ object = new DeletedObject();
+ object.setID(record.getId());
+ object.setDeletedDate(record.getDeletedDate());
+ resultRecords.add(object);
+ }
+ }
+ result.setResultRecords(resultRecords);
+ return result;
+ } catch (InvalidSObjectFault e) {
+ throw new ConnectorException(e.getExceptionMessage());
+ } catch (UnexpectedErrorFault e) {
+ throw new ConnectorException(e.getMessage());
+ } catch (RemoteException e) {
+ throw new ConnectorException(e, e.getMessage());
+ }
+ }
}
Added:
trunk/connectors/connector-salesforce/src/main/java/com/metamatrix/connector/salesforce/execution/DeletedObject.java
===================================================================
---
trunk/connectors/connector-salesforce/src/main/java/com/metamatrix/connector/salesforce/execution/DeletedObject.java
(rev 0)
+++
trunk/connectors/connector-salesforce/src/main/java/com/metamatrix/connector/salesforce/execution/DeletedObject.java 2009-04-24
20:16:30 UTC (rev 843)
@@ -0,0 +1,22 @@
+package com.metamatrix.connector.salesforce.execution;
+
+import java.util.Calendar;
+
+public class DeletedObject {
+
+ String ID;
+ Calendar deletedDate;
+
+ public String getID() {
+ return ID;
+ }
+ public void setID(String id) {
+ ID = id;
+ }
+ public Calendar getDeletedDate() {
+ return deletedDate;
+ }
+ public void setDeletedDate(Calendar deletedDate) {
+ this.deletedDate = deletedDate;
+ }
+}
Added:
trunk/connectors/connector-salesforce/src/main/java/com/metamatrix/connector/salesforce/execution/DeletedResult.java
===================================================================
---
trunk/connectors/connector-salesforce/src/main/java/com/metamatrix/connector/salesforce/execution/DeletedResult.java
(rev 0)
+++
trunk/connectors/connector-salesforce/src/main/java/com/metamatrix/connector/salesforce/execution/DeletedResult.java 2009-04-24
20:16:30 UTC (rev 843)
@@ -0,0 +1,36 @@
+package com.metamatrix.connector.salesforce.execution;
+
+import java.util.Calendar;
+import java.util.List;
+
+public class DeletedResult {
+
+ private Calendar latestDateCovered;
+ private Calendar earliestDateAvailable;
+ private List<DeletedObject> resultRecords;
+
+ public Calendar getLatestDateCovered() {
+ return latestDateCovered;
+ }
+
+ public void setLatestDateCovered(Calendar latestDateCovered) {
+ this.latestDateCovered = latestDateCovered;
+ }
+
+
+ public Calendar getEarliestDateAvailable() {
+ return earliestDateAvailable;
+ }
+
+ public void setEarliestDateAvailable(Calendar earliestDateAvailable) {
+ this.earliestDateAvailable = earliestDateAvailable;
+ }
+
+ public void setResultRecords(List<DeletedObject> resultRecords) {
+ this.resultRecords = resultRecords;
+ }
+
+ public List<DeletedObject> getResultRecords() {
+ return resultRecords;
+ }
+}
Added:
trunk/connectors/connector-salesforce/src/main/java/com/metamatrix/connector/salesforce/execution/GetDeletedExecutionImpl.java
===================================================================
---
trunk/connectors/connector-salesforce/src/main/java/com/metamatrix/connector/salesforce/execution/GetDeletedExecutionImpl.java
(rev 0)
+++
trunk/connectors/connector-salesforce/src/main/java/com/metamatrix/connector/salesforce/execution/GetDeletedExecutionImpl.java 2009-04-24
20:16:30 UTC (rev 843)
@@ -0,0 +1,95 @@
+package com.metamatrix.connector.salesforce.execution;
+
+import java.sql.Timestamp;
+import java.util.ArrayList;
+import java.util.Calendar;
+import java.util.GregorianCalendar;
+import java.util.List;
+
+import org.teiid.connector.api.ConnectorException;
+import org.teiid.connector.language.IParameter;
+import org.teiid.connector.language.IProcedure;
+
+/**
+ *
+ * The structure of the getDeleted procedure is:
+ * Salesforce object type: String: IN param
+ * startDate: datatime: IN param
+ * enddate: datetime: IN param
+ * earliestDateAvailable: datetime: OUT param
+ * latestDateCovered: datetime: OUT param
+ * getUpdatedResult: resultset: OUT param
+ *
+ */
+
+public class GetDeletedExecutionImpl implements SalesforceProcedureExecution {
+
+ private static final int EARLIESTDATEAVAILABLE = 4;
+ private static final int RESULT = 5;
+
+ private ProcedureExecutionParent parent;
+
+ private DeletedResult deletedResult;
+ private int resultIndex = 0;
+
+ public GetDeletedExecutionImpl(
+ ProcedureExecutionParent procedureExecutionParent) {
+ this.parent = procedureExecutionParent;
+ }
+
+ @Override
+ public void cancel() {
+ // nothing to do here
+
+ }
+
+ @Override
+ public void close() {
+ // nothing to do here
+
+ }
+
+ @Override
+ public void execute(ProcedureExecutionParent procedureExecutionParent) throws
ConnectorException {
+ IProcedure command = parent.getCommand();
+ List<IParameter> params = command.getParameters();
+
+ IParameter object = (IParameter) params.get(OBJECT);
+ String objectName = (String) object.getValue();
+
+ IParameter start = (IParameter) params.get(STARTDATE);
+ Timestamp startTime = (Timestamp) start.getValue();
+ Calendar startCalendar = GregorianCalendar.getInstance();
+ startCalendar.setTime(startTime);
+
+ IParameter end = (IParameter) params.get(ENDDATE);
+ Timestamp endTime = (Timestamp) end.getValue();
+ Calendar endCalendar = GregorianCalendar.getInstance();
+ endCalendar.setTime(endTime);
+
+ deletedResult = parent.getConnection().getDeleted(objectName, startCalendar,
endCalendar);
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public List<?> getOutputParameterValues() {
+ List result = new ArrayList();
+ result.add(deletedResult.getLatestDateCovered());
+ result.add(deletedResult.getEarliestDateAvailable());
+ return result;
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public List<?> next() {
+ List result = null;
+ if(deletedResult.getResultRecords() != null && resultIndex <
deletedResult.getResultRecords().size()){
+ result = new ArrayList(2);
+ result.add(deletedResult.getResultRecords().get(resultIndex).getID());
+ result.add(deletedResult.getResultRecords().get(resultIndex).getDeletedDate());
+ resultIndex++;
+ }
+ return result;
+ }
+
+}
Added:
trunk/connectors/connector-salesforce/src/main/java/com/metamatrix/connector/salesforce/execution/GetUpdatedExecutionImpl.java
===================================================================
---
trunk/connectors/connector-salesforce/src/main/java/com/metamatrix/connector/salesforce/execution/GetUpdatedExecutionImpl.java
(rev 0)
+++
trunk/connectors/connector-salesforce/src/main/java/com/metamatrix/connector/salesforce/execution/GetUpdatedExecutionImpl.java 2009-04-24
20:16:30 UTC (rev 843)
@@ -0,0 +1,86 @@
+package com.metamatrix.connector.salesforce.execution;
+
+import java.sql.Timestamp;
+import java.util.ArrayList;
+import java.util.Calendar;
+import java.util.GregorianCalendar;
+import java.util.List;
+
+import org.teiid.connector.api.ConnectorException;
+import org.teiid.connector.language.IParameter;
+import org.teiid.connector.language.IProcedure;
+
+/**
+ *
+ * The structure of the getUpdated procedure is:
+ * Salesforce object type: String: IN param
+ * startDate: datatime: IN param
+ * enddate: datetime: IN param
+ * latestDateCovered: datetime: OUT param
+ * getUpdatedResult: resultset: OUT param
+ *
+ */
+
+public class GetUpdatedExecutionImpl implements SalesforceProcedureExecution {
+
+ private static final int RESULT = 4;
+
+ private ProcedureExecutionParent parent;
+ private UpdatedResult updatedResult;
+ private int idIndex = 0;
+
+ public GetUpdatedExecutionImpl(
+ ProcedureExecutionParent procedureExecutionParent) {
+ this.parent = procedureExecutionParent;
+ }
+
+ @Override
+ public void cancel() {
+ // nothing to do here
+ }
+
+ @Override
+ public void close() {
+ // nothing to do here
+ }
+
+ @Override
+ public void execute(ProcedureExecutionParent procedureExecutionParent) throws
ConnectorException {
+ IProcedure command = parent.getCommand();
+ List<IParameter> params = command.getParameters();
+
+ IParameter object = (IParameter) params.get(OBJECT);
+ String objectName = (String) object.getValue();
+
+ IParameter start = (IParameter) params.get(STARTDATE);
+ Timestamp startTime = (Timestamp) start.getValue();
+ Calendar startCalendar = GregorianCalendar.getInstance();
+ startCalendar.setTime(startTime);
+
+ IParameter end = (IParameter) params.get(ENDDATE);
+ Timestamp endTime = (Timestamp) end.getValue();
+ Calendar endCalendar = GregorianCalendar.getInstance();
+ endCalendar.setTime(endTime);
+
+ updatedResult = parent.getConnection().getUpdated(objectName, startCalendar,
endCalendar);
+ }
+
+ @Override
+ public List<?> getOutputParameterValues() {
+ List result = new ArrayList(1);
+ result.add(updatedResult.getLatestDateCovered());
+ return result;
+ }
+
+ @Override
+ public List<?> next() {
+ List result = null;
+ if(updatedResult.getIDs() != null && idIndex <
updatedResult.getIDs().length){
+ result = new ArrayList(1);
+ result.add(updatedResult.getIDs()[idIndex]);
+ idIndex++;
+ }
+ return result;
+ }
+
+}
Added:
trunk/connectors/connector-salesforce/src/main/java/com/metamatrix/connector/salesforce/execution/ProcedureExecutionParent.java
===================================================================
---
trunk/connectors/connector-salesforce/src/main/java/com/metamatrix/connector/salesforce/execution/ProcedureExecutionParent.java
(rev 0)
+++
trunk/connectors/connector-salesforce/src/main/java/com/metamatrix/connector/salesforce/execution/ProcedureExecutionParent.java 2009-04-24
20:16:30 UTC (rev 843)
@@ -0,0 +1,22 @@
+package com.metamatrix.connector.salesforce.execution;
+
+import org.teiid.connector.api.ConnectorEnvironment;
+import org.teiid.connector.api.ExecutionContext;
+import org.teiid.connector.language.IProcedure;
+import org.teiid.connector.metadata.runtime.RuntimeMetadata;
+
+import com.metamatrix.connector.salesforce.connection.SalesforceConnection;
+
+public interface ProcedureExecutionParent {
+
+ public IProcedure getCommand();
+
+ public ExecutionContext getExecutionContext();
+
+ public RuntimeMetadata getMetadata();
+
+ public SalesforceConnection getConnection();
+
+ public ConnectorEnvironment getConectorEnvironment();
+
+}
Added:
trunk/connectors/connector-salesforce/src/main/java/com/metamatrix/connector/salesforce/execution/ProcedureExecutionParentImpl.java
===================================================================
---
trunk/connectors/connector-salesforce/src/main/java/com/metamatrix/connector/salesforce/execution/ProcedureExecutionParentImpl.java
(rev 0)
+++
trunk/connectors/connector-salesforce/src/main/java/com/metamatrix/connector/salesforce/execution/ProcedureExecutionParentImpl.java 2009-04-24
20:16:30 UTC (rev 843)
@@ -0,0 +1,105 @@
+package com.metamatrix.connector.salesforce.execution;
+
+import java.util.List;
+
+import org.teiid.connector.api.ConnectorEnvironment;
+import org.teiid.connector.api.ConnectorException;
+import org.teiid.connector.api.DataNotAvailableException;
+import org.teiid.connector.api.ExecutionContext;
+import org.teiid.connector.api.ProcedureExecution;
+import org.teiid.connector.language.IProcedure;
+import org.teiid.connector.metadata.runtime.RuntimeMetadata;
+
+import com.metamatrix.connector.salesforce.connection.SalesforceConnection;
+
+public class ProcedureExecutionParentImpl implements ProcedureExecution,
ProcedureExecutionParent {
+
+ private IProcedure command;
+ private ExecutionContext executionContext;
+ private RuntimeMetadata metadata;
+ private SalesforceProcedureExecution execution;
+ private SalesforceConnection connection;
+ private ConnectorEnvironment connectorEnv;
+
+ public ProcedureExecutionParentImpl(IProcedure command,
+ SalesforceConnection connection, RuntimeMetadata metadata, ExecutionContext
executionContext, ConnectorEnvironment connectorEnv) {
+ this.setCommand(command);
+ this.setConnection(connection);
+ this.setMetadata(metadata);
+ this.setExecutionContext(executionContext);
+ this.setConnectorEnvironment(connectorEnv);
+ }
+
+ @Override
+ public List<?> getOutputParameterValues() throws ConnectorException {
+ return execution.getOutputParameterValues();
+ }
+
+ @Override
+ public List<?> next() throws ConnectorException, DataNotAvailableException {
+ return execution.next();
+ }
+
+ @Override
+ public void cancel() throws ConnectorException {
+ execution.cancel();
+ }
+
+ @Override
+ public void close() throws ConnectorException {
+ execution.close();
+ }
+
+ @Override
+ public void execute() throws ConnectorException {
+ if(getCommand().getProcedureName().endsWith("getUpdated")) {
+ execution = new GetUpdatedExecutionImpl(this);
+ execution.execute(this);
+ }
+ else if(getCommand().getProcedureName().endsWith("getDeleted")) {
+ execution = new GetDeletedExecutionImpl(this);
+ execution.execute(this);
+ }
+ }
+
+ public void setCommand(IProcedure command) {
+ this.command = command;
+ }
+
+ public IProcedure getCommand() {
+ return command;
+ }
+
+ private void setConnection(SalesforceConnection connection) {
+ this.connection = connection;
+ }
+
+ public SalesforceConnection getConnection() {
+ return connection;
+ }
+
+ private void setExecutionContext(ExecutionContext executionContext) {
+ this.executionContext = executionContext;
+ }
+
+ public ExecutionContext getExecutionContext() {
+ return executionContext;
+ }
+
+ private void setMetadata(RuntimeMetadata metadata) {
+ this.metadata = metadata;
+ }
+
+ public RuntimeMetadata getMetadata() {
+ return metadata;
+ }
+
+ private void setConnectorEnvironment(ConnectorEnvironment connectorEnv) {
+ this.connectorEnv = connectorEnv;
+ }
+
+ public ConnectorEnvironment getConectorEnvironment() {
+ return connectorEnv;
+ }
+
+}
Added:
trunk/connectors/connector-salesforce/src/main/java/com/metamatrix/connector/salesforce/execution/SalesforceProcedureExecution.java
===================================================================
---
trunk/connectors/connector-salesforce/src/main/java/com/metamatrix/connector/salesforce/execution/SalesforceProcedureExecution.java
(rev 0)
+++
trunk/connectors/connector-salesforce/src/main/java/com/metamatrix/connector/salesforce/execution/SalesforceProcedureExecution.java 2009-04-24
20:16:30 UTC (rev 843)
@@ -0,0 +1,24 @@
+package com.metamatrix.connector.salesforce.execution;
+
+import java.util.List;
+
+import org.teiid.connector.api.ConnectorException;
+
+public interface SalesforceProcedureExecution {
+
+ static final int OBJECT = 0;
+ static final int STARTDATE = 1;
+ static final int ENDDATE = 2;
+ static final int LATESTDATECOVERED = 3;
+
+ List<?> getOutputParameterValues();
+
+ List<?> next();
+
+ void cancel();
+
+ void close();
+
+ void execute(ProcedureExecutionParent procedureExecutionParent) throws
ConnectorException;
+
+}
Added:
trunk/connectors/connector-salesforce/src/main/java/com/metamatrix/connector/salesforce/execution/UpdatedResult.java
===================================================================
---
trunk/connectors/connector-salesforce/src/main/java/com/metamatrix/connector/salesforce/execution/UpdatedResult.java
(rev 0)
+++
trunk/connectors/connector-salesforce/src/main/java/com/metamatrix/connector/salesforce/execution/UpdatedResult.java 2009-04-24
20:16:30 UTC (rev 843)
@@ -0,0 +1,25 @@
+package com.metamatrix.connector.salesforce.execution;
+
+import java.util.Calendar;
+
+public class UpdatedResult {
+
+ private Calendar latestDateCovered;
+ private String[] IDs;
+
+ public Calendar getLatestDateCovered() {
+ return latestDateCovered;
+ }
+
+ public void setLatestDateCovered(Calendar latestDateCovered) {
+ this.latestDateCovered = latestDateCovered;
+ }
+
+ public String[] getIDs() {
+ return IDs;
+ }
+
+ public void setIDs(String[] ids) {
+ this.IDs = ids;
+ }
+}
Modified:
trunk/connectors/connector-salesforce/src/main/java/com/metamatrix/connector/salesforce/execution/visitors/CriteriaVisitor.java
===================================================================
---
trunk/connectors/connector-salesforce/src/main/java/com/metamatrix/connector/salesforce/execution/visitors/CriteriaVisitor.java 2009-04-24
16:12:37 UTC (rev 842)
+++
trunk/connectors/connector-salesforce/src/main/java/com/metamatrix/connector/salesforce/execution/visitors/CriteriaVisitor.java 2009-04-24
20:16:30 UTC (rev 843)
@@ -170,7 +170,6 @@
private void appendMultiselectIn(Element column, IInCriteria criteria) throws
ConnectorException {
StringBuffer result = new StringBuffer();
- IExpression left = criteria.getLeftExpression();
result.append(column.getNameInSource()).append(SPACE);
if(criteria.isNegated()) {
result.append(EXCLUDES).append(SPACE);
@@ -314,7 +313,7 @@
table = group.getMetadataObject();
String supportsQuery = (String) table.getProperties().get(
"Supports Query");
- if (!Util.convertStringToBoolean(supportsQuery)) {
+ if (!Boolean.valueOf(supportsQuery)) {
throw new ConnectorException(
table.getNameInSource()
+ " "
Modified:
trunk/connectors/connector-salesforce/src/main/java/com/metamatrix/connector/salesforce/execution/visitors/InsertVisitor.java
===================================================================
---
trunk/connectors/connector-salesforce/src/main/java/com/metamatrix/connector/salesforce/execution/visitors/InsertVisitor.java 2009-04-24
16:12:37 UTC (rev 842)
+++
trunk/connectors/connector-salesforce/src/main/java/com/metamatrix/connector/salesforce/execution/visitors/InsertVisitor.java 2009-04-24
20:16:30 UTC (rev 843)
@@ -38,7 +38,6 @@
public class InsertVisitor extends CriteriaVisitor {
- List<ConnectorException> exceptions = new ArrayList<ConnectorException>();
List<MessageElement> elements = new ArrayList<MessageElement>();
public InsertVisitor(RuntimeMetadata metadata) {
Modified:
trunk/connectors/connector-salesforce/src/main/java/com/metamatrix/connector/salesforce/execution/visitors/SelectVisitor.java
===================================================================
---
trunk/connectors/connector-salesforce/src/main/java/com/metamatrix/connector/salesforce/execution/visitors/SelectVisitor.java 2009-04-24
16:12:37 UTC (rev 842)
+++
trunk/connectors/connector-salesforce/src/main/java/com/metamatrix/connector/salesforce/execution/visitors/SelectVisitor.java 2009-04-24
20:16:30 UTC (rev 843)
@@ -84,14 +84,15 @@
selectSymbolIndexToElement.put(index, element);
selectSymbolNameToIndex .put(element.getNameInSource(), index);
String nameInSource = element.getNameInSource();
- if (nameInSource.equalsIgnoreCase("id")) {
- idIndex = index;
- }
if (null == nameInSource || nameInSource.length() == 0) {
exceptions.add(new ConnectorException(
"name in source is null or empty for column "
+ symbol.toString()));
+ continue;
}
+ if (nameInSource.equalsIgnoreCase("id")) {
+ idIndex = index;
+ }
if (!firstTime) {
selectSymbols.append(", ");
} else {