1 19 20 package org.apache.cayenne.query; 21 22 import java.util.HashMap ; 23 import java.util.Map ; 24 25 import org.apache.cayenne.exp.Expression; 26 import org.apache.cayenne.map.ObjEntity; 27 28 32 public class UpdateQuery extends QualifiedQuery { 33 34 protected Map updAttributes = new HashMap (); 35 36 37 public UpdateQuery() { 38 } 39 40 private void init(Object root, Expression qualifier) { 41 setRoot(root); 42 setQualifier(qualifier); 43 } 44 45 50 public UpdateQuery(ObjEntity root) { 51 this(root, null); 52 } 53 54 60 public UpdateQuery(ObjEntity root, Expression qualifier) { 61 init(root, qualifier); 62 } 63 64 70 public UpdateQuery(Class rootClass) { 71 this(rootClass, null); 72 } 73 74 81 public UpdateQuery(Class rootClass, Expression qualifier) { 82 init(rootClass, qualifier); 83 } 84 85 86 public UpdateQuery(String objEntityName) { 87 this(objEntityName, null); 88 } 89 90 94 public UpdateQuery(String objEntityName, Expression qualifier) { 95 init(objEntityName, qualifier); 96 } 97 98 103 public SQLAction createSQLAction(SQLActionVisitor visitor) { 104 return visitor.updateAction(this); 105 } 106 107 public void addUpdAttribute(String attrName, Object updatedValue) { 108 updAttributes.put(attrName, updatedValue); 109 } 110 111 112 public Map getUpdAttributes() { 113 return updAttributes; 114 } 115 } 116 | Popular Tags |