|
From: David F. <dwf...@us...> - 2006-09-29 21:08:02
|
Update of /cvsroot/openmed/OpenEMed/src/servers/persistent/gov/lanl/COAS In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv27987/src/servers/persistent/gov/lanl/COAS Modified Files: QueryAccessImpl.java Log Message: Added wildcard support for SubjectId Index: QueryAccessImpl.java =================================================================== RCS file: /cvsroot/openmed/OpenEMed/src/servers/persistent/gov/lanl/COAS/QueryAccessImpl.java,v retrieving revision 1.36 retrieving revision 1.37 diff -C2 -d -r1.36 -r1.37 *** QueryAccessImpl.java 28 Mar 2006 00:47:13 -0000 1.36 --- QueryAccessImpl.java 29 Sep 2006 21:07:58 -0000 1.37 *************** *** 149,154 **** } - - // // Methods --- 149,152 ---- *************** *** 164,176 **** * @param policy * @return int ! * @exception InvalidIds ! * @exception DuplicateIds ! * @exception InvalidCodes ! * @exception DuplicateCodes ! * @exception InvalidTimeSpan ! * @exception InvalidQualifiers ! * @exception DuplicateQualifiers ! * @exception InvalidPolicies ! * @exception DuplicatePolicies */ public int count_observations(QualifiedPersonId[] who, String[] what, TimeSpan when, --- 162,174 ---- * @param policy * @return int ! * @throws InvalidIds ! * @throws DuplicateIds ! * @throws InvalidCodes ! * @throws DuplicateCodes ! * @throws InvalidTimeSpan ! * @throws InvalidQualifiers ! * @throws DuplicateQualifiers ! * @throws InvalidPolicies ! * @throws DuplicatePolicies */ public int count_observations(QualifiedPersonId[] who, String[] what, TimeSpan when, *************** *** 198,202 **** * @param observation_id * @return Any ! * @exception org.omg.DsObservationAccess.InvalidOids */ public Any get_observation(org.omg.DsObservationAccess.ObservationId observation_id) --- 196,201 ---- * @param observation_id * @return Any ! * @throws org.omg.DsObservationAccess.InvalidOids ! * */ public Any get_observation(org.omg.DsObservationAccess.ObservationId observation_id) *************** *** 269,274 **** * @param observation_ids * @return Any ! * @exception org.omg.DsObservationAccess.InvalidOids ! * @exception org.omg.DsObservationAccess.DuplicateOids */ public Any[] get_observations(org.omg.DsObservationAccess.ObservationId[] observation_ids) --- 268,275 ---- * @param observation_ids * @return Any ! * @throws org.omg.DsObservationAccess.InvalidOids ! * ! * @throws org.omg.DsObservationAccess.DuplicateOids ! * */ public Any[] get_observations(org.omg.DsObservationAccess.ObservationId[] observation_ids) *************** *** 291,295 **** * engine, in accordance with default policies. * In essence, the 'who', 'what', and 'when' filter the database of observations. ! * * Time spans with end times greater than the server's current time are interpreted to * mean 'through now, so indicate the concept 'from a given time through now with a --- 292,296 ---- * engine, in accordance with default policies. * In essence, the 'who', 'what', and 'when' filter the database of observations. ! * <p/> * Time spans with end times greater than the server's current time are interpreted to * mean 'through now, so indicate the concept 'from a given time through now with a *************** *** 318,327 **** * A typical client will choose a large number for max_sequence if the size of the data * items is small. ! * ! * * Non-standard extensions: * ======================== * The query mechanism has been extended to allow wildcard searches on the who, what and when parameters. ! * * The who-parameter allows wildcards in its String instance memebers. * 1.case: --- 319,328 ---- * A typical client will choose a large number for max_sequence if the size of the data * items is small. ! * <p/> ! * <p/> * Non-standard extensions: * ======================== * The query mechanism has been extended to allow wildcard searches on the who, what and when parameters. ! * <p/> * The who-parameter allows wildcards in its String instance memebers. * 1.case: *************** *** 331,344 **** * QualifiedPersonId == "" AND QualifiedPersonId.domain.naming_entity == "" * retrieves all subjectIds in all domains, the RegistrationAuthority (DNS, ISO, IDL, DCE, OTHER) is ignored ! * * For the what-parameter an empty string array (new String[0]) is defined as a wildcard. Also * if the what parameter ends in "/", it adds a wildcard to the end. It is also influenced * by the policy that provides only top level codes versus all codes. ! * * The when parameter allows wildcards in its String instance memebers. * An empty string in the the when.start and/or when.stop variables are interpreted as open * lower and/or upper boundaries in the time interval. * - * * @param who * @param what --- 332,344 ---- * QualifiedPersonId == "" AND QualifiedPersonId.domain.naming_entity == "" * retrieves all subjectIds in all domains, the RegistrationAuthority (DNS, ISO, IDL, DCE, OTHER) is ignored ! * <p/> * For the what-parameter an empty string array (new String[0]) is defined as a wildcard. Also * if the what parameter ends in "/", it adds a wildcard to the end. It is also influenced * by the policy that provides only top level codes versus all codes. ! * <p/> * The when parameter allows wildcards in its String instance memebers. * An empty string in the the when.start and/or when.stop variables are interpreted as open * lower and/or upper boundaries in the time interval. * * @param who * @param what *************** *** 347,354 **** * @param the_rest * @return Any ! * @exception org.omg.DsObservationAccess.InvalidIds ! * @exception org.omg.DsObservationAccess.InvalidCodes ! * @exception org.omg.DsObservationAccess.DuplicateCodes ! * @exception org.omg.DsObservationAccess.InvalidTimeSpan */ public synchronized Any[] get_observations_by_time(QualifiedPersonId who, --- 347,358 ---- * @param the_rest * @return Any ! * @throws org.omg.DsObservationAccess.InvalidIds ! * ! * @throws org.omg.DsObservationAccess.InvalidCodes ! * ! * @throws org.omg.DsObservationAccess.DuplicateCodes ! * ! * @throws org.omg.DsObservationAccess.InvalidTimeSpan ! * */ public synchronized Any[] get_observations_by_time(QualifiedPersonId who, *************** *** 361,365 **** org.omg.PersonIdService.QualifiedPersonId[] whoSeq = new org.omg.PersonIdService.QualifiedPersonId[]{ ! who }; --- 365,369 ---- org.omg.PersonIdService.QualifiedPersonId[] whoSeq = new org.omg.PersonIdService.QualifiedPersonId[]{ ! who }; *************** *** 381,391 **** * @param the_rest * @return Any ! * @exception org.omg.DsObservationAccess.InvalidIds ! * @exception org.omg.DsObservationAccess.DuplicateIds ! * @exception org.omg.DsObservationAccess.InvalidCodes ! * @exception org.omg.DsObservationAccess.DuplicateCodes ! * @exception org.omg.DsObservationAccess.InvalidTimeSpan ! * @exception org.omg.DsObservationAccess.InvalidQualifiers ! * @exception org.omg.DsObservationAccess.DuplicateQualifiers */ public Any[] get_observations_by_qualifier(QualifiedPersonId[] who, String[] what, --- 385,402 ---- * @param the_rest * @return Any ! * @throws org.omg.DsObservationAccess.InvalidIds ! * ! * @throws org.omg.DsObservationAccess.DuplicateIds ! * ! * @throws org.omg.DsObservationAccess.InvalidCodes ! * ! * @throws org.omg.DsObservationAccess.DuplicateCodes ! * ! * @throws org.omg.DsObservationAccess.InvalidTimeSpan ! * ! * @throws org.omg.DsObservationAccess.InvalidQualifiers ! * ! * @throws org.omg.DsObservationAccess.DuplicateQualifiers ! * */ public Any[] get_observations_by_qualifier(QualifiedPersonId[] who, String[] what, *************** *** 416,428 **** * @param the_rest * @return Any ! * @exception org.omg.DsObservationAccess.InvalidIds ! * @exception org.omg.DsObservationAccess.DuplicateIds ! * @exception org.omg.DsObservationAccess.InvalidCodes ! * @exception org.omg.DsObservationAccess.DuplicateCodes ! * @exception org.omg.DsObservationAccess.InvalidTimeSpan ! * @exception org.omg.DsObservationAccess.InvalidQualifiers ! * @exception org.omg.DsObservationAccess.DuplicateQualifiers ! * @exception org.omg.DsObservationAccess.InvalidPolicies ! * @exception org.omg.DsObservationAccess.DuplicatePolicies */ public Any[] get_observations_with_policy(QualifiedPersonId[] who, String[] what, --- 427,448 ---- * @param the_rest * @return Any ! * @throws org.omg.DsObservationAccess.InvalidIds ! * ! * @throws org.omg.DsObservationAccess.DuplicateIds ! * ! * @throws org.omg.DsObservationAccess.InvalidCodes ! * ! * @throws org.omg.DsObservationAccess.DuplicateCodes ! * ! * @throws org.omg.DsObservationAccess.InvalidTimeSpan ! * ! * @throws org.omg.DsObservationAccess.InvalidQualifiers ! * ! * @throws org.omg.DsObservationAccess.DuplicateQualifiers ! * ! * @throws org.omg.DsObservationAccess.InvalidPolicies ! * ! * @throws org.omg.DsObservationAccess.DuplicatePolicies ! * */ public Any[] get_observations_with_policy(QualifiedPersonId[] who, String[] what, *************** *** 464,469 **** checkSecurity("+READ+"); ! String[] codes = get_supported_codes(0); ! // codeMapper.getCodeList(policyMgr.getPolicy(supportedCodesReturnAll)); String[] retCodes = codes; int elementCount = codes.length; --- 484,489 ---- checkSecurity("+READ+"); ! String[] codes = get_supported_codes(0); ! // codeMapper.getCodeList(policyMgr.getPolicy(supportedCodesReturnAll)); String[] retCodes = codes; int elementCount = codes.length; *************** *** 492,513 **** return retCodes; } ! /** ! * Non corba call to get_supported_codes ! * @param max_sequence ! */ public String[] get_supported_codes(int max_sequence) { String[] codes = codeMapper.getCodeList(policyMgr.getPolicy(supportedCodesReturnAll)); String[] retCodes = codes; int elementCount = codes.length; ! if (max_sequence == 0) return retCodes; ! if (elementCount > max_sequence) { ! retCodes = new String[max_sequence]; System.arraycopy(codes, 0, retCodes, 0, max_sequence); ! } ! return retCodes; ! } /** * Supplies the ObservationType (CORBA::TCKind and CORBA::RepositoryId) of the --- 512,536 ---- return retCodes; } ! ! /** ! * Non corba call to get_supported_codes ! * ! * @param max_sequence ! */ public String[] get_supported_codes(int max_sequence) { String[] codes = codeMapper.getCodeList(policyMgr.getPolicy(supportedCodesReturnAll)); String[] retCodes = codes; int elementCount = codes.length; ! if (max_sequence == 0) return retCodes; ! if (elementCount > max_sequence) { ! retCodes = new String[max_sequence]; System.arraycopy(codes, 0, retCodes, 0, max_sequence); ! } ! return retCodes; ! } + /** * Supplies the ObservationType (CORBA::TCKind and CORBA::RepositoryId) of the *************** *** 525,530 **** * @param observation_type * @return org.omg.CORBA.TypeCode ! * @exception org.omg.DsObservationAccess.InvalidCodes ! * @exception org.omg.DsObservationAccess.NotImplemented */ public org.omg.CORBA.TypeCode get_type_code_for_observation_type(String observation_type) --- 548,555 ---- * @param observation_type * @return org.omg.CORBA.TypeCode ! * @throws org.omg.DsObservationAccess.InvalidCodes ! * ! * @throws org.omg.DsObservationAccess.NotImplemented ! * */ public org.omg.CORBA.TypeCode get_type_code_for_observation_type(String observation_type) *************** *** 557,569 **** * @param qualifier * @return String[] ! * @exception org.omg.DsObservationAccess.InvalidCodes ! * @exception org.omg.DsObservationAccess.NotImplemented */ public String[] get_supported_qualifiers(String qualifier) throws InvalidCodes, org.omg.DsObservationAccess.NotImplemented { ! cat.debug("get_supported_qualifiers called with "+qualifier); java.util.regex.Pattern p = java.util.regex.Pattern.compile(qualifier); - // Security check checkSecurity("+READ+"); --- 582,595 ---- * @param qualifier * @return String[] ! * @throws org.omg.DsObservationAccess.InvalidCodes ! * ! * @throws org.omg.DsObservationAccess.NotImplemented ! * */ public String[] get_supported_qualifiers(String qualifier) throws InvalidCodes, org.omg.DsObservationAccess.NotImplemented { ! cat.debug("get_supported_qualifiers called with " + qualifier); java.util.regex.Pattern p = java.util.regex.Pattern.compile(qualifier); // Security check checkSecurity("+READ+"); *************** *** 577,587 **** for (int i = 0; i < codes.length; i++) { ! if (codes[i] != null) { if (qualifier != null && !qualifier.equals("")) { m = p.matcher(codes[i]); if (m.find()) retCodes.add(codes[i]); ! } else ! if (!(codes[i] == null)) retCodes.add(codes[i]); } } --- 603,612 ---- for (int i = 0; i < codes.length; i++) { ! if (codes[i] != null) { if (qualifier != null && !qualifier.equals("")) { m = p.matcher(codes[i]); if (m.find()) retCodes.add(codes[i]); ! } else if (!(codes[i] == null)) retCodes.add(codes[i]); } } *************** *** 603,606 **** --- 628,632 ---- * A complete list of policies which this server can employ when filtering on desired * observations. The returned list is of codes only. + * * @return String[] */ *************** *** 615,618 **** --- 641,645 ---- * The returned list is a list of name-value pairs, both the name of the policy and its * default value. + * * @return NameValuePair[] */ *************** *** 624,627 **** --- 651,655 ---- * Version of COAS specification supported by this DsObservationAccess server, starting * with '1.0' for the first approved specification. + * * @return String */ *************** *** 711,717 **** * check the security * - * * @param type - * * @see */ --- 739,743 ---- *************** *** 737,741 **** * get observations based on the specified policy * - * * @param who * @param what --- 763,766 ---- *************** *** 746,752 **** * @param the_rest * @param count - * * @return Any[] - * * @see */ --- 771,775 ---- *************** *** 790,795 **** currentPolicies = policyMgr.getDefaultPolicies(); - - // update the policies for (int i = 0; i < policy.length; i++) { --- 813,816 ---- *************** *** 834,838 **** if (removeDuplicates) obsDataVector = removeDuplicates(obsDataVector); ! if (qualifiers != null && qualifiers.length > 0) obsDataVector = filterOnQualifiers(obsQualifiers, obsDataVector); if (count) { --- 855,860 ---- if (removeDuplicates) obsDataVector = removeDuplicates(obsDataVector); ! if (qualifiers != null && qualifiers.length > 0) ! obsDataVector = filterOnQualifiers(obsQualifiers, obsDataVector); if (count) { *************** *** 864,873 **** * * @param who is the QualifiedPersonId to be matched ! * @param what an array of codes to be matched ! * @param when TimeSpan to be matched ! * @return SearchFilter * @throws InvalidTimeSpan * @throws gov.lanl.Database.DBException - * * @see */ --- 886,894 ---- * * @param who is the QualifiedPersonId to be matched ! * @param what an array of codes to be matched ! * @param when TimeSpan to be matched ! * @return SearchFilter * @throws InvalidTimeSpan * @throws gov.lanl.Database.DBException * @see */ *************** *** 889,894 **** // get stringified version of the qualified person id String subjectIdStr = gov.lanl.Utility.TransLib.qualified_person_to_str(who); ! ! whoFilter.compareFilter("subjectId", subjectIdStr, SearchFilter.EQUAL); } else if (who.domain.naming_entity.length() > 0) { whoFilter = DBMgrFactory.createFilter(); --- 910,918 ---- // get stringified version of the qualified person id String subjectIdStr = gov.lanl.Utility.TransLib.qualified_person_to_str(who); ! if (subjectIdStr.contains("?")) { ! String subjIdStr = subjectIdStr.replace("?", wildcard); ! whoFilter.compareFilter("subjectId", subjIdStr, SearchFilter.LIKE); ! } else ! whoFilter.compareFilter("subjectId", subjectIdStr, SearchFilter.EQUAL); } else if (who.domain.naming_entity.length() > 0) { whoFilter = DBMgrFactory.createFilter(); *************** *** 897,901 **** try { String domain = transLib.authority_to_str(who.domain); ! domain += wildcard; --- 921,927 ---- try { String domain = transLib.authority_to_str(who.domain); ! if (domain.contains("?")) { ! domain = domain.replace("?",wildcard); ! } domain += wildcard; *************** *** 1041,1045 **** * Actually retrieve the requested observations from the database * - * * @param who * @param what --- 1067,1070 ---- *************** *** 1048,1059 **** * @param currentPolicies * @param deep - * * @return Vector - * * @throws DuplicateCodes * @throws InvalidCodes * @throws InvalidIds * @throws InvalidTimeSpan - * * @see */ --- 1073,1081 ---- *************** *** 1113,1123 **** * Prepare the Output Vector and convert to Any[] * - * * @param inList * @param the_rest * @param max_sequence - * * @return Any[] - * * @see */ --- 1135,1142 ---- *************** *** 1200,1203 **** --- 1219,1223 ---- * filter based on the qualifiers * Oly include elements that contain all the qualifiers + * * @param qualifiers * @param observations *************** *** 1227,1230 **** --- 1247,1251 ---- * the data set, keeping only the most recent (as determined by * DATE_RECORDED) + * * @param observations * @return ArrayList *************** *** 1271,1275 **** } - /*--- formatting done in "OpenEMed Convention" style on 10-18-2001 ---*/ --- 1292,1295 ---- |