Thank you Bruno, 
I was trying changing  the code of dspace 5.2 and its diferent.

> @POST
> @Path("/find-by-metadata-field")
> @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
> public Item[] findItemsByMetadataField(MetadataEntry metadataEntry, 
> @QueryParam("expand") String expand,
>         @QueryParam("userIP") String user_ip, @QueryParam("userAgent") String 
> user_agent,
>         @QueryParam("xforwardedfor") String xforwardedfor, @Context 
> HttpHeaders headers, @Context HttpServletRequest request)
>         throws WebApplicationException
> {
>
>     log.info("Looking for item with metadata(key=" + metadataEntry.getKey() + 
> ",value=" + metadataEntry.getValue()
>             + ", language=" + metadataEntry.getLanguage() + ").");
>     org.dspace.core.Context context = null;
>
>     List<Item> items = new ArrayList<Item>();
>     String[] metadata = mySplit(metadataEntry.getKey());
>
>     try
>     {
>         context = createContext(getUser(headers));        
>
>         // Must used own style.
>         if ((metadata.length < 2) || (metadata.length > 3))
>         {
>             context.abort();
>             log.error("Finding failed, bad metadata key.");
>             throw new WebApplicationException(Response.Status.NOT_FOUND);
>         }
>
>         String sql = "SELECT RESOURCE_ID, TEXT_VALUE, TEXT_LANG, SHORT_ID, 
> ELEMENT, QUALIFIER " +
>                 "FROM METADATAVALUE " +
>                 "JOIN METADATAFIELDREGISTRY ON 
> METADATAVALUE.METADATA_FIELD_ID = METADATAFIELDREGISTRY.METADATA_FIELD_ID " +
>                 "JOIN METADATASCHEMAREGISTRY ON 
> METADATAFIELDREGISTRY.METADATA_SCHEMA_ID = 
> METADATASCHEMAREGISTRY.METADATA_SCHEMA_ID " +
>                 "WHERE " +
>                 "SHORT_ID='" + metadata[0] + "'  AND " +
>                 "ELEMENT='" + metadata[1] + "' AND ";
>         if (metadata.length > 3)
>         {
>             sql += "QUALIFIER='" + metadata[2] + "' AND ";
>         }
>         if (org.dspace.storage.rdbms.DatabaseManager.isOracle())
>         {
>             sql += "dbms_lob.compare(TEXT_VALUE, '" + 
> metadataEntry.getValue() + "') = 0 AND ";
>         }
>         else
>         {
>             sql += "TEXT_VALUE='" + metadataEntry.getValue() + "' AND ";
>         }
>         if (metadataEntry.getLanguage() != null)
>         {
>             sql += "TEXT_LANG='" + metadataEntry.getLanguage() + "'";
>         }
>         else
>         {
>             sql += "TEXT_LANG is null";
>         }
>
>         TableRowIterator iterator = 
> org.dspace.storage.rdbms.DatabaseManager.query(context, sql);
>         while (iterator.hasNext())
>         {
>             TableRow row = iterator.next();
>             org.dspace.content.Item dspaceItem = this.findItem(context, 
> row.getIntColumn("RESOURCE_ID"),
>                     org.dspace.core.Constants.READ);
>             Item item = new Item(dspaceItem, "", context);
>             writeStats(dspaceItem, UsageEvent.Action.VIEW, user_ip, 
> user_agent, xforwardedfor, headers,
>                     request, context);
>             items.add(item);
>         }
>
>         context.complete();
>
>     }
>     catch (SQLException e)
>     {
>         processException("Something went wrong while finding item. 
> SQLException, Message: " + e, context);
>     }
>     catch (ContextException e)
>     {
>         processException("Context error:" + e.getMessage(), context);
>     }
>     finally
>     {
>         processFinally(context);
>     }
>
>     if (items.size() == 0)
>     {
>         log.info("Items not found.");
>     }
>     else
>     {
>         log.info("Items were found.");
>     }
>
>     return items.toArray(new Item[0]);
> }
>
>

 The query has what I want, but I dont know how to obtain the results.

-- 
You received this message because you are subscribed to the Google Groups 
"DSpace Technical Support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to dspace-tech+unsubscr...@googlegroups.com.
To post to this group, send email to dspace-tech@googlegroups.com.
Visit this group at https://groups.google.com/group/dspace-tech.
For more options, visit https://groups.google.com/d/optout.

Reply via email to