use of gov.ca.cwds.data.persistence.cms.LongText in project API by ca-cwds.
the class LongTextService method create.
/**
* {@inheritDoc}
*
* @see gov.ca.cwds.rest.services.CrudsService#create(gov.ca.cwds.rest.api.Request)
*/
@Override
public PostedLongText create(Request request) {
assert request instanceof gov.ca.cwds.rest.api.domain.cms.LongText;
gov.ca.cwds.rest.api.domain.cms.LongText longText = (gov.ca.cwds.rest.api.domain.cms.LongText) request;
try {
String lastUpdatedId = staffPersonIdRetriever.getStaffPersonId();
LongText managed = new LongText(CmsKeyIdGenerator.cmsIdGenertor(lastUpdatedId), longText, lastUpdatedId);
managed = longTextDao.create(managed);
return new PostedLongText(managed);
} catch (EntityExistsException e) {
LOGGER.info("LongText already exists : {}", longText);
throw new ServiceException(e);
}
}
use of gov.ca.cwds.data.persistence.cms.LongText in project API by ca-cwds.
the class LongTextService method update.
/**
* {@inheritDoc}
*
* @see gov.ca.cwds.rest.services.CrudsService#update(java.io.Serializable,
* gov.ca.cwds.rest.api.Request)
*/
@Override
public gov.ca.cwds.rest.api.domain.cms.LongText update(Serializable primaryKey, Request request) {
assert primaryKey instanceof String;
assert request instanceof gov.ca.cwds.rest.api.domain.cms.LongText;
gov.ca.cwds.rest.api.domain.cms.LongText longText = (gov.ca.cwds.rest.api.domain.cms.LongText) request;
try {
String lastUpdatedId = staffPersonIdRetriever.getStaffPersonId();
LongText managed = new LongText((String) primaryKey, longText, lastUpdatedId);
managed = longTextDao.update(managed);
return new gov.ca.cwds.rest.api.domain.cms.LongText(managed);
} catch (EntityNotFoundException e) {
LOGGER.info("LongText not found : {}", longText);
throw new ServiceException(e);
}
}
use of gov.ca.cwds.data.persistence.cms.LongText in project API by ca-cwds.
the class LongTextDaoIT method testUpdateEntityNotFoundException.
@Override
@Test
public void testUpdateEntityNotFoundException() throws Exception {
thrown.expect(EntityNotFoundException.class);
gov.ca.cwds.rest.api.domain.cms.LongText vdlt = validDomainLongText();
LongText longText = new LongText("ABC1234567", vdlt.getCountySpecificCode(), vdlt.getTextDescription());
longTextDao.update(longText);
}
use of gov.ca.cwds.data.persistence.cms.LongText in project API by ca-cwds.
the class LongTextDaoIT method testDelete.
/**
* Delete JUnit test
*/
@Override
@Test
public void testDelete() throws Exception {
LongText deleted = longTextDao.delete(id);
assertThat(deleted.getId(), is(id));
}
use of gov.ca.cwds.data.persistence.cms.LongText in project API by ca-cwds.
the class LongTextDaoIT method testDeleteEntityNotFoundException.
@Override
@Test
public void testDeleteEntityNotFoundException() throws Exception {
LongText deleted = longTextDao.delete("9999999ZZZ");
assertThat(deleted, is(nullValue()));
}
Aggregations