Sweet :)

  _____  

From: Action Request System discussion list(ARSList)
[mailto:[email protected]] On Behalf Of Roys, Eric D
Sent: Monday, November 30, 2009 3:30 PM
To: [email protected]
Subject: Re: Java API - parseQualification Error - Part 2


** 
Defect SW00351474  :-)


  _____  

From: Action Request System discussion list(ARSList)
[mailto:[email protected]] On Behalf Of LJ Longwing
Sent: Thursday, November 12, 2009 5:59 PM
To: [email protected]
Subject: Re: Java API - parseQualification Error - Part 2


** 
I would personally push them to admit and log a defect.  Point being that if
they say you can use an ARServerUser object as such
 
parseQualification(String form, String qualification) 
          Parses a given readable qualification string into internal
structure.
 
And they are going to put a qualification on that of "oh, unless your
qualification string is referencing an integer value that's negative",
that's completely bogus.  They need to make sure that their function is
functioning properly, the fact that it works if you use an overloaded
version of the function is irrelevant.  They have a bug in that function.
You can use the overloaded version as a workaround if you need to while they
fix the bug, but they need to fix it.  I have an open defect with BMC
regarding the 
 
getListFilterObjects() 
          return the detail of all (accessible) Filter objects
 
Function, throws a null pointer error on my server.  I have the workaround
of using getListFilter() and looping through that list to get EVERY filter
object, but it's not as efficient....just because there is a workaround
doesn't mean there isn't a bug.

  _____  

From: Action Request System discussion list(ARSList)
[mailto:[email protected]] On Behalf Of Roys, Eric D
Sent: Thursday, November 12, 2009 4:38 PM
To: [email protected]
Subject: Re: Java API - parseQualification Error - Part 2


** 
LJ, 
 
Field ID or Name is irrelevant. What is suggested is instead of writing: 
QualifierInfo qual = ctl.parseQualification("Roles", "'Role ID' = -900000");
//works in 7.1 just fine also works just fine for qual not having negative
sign
 
the work-around is to add the following: 
List <Field> fields = ctl.getListFieldObjects(formName);  // not required
for non-negatives apparently
 
then change qualifier inputs to use the 'fields' reference: 
QualifierInfo qual = ctl.parseQualification(qualStr, fields, null,
Constants.AR_QUALCONTEXT_DEFAULT);
 
So tell me... defect or no defect? I was told no defect by support,
therefore no ETA on a fix. I suppose that's fine if you don't have a
"negative" outlook on things ;-)
Maybe that's a polite way of saying I have no idea what I'm doing. All I
know is it worked and then it didn't but only for one minor situational
change.
 
 
-Eric


  _____  

From: Action Request System discussion list(ARSList)
[mailto:[email protected]] On Behalf Of LJ Longwing
Sent: Thursday, November 12, 2009 12:21 PM
To: [email protected]
Subject: Re: Java API - parseQualification Error - Part 2


** 
Eric,
So they are saying the problem is looking up the field name, and if you use
the Field ID it works just fine?

  _____  

From: Action Request System discussion list(ARSList)
[mailto:[email protected]] On Behalf Of Roys, Eric D
Sent: Thursday, November 12, 2009 10:40 AM
To: [email protected]
Subject: Re: Java API - parseQualification Error - Part 2


** 


For anyone interested (part 2 of 2)... 

