| Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||||||
| EOAdaptorOperation |
|
| 1.4;1.4 |
| 1 | /* |
|
| 2 | Wotonomy: OpenStep design patterns for pure Java applications. |
|
| 3 | Copyright (C) 2001 Michael Powers |
|
| 4 | ||
| 5 | This library is free software; you can redistribute it and/or |
|
| 6 | modify it under the terms of the GNU Lesser General Public |
|
| 7 | License as published by the Free Software Foundation; either |
|
| 8 | version 2.1 of the License, or (at your option) any later version. |
|
| 9 | ||
| 10 | This library is distributed in the hope that it will be useful, |
|
| 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
| 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
| 13 | Lesser General Public License for more details. |
|
| 14 | ||
| 15 | You should have received a copy of the GNU Lesser General Public |
|
| 16 | License along with this library; if not, see http://www.gnu.org |
|
| 17 | */ |
|
| 18 | package net.wotonomy.access; |
|
| 19 | ||
| 20 | import net.wotonomy.control.EOQualifier; |
|
| 21 | import net.wotonomy.foundation.NSArray; |
|
| 22 | import net.wotonomy.foundation.NSDictionary; |
|
| 23 | ||
| 24 | /** |
|
| 25 | * Represents a single primitive operation in a database server. |
|
| 26 | * Can be insert, update, delete, lock a row, or execute a |
|
| 27 | * stored procedure. |
|
| 28 | * |
|
| 29 | * @author ezamudio@nasoft.com |
|
| 30 | * @author $Author: cgruber $ |
|
| 31 | * @version $Revision: 894 $ |
|
| 32 | */ |
|
| 33 | public class EOAdaptorOperation { |
|
| 34 | ||
| 35 | protected EOEntity _entity; |
|
| 36 | protected NSArray _attributes; |
|
| 37 | protected NSDictionary _changedValues; |
|
| 38 | protected Throwable _exception; |
|
| 39 | protected EOQualifier _qualifier; |
|
| 40 | protected EOStoredProcedure _proc; |
|
| 41 | protected int _adaptorOp; |
|
| 42 | ||
| 43 | public EOAdaptorOperation(EOEntity entity) { |
|
| 44 | 0 | super(); |
| 45 | 0 | _entity = entity; |
| 46 | 0 | } |
| 47 | ||
| 48 | public void setAdaptorOperator(int adOp) { |
|
| 49 | 0 | _adaptorOp = adOp; |
| 50 | 0 | } |
| 51 | public int adaptorOperator() { |
|
| 52 | 0 | return _adaptorOp; |
| 53 | } |
|
| 54 | ||
| 55 | public void setAttributes(NSArray atts) { |
|
| 56 | 0 | _attributes = atts; |
| 57 | 0 | } |
| 58 | public NSArray attributes() { |
|
| 59 | 0 | return _attributes; |
| 60 | } |
|
| 61 | ||
| 62 | public void setChangedValues(NSDictionary values) { |
|
| 63 | 0 | _changedValues = values; |
| 64 | 0 | } |
| 65 | public NSDictionary changedValues() { |
|
| 66 | 0 | return _changedValues; |
| 67 | } |
|
| 68 | ||
| 69 | public int compareAdaptorOperation(EOAdaptorOperation op) { |
|
| 70 | 0 | if (op.entity() != null && entity() != null) { |
| 71 | 0 | if (!op.entity().name().equals(entity().name())) |
| 72 | 0 | op.entity().name().compareTo(entity().name()); |
| 73 | } |
|
| 74 | 0 | if (adaptorOperator() < op.adaptorOperator()) |
| 75 | 0 | return -1; |
| 76 | 0 | if (adaptorOperator() > op.adaptorOperator()) |
| 77 | 0 | return 1; |
| 78 | 0 | return 0; |
| 79 | } |
|
| 80 | ||
| 81 | public EOEntity entity() { |
|
| 82 | 0 | return _entity; |
| 83 | } |
|
| 84 | ||
| 85 | public void setException(Throwable t) { |
|
| 86 | 0 | _exception = t; |
| 87 | 0 | } |
| 88 | public Throwable exception() { |
|
| 89 | 0 | return _exception; |
| 90 | } |
|
| 91 | ||
| 92 | public void setQualifier(EOQualifier q) { |
|
| 93 | 0 | _qualifier = q; |
| 94 | 0 | } |
| 95 | public EOQualifier qualifier() { |
|
| 96 | 0 | return _qualifier; |
| 97 | } |
|
| 98 | ||
| 99 | public void setStoredProcedure(EOStoredProcedure sp) { |
|
| 100 | 0 | _proc = sp; |
| 101 | 0 | } |
| 102 | public EOStoredProcedure storedProcedure() { |
|
| 103 | 0 | return _proc; |
| 104 | } |
|
| 105 | ||
| 106 | } |
|
| 107 | /* |
|
| 108 | * $Log$ |
|
| 109 | * Revision 1.2 2006/02/16 16:47:13 cgruber |
|
| 110 | * Move some classes in to "internal" packages and re-work imports, etc. |
|
| 111 | * |
|
| 112 | * Also use UnsupportedOperationExceptions where appropriate, instead of WotonomyExceptions. |
|
| 113 | * |
|
| 114 | * Revision 1.1 2006/02/16 13:19:57 cgruber |
|
| 115 | * Check in all sources in eclipse-friendly maven-enabled packages. |
|
| 116 | * |
|
| 117 | * Revision 1.1 2003/08/13 00:37:45 chochos |
|
| 118 | * an almost complete implementation of the abstract adaptor-layer classes |
|
| 119 | * |
|
| 120 | */ |