public String removeFromAlbum() throws Exception { AlbumImagesBean aib = (AlbumImagesBean) BeanHelper.getSessionBean(AlbumImagesBean.class); AlbumController ac = new AlbumController(sessionBean.getUser()); aib.getAlbum().getAlbum().getImages().remove(image.getId()); ac.update(aib.getAlbum().getAlbum()); if (getIsInActiveAlbum()) sessionBean.getActiveAlbum().getAlbum().getImages().remove(image.getId()); BeanHelper.info( sessionBean.getLabel("image") + " " + image.getFilename() + " " + sessionBean.getMessage("success_album_remove_from")); return "pretty:"; }
public String addToActiveAlbum() throws Exception { AlbumBean activeAlbum = sessionBean.getActiveAlbum(); AlbumController ac = new AlbumController(sessionBean.getUser()); if (activeAlbum.getAlbum().getImages().contains(image.getId())) { BeanHelper.error( ((SessionBean) BeanHelper.getSessionBean(SessionBean.class)).getLabel("image") + " " + image.getFilename() + " " + ((SessionBean) BeanHelper.getSessionBean(SessionBean.class)) .getMessage("already_in_active_album")); } else { activeAlbum.getAlbum().getImages().add(image.getId()); ac.update(activeAlbum.getAlbum()); BeanHelper.info( ((SessionBean) BeanHelper.getSessionBean(SessionBean.class)).getLabel("image") + " " + image.getFilename() + " " + ((SessionBean) BeanHelper.getSessionBean(SessionBean.class)) .getMessage("added_to_active_album")); } return ""; }