Package domain

Examples of domain.EventType


      RepetitionType repetitionTypeObject = (RepetitionType) databaseSession.createCriteria(RepetitionType.class)
                                            .add(Restrictions.eq("id", this.repetitionType))
                                            .uniqueResult();
     
      EventType eventTypeObject = (EventType) databaseSession.createCriteria(EventType.class)
                                  .add(Restrictions.eq("id", this.eventType))
                                  .uniqueResult();
      Date fromDate = DateOperator.stringToDate(this.from);
      Date toDate = DateOperator.stringToDate(this.to);
   
      if( (null == fromDate) || (null == toDate) ) {
        throw new IllegalArgumentException("Date has wrong format");
      }
      if( !DateOperator.date1IsBeforeDate2(fromDate, toDate) ) {
        throw new IllegalArgumentException("From date should be before to date");
      }
      if( !DateOperator.isRepetitionPossible(fromDate, toDate, repetitionTypeObject) ) {
        return new Response(ResponseStatus.FAIL, "Repetition is not possible. Make sure there is a sense in the repetition type you choose");
      }
     
      User oldOwner = (User) databaseSession.get(User.class, this.oldOwner);

      if (oldOwner == null) {
        throw new IllegalArgumentException("Couldn't locate old owner of the event");
      }
     
      EventType oldEventType = (EventType) databaseSession.get(EventType.class, this.oldEventType);
     
      if (oldEventType == null) {
        throw new IllegalArgumentException("Couldn't locate old type of the event");
      }
     
View Full Code Here


   */
  @Override
  protected Response internalExecute(HttpServletRequest request, Session databaseSession) {
 
    Response response = null;
    EventType eventTypeObject = null;
    HttpSession httpSession = request.getSession();
   
    // if user is not a manager, he can't continue
    if( ! ((Boolean) httpSession.getAttribute("manager")) ) {
     
      return new Response(ResponseStatus.FAIL, "No authorization");
    }
   
    eventTypeObject = new EventType();
   
    if( (null == this.description) || (0 == this.description.length()) ) {
      return new Response(ResponseStatus.FAIL, "Descrition is not valid");
    }
    if( (null == this.color) || (0 == this.color.length()) ) {
      return new Response(ResponseStatus.FAIL, "Color is not valid");
    }
   
    eventTypeObject.setDescription(this.description);
    eventTypeObject.setColor(this.color);
   
    try {
      Transaction transaction = databaseSession.beginTransaction();
      try {
        databaseSession.save(eventTypeObject);
View Full Code Here

      return new Response(ResponseStatus.FAIL, "Start date need to be before end date");
    }
   
    else {
      try {
        EventType eventTypeObject = (EventType) databaseSession.createCriteria(EventType.class).add(Restrictions.eq("id", this.eventType)).uniqueResult();
        if(null == eventTypeObject) {
          return new Response(ResponseStatus.FAIL, "Not valid event type");
        }
       
        EventId eventIdObject = new EventId()
View Full Code Here

      if( !DateOperator.date1IsBeforeDate2(fromDate, toDate) ) {
        throw new IllegalArgumentException("Start date need to be before end date");
      }
     
      if (oldFrom != null && oldTo != null) { // if we need to exclude old event, get it.   
        EventType oldEventTypeObj = (EventType) databaseSession.get(EventType.class, oldEventType);
        User oldOwnerObj = (User) databaseSession.get(User.class, oldOwner);
       
        oldEvent = (Event) databaseSession.createCriteria(Event.class)
          .add(Restrictions.eq("id.from", DateOperator.stringToDate(this.oldFrom) ))
          .add(Restrictions.eq("id.to", DateOperator.stringToDate(this.oldTo)))
View Full Code Here

   */
  @Override
  protected Response internalExecute(HttpServletRequest request, Session databaseSession) {
 
    Response response = null;
    EventType oldEventType = null;
    HttpSession httpSession = request.getSession();
   
    // if user is not a manager, he can't continue
    if( ! ((Boolean) httpSession.getAttribute("manager")) ) {
     
      return new Response(ResponseStatus.FAIL, "No authorization");
    }
   
    try
     
      oldEventType = (EventType) databaseSession.createCriteria(EventType.class)
                  .add(Restrictions.eq("id", this.id))
                  .uniqueResult();
     
      if (null == oldEventType) {
        throw new IllegalArgumentException("The user you are editing was not found.");
      }
     
      Transaction transaction = databaseSession.beginTransaction();     
 
      oldEventType.setColor(this.color);
      oldEventType.setDescription(this.description);
      databaseSession.update(oldEventType);
 
      transaction.commit();
      response = new Response(ResponseStatus.OK);
    }
View Full Code Here

     
      return new Response(ResponseStatus.FAIL, "No authorization");
    }
   
   
    EventType eventTypeObject = (EventType) databaseSession.createCriteria(EventType.class)
                        .add(Restrictions.eq("id", this.id))
                        .uniqueResult();
   
    if(null == eventTypeObject) {
      return new Response(ResponseStatus.FAIL, "Not valid event type");
View Full Code Here

    if( null == fromDate || null == toDate ) {
      return (new Response(ResponseStatus.FAIL, "Dates parsing problem" ));
    }
    else {
      try {
        EventType eventTypeObject = (EventType) databaseSession.get(EventType.class, this.eventType);
        if(null == eventTypeObject)
        {
          return (new Response(ResponseStatus.FAIL, "Not valid event type"));
        }
       
View Full Code Here

   
    Boolean success = false;
    Session session = Database.getInstance().getSessionFactory().openSession();
   
    // load initial event-types
    EventType eventType1 = new EventType();
    eventType1.setColor("#C0C0C0"); // Silver
    eventType1.setDescription("Conference");
 
    EventType eventType2 = new EventType();
    eventType2.setColor("#90EE90"); // LightGreen
    eventType2.setDescription("Meeting");
   
    EventType eventType3 = new EventType();
    eventType3.setColor("#87CEEB"); // SkyBlue
    eventType3.setDescription("Lecture");
   
    EventType eventType4 = new EventType();
    eventType4.setColor("#FA8072"); // Salmon
    eventType4.setDescription("Call");
   
    EventType eventType5 = new EventType();
    eventType5.setColor("#DDA0DD"); // Plum
    eventType5.setDescription("Birthday");
   
    EventType eventType6 = new EventType();
    eventType6.setColor("#FFA07A"); // LightSalmon
    eventType6.setDescription("Party");
   
    EventType eventType7 = new EventType();
    eventType7.setColor("#FFFF00"); // Yellow
    eventType7.setDescription("Other");
   
    // load initial roles
    Role role1 = new Role();
    role1.setDescription("User");
   
View Full Code Here

TOP

Related Classes of domain.EventType

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.