Java Code Examples for ca.uhn.fhir.rest.api.MethodOutcome#setCreated()

The following examples show how to use ca.uhn.fhir.rest.api.MethodOutcome#setCreated() . 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: OrganizationProvider.java    From careconnect-reference-implementation with Apache License 2.0 6 votes vote down vote up
@Update
public MethodOutcome updateOrganization(HttpServletRequest theRequest,@ResourceParam Organization organization, @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 {
            Organization newOrganization = organisationDao.create(ctx, organization, theId, theConditional);
            method.setId(newOrganization.getIdElement());
            method.setResource(newOrganization);
    } catch (Exception ex) {

        ProviderResponseLibrary.handleException(method,ex);
    }



    return method;
}
 
Example 2
Source File: RelatedPersonProvider.java    From careconnect-reference-implementation with Apache License 2.0 6 votes vote down vote up
@Create
public MethodOutcome createRelatedPerson(HttpServletRequest theRequest, @ResourceParam RelatedPerson person) {

	resourcePermissionProvider.checkPermission("create");
    MethodOutcome method = new MethodOutcome();
    method.setCreated(true);
    OperationOutcome opOutcome = new OperationOutcome();

    method.setOperationOutcome(opOutcome);
    try {
    RelatedPerson newRelatedPerson = personDao.update(ctx, person, null,null);
    method.setId(newRelatedPerson.getIdElement());
    method.setResource(newRelatedPerson);
    } catch (Exception ex) {

        ProviderResponseLibrary.handleException(method,ex);
    }

    return method;
}
 
Example 3
Source File: CareTeamProvider.java    From careconnect-reference-implementation with Apache License 2.0 6 votes vote down vote up
@Create
public MethodOutcome create(HttpServletRequest theRequest, @ResourceParam CareTeam careTeam) {

	resourcePermissionProvider.checkPermission("create");
    MethodOutcome method = new MethodOutcome();
    method.setCreated(true);
    OperationOutcome opOutcome = new OperationOutcome();

    method.setOperationOutcome(opOutcome);

    try {
        CareTeam newCareTeam = careTeamDao.create(ctx,careTeam, null,null);
        method.setId(newCareTeam.getIdElement());
        method.setResource(newCareTeam);
    } catch (Exception ex) {
        ProviderResponseLibrary.handleException(method,ex);
    }


    return method;
}
 
Example 4
Source File: CompositionProvider.java    From careconnect-reference-implementation with Apache License 2.0 6 votes vote down vote up
@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 5
Source File: ConditionProvider.java    From careconnect-reference-implementation with Apache License 2.0 6 votes vote down vote up
@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 6
Source File: OrganizationProvider.java    From careconnect-reference-implementation with Apache License 2.0 6 votes vote down vote up
@Create
public MethodOutcome createOrganization(HttpServletRequest theRequest,@ResourceParam Organization organization) {

	resourcePermissionProvider.checkPermission("create");
    MethodOutcome method = new MethodOutcome();
    method.setCreated(true);
    OperationOutcome opOutcome = new OperationOutcome();

    method.setOperationOutcome(opOutcome);
    try {
        Organization newOrganization = organisationDao.create(ctx, organization,null,null);
        method.setId(newOrganization.getIdElement());
        method.setResource(newOrganization);
    } catch (Exception ex) {

        ProviderResponseLibrary.handleException(method,ex);
    }

    return method;
}
 
Example 7
Source File: EndpointProvider.java    From careconnect-reference-implementation with Apache License 2.0 6 votes vote down vote up
@Update
public MethodOutcome updateEndpoint(HttpServletRequest theRequest, @ResourceParam Endpoint endpoint, @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 {
    Endpoint newEndpoint = endpointDao.create(ctx, endpoint, theId, theConditional);
    method.setId(newEndpoint.getIdElement());
    method.setResource(newEndpoint);

} catch (Exception ex) {

    ProviderResponseLibrary.handleException(method,ex);
}


    return method;
}
 
