Package evolaris.framework.smsservices.business

Examples of evolaris.framework.smsservices.business.Entry


    List<Long> proposedFragmentIds = new LinkedList<Long>();
    List<Long> proposedChannelIds = new LinkedList<Long>();
    List<Blog> sourceBlogs = new LinkedList<Blog>();
    List<Long> proposedBlogIds = new LinkedList<Long>();
    for (Mapping entryMapping : mappingSet) {
      Entry sourceEntry = entryMapping.getSourceEntry();
      if (sourceEntry.getUser() != null){
        sourceUsers.add(sourceEntry.getUser());
        Entry destinationEntry = entryMapping.getDestinationEntry();
        if (destinationEntry != null){
          proposedUsers.add(destinationEntry.getUser());
          proposedUserIds.add(destinationEntry.getUser().getId());
        } else {
          proposedUserIds.add(-1L);
        }
      } else if (sourceEntry.getUserSet() != null){
        sourceUserSets.add(sourceEntry.getUserSet());
        Entry destinationEntry = entryMapping.getDestinationEntry();
        if (destinationEntry != null){
          proposedUserSetIds.add(destinationEntry.getUserSet().getId());
        } else {
          proposedUserSetIds.add(-1L);
        }
      } else if (sourceEntry.getSender() != null){
        sourceSenders.add(sourceEntry.getSender());
        Entry destinationEntry = entryMapping.getDestinationEntry();
        if (destinationEntry != null){
          proposedSenderIds.add(destinationEntry.getSender().getId());
        } else {
          proposedSenderIds.add(-1L);
        }
      } else if (sourceEntry.getFragment() != null){
        sourceFragments.add(sourceEntry.getFragment());
        Entry destinationEntry = entryMapping.getDestinationEntry();
        if (destinationEntry != null){
          proposedFragmentIds.add(destinationEntry.getFragment().getId());
        } else {
          proposedFragmentIds.add(-1L);
        }
      } else if (sourceEntry.getBlog() != null) {
        sourceBlogs.add(sourceEntry.getBlog());
        Entry destinationEntry = entryMapping.getDestinationEntry();
        if (destinationEntry != null) {
          proposedBlogIds.add(destinationEntry.getBlog().getId());
        } else {
          proposedBlogIds.add(-1L);
        }
      } // ignore group entry
    }
