Search in sources :

Example 1 with FacesMessage

use of com.artezio.arttime.web.interceptors.FacesMessage 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 FacesMessage

use of com.artezio.arttime.web.interceptors.FacesMessage 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)

Example 3 with FacesMessage

use of com.artezio.arttime.web.interceptors.FacesMessage in project ART-TIME by Artezio.

the class SettingsService method update.

@FacesMessage(onCompleteMessageKey = "message.settingsAreSaved")
public Settings update(Settings settings, String password) {
    PasswordService passwordService = new DefaultPasswordService();
    String encryptedPassword = passwordService.encryptPassword(password);
    settings.setAdminPassword(encryptedPassword);
    return update(settings);
}
Also used : DefaultPasswordService(org.apache.shiro.authc.credential.DefaultPasswordService) PasswordService(org.apache.shiro.authc.credential.PasswordService) DefaultPasswordService(org.apache.shiro.authc.credential.DefaultPasswordService) FacesMessage(com.artezio.arttime.web.interceptors.FacesMessage)

Example 4 with FacesMessage

use of com.artezio.arttime.web.interceptors.FacesMessage in project ART-TIME by Artezio.

the class ProjectRepository method remove.

@Log(logParams = true)
@FacesMessage(onCompleteMessageKey = "message.projectIsDeleted")
@WebCached(resetCache = true)
public void remove(@DetailedLogged Project project) {
    Project managedProject = entityManager.find(Project.class, project.getId());
    entityManager.remove(managedProject);
    entityManager.flush();
}
Also used : Project(com.artezio.arttime.datamodel.Project) WebCached(com.artezio.arttime.admin_tool.cache.WebCached) Log(com.artezio.arttime.admin_tool.log.Log) FacesMessage(com.artezio.arttime.web.interceptors.FacesMessage)

Aggregations

FacesMessage (com.artezio.arttime.web.interceptors.FacesMessage)4 WebCached (com.artezio.arttime.admin_tool.cache.WebCached)3 Log (com.artezio.arttime.admin_tool.log.Log)3 HourType (com.artezio.arttime.datamodel.HourType)2 ActualTimeRemovalException (com.artezio.arttime.exceptions.ActualTimeRemovalException)2 Project (com.artezio.arttime.datamodel.Project)1 DefaultPasswordService (org.apache.shiro.authc.credential.DefaultPasswordService)1 PasswordService (org.apache.shiro.authc.credential.PasswordService)1