Example 8
Source File: AppointmentProvider.java    From careconnect-reference-implementation with Apache License 2.0 6 votes vote down vote up
@Create
public MethodOutcome createAppointment(HttpServletRequest theRequest, @ResourceParam Appointment appointment) {

	resourcePermissionProvider.checkPermission("create");
	
    MethodOutcome method = new MethodOutcome();
    method.setCreated(true);
    OperationOutcome opOutcome = new OperationOutcome();

    method.setOperationOutcome(opOutcome);

    try {
        Appointment newAppointment = appointmentDao.create(ctx, appointment,null,null);
        method.setId(newAppointment.getIdElement());
        method.setResource(newAppointment);
    } catch (Exception ex) {

        ProviderResponseLibrary.handleException(method,ex);
    }


    return method;
}
 
Example 9
Source File: EncounterProvider.java    From careconnect-reference-implementation with Apache License 2.0 6 votes vote down vote up
@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 10
Source File: ReferralRequestProvider.java    From careconnect-reference-implementation with Apache License 2.0 6 votes vote down vote up
@Update
public MethodOutcome updateReferralRequest(HttpServletRequest theRequest, @ResourceParam ReferralRequest referral, @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 {
        ReferralRequest newReferralRequest = referralDao.create(ctx, referral, theId, theConditional);
        method.setId(newReferralRequest.getIdElement());
        method.setResource(newReferralRequest);
    } catch (Exception ex) {

        ProviderResponseLibrary.handleException(method,ex);
    }

    return method;
}
 
Example 11
Source File: StructureDefinitionProvider.java    From careconnect-reference-implementation with Apache License 2.0 6 votes vote down vote up
@Update()
public MethodOutcome update(HttpServletRequest theRequest,@ResourceParam  StructureDefinition structureDefinition) throws OperationOutcomeException {
    log.info("update method is called");
    resourcePermissionProvider.checkPermission("update");
    MethodOutcome method = new MethodOutcome();

    try {
        StructureDefinition newStructureDefinition = structureDefinitionDao.create(ctx,structureDefinition);
        method.setCreated(false);
        method.setId(newStructureDefinition.getIdElement());
        method.setResource(newStructureDefinition);
    } catch (BaseServerResponseException srv) {
        // HAPI Exceptions pass through
        throw srv;
    } catch(Exception ex) {
        ProviderResponseLibrary.handleException(method,ex);
    }

    return method;
}
 
Example 12
Source File: ConceptMapProvider.java    From careconnect-reference-implementation with Apache License 2.0 6 votes vote down vote up
@Create
  public MethodOutcome create(HttpServletRequest theRequest, @ResourceParam ConceptMap conceptMap) {
log.info("create method is called");
resourcePermissionProvider.checkPermission("create");
MethodOutcome method = new MethodOutcome();

OperationOutcome opOutcome = new OperationOutcome();

method.setOperationOutcome(opOutcome);

try {
	ConceptMap newConceptMap = conceptMapDao.create(ctx,conceptMap);
	method.setCreated(true);
	method.setId(newConceptMap.getIdElement());
	method.setResource(newConceptMap);
} catch (BaseServerResponseException srv) {
	// HAPI Exceptions pass through
	throw srv;
} catch(Exception ex) {
	ProviderResponseLibrary.handleException(method,ex);
}
return method;
  }
 
Example 13
Source File: ValueSetProvider.java    From careconnect-reference-implementation with Apache License 2.0 6 votes vote down vote up
@Update()
public MethodOutcome update(HttpServletRequest theRequest,@ResourceParam ValueSet valueSet) {

	resourcePermissionProvider.checkPermission("update");
    MethodOutcome method = new MethodOutcome();
    method.setCreated(true);
    OperationOutcome opOutcome = new OperationOutcome();

    method.setOperationOutcome(opOutcome);


    try {
        ValueSet newValueSet = valueSetDao.create(ctx, valueSet);
        method.setId(newValueSet.getIdElement());
        method.setResource(newValueSet);
    } catch (BaseServerResponseException srv) {
        // HAPI Exceptions pass through
        throw srv;
    } catch(Exception ex) {
        ProviderResponseLibrary.handleException(method,ex);
    }


    return method;
}
 
