diff --git a/org.bridgedb.uri.ws.server/src/org/bridgedb/ws/uri/WSOtherservices.java b/org.bridgedb.uri.ws.server/src/org/bridgedb/ws/uri/WSOtherservices.java index 22b156e21..cdd7734c1 100644 --- a/org.bridgedb.uri.ws.server/src/org/bridgedb/ws/uri/WSOtherservices.java +++ b/org.bridgedb.uri.ws.server/src/org/bridgedb/ws/uri/WSOtherservices.java @@ -20,6 +20,7 @@ package org.bridgedb.ws.uri; import java.io.UnsupportedEncodingException; +import java.util.HashMap; import java.util.List; import javax.servlet.ServletContext; @@ -60,6 +61,8 @@ public class WSOtherservices extends WSAPI implements ServletContextListener { private static boolean EXCLUDE_GRAPH = false; private static boolean INCLUDE_GRAPH = true; + private static final HashMap setMappings = new HashMap(); + private static final Logger logger = Logger.getLogger(WSOtherservices.class); private ServletContext context; @@ -167,6 +170,23 @@ public Response getSetMapping(@QueryParam(WsUriConstants.SOURCE_DATASOURCE_SYSTE @QueryParam(WsUriConstants.LENS_URI) String lensUri, @Context HttpServletRequest httpServletRequest) throws BridgeDBException, UnsupportedEncodingException { + String key = scrCode + targetCode + lensUri; + Response result = setMappings.get(key); + if (result == null){ + result = getSetMappingNew(scrCode, targetCode, lensUri, httpServletRequest); + setMappings.put(key, result); + } + return result; + } + + @GET + @Produces(MediaType.TEXT_HTML) + @Path("/" + SetMappings.METHOD_NAME) + public Response getSetMappingNew(@QueryParam(WsUriConstants.SOURCE_DATASOURCE_SYSTEM_CODE) String scrCode, + @QueryParam(WsUriConstants.TARGET_DATASOURCE_SYSTEM_CODE) String targetCode, + @QueryParam(WsUriConstants.LENS_URI) String lensUri, + @Context HttpServletRequest httpServletRequest) + throws BridgeDBException, UnsupportedEncodingException { List mappingSetInfos = uriMapper.getMappingSetInfos(scrCode, targetCode, lensUri); String lensName; if (lensUri != null && !lensUri.isEmpty()){