Package com.dotmarketing.portlets.calendar.model

Examples of com.dotmarketing.portlets.calendar.model.Event


    }
    return result.toString();
  }

  public Event disconnectEvent(Event event, User user, Date startDate, Date endDate) throws DotDataException, DotSecurityException{
    Event newEvent = null;
    if(event!=null && event.isRecurrent()){
      Contentlet newCont = conAPI.copyContentlet(event,user, true);
      newEvent = eventFactory.convertToEvent(newCont);
      newEvent.setDisconnectedFrom(event.getIdentifier());
      newEvent.setRecurrenceDatesToIgnore("");
      newEvent.setRecurs(false);
      newEvent.setRecurrenceDayOfMonth(0);
      newEvent.setRecurrenceDayOfWeek(0);
      newEvent.setRecurrenceDaysOfWeek("");
      newEvent.setRecurrenceInterval(0);
      newEvent.setRecurrenceMonthOfYear(0);
      newEvent.setRecurrenceOccurs("");
      newEvent.setRecurrenceWeekOfMonth(0);
      newEvent.setRecurrenceStart(null);
      newEvent.setRecurrenceEnd(null);
      newEvent.setNoRecurrenceEnd(false);
      newEvent.setOriginalStartDate(event.getStartDate());
      newEvent.setStartDate(startDate);
      newEvent.setEndDate(endDate);
      newEvent.setInode("");
      event.addDateToIgnore(startDate);

      List<Category> eventCategories =  APILocator.getCategoryAPI().getParents(event, user, true);
     
      Contentlet oldCont  = conAPI.checkout(event.getInode(), user, true);
View Full Code Here


    //Retrieving the current user
    User user = userAPI.getLoggedInUser(request);
    boolean respectFrontendRoles = true;

    Event ev = eventAPI.find(id, live, user, respectFrontendRoles);
   
    Map<String, Object> eventMap = ev.getMap();
   
    //Loading categories
    List<Map<String, Object>> categoryMaps = new ArrayList<Map<String,Object>>();
    List<Category> eventCategories =  categoryAPI.getParents(ev, user, respectFrontendRoles);
    for(Category cat : eventCategories) {
      categoryMaps.add(cat.getMap());
    }
    eventMap.put("categories", categoryMaps);
    eventMap.put("rating", RatingAPI.getAverageRating(ev.getIdentifier()));
    eventMap.put("votes", RatingAPI.getRatingVotesNumber(ev.getIdentifier()));
    eventMap.put("hasReadPermission", perAPI.doesUserHavePermission(ev, PermissionAPI.PERMISSION_READ, user, respectFrontendRoles));
    eventMap.put("hasWritePermission", perAPI.doesUserHavePermission(ev, PermissionAPI.PERMISSION_WRITE, user, respectFrontendRoles));
    eventMap.put("hasPublishPermission", perAPI.doesUserHavePermission(ev, PermissionAPI.PERMISSION_PUBLISH, user, respectFrontendRoles));
    eventMap.put("readPermission", perAPI.doesUserHavePermission(ev, PermissionAPI.PERMISSION_READ, user, respectFrontendRoles));
    eventMap.put("writePermission", perAPI.doesUserHavePermission(ev, PermissionAPI.PERMISSION_WRITE, user, respectFrontendRoles));
    eventMap.put("publishPermission", perAPI.doesUserHavePermission(ev, PermissionAPI.PERMISSION_PUBLISH, user, respectFrontendRoles));
    eventMap.put("isDisconnected", UtilMethods.isSet(ev.getDisconnectedFrom()));
    CommentsWebAPI cAPI = new CommentsWebAPI();
    cAPI.setUser(user);
    cAPI.setRespectFrontendRoles(respectFrontendRoles);
    eventMap.put("commentsCount", cAPI.getCommentsCount(ev.getInode()));
   
    return eventMap;
   
  }
View Full Code Here

      respectCMSAnon = true;
      user = (User)request.getSession().getAttribute(WebKeys.CMS_USER);
    }
   
    List<Event> eventsList = new ArrayList<Event>();
    Event parentEv = eventAPI.find(parentEvent, true, user, respectCMSAnon);
    List<Event> events = eventAPI.findRelatedEvents(parentEv, fromDate, toDate, true, user, respectCMSAnon);
    for(Event ev : events) {
      eventsList.add(ev);
    }
    return eventsList;
View Full Code Here

    if(user == null) {
      //Assuming is a front-end access
      respectCMSAnon = true;
      user = (User)request.getSession().getAttribute(WebKeys.CMS_USER);
    }
    Event event = eventAPI.find(id, true, user, respectCMSAnon);
    return event; 
  }
