From: <jes...@us...> - 2009-06-24 14:28:15
|
Revision: 4438 http://geonetwork.svn.sourceforge.net/geonetwork/?rev=4438&view=rev Author: jesseeichar Date: 2009-06-24 14:28:12 +0000 (Wed, 24 Jun 2009) Log Message: ----------- fixes for reusable object matching Modified Paths: -------------- sandbox/geocat.ch/trunk/src/org/fao/geonet/services/reusable/ContactsStrategy.java sandbox/geocat.ch/trunk/src/org/fao/geonet/services/reusable/FormatsStrategy.java Modified: sandbox/geocat.ch/trunk/src/org/fao/geonet/services/reusable/ContactsStrategy.java =================================================================== --- sandbox/geocat.ch/trunk/src/org/fao/geonet/services/reusable/ContactsStrategy.java 2009-06-24 11:14:49 UTC (rev 4437) +++ sandbox/geocat.ch/trunk/src/org/fao/geonet/services/reusable/ContactsStrategy.java 2009-06-24 14:28:12 UTC (rev 4438) @@ -80,27 +80,26 @@ String key = email+firstname+lastname; - if (key.length() > 0) { - Element roleElem = Utils.nextElement(originalElem.getDescendants(new ElementFinder("CI_RoleCode", ReusableObjManager.GMD_NAMESPACE, "role"))); - String query = "select id,validated,organisation from Users where COALESCE(TRIM(email),'')||COALESCE(TRIM(name),'')||COALESCE(TRIM(surname),'') ILIKE ? AND profile=?"; - List<Element> records = _dbms.select(query,key,SHARED).getChildren(); + Element roleElem = Utils.nextElement(originalElem.getDescendants(new ElementFinder("CI_RoleCode", ReusableObjManager.GMD_NAMESPACE, "role"))); + String query = "select id,validated,organisation from Users where COALESCE(TRIM(email),'')||COALESCE(TRIM(name),'')||COALESCE(TRIM(surname),'') ILIKE ? AND profile=?"; + List<Element> records = _dbms.select(query,key,SHARED).getChildren(); - for (Element record : records) { - String role = roleElem.getAttributeValue("codeListValue"); - Element recordOrg = LangUtils.loadInternalMultiLingualElem(record.getChildTextTrim("organisation")); + for (Element record : records) { + String role = roleElem.getAttributeValue("codeListValue"); + Element recordOrg = LangUtils.loadInternalMultiLingualElem(record.getChildTextTrim("organisation")); - String elemOrg = lookupElement(originalElem, "organisationName", defaultMetadataLang); + String elemOrg = lookupElement(originalElem, "organisationName", defaultMetadataLang); - if (translation(recordOrg, defaultMetadataLang).equalsIgnoreCase(elemOrg)) { - String id = record.getChildTextTrim("id"); - String validatedString = record.getChildTextTrim("validated"); - boolean validated = !("n".equalsIgnoreCase(validatedString)); - Collection<Element> xlinkIt = xlinkIt(originalElem, role, id, validated); - Log.debug("Reusable Objects", Xml.getString(record)); - return Pair.read(xlinkIt, true); - } + if (translation(recordOrg, defaultMetadataLang).equalsIgnoreCase(elemOrg)) { + String id = record.getChildTextTrim("id"); + String validatedString = record.getChildTextTrim("validated"); + boolean validated = !("n".equalsIgnoreCase(validatedString)); + Collection<Element> xlinkIt = xlinkIt(originalElem, role, id, validated); + Log.debug("Reusable Objects", Xml.getString(record)); + return Pair.read(xlinkIt, true); } } + return NULL; } Modified: sandbox/geocat.ch/trunk/src/org/fao/geonet/services/reusable/FormatsStrategy.java =================================================================== --- sandbox/geocat.ch/trunk/src/org/fao/geonet/services/reusable/FormatsStrategy.java 2009-06-24 11:14:49 UTC (rev 4437) +++ sandbox/geocat.ch/trunk/src/org/fao/geonet/services/reusable/FormatsStrategy.java 2009-06-24 14:28:12 UTC (rev 4438) @@ -68,11 +68,11 @@ Element name = name(originalElem); if (name != null && name.getChild("CharacterString", ReusableObjManager.GCO_NAMESPACE)!=null) { - String query = "SELECT id,validated FROM Formats WHERE UPPER(TRIM(name))='" - + name.getChildTextTrim("CharacterString", ReusableObjManager.GCO_NAMESPACE).toUpperCase() + "'"; + String query = "SELECT id,validated FROM Formats WHERE TRIM(name) LIKE '" + + name.getChildTextTrim("CharacterString", ReusableObjManager.GCO_NAMESPACE) + "'"; Element version = version(originalElem); if (version != null && version.getChild("CharacterString", ReusableObjManager.GCO_NAMESPACE)!=null) { - query += " AND UPPER(TRIM(version))='" + version.getChildTextTrim("CharacterString", ReusableObjManager.GCO_NAMESPACE).toUpperCase() + "'"; + query += " AND TRIM(version) LIKE '" + version.getChildTextTrim("CharacterString", ReusableObjManager.GCO_NAMESPACE) + "'"; } Element el = _dbms.select(query); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |