Revision 10239
Added by Jing Tao over 7 years ago
src/edu/ucsb/nceas/metacat/IdentifierManager.java | ||
---|---|---|
39 | 39 |
|
40 | 40 |
import org.apache.log4j.Logger; |
41 | 41 |
import org.dataone.client.v2.formats.ObjectFormatCache; |
42 |
import org.dataone.configuration.Settings; |
|
42 | 43 |
import org.dataone.service.exceptions.BaseException; |
43 | 44 |
import org.dataone.service.exceptions.InvalidSystemMetadata; |
44 | 45 |
import org.dataone.service.types.v1.AccessPolicy; |
... | ... | |
85 | 86 |
|
86 | 87 |
public static final String TYPE_SYSTEM_METADATA = "systemmetadata"; |
87 | 88 |
public static final String TYPE_IDENTIFIER = "identifier"; |
89 |
|
|
90 |
private static boolean filterWhiteSpaces = Settings.getConfiguration().getBoolean("dataone.listingidentifier.filteringwhitespaces", true); |
|
88 | 91 |
|
89 | 92 |
/** |
90 | 93 |
* The single instance of the manager that is always returned. |
... | ... | |
1868 | 1871 |
boolean f2 = false; |
1869 | 1872 |
boolean f3 = false; |
1870 | 1873 |
boolean f4 = false; |
1874 |
boolean f5 = false; |
|
1871 | 1875 |
|
1872 | 1876 |
|
1873 | 1877 |
if (startTime != null) { |
... | ... | |
1930 | 1934 |
whereClauseSql += " and authoritive_member_node = '" + |
1931 | 1935 |
nodeId.getValue().trim() + "'"; |
1932 | 1936 |
} |
1937 |
f5 = true; |
|
1933 | 1938 |
} |
1939 |
|
|
1940 |
//add a filter to remove pids whith white spaces |
|
1941 |
if(filterWhiteSpaces) { |
|
1942 |
logMetacat.debug("IdnetifierManager.querySystemMetadata - the default value of the property \"dataone.listingidentifier.filteringwhitespaces\" is true, so we will filter the white spaces in the query"); |
|
1943 |
if(!f1 && !f2 && !f3 && !f4 && !f5) { |
|
1944 |
whereClauseSql += " where guid not like '% %' "; |
|
1945 |
} else { |
|
1946 |
whereClauseSql += " and guid not like '% %' "; |
|
1947 |
} |
|
1948 |
} else { |
|
1949 |
logMetacat.debug("IdnetifierManager.querySystemMetadata - the property \"dataone.listingidentifier.filteringwhitespaces\" is configured to be false, so we don't filter the white spaces in the query."); |
|
1950 |
} |
|
1934 | 1951 |
|
1935 | 1952 |
|
1936 | 1953 |
// connection |
... | ... | |
2045 | 2062 |
//do nothing |
2046 | 2063 |
} |
2047 | 2064 |
|
2048 |
logMetacat.debug("list objects fieldStmt: " + fieldStmt.toString());
|
|
2065 |
logMetacat.info("list objects fieldStmt: " + fieldStmt.toString());
|
|
2049 | 2066 |
|
2050 |
logMetacat.debug("list objects countStmt: " + countStmt.toString());
|
|
2067 |
logMetacat.info("list objects countStmt: " + countStmt.toString());
|
|
2051 | 2068 |
|
2052 | 2069 |
// get the total object count no matter what |
2053 | 2070 |
int total = 0; |
Also available in: Unified diff
Add the code to filter out the pids with white spaces in the query.