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

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


      followedArtifact.setLastNotifiedVersionDate(new Date());
      followedArtifactService.update(followedArtifact);
      return Lists.newArrayListWithCapacity(0);
    }
   
    User follower = followedArtifact.getUser();
    List<ArtifactVersion> lastVersions = artifactService.listArtifactVersionsAfterDate
        (followedArtifact.getArtifact(), followedArtifact.getLastNotifiedVersionDate());
   
    List<ArtifactNotificationRule> rules = followedArtifactService.listArtifactNotificationRules(followedArtifact);
   
    List<ArtifactVersionNotification> notifications = Lists.newArrayList();
    for (ArtifactVersion version : lastVersions) {
      // Rules check
      if (!artifactNotificationRuleService.checkRulesForVersion(version.getVersion(), rules)) {
        continue;
      }
     
      ArtifactVersionNotification notification = new ArtifactVersionNotification(version);
      artifactVersionNotificationService.create(notification);
     
      follower.addNotification(notification);
      notifications.add(notification);
      if (followedArtifact.getLastNotifiedVersionDate().before(version.getLastUpdateDate())) {
        followedArtifact.setLastNotifiedVersionDate(version.getLastUpdateDate());
      }
    }
View Full Code Here


    }
   
    HttpServletRequest request = ((ServletWebRequest) RequestCycle.get().getRequest()).getContainerRequest();
    ClientAuthenticationToken token = (ClientAuthenticationToken) request.getSession().getAttribute(Pac4jAuthenticationUtils.AUTH_TOKEN_ATTRIBUTE);
   
    IModel<User> userModel = new GenericEntityModel<Long, User>(new User());
    userModel.getObject().setActive(false);
   
    if (token != null && token.getUserProfile() != null) {
      CommonProfile profile = (CommonProfile) token.getUserProfile();
      if (profile.getEmail() != null) {
        User user = userService.getByUserName(profile.getEmail());
        if (user != null) {
          LOGGER.warn("This email address is already used by another user");
          getSession().warn(getString("register.userName.notUnique"));
        }
      }
View Full Code Here

    item.add(new ClassAttributeAppender(new LoadableDetachableModel<String>() {
      private static final long serialVersionUID = 1L;
     
      @Override
      protected String load() {
        User user = MavenArtifactNotifierSession.get().getUser();
        boolean isFollowed = user != null && userService.isFollowedArtifact(user, item.getModelObject());
        boolean isDeprecated = artifactModel.getObject() != null &&
            ArtifactDeprecationStatus.DEPRECATED.equals(artifactModel.getObject().getDeprecationStatus());
        return isFollowed ? "success" : (isDeprecated ? "warning" : null);
      }
View Full Code Here

  private IModel<String> confirmPasswordModel;
 
  public ResetPasswordNotificationPage(PageParameters parameters) {
    super(parameters);
   
    User user = LinkUtils.extractUserFromHashPageParameter(userService, parameters, getApplication().getHomePage());
    userModel = new GenericEntityModel<Long, User>(user);
    passwordModel = Model.of();
    confirmPasswordModel = Model.of();

    addBreadCrumbElement(new BreadCrumbElement(new ResourceModel("home.pageTitle"), HomePage.linkDescriptor()));
    addBreadCrumbElement(new BreadCrumbElement(new ResourceModel("notification.resetPassword.pageTitle"), getPageClass(), parameters));
   
    add(new Label("pageTitle", new ResourceModel("notification.resetPassword.pageTitle")));
   
    Form<User> form = new Form<User>("form") {
      private static final long serialVersionUID = 1L;

      @Override
      protected void onSubmit() {
        try {
          User user = userModel.getObject();
          String passwordValue = passwordModel.getObject();
          String confirmPasswordValue = confirmPasswordModel.getObject();
         
          if (passwordValue != null && confirmPasswordValue != null) {
            userService.changePassword(user, passwordValue);
View Full Code Here

  private IUserService userService;
 
  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"));
     
View Full Code Here

     
      @Override
      protected void onConfigure() {
        super.onConfigure();
        Project project = getModelObject();
        User user = MavenArtifactNotifierSession.get().getUser();
       
        setVisible(user != null && project != null && !userService.isFollowedProject(user, project));
      }
     
      // XXX: Disabled for now
      @Override
      public boolean isVisible() {
        return false;
      }
    };
    follow.add(new AuthenticatedOnlyBehavior());
    add(follow);
   
    // Unfollow
    AjaxLink<Project> unfollow = new AjaxLink<Project>("unfollow", projectModel) {
      private static final long serialVersionUID = 1L;
     
      @Override
      public void onClick(AjaxRequestTarget target) {
        try {
          userService.unfollowProject(MavenArtifactNotifierSession.get().getUser(), getModelObject());
          target.add(getPage());
        } catch (Exception e) {
          LOGGER.error("Error occured while unfollowing project", e);
          getSession().error(getString("common.error.unexpected"));
        }
        FeedbackUtils.refreshFeedback(target, getPage());
      }
     
      @Override
      protected void onConfigure() {
        super.onConfigure();
        Project project = getModelObject();
        User user = MavenArtifactNotifierSession.get().getUser();
       
        setVisible(user != null && project != null && userService.isFollowedProject(user, project));
      }
     
      // XXX: Disabled for now
View Full Code Here

  private IUserService userService;
 
  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"));
     
View Full Code Here

    }
    if (!line.containsKey(AUDIT_SUMMARY_LAST_EDIT_DATE_FIELD_NAME)) {
      line.put(AUDIT_SUMMARY_LAST_EDIT_DATE_FIELD_NAME, creationDate);
    }

    User creationAuthor = userService.getAuthenticatedUser();
    if (!line.containsKey(AUDIT_SUMMARY_CREATION_AUTHOR_FIELD_NAME)) {
      line.put(AUDIT_SUMMARY_CREATION_AUTHOR_FIELD_NAME, creationAuthor);
    }
    if (!line.containsKey(AUDIT_SUMMARY_LAST_EDIT_AUTHOR_FIELD_NAME)) {
      line.put(AUDIT_SUMMARY_LAST_EDIT_AUTHOR_FIELD_NAME, creationAuthor);
View Full Code Here

  private IUserService userService;
 
  public ResetPasswordHtmlNotificationDemoPage(PageParameters parameters) {
    super(parameters);

    User user = userService.getByUserName(ConsoleNotificationIndexPage.DEFAULT_USERNAME);
    if (user == null) {
      LOGGER.error("There is no user available");
      Session.get().error(getString("console.notifications.noDataAvailable"));
     
      throw new RestartResponseException(ConsoleNotificationIndexPage.class);
    }
    user.setNotificationHash(userService.getHash(user, user.getPasswordHash()));
   
    add(new ResetPasswordHtmlNotificationPanel("htmlPanel", Model.of(user)));
    user.setNotificationHash(null);
  }
View Full Code Here

      private static final long serialVersionUID = 1L;

      @Override
      protected void onConfigure() {
        super.onConfigure();
        User user = userModel.getObject();
        if (user != null) {
          setVisible(AuthenticationType.LOCAL.equals(user.getAuthenticationType()));
        }
      }
    };
    changeUserPassword.add(new AjaxModalOpenBehavior(changePasswordPanel, MouseEvent.CLICK) {
      private static final long serialVersionUID = -7179264122322968921L;
     
      @Override
      protected void onShow(AjaxRequestTarget target) {
      }
    });
    add(changeUserPassword);
   
    // Enable user link
    add(new Link<User>("enableUser", userModel) {
      private static final long serialVersionUID = 6157423807032594861L;
     
      @Override
      public void onClick() {
        try {
          userService.setActive(getModelObject(), true);
          getSession().success(getString("administration.user.enable.success"));
        } catch (Exception e) {
          LOGGER.error("Error occured while enabling user", e);
          getSession().error(getString("common.error"));
        }
      }
     
      @Override
      protected void onConfigure() {
        super.onConfigure();
        setVisible(!getModelObject().isActive());
      }
    });
   
    // Disable user link
    IModel<String> confirmationTextModel = new StringResourceModel(
        "administration.user.disable.confirmation.text", null,
        new Object[] { userModel.getObject().getDisplayName() }
    );
   
    add(new AjaxConfirmLink<User>("disableUser", userModel,
        new ResourceModel("administration.user.disable.confirmation.title"),
        confirmationTextModel,
        new ResourceModel("common.confirm"),
        new ResourceModel("common.cancel"),
        null, false) {
      private static final long serialVersionUID = 6157423807032594861L;
     
      @Override
      public void onClick(AjaxRequestTarget target) {
        try {
          userService.setActive(getModelObject(), false);
          getSession().success(getString("administration.user.disable.success"));
        } catch (Exception e) {
          LOGGER.error("Error occured while disabling user", e);
          getSession().error(getString("common.error"));
        }
        target.add(getPage());
        FeedbackUtils.refreshFeedback(target, getPage());
      }
     
      @Override
      protected void onConfigure() {
        super.onConfigure();
        User displayedUser = getModelObject();
        User currentUser = MavenArtifactNotifierSession.get().getUser();
        setVisible(!displayedUser.equals(currentUser) && displayedUser.isActive());
      }
    });
  }
View Full Code Here

TOP

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

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.