@Update public abstract MethodOutcome updateSomePatient(@IdParam IdType theId, @ResourceParam Patient thePatient); //END SNIPPET: updateClient
@Update public MethodOutcome update(@IdParam IdType theId, @ResourceParam Patient thePatient) { String resourceId = theId.getIdPart(); String versionId = theId.getVersionIdPart(); // this will contain the ETag String currentVersion = "1"; // populate this with the current version if (!versionId.equals(currentVersion)) { throw new ResourceVersionConflictException("Expected version " + currentVersion); } // ... perform the update ... return new MethodOutcome(); } //END SNIPPET: updateEtag
@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
@Update public MethodOutcome updatePatientWithRawValue ( @ResourceParam Patient thePatient, @IdParam IdType theId, @ResourceParam String theRawBody, @ResourceParam EncodingEnum theEncodingEnum) { // Here, thePatient will have the parsed patient body, but // theRawBody will also have the raw text of the resource // being created, and theEncodingEnum will tell you which // encoding was used return new MethodOutcome(); // populate this } //END SNIPPET: updateRaw
/** * @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); }
@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); } }
@Update() public MethodOutcome update( @IdParam IdDt theId,
@Update public MethodOutcome updatePatientPrefer( @ResourceParam Patient thePatient, @IdParam IdType theId) { // Save the patient to the database // Update the version and last updated time on the resource IdType updatedId = theId.withVersion("123"); thePatient.setId(updatedId); InstantType lastUpdated = InstantType.withCurrentTime(); thePatient.getMeta().setLastUpdatedElement(lastUpdated); // Add the resource to the outcome, so that it can be returned by the server // if the client requests it MethodOutcome outcome = new MethodOutcome(); outcome.setId(updatedId); outcome.setResource(thePatient); return outcome; } //END SNIPPET: updatePrefer
@Update public MethodOutcome updatePatient(@IdParam IdType theId, @ResourceParam Patient thePatient) {
/** * @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); }
@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); } }