Package uk.nhs.interoperability.payloads.exceptions

Examples of uk.nhs.interoperability.payloads.exceptions.MissingMandatoryFieldException


    // If no prognosis awareness has been given, exit
    if (isbFields.getMainInformalCarerAwareOfPrognosis() == null) {
      return null;
    }
   
    MissingMandatoryFieldException missingFields = new MissingMandatoryFieldException();
    // Null checks for mandatory fields
    // If we have a prognosis awareness for the main informal carer, we need to know who the main informal carer is (name)
    if (isbFields.getMainInformalCarerName() == null) {
      missingFields.addMissingField("MainInformalCarerName", "In order to indicate the main informal carer's awareness of the prognosis, you must also include the name of the main informal carer");
    }
    // We also need to know when the prognosis awareness was recorded
    if (isbFields.getPrognosisAwarenessRecordedDate() == null) {
      missingFields.addMissingField("PrognosisAwarenessRecordedDate", "In order to indicate the main informal carer's awareness of the prognosis, you must also include the date this awareness was recorded");
    }
   
    if (missingFields.hasEntries()) {
      throw missingFields;
    }
   
    PrognosisAwareness template = new PrognosisAwareness();
   
View Full Code Here


    }

    AdvanceDecisionToRefuseTreatment template = new AdvanceDecisionToRefuseTreatment();
    template.setID(CDAUUID.generateUUIDString());
   
    MissingMandatoryFieldException missingFields = new MissingMandatoryFieldException();
    // Null checks for mandatory fields
    // If we have an ADRT, we need an effective time
    if (isbFields.getADRTRecordedDate() == null) {
      missingFields.addMissingField("ADRTRecordedDate", "If an ADRT is provided, the date this was recorded is also required");
    }
    // We also need to know where the ADRT documents are held
    if (isbFields.getADRTDocumentLocation() == null) {
      missingFields.addMissingField("ADRTDocumentLocation", "If an ADRT is provided, the location of the ADRT documentation is also required");
    }
   
    if (missingFields.hasEntries()) {
      throw missingFields;
    }
   
    // Time recorded
    template.setEffectiveTime(isbFields.getADRTRecordedDate());
