Package evolaris.framework.smsservices.business

Examples of evolaris.framework.smsservices.business.SmsServiceDbManager


  /**
   * @see evolaris.framework.sys.web.form.EnterEditDuplicateForm#createEntry(java.lang.Object, java.util.Locale, org.hibernate.Session)
   */
  @Override
  public void createEntry(TimerEvent entry, Locale locale, Session session) {
         SmsServiceDbManager serviceDbManager = new SmsServiceDbManager(locale,session);
         serviceDbManager.createTimerEvent(entry);
  }
View Full Code Here


  /**
   * @see evolaris.framework.sys.web.form.EnterEditDuplicateForm#deleteEntry(java.lang.Object, java.util.Locale, org.hibernate.Session, org.apache.struts.util.MessageResources)
   */
  @Override
  public void deleteEntry(TimerEvent entry, Locale locale, Session session, MessageResources resources) {
    SmsServiceDbManager serviceDbManager = new SmsServiceDbManager(locale,session);
    serviceDbManager.deleteTimerEvent(entry);
  }
View Full Code Here

  /**
   * @see evolaris.framework.sys.web.form.EnterEditDuplicateForm#modifyEntry(java.lang.Object, java.util.Locale, org.hibernate.Session)
   */
  @Override
  public void modifyEntry(TimerEvent entry, Locale locale, Session session) {
    SmsServiceDbManager serviceDbManager = new SmsServiceDbManager(locale,session);
    serviceDbManager.modifyTimerEvent(entry);
  }
View Full Code Here

  protected ActionForward defaultMethod(ActionMapping mapping, ActionForm form, HttpServletRequest req, HttpServletResponse resp) {
   
    TimerEventExecutionForm teForm = (TimerEventExecutionForm)form;
   
   
    SmsServiceDbManager smsServiceDbManager = new SmsServiceDbManager(locale,session);
    TimerEvent timerEvent = smsServiceDbManager.getTimerEvent(teForm.getId());
    if (timerEvent == null){
      throw new InputException(getResources(req).getMessage(locale, "admin.entryNotAvailable"));
    }
   
    MessageResources resources = getResources(req);
View Full Code Here

  }


  private TimerEvent eventFromSession(HttpServletRequest req) {
    // get the current event from the session
    SmsServiceDbManager serviceMgr = new SmsServiceDbManager(locale,session);
    Object eventIdParam = req.getSession().getAttribute("interactionListId");
    if (eventIdParam == null || !(eventIdParam instanceof Long)) {
      throw new BugException("no event id found for association");
    }
    long eventId = ((Long)eventIdParam).longValue();
    if (eventId == -1) {
      throw new BugException("id -1 in session");
    }
    TimerEvent event = serviceMgr.getTimerEvent(eventId);
    if(event == null) {
      throw new ConfigurationException("There is no event with id: " + eventId + " -> cannot add a new interaction");
    }
    return event;
  }
View Full Code Here

      userToDisplay = userManager.getUserDetails(selectedUserId);
      Hibernate.initialize(userToDisplay); // used to fetch
    }

    // create displayable list of timer events
    SmsServiceDbManager smsServiceDbManager = new SmsServiceDbManager(locale, session);
    TimerEvent[] timerEvents = smsServiceDbManager.getTimerEvents(null,null, 0, true, groupToDisplay,userToDisplay)// show also out-of-date timer events, but not processed entries (shouldn't occur anyhow)
    TimerEventListForm.DisplayListEntry[] displayListEntries = new TimerEventListForm.DisplayListEntry[timerEvents.length];
    SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm");
    CommandEntryManager commandEntryManager = new CommandEntryManager(locale,session);
    MessageResources resources = getResources(req);
    String noInteractionsString = resources.getMessage(locale,"smssvc.noInteractions");
