Package fr.openwide.maven.artifact.notifier.core.business.user.model

Examples of fr.openwide.maven.artifact.notifier.core.business.user.model.EmailAddress


  private IModel<EmailAddress> emailAddressModel;
 
  public ConfirmEmailNotificationPage(PageParameters parameters) {
    super(parameters);
   
    EmailAddress emailAddress = LinkUtils.extractEmailFromHashPageParameter(emailAddressService, parameters, getApplication().getHomePage());
    emailAddressModel = new GenericEntityModel<Long, EmailAddress>(emailAddress);
   
    if (emailAddress.getStatus() != EmailStatus.PENDING_CONFIRM) {
      LOGGER.error("This email address is not pending for a confirmation");
      Session.get().error(getString("notification.email.confirm.wrongStatus"));

      redirect(getApplication().getHomePage());
      return;
View Full Code Here


 
  public DeleteEmailHtmlNotificationDemoPage(PageParameters parameters) {
    super(parameters);
   
    User user = userService.getByUserName(ConsoleNotificationIndexPage.DEFAULT_USERNAME);
    EmailAddress emailAddress = null;
    if (user != null) {
      emailAddress = Iterables.getFirst(user.getAdditionalEmails(), null);
    }
    if (user == null || emailAddress == null) {
      LOGGER.error("There is no user or email address available");
      Session.get().error(getString("console.notifications.noDataAvailable"));
     
      throw new RestartResponseException(ConsoleNotificationIndexPage.class);
    }

    if (emailAddress.getEmailHash() == null) {
      emailAddress.setEmailHash(userService.getHash(user, emailAddress.getEmail()));
    }
   
    add(new DeleteEmailHtmlNotificationPanel("htmlPanel", Model.of(emailAddress)));
  }
View Full Code Here

 
  public ConfirmEmailHtmlNotificationDemoPage(PageParameters parameters) {
    super(parameters);
   
    User user = userService.getByUserName(ConsoleNotificationIndexPage.DEFAULT_USERNAME);
    EmailAddress emailAddress = null;
    if (user != null) {
      emailAddress = Iterables.getFirst(user.getAdditionalEmails(), null);
    }
    if (user == null || emailAddress == null) {
      LOGGER.error("There is no user or email address available");
      Session.get().error(getString("console.notifications.noDataAvailable"));
     
      throw new RestartResponseException(ConsoleNotificationIndexPage.class);
    }

    if (emailAddress.getEmailHash() == null) {
      emailAddress.setEmailHash(userService.getHash(user, emailAddress.getEmail()));
    }
   
    add(new ConfirmEmailHtmlNotificationPanel("htmlPanel", Model.of(emailAddress)));
  }
View Full Code Here

  }
 
  public static EmailAddress extractEmailFromHashPageParameter(IEmailAddressService emailAddressService, PageParameters parameters,
      Class<? extends Page> redirectPageClass) {
    String hash = parameters.get(LinkUtils.HASH_PARAMETER).toString();
    EmailAddress emailAddress = emailAddressService.getByHash(hash);

    if (emailAddress == null) {
      LOGGER.error("Unable to get email address from hash");
      MavenArtifactNotifierSession.get().error(
          Application.get().getResourceSettings().getLocalizer().getString("common.error.noItem", null));
View Full Code Here

          private static final long serialVersionUID = -5179621361619239269L;
         
          @Override
          public void onClick(AjaxRequestTarget target) {
            try {
              EmailAddress email = item.getModelObject();
             
              if (email.getStatus() == EmailStatus.PENDING_CONFIRM) {
                userService.doDeleteEmailAddress(email);
                getSession().success(getString("profile.doDeleteEmail.success"));
              } else if (email.getStatus() == EmailStatus.VALIDATED) {
                userService.deleteEmailAddress(email);
                getSession().success(getString("profile.deleteEmail.success"));
              }
            } catch (Exception e) {
              LOGGER.error("Error occured while sending delete email notification", e);
View Full Code Here

  private IModel<EmailAddress> emailAddressModel;
 
  public DeleteEmailNotificationPage(PageParameters parameters) {
    super(parameters);
   
    EmailAddress emailAddress = LinkUtils.extractEmailFromHashPageParameter(emailAddressService, parameters, getApplication().getHomePage());
    emailAddressModel = new GenericEntityModel<Long, EmailAddress>(emailAddress);
   
    addBreadCrumbElement(new BreadCrumbElement(new ResourceModel("home.pageTitle"), HomePage.linkDescriptor()));
    addBreadCrumbElement(new BreadCrumbElement(new ResourceModel("notification.email.delete.pageTitle"), getPageClass(), parameters));
   
    add(new Label("pageTitle", new ResourceModel("notification.email.delete.pageTitle")));
   
    add(new Link<EmailAddress>("confirmLink", emailAddressModel) {
      private static final long serialVersionUID = 1L;

      @Override
      public void onClick() {
        EmailAddress emailAddress = getModelObject();
        try {
          userService.doDeleteEmailAddress(emailAddress);
          Session.get().success(getString("notification.email.delete.success"));
        } catch (Exception e) {
          LOGGER.error("Error occured while deleting email", e);
View Full Code Here

  @Override
  public boolean addEmailAddress(User user, String email) throws ServiceException, SecurityServiceException {
    String hash = getHash(user, email);

    if (emailAddressService.getByHash(hash) == null) {
      EmailAddress emailAddress = new EmailAddress(email);
      emailAddress.setEmailHash(hash);
      user.addAdditionalEmail(emailAddress);
      update(user);
     
      notificationService.sendConfirmEmailNotification(emailAddress);
      return true;
View Full Code Here

      LOGGER.error("There is no additional email address available");
      Session.get().error(getString("console.notifications.noDataAvailable"));
     
      throw new RestartResponseException(ConsoleNotificationIndexPage.class);
    }
    EmailAddress additionalEmail = emailAddresses.get(0);
   
    List<ArtifactVersionNotification> notifications = userService.listRecentNotifications(user);
   
    IModel<List<ArtifactVersionNotification>> notificationsModel = new ListModel<ArtifactVersionNotification>(notifications);
    add(new NewVersionsHtmlNotificationPanel("htmlPanel", notificationsModel,
View Full Code Here

TOP

Related Classes of fr.openwide.maven.artifact.notifier.core.business.user.model.EmailAddress

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.