org.hl7.fhir.dstu3.model.IdType Java Examples

The following examples show how to use org.hl7.fhir.dstu3.model.IdType. 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: SlotProvider.java    From careconnect-reference-implementation with Apache License 2.0 6 votes vote down vote up
@Update
public MethodOutcome updateSlot(HttpServletRequest theRequest, @ResourceParam Slot slot, @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 {
        Slot existingSlot = slotDao.create(ctx, slot, theId, theConditional);
        method.setId(existingSlot.getIdElement());
        method.setResource(existingSlot);
    } catch (Exception ex) {

        ProviderResponseLibrary.handleException(method,ex);
    }


    return method;
}
 
Example #2
Source File: DiagnosticReportProvider.java    From careconnect-reference-implementation with Apache License 2.0 6 votes vote down vote up
@Update
public MethodOutcome update(HttpServletRequest theRequest, @ResourceParam DiagnosticReport diagnosticReport, @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 {
    DiagnosticReport newDiagnosticReport = diagnosticReportDao.create(ctx,diagnosticReport, theId, theConditional);
    method.setId(newDiagnosticReport.getIdElement());
    method.setResource(newDiagnosticReport);
    } catch (Exception ex) {

        ProviderResponseLibrary.handleException(method,ex);
    }


    return method;
}
 
Example #3
Source File: MedicationDispenseProvider.java    From careconnect-reference-implementation with Apache License 2.0 6 votes vote down vote up
@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 #4
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 #5
Source File: PractitionerProvider.java    From careconnect-reference-implementation with Apache License 2.0 6 votes vote down vote up
@Update
public MethodOutcome updatePractitioner(HttpServletRequest theRequest, @ResourceParam Practitioner practitioner, @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 {
    Practitioner newPractitioner = practitionerDao.create(ctx,practitioner, theId, theConditional);
    method.setId(newPractitioner.getIdElement());
    method.setResource(newPractitioner);
    } catch (Exception ex) {

        ProviderResponseLibrary.handleException(method,ex);
    }



    return method;
}
 
Example #6
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 #7
Source File: RelatedPersonProvider.java    From careconnect-reference-implementation with Apache License 2.0 6 votes vote down vote up
@Update
public MethodOutcome updateRelatedPerson(HttpServletRequest theRequest, @ResourceParam RelatedPerson person, @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 {
    RelatedPerson newRelatedPerson = personDao.update(ctx, person, theId, theConditional);
    method.setId(newRelatedPerson.getIdElement());
    method.setResource(newRelatedPerson);

} catch (Exception ex) {

    ProviderResponseLibrary.handleException(method,ex);
}


    return method;
}
 
Example #8
Source File: EncounterProvider.java    From careconnect-reference-implementation with Apache License 2.0 6 votes vote down vote up
@Update
public MethodOutcome update(HttpServletRequest theRequest, @ResourceParam Encounter encounter, @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 {
        Encounter newEncounter = encounterDao.create(ctx, encounter, theId, theConditional);
        method.setId(newEncounter.getIdElement());
        method.setResource(newEncounter);
    } catch (Exception ex) {
        ProviderResponseLibrary.handleException(method,ex);
    }


    return method;
}
 
Example #9
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 #10
Source File: LocationProvider.java    From careconnect-reference-implementation with Apache License 2.0 6 votes vote down vote up
@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 #11
Source File: ScheduleProvider.java    From careconnect-reference-implementation with Apache License 2.0 6 votes vote down vote up
@Update
public MethodOutcome updateSchedule(HttpServletRequest theRequest, @ResourceParam Schedule schedule, @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 {
        Schedule existingSchedule = scheduleDao.create(ctx, schedule, theId, theConditional);
        method.setId(existingSchedule.getIdElement());
        method.setResource(existingSchedule);
    } catch (Exception ex) {

        ProviderResponseLibrary.handleException(method,ex);
    }


    return method;
}
 
Example #12
Source File: StructureDefinitionProvider.java    From careconnect-reference-implementation with Apache License 2.0 6 votes vote down vote up
@Delete
public MethodOutcome delete
        (@IdParam IdType internalId) {
    resourcePermissionProvider.checkPermission("delete");
    MethodOutcome method = new MethodOutcome();

    try {
        OperationOutcome outcome = structureDefinitionDao.delete(ctx,internalId);
        method.setCreated(false);
        //method.setId(newStructureDefinition.getIdElement());
        method.setResource(outcome);
    } catch (Exception ex) {
        log.info(ex.getMessage());
        ProviderResponseLibrary.handleException(method,ex);
    }

    return method;
}
 
Example #13
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 #14
Source File: StructureMapUtilities.java    From org.hl7.fhir.core with Apache License 2.0 5 votes vote down vote up
private void parseParameter(StructureMapGroupRuleTargetComponent target, FHIRLexer lexer) throws FHIRLexerException, FHIRFormatError {
	if (!lexer.isConstant(true)) {
		target.addParameter().setValue(new IdType(lexer.take()));
	} else if (lexer.isStringConstant())
		target.addParameter().setValue(new StringType(lexer.readConstant("??")));
	else {
		target.addParameter().setValue(readConstant(lexer.take(), lexer));
	}
}
 
