Ready to Learn?Ex Libris products all provide open APIs

General Purpose

The PushTo plug-in allows customers to indicate which social bookmark services (Connotea, Delicious, RefWorks, and so forth) to display in the FE, and enables customers to add new social bookmark sites to that list. This plug-in provides several options to customize how the required information exports to various social bookmark sites.

Implementation Steps

FROM any FE machine:

1) Copy the following JAR file(s):
     a) up to Primo 4.5:

     b) from Primo 4.5 and on:

2) Place this jar file in your development environment so you can start implementing the interfaces defined in the extracted JAR file.

3) Implement the interface: PushToInterface

4) Wrap your implementation class in a JAR file, which must be given a unique name

5) Place your JAR file at: $primo_dev/ng/primo/home/profile/search/pushTo on all FE machines (ignore any content you might find in this directory)

6) Add a row to the Adaptors mapping table:

     a) Adaptor Identifier - A code name for your implementation.
                                              This code will be used later on. Do not use spaces or special characters.
     b) Key - Enter the value: Class.

     c) Value - enter the full qualified class name of your implementation

7) This step will add a new "Push to" option in the drop down list.
     Add the following 4 lines to the "Keeping This item Tile" code table (XXX stand for the code you gave to your adaptor in step 6):
     a) default.fulldisplay.command.pushto.option.eshelf.XXX -
          The value is the name of the adaptor (for example: EndNote)

     b) default.fulldisplay.command.pushto.option.XXX -
          The value is the name of the adaptor (for example: EndNote)

     c) -
         the value is usually: "Push to <name>" (for example: Push To EndNote)

     d) -
          the value is usually: "Push to <name>" (for example: Push To EndNote)



Implementing the PushToInterface

This interface includes 3 methods.

2 are deprecated, so there is actually only 1 method to implement.

The 2 deprecated methods are:

  1. getContent()

  2. getFormAction()

For these 2 methods, just return the null value, and ignore them.

The only method to be implemented is:

public String pushTo(HttpServletRequest request, HttpServletResponse response,PrimoResult[] record,boolean fromBasket)

This method receives 4 parameters:

  1. request
  2. response
  3. record - an array containing one or more PNX records.
  4. fromBasket - indication if you were called from the E-shelf screen or not (details tab).
                             This parameter is not really needed and it can be ignored.

This method should return a value. You should always return null, do not try returning something else.

Basically you should iterate over the PNX records array and submit each record to the social bookmark site.

Iterating over the PNX array

The array of records you receive are XMLBeans records (A JAVA framework for parsing XML files).

The below code snippet demonstrates the iteration, over the array and shows an example of retrieving a title for a record.


for (int i = 0; i < record.length; i++) {
          DOC resultDocumnet = record[i].getSEGMENTS().getJAGROOTArray(0) .
          RecordType rec = resultDocumnet.getPrimoNMBib().getRecordArray(0);
          String title = rec.getDisplay().getTitleArray(0);

Openning a popup from the adaptor

You might want to present the user a popup before sending the information to the bookmark site.

In order to achieve this, you should use the response object to write back an HTML content.

Below is a code snippet demonstrating it. This code should be done in the pushTo() method:


PrintWriter out = response.getWriter();
out.println("<html xmlns=\"\" xml:lang=\"en-US\" lang=\"en-US\">");
out.println("    <form method=\"POST\" action=\"#\">");


return null;


When the user clicks submit (or OK in this example), the method pushTo() will be called again, and then you can use the request object, to retrieve the relevant data from the form.

The method pushTo() is called again because the following line:

out.println("    <form method=\"POST\" action=\"#\">");

which exists in the form.

You will need to know how to identify the call to pushTo() the requires the form to be displayed, and the call to pushTo() which is triggered from the submit request.