View Full Code Here


        User selectedUser = userManager.getUserDetails(selectedUserId);
        if (selectedUser == null){
          throw new InputException(getResources(req).getMessage(locale, "smssvc.SelectedUserNotAvaliableAnymore"),"user #" + selectedUserId + " not found",null,null);
        }
        checkAccessRights(req,selectedUser.getGroup());
        mappingSet.add(new Entry(sourceUser), new Entry(selectedUser));
      }
    }
   
    // user sets
   
    UserSetManager userSetManager = new UserSetManager(locale,session);
    long[] sourceUserSetIds = f.getSourceUserSetIds();
    if (sourceUserSetIds != null){
      long[] selectedUserSetIds = f.getSelectedUserSetIds();
      for (int i = 0; i < sourceUserSetIds.length; i++){
        long sourceUserSetId = sourceUserSetIds[i];
        UserSet sourceUserSet = userSetManager.getUserSet(sourceUserSetId);
        if (sourceUserSet == null){
          throw new InputException(getResources(req).getMessage(locale, "smssvc.SourceUserSetNotAvailableAnymore"),"user set #" + sourceUserSetId + " not found",null,null);
        }
        checkAccessRights(req,sourceUserSet.getGroup());
        long selectedUserSetId = selectedUserSetIds[i];
        if (selectedUserSetId >= 1){  // mapping entry => assign; no entry => create
          UserSet selectedUserSet = userSetManager.getUserSet(selectedUserSetId);
          if (selectedUserSet == null){
            throw new InputException(getResources(req).getMessage(locale, "smssvc.SelectedUserSetNotAvaliableAnymore"),"user set #" + selectedUserSetId + " not found",null,null);
          }
          checkAccessRights(req,selectedUserSet.getGroup());
          mappingSet.add(new Entry(sourceUserSet), new Entry(selectedUserSet));
        }
      }
    }
   
    // senders
   
    SmsSenderManager senderManager = new SmsSenderManager(locale,session);
    long[] sourceSenderIds = f.getSourceSenderIds();
    if (sourceSenderIds != null){  // at least one mapping
      long[] selectedSenderIds = f.getSelectedSenderIds();
      for (int i = 0; i < sourceSenderIds.length; i++){
        long sourceSenderId = sourceSenderIds[i];
        Sender sourceSender = senderManager.getSmsSenderById(sourceSenderId);
        if (sourceSender == null){
          throw new InputException(getResources(req).getMessage(locale, "smssvc.SourceSenderNotAvailableAnymore"),"sender #" + sourceSenderId + " not found",null,null);
        }
        if (!req.isUserInRole(UserManagerBase.ADMINISTRATOR) && !senderManager.isValidForGroup(sourceSender,webUser.getGroup())) {
          throw new InputException(getResources(req).getMessage(locale, "smssvc.insufficientRights"));
        }
        long selectedSenderId = selectedSenderIds[i];
        if (selectedSenderId >= 1){  // mapping entry => assign; no entry => add to group
          Sender selectedSender = senderManager.getSmsSenderById(selectedSenderId);
          if (selectedSender == null){
            throw new InputException(getResources(req).getMessage(locale, "smssvc.SelectedSenderNotAvaliableAnymore"),"sender #" + selectedSenderId + " not found",null,null);
          }
          if (!req.isUserInRole(UserManagerBase.ADMINISTRATOR) && !senderManager.isValidForGroup(selectedSender,webUser.getGroup())) {
            throw new InputException(getResources(req).getMessage(locale, "smssvc.insufficientRights"));
          }
          mappingSet.add(new Entry(sourceSender), new Entry(selectedSender));
        }
      }
    }

    // blogs

    BlogManager blogManager = new BlogManager(locale, session);
    long[] sourceBlogIds = f.getSourceBlogIds();
    if (sourceBlogIds != null) {  // at least one mapping
      Blog personalBlog = new Blog();
      personalBlog.setId(-99);
      personalBlog.setName(this.getResources(req).getMessage("smssvc.personalBlog"));
      long[] selectedBlogIds = f.getSelectedBlogIds();
      for (int i = 0; i < sourceBlogIds.length; i++){
        long sourceBlogId = sourceBlogIds[i];
        Blog sourceBlog = sourceBlogId == -99 ? personalBlog : blogManager.getBlog(sourceBlogId);
        if (sourceBlog == null){
          throw new InputException(getResources(req).getMessage(locale, "smssvc.SourceBlogNotAvailableAnymore"),"blog #" + sourceBlogId + " not found",null,null);
        }
        if (sourceBlog.getId() != -99) {
          checkAccessRights(req, sourceBlog.getGroup());
        }
        long selectedBlogId = selectedBlogIds[i];
        if (selectedBlogId != -99 && selectedBlogId <= 0) {
          throw new InputException(getResources(req).getMessage(locale, "smssvc.BlogMappingSelectionMissing"),"sourceBlogId = " + sourceBlogId,null,null);
        }
        Blog selectedBlog = selectedBlogId == -99 ? personalBlog : blogManager.getBlog(selectedBlogId);
        if (selectedBlog == null) {
          throw new InputException(getResources(req).getMessage(locale, "smssvc.SelectedBlogNotAvaliableAnymore"),"blog #" + selectedBlogId + " not found",null,null);
        }
        if (selectedBlogId != -1) {
          checkAccessRights(req,selectedBlog.getGroup());
        }
        mappingSet.add(new Entry(sourceBlog), new Entry(selectedBlog));
      }
    }       
   
    // fragments
   
    SmsDbManager smsDbManager = new SmsDbManager(locale,session);
    long[] sourceFragmentIds = f.getSourceFragmentIds();
    if (sourceFragmentIds != null){  // at least one mapping
      long[] selectedFragmentIds = f.getSelectedFragmentIds();
      for (int i = 0; i < sourceFragmentIds.length; i++){
        long sourceFragmentId = sourceFragmentIds[i];
        Fragment sourceFragment = smsDbManager.getFragment(sourceFragmentId);
        if (sourceFragment == null){
          throw new InputException(getResources(req).getMessage(locale, "smssvc.SourceFragmentNotAvailableAnymore"),"fragment #" + sourceFragmentId + " not found",null,null);
        }
        checkAccessRights(req,sourceFragment.getGroup());
        long selectedFragmentId = selectedFragmentIds[i];
        if (selectedFragmentId <= 0){
          throw new InputException(getResources(req).getMessage(locale, "smssvc.FragmentMappingSelectionMissing"),"sourceFragmentId = " + sourceFragmentId,null,null);
        }
        Fragment selectedFragment = smsDbManager.getFragment(selectedFragmentId);
        if (selectedFragment == null){
          throw new InputException(getResources(req).getMessage(locale, "smssvc.SelectedFragmentNotAvaliableAnymore"),"fragment #" + selectedFragmentId + " not found",null,null);
        }
        checkAccessRights(req,selectedFragment.getGroup());
        mappingSet.add(new Entry(sourceFragment), new Entry(selectedFragment));
      }
    }
   
    req.getSession().setAttribute("mappingSet", mappingSet);
    return mapping.findForward("selected");
