1 56 package org.objectstyle.cayenne.query; 57 58 import java.util.ArrayList ; 59 import java.util.List ; 60 61 import org.objectstyle.cayenne.map.DbEntity; 62 63 70 public abstract class BatchQuery extends AbstractQuery { 71 72 public BatchQuery(DbEntity dbEntity) { 73 setRoot(dbEntity); 74 } 75 76 81 public SQLAction createSQLAction(SQLActionVisitor visitor) { 82 return visitor.batchAction(this); 83 } 84 85 90 public boolean isUsingOptimisticLocking() { 91 return false; 92 } 93 94 97 public DbEntity getDbEntity() { 98 return (DbEntity) getRoot(); 99 } 100 101 112 public List getValuesForUpdateParameters(boolean includeNullValues) { 113 int len = getDbAttributes().size(); 114 List values = new ArrayList (len); 115 for (int i = 0; i < len; i++) { 116 Object value = getObject(i); 117 if (includeNullValues || value != null) { 118 values.add(value); 119 } 120 } 121 return values; 122 } 123 124 127 public boolean isEmpty() { 128 return size() == 0; 129 } 130 131 134 public abstract List getDbAttributes(); 135 136 139 public abstract void reset(); 140 141 146 public abstract boolean next(); 147 148 151 public Object getObject(int valueIndex) { 152 return getValue(valueIndex); 153 } 154 155 160 public abstract Object getValue(int valueIndex); 161 162 165 public abstract int size(); 166 } 167 | Popular Tags |