Example #1
0
  public List getCategories() {
    List concepts = null;
    try {
      //		GetReturnType request = new GetReturnType();
      //		request.setType("limited");

      GetCategoriesType request = new GetCategoriesType();
      request.setType("core");
      request.setHiddens(false);
      request.setSynonyms(false);

      OntologyResponseMessage msg = new OntologyResponseMessage();
      StatusType procStatus = null;
      while (procStatus == null || !procStatus.getType().equals("DONE")) {
        String response = OntServiceDriver.getCategories(request, "FIND");
        procStatus = msg.processResult(response);
        //				if  other error codes
        //				TABLE_ACCESS_DENIED and USER_INVALID, DATABASE ERROR
        if (procStatus.getType().equals("ERROR")) {
          System.setProperty("errorMessage", procStatus.getValue());
          return concepts;
        }
        procStatus.setType("DONE");
      }
      ConceptsType allConcepts = msg.doReadConcepts();
      if (allConcepts != null) concepts = allConcepts.getConcept();

    } catch (AxisFault e) {
      log.error(e.getMessage());
      System.setProperty("errorMessage", "Ontology cell unavailable");
    } catch (I2B2Exception e) {
      log.error(e.getMessage());
      System.setProperty("errorMessage", e.getMessage());
    } catch (Exception e) {
      log.error(e.getMessage());
      System.setProperty("errorMessage", "Remote server unavailable");
    }

    return concepts;
  }