Project

General

Profile

Revision 5870

Added by berkley over 10 years ago

added code to run an squery for listObjects instead of an anyfield query

View differences:

src/edu/ucsb/nceas/metacat/dataone/CrudService.java
606 606
              System.out.println("query end time is " + endTime);
607 607
          }
608 608
          params.clear();
609
          params.put("returndoctype", new String[] {PropertyService.getProperty("crudService.listObjects.ReturnDoctype")});
610 609
          params.put("qformat", new String[] {PropertyService.getProperty("crudService.listObjects.QFormat")});
611
          params.put("returnfield", new String[] {
612
                  PropertyService.getProperty("crudService.listObjects.ReturnField.1"), 
613
                  PropertyService.getProperty("crudService.listObjects.ReturnField.2"),
614
                  PropertyService.getProperty("crudService.listObjects.ReturnField.3"),
615
                  PropertyService.getProperty("crudService.listObjects.ReturnField.4"),
616
                  PropertyService.getProperty("crudService.listObjects.ReturnField.5"),
617
                  PropertyService.getProperty("crudService.listObjects.ReturnField.6"),
618
                  PropertyService.getProperty("crudService.listObjects.ReturnField.7"),
619
                  });
620
          params.put("anyfield", new String[] {PropertyService.getProperty("crudService.listObjects.anyfield")});
610
          params.put("action", new String[] {"squery"});
611
          params.put("query", new String[] {createListObjectsPathQueryDocument()});
621 612
          
622 613
          /*System.out.println("query is: metacatUrl: " + metacatUrl + " user: " + sessionData.getUserName() +
623 614
                  " sessionid: " + sessionData.getId() + " params: ");
......
1990 1981
        sm.setAuthoritativeMemberNode(nr);
1991 1982
        return sm;
1992 1983
    }
1984
    
1985
    /**
1986
     * create the listObjects pathQuery document
1987
     */
1988
    private String createListObjectsPathQueryDocument()
1989
        throws PropertyNotFoundException
1990
    {
1991
        String s = "<pathquery>";
1992
        s += "<returndoctype>" + PropertyService.getProperty("crudService.listObjects.ReturnDoctype") + "</returndoctype>";
1993
        s += "<returnfield>" + PropertyService.getProperty("crudService.listObjects.ReturnField.1") + "</returnfield>";
1994
        s += "<returnfield>" + PropertyService.getProperty("crudService.listObjects.ReturnField.2") + "</returnfield>";
1995
        s += "<returnfield>" + PropertyService.getProperty("crudService.listObjects.ReturnField.3") + "</returnfield>";
1996
        s += "<returnfield>" + PropertyService.getProperty("crudService.listObjects.ReturnField.4") + "</returnfield>";
1997
        s += "<returnfield>" + PropertyService.getProperty("crudService.listObjects.ReturnField.5") + "</returnfield>";
1998
        s += "<returnfield>" + PropertyService.getProperty("crudService.listObjects.ReturnField.6") + "</returnfield>";
1999
        s += "<returnfield>" + PropertyService.getProperty("crudService.listObjects.ReturnField.7") + "</returnfield>";
2000
        s += "<querygroup operator=\"UNION\"><queryterm casesensitive=\"false\" searchmode=\"contains\">";
2001
        s += "<value>%</value>"; 
2002
        s += "<pathexpr>" + PropertyService.getProperty("crudService.listObjects.ReturnField.3") + "</pathexpr>";
2003
        s += "</queryterm></querygroup></pathquery>";
2004
  
2005
        return s;
2006
    }
1993 2007
}
1994 2008

  

Also available in: Unified diff