litesoft
@ 947
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 |
// This Source Code is in the Public Domain per: http://unlicense.org package org.litesoft.ui_1_5.filtering; import org.litesoft.core.simpletypes.nonpublic.*; /** * <a href="../../Licence.txt">Licence</a><br> */ public abstract class FormQueryFilter extends EqualSupport // implements HierarchicalDesiccatable { // private WhereClauseType mType; // // /** // * Constructor that simply sets the <b>Type</b> of this FormQueryFilter.<p> // * <p/> // * Please see the <tt>public static final int</tt>s for the currently // * supported <b>Type</b>s.<p> // * // * @param pType the Type for this FormQueryFilter. // */ // protected FormQueryFilter( WhereClauseType pType ) // { // mType = pType; // } // // /** // * Accessor for the <b>Type</b> of this FormQueryFilter.<p> // * <p/> // * Please see the <tt>public static final int</tt>s for the currently // * supported <b>Type</b>s.<p> // * // * @return the <b>Type</b>. // */ // public final WhereClauseType getType() // { // return mType; // } // // /** // * Generate a Debug friendly representation.<p> // * // * @return a String for Debuging. // */ // public final String toString() // { // StringBuilder sb = new StringBuilder( "FormQueryFilter " ); // toStringHelper( sb ); // return sb.toString(); // } // // public WhereClause toWhereClause( MetaDataForPO pPOmd, Map<String, InputFQFentry> pParams ) // { // Utils.assertNotNull( "MetaDataForPO", pPOmd ); // if ( pParams == null ) // { // pParams = Collections.emptyMap(); // } // return LLtoWC( pPOmd, pParams ); // } // // abstract protected WhereClause LLtoWC( MetaDataForPO pPOmd, Map<String, InputFQFentry> pParams ); // // public int hashCode() // { // return mType.hashCode(); // } // // public boolean equals( Object obj ) // { // if ( obj instanceof FormQueryFilter ) // { // FormQueryFilter them = (FormQueryFilter) obj; // if ( this.mType.equals( them.mType ) ) // { // return LLequalsSameTypeNonNull( them ); // } // } // return false; // } // // abstract protected boolean LLequalsSameTypeNonNull( FormQueryFilter pThem ); // // /** // * Helper method for <b>toString()</b> that provides a more efficient // * mechanism for the recursive decent of a FormQueryFilter <i>tree</i>.<p> // * // * @param pSB the StringBuilder to build the FormQueryFilter into.<p> // * // * @see #toString() // */ // protected abstract void toStringHelper( StringBuilder pSB ); // // /** // * Helper method for <b>toStringHelper()</b> that adds a parenthesized // * nested FormQueryFilter.<p> // * // * @param pSB the StringBuilder to build the FormQueryFilter into. // * @param pFormQueryFilter the nested FormQueryFilter to wrap with parenthesizes // * and append.<p> // * // * @see #toStringHelper(StringBuilder) // */ // protected static void toStringHelperParenthesizer( StringBuilder pSB, FormQueryFilter pFormQueryFilter ) // { // pSB.append( '(' ); // pFormQueryFilter.toStringHelper( pSB ); // pSB.append( ')' ); // } // // /** // * Helper method for <b>toStringHelper()</b> that adds a prefix and then // * parenthesizes a nested FormQueryFilter.<p> // * // * @param pSB the StringBuilder to build the FormQueryFilter into. // * @param pPreFix the prefix to append. // * @param pFormQueryFilter the nested FormQueryFilter to wrap with parenthesizes // * and append.<p> // * // * @see #toStringHelper(StringBuilder) // */ // protected static void toStringHelperParenthesizer( StringBuilder pSB, String pPreFix, // FormQueryFilter pFormQueryFilter ) // { // pSB.append( pPreFix ); // pSB.append( ' ' ); // toStringHelperParenthesizer( pSB, pFormQueryFilter ); // } // // protected void toStringValue( StringBuilder pSB, Object pValue ) // { // if ( pValue == null ) // { // pSB.append( "null" ); // } // else if ( pValue instanceof Number ) // { // pSB.append( pValue ); // } // else // { // pSB.append( '"' ); // if ( pValue instanceof Date ) // { // pSB.append( Utils.formatYMDHMS( (Date) pValue ) ); // } // else // { // Utils.formatToJavaSourceString( pSB, pValue.toString() ); // } // pSB.append( '"' ); // } // } // // public final void desiccate( HierarchicalDataSink pSink ) // { // populate( pSink.createRootNode( getDesiccateType() ) ); // } // // public final void desiccate( HierarchicalDataSink.Node pParentNode ) // { // populate( pParentNode.createChildNode( getDesiccateType() ) ); // } // // protected final void populate( HierarchicalDataSink.Node pNode ) // { // LLpopulate( pNode ); // pNode.done(); // } // // abstract protected void LLpopulate( HierarchicalDataSink.Node pNode ); // // abstract public String getDesiccateType(); // // protected abstract static class FQFRehydrateFactory extends AbstractHierarchicalRehydrateFactory // { // public final HierarchicalDesiccatable rehydrate( HierarchicalRehydrateFactoryFactory pFactoryFactory, // HierarchicalDataSource.Node pSourceNode, // Object pCommonParam ) // { // chkRehydrationNodeName( pSourceNode, getType() ); // return create( pFactoryFactory, pSourceNode, (Finder) pCommonParam ); // } // // abstract protected String getType(); // // abstract protected HierarchicalDesiccatable create( // HierarchicalRehydrateFactoryFactory pFactoryFactory, HierarchicalDataSource.Node pSourceNode, // Finder pFinder ); // // protected FormQueryFilter getOptionalChildFilter( HierarchicalRehydrateFactoryFactory pFactoryFactory, // HierarchicalDataSource.Node pSourceNode, // Finder pFinder ) // { // Object rv = pFactoryFactory.rehydrateNextChild( pSourceNode, pFinder ); // if ( (rv instanceof FormQueryFilter) || (rv == null) ) // { // return (FormQueryFilter) rv; // } // throw new IllegalArgumentException( "Got a " + pSourceNode.getName() + // ", but instead of expected sub-filter, got a " + // rv.getClass() ); // } // // protected FormQueryFilter getRequiredChildFilter( HierarchicalRehydrateFactoryFactory pFactoryFactory, // HierarchicalDataSource.Node pSourceNode, // Finder pFinder ) // { // FormQueryFilter zChildFilter = getOptionalChildFilter( pFactoryFactory, pSourceNode, pFinder ); // if ( zChildFilter != null ) // { // return zChildFilter; // } // throw new IllegalArgumentException( // "Got a " + pSourceNode.getName() + ", but there was not a required sub-filter" ); // } // } // // private static HierarchicalRehydrateFactoryFactory zFactoryFactory = // HierarchicalRehydrateFactoryFactory.INSTANCE; // // private static void register( FQFRehydrateFactory pFactory ) // { // zFactoryFactory.addFactory( pFactory.getType(), pFactory ); // } // // public static void registerRehydrateFactories() // { // if ( null == zFactoryFactory.getFactory( FQFnot.TYPE ) ) // { // register( FQFand.RehydrateFactory.INSTANCE ); // register( FQFor.RehydrateFactory.INSTANCE ); // // register( FQFandEqualsInput.RehydrateFactory.INSTANCE ); // register( FQFbetweenInput.RehydrateFactory.INSTANCE ); // register( FQFcontainsInput.RehydrateFactory.INSTANCE ); // register( FQFendsWithInput.RehydrateFactory.INSTANCE ); // register( FQFequalsInput.RehydrateFactory.INSTANCE ); // register( FQFgreaterThanInput.RehydrateFactory.INSTANCE ); // register( FQFlessThanInput.RehydrateFactory.INSTANCE ); // register( FQFlikeInput.RehydrateFactory.INSTANCE ); // register( FQForEqualsInput.RehydrateFactory.INSTANCE ); // register( FQFstartsWithInput.RehydrateFactory.INSTANCE ); // // register( FQFisAnyOf.RehydrateFactory.INSTANCE ); // // register( FQFbetween.RehydrateFactory.INSTANCE ); // // register( FQFequals.RehydrateFactory.INSTANCE ); // register( FQFgreaterThan.RehydrateFactory.INSTANCE ); // register( FQFlessThan.RehydrateFactory.INSTANCE ); // // register( FQFisNull.RehydrateFactory.INSTANCE ); // // register( FQFcontains.RehydrateFactory.INSTANCE ); // register( FQFendsWith.RehydrateFactory.INSTANCE ); // register( FQFstartsWith.RehydrateFactory.INSTANCE ); // // register( FQFlike.RehydrateFactory.INSTANCE ); // // register( FQFfalse.RehydrateFactory.INSTANCE ); // register( FQFtrue.RehydrateFactory.INSTANCE ); // // register( FQFnot.RehydrateFactory.INSTANCE ); // } // } } |