1 #set ($myClassName = "${glConditionKeyName}")
\r
5 using ${glPackageBaseCommonCOption};
\r
6 using ${glPackageBaseCommonCValue};
\r
7 using ${glPackageBaseCommonJavaLike};
\r
9 namespace ${glPackageBaseCommonCKey} {
\r
11 public abstract class ${myClassName} {
\r
13 // ===================================================================================
\r
16 /** Mark of replaced value. */
\r
17 public static readonly String MARK_OF_REPLACED_VALUE = "ReplacedValue";
\r
19 /** The condition key of equal. */
\r
20 public static readonly ${myClassName} CK_EQUAL = new ${myClassName}Equal();
\r
22 /** The condition key of notEqual. */
\r
23 public static readonly ${myClassName} CK_NOT_EQUAL = new ${myClassName}NotEqual();
\r
25 /** The condition key of greaterThan. */
\r
26 public static readonly ${myClassName} CK_GREATER_THAN = new ${myClassName}GreaterThan();
\r
28 /** The condition key of lessrThan. */
\r
29 public static readonly ${myClassName} CK_LESS_THAN = new ${myClassName}LessThan();
\r
31 /** The condition key of greaterEqual. */
\r
32 public static readonly ${myClassName} CK_GREATER_EQUAL = new ${myClassName}GreaterEqual();
\r
34 /** The condition key of lessEqual. */
\r
35 public static readonly ${myClassName} CK_LESS_EQUAL = new ${myClassName}LessEqual();
\r
37 /** The condition key of prefixSearch. */
\r
38 public static readonly ${myClassName} CK_PREFIX_SEARCH = new ${myClassName}PrefixSearch();
\r
40 /** The condition key of likeSearch. */
\r
41 public static readonly ${myClassName} CK_LIKE_SEARCH = new ${myClassName}LikeSearch();
\r
43 /** The condition key of inScope. */
\r
44 public static readonly ${myClassName} CK_IN_SCOPE = new ${myClassName}InScope();
\r
46 /** The condition key of notInScope. */
\r
47 public static readonly ${myClassName} CK_NOT_IN_SCOPE = new ${myClassName}NotInScope();
\r
49 /** The condition key of isNull. */
\r
50 public static readonly ${myClassName} CK_IS_NULL = new ${myClassName}IsNull();
\r
52 /** The condition key of isNotNull. */
\r
53 public static readonly ${myClassName} CK_IS_NOT_NULL = new ${myClassName}IsNotNull();
\r
55 /** Dummy-object for IsNull and IsNotNull and so on... */
\r
56 protected static readonly Object DUMMY_OBJECT = new Object();
\r
58 // ===================================================================================
\r
61 /** Condition-key. */
\r
62 protected String _conditionKey;
\r
65 protected String _operand;
\r
67 // ===================================================================================
\r
70 public String getConditionKey() {
\r
71 // Because initial charactor of property name is capital in dotNet world.
\r
72 return (_conditionKey != null ? _conditionKey.Substring(0, 1).ToUpper() + _conditionKey.Substring(1) : null);
\r
75 public String getOperand() {
\r
79 abstract public bool isValidRegistration(${glConditionValueName} conditionValue, Object value, String callerName);
\r
81 public ${myClassName} addWhereClause(List<String> conditionList, String columnName, ${glConditionValueName} value) {
\r
82 if (value == null) {
\r
83 String msg = "Argument[value] must not be null:";
\r
84 throw new IllegalArgumentException(msg + " value=" + value + " this.ToString()=" + ToString());
\r
86 doAddWhereClause(conditionList, columnName, value);
\r
90 public ${myClassName} addWhereClause(List<String> conditionList, String columnName, ${glConditionValueName} value, ${glConditionOptionInterfaceName} option) {
\r
91 if (value == null) {
\r
92 String msg = "Argument[value] must not be null:";
\r
93 throw new IllegalArgumentException(msg + " value=" + value + " this.ToString()=" + ToString());
\r
95 doAddWhereClause(conditionList, columnName, value, option);
\r
99 abstract protected void doAddWhereClause(List<String> conditionList, String columnName, ${glConditionValueName} value);
\r
100 abstract protected void doAddWhereClause(List<String> conditionList, String columnName, ${glConditionValueName} value, ${glConditionOptionInterfaceName} option);
\r
102 public ${glConditionValueName} setupConditionValue(${glConditionValueName} conditionValue, Object value, String location) {
\r
103 if (conditionValue == null) {
\r
104 String msg = "Argument[conditionValue] must not be null:";
\r
105 throw new IllegalArgumentException(msg + " value=" + value + " this.ToString()=" + ToString());
\r
107 doSetupConditionValue(conditionValue, value, location);
\r
108 return conditionValue;
\r
111 public ${glConditionValueName} setupConditionValue(${glConditionValueName} conditionValue, Object value, String location, ${glConditionOptionInterfaceName} option) {
\r
112 if (conditionValue == null) {
\r
113 String msg = "Argument[conditionValue] must not be null:";
\r
114 throw new IllegalArgumentException(msg + " value=" + value + " this.ToString()=" + ToString());
\r
116 doSetupConditionValue(conditionValue, value, location, option);
\r
117 return conditionValue;
\r
120 abstract protected void doSetupConditionValue(${glConditionValueName} conditionValue, Object value, String location);
\r
121 abstract protected void doSetupConditionValue(${glConditionValueName} conditionValue, Object value, String location, ${glConditionOptionInterfaceName} option);
\r
123 protected String buildBindClause(String columnName, String location) {
\r
124 return columnName + " " + getOperand() + " " + "/*dto." + location + "*/null";
\r
127 protected String buildBindClauseWithRearOption(String columnName, String location, String rearOption) {
\r
128 return columnName + " " + getOperand() + " " + "/*dto." + location + "*/null" + rearOption;
\r
131 protected String buildBindClause(String columnName, String location, String dummyValue) {
\r
132 return columnName + " " + getOperand() + " " + "/*dto." + location + "*/" + dummyValue;
\r
135 protected String buildClauseWithoutValue(String columnName) {
\r
136 return columnName + " " + getOperand();
\r
139 protected String getWildCard() {
\r
140 return "${database.WildCard}";
\r
143 // ===================================================================================
\r
146 public override int GetHashCode() {
\r
147 return getConditionKey().GetHashCode();
\r
150 public override bool Equals(Object other) {
\r
151 if (other is ${myClassName}) {
\r
152 if (this.getConditionKey().Equals(((${myClassName})other).getConditionKey())) {
\r
159 public override String ToString() {
\r
160 return "${myClassName}: " + getConditionKey() + " " + getOperand() + " wild-card=[" + getWildCard() + "]";
\r