Ejemplo n.º 1
0
  protected void populateSearch(String[] input, ExampleSearch exampleSearch) {
    ArrayDesignSearch search = (ArrayDesignSearch) exampleSearch;
    ArrayDesign example = new ArrayDesign();
    if (headerIndexMap.get(API) < input.length && !input[headerIndexMap.get(API)].equals("")) {
      search.setApi(input[headerIndexMap.get(API)].trim());
    }

    if (headerIndexMap.get(NAME) < input.length && !input[headerIndexMap.get(NAME)].equals(""))
      example.setName(input[headerIndexMap.get(NAME)].trim());
    if (headerIndexMap.get(LSID) < input.length && !input[headerIndexMap.get(LSID)].equals(""))
      example.setLsid(input[headerIndexMap.get(LSID)].trim());

    if (headerIndexMap.get(PROVIDER) < input.length
        && !input[headerIndexMap.get(PROVIDER)].equals("")) {
      /*ArrayProvider provider = new ArrayProvider();
      provider.setName(input[headerIndexMap.get(PROVIDER)]);
      example.setArrayProvider(provider);*/
      ArrayProvider provider = null;
      try {
        provider = apiFacade.getArrayProvider(search.getApi(), input[headerIndexMap.get(PROVIDER)]);
      } catch (Exception e) {
        log.error("Error retrieving ArrayProvider for ArrayDesign search", e);
        provider = new ArrayProvider();
        provider.setName(input[headerIndexMap.get(PROVIDER)]);
      }

      if (provider != null) {
        example.setArrayProvider(provider);
      }
    }
    if (headerIndexMap.get(ASSAY_TYPE) < input.length
        && !input[headerIndexMap.get(ASSAY_TYPE)].equals("")) {
      example.getAssayTypes().add(new AssayType(input[headerIndexMap.get(ASSAY_TYPE)]));
    }
    if (headerIndexMap.get(NULL) < input.length && !input[headerIndexMap.get(NULL)].equals("")) {
      example = null;
    }
    search.setArrayDesign(example);
    if (headerIndexMap.get(TEST_CASE) < input.length
        && !input[headerIndexMap.get(TEST_CASE)].equals(""))
      search.setTestCase(Float.parseFloat(input[headerIndexMap.get(TEST_CASE)].trim()));
    if (headerIndexMap.get(EXPECTED_RESULTS) < input.length
        && !input[headerIndexMap.get(EXPECTED_RESULTS)].equals(""))
      search.setExpectedResults(
          Integer.parseInt(input[headerIndexMap.get(EXPECTED_RESULTS)].trim()));
    if (headerIndexMap.get(MIN_RESULTS) < input.length
        && !input[headerIndexMap.get(MIN_RESULTS)].equals(""))
      search.setMinResults(Integer.parseInt(input[headerIndexMap.get(MIN_RESULTS)].trim()));
    if (headerIndexMap.get(EXPECTED_PROVIDER) < input.length
        && !input[headerIndexMap.get(EXPECTED_PROVIDER)].equals(""))
      search.setExpectedProvider(input[headerIndexMap.get(EXPECTED_PROVIDER)].trim());
    if (headerIndexMap.get(EXPECTED_ORGANISM) < input.length
        && !input[headerIndexMap.get(EXPECTED_ORGANISM)].equals(""))
      search.setExpectedOrganism(input[headerIndexMap.get(EXPECTED_ORGANISM)]);
  }