tim@845: package de.intevation.gnv.state.cache;
tim@845: /**
tim@1036:  * This Class is a Container which carries the
tim@1036:  * databasequery which belongs to an state.
tim@1036:  * It is also possible to look up if the query contains a specific
tim@1036:  * TableName.
tim@845:  * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a>
tim@845:  *
tim@845:  */
tim@845: public class QueryObject {
tim@845: 
tim@845:     /**
tim@845:      * The Id of the State the Query belongs to
tim@845:      */
tim@845:     private String stateId = null;
tim@845: 
tim@845:     /**
tim@845:      * The Query which belongs to the State
tim@845:      */
tim@845:     private String query = null;
tim@845: 
tim@845:     /**
tim@845:      * Constructor
tim@845:      * @param stateId the Id of the State the Query belongs to
tim@845:      * @param query the Query which belongs to the State
tim@845:      */
tim@845:     public QueryObject(String stateId, String query) {
tim@845:         this.stateId = stateId;
tim@845:         this.query = query.toUpperCase();
tim@845:     }
tim@845: 
tim@845:     /**
tim@845:      * Returns the StateId
tim@845:      * @return the Stateid
tim@845:      */
tim@845:     public String getStateId() {
tim@845:         return stateId;
tim@845:     }
tim@845: 
tim@845:     /**
tim@845:      * Returns the Querystring
tim@845:      * @return the QueryString
tim@845:      */
tim@845:     public String getQuery() {
tim@845:         return query;
tim@845:     }
tim@845: 
tim@845:     /**
tim@845:      * Returns true if the given Name of the Table is Contained in the Query
tim@845:      * @param tableName the Name of the Table
tim@845:      * @return true if the Name of the Table is contained in the Query
tim@845:      */
tim@845:     public boolean queryContainsTableName(String tableName){
tim@845:         return this.query.contains(tableName);
tim@845:     }
tim@845: }