@Delete() public void deletePatientConditional(@IdParam IdType theId, @ConditionalUrlParam String theConditionalUrl) { // Only one of theId or theConditionalUrl will have a value depending // on whether the URL receieved was a logical ID, or a conditional // search string if (theId != null) { // do a normal delete } else { // do a conditional delete } // otherwise, delete was successful return; // can also return MethodOutcome } //END SNIPPET: deleteConditional
@Update public MethodOutcome updatePatientConditional( @ResourceParam Patient thePatient, @IdParam IdType theId, @ConditionalUrlParam String theConditional) { // Only one of theId or theConditional will have a value and the other will be null, // depending on the URL passed into the server. if (theConditional != null) { // Do a conditional update. theConditional will have a value like "Patient?identifier=system%7C00001" } else { // Do a normal update. theId will have the identity of the resource to update } return new MethodOutcome(); // populate this } //END SNIPPET: updateConditional
@Create public MethodOutcome createPatientConditional( @ResourceParam Patient thePatient, @ConditionalUrlParam String theConditionalUrl) { if (theConditionalUrl != null) { // We are doing a conditional create // populate this with the ID of the existing resource which // matches the conditional URL return new MethodOutcome(); } else { // We are doing a normal create // populate this with the ID of the newly created resource return new MethodOutcome(); } } //END SNIPPET: createConditional
/** * @param theConditional This is provided only so that subclasses can implement if they want */ @Update public MethodOutcome update( @ResourceParam T theResource, @ConditionalUrlParam String theConditional) { ValidateUtil.isTrueOrThrowInvalidRequest(isBlank(theConditional), "This server doesn't support conditional update"); String idPartAsString = theResource.getIdElement().getIdPart(); TreeMap<Long, T> versionToResource = getVersionToResource(idPartAsString); Long versionIdPart; boolean created; if (versionToResource.isEmpty()) { versionIdPart = 1L; created = true; } else { versionIdPart = versionToResource.lastKey() + 1L; created = false; } IIdType id = store(theResource, idPartAsString, versionIdPart); myUpdateCount.incrementAndGet(); return new MethodOutcome() .setCreated(created) .setId(id); }
@Create public MethodOutcome create(@ResourceParam final Patient patient, @ConditionalUrlParam String theConditional) { // create the patient ... return new MethodOutcome(new IdDt(1L)).setCreated(true); }
@Delete() public MethodOutcome delete(HttpServletRequest theRequest, @IdParam IdDt theResource, @ConditionalUrlParam(supportsMultiple = true) String theConditional, RequestDetails theRequestDetails) { startRequest(theRequest); try { if (theConditional != null) { return getDao().deleteByUrl(theConditional, theRequestDetails); } else { return getDao().delete(theResource, theRequestDetails); } } finally { endRequest(theRequest); } }
@Delete() public MethodOutcome delete(HttpServletRequest theRequest, @IdParam IdType theResource, @ConditionalUrlParam(supportsMultiple = true) String theConditional, RequestDetails theRequestDetails) { startRequest(theRequest); try { if (theConditional != null) { return getDao().deleteByUrl(theConditional, theRequestDetails); } else { return getDao().delete(theResource, theRequestDetails); } } finally { endRequest(theRequest); } }
@Create public MethodOutcome create(HttpServletRequest theRequest, @ResourceParam T theResource, @ConditionalUrlParam String theConditional, RequestDetails theRequestDetails) { startRequest(theRequest); try { if (theConditional != null) { return getDao().create(theResource, theConditional, theRequestDetails); } else { return getDao().create(theResource, theRequestDetails); } } finally { endRequest(theRequest); } }
@Delete() public MethodOutcome delete(HttpServletRequest theRequest, @IdParam IdType theResource, @ConditionalUrlParam(supportsMultiple = true) String theConditional, RequestDetails theRequestDetails) { startRequest(theRequest); try { if (theConditional != null) { return getDao().deleteByUrl(theConditional, theRequestDetails); } else { return getDao().delete(theResource, theRequestDetails); } } finally { endRequest(theRequest); } }
@Create public MethodOutcome create(HttpServletRequest theRequest, @ResourceParam T theResource, @ConditionalUrlParam String theConditional, RequestDetails theRequestDetails) { startRequest(theRequest); try { if (theConditional != null) { return getDao().create(theResource, theConditional, theRequestDetails); } else { return getDao().create(theResource, theRequestDetails); } } finally { endRequest(theRequest); } }
@Create public MethodOutcome create(HttpServletRequest theRequest, @ResourceParam T theResource, @ConditionalUrlParam String theConditional, RequestDetails theRequestDetails) { startRequest(theRequest); try { if (theConditional != null) { return getDao().create(theResource, theConditional, theRequestDetails); } else { return getDao().create(theResource, theRequestDetails); } } finally { endRequest(theRequest); } }
@Update public MethodOutcome update(HttpServletRequest theRequest, @ResourceParam T theResource, @IdParam IdType theId, @ConditionalUrlParam String theConditional, RequestDetails theRequestDetails) { startRequest(theRequest); try { if (theConditional != null) { return getDao().update(theResource, theConditional, theRequestDetails); } else { return getDao().update(theResource, theRequestDetails); } } finally { endRequest(theRequest); } }
@Update public MethodOutcome update(HttpServletRequest theRequest, @ResourceParam T theResource, @IdParam IdType theId, @ConditionalUrlParam String theConditional, RequestDetails theRequestDetails) { startRequest(theRequest); try { if (theConditional != null) { return getDao().update(theResource, theConditional, theRequestDetails); } else { return getDao().update(theResource, theRequestDetails); } } finally { endRequest(theRequest); } }
@Update public MethodOutcome update(HttpServletRequest theRequest, @ResourceParam T theResource, @IdParam IdDt theId, @ConditionalUrlParam String theConditional, RequestDetails theRequestDetails) { startRequest(theRequest); try { if (theConditional != null) { return getDao().update(theResource, theConditional, theRequestDetails); } else { theResource.setId(theId); return getDao().update(theResource, theRequestDetails); } } finally { endRequest(theRequest); } }
@IdParam IdDt theId, @ResourceParam Patient theResource, @ConditionalUrlParam String theConditionalUrl, RequestDetails theRequestDetails) {
@Create public MethodOutcome create(HttpServletRequest theRequest, @ResourceParam T theResource, @ConditionalUrlParam String theConditional, RequestDetails theRequestDetails) { startRequest(theRequest); try { if (theConditional != null) { return getDao().create(theResource, theConditional, theRequestDetails); } else { return getDao().create(theResource, theRequestDetails); } } finally { endRequest(theRequest); } }
@Create public MethodOutcome create(HttpServletRequest theRequest, @ResourceParam T theResource, @ConditionalUrlParam String theConditional, RequestDetails theRequestDetails) { startRequest(theRequest); try { if (theConditional != null) { return getDao().create(theResource, theConditional, theRequestDetails); } else { return getDao().create(theResource, theRequestDetails); } } finally { endRequest(theRequest); } }
@Delete() public MethodOutcome delete(HttpServletRequest theRequest, @IdParam IdType theResource, @ConditionalUrlParam(supportsMultiple = true) String theConditional, RequestDetails theRequestDetails) { startRequest(theRequest); try { if (theConditional != null) { return getDao().deleteByUrl(theConditional, theRequestDetails); } else { return getDao().delete(theResource, theRequestDetails); } } finally { endRequest(theRequest); } }
@Delete() public MethodOutcome delete(HttpServletRequest theRequest, @IdParam IdType theResource, @ConditionalUrlParam(supportsMultiple = true) String theConditional, RequestDetails theRequestDetails) { startRequest(theRequest); try { if (theConditional != null) { return getDao().deleteByUrl(theConditional, theRequestDetails); } else { return getDao().delete(theResource, theRequestDetails); } } finally { endRequest(theRequest); } }
@Update public MethodOutcome update(HttpServletRequest theRequest, @ResourceParam T theResource, @IdParam IdType theId, @ConditionalUrlParam String theConditional, RequestDetails theRequestDetails) { startRequest(theRequest); try { if (theConditional != null) { return getDao().update(theResource, theConditional, theRequestDetails); } else { return getDao().update(theResource, theRequestDetails); } } finally { endRequest(theRequest); } }