Secondary response from support (it doesn't error as before): 

Sample API program that works for me.. customer will need to change the
details marked with a " <------" for his test.. 

import com.bmc.arsys.api.*; 
import java.util.*; 

public class JavaAPITest { 
private ARServerUser server; 
private String formName= "Roles";     <------ 

public JavaAPITest() { 
   server = new ARServerUser(); 
   server.setServer("atlwin01");                <------ 
   server.setPort(0);                           <------ 
   server.setUser("Demo");                       <------ 
   server.setPassword("");                         <------ 
   } 

public static void main(String[] args) { 
   JavaAPITest test = new JavaAPITest(); 
   test.connect(); 
   test.queryEntrysByQual("( \'Create Date\' > \"1/1/2009\" )"); 
   test.queryEntrysByQual("( \'1702\' = -1210 )");
<------ 
   test.cleanup(); 
   } 

// 
// Connect the current user to the server. 
// 
void connect() { 
   System.out.println(); 
   System.out.println("Connecting to AR Server..."); 
   try { 
      server.verifyUser(); 
      } 
   catch (ARException e) { 
      // 
      //This exception is triggered by a bad server, password or, 
      //if guest access is turned off, by an unknown username. 
      // 
      ARExceptionHandler(e, "Cannot verify user " + server.getUser() + ".");

      System.exit(1); 
      } 
   System.out.println("Connected to AR Server " + 
   server.getServer()); 
   } 

// 
// Retrieve entries from the form using the given qualification. With // the
returned entry set, print out the ID of each entry and the // contents in
its shortDescription field.

// 
void queryEntrysByQual(String qualStr) { 
   System.out.println(); 
   System.out.println ("Retrieving entryies with qualification " + qualStr);


   try { 
      // Retrieve the detail info of all fields from the form. 
      List <Field> fields = server.getListFieldObjects(formName); 

      // Create the search qualifier. 
      QualifierInfo qual = server.parseQualification(qualStr, fields, null,
Constants.AR_QUALCONTEXT_DEFAULT); 
      int[] fieldIds = {2, 7, 8}; 
      OutputInteger nMatches = new OutputInteger(); 
      List<SortInfo> sortOrder = new ArrayList<SortInfo>(); 
      sortOrder.add(new SortInfo(2, Constants.AR_SORT_DESCENDING)); 

      // Retrieve entries from the form using the given 
      // qualification. 
      List<Entry> entryList = server.getListEntryObjects(formName, qual, 0,
Constants.AR_NO_MAX_LIST_RETRIEVE, sortOrder, fieldIds, true, nMatches);

      System.out.println ("Query returned " + nMatches + " matches."); 
      
      if( nMatches.intValue() > 0){ 
         // Print out the matches. 
         System.out.println("Request Id " + "Short Description" ); 
         for( int i = 0; i < entryList.size(); i++ ){ 
            System.out.println (entryList.get(i).getEntryId() + " " +
entryList.get(i).get(Constants.AR_CORE_SHORT_DESCRIPTION));

            } 
         } 
      } 
   
   catch( ARException e ) { 
      ARExceptionHandler(e, "Problem while querying by qualifier. "); 
      } 
   } 

public void ARExceptionHandler(ARException e, String errMessage){
System.out.println(errMessage); printStatusList(server.getLastStatus());

System.out.print("Stack Trace:"); 
e.printStackTrace(); 
} 

public void printStatusList(List<StatusInfo> statusList) { if (statusList ==
null || statusList.size()==0) { System.out.println("Status List is empty.");
return; }

System.out.print("Message type: "); 
switch(statusList.get(0).getMessageType()) 
{ 
case Constants.AR_RETURN_OK: 
System.out.println("Note"); 
break; 
case Constants.AR_RETURN_WARNING: 
System.out.println("Warning"); 
break; 
case Constants.AR_RETURN_ERROR: 
System.out.println("Error"); 
break; 
case Constants.AR_RETURN_FATAL: 
System.out.println("Fatal Error"); 
break; 
default: 
System.out.println("Unknown (" + 
statusList.get(0).getMessageType() + ")"); break; }
System.out.println("Status List:"); for (int i=0; i < statusList.size();
i++) { System.out.println(statusList.get(i).getMessageText());

System.out.println(statusList.get(i).getAppendedText()); 
} 
} 


public void cleanup() { 
// Logout the user from the server. This releases the resource // allocated
on the server for the user. 
server.logout(); 
System.out.println(); 
System.out.println("User logged out."); 
} 
} 

_Platinum Sponsor: [email protected] ARSlist: "Where the Answers
Are"_ _Platinum Sponsor: [email protected] ARSlist: "Where the
Answers Are"_ _Platinum Sponsor: [email protected] ARSlist: "Where
the Answers Are"_ _Platinum Sponsor: [email protected] ARSlist:
"Where the Answers Are"_ _Platinum Sponsor: [email protected]
ARSlist: "Where the Answers Are"_ 

_______________________________________________________________________________
UNSUBSCRIBE or access ARSlist Archives at www.arslist.org
Platinum Sponsor:[email protected] ARSlist: "Where the Answers Are"

Reply via email to