Search in sources :

Example 1 with ActualTimeRemovalException

use of com.artezio.arttime.exceptions.ActualTimeRemovalException in project ART-TIME by Artezio.

the class HourTypeRepository method remove.

@FacesMessage(onCompleteMessageKey = "message.hourTypeIsDeleted")
@WebCached(resetCache = true)
@Log(logParams = true)
public void remove(@DetailedLogged HourType hourType) throws ActualTimeRemovalException {
    if (hourType.isActualTime()) {
        throw new ActualTimeRemovalException("Attempt to delete an actual time.");
    }
    HourType type = entityManager.find(HourType.class, hourType.getId());
    entityManager.remove(type);
    entityManager.flush();
}
Also used : ActualTimeRemovalException(com.artezio.arttime.exceptions.ActualTimeRemovalException) HourType(com.artezio.arttime.datamodel.HourType) WebCached(com.artezio.arttime.admin_tool.cache.WebCached) Log(com.artezio.arttime.admin_tool.log.Log) FacesMessage(com.artezio.arttime.web.interceptors.FacesMessage)

Example 2 with ActualTimeRemovalException

use of com.artezio.arttime.exceptions.ActualTimeRemovalException in project ART-TIME by Artezio.

the class HourTypeRepository method remove.

@FacesMessage(onCompleteMessageKey = "message.hourTypeIsDeleted")
@WebCached(resetCache = true)
@Log(logParams = true)
public void remove(@DetailedLogged HourType hourType) throws ActualTimeRemovalException {
    if (hourType.isActualTime()) {
        throw new ActualTimeRemovalException("Attempt to delete an actual time.");
    }
    HourType type = entityManager.find(HourType.class, hourType.getId());
    entityManager.remove(type);
}
Also used : ActualTimeRemovalException(com.artezio.arttime.exceptions.ActualTimeRemovalException) HourType(com.artezio.arttime.datamodel.HourType) WebCached(com.artezio.arttime.admin_tool.cache.WebCached) Log(com.artezio.arttime.admin_tool.log.Log) FacesMessage(com.artezio.arttime.web.interceptors.FacesMessage)

Aggregations

WebCached (com.artezio.arttime.admin_tool.cache.WebCached)2 Log (com.artezio.arttime.admin_tool.log.Log)2 HourType (com.artezio.arttime.datamodel.HourType)2 ActualTimeRemovalException (com.artezio.arttime.exceptions.ActualTimeRemovalException)2 FacesMessage (com.artezio.arttime.web.interceptors.FacesMessage)2