Z3950 PresentResponse for OPAC - z39.50

Any idea how I can set the OPACRecord object on PresentResponse in Z39.50? PresentResponse only accepts Records which is a list of NamePlusRecords and each NamePlusRecord object only allows an External object. Any inputs would be helpful. Thanks!
Ref:
https://www.loc.gov/z3950/agency/asn1.html#OPACRecord

Related

Add UNKNOWN eventstreams to CEP Engine and get a list of all properties (payload) of this event

I want to be able to add event streams where I don't know beforehand what kind of properties the events have. So I don't know before if there is an integer ID or if there is a date timestamp and which payload might be there. As soon as I add such an unknown event, Esper should examine the stream and return the contained properties of the stream to me.
Thank you very much. That actually helps me a lot. But a function which returns all property names directly does not exist, does it? So I would have to use dynamic parameters (trial and error) until I know which ones exist in the eventstream.
Thank you for your help :)
See similar to Add Sensorevents to CEP Engine and get a list of all properties
In the case that you don't have some or all of the properties, you can add the stream without any properties or with those properties that you know that the events have. Here is how to add a stream where you don't know any properties in advance:
#public #buseventtype create schema MyStream()
You can now use EPEventServive#sendEvent to send events.
You can use this stream in various ways. You can simply select the event.
select * from MyStream
Or you can use the dynamic property names, those with a '?' questionmark appended to them. This can refer to properties that may or may not exist.
select id? as id from MyStream
The "id?" returns an Object-type value. You can use "cast" to make it, for instance, a double-type value to total up.
select id? as id, sum(cast(someNumericProperty?, double)) as total from MyStream where
When the property doesn't exist the "?" expression returns null. There is an "exists" function that returns true when the parameter that is a dynamic property exists.
I don't think the Esper runtime actually knows about any dynamic property until the EPL attempts to use that dynamic property. The runtime doesn't inspect any event for actual properties.
You can add your own user-defined function that determines what the property names may be for your specific event underlying. So when the underlying is a java.util.Map the user-defined function can return "event.keySet()".

How to access object field in qaf step from stored variable

In my previous question I was looking for a way to access and store return value of the function in qaf step. I was provided with the following:
When create new user using "{'name':'user1','password':'user123'}"
And store into 'newUser'
Then system should have user '${newUser}'
Now, I'd like to know how to get value from object/collection stored.
If it is a simple object named newUser which has field Id. How would I pass Id on next step?
And, if return is List, how to get by index from stored list?
Resolved issue on my own. If anyone faces same unknowns, here is how I solved it.
For requirements to work around response data, parsing same stored objects in properties by specific fields or collecting data from other structures such as Maps or Lists, create common functions with #QAFTestStep annotation to get data for class member name, map by key or list by index and so on... Add those in common steps and then write stepname text in gherkin format with parameters specified. Let me know if someone needs help, always ready to help out...

Is it possible to refresh a property in Grails?

In order to refresh a domain object i.e to re-read the data from database we do refresh().
def b = Book.get(1)
…
b.refresh()
I am wondering whether we can refresh a property of the domain.
Suppose i have bound params to Book object and suppose i want to unbind the author property from the book object then is it possible to achieve that?
Let's consider the Book is defined as
class Book {
String title
String author
String category
}
Suppose I do bindData(bookInstance, params). This will bind to all properties. I want to unbind the author after bindData. Is this possible?
It sounds like you just want to exclude binding a particular property.
bindData(bookInstance, params, [exclude: 'author'])
will bind all of the Book properties except for those listed.
You can conversely use include to explicitly list which properties to bind from params.
bindData(bookInstance, params, [include: 'title', 'category'])
I solved this by using bookInstance.author = bookInstance.getPersistentValue('author').

Ruby Rails - Go through Array & Save Each Value As A Unique Variable

My array contains a varying amount of objects. I need to iterate through the array and save each object id as a unique variable. Given the amount of objects within the array will vary, how should I do this?
"items"=>[{"id"=>"B00668BTCI"}, {"id"=>"B0041KJSL2"}]
I need to save the information to a new object that can support up to 16 IDs. #object.id_one, #object.id_two, etc...
The suitable way to save your data all depends upon how you want to reference it or access it later. Meta-programming is interesting and fun, but may be overkill depending upon your needs. You will need to determine that after looking at the choices. An alternative way is in an array:
array_of_ids = items.map(&:values).flatten
Or
array_of_ids = items.map { |item| item["id"] }
Then all of the IDs are in the array array_of_ids and becomes, in your example:
["B00668BTCI", "B0041KJSL2"]
Accessible by:
array_of_ids[0] # first id
array_of_ids[1] # second array
...
You need to do some meta-programming here...
Here is a post for you, it has an answer (by Chirantan) that shows how to create instance variables dynamically.
Hope this helps.
EDIT
Just in case you get interested to learn more, I have also found a good article about creating methods dynamically, check it out.
Dynamically adding class methods in Ruby by Ryan Angilly

Creating new Objects With SPRING.Net

I'm new on spring.net, and I'm tring to create an List<> of objects.
The list is initialized by a loop that calls:
IObj obj= (IObj)ContextRegistry.GetContext().GetObject("obj")
change object properties....
add it to the list...
the problem is : I keep getting the same object every step of the loop
so I get a list of the same object
If your object definitions are not singletons, then you will get a new object each time. Note, by default, singleton is set to true, so you have to explicitly set it to false.
For example, if you are using xml files to configure your objects, set the singleton attribute to false:
<object name="name" type="..." singleton="false"/>
It is not clear what you are trying to achieve by looping over the "GetObject("obj")" method. Maybe you can post the loop-code?
What "GetObject("obj")" does is to ask the Container for the Object with the name "obj". You stated that want to change the object's properties and add it to a list. This is something the container can do for you:
Set the properties of an Object:
http://www.springframework.net/doc-latest/reference/html/objects.html#objects-simple-values
Create a list:
http://www.springframework.net/doc-latest/reference/html/objects.html#objects-collections-values
This list can be injected into an Object you choose.
If you just want non-singleton objects of your IObj, naders answer is correct. Spring calls these non-singleton objects "prototypes". An overview of available Scopes can be found here: http://www.springframework.net/doc-latest/reference/html/objects.html#objects-factory-scopes

Resources