Some evidence entities contain one or more case participant role fields. These are foreign keys to the Case Participant Role entity. When this evidence is broadcast to one or more target cases, the evidence will initially be inserted with the case participant roles of the source case. These must be handled by specialized code in the transferEvidence Evidence Interface function so these fields are updated with case participant roles on the target case. An example of such code is shown below:
// ____________________________________________________________ /* * Method that does any entity adjustments for moving the * evidence record to a new caseID * * @param details Contains the evidenceID / evidenceType * pairings of the evidence to be transferred * @param fromCaseKey The case from which the evidence is being * transferred * @param toCaseKey The case to which the evidence is being * transferred */ public void transferEvidence(EvidenceTransferDetails details, CaseHeaderKey fromCaseKey, CaseHeaderKey toCaseKey) throws AppException, InformationalException { EIEvidenceKey key = new EIEvidenceKey(); CaseParticipantRoleKey caseParticipantRoleKey = new CaseParticipantRoleKey(); CaseParticipantRoleDtls caseParticipantRoleDtls; CaseIDParticipantRoleKey caseIDParticipantRoleKey = new CaseIDParticipantRoleKey(); CaseParticipantRoleDtlsList caseParicipantRoleDtlsList; CaseParticipantRole caseParticipantRoleObj = CaseParticipantRoleFactory.newInstance(); // Read the "from" Evidence entity details key.evidenceID = details.fromEvidenceID; key.evidenceType = details.fromEvidenceType; fromClaimParticipantDtls = (ClaimParticipantDtls)readEvidence(key); // Read the "to" evidence entity details key.evidenceID = details.toEvidenceID; key.evidenceType = details.toEvidenceType; toClaimParticipantDtls = (ClaimParticipantDtls)readEvidence(key); // Get the case participant details curam.core.sl.intf.CaseParticipantRole caseParticipantServiceLayerObj = curam.core.sl.fact.CaseParticipantRoleFactory.newInstance(); CaseParticipantRoleDetails caseParticipantRoleDetails = new CaseParticipantRoleDetails(); caseParticipantRoleDetails.dtls.caseID = toCaseKey.caseID; caseIDParticipantRoleKey.caseID = toCaseKey.caseID; caseParticipantRoleDetails.dtls.fromDate = Date.getCurrentDate(); caseParticipantRoleDetails.dtls.recordStatus = RECORDSTATUS.NORMAL; if (fromClaimParticipantDtls.caseParticipantRoleID != 0L) { // Find the ParticipantRoleID by using the existing // CaseParticipantRoleID caseParticipantRoleKey.caseParticipantRoleID = fromClaimParticipantDtls.caseParticipantRoleID; caseParticipantRoleDtls = caseParticipantRoleObj.read(caseParticipantRoleKey); // Need to search for the CaseParticipantRole that have the // to CaseID and the existing ParicipantRoleID. There should // only be one. caseIDParticipantRoleKey.participantRoleID = caseParticipantRoleDtls.participantRoleID; caseParticipantRoleDtlsList = caseParticipantRoleObj.searchByParticipantRoleAndCase( caseIDParticipantRoleKey); caseParticipantRoleDetails.dtls.participantRoleID = caseParticipantRoleDtls.participantRoleID; // If the list is empty, it means the participant to whom the // evidence belongs is not a CPR on the toCase if (caseParticipantRoleDtlsList.dtls.isEmpty()) { // never create a PRIMARY in transferEvidence if (caseParticipantRoleDtls.typeCode.equals( CASEPARTICIPANTROLETYPE.PRIMARY)) { caseParticipantRoleDetails.dtls.typeCode = CASEPARTICIPANTROLETYPE.MEMBER; } else { // use the 'from' type caseParticipantRoleDetails.dtls.typeCode = caseParticipantRoleDtls.typeCode; } // Create a new record caseParticipantServiceLayerObj.insertCaseParticipantRole( caseParticipantRoleDetails); toClaimParticipantDtls.caseParticipantRoleID = caseParticipantRoleDetails.dtls.caseParticipantRoleID; } else { // MEMBER takes precedence if (fromClaimParticipantDtls.caseParticipantRoleID == toClaimParticipantDtls.caseParticipantRoleID) { for (int i = 0; i < caseParticipantRoleDtlsList.dtls.size(); i++) { if (caseParticipantRoleDtlsList.dtls.item( i).typeCode.equals(CASEPARTICIPANTROLETYPE.MEMBER) || caseParticipantRoleDtlsList.dtls.item( i).typeCode.equals(CASEPARTICIPANTROLETYPE.PRIMARY)) { toClaimParticipantDtls.caseParticipantRoleID = caseParticipantRoleDtlsList.dtls.item( i).caseParticipantRoleID; break; } } } // If there are still no matches, use the MEMBER type to // create a new record if (fromClaimParticipantDtls.caseParticipantRoleID == toClaimParticipantDtls.caseParticipantRoleID) { caseParticipantRoleDetails.dtls.typeCode = CASEPARTICIPANTROLETYPE.MEMBER; caseParticipantServiceLayerObj.insertCaseParticipantRole( caseParticipantRoleDetails); toClaimParticipantDtls.caseParticipantRoleID = caseParticipantRoleDetails.dtls.caseParticipantRoleID; } } } claimparticipantKey.evidenceID = details.toEvidenceID; modify(claimparticipantKey, toClaimParticipantDtls); }