Java Code Examples for ca.uhn.fhir.rest.api.MethodOutcome#setOperationOutcome()
The following examples show how to use
ca.uhn.fhir.rest.api.MethodOutcome#setOperationOutcome() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: RiskAssessmentProvider.java From careconnect-reference-implementation with Apache License 2.0 | 6 votes |
@Create public MethodOutcome create(HttpServletRequest theRequest, @ResourceParam RiskAssessment riskAssessment) { resourcePermissionProvider.checkPermission("create"); MethodOutcome method = new MethodOutcome(); method.setCreated(true); OperationOutcome opOutcome = new OperationOutcome(); method.setOperationOutcome(opOutcome); try { RiskAssessment newRiskAssessment = riskAssessmentDao.create(ctx,riskAssessment, null,null); method.setId(newRiskAssessment.getIdElement()); method.setResource(newRiskAssessment); } catch (Exception ex) { ProviderResponseLibrary.handleException(method,ex); } return method; }
Example 2
Source File: EncounterProvider.java From careconnect-reference-implementation with Apache License 2.0 | 6 votes |
@Create public MethodOutcome create(HttpServletRequest theRequest, @ResourceParam Encounter encounter) { resourcePermissionProvider.checkPermission("create"); MethodOutcome method = new MethodOutcome(); method.setCreated(true); OperationOutcome opOutcome = new OperationOutcome(); method.setOperationOutcome(opOutcome); try { Encounter newEncounter = encounterDao.create(ctx, encounter, null, null); method.setId(newEncounter.getIdElement()); method.setResource(newEncounter); } catch (Exception ex) { ProviderResponseLibrary.handleException(method,ex); } return method; }
Example 3
Source File: ImmunizationProvider.java From careconnect-reference-implementation with Apache License 2.0 | 6 votes |
@Create public MethodOutcome create(HttpServletRequest theRequest, @ResourceParam Immunization immunisation) { resourcePermissionProvider.checkPermission("create"); MethodOutcome method = new MethodOutcome(); method.setCreated(true); OperationOutcome opOutcome = new OperationOutcome(); method.setOperationOutcome(opOutcome); try { Immunization newImmunisation = immunisationDao.create(ctx,immunisation, null, null); method.setId(newImmunisation.getIdElement()); method.setResource(newImmunisation); } catch (Exception ex) { ProviderResponseLibrary.handleException(method,ex); } return method; }
Example 4
Source File: LocationProvider.java From careconnect-reference-implementation with Apache License 2.0 | 6 votes |
@Create public MethodOutcome createLocation(HttpServletRequest theRequest, @ResourceParam Location location) { resourcePermissionProvider.checkPermission("create"); MethodOutcome method = new MethodOutcome(); method.setCreated(true); OperationOutcome opOutcome = new OperationOutcome(); method.setOperationOutcome(opOutcome); try { Location newLocation = locationDao.create(ctx, location,null,null); method.setId(newLocation.getIdElement()); method.setResource(newLocation); } catch (Exception ex) { ProviderResponseLibrary.handleException(method,ex); } return method; }
Example 5
Source File: LocationProvider.java From careconnect-reference-implementation with Apache License 2.0 | 6 votes |
@Update public MethodOutcome updateLocation(HttpServletRequest theRequest, @ResourceParam Location location, @IdParam IdType theId, @ConditionalUrlParam String theConditional, RequestDetails theRequestDetails) { resourcePermissionProvider.checkPermission("update"); MethodOutcome method = new MethodOutcome(); method.setCreated(true); OperationOutcome opOutcome = new OperationOutcome(); method.setOperationOutcome(opOutcome); try { Location newLocation = locationDao.create(ctx, location, theId, theConditional); method.setId(newLocation.getIdElement()); method.setResource(newLocation); } catch (Exception ex) { ProviderResponseLibrary.handleException(method,ex); } return method; }
Example 6
Source File: CompositionProvider.java From careconnect-reference-implementation with Apache License 2.0 | 6 votes |
@Create public MethodOutcome create(HttpServletRequest theRequest, @ResourceParam Composition composition) { resourcePermissionProvider.checkPermission("create"); MethodOutcome method = new MethodOutcome(); method.setCreated(true); OperationOutcome opOutcome = new OperationOutcome(); method.setOperationOutcome(opOutcome); try { Composition newComposition = compositionDao.create(ctx,composition, null,null); method.setId(newComposition.getIdElement()); method.setResource(newComposition); } catch (Exception ex) { ProviderResponseLibrary.handleException(method,ex); } return method; }
Example 7
Source File: SlotProvider.java From careconnect-reference-implementation with Apache License 2.0 | 6 votes |
@Create public MethodOutcome createSlot(HttpServletRequest theRequest, @ResourceParam Slot slot) { resourcePermissionProvider.checkPermission("create"); MethodOutcome method = new MethodOutcome(); method.setCreated(true); OperationOutcome opOutcome = new OperationOutcome(); method.setOperationOutcome(opOutcome); try { Slot newSlot = slotDao.create(ctx, slot,null,null); method.setId(newSlot.getIdElement()); method.setResource(newSlot); } catch (Exception ex) { ProviderResponseLibrary.handleException(method,ex); } return method; }
Example 8
Source File: ScheduleProvider.java From careconnect-reference-implementation with Apache License 2.0 | 6 votes |
@Create public MethodOutcome createSchedule(HttpServletRequest theRequest, @ResourceParam Schedule schedule) { resourcePermissionProvider.checkPermission("create"); MethodOutcome method = new MethodOutcome(); method.setCreated(true); OperationOutcome opOutcome = new OperationOutcome(); method.setOperationOutcome(opOutcome); try { Schedule newSchedule = scheduleDao.create(ctx, schedule,null,null); method.setId(newSchedule.getIdElement()); method.setResource(newSchedule); } catch (Exception ex) { ProviderResponseLibrary.handleException(method,ex); } return method; }
Example 9
Source File: MedicationDispenseProvider.java From careconnect-reference-implementation with Apache License 2.0 | 6 votes |
@Update public MethodOutcome update(HttpServletRequest theRequest, @ResourceParam MedicationDispense dispense, @IdParam IdType theId, @ConditionalUrlParam String theConditional, RequestDetails theRequestDetails) { resourcePermissionProvider.checkPermission("update"); MethodOutcome method = new MethodOutcome(); method.setCreated(true); OperationOutcome opOutcome = new OperationOutcome(); method.setOperationOutcome(opOutcome); try { MedicationDispense newMedicationDispense = dispenseDao.create(ctx,dispense, theId, theConditional); method.setId(newMedicationDispense.getIdElement()); method.setResource(newMedicationDispense); } catch (Exception ex) { ProviderResponseLibrary.handleException(method,ex); } return method; }
Example 10
Source File: ImmunizationProvider.java From careconnect-reference-implementation with Apache License 2.0 | 6 votes |
@Update public MethodOutcome update(HttpServletRequest theRequest, @ResourceParam Immunization immunisation, @IdParam IdType theId, @ConditionalUrlParam String theConditional, RequestDetails theRequestDetails) { resourcePermissionProvider.checkPermission("update"); MethodOutcome method = new MethodOutcome(); method.setCreated(true); OperationOutcome opOutcome = new OperationOutcome(); method.setOperationOutcome(opOutcome); try { Immunization newImmunisation = immunisationDao.create(ctx,immunisation, theId, theConditional); method.setId(newImmunisation.getIdElement()); method.setResource(newImmunisation); } catch (Exception ex) { ProviderResponseLibrary.handleException(method,ex); } return method; }
Example 11
Source File: MedicationAdministrationProvider.java From careconnect-reference-implementation with Apache License 2.0 | 6 votes |
@Create public MethodOutcome create(HttpServletRequest theRequest, @ResourceParam MedicationAdministration administration) { resourcePermissionProvider.checkPermission("create"); MethodOutcome method = new MethodOutcome(); method.setCreated(true); OperationOutcome opOutcome = new OperationOutcome(); method.setOperationOutcome(opOutcome); try { MedicationAdministration newMedicationAdministration = administrationDao.create(ctx,administration, null,null); method.setId(newMedicationAdministration.getIdElement()); method.setResource(newMedicationAdministration); } catch (Exception ex) { ProviderResponseLibrary.handleException(method,ex); } return method; }
Example 12
Source File: MedicationProvider.java From careconnect-reference-implementation with Apache License 2.0 | 6 votes |
@Update public MethodOutcome update(HttpServletRequest theRequest, @ResourceParam Medication medication, @IdParam IdType theId, @ConditionalUrlParam String theConditional, RequestDetails theRequestDetails) { resourcePermissionProvider.checkPermission("update"); MethodOutcome method = new MethodOutcome(); method.setCreated(true); OperationOutcome opOutcome = new OperationOutcome(); method.setOperationOutcome(opOutcome); try { Medication newMedication = medicationDao.create(ctx,medication, theId, theConditional); method.setId(newMedication.getIdElement()); method.setResource(newMedication); } catch (Exception ex) { ProviderResponseLibrary.handleException(method,ex); } return method; }
Example 13
Source File: DocumentReferenceProvider.java From careconnect-reference-implementation with Apache License 2.0 | 6 votes |
@Create public MethodOutcome create(HttpServletRequest theRequest, @ResourceParam DocumentReference documentReference) { resourcePermissionProvider.checkPermission("create"); MethodOutcome method = new MethodOutcome(); method.setCreated(true); OperationOutcome opOutcome = new OperationOutcome(); method.setOperationOutcome(opOutcome); try { DocumentReference newDocumentReference = documentReferenceDao.create(ctx,documentReference, null,null); method.setId(newDocumentReference.getIdElement()); method.setResource(newDocumentReference); } catch (Exception ex) { ProviderResponseLibrary.handleException(method,ex); } return method; }
Example 14
Source File: DocumentReferenceProvider.java From careconnect-reference-implementation with Apache License 2.0 | 6 votes |
@Update public MethodOutcome update(HttpServletRequest theRequest, @ResourceParam DocumentReference documentReference, @IdParam IdType theId, @ConditionalUrlParam String theConditional, RequestDetails theRequestDetails) { resourcePermissionProvider.checkPermission("update"); MethodOutcome method = new MethodOutcome(); method.setCreated(true); OperationOutcome opOutcome = new OperationOutcome(); method.setOperationOutcome(opOutcome); try { DocumentReference newDocumentReference = documentReferenceDao.create(ctx,documentReference, theId, theConditional); method.setId(newDocumentReference.getIdElement()); method.setResource(newDocumentReference); } catch (Exception ex) { ProviderResponseLibrary.handleException(method,ex); } return method; }
Example 15
Source File: ConditionProvider.java From careconnect-reference-implementation with Apache License 2.0 | 6 votes |
@Update public MethodOutcome update(HttpServletRequest theRequest, @ResourceParam Condition condition, @IdParam IdType theId, @ConditionalUrlParam String theConditional, RequestDetails theRequestDetails) { resourcePermissionProvider.checkPermission("update"); MethodOutcome method = new MethodOutcome(); method.setCreated(true); OperationOutcome opOutcome = new OperationOutcome(); method.setOperationOutcome(opOutcome); try { Condition newCondition = conditionDao.create(ctx, condition, theId, theConditional); method.setId(newCondition.getIdElement()); method.setResource(newCondition); } catch (BaseServerResponseException srv) { // HAPI Exceptions pass through throw srv; } catch(Exception ex) { ProviderResponseLibrary.handleException(method,ex); } return method; }
Example 16
Source File: ClaimProvider.java From careconnect-reference-implementation with Apache License 2.0 | 5 votes |
@Update public MethodOutcome update(HttpServletRequest theRequest, @ResourceParam Claim claim, @IdParam IdType theId, @ConditionalUrlParam String theConditional, RequestDetails theRequestDetails) { resourcePermissionProvider.checkPermission("update"); MethodOutcome method = new MethodOutcome(); method.setCreated(true); OperationOutcome opOutcome = new OperationOutcome(); method.setOperationOutcome(opOutcome); try { Claim newClaim = claimDao.create(ctx,claim, theId, theConditional); method.setId(newClaim.getIdElement()); method.setResource(newClaim); } catch (BaseServerResponseException srv) { // HAPI Exceptions pass through throw srv; } catch(Exception ex) { ProviderResponseLibrary.handleException(method,ex); } return method; }
Example 17
Source File: ProviderResponseLibrary.java From careconnect-reference-implementation with Apache License 2.0 | 5 votes |
public static MethodOutcome handleException(MethodOutcome method, Exception ex) { if (ex instanceof OperationOutcomeException) { OperationOutcomeException outcomeException = (OperationOutcomeException) ex; if (outcomeException.getOutcome().hasIssue()) { log.error(outcomeException.getOutcome().getIssueFirstRep().getDiagnostics()); } method.setOperationOutcome(outcomeException.getOutcome()); method.setCreated(false); } else { log.error(ex.getMessage()); if (ex.getStackTrace().length >0) { StringWriter sw = new StringWriter(); ex.printStackTrace(new PrintWriter(sw)); String exceptionAsString = sw.toString(); log.error(exceptionAsString); } if (ex.getCause() != null) { log.error("Cause {}",ex.getCause()); } method.setCreated(false); method.setOperationOutcome(OperationOutcomeFactory.createOperationOutcome(ex.getMessage())); } createException(null, method.getOperationOutcome()); // This next line should not be called return method; }
Example 18
Source File: RiskAssessmentProvider.java From careconnect-reference-implementation with Apache License 2.0 | 4 votes |
@Update public MethodOutcome update(HttpServletRequest theRequest, @ResourceParam RiskAssessment riskAssessment, @IdParam IdType theId, @ConditionalUrlParam String theConditional, RequestDetails theRequestDetails) { resourcePermissionProvider.checkPermission("update"); MethodOutcome method = new MethodOutcome(); method.setCreated(true); OperationOutcome opOutcome = new OperationOutcome(); method.setOperationOutcome(opOutcome); try { RiskAssessment newRiskAssessment = riskAssessmentDao.create(ctx,riskAssessment, theId, theConditional); method.setId(newRiskAssessment.getIdElement()); method.setResource(newRiskAssessment); } catch (Exception ex) { ProviderResponseLibrary.handleException(method,ex); } return method; }
Example 19
Source File: ProcedureProvider.java From careconnect-reference-implementation with Apache License 2.0 | 4 votes |
@Update public MethodOutcome update(HttpServletRequest theRequest, @ResourceParam Procedure procedure, @IdParam IdType theId, @ConditionalUrlParam String theConditional, RequestDetails theRequestDetails) { resourcePermissionProvider.checkPermission("update"); MethodOutcome method = new MethodOutcome(); method.setCreated(true); OperationOutcome opOutcome = new OperationOutcome(); method.setOperationOutcome(opOutcome); try { Procedure newProcedure = procedureDao.create(ctx,procedure, theId, theConditional); method.setId(newProcedure.getIdElement()); method.setResource(newProcedure); } catch (Exception ex) { ProviderResponseLibrary.handleException(method,ex); } return method; }
Example 20
Source File: FlagProvider.java From careconnect-reference-implementation with Apache License 2.0 | 4 votes |
@Update public MethodOutcome update(HttpServletRequest theRequest, @ResourceParam Flag flag, @IdParam IdType theId, @ConditionalUrlParam String theConditional, RequestDetails theRequestDetails) { resourcePermissionProvider.checkPermission("update"); MethodOutcome method = new MethodOutcome(); method.setCreated(true); OperationOutcome opOutcome = new OperationOutcome(); method.setOperationOutcome(opOutcome); try { log.trace(theId.getId()); Flag newList = flagDao.create(ctx, flag, theId, theConditional); method.setId(newList.getIdElement()); method.setResource(newList); } catch (Exception ex) { ProviderResponseLibrary.handleException(method,ex); } return method; }