use of gov.ca.cwds.data.persistence.cms.CountyTrigger in project API by ca-cwds.
the class LACountyTrigger method createClientAddressCountyTrigger.
/**
* @param object The object creates the county Trigger for the clientAddress
* @return the CountyTrigger created
*/
public boolean createClientAddressCountyTrigger(Object object) {
ClientAddress clientAddress;
if (object instanceof ClientAddress) {
clientAddress = (ClientAddress) object;
if (clientAddress.getFkClient() != "" && clientAddress.getFkClient() != null && clientAddress.getFkAddress() != "" && clientAddress.getFkAddress() != null) {
CountyTrigger countyTrigger1 = new CountyTrigger(clientAddress.getFkClient(), LA_COUNTY_SPECIFIC_CODE, CLIENT_COUNTYOWNERSHIP, new Date(), ClientAddress.class.getDeclaredAnnotation(Table.class).name());
CountyTrigger countyTrigger2 = new CountyTrigger(clientAddress.getFkAddress(), LA_COUNTY_SPECIFIC_CODE, ADDRESS_COUNTYOWNERSHIP, new Date(), ClientAddress.class.getDeclaredAnnotation(Table.class).name());
countyTriggerDao.create(countyTrigger1);
countyTriggerDao.create(countyTrigger2);
}
LOGGER.info("LA county clientAddress triggered");
}
return true;
}
use of gov.ca.cwds.data.persistence.cms.CountyTrigger 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.CountyTrigger in project API by ca-cwds.
the class CountyTriggerDaoIT method testDelete.
@Override
@Test
public void testDelete() throws Exception {
String timestamp = "2017-05-23 19:53:50.505";
CountyTriggerEmbeddable countyTriggerEmbeddable = new CountyTriggerEmbeddable(countyOwnershipT, null);
DateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS");
Date date = formatter.parse(timestamp);
countyTriggerEmbeddable.setIntegratorTimeStamp(date);
CountyTrigger deleted = countyTriggerDao.delete(countyTriggerEmbeddable);
assertThat(deleted.getCountyTriggerEmbeddable().getCountyOwnershipT(), is(countyOwnershipT));
}
use of gov.ca.cwds.data.persistence.cms.CountyTrigger in project API by ca-cwds.
the class CountyTriggerDaoIT method testFind.
@Override
@Test
public void testFind() throws Exception {
String timestamp = "2017-05-23 19:53:50.505";
CountyTriggerEmbeddable countyTriggerEmbeddable = new CountyTriggerEmbeddable(countyOwnershipT, null);
DateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS");
Date date = formatter.parse(timestamp);
countyTriggerEmbeddable.setIntegratorTimeStamp(date);
CountyTrigger found = countyTriggerDao.find(countyTriggerEmbeddable);
assertThat(found.getCountyTriggerEmbeddable().getCountyOwnershipT(), is(equalTo(countyOwnershipT)));
}
use of gov.ca.cwds.data.persistence.cms.CountyTrigger in project API by ca-cwds.
the class CountyTriggerDaoIT method testDeleteEntityNotFoundException.
@Override
@Test
public void testDeleteEntityNotFoundException() throws Exception {
CountyTriggerEmbeddable countyTriggerEmbeddable = new CountyTriggerEmbeddable("ABC1234568", null);
CountyTrigger deleted = countyTriggerDao.delete(countyTriggerEmbeddable);
assertThat(deleted, is(nullValue()));
}
Aggregations