Example #15
Source File: RiskAssessmentProvider.java    From careconnect-reference-implementation with Apache License 2.0 5 votes vote down vote up
@Read()
public RiskAssessment get(@IdParam IdType riskAssessmentId) {

	resourcePermissionProvider.checkPermission("read");
    RiskAssessment riskAssessment = riskAssessmentDao.read(ctx,riskAssessmentId);

    if ( riskAssessment == null) {
        throw OperationOutcomeFactory.buildOperationOutcomeException(
                new ResourceNotFoundException("No RiskAssessment/ " + riskAssessmentId.getIdPart()),
                 OperationOutcome.IssueType.NOTFOUND);
    }

    return riskAssessment;
}
 
Example #16
Source File: PatientProvider.java    From careconnect-reference-implementation with Apache License 2.0 5 votes vote down vote up
@Read
public Patient read(@IdParam IdType internalId) {
	
	resourcePermissionProvider.checkPermission("read");
	
    Patient patient = patientDao.read(ctx,internalId);
    if (patient == null) {
        throw OperationOutcomeFactory.buildOperationOutcomeException(
                new ResourceNotFoundException("No patient details found for patient ID: " + internalId.getIdPart()),
                 OperationOutcome.IssueType.NOTFOUND);
    }

    return patient;
}
 
Example #17
Source File: StructureMapUtilities.java    From org.hl7.fhir.core with Apache License 2.0 5 votes vote down vote up
private TypeDetails getParam(VariablesForProfiling vars, StructureMapGroupRuleTargetParameterComponent parameter) throws DefinitionException {
  Type p = parameter.getValue();
  if (!(p instanceof IdType))
    return new TypeDetails(CollectionStatus.SINGLETON, "http://hl7.org/fhir/StructureDefinition/"+p.fhirType());
  else { 
    String n = ((IdType) p).asStringValue();
    VariableForProfiling b = vars.get(VariableMode.INPUT, n);
    if (b == null)
      b = vars.get(VariableMode.OUTPUT, n);
    if (b == null)
      throw new DefinitionException("Variable "+n+" not found ("+vars.summary()+")");
    return b.getProperty().getTypes();
  }
}
 
Example #18
Source File: EndpointProvider.java    From careconnect-reference-implementation with Apache License 2.0 5 votes vote down vote up
@Read()
public Endpoint getEndpoint(@IdParam IdType endpointId) {
	resourcePermissionProvider.checkPermission("read");
    Endpoint endpoint = endpointDao.read(ctx,endpointId);

    if ( endpoint == null) {
        throw OperationOutcomeFactory.buildOperationOutcomeException(
                new ResourceNotFoundException("No Endpoint/ " + endpointId.getIdPart()),
                 OperationOutcome.IssueType.NOTFOUND);
    }

    return endpoint;
}
 
Example #19
Source File: StructureMapUtilities.java    From org.hl7.fhir.core with Apache License 2.0 5 votes vote down vote up
private Base getParam(Variables vars, StructureMapGroupRuleTargetParameterComponent parameter) throws DefinitionException {
	Type p = parameter.getValue();
	if (!(p instanceof IdType))
		return p;
	else { 
		String n = ((IdType) p).asStringValue();
     Base b = vars.get(VariableMode.INPUT, n);
		if (b == null)
			b = vars.get(VariableMode.OUTPUT, n);
		if (b == null)
       throw new DefinitionException("Variable "+n+" not found ("+vars.summary()+")");
		return b;
	}
}
 
Example #20
Source File: StructureMapUtilities.java    From org.hl7.fhir.core with Apache License 2.0 5 votes vote down vote up
private String getParamString(VariablesForProfiling vars, StructureMapGroupRuleTargetParameterComponent parameter) {
  Type p = parameter.getValue();
  if (p == null || p instanceof IdType)
    return null;
  if (!p.hasPrimitiveValue())
    return null;
  return p.primitiveValue();
}
 
Example #21
Source File: EpisodeOfCareDao.java    From careconnect-reference-implementation with Apache License 2.0 5 votes vote down vote up
@Override
public EpisodeOfCareEntity readEntity(FhirContext ctx, IdType theId) {

    if (daoutils.isNumeric(theId.getIdPart())) {
        EpisodeOfCareEntity episodeOfCareEntity = (EpisodeOfCareEntity) em.find(EpisodeOfCareEntity.class, Long.parseLong(theId.getIdPart()));

        return episodeOfCareEntity;
    } else {
        return null;
    }
}
 
Example #22
Source File: PractitionerRoleDao.java    From careconnect-reference-implementation with Apache License 2.0 5 votes vote down vote up
@Override
public org.hl7.fhir.dstu3.model.PractitionerRole read(FhirContext ctx, IdType theId) {

    if (daoutils.isNumeric(theId.getIdPart())) {
        PractitionerRole roleEntity = (PractitionerRole) em.find(PractitionerRole.class, Long.parseLong(theId.getIdPart()));
        return roleEntity == null
                ? null
                : practitionerRoleToFHIRPractitionerRoleTransformer.transform(roleEntity);
    } else {
        return null;
    }

}
 