View Full Code Here

  public static AnticipatoryMedicineBoxIssueProcedure createAMBox(EndOfLifeCareISBFields isbFields) throws MissingMandatoryFieldException {
    // If no anticipatory medication issued, skip this
    if (!isbFields.isAnticipatoryMedicinesIssued()) {
      return null;
    }
    MissingMandatoryFieldException missingFields = new MissingMandatoryFieldException();
    // Null checks for mandatory fields
    // If we have an anticipatory medicine box, we need a time issued
    if (isbFields.getAnticipatoryMedicinesDateIssued() == null) {
      missingFields.addMissingField("AnticipatoryMedicinesDateIssued", "If an anticipatory medicine box has been issued, the date it was issued is required");
    }
    // We also need to know where the ADRT documents are held
    if (isbFields.getAnticipatoryMedicinesLocation() == null) {
      missingFields.addMissingField("AnticipatoryMedicinesLocation", "If an anticipatory medicine box has been issued, the location of the box is required");
    }
    if (missingFields.hasEntries()) {
      throw missingFields;
    }
   
    AnticipatoryMedicineBoxIssueProcedure template = new AnticipatoryMedicineBoxIssueProcedure();
    template.setID(CDAUUID.generateUUIDString());
View Full Code Here

  public static DNACPRDecisionbySeniorResponsibleClinician createDNACPR(EndOfLifeCareISBFields isbFields) throws MissingMandatoryFieldException {
    // If no DNACPR Decision included, skip this
    if (isbFields.getDNACPR() == null) {
      return null;
    }
    MissingMandatoryFieldException missingFields = new MissingMandatoryFieldException();
    // Null checks for mandatory fields
    // If we have a DNACPR Decision, we also need a senior responsible clinician name
    if (isbFields.getSeniorResponsibleClinicianName() == null) {
      missingFields.addMissingField("SeniorResponsibleClinicianName", "If a DNACPR decision is included, the senior responsible clinician name is also required");
    }
    // We also need the senior responsible clinician org id
    if (isbFields.getSeniorResponsibleClinicianORGID() == null) {
      missingFields.addMissingField("SeniorResponsibleClinicianORGID", "If a DNACPR decision is included, the senior responsible clinician's organisation (ODS) ID is also required");
    }
    // We also need the senior responsible clinician org name
    if (isbFields.getSeniorResponsibleClinicianORGName() == null) {
      missingFields.addMissingField("SeniorResponsibleClinicianORGName", "If a DNACPR decision is included, the senior responsible clinician's organisation name is also required");
    }
    // We also need the date of the decision
    if (isbFields.getDNACPRDate() == null) {
      missingFields.addMissingField("DNACPRDate", "If a DNACPR decision is included, the date the decision was made is also required");
    }
    // We also need the date the decision was recorded
    if (isbFields.getDNACPRCreatedDate() == null) {
      missingFields.addMissingField("DNACPRCreatedDate", "If a DNACPR decision is included, the date the decision was originally recorded is also required");
    }
    if (missingFields.hasEntries()) {
      throw missingFields;
    }
   
    DNACPRDecisionbySeniorResponsibleClinician template = new DNACPRDecisionbySeniorResponsibleClinician();
View Full Code Here

  public static AuthoritytoLastingPowerofAttorney createLPA(EndOfLifeCareISBFields isbFields) throws MissingMandatoryFieldException {
    // If no DNACPR Decision included, skip this
    if (isbFields.getLPAAuthority() == null) {
      return null;
    }
    MissingMandatoryFieldException missingFields = new MissingMandatoryFieldException();
    // Null checks for mandatory fields
    // If we have an LPA authority we also need a name for the LPA
    if (isbFields.getLPAName() == null) {
      missingFields.addMissingField("LPAName", "If an LPA authority is included, the name of the LPA is also required");
    }
    if (isbFields.getLPADate() == null) {
      missingFields.addMissingField("LPADate", "If an LPA authority is included, the date the LPA was granted is also required");
    }
    if (missingFields.hasEntries()) {
      throw missingFields;
    }
   
    AuthoritytoLastingPowerofAttorney template = new AuthoritytoLastingPowerofAttorney();
    template.setID(CDAUUID.generateUUIDString());
View Full Code Here

    template.setPersonName(commonFields.getDataEntererName());
    return template;
  }
 
  public static CustodianOrganizationUniversal createCustodian(NonCodedCDACommonFields commonFields) throws MissingMandatoryFieldException {
    MissingMandatoryFieldException missingFields = new MissingMandatoryFieldException();
    // Null checks for mandatory fields
    if (commonFields.getCustodianODSCode() == null) {
      missingFields.addMissingField("custodianODSCode", "The ODS ID of the custodian organisation must be provided");
    }
    if (commonFields.getCustodianOrganisationName() == null) {
      missingFields.addMissingField("custodianOrganisationName", "The name of the custodian organisation must be provided");
    }
    if (missingFields.hasEntries()) {
      throw missingFields;
    }
   
    CustodianOrganizationUniversal template = new CustodianOrganizationUniversal();
   
View Full Code Here

   
    return template;
  }
 
  public static Recipient createRecipient(DocumentRecipient recipient) throws MissingMandatoryFieldException {
    MissingMandatoryFieldException missingFields = new MissingMandatoryFieldException();
    // Null checks for mandatory fields
    if (recipient.getRecipientName() == null) {
      missingFields.addMissingField("recipientName", "The name of the recipient must be provided");
    }
    if (recipient.getRecipientODSCode() == null) {
      missingFields.addMissingField("recipientODSCode", "The ODS Code for the organisation of the recipient must be provided");
    }
    if (recipient.getRecipientOrganisationName() == null) {
      missingFields.addMissingField("recipientOrganisationName", "The organisation name for the recipient must be provided");
    }
    if (missingFields.hasEntries()) {
      throw missingFields;
    }
   
    RecipientPersonUniversal template = new RecipientPersonUniversal();
   
View Full Code Here

   
    return template;
  }
 
  public static Participant createParticipant(NonCodedCDAParticipant participant) throws MissingMandatoryFieldException {
    MissingMandatoryFieldException missingFields = new MissingMandatoryFieldException();
    // No mandatory fields in this object
   
    DocumentParticipantUniversal template = new DocumentParticipantUniversal();
   
    // participantName
    if (participant.getParticipantName() != null) {
      template.setName(participant.getParticipantName());
    }
    // participantSDSID
    if (participant.getParticipantSDSID() != null) {
      template.addId(new PersonID()
                  .setType(PersonIDType.SDSID.code)
                  .setOID(participant.getParticipantSDSID()));
      if (participant.getParticipantSDSRoleID() == null) {
        missingFields.addMissingField("participantSDSRoleID", "If a participant SDS ID is provided, then an SDS Role ID must also be provided");
        throw missingFields;
      }
      // participantSDSRoleID
      template.addId(new PersonID()
                  .setType(PersonIDType.SDSRoleProfile.code)
View Full Code Here

     }
    return template;
  }
 
  public static PersonUniversal createAuthenticator(NonCodedCDACommonFields commonFields) throws MissingMandatoryFieldException {
    MissingMandatoryFieldException missingFields = new MissingMandatoryFieldException();
    // Null checks for mandatory fields
    if (commonFields.getAuthenticatorName() == null) {
      missingFields.addMissingField("authenticatorName", "The name of the authenticator must be provided");
    }
    if (commonFields.getAuthenticatorSDSID() == null) {
      missingFields.addMissingField("authenticatorSDSID", "The SDS ID for the authenticator must be provided");
    }
    if (commonFields.getAuthenticatorSDSRoleID() == null) {
      missingFields.addMissingField("authenticatorSDSRoleID", "The SDS Role ID for the authenticator must be provided");
    }
    if (missingFields.hasEntries()) {
      throw missingFields;
    }
   
    PersonUniversal template = new PersonUniversal();
   
View Full Code Here

   
    return template;
  }
 
  public static ServiceEvent createServiceEvent(NonCodedCDACommonFields commonFields) throws MissingMandatoryFieldException {
    MissingMandatoryFieldException missingFields = new MissingMandatoryFieldException();
    // Null checks for mandatory fields
    boolean from = commonFields.getEventEffectiveFromTime()!=null;
    boolean to = commonFields.getEventEffectiveToTime()!=null;
    boolean name = commonFields.getEventPerformerName()!=null;
    boolean ods = commonFields.getEventODSCode()!=null;
    boolean org = commonFields.getEventOrganisatioName()!=null;
   
    if ((name && ods && org) || (!name && !ods && !org))  {
      // OK
    } else {
      missingFields.addMissingField("eventPerformerName", "If an event performer is provided, the name, ODS code and organisation name must all be included");
    }
    if (commonFields.getEventType() == null) {
      missingFields.addMissingField("eventType", "If an event performer is provided, the type of event must also be included");
    }
    if (missingFields.hasEntries()) {
      throw missingFields;
    }
   
    ServiceEvent template = new ServiceEvent();
   
View Full Code Here

TOP

Related Classes of uk.nhs.interoperability.payloads.exceptions.MissingMandatoryFieldException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.