[OPEN-ILS-DEV] How to query coded_value_map via OSRF

Jason Stephenson jason at sigio.com
Thu Jul 11 04:45:28 EDT 2019


I want to follow up on something specific that Ken said, and that I
forgot to mention.  Dan Wells didn't address this either.

On 7/10/19 10:26 PM, Ken Cox wrote:
> Jason,
> 
> Thank you, that is a great hint, but I'm not close enough to get it
> yet. In the past I've looked at OSRF methods registered in perl
> modules, and they were wrapped with some decorations that told me how
> they were supposed to be called (__PACKAGE__->register_method and look
> at the params array).  In this case (sub init_ro_object_cache) I don't
> recognize any methods being registered at all.  I tried to

The cstore and pcrud methods are all generated from the IDL at service
startup.  If you know how cstore works, then you pretty much know how
pcrud works.  You create, retrieve, update, and delete things in pretty
much the same way.  The main differences being in the method names
(pcurd uses the IDL class id, and cstore uses the Fieldmapper class id
with :: turned into _) and in pcrud pretty much always requiring
permissions, so therefore an authtoken.  Also, cstore should *never* be
exposed through the gateway.

The method names are totally predictable when you understand how they
are generated. For ccvm, we get:

open-ils.pcrud.ccvm.create
open-ils.pcrud.ccvm.retrieve
open-ils.pcrud.ccvm.update
open-ils.pcrud.ccvm.delete
open-ils.pcrud.ccvm.search
open-ils.pcrud.ccvm.id_list

create takes a newly made Fieldmapper object
retrieve takes an integer of the database id
update takes an existing Fieldmapper object
delete takes an existing Fieldmapper object
search takes a JSON object of search parameters
id_list takes a JSON object of search parameters

The arguments all come after the authtoken.

Create, update, and delete, all have to happen within a pcrud
transaction or you will get an error message.

If you know C, you can find how this is done, along with a somewhat
helpful comment beginning around line 51 in
Evergreen/Open-ILS/src/c-apps/oils_pcrud.c.

> 
> srfsh# introspect open-ils.pcrud "open-ils.pcrud.search.ccvm"
> 
> but it didn't provide any help.  I tried calling it in a lot of
> different ways but all I get is
> 
> https://gapines.org/osrf-gateway-v1?service=open-ils.pcrud&method=open-ils.pcrud.search.ccvm&param=%22ANONYMOUS%22&param=*
> {"payload":[],"debug": "osrfMethodException : Severe query error --
> see error log for more details","status":500}
> 
> One more clue please?
> 
> Thanks,
> Ken


More information about the Open-ils-dev mailing list