Package com.centraview.activity.helper

Examples of com.centraview.activity.helper.ActivityHelperLocal


        throw new AuthorizationFailedException("User does not have access to Tasks");
      }

      InitialContext ic = CVUtility.getInitialContext();
      ActivityHelperLocalHome home = (ActivityHelperLocalHome)ic.lookup("local/ActivityHelper");
      ActivityHelperLocal remote = (ActivityHelperLocal) home.create();
      remote.setDataSource(dataSource);

      ActivityVO actVo = new ActivityVO();
      actVo.setEntityID(0);
      actVo.setIndividualID(tvo.getIndividualID());
      actVo.setActivityType(8);
      actVo.setOwner(userId);
      actVo.setTitle(tvo.getTitle());
      actVo.setActivityDetails(tvo.getActivityDetails());
      actVo.setActivityStartDate(tvo.getStart());
      actVo.setActivityDueDate(tvo.getEnd());
      actVo.setVisibility("PUBLIC");
      activityId = remote.addActivity(actVo,userId);

      int taskCount = 1;
      dl.setSql("projecttask.selecttaskcount");
      dl.setInt(1, tvo.getProjectID());
View Full Code Here


    {
      CVDal dl = new CVDal(dataSource);

      InitialContext ic = CVUtility.getInitialContext();
      ActivityHelperLocalHome home = (ActivityHelperLocalHome)ic.lookup("local/ActivityHelper");
      ActivityHelperLocal remote = (ActivityHelperLocal) home.create();
      remote.setDataSource(dataSource);
      ActivityVO actVo = new ActivityVO();
      actVo = remote.getActivity(taskId,userId);

      tvo.setTitle(actVo.getTitle());
      tvo.setActivityDetails(actVo.getActivityDetails());
      tvo.setCreatedBy(actVo.getCreatedBy());
      tvo.setCreatedOn(actVo.getCreatedOn());
View Full Code Here

      CVDal dl = new CVDal(dataSource);

      InitialContext ic = CVUtility.getInitialContext();
      ActivityHelperLocalHome home = (ActivityHelperLocalHome)ic.lookup("local/ActivityHelper");
      ActivityHelperLocal remote = (ActivityHelperLocal) home.create();
      remote.setDataSource(dataSource);

      ActivityVO actVo = new ActivityVO();
      actVo.setActivityID(tvo.getActivityID());
      actVo.setEntityID(0);
      actVo.setIndividualID(tvo.getIndividualID());
      actVo.setActivityType(8);
      actVo.setTitle(tvo.getTitle());
      actVo.setActivityDetails(tvo.getActivityDetails());
      actVo.setActivityStartDate(tvo.getStart());
      actVo.setActivityDueDate(tvo.getEnd());
      actVo.setStatus(tvo.getStatus());

      remote.updateActivity(actVo,userId);

      dl.setSql("projecttask.updatetask");
      dl.setInt(1, tvo.getProjectID());
      dl.setInt(2, tvo.getParentID());
      dl.setString(3, tvo.getIsMileStone());
View Full Code Here

    try
    {
      InitialContext ic = CVUtility.getInitialContext();
      ActivityHelperLocalHome home = (ActivityHelperLocalHome)ic.lookup("local/ActivityHelper");
      ActivityHelperLocal remote = (ActivityHelperLocal) home.create();
      remote.setDataSource(dataSource);
      remote.deleteActivity(taskId,individualID);

      cvdl.setSql("projecttask.selecttaskaction");
      cvdl.setInt(1, taskId);
      Collection col = cvdl.executeQuery();
      Iterator itCount = col.iterator();
View Full Code Here

    try
    {

      InitialContext ic = CVUtility.getInitialContext();
      ActivityHelperLocalHome home = (ActivityHelperLocalHome)ic.lookup("local/ActivityHelper");
      ActivityHelperLocal remote = (ActivityHelperLocal) home.create();
      remote.setDataSource(dataSource);

      ActivityVO actVo = new ActivityVO();
      actVo.setEntityID(entityid);
      actVo.setIndividualID(individualid);
      actVo.setActivityType(4);
      actVo.setOwner(ownerid);
      actVo.setTitle(strTitle);
      actVo.setActivityDetails(strDetail);
      actVo.setActivityDetails(strDetail);
      actVo.setActivityDueDate(duebydate);
      actVo.setStatus(statusid);
      actVo.setVisibility("PUBLIC");
      int activityid = remote.addActivity(actVo,ownerid);

      cvdal.setSqlQuery("INSERT INTO literaturerequest VALUES(?,?,?)");
      cvdal.setInt(1,activityid);
      cvdal.setInt(2,assignedtoid);
      cvdal.setInt(3,deliveryid);
View Full Code Here

    Collection colDetails = null;
    try
    {
      InitialContext ic = CVUtility.getInitialContext();
      ActivityHelperLocalHome home = (ActivityHelperLocalHome)ic.lookup("local/ActivityHelper");
      ActivityHelperLocal remote = (ActivityHelperLocal) home.create();
      remote.setDataSource(dataSource);
      ActivityVO actVo = new ActivityVO();
      actVo = remote.getActivity(activityID,individualID);

      literatureDetails.setDuebydate(actVo.getActivityDueDate());
      if(actVo.getEntityID() != 0){
        literatureDetails.setEntityid(actVo.getEntityID());
        literatureDetails.setEntityname(actVo.getEntityName());
View Full Code Here

    try
    {

      InitialContext ic = CVUtility.getInitialContext();
      ActivityHelperLocalHome home = (ActivityHelperLocalHome)ic.lookup("local/ActivityHelper");
      ActivityHelperLocal remote = (ActivityHelperLocal) home.create();
      remote.setDataSource(dataSource);

      ActivityVO actVo = new ActivityVO();
      actVo.setActivityID(activityid);
      actVo.setEntityID(entityid);
      actVo.setIndividualID(individualid);
      actVo.setActivityType(4);
      actVo.setTitle(strTitle);
      actVo.setActivityDetails(strDetail);
      actVo.setActivityDueDate(duebydate);
      actVo.setStatus(statusid);

      remote.updateActivity(actVo,ownerid);

      cvdal.setSqlQuery("DELETE FROM literaturerequestlink WHERE ActivityID = ? ");
      cvdal.setInt(1 , activityid );
      cvdal.executeUpdate();
      cvdal.clearParameters();
View Full Code Here

     int result=0;
    CVDal cvdal = new CVDal(dataSource);
    try {
      InitialContext ic = CVUtility.getInitialContext();
      ActivityHelperLocalHome home = (ActivityHelperLocalHome)ic.lookup("local/ActivityHelper");
      ActivityHelperLocal remote = (ActivityHelperLocal) home.create();
      remote.setDataSource(dataSource);
      remote.deleteActivity(activityid,individualID);
     
      cvdal.setSqlQuery("DELETE FROM literaturerequest WHERE ActivityID = ? ");
      cvdal.setInt(1 , activityid );
      cvdal.executeUpdate();
      cvdal.clearParameters();
View Full Code Here

   try
   {

   InitialContext ic = CVUtility.getInitialContext();
   ActivityHelperLocalHome home = (ActivityHelperLocalHome)ic.lookup("local/ActivityHelper");
   ActivityHelperLocal remote = (ActivityHelperLocal) home.create();
   remote.setDataSource(dataSource);

     int sequence = 0;
     boolean advSearchPresent;
     if (searchCol == null)
     {
       advSearchPresent = false;
     }else{
       advSearchPresent = true;
     }

     while (iterator.hasNext())
     {
       HashMap activityRecord = (HashMap)iterator.next();
       Integer activityId = new Integer(((Number)activityRecord.get("ActivityID")).intValue());

       if (((Number)activityRecord.get("Status")).intValue() == 2)
       {
         // TODO: HARDCODED HTML!!!
         activityRecord.put("Title", "<span class=completedActivity>"+ (String)activityRecord.get( "Title" ) + "</span>");
       }

       // In the getAllCalendar method we may have run a search and gotten results
       // Therefore as we iterate the list, we check the activity Id against the
       // passed in collection if(advSearchPresent) of course
       // and if the current activity doesn't match, then we just skip it.
       if (advSearchPresent)
       {
         Long searchActivityId = (Long)activityRecord.get("ActivityID");
         HashMap compareHashMap = new HashMap();
         compareHashMap.put("ActivityID", searchActivityId);
         if (!searchCol.contains(compareHashMap))
         {
           continue;
         }
       }

       // If we made it this far then we can get the activity detail and populate the object.
       GregorianCalendar activityRecordStart = new GregorianCalendar(TimeZone.getTimeZone("EST"));
       if (activityRecord.get("Start") != null)
       {
         Timestamp activityStartDate = (Timestamp)activityRecord.get("Start");
         activityRecordStart.setTimeInMillis(activityStartDate.getTime());
       }

       GregorianCalendar activityRecordEnd = new GregorianCalendar(TimeZone.getTimeZone("EST"));
       if (activityRecord.get("End") != null)
       {
         Timestamp activityEndDate = (Timestamp)activityRecord.get("End");
         activityRecordEnd.setTimeInMillis(activityEndDate.getTime());
       }
       
        int activityType = ((Number)activityRecord.get("Type")).intValue();
        // its a Special Case for the Forcast Sales. We will not have the end date for it..
        // we have to display as the whole day event, for that reason if we set the start as end date.
        if(activityType == 3){
          activityRecordEnd.set(GregorianCalendar.DAY_OF_MONTH,activityRecordStart.get(GregorianCalendar.DAY_OF_MONTH));
          activityRecordEnd.set(GregorianCalendar.MONTH,activityRecordStart.get(GregorianCalendar.MONTH));
          activityRecordEnd.set(GregorianCalendar.YEAR,activityRecordStart.get(GregorianCalendar.YEAR));
          activityRecordEnd.set(GregorianCalendar.HOUR_OF_DAY,23);
        }
       
       // And what if they were null ... it means we have fubar data, and thats just the way it is.

       // if this is a recurring record, do some stuff.
       if ((activityRecord.get("startdate") != null))
       {
         RecurrenceVO recurrenceVO = new RecurrenceVO();
         recurrenceVO.setRecurrenceId(((Long)activityRecord.get("RecurrenceID")).intValue());
         recurrenceVO.setStartDate((Date)activityRecord.get("startdate"));
         recurrenceVO.setUntil((Date)activityRecord.get("Until"));
         recurrenceVO.setTimePeriod((String)activityRecord.get("TimePeriod"));
         recurrenceVO.setOn(((Number)activityRecord.get("RecurrOn")).intValue());
         recurrenceVO.setEvery(((Integer)activityRecord.get("Every")).intValue());
         recurrenceVO.fillRecurrenceHashMap();

         HashMap recurrenceRuleMap = recurrenceVO.getRecurrenceHM();
         if (recurrenceRuleMap != null && recurrenceRuleMap.size() > 0)
         {
           Date recurrStartDate = (Date)activityRecord.get("startdate");
           // For very long recurrences we only need to calculate out 18 months before of the
           // passedStartDate otherwise we spend all our time calculating recurring tasks.
           Calendar compareCalendar = (Calendar)passedStartDate.clone();
           compareCalendar.add(Calendar.MONTH, -18);
           Date compareDate = new Date(compareCalendar.getTimeInMillis());
           if (recurrStartDate.before(compareDate))
           {
             recurrStartDate = compareDate;
           }

           GregorianCalendar recurringStartDate = new GregorianCalendar(TimeZone.getTimeZone("EST"));
           if (recurrStartDate != null)
           {
             recurringStartDate.setTime(recurrStartDate);
             recurringStartDate.set(Calendar.HOUR, activityRecordStart.get(Calendar.HOUR));
             recurringStartDate.set(Calendar.MINUTE, activityRecordStart.get(Calendar.MINUTE));
             recurringStartDate.set(Calendar.AM_PM, activityRecordStart.get(Calendar.AM_PM));
           }

           Date recurrEndDate = (Date)activityRecord.get("Until");
           // if there is no end date (the recurrence is open ended)
           // then coerce it to the passed in end date, for calculation purposes
           // Also for very long recurrences we only need to calculate out 2 months ahead of the
           // passedEndDate otherwise we spend all our time calculating recurring tasks.
           compareCalendar = (Calendar)passedEndDate.clone();
           compareCalendar.add(Calendar.MONTH, 2);
           compareDate = new Date(compareCalendar.getTimeInMillis());
           if (recurrEndDate == null || recurrEndDate.after(compareDate))
           {
             recurrEndDate = compareDate;
           }

           // get an RFC 2445 compliant recurrance rule string.
           String rfcRuleString = recurrenceVO.getRecurrenceRule(recurrenceRuleMap);

           // This object can take a rule string, a start and end date
           // and supply a list of dates where the activity occurs.
           long start = System.currentTimeMillis();
          
           try{
             RecurranceRuleRfc rfcRecurranceRule = new RecurranceRuleRfc(rfcRuleString, recurrStartDate, recurrEndDate);
             List matchingDates = rfcRecurranceRule.getAllMatchingDates();
             // Iterate the list and add new activity objects onto the list.
             start = System.currentTimeMillis();
             for (int i = 0; i < matchingDates.size(); i++)
             {
               java.util.Date matchingDate = (java.util.Date)matchingDates.get(i);
               GregorianCalendar recurringInstanceStartDate = new GregorianCalendar(passedStartDate.getTimeZone());
               // This is the start Calendar for this instance of the recurrance
               recurringInstanceStartDate.setTime(matchingDate); // This will set the MONTH/DATE/YEAR
               // Get the Time of Day from the activity Record
               recurringInstanceStartDate.set(Calendar.HOUR, activityRecordStart.get(Calendar.HOUR));
               recurringInstanceStartDate.set(Calendar.MINUTE, activityRecordStart.get(Calendar.MINUTE));
               recurringInstanceStartDate.set(Calendar.AM_PM, activityRecordStart.get(Calendar.AM_PM));
               // This is the End Calendar for this instance of the recurrance
               GregorianCalendar recurringInstanceEndDate = new GregorianCalendar(passedEndDate.getTimeZone());
               // The only real way to set the instance end time
               // is to find out the duration of the activityRecord and set the
               // end time of this instance to be offset from the start time of
               // the same instance by the calculated duration.
               long activityDuration = activityRecordEnd.getTimeInMillis() - activityRecordStart.getTimeInMillis();
               recurringInstanceEndDate.setTimeInMillis(recurringInstanceStartDate.getTimeInMillis() + activityDuration);
               CalendarActivityObject recurringInstanceObject = new CalendarActivityObject(recurringInstanceStartDate, recurringInstanceEndDate, activityId, (String)activityRecord.get("Title"), (String)activityRecord.get("ActivityName"), userId, individualId, "",false,null,null);
               recurringInstanceObject.setActivityDetail((String)activityRecord.get("Details"));
               // set visibility
               recurringInstanceObject.setActivityVisibility((String)activityRecord.get("visibility"));
               // set owner
               recurringInstanceObject.setActivityOwnerId(((Number)activityRecord.get("Owner")).intValue());
               ArrayList activityAttendeeInfo = remote.getActivityAttendee(activityId.intValue());
               recurringInstanceObject.setActivityAttendee(activityAttendeeInfo);
               //Find the Entity
               HashMap activityLinkInfo = remote.getActivityLink(activityId.intValue());
               String entityName = (String)activityLinkInfo.get("EntityName");
               int entityID = -1;
               try
               {
                 Integer.parseInt((String)activityLinkInfo.get("EntityID"));
               }catch(NumberFormatException nfe){
                 // "Don't stand so, don't stand so, close to me..."
               }
               //Set the Entity
               recurringInstanceObject.setEntityName(entityName);
               recurringInstanceObject.setEntityID(entityID);
               retVec.add(recurringInstanceObject);
             } // end for (int ctr = 0; ctr < results.size(); ctr++)
           }catch (Exception e){
             logger.debug("[Exception][CvCalendarEJB.fillReturnVector] Exception Thrown: " , e);
           }            
         } // end if (mapRecurrence != null)
       }else if (activityRecordStart.before(passedEndDate) && activityRecordEnd.after(passedStartDate)){
         // else it is not a recurring type of activity.

         // We will collect the number of days in the StartDate and EndDate ArrayList
         // in between the Starting Time Activity and Ending Time of Activity.
         GregorianCalendar tempStartTime = new GregorianCalendar(TimeZone.getTimeZone("EST"));
         tempStartTime.setTimeInMillis(activityRecordStart.getTimeInMillis());

         GregorianCalendar tempEndTime = new GregorianCalendar(TimeZone.getTimeZone("EST"));

         ArrayList StartDate = new ArrayList();
         ArrayList EndDate = new ArrayList();

         StartDate.add(new Long(tempStartTime.getTimeInMillis()));
         while (tempStartTime.before(activityRecordEnd))
         {
           tempEndTime.setTimeInMillis(tempStartTime.getTimeInMillis());
           tempEndTime.set(GregorianCalendar.HOUR,11);
           tempEndTime.set(GregorianCalendar.MINUTE,59);
           tempEndTime.set(GregorianCalendar.SECOND,59);
           tempEndTime.set(GregorianCalendar.AM_PM,GregorianCalendar.PM);

           tempStartTime.add(GregorianCalendar.DAY_OF_MONTH,1);
           tempStartTime.set(GregorianCalendar.HOUR,0);
           tempStartTime.set(GregorianCalendar.MINUTE,0);
           tempStartTime.set(GregorianCalendar.SECOND,0);
           tempStartTime.set(GregorianCalendar.AM_PM,GregorianCalendar.AM);

           if (! tempStartTime.before(activityRecordEnd))
           {
             break;
             }else{
             EndDate.add(new Long(tempEndTime.getTimeInMillis()));
             StartDate.add(new Long(tempStartTime.getTimeInMillis()));
           }   // end of if(!tempStartTime.before(activityRecordEnd))

         }   // end of while (tempStartTime.before(activityRecordEnd))

         tempEndTime.setTimeInMillis(activityRecordEnd.getTimeInMillis());
         EndDate.add(new Long(tempEndTime.getTimeInMillis()));

         for(int i = 0; i<StartDate.size();i++)
         {
           long startTimeInMills = ((Long) StartDate.get(i)).longValue();
           long endTimeInMills = ((Long) EndDate.get(i)).longValue();

           GregorianCalendar ActivityStart = new GregorianCalendar(TimeZone.getTimeZone("EST"));
           ActivityStart.setTimeInMillis(startTimeInMills);

           GregorianCalendar ActivityEnd = new GregorianCalendar(TimeZone.getTimeZone("EST"));
           ActivityEnd.setTimeInMillis(endTimeInMills);

           CalendarActivityObject cvo = null;

           // Activity for only one day
           if (StartDate.size() == 1)
           {
             cvo = new CalendarActivityObject(ActivityStart, ActivityEnd, activityId, (String)activityRecord.get("Title"), (String)activityRecord.get("ActivityName"), userId, individualId, "",false,null,null);
           }else{
             // Activity Spaninng for multiple days. We will set the flag value
             // to True and pass the Actual starting and ending time of the Activity.
             cvo = new CalendarActivityObject(ActivityStart, ActivityEnd, activityId, (String)activityRecord.get("Title"), (String)activityRecord.get("ActivityName"), userId, individualId, "",true,activityRecordStart,activityRecordEnd);
           }   // end if (StartDate.size() == 1)

           cvo.setActivityDetail((String)activityRecord.get("Details"));
           cvo.setActivityVisibility((String)activityRecord.get("visibility"));
           cvo.setActivitySequence(sequence);

           // Find the Entity

           HashMap activityLinkInfo = remote.getActivityLink(activityId.intValue());
           String entityName = (String)activityLinkInfo.get("EntityName");
           int entityID = -1;
           try
           {
             entityID = Integer.parseInt((String)activityLinkInfo.get("EntityID"));
           }catch(NumberFormatException nfe){
             // "Don't stand so, don't stand so, close to me..."
           }

           // Set the Entity
           cvo.setEntityName(entityName);
           cvo.setEntityID(entityID);

           // Setting owner ID
           cvo.setActivityOwnerId(((Number)activityRecord.get("Owner")).intValue());

     ArrayList activityAttendeeInfo = remote.getActivityAttendee(activityId.intValue());
     cvo.setActivityAttendee(activityAttendeeInfo);

           sequence++;
           retVec.add(cvo);
         //end for (int i=0; i<StartDate.size(); i++)
View Full Code Here

    int newActivityID = 0;

    try {
      InitialContext ic = CVUtility.getInitialContext();
      ActivityHelperLocalHome home = (ActivityHelperLocalHome)ic.lookup("local/ActivityHelper");
      ActivityHelperLocal remote = home.create();
      remote.setDataSource(dataSource);
      newActivityID = remote.addActivity(av, userId);

      commitAttachment(av, userId);
    } catch (Exception e) {
      System.out.println("[Exception][ActivityFacadeEJB] Exception thrown in add(): " + e);
      e.printStackTrace();
View Full Code Here

TOP

Related Classes of com.centraview.activity.helper.ActivityHelperLocal

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.