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

Ken Cox kenstir at gmail.com
Fri Jul 12 22:00:19 EDT 2019


Jason and Daniel, that was extremely helpful.  I feel like I learned how to
fish in the permacrud today.  Thank you very much!

I don't feel like I described well enough why I was interested, so here
goes:
* when you search in the app, you can choose a search format, e.g. "All
Books".  This is coded as "book" in the search
(open-ils.search.biblio.multiclass.query).  So I need a mapping from search
display labels to search formats.
* when you look up a record returned from a search, the app needs to
display a label for the format of the specific record, e.g. "E-book" or
"Downloadable ebooks".  So I need a mapping from item formats to item
display labels.
* these mappings are different for different installations, e.g. "E-book"
vs. "Downloadable ebooks"

Thanks again,
Ken

On Thu, Jul 11, 2019 at 4:45 AM Jason Stephenson <jason at sigio.com> wrote:

> 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
>


-- 
-Ken
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://libmail.georgialibraries.org/pipermail/open-ils-dev/attachments/20190712/e3c7c528/attachment.html>


More information about the Open-ils-dev mailing list