View Full Code Here

    newFragment = new Fragment();
    f.toEntry(newFragment, locale, session, getResources(req));
    checkAccessRights(req, newFragment.getGroup(),null);
   
    // group assignment is not editable => perform source to destination automatically
    mappingSet.add(new Entry(oldFragment.getGroup()), new Entry(newFragment.getGroup()));
   
    // Create duplicated command entries according to the original execution order
    CommandEntryManager commandEntryManager = new CommandEntryManager(locale,session);
    SortedSet<CommandEntry> newCommandEntries = new TreeSet<CommandEntry>(new CommandEntryManager.CommandEntryComparator());
    Set<CommandEntry> oldCommandEntries = oldFragment.getCommandEntries();
View Full Code Here

    newInvocation = new Invocation();
    f.toEntry(newInvocation, locale, session, getResources(req));
    checkAccessRights(req, newInvocation.getGroup(),null);
   
    // group assignment is not editable => perform source to destination automatically
    mappingSet.add(new Entry(oldInvocation.getGroup()), new Entry(newInvocation.getGroup()));
   
    // Create duplicated command entries according to the original execution order
    CommandEntryManager commandEntryManager = new CommandEntryManager(locale,session);
    SortedSet<CommandEntry> newCommandEntries = new TreeSet<CommandEntry>(new CommandEntryManager.CommandEntryComparator());
    Set<CommandEntry> oldCommandEntries = oldInvocation.getCommandEntries();
View Full Code Here

    newTimerEvent = new TimerEvent();
    f.toEntry(newTimerEvent, locale, session, getResources(req));
    checkAccessRights(req, newTimerEvent.getGroup(),null);
   
    // group assignment is not editable => perform source to destination automatically
    mappingSet.add(new Entry(oldTimerEvent.getGroup()), new Entry(newTimerEvent.getGroup()));
   
    // Create duplicated command entries according to the original execution order
    CommandEntryManager commandEntryManager = new CommandEntryManager(locale,session);
    SortedSet<CommandEntry> newCommandEntries = new TreeSet<CommandEntry>(new CommandEntryManager.CommandEntryComparator());
    Set<CommandEntry> oldCommandEntries = oldTimerEvent.getCommandEntries();
View Full Code Here

TOP

Related Classes of evolaris.framework.smsservices.business.Entry

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.