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

Examples of fr.openwide.maven.artifact.notifier.core.business.artifact.model.FollowedArtifact


          private static final long serialVersionUID = 1L;
         
          @Override
          public void onClick(AjaxRequestTarget target) {
            try {
              FollowedArtifact followedArtifact = getModelObject();
              if (followedArtifact != null) {
                userService.unfollowArtifact(MavenArtifactNotifierSession.get().getUser(), followedArtifact);
                backupArtifactBeanModel.setObject(new ArtifactBean(followedArtifact));
                followedArtifactModel.setObject(null);
                target.add(DashboardArtifactPortfolioPanel.this);
                getSession().success(getString("artifact.delete.success"));
              } else {
                getSession().warn(getString("artifact.delete.notFollowed"));
              }
            } catch (Exception e) {
              LOGGER.error("Error occured while unfollowing artifact", e);
              Session.get().error(getString("common.error.unexpected"));
            }
            FeedbackUtils.refreshFeedback(target, getPage());
          }
         
          @Override
          protected void onConfigure() {
            super.onConfigure();
            FollowedArtifact followedArtifact = getModelObject();
            setVisible(followedArtifact != null);
          }
        };
        item.add(unfollow);
      }
View Full Code Here


         
          @Override
          public void onClick(AjaxRequestTarget target) {
            try {
              User user = UserArtifactsPanel.this.getModelObject();
              FollowedArtifact followedArtifact = getModelObject();
             
              userService.unfollowArtifact(user, followedArtifact);
              Session.get().success(getString("artifact.delete.success"));
            } catch (Exception e) {
              LOGGER.error("Error occured while unfollowing artifact", e);
View Full Code Here

          private static final long serialVersionUID = -5179621361619239269L;
         
          @Override
          public void onClick(AjaxRequestTarget target) {
            try {
              FollowedArtifact followedArtifact = FollowedArtifactNotificationRulesPanel.this.getModelObject();
              ArtifactNotificationRule rule = getModelObject();
             
              followedArtifactService.removeArtifactNotificationRule(followedArtifact, rule);
              Session.get().success(getString("artifact.rules.delete.success"));
            } catch (Exception e) {
              LOGGER.error("An error occured while removing the rule", e);
              Session.get().error(getString("artifact.rules.delete.error"));
            }
            target.add(getPage());
            FeedbackUtils.refreshFeedback(target, getPage());
          }
        });
      }
    };
    add(rulesListView);
   
    add(new WebMarkupContainer("emptyList") {
      private static final long serialVersionUID = 6700720373087584498L;

      @Override
      public void onConfigure() {
        super.onConfigure();
        setVisible(rulesListView.size() <= 0);
      }
    });
   
    // Add rule form
    final Form<Void> addRuleForm = new Form<Void>("addRuleForm");
    IModel<String> regexModel = Model.of();
    IModel<ArtifactNotificationRuleType> typeModel = Model.of(ArtifactNotificationRuleType.COMPLY);
   
    // Regex text field
    final TextField<String> regexTextField = new RequiredTextField<String>("regexInput", regexModel);
    regexTextField.setLabel(new ResourceModel("artifact.rules.field.regex"));
    regexTextField.add(new LabelPlaceholderBehavior());
    addRuleForm.add(regexTextField);
   
    // Type dropdown
    final ArtifactNotificationRuleTypeDropDownChoice typeDropDown = new ArtifactNotificationRuleTypeDropDownChoice("type", typeModel);
    typeDropDown.setRequired(true);
    addRuleForm.add(typeDropDown);
   
    addRuleForm.add(new AjaxSubmitLink("addRuleLink", addRuleForm) {
      private static final long serialVersionUID = 6935376642872117563L;
     
      @Override
      protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
        FollowedArtifact followedArtifact = FollowedArtifactNotificationRulesPanel.this.getModelObject();
        String regex = regexTextField.getModelObject();
        ArtifactNotificationRuleType type = typeDropDown.getModelObject();
       
        if (StringUtils.hasText(regex) && type != null) {
          try {
View Full Code Here

      private static final long serialVersionUID = 1L;
     
      @Override
      protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
        ArtifactNotificationRule rule = ArtifactNotificationRuleFormPopupPanel.this.getModelObject();
        FollowedArtifact followedArtifact = rule.getFollowedArtifact();
       
        if (StringUtils.hasText(rule.getRegex()) && rule.getType() != null) {
          try {
            if (artifactNotificationRuleService.isRuleValid(rule.getRegex())) {
             
View Full Code Here

    return userDao.countSearch(searchPattern);
  }
 
  @Override
  public FollowedArtifact followArtifact(User user, Artifact artifact) throws ServiceException, SecurityServiceException {
    FollowedArtifact followedArtifact = getFollowedArtifact(user, artifact);
    if (followedArtifact != null) {
      throw new AlreadyFollowedArtifactException();
    } else {
      followedArtifact = new FollowedArtifact(artifact);
      followedArtifactService.create(followedArtifact);
     
      artifact.setFollowersCount(artifact.getFollowersCount() + 1);
     
      user.addFollowedArtifact(followedArtifact);
View Full Code Here

    return true;
  }
 
  @Override
  public boolean unfollowArtifact(User user, Artifact artifact) throws ServiceException, SecurityServiceException {
    FollowedArtifact followedArtifact = getFollowedArtifact(user, artifact);
    if (followedArtifact == null) {
      return false;
    } else {
      return unfollowArtifact(user, followedArtifact);
    }
View Full Code Here

TOP

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

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.