summaryrefslogtreecommitdiff
path: root/projects/net.wotonomy.persistence/src/main/java/net/wotonomy/access/EOAdaptorChannel.java
diff options
context:
space:
mode:
Diffstat (limited to 'projects/net.wotonomy.persistence/src/main/java/net/wotonomy/access/EOAdaptorChannel.java')
-rw-r--r--projects/net.wotonomy.persistence/src/main/java/net/wotonomy/access/EOAdaptorChannel.java110
1 files changed, 57 insertions, 53 deletions
diff --git a/projects/net.wotonomy.persistence/src/main/java/net/wotonomy/access/EOAdaptorChannel.java b/projects/net.wotonomy.persistence/src/main/java/net/wotonomy/access/EOAdaptorChannel.java
index 09b8a6d..44b3401 100644
--- a/projects/net.wotonomy.persistence/src/main/java/net/wotonomy/access/EOAdaptorChannel.java
+++ b/projects/net.wotonomy.persistence/src/main/java/net/wotonomy/access/EOAdaptorChannel.java
@@ -24,11 +24,11 @@ import net.wotonomy.foundation.NSDictionary;
import net.wotonomy.foundation.NSMutableDictionary;
/**
-*
-* @author ezamudio@nasoft.com
-* @author $Author: cgruber $
-* @version $Revision: 894 $
-*/
+ *
+ * @author ezamudio@nasoft.com
+ * @author $Author: cgruber $
+ * @version $Revision: 894 $
+ */
public abstract class EOAdaptorChannel {
protected EOAdaptorContext _context;
@@ -102,7 +102,7 @@ public abstract class EOAdaptorChannel {
public NSMutableDictionary dictionaryWithObjectsForAttributes(Object[] values, NSArray attributes) {
Object[] keys = new Object[attributes.count()];
for (int i = 0; i < attributes.count(); i++)
- keys[i] = ((EOAttribute)attributes.objectAtIndex(i)).name();
+ keys[i] = ((EOAttribute) attributes.objectAtIndex(i)).name();
return new NSMutableDictionary(values, keys);
}
@@ -150,57 +150,60 @@ public abstract class EOAdaptorChannel {
public void performAdaptorOperation(EOAdaptorOperation operation) {
int opcode = operation.adaptorOperator();
switch (opcode) {
- case EODatabaseOperation.AdaptorLockOperator:
- if (operation.entity() == null)
- throw new EOGeneralAdaptorException("A lock operation must have an entity assigned to it.",
+ case EODatabaseOperation.AdaptorLockOperator:
+ if (operation.entity() == null)
+ throw new EOGeneralAdaptorException("A lock operation must have an entity assigned to it.",
new NSDictionary(operation, "operation"));
- if (operation.qualifier() == null)
- throw new EOGeneralAdaptorException("A lock operation must have a qualifier assigned to it.",
+ if (operation.qualifier() == null)
+ throw new EOGeneralAdaptorException("A lock operation must have a qualifier assigned to it.",
new NSDictionary(operation, "operation"));
- if (operation.qualifier() == null)
- throw new EOGeneralAdaptorException("A lock operation must have changedValues assigned to it.",
+ if (operation.qualifier() == null)
+ throw new EOGeneralAdaptorException("A lock operation must have changedValues assigned to it.",
new NSDictionary(operation, "operation"));
- lockRowComparingAttributes(operation.attributes(), operation.entity(), operation.qualifier(), operation.changedValues());
- break;
- case EODatabaseOperation.AdaptorInsertOperator:
- if (operation.entity() == null)
- throw new EOGeneralAdaptorException("An insert operation must have an entity assigned to it.",
+ lockRowComparingAttributes(operation.attributes(), operation.entity(), operation.qualifier(),
+ operation.changedValues());
+ break;
+ case EODatabaseOperation.AdaptorInsertOperator:
+ if (operation.entity() == null)
+ throw new EOGeneralAdaptorException("An insert operation must have an entity assigned to it.",
new NSDictionary(operation, "operation"));
- if (operation.changedValues() == null)
- throw new EOGeneralAdaptorException("An insert operation must have changedValues assigned to it.",
+ if (operation.changedValues() == null)
+ throw new EOGeneralAdaptorException("An insert operation must have changedValues assigned to it.",
new NSDictionary(operation, "operation"));
- insertRow(operation.changedValues(), operation.entity());
- break;
- case EODatabaseOperation.AdaptorUpdateOperator:
- if (operation.entity() == null)
- throw new EOGeneralAdaptorException("An update operation must have an entity assigned to it.",
+ insertRow(operation.changedValues(), operation.entity());
+ break;
+ case EODatabaseOperation.AdaptorUpdateOperator:
+ if (operation.entity() == null)
+ throw new EOGeneralAdaptorException("An update operation must have an entity assigned to it.",
new NSDictionary(operation, "operation"));
- if (operation.changedValues() == null)
- throw new EOGeneralAdaptorException("An update operation must have changedValues assigned to it.",
+ if (operation.changedValues() == null)
+ throw new EOGeneralAdaptorException("An update operation must have changedValues assigned to it.",
new NSDictionary(operation, "operation"));
- updateValuesInRowsDescribedByQualifier(operation.changedValues(), operation.qualifier(), operation.entity());
- break;
- case EODatabaseOperation.AdaptorDeleteOperator:
- if (operation.entity() == null)
- throw new EOGeneralAdaptorException("A delete operation must have an entity assigned to it.",
+ updateValuesInRowsDescribedByQualifier(operation.changedValues(), operation.qualifier(),
+ operation.entity());
+ break;
+ case EODatabaseOperation.AdaptorDeleteOperator:
+ if (operation.entity() == null)
+ throw new EOGeneralAdaptorException("A delete operation must have an entity assigned to it.",
new NSDictionary(operation, "operation"));
- deleteRowsDescribedByQualifier(operation.qualifier(), operation.entity());
- break;
- case EODatabaseOperation.AdaptorStoredProcedureOperator:
- if (operation.storedProcedure() == null)
- throw new EOGeneralAdaptorException("A stored procedure operation must have a stored procedure assigned to it.",
+ deleteRowsDescribedByQualifier(operation.qualifier(), operation.entity());
+ break;
+ case EODatabaseOperation.AdaptorStoredProcedureOperator:
+ if (operation.storedProcedure() == null)
+ throw new EOGeneralAdaptorException(
+ "A stored procedure operation must have a stored procedure assigned to it.",
new NSDictionary(operation, "operation"));
- executeStoredProcedure(operation.storedProcedure(), operation.changedValues());
- break;
- default:
- throw new EOGeneralAdaptorException("I don't know how to perform an operation with code " + opcode,
+ executeStoredProcedure(operation.storedProcedure(), operation.changedValues());
+ break;
+ default:
+ throw new EOGeneralAdaptorException("I don't know how to perform an operation with code " + opcode,
new NSDictionary(operation, "operation"));
}
}
public void performAdaptorOperations(NSArray ops) {
for (int i = 0; i < ops.count(); i++) {
- EOAdaptorOperation adop = (EOAdaptorOperation)ops.objectAtIndex(i);
+ EOAdaptorOperation adop = (EOAdaptorOperation) ops.objectAtIndex(i);
performAdaptorOperation(adop);
}
}
@@ -217,28 +220,29 @@ public abstract class EOAdaptorChannel {
int count = updateValuesInRowsDescribedByQualifier(row, q, entity);
if (count != 1) {
adaptorContext().rollbackTransaction();
- throw new EOGeneralAdaptorException("The qualifier should describe exactly one row (updated " + count + " rows)");
+ throw new EOGeneralAdaptorException(
+ "The qualifier should describe exactly one row (updated " + count + " rows)");
}
adaptorContext().commitTransaction();
}
}
/*
- * $Log$
- * Revision 1.2 2006/02/16 16:47:14 cgruber
- * Move some classes in to "internal" packages and re-work imports, etc.
+ * $Log$ Revision 1.2 2006/02/16 16:47:14 cgruber Move some classes in to
+ * "internal" packages and re-work imports, etc.
*
- * Also use UnsupportedOperationExceptions where appropriate, instead of WotonomyExceptions.
+ * Also use UnsupportedOperationExceptions where appropriate, instead of
+ * WotonomyExceptions.
*
- * Revision 1.1 2006/02/16 13:19:57 cgruber
- * Check in all sources in eclipse-friendly maven-enabled packages.
+ * Revision 1.1 2006/02/16 13:19:57 cgruber Check in all sources in
+ * eclipse-friendly maven-enabled packages.
*
- * Revision 1.2 2005/05/11 15:21:53 cgruber
- * Change enum to enumeration, since enum is now a keyword as of Java 5.0
+ * Revision 1.2 2005/05/11 15:21:53 cgruber Change enum to enumeration, since
+ * enum is now a keyword as of Java 5.0
*
* A few other comments in the code.
*
- * Revision 1.1 2003/08/13 00:37:45 chochos
- * an almost complete implementation of the abstract adaptor-layer classes
+ * Revision 1.1 2003/08/13 00:37:45 chochos an almost complete implementation of
+ * the abstract adaptor-layer classes
*
*/ \ No newline at end of file