@Override public Object read(Object req, Map kvp, Map rawKvp) throws Exception { GetRepositoryItemType request = (GetRepositoryItemType) super.read(req, kvp, rawKvp); if (request.getId() == null) { throw new ServiceException( "ID parameter not provided for GetRepositoryItemBean operation", ServiceException.MISSING_PARAMETER_VALUE, "id"); } return request; } }
@Override public Object read(Object req, Map kvp, Map rawKvp) throws Exception { GetRepositoryItemType request = (GetRepositoryItemType) super.read(req, kvp, rawKvp); if (request.getId() == null) { throw new ServiceException( "ID parameter not provided for GetRepositoryItemBean operation", ServiceException.MISSING_PARAMETER_VALUE, "id"); } return request; }
/** * Returns the requested RepositoryItem * * @param request */ public RepositoryItem run(GetRepositoryItemType request) { try { RepositoryItem item = store.getRepositoryItem(request.getId()); if (item == null) { // by spec we have to return a 404 throw new HttpErrorCodeException( 404, "No repository item found for id " + request.getId()); } return item; } catch (IOException e) { throw new ServiceException("Failed to load the repository item", e); } } }
/** * Returns the requested RepositoryItem * * @param request * @return */ public RepositoryItem run(GetRepositoryItemType request) { try { RepositoryItem item = store.getRepositoryItem(request.getId()); if(item == null) { // by spec we have to return a 404 throw new HttpErrorCodeException(404, "No repository item found for id " + request.getId()); } return item; } catch (IOException e) { throw new ServiceException("Failed to load the repository item", e); } } }
public void testParseValidRequest() throws Exception { params.put("service", "csw"); params.put("VERSION", "2.0.2"); params.put("id", "foo"); GetRepositoryItemType request = getRequest(params); assertEquals("2.0.2", request.getVersion()); assertEquals("csw", request.getService()); assertEquals("foo", request.getId()); } }