Project

General

Profile

« Previous | Next » 

Revision 2663

Added by sgarg over 18 years ago

Replacing MetaCatUtil.debugMessage or MetaCatUtil.logMetacat call with logMetacat (private Logger object) call

View differences:

QuerySpecification.java
40 40

  
41 41
import edu.ucsb.nceas.dbadapter.AbstractDatabase;
42 42

  
43
import org.apache.log4j.Logger;
43 44
import org.xml.sax.Attributes;
44 45
import org.xml.sax.InputSource;
45 46
import org.xml.sax.SAXException;
......
115 116

  
116 117
    private StringBuffer textBuffer = new StringBuffer();
117 118

  
119
    private static Logger logMetacat = Logger.getLogger(QuerySpecification.class);
120

  
118 121
    /**
119 122
     * construct an instance of the QuerySpecification class
120 123
     *
......
235 238
            ownerQuery = ownerQuery + "lower(user_owner) ='" + userName + "'";
236 239
        }
237 240

  
238
        MetaCatUtil.debugMessage("OwnerQuery: " + ownerQuery, 30);
241
        logMetacat.info("OwnerQuery: " + ownerQuery);
239 242
        return ownerQuery;
240 243
    }
241 244

  
......
249 252
        String allowString = constructAllowString();
250 253
        allowQuery = "SELECT docid from xml_access WHERE( " + allowString;
251 254
        allowQuery = allowQuery + ") AND subtreeid IS NULL";
252
        MetaCatUtil.debugMessage("allow query is: " + allowQuery, 30);
255
        logMetacat.info("allow query is: " + allowQuery);
253 256
        return allowQuery;
254 257

  
255 258
    }
......
281 284
                }//if
282 285
            }//for
283 286
        }//if
284
        MetaCatUtil.debugMessage("allow string is: " + allowQuery, 40);
287
        logMetacat.info("allow string is: " + allowQuery);
285 288
        return allowQuery;
286 289
    }
287 290

  
......
296 299
        String denyString = constructDenyString();
297 300
        denyQuery = "SELECT docid from xml_access WHERE( " + denyString;
298 301
        denyQuery = denyQuery + ") AND subtreeid IS NULL ";
299
        MetaCatUtil.debugMessage("denyquery is: " + denyQuery, 30);
302
        logMetacat.info("denyquery is: " + denyQuery);
300 303
        return denyQuery;
301 304

  
302 305
    }
......
349 352
        accessQuery = " AND (docid IN(" + onwer + ")";
350 353
        accessQuery = accessQuery + " OR (docid IN (" + allow + ")"
351 354
                + " AND docid NOT IN (" + deny + ")))";
352
        MetaCatUtil.debugMessage("accessquery is: " + accessQuery, 30);
355
        logMetacat.warn("accessquery is: " + accessQuery);
353 356
        return accessQuery;
354 357
    }
355 358

  
......
632 635
        // make sure if return fields has an attribute or not
633 636
        if (inputString.indexOf(ATTRIBUTESYMBOL) == -1) {
634 637
            // no attribute value will be returned
635
            MetaCatUtil.debugMessage("QuerySpecification.handleReturnField(): " , 35);
636
            MetaCatUtil.debugMessage("  there are no attributes in the XPATH statement" , 35);
638
            logMetacat.info("QuerySpecification.handleReturnField(): " );
639
            logMetacat.info("  there are no attributes in the XPATH statement" );
637 640
            returnFieldList.add(inputString);
638 641
            containsExtendedSQL = true;
639 642
        } else {
......
641 644
          if ( inputString.startsWith(ATTRIBUTESYMBOL) ) {
642 645

  
643 646
            // case where the return field is solely an attribute
644
            MetaCatUtil.debugMessage("QuerySpecification.handleReturnField(): " , 35);
645
            MetaCatUtil.debugMessage("  there are *only* attributes in the XPATH statement" , 35);
647
            logMetacat.info("QuerySpecification.handleReturnField(): " );
648
            logMetacat.info("  there are *only* attributes in the XPATH statement" );
646 649
            String returnPath = newPathExpressionWithOutAttribute(inputString);
647 650
            String attributeName = getAttributeName(inputString);
648 651
            Vector pathInfo = new Vector();
......
662 665
            // has a attribute return field
663 666
            // divied the return filed into two parts, one is path and the
664 667
            // other is attribue name
665
            MetaCatUtil.debugMessage("QuerySpecification.handleReturnField: " , 35);
666
            MetaCatUtil.debugMessage("  there are both attributes and elements" , 35);
667
            MetaCatUtil.debugMessage("  in the XPATH statement" , 35);
668
            logMetacat.info("QuerySpecification.handleReturnField: " );
669
            logMetacat.info("  there are both attributes and elements" );
670
            logMetacat.info("  in the XPATH statement" );
668 671
            String returnPath = newPathExpressionWithOutAttribute(inputString);
669 672
            String attributeName = getAttributeName(inputString);
670 673
            Vector pathInfo = new Vector();
......
768 771
        // if there is only one percentage search item, this query is a
769 772
        // percentage
770 773
        // search query
771
        MetaCatUtil.debugMessage("percentage number: "
772
                + query.getPercentageSymbolCount(), 35);
774
        logMetacat.info("percentage number: "
775
                + query.getPercentageSymbolCount());
773 776
        if (query.getPercentageSymbolCount() == 1) {
774
            MetaCatUtil.debugMessage("it is a percentage search", 30);
777
            logMetacat.info("It is a percentage search");
775 778
            percentageSearch = true;
776 779
        }
777 780

  
......
815 818
        sql.append(")");
816 819
        sql.append(")");
817 820
        sql.append(")");
818
        MetaCatUtil.debugMessage("accessControlSQLForReturnField: "
819
                + sql.toString(), 30);
821
        logMetacat.info("accessControlSQLForReturnField: "
822
                + sql.toString());
820 823
        return sql.toString();
821 824
    }
822 825

  
......
883 886
    public String printExtendedSQL(String doclist,
884 887
            Hashtable unaccessableNodePair)
885 888
    {
886
        MetaCatUtil.debugMessage("querySpecification.printExtendedSQL called\n", 35);
889
        logMetacat.info("querySpecification.printExtendedSQL called\n");
887 890
        StringBuffer self = new StringBuffer();
888 891

  
889 892
        boolean usePathIndex = true;
......
1080 1083
                self.append(" AND xml_nodes.rootnodeid = xml_documents.rootnodeid");
1081 1084
            }
1082 1085

  
1083
            MetaCatUtil.debugMessage("Attribute query: " + self.toString(), 30);
1086
            logMetacat.warn("Attribute query: " + self.toString());
1084 1087

  
1085 1088
            return self.toString();
1086 1089
        }
......
1117 1120
                    self.append(returnPath);
1118 1121
                    self.append("' AND ");
1119 1122
                }else {
1120
                  MetaCatUtil.debugMessage("QuerySpecification.printAttributeQuery: "
1121
                   + "returnPath is: " + returnPath, 30);
1123
                  logMetacat.info("QuerySpecification.printAttributeQuery: "
1124
                   + "returnPath is: " + returnPath);
1122 1125
                }
1123 1126
                self.append("xml_nodes.nodename like '");
1124 1127
                self.append(attributeName);
......
1130 1133
                    self.append(returnPath);
1131 1134
                    self.append("' AND ");
1132 1135
                }else {
1133
                  MetaCatUtil.debugMessage("QuerySpecification.printAttributeQuery: "
1134
                   + "returnPath is null: " + returnPath, 30);
1136
                  logMetacat.info("QuerySpecification.printAttributeQuery: "
1137
                   + "returnPath is null: " + returnPath);
1135 1138
                }
1136 1139
                self.append("xml_nodes.nodename like '");
1137 1140
                self.append(attributeName);
......
1141 1144
        self.append(") AND xml_nodes.docid in (");
1142 1145
        self.append(doclist);
1143 1146
        self.append(") AND xml_nodes.nodetype = 'ATTRIBUTE'");
1144
        MetaCatUtil.debugMessage("Attribute query: " + self.toString(), 30);
1147
        logMetacat.warn("Attribute query: " + self.toString());
1145 1148

  
1146 1149
        return self.toString();
1147 1150
    }
......
1187 1190
        if (index != 0) {
1188 1191
            newExpression = pathExpression.substring(0, index - 1);
1189 1192
        }
1190
        MetaCatUtil.debugMessage("The path expression without attributes: "
1191
                + newExpression, 30);
1193
        logMetacat.info("The path expression without attributes: "
1194
                + newExpression);
1192 1195
        return newExpression;
1193 1196
    }
1194 1197

  
......
1202 1205
        if (index != 1) {
1203 1206
            attributeName = path.substring(index + 1, size);
1204 1207
        }
1205
        MetaCatUtil.debugMessage("The attirbute name from path: "
1206
                + attributeName, 30);
1208
        logMetacat.info("The attirbute name from path: "
1209
                + attributeName);
1207 1210
        return attributeName;
1208 1211
    }
1209 1212

  

Also available in: Unified diff