View Full Code Here

    //Retrieving the current user
    User user = userAPI.getLoggedInUser(request);
    boolean respectFrontendRoles = true;
   
    List<Map<String, Object>> retList = new ArrayList<Map<String,Object>>();
    Event parentEv = eventAPI.find(parentEvent, live, user, respectFrontendRoles);
    List<Event> events = eventAPI.findRelatedEvents(parentEv, fromDate, toDate, live, user, respectFrontendRoles);
    for(Event ev : events) {
      retList.add(ev.getMap());
    }
    return retList;
View Full Code Here

    //Retrieving the current user
    User user = userAPI.getLoggedInUser(request);
    boolean respectFrontendRoles = true;

    Event ev = eventAPI.findbyInode(inode, user, respectFrontendRoles);
    try{
      contAPI.publish(ev, user, respectFrontendRoles);
    }catch(Exception e){Logger.error(this, e.getMessage());}
   
    HibernateUtil.commitTransaction();
    if(!contAPI.isInodeIndexed(ev.getInode())){
      Logger.error(this, "Timed out while waiting for index to return");
    }
  }
View Full Code Here

    //Retrieving the current user
    User user = userAPI.getLoggedInUser(request);
    boolean respectFrontendRoles = true;

    Event ev = eventAPI.findbyInode(inode, user, respectFrontendRoles);

    try
      contAPI.unpublish(ev, user, respectFrontendRoles)
    } catch (DotSecurityException e) {
      eventUnpublishErrors.add(e.getLocalizedMessage());
    } catch (DotDataException e) {
      eventUnpublishErrors.add(e.getLocalizedMessage());
    } catch (DotContentletStateException e) {
      eventUnpublishErrors.add(e.getLocalizedMessage());
    }finally{     
      if(eventUnpublishErrors.size() > 0){
        callbackData.put("eventUnpublishErrors", eventUnpublishErrors);               
      }       
    }
    HibernateUtil.commitTransaction();
    if(!contAPI.isInodeIndexed(ev.getInode())){
      Logger.error(this, "Timed out while waiting for index to return");
    }

    return callbackData;
  }
View Full Code Here

    //Retrieving the current user
    User user = userAPI.getLoggedInUser(request);
    boolean respectFrontendRoles = true;

    Event ev = eventAPI.findbyInode(inode, user, respectFrontendRoles);
    try{
      contAPI.archive(ev, user, respectFrontendRoles);
    }catch(Exception e){Logger.error(this, e.getMessage());}

    HibernateUtil.commitTransaction();
    if(!contAPI.isInodeIndexed(ev.getInode())){
      Logger.error(this, "Timed out while waiting for index to return");
    }
  }
View Full Code Here

    //Retrieving the current user
    User user = userAPI.getLoggedInUser(request);
    boolean respectFrontendRoles = true;

    Event ev = eventAPI.findbyInode(inode, user, respectFrontendRoles);
    if(putBack){
      Event baseEvent = null;
      try{
         baseEvent =eventAPI.find(ev.getDisconnectedFrom(), false, user, respectFrontendRoles);
      }catch(Exception e){
        Logger.error(this, "Base event not found");
      }
      if(baseEvent!=null){
        try{
          Date originalStartDate = ev.getOriginalStartDate();
          baseEvent.deleteDateToIgnore(originalStartDate);
          APILocator.getContentletAPI().checkin(baseEvent, categoryAPI.getParents(baseEvent, user, true), perAPI.getPermissions(baseEvent), user, false);
        }catch(Exception e){
          Logger.error(this, "Could not put back event in recurrence");
        }
      }
View Full Code Here

    //Retrieving the current user
    User user = userAPI.getLoggedInUser(request);
    boolean respectFrontendRoles = true;

    Event ev = eventAPI.findbyInode(inode, user, respectFrontendRoles);
    try{
     
      if(UtilMethods.isSet(ev.getDisconnectedFrom())){
        Event baseEvent = null;
        try{
           baseEvent =eventAPI.find(ev.getDisconnectedFrom(), false, user, respectFrontendRoles);
        }catch(Exception e){
          Logger.error(this, "Base event not found");
        }
        if(baseEvent!=null){
          try{
            Date originalStartDate = ev.getOriginalStartDate();
            baseEvent.addDateToIgnore(originalStartDate);
            APILocator.getContentletAPI().checkin(baseEvent, categoryAPI.getParents(baseEvent, user, true), perAPI.getPermissions(baseEvent), user, false);
          }catch(Exception e){
            Logger.error(this, "Could not delete event from recurrence");
          }
        }
View Full Code Here

TOP

Related Classes of com.dotmarketing.portlets.calendar.model.Event

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.