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

The following examples show how to use org.hl7.fhir.dstu3.model.IdType. These examples are extracted from open source projects. 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
@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 2
@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 3
@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 4
@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 5
@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
@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
@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
@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 9
@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 10
@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 11
@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 12
@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 13
@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 14
Source Project: org.hl7.fhir.core   Source File: StructureMapUtilities.java    License: 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 Project: org.hl7.fhir.core   Source File: StructureMapUtilities.java    License: 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 16
@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
@Override
public RiskAssessmentEntity readEntity(FhirContext ctx, IdType theId) {
    if (daoutils.isNumeric(theId.getIdPart())) {
        RiskAssessmentEntity riskIntolerance = (RiskAssessmentEntity) em.find(RiskAssessmentEntity.class, Long.parseLong(theId.getIdPart()));
        return riskIntolerance;
    }
    return null;
}
 
Example 18
Source Project: org.hl7.fhir.core   Source File: StructureMapUtilities.java    License: 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 19
Source Project: org.hl7.fhir.core   Source File: StructureMapUtilities.java    License: 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 20
@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 21
@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 22
@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 23
@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 24
@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 25
@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 26
@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;
}
 
Example 27
@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 28
@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 29
@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 30
@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;
    }

}