public ImageBean() throws Exception { image = new Image(); sessionBean = (SessionBean) BeanHelper.getSessionBean(SessionBean.class); navigation = (Navigation) BeanHelper.getApplicationBean(Navigation.class); prettyLink = "pretty:editImage"; labels = (MetadataLabels) BeanHelper.getSessionBean(MetadataLabels.class); }
public String select() { if (!selected) { ((SessionBean) BeanHelper.getSessionBean(SessionBean.class)) .getSelected() .remove(image.getId()); } else { ((SessionBean) BeanHelper.getSessionBean(SessionBean.class)).getSelected().add(image.getId()); } return ""; }
public void loadImage() { try { image = ObjectLoader.loadImage(ObjectHelper.getURI(Image.class, id), sessionBean.getUser()); } catch (NotFoundException e) { image = new Image(); BeanHelper.error( sessionBean.getLabel("image") + " " + id + sessionBean.getLabel("not_found")); } catch (Exception e) { BeanHelper.error(sessionBean.getMessage("error_image_load")); logger.error(sessionBean.getMessage("error_image_load"), e); } }
public ImageBean(Image img) throws Exception { image = img; sessionBean = (SessionBean) BeanHelper.getSessionBean(SessionBean.class); navigation = (Navigation) BeanHelper.getApplicationBean(Navigation.class); prettyLink = "pretty:editImage"; labels = (MetadataLabels) BeanHelper.getSessionBean(MetadataLabels.class); if (sessionBean.getSelected().contains(image.getId())) { setSelected(true); } loadProfile(); removeDeadMetadata(); sortMetadataAccordingtoProfile(); }
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 void loadProfile() { try { profile = sessionBean.getProfileCached().get(image.getMetadataSet().getProfile()); if (profile == null) { profile = ObjectLoader.loadProfile(image.getMetadataSet().getProfile(), sessionBean.getUser()); } if (profile == null) { profile = new MetadataProfile(); } } catch (Exception e) { BeanHelper.error( sessionBean.getMessage("error_profile_load") + " " + image.getMetadataSet().getProfile() + " " + sessionBean.getLabel("of") + " " + image.getId()); profile = new MetadataProfile(); logger.error( "Error load profile " + image.getMetadataSet().getProfile() + " of image " + image.getId(), e); } }
public void loadCollection() { try { collection = ObjectLoader.loadCollection(getImage().getCollection(), sessionBean.getUser()); } catch (Exception e) { BeanHelper.error(e.getMessage()); e.printStackTrace(); collection = null; } }
public String getEmailSubject(boolean newAccount) { SessionBean session = (SessionBean) BeanHelper.getSessionBean(SessionBean.class); String emailsubject = ""; if (newAccount) { emailsubject = session.getMessage("email_new_user_subject"); } else { emailsubject = session.getMessage("email_new_password_subject"); } return emailsubject; }
private String getEmailMessage( String password, String email, String username, String message_bundle) { Navigation navigation = (Navigation) BeanHelper.getApplicationBean(Navigation.class); SessionBean session = (SessionBean) BeanHelper.getSessionBean(SessionBean.class); String userPage = navigation.getApplicationUrl() + "user?id=" + email; String emailMessage = session.getMessage(message_bundle); if ("email_new_user".equals(message_bundle)) { emailMessage = emailMessage.replace("XXX_LINK_TO_APPLICATION_XXX", navigation.getApplicationUrl()); } emailMessage = emailMessage .replace("XXX_USER_NAME_XXX,", username) .replace("XXX_LOGIN_XXX", email) .replace("XXX_PASSWORD_XXX", password) .replace("XXX_LINK_TO_USER_PAGE_XXX", userPage); return emailMessage; }
public void selectedChanged(ValueChangeEvent event) { sessionBean = (SessionBean) BeanHelper.getSessionBean(SessionBean.class); if (event.getNewValue().toString().equals("true") && !sessionBean.getSelected().contains(image.getId())) { setSelected(true); select(); } else if (event.getNewValue().toString().equals("false") && sessionBean.getSelected().contains(image.getId())) { setSelected(false); select(); } }
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 ""; }
private String getBundle(String messageBundle) { SessionBean session = (SessionBean) BeanHelper.getSessionBean(SessionBean.class); return session.getMessage(messageBundle); }
public boolean getSelected() { sessionBean = (SessionBean) BeanHelper.getSessionBean(SessionBean.class); if (image != null && sessionBean.getSelected().contains(image.getId())) selected = true; else selected = false; return selected; }
public void initBrowsing() { browse = new SingleImageBrowse((ImagesBean) BeanHelper.getSessionBean(ImagesBean.class), image); }