View Full Code Here

  // delete according to selected ID
  private ActionForward delete(ActionMapping mapping, ActionForm form, HttpServletRequest req, HttpServletResponse resp) {
    Object idAttribute = req.getParameter("id");
    if (idAttribute != null && idAttribute instanceof String){
      long timerEventId = Long.parseLong((String)idAttribute);
      SmsServiceDbManager serviceDbManager = new SmsServiceDbManager(locale,session);
      TimerEvent timerEvent = serviceDbManager.getTimerEvent(timerEventId);
      if (timerEvent == null){
        throw new InputException(getResources(req).getMessage(locale, "smssvc.timerEventToBeDeletedDoesNotExistAnymore"),"timer event  id = " + timerEventId,null,null)// may have just been excuted
      }
      if (!(req.isUserInRole(UserManagerBase.ADMINISTRATOR)
          || req.isUserInRole(UserManagerBase.GROUP_ADMINISTRATOR) && timerEvent.getGroup() == webUser.getGroup()
          || req.isUserInRole(UserManagerBase.USER) && timerEvent.getRequestingUser() == webUser)) {
        throw new InputException(getResources(req).getMessage(locale, "smssvc.insufficientRights"));
      }
      serviceDbManager.deleteTimerEvent(timerEvent);
      LOGGER.info("User " + req.getUserPrincipal().getName().toLowerCase() + ": Timer event #" + timerEventId + " has been deleted");
    } else {
      throw new BugException("missing or invalid id parameter passed to delete action: " + idAttribute);
    }
    return mapping.findForward("deleted");
View Full Code Here

   * @param id  timer event ID
   * @return timer event entry; null if not found
   */
  @Override
  protected TimerEvent entryFromDatabase(long id) {
    SmsServiceDbManager serviceDbManager = new SmsServiceDbManager(locale,session);
    return serviceDbManager.getTimerEvent(id);
  }
View Full Code Here

   
    Object oldTimerEventId = req.getSession().getAttribute("oldInteractionListId");
    if (oldTimerEventId == null || !(oldTimerEventId instanceof Long)){
      throw new InputException(getResources(req).getMessage(locale, "admin.entryNotAvailable"),"old timer event entry not found in session",null,null);
    }
    TimerEvent oldTimerEvent = new SmsServiceDbManager(locale,session).getTimerEvent((Long)oldTimerEventId);
    if (oldTimerEvent == null){
      throw new InputException(getResources(req).getMessage(locale, "admin.entryNotAvailable"),"old timer event entry #" + oldTimerEventId + " not found",null,null);
    }
    checkAccessRights(req,oldTimerEvent.getGroup(),null);

    Object newEntry = req.getSession().getAttribute("newTimerEvent");
    if (newEntry == null || !(newEntry instanceof TimerEvent)){
      throw new InputException(getResources(req).getMessage(locale, "admin.entryNotAvailable"),"new timer event entry not found in session",null,null);
    }
   
    // reload references in current session
    TimerEvent newTimerEvent = (TimerEvent)newEntry;
    f.initialize(newTimerEvent,locale,session,getResources(req));
    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();
    SortedSet<CommandEntry> sortedOldCommandEntries = new TreeSet<CommandEntry>(new CommandEntryManager.CommandEntryComparator());
    sortedOldCommandEntries.addAll(oldCommandEntries);
    for (CommandEntry oldCommandEntry : sortedOldCommandEntries) {
      CommandEntryExtender extender = commandEntryManager.createCommandEntryExtender(oldCommandEntry);
      CommandEntry duplicatedCommandEntry = extender.duplicateCommandEntry(newTimerEvent.getGroup(),mappingSet);
      Set<TimerEvent> timerEvents = new TreeSet<TimerEvent>();
      timerEvents.add(newTimerEvent);
      duplicatedCommandEntry.setTimerEvents(timerEvents);
      commandEntryManager.create(duplicatedCommandEntry)// also sets the ID for sorting
      newCommandEntries.add(duplicatedCommandEntry);
    }
    newTimerEvent.setCommandEntries(newCommandEntries);
    new SmsServiceDbManager(locale,session).createTimerEvent(newTimerEvent);
     return mapping.findForward("duplicated");
  }
View Full Code Here

TOP

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

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.