Examples of UserFilter


Examples of com.dotmarketing.portlets.userfilter.model.UserFilter

          HibernateUtil.saveOrUpdate(childCampaign);

          MailingList ml = (MailingList) InodeFactory.getChildOfClass(c, MailingList.class);
          HTMLPage page = (HTMLPage) InodeFactory.getChildOfClass(c, HTMLPage.class);
          Communication comm = (Communication) InodeFactory.getChildOfClass(c, Communication.class);
          UserFilter userfilter = (UserFilter) InodeFactory.getChildOfClass(c, UserFilter.class);

          if(InodeUtils.isSet(ml.getInode())){
            relationshipAPI.addRelationship(childCampaign.getInode(), ml.getInode(), "child");
          }
          if(InodeUtils.isSet(page.getInode())){
            relationshipAPI.addRelationship(childCampaign.getInode(), page.getInode(), "child");
          }
          if (InodeUtils.isSet(comm.getInode())) {
            relationshipAPI.addRelationship(childCampaign.getInode(), comm.getInode(), "child");
          }
          if (InodeUtils.isSet(userfilter.getInode())) {
            relationshipAPI.addRelationship(childCampaign.getInode(), userfilter.getInode(), "child");
          }
          HibernateUtil.saveOrUpdate(childCampaign);


          campaigns.add(childCampaign);



          c.setLocked(false);
        }
        catch (Exception ex) {
          Logger.debug(this, ex.getMessage());
        }
      }
    }
    else {
      //get a list of waiting queues
      campaigns = CampaignFactory.getWaitingCampaigns();
    }

    StringBuffer message = null;

    if (campaigns.size() == 0)
    {
      campaigns = null;
      return;
    }

    try {

      Logger.debug(DeliverCampaignThread.class, "GOING to deliver campaigns");
      Iterator<Campaign> campIter = campaigns.iterator();
     
      //### LOOP THE CAMPAIGNS ###
      while (campIter.hasNext())
      {
        //Obtain the campaign
        Campaign c = (Campaign) campIter.next();
        Communication comm = (Communication) InodeFactory.getChildOfClass(c, Communication.class);
       
        if ((comm == null) || (!InodeUtils.isSet(comm.getInode()))) {
          Logger.info(DeliverCampaignThread.class, "I didn't find a communication for campaign inode=" + c.getInode());
         
          c.setCompletedDate(new java.util.Date());
          c.setLocked(false);
          message = null;
          HibernateUtil.saveOrUpdate(c);
         
          continue;
        }

        Logger.debug(DeliverCampaignThread.class, "got campaign:" + c.getTitle());
        //Mailing list
        String campaingSendTo = c.getSendTo();

        MailingList ml = null;
        UserFilter uf = null;
        List<UserProxy> subscribers =  null;
        if ((campaingSendTo != null) && campaingSendTo.equalsIgnoreCase("mailingList")) {
          ml = (MailingList) InodeFactory.getChildOfClass(c,MailingList.class);
          if (!InodeUtils.isSet(ml.getInode()))
          {
            Logger.info(DeliverCampaignThread.class, "I didn't find a mailing list for campaign inode=" + c.getInode());
           
            c.setCompletedDate(new java.util.Date());
            c.setLocked(false);
            message = null;
            HibernateUtil.saveOrUpdate(c);
           
            continue;
          }
          else
          {
            Logger.debug(DeliverCampaignThread.class, "got mailingList:" + ml.getTitle());
            //Get the subscribers
            subscribers = MailingListFactory.getMailingListSubscribers(ml);
            Logger.debug(DeliverCampaignThread.class, "Got subscribers:" + subscribers.size());
          }
        }
        else if ((campaingSendTo != null) && campaingSendTo.equalsIgnoreCase("userFilter")) {
          uf = (UserFilter) InodeFactory.getChildOfClass(c,UserFilter.class);
          if (!InodeUtils.isSet(uf.getInode()))
          {
            Logger.info(DeliverCampaignThread.class, "I didn't find an user filter for campaign inode=" + c.getInode());
           
            c.setCompletedDate(new java.util.Date());
            c.setLocked(false);
            message = null;
            HibernateUtil.saveOrUpdate(c);
           
            continue;
          }
          else
          {
            Logger.debug(DeliverCampaignThread.class, "got user filter:" + uf.getUserFilterTitle());
            //Get the subscribers
            try {
              subscribers = UserFilterFactory.getUserProxiesFromFilter(uf);
            }
            catch (Exception e) {
View Full Code Here

Examples of com.dotmarketing.portlets.userfilter.model.UserFilter

  private void _save(ActionForm form, ActionRequest req, ActionResponse res)
  throws Exception {
    User user = _getUser(req);
    PermissionAPI perAPI = APILocator.getPermissionAPI();
    UserManagerListSearchForm mlForm = (UserManagerListSearchForm) form;
    UserFilter uf;
    if (InodeUtils.isSet(mlForm.getUserFilterListInode())) {
      uf = (UserFilter) InodeFactory.getInode(mlForm.getUserFilterListInode(), UserFilter.class);

      //removing permissions on the user filter\
      perAPI.removePermissions(uf);
    }
    else {
      uf = new UserFilter();
    }

    BeanUtils.copyProperties(uf, mlForm);
    uf.setCategories(mlForm.getCategoriesStr());
    HibernateUtil.startTransaction();
    HibernateUtil.saveOrUpdate(uf);
    HibernateUtil.commitTransaction();

    // read permission
    String[] readPermissions = req.getParameterValues("readRole");
    // write permission
    String[] writePermissions = req.getParameterValues("writeRole");
    //adding roles to user filter
    Permission permission = null;
    if (readPermissions != null) {
      for (int n = 0; n < readPermissions.length; n++) {
        permission = new Permission(uf.getInode(), readPermissions[n], PERMISSION_READ);
        perAPI.save(permission, uf, user, false);
      }
    }

    if (writePermissions != null) {
      for (int n = 0; n < writePermissions.length; n++) {
        permission = new Permission(uf.getInode(), writePermissions[n],  PERMISSION_WRITE);
        perAPI.save(permission, uf, user, false);
      }
    }
    mlForm.setUserFilterListInode(uf.getInode());
    SessionMessages.add(req, "message", "message.userfilter.save");
  }
View Full Code Here

Examples of com.dotmarketing.portlets.userfilter.model.UserFilter

    if (!InodeUtils.isSet(inode)) {
      inode = searchForm.getUserFilterListInode();
    }
   
    if (InodeUtils.isSet(inode)) {
      UserFilter uf = UserFilterFactory.getUserFilter(inode);
 
      searchForm.setUserFilterListInode(inode);
 
      BeanUtils.copyProperties(searchForm, uf);
      searchForm.setCategories(uf.getCategoriesArray());
    }
  }
View Full Code Here

Examples of com.dotmarketing.portlets.userfilter.model.UserFilter

  //Deleting User Filter
  private void _deleteUserFilter(ActionForm form, ActionRequest req, ActionResponse res)
  throws Exception {
    UserManagerListSearchForm mlForm = (UserManagerListSearchForm) form;
    UserFilter uf;
    if (InodeUtils.isSet(mlForm.getUserFilterListInode())) {
      uf = (UserFilter) InodeFactory.getInode(mlForm.getUserFilterListInode(), UserFilter.class);

      //removing permissions on the user filter
      PermissionAPI perAPI = APILocator.getPermissionAPI();
View Full Code Here

Examples of com.dotmarketing.portlets.userfilter.model.UserFilter

      }
     
      StringTokenizer ids = new StringTokenizer(mailingListIds, ",");
      String mailingListId;
      MailingList mailingList;
      UserFilter userFilter;
     
      while(ids.hasMoreTokens()) {
        mailingListId = ids.nextToken();
        mailingList = MailingListFactory.getMailingListsByInode(mailingListId);
       
        if (UtilMethods.isSet(mailingList.getInode())) {
          if (mailingList.getUserId().equals(user.getUserId()) || MailingListFactory.isMailingListAdmin(user)) {
          InodeFactory.deleteInode(mailingList);
          SessionMessages.add(req, "message", "message.mailinglist.delete");
        } else {
          SessionMessages.add(req, "message", "message.mailinglist.cannotEdit");
        }
        } else {
          userFilter = UserFilterFactory.getUserFilter(mailingListId);
          if (userFilter.getOwner().equals(user.getUserId()) || MailingListFactory.isMailingListAdmin(user)) {
          InodeFactory.deleteInode(userFilter);
          SessionMessages.add(req, "message", "message.mailinglist.delete");
        } else {
          SessionMessages.add(req, "message", "message.mailinglist.cannotEdit");
        }
View Full Code Here

Examples of com.dotmarketing.portlets.userfilter.model.UserFilter

      if (InodeUtils.isSet(page.getInode())) {
        cfform.setHtmlPage(page.getInode());
        cfform.setSelectedHtmlPage(page.getTitle());
      }

      UserFilter uf = (UserFilter) InodeFactory.getChildOfClass(c, UserFilter.class);
      cfform.setUserFilterInode(uf.getInode());
    }
    else {
      cfform.setMailingList(null);
      cfform.setHtmlPage(null);
      cfform.setCommunicationInode(null);
View Full Code Here

Examples of com.dotmarketing.portlets.userfilter.model.UserFilter

      if (InodeUtils.isSet(comm.getInode())) {
        c.addChild(comm);
      }

      // wipe the old user filter that was the child
      UserFilter userfilter = (UserFilter) InodeFactory.getChildOfClass(c, UserFilter.class);
      c.deleteChild(userfilter);

      //try to get the campaign's new communication
      userfilter = (UserFilter) InodeFactory.getInode(String.valueOf(cfform.getUserFilterInode()), UserFilter.class);
      if (InodeUtils.isSet(userfilter.getInode())) {
        c.addChild(userfilter);
      }

      c.setUserId(user.getUserId());
View Full Code Here

Examples of com.dotmarketing.portlets.userfilter.model.UserFilter

    Campaign c = (Campaign) req.getAttribute(WebKeys.CAMPAIGN_EDIT);
    MailingList ml = (MailingList) InodeFactory.getChildOfClass(c, MailingList.class);
    HTMLPage page = (HTMLPage) InodeFactory.getChildOfClass(c, HTMLPage.class);
    Communication comm = (Communication) InodeFactory.getChildOfClass(c, Communication.class);
    UserFilter userfilter = (UserFilter) InodeFactory.getChildOfClass(c, UserFilter.class);

    Campaign copy = CampaignFactory.newInstance();

    copy.setTitle( c.getTitle() + " (copy)");
    copy.setFromEmail(c.getFromEmail());
    copy.setFromName(c.getFromName());
    copy.setCStartDate(c.getCStartDate());
    copy.setSubject(c.getSubject());
    copy.setMessage(c.getMessage());
    copy.setOwner(c.getOwner());
    copy.setUserId(c.getUserId());
    copy.setCommunicationInode(c.getCommunicationInode());
    copy.setUserFilterInode(c.getUserFilterInode());

    //no sure if this is needed
    HibernateUtil.saveOrUpdate(copy);

    if(InodeUtils.isSet(ml.getInode())){
      copy.addChild(ml);
    }
    if(InodeUtils.isSet(page.getInode())){
      copy.addChild(page);
    }
    if (InodeUtils.isSet(comm.getInode())) {
      copy.addChild(comm);
    }
    if (InodeUtils.isSet(userfilter.getInode())) {
      copy.addChild(userfilter);
    }
    HibernateUtil.saveOrUpdate(copy);

    //add message
View Full Code Here

Examples of com.google.api.ads.dfa.axis.v1_19.UserFilter

    // Retrieve the user who is to be modified.
    User user = userService.getUser(userId);

    // Create and configure a user filter.
    UserFilter filterToAdd = new UserFilter();
    // The following field has been filled in to make a filter that allows a
    // user to access only the assigned objects.
    // This value was determined using GetUserFilterCriteriaTypes.java.
    filterToAdd.setUserFilterCriteriaId(2);
    // Because this filter used the criteria type "Assigned" it is necessary
    // to specify what advertisers this user has access to. This next step
    // would be skipped for the criteria types "All" and "None".

    // Create an object filter to represent each object the user has access
    // to. Since this is an advertiser filter, an object filter represents an
    // advertiser. The total of object filter objects will need to match the
    // total of advertisers the user is assigned.
    ObjectFilter allowedObject = new ObjectFilter();
    // Insert the advertiser ID of an advertiser assigned to this user.
    allowedObject.setId(advertiserId);
    // Create any additional object filters that are needed, then create an
    // array of all of the object filters for this filter.
    ObjectFilter[] objectFilters = {allowedObject};
    // Add these settings to the user filter
    filterToAdd.setObjectFilters(objectFilters);

    // Add the filter to the user. The following method is specific to
    // advertiser filters. See the User class documentation for the names of
    // methods for other filters.
    user.setAdvertiserUserFilter(filterToAdd);
View Full Code Here

Examples of com.google.api.ads.dfa.axis.v1_20.UserFilter

    // Retrieve the user who is to be modified.
    User user = userService.getUser(userId);

    // Create and configure a user filter.
    UserFilter filterToAdd = new UserFilter();
    // The following field has been filled in to make a filter that allows a
    // user to access only the assigned objects.
    // This value was determined using GetUserFilterCriteriaTypes.java.
    filterToAdd.setUserFilterCriteriaId(2);
    // Because this filter used the criteria type "Assigned" it is necessary
    // to specify what advertisers this user has access to. This next step
    // would be skipped for the criteria types "All" and "None".

    // Create an object filter to represent each object the user has access
    // to. Since this is an advertiser filter, an object filter represents an
    // advertiser. The total of object filter objects will need to match the
    // total of advertisers the user is assigned.
    ObjectFilter allowedObject = new ObjectFilter();
    // Insert the advertiser ID of an advertiser assigned to this user.
    allowedObject.setId(advertiserId);
    // Create any additional object filters that are needed, then create an
    // array of all of the object filters for this filter.
    ObjectFilter[] objectFilters = {allowedObject};
    // Add these settings to the user filter
    filterToAdd.setObjectFilters(objectFilters);

    // Add the filter to the user. The following method is specific to
    // advertiser filters. See the User class documentation for the names of
    // methods for other filters.
    user.setAdvertiserUserFilter(filterToAdd);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.