Example #23
Source File: StructureDefinitionDao.java    From careconnect-reference-implementation with Apache License 2.0 5 votes vote down vote up
@Override
public OperationOutcome delete(FhirContext ctx, IdType theId) {
	log.trace("Retrieving ValueSet = " + theId.getValue());

	StructureDefinitionEntity structureDefinitionEntity = findStructureDefinitionEntity(theId);

	if (structureDefinitionEntity == null) return null;

	for (StructureDefinitionIdentifier identifier : structureDefinitionEntity.getIdentifiers()) {
		em.remove(identifier);
	}
	em.remove(structureDefinitionEntity);
	return new OperationOutcome();

}
 
Example #24
Source File: QuestionnaireProvider.java    From careconnect-reference-implementation with Apache License 2.0 5 votes vote down vote up
@Update
public MethodOutcome update(HttpServletRequest theRequest, @ResourceParam Questionnaire questionnaire,
                            @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 {
        Questionnaire newQuestionnaire = questionnaireDao.create(ctx, questionnaire, theId, theConditional);
        method.setId(newQuestionnaire.getIdElement());
        method.setResource(newQuestionnaire);

    } catch (BaseServerResponseException srv) {
        // HAPI Exceptions pass through
        throw srv;
    } catch (Exception ex) {
        ProviderResponseLibrary.handleException(method, ex);
    }


    return method;
}
 
Example #25
Source File: RelatedPersonProvider.java    From careconnect-reference-implementation with Apache License 2.0 5 votes vote down vote up
@Read()
public RelatedPerson getRelatedPerson(@IdParam IdType personId) {

	resourcePermissionProvider.checkPermission("read");
    RelatedPerson person = personDao.read(ctx,personId);

    if ( person == null) {
        throw OperationOutcomeFactory.buildOperationOutcomeException(
                new ResourceNotFoundException("No RelatedPerson/ " + personId.getIdPart()),
                 OperationOutcome.IssueType.NOTFOUND);
    }

    return person;
}
 
Example #26
Source File: ListProvider.java    From careconnect-reference-implementation with Apache License 2.0 5 votes vote down vote up
@Read()
public ListResource getList(@IdParam IdType listId) {
	resourcePermissionProvider.checkPermission("read");
    ListResource form = listDao.read(ctx,listId);

    if ( form == null) {
        throw OperationOutcomeFactory.buildOperationOutcomeException(
                new ResourceNotFoundException("No List/ " + listId.getIdPart()),
                 OperationOutcome.IssueType.NOTFOUND);
    }

    return form;
}
 
Example #27
Source File: GoalProvider.java    From careconnect-reference-implementation with Apache License 2.0 5 votes vote down vote up
@Read()
public Goal get(@IdParam IdType goalId) {
	resourcePermissionProvider.checkPermission("read");
    Goal goal = goalDao.read(ctx,goalId);

    if ( goal == null) {
        throw OperationOutcomeFactory.buildOperationOutcomeException(
                new ResourceNotFoundException("No Goal/ " + goalId.getIdPart()),
                OperationOutcome.IssueType.NOTFOUND);
    }

    return goal;
}
 
Example #28
Source File: ScheduleProvider.java    From careconnect-reference-implementation with Apache License 2.0 5 votes vote down vote up
@Read()
public Schedule getSchedule(@IdParam IdType scheduleId) {
	resourcePermissionProvider.checkPermission("read");
    Schedule schedule = scheduleDao.read(ctx,scheduleId);

    if ( schedule == null) {
        throw OperationOutcomeFactory.buildOperationOutcomeException(
                new ResourceNotFoundException("No Schedule/ " + scheduleId.getIdPart()),
                 OperationOutcome.IssueType.NOTFOUND);
    }

    return schedule;
}
 
Example #29
Source File: LocationProvider.java    From careconnect-reference-implementation with Apache License 2.0 5 votes vote down vote up
@Read()
public Location getLocation(@IdParam IdType locationId) {
	resourcePermissionProvider.checkPermission("read");
    Location location = locationDao.read(ctx,locationId);

    if ( location == null) {
        throw OperationOutcomeFactory.buildOperationOutcomeException(
                new ResourceNotFoundException("No Location/ " + locationId.getIdPart()),
                 OperationOutcome.IssueType.NOTFOUND);
    }

    return location;
}
 
Example #30
Source File: GoalDao.java    From careconnect-reference-implementation with Apache License 2.0 5 votes vote down vote up
@Override
public Goal read(FhirContext ctx, IdType theId) {
    if (daoutils.isNumeric(theId.getIdPart())) {
        GoalEntity goal = (GoalEntity) em.find(GoalEntity.class, Long.parseLong(theId.getIdPart()));
        return goalEntityToFHIRGoalTransformer.transform(goal);
    }
    return null;
}