Example 14
Source File: PractitionerProvider.java    From careconnect-reference-implementation with Apache License 2.0 6 votes vote down vote up
@Create
public MethodOutcome createPractitioner(HttpServletRequest theRequest, @ResourceParam Practitioner practitioner) {

	resourcePermissionProvider.checkPermission("create");
    MethodOutcome method = new MethodOutcome();
    method.setCreated(true);
    OperationOutcome opOutcome = new OperationOutcome();

    method.setOperationOutcome(opOutcome);
    try {
    Practitioner newPractitioner = practitionerDao.create(ctx,practitioner, null, null);
    method.setId(newPractitioner.getIdElement());
    method.setResource(newPractitioner);
    } catch (Exception ex) {

        ProviderResponseLibrary.handleException(method,ex);
    }


    return method;
}
 
Example 15
Source File: ConsentProvider.java    From careconnect-reference-implementation with Apache License 2.0 6 votes vote down vote up
@Create
public MethodOutcome create(HttpServletRequest theRequest, @ResourceParam Consent consent) {

	resourcePermissionProvider.checkPermission("create");
    MethodOutcome method = new MethodOutcome();
    method.setCreated(true);
    OperationOutcome opOutcome = new OperationOutcome();

    method.setOperationOutcome(opOutcome);

    try {

        Consent newConsent = consentDao.create(ctx,consent, null,null);
        method.setId(newConsent.getIdElement());
        method.setResource(newConsent);
    } catch (Exception ex) {
        ProviderResponseLibrary.handleException(method,ex);
    }


    return method;
}
 
Example 16
Source File: MedicationProvider.java    From careconnect-reference-implementation with Apache License 2.0 6 votes vote down vote up
@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 17
Source File: ReferralRequestProvider.java    From careconnect-reference-implementation with Apache License 2.0 6 votes vote down vote up
@Create
public MethodOutcome createReferralRequest(HttpServletRequest theRequest, @ResourceParam ReferralRequest referral) {

	resourcePermissionProvider.checkPermission("create");
    MethodOutcome method = new MethodOutcome();
    method.setCreated(true);
    OperationOutcome opOutcome = new OperationOutcome();

    method.setOperationOutcome(opOutcome);

    try {
        ReferralRequest newReferralRequest = referralDao.create(ctx, referral,null,null);
        method.setId(newReferralRequest.getIdElement());
        method.setResource(newReferralRequest);

    } catch (Exception ex) {

        ProviderResponseLibrary.handleException(method,ex);
    }

    return method;
}
 
Example 18
Source File: ClinicalImpressionProvider.java    From careconnect-reference-implementation with Apache License 2.0 6 votes vote down vote up
@Create
public MethodOutcome create(HttpServletRequest theRequest, @ResourceParam ClinicalImpression impression) {

	resourcePermissionProvider.checkPermission("read");
    MethodOutcome method = new MethodOutcome();
    method.setCreated(true);
    OperationOutcome opOutcome = new OperationOutcome();

    method.setOperationOutcome(opOutcome);

    try {
        ClinicalImpression newClinicalImpression = impressionDao.create(ctx,impression, null,null);
        method.setId(newClinicalImpression.getIdElement());
        method.setResource(newClinicalImpression);
    } catch (Exception ex) {
        ProviderResponseLibrary.handleException(method,ex);
    }


    return method;
}
 
Example 19
Source File: RiskAssessmentProvider.java    From careconnect-reference-implementation with Apache License 2.0 4 votes vote down vote up
@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 20
Source File: PersonProvider.java    From careconnect-reference-implementation with Apache License 2.0 4 votes vote down vote up
@Update
public MethodOutcome update(HttpServletRequest theRequest, @ResourceParam Person person, @IdParam IdType theId, RequestDetails theRequestDetails) throws OperationOutcomeException {

    log.debug("Update Person Provider called");
    

    MethodOutcome method = new MethodOutcome();
    method.setCreated(true);
    OperationOutcome opOutcome = new OperationOutcome();

    method.setOperationOutcome(opOutcome);
    Person newPerson = null;

    newPerson = personDao.update(ctx, person, theId);

    method.setId(newPerson.getIdElement());
    method.setResource(newPerson);


    log.debug("called update Person method");

    return method;
}