示例#1
0
  /**
   * Search for Data Elements using the Long Name
   *
   * @param args
   */
  public static void main(String[] args) {
    try {

      System.out.println("...TestCaDsrApi Started...");
      ApplicationService appService =
          ApplicationServiceProvider.getApplicationServiceFromUrl(
              "https://cadsrapi.nci.nih.gov/cadsrapi4");
      System.out.println("Searching for DataElements");

      // Search for the Data Element with the Long Name "Patient Race Category*". The asterisk (*)
      // is a wild card.
      DataElement dataElement = new DataElement();
      dataElement.setLongName("Patient Race Category*");
      // dataElement.setPublicID(2238438L);
      // dataElement.setLatestVersionIndicator("Yes");
      List<Object> results = appService.search(DataElement.class, dataElement);
      System.out.println(" received results : " + results.size());

      for (int i = 0; i < results.size(); i++) {
        // Show the DE
        Object curr = results.get(i);
        DataElement de = (DataElement) curr;
        System.out.println("===Data Element " + de.getLongName());
        System.out.println("Data Element " + de.getVersion());
        System.out.println("Data Element " + de.getPreferredDefinition());
      }
    } catch (Exception exception) {
      System.out.println("--------Error in the TestCaDsrApi");
      exception.printStackTrace();
    }
  }
	 public List search(String searchClassName, Object criterion) throws Exception
	 {
		try
		{
		 	ApplicationService applicationService = ApplicationServiceProvider.getApplicationService();		 	
		 	List criterionList = applicationService.search(searchClassName, criterion);
			return criterionList;
		}catch(Exception e)
		{
			log.error("Error thrown from Generic Service " + e.getMessage());
			throw new org.apache.axis.AxisFault("Error thrown from Generic Service "+e.getMessage() );
		}
	}