use of gov.ca.cwds.data.persistence.cms.Referral in project API by ca-cwds.
the class LACountyTrigger method createCountyTrigger.
/**
* @param object The object creates the county Trigger for the Referral and referralClient
* @return the countyTrigger created
*/
public boolean createCountyTrigger(Object object) {
Referral referral;
ReferralClient referralClient;
if (object instanceof Referral) {
referral = (Referral) object;
if (referral.getAllegesAbuseOccurredAtAddressId() != "" && referral.getAllegesAbuseOccurredAtAddressId() != null) {
CountyTrigger countyTrigger = new CountyTrigger(referral.getAllegesAbuseOccurredAtAddressId(), referral.getCountySpecificCode(), ADDRESS_COUNTYOWNERSHIP, null, Referral.class.getDeclaredAnnotation(Table.class).name());
countyTriggerDao.create(countyTrigger);
LOGGER.info("LA county referral address triggered");
}
}
if (object instanceof ReferralClient) {
referralClient = (ReferralClient) object;
if (referralClient.getClientId() != "" && referralClient.getClientId() != null) {
CountyTrigger countyTrigger = new CountyTrigger(referralClient.getClientId(), referralClient.getCountySpecificCode(), CLIENT_COUNTYOWNERSHIP, null, ReferralClient.class.getDeclaredAnnotation(Table.class).name());
countyTriggerDao.create(countyTrigger);
LOGGER.info("LA county referralClient triggered");
}
}
return true;
}
use of gov.ca.cwds.data.persistence.cms.Referral in project API by ca-cwds.
the class ReferralDaoIT method testFind.
@Override
@Test
public void testFind() throws Exception {
String id = "AbiQCgu0Hj";
Referral found = referralDao.find(id);
assertThat(found.getId(), is(id));
}
use of gov.ca.cwds.data.persistence.cms.Referral in project API by ca-cwds.
the class ReferralDaoIT method testUpdate.
@Override
@Test
public void testUpdate() throws Exception {
Referral referral = new Referral("AbiQCgu0Hj", " ", "N", "N", "D5YRVOm0Ht", (short) 122, " ", (Date) null, (short) 409, "", "", "L3H7sSC0Ht", "", "N", "N", (short) 1118, " ", "N", "N", (Date) null, "Verification (R3)", " ", (Date) null, (Date) null, (short) 1520, (short) 0, (Date) null, (Date) null, "", "", " ", " ", " ", "", "", "0Ht", "0Ht", "51", "N", "N", "N", "N", (Date) null, "C", (short) 0, (Date) null, "", (Date) null, null, null, null, null);
Referral updated = referralDao.update(referral);
assertThat(updated, is(referral));
}
use of gov.ca.cwds.data.persistence.cms.Referral in project API by ca-cwds.
the class ReferralDaoIT method testDelete.
@Override
@Test
public void testDelete() throws Exception {
String id = "AbiQCgu0Hj";
Referral deleted = referralDao.delete(id);
assertThat(deleted.getId(), is(id));
}
use of gov.ca.cwds.data.persistence.cms.Referral in project API by ca-cwds.
the class LACountyTriggerTest method createReferralCountyTriggerTest.
/*
* Test for checking the referral county trigger created with the FKAddress_T
*/
@SuppressWarnings("javadoc")
@Test
public void createReferralCountyTriggerTest() throws JsonParseException, JsonMappingException, IOException {
when(countyTriggerDao.find(any(String.class))).thenReturn(null);
gov.ca.cwds.rest.api.domain.cms.Referral validDomainReferral = MAPPER.readValue(fixture("fixtures/legacy/business/rules/laCountyTrigger/validReferral.json"), gov.ca.cwds.rest.api.domain.cms.Referral.class);
when(countyTriggerDao.create(any(CountyTrigger.class))).thenAnswer(new Answer<CountyTrigger>() {
@Override
public CountyTrigger answer(InvocationOnMock invocation) throws Throwable {
CountyTrigger report = (CountyTrigger) invocation.getArguments()[0];
countyTrigger = report;
return report;
}
});
Referral referral = new Referral("ABC1234567", validDomainReferral, "BTr");
laCountyTrigger.createCountyTrigger(referral);
assertThat(countyTrigger.getCountyTriggerEmbeddable().getCountyOwnershipT(), is(equalTo("1234567ABC")));
}
Aggregations