Package au.edu.qut.yawl.worklist.model

Examples of au.edu.qut.yawl.worklist.model.AggregatedWorkItemRecord


                      Actually to keep the grouping of items
                      So that we know when we are finished with one item
                     */
                   
                    resultlist = _model.executeQueryWorkItems(exec_query+ " order by time");
                    AggregatedWorkItemRecord witem = new AggregatedWorkItemRecord();
                   
                    HashMap parent_items = new HashMap();
                   
                    YWorkItemEvent dummy_event = new YWorkItemEvent();
                    dummy_event.setIdentifier("");
                    dummy_event.setTaskid("");
                    dummy_event.setEvent("dummy");
                    resultlist.add(dummy_event);
                    /*
                      Create WorkItemRecords...
                     */
                   
                    /*
                      Rewrite into a hashMap Algorithm, which makes it order independent
                      That should fix it!!!
                     */
                   
                    HashMap eventview = new HashMap();
                   
                    for (int j = 0; j < resultlist.size();j++) {
                       
                        YWorkItemEvent event = (YWorkItemEvent) resultlist.get(j);
                       
                        witem = (AggregatedWorkItemRecord) eventview.get(event.getIdentifier()+event.getTaskid());
                       
                        if (witem==null) {
                            witem = new AggregatedWorkItemRecord();
                            witem.setCaseID(event.getIdentifier());
                            witem.setTaskID(event.getTaskid());
                            eventview.put(event.getIdentifier()+event.getTaskid(),witem);
                        }
                       
                       
                        if (event.getEvent().equals("Fired")) {
                            witem.setFiringTime(DateTransform.transform(event.getTime()));
                           
                           
                            Long parent_enablement = (Long) parent_items.get(event.getIdentifier().
                                    substring(0,event.getIdentifier().
                                    lastIndexOf("."))+
                                    event.getTaskid());
                            if (parent_enablement!=null) {
                                long enabled = parent_enablement.longValue();
                                witem.setEnablementTime(DateTransform.transform(enabled));
                                witem.setFired2Started(enabled);
                            }
                           
                        }
                        if (event.getEvent().equals("Executing")) {
                            witem.setStartTime(DateTransform.transform(event.getTime()));
                            add = true;
                            long started = event.getTime();
                            witem.setStarted2Complete(started);
                           
                        }
                        if (event.getEvent().equals("Enabled")) {
                            parent_items.put(event.getIdentifier()+event.getTaskid(),
                                    new Long(event.getTime()));
                        }
                       
                        if (event.getEvent().equals("Complete")) {
                            witem.setCompletionTime(DateTransform.transform(event.getTime()));
                            long completed = event.getTime();
                           
                           
                            long enabled = witem.getFired2Started();
                           
                           
                            long started = witem.getStarted2Complete();
                            /*
                              fired to started
                             */
                            witem.setFired2Started(started - enabled);
                           
                            /*
                              completion time (fired - complete)
                             */
                            witem.setFired2Complete(completed-enabled);
                           
                            /*
                              started to complete
                             */
                            witem.setStarted2Complete(completed-started);
                           
                            witem.setAssignedTo(event.getResource());
                           
                           
                            /*
                              Do not add the parent items and items with missing information
                             */
                            if (parent_items.get(event.getIdentifier()+event.getTaskid())==null) {
                               
                                if (enabled!=0 && completed!=0 && started!=0) {
                                    checkForAddition(filter,witem,reallyfinal);
                                }
                            }
                           
                        }
                        witem.setTaskID(event.getTaskid());
                        witem.setSpecificationID(event.getDescription());
                    }
                   
                   
                    if (filter.granularity.equals("Percent")) {
                        reallyfinal = reduceToPercentage(reallyfinal, filter);
                    }
                   
                    /*
                      calculate the aggregation according to the grouping
                     */
                   
                    if (!grouping.equals("No grouping")) {
                        reallyfinal = calculateWorkItemAggregation(reallyfinal,grouping);
                       
                        System.out.println(reallyfinal);
                       
                    }
                   
                   
                }
            }
           
           
            if (action!=null && action.equals("Create chart")) {
               
                String interval_granul = req.getParameter("interval_chart_granularity");
                int granul = 0;
                if (interval_granul.equals("Seconds")) {
                    granul = Calendar.SECOND;
                }
                if (interval_granul.equals("Minutes")) {
                    granul = Calendar.MINUTE;
                }
                if (interval_granul.equals("Hours")) {
                    granul = Calendar.HOUR_OF_DAY;
                }
                if (interval_granul.equals("Days")) {
                    granul = Calendar.DATE;
                }
                if (interval_granul.equals("Months")) {
                    granul = Calendar.MONTH;
                }
                if (interval_granul.equals("Years")) {
                    granul = Calendar.YEAR;
                }
               
               
                String charttype = req.getParameter("graphtype");
               
                System.out.println(charttype);
               
                List chartValues = new LinkedList();
               
                String xaxis = req.getParameter("groupbyvalue");
                String yaxis = req.getParameter("chartvalue");
               
                for (int i = 0; i < reallyfinal.size();i++) {
                   
                   
                    if (querytype.equals("case")) {
                       
                        YLogIdentifier ylog = (YLogIdentifier) reallyfinal.get(i);
                        System.out.println(ylog.getTime());
                        System.out.println(ylog.getSpecification());
                        Object[] o = new Object[2];
                       
                        /*
                          Select time selected
                         */
                        if (yaxis.equals("Started-Completed")) {
                            o[1] = new Integer((int)DateTransform.getTime(ylog.getTime(),granul));
                        } else if (yaxis.equals("Count")) {
                            o[1] = new Integer((int) ylog.getCount());
                        }
                       
                        /*
                          Select group by element
                         */
                        if (grouping.equals("Specification")) {
                            o[0] = ylog.getSpecification();
                        } else if (grouping.equals("Resource")) {
                            o[0] = ylog.getCreatedby();
                        } else {
                            o[0] = ylog.getIdentifier();
                        }
                       
                        System.out.println("Setting " +  grouping +  " as " + o[0] + " " + ylog.getCreatedby());
                        chartValues.add(o);
                       
                    } else {
                        AggregatedWorkItemRecord witem = (AggregatedWorkItemRecord) reallyfinal.get(i);
                        Object[] o = new Object[2];
                       
                        /*
                          Select time selected
                         */                                               
                        if (yaxis.equals("Enabled-Completed")) {
                            o[1] = new Integer(DateTransform.getTime(witem.getFired2Complete(),granul));
                        } else if (yaxis.equals("Started-Completed")) {
                            o[1] = new Integer(DateTransform.getTime(witem.getStarted2Complete(),granul));
                        } else if (yaxis.equals("Enabled-Started")) {
                            o[1] = new Integer(DateTransform.getTime(witem.getFired2Started(),granul));
                        } else if (yaxis.equals("Count")) {
                            o[1] = new Integer((int) witem.getCount());
                        }
                       
                       
                        /*
                          Select group by element
                         */
                        if (grouping.equals("Specification")) {
                            o[0] = witem.getSpecificationID();
                        } else if (grouping.equals("Resource")) {
                            o[0] = witem.getAssignedTo();
                        } else {
                            o[0] = witem.getTaskID();
                        }
                        chartValues.add(o);
                    }
                }
               
View Full Code Here


           
            paramlist = new LinkedList();
           
            if (parseList.get(i) instanceof AggregatedWorkItemRecord) {
               
                AggregatedWorkItemRecord witem = (AggregatedWorkItemRecord) parseList.get(i);
               
                if (columnlist.contains("ID")) {
                    paramlist.add(witem.getCaseID());
                }
                if (columnlist.contains("Task")) {
                    paramlist.add(witem.getTaskID());
                }
                if (columnlist.contains("Enabled")) {
                    paramlist.add(witem.getEnablementTime());
                }
                if (columnlist.contains("Started")) {
                    paramlist.add(witem.getStartTime());
                }
                if (columnlist.contains("Completed")) {
                    paramlist.add(witem.getCompletionTime());
                }
                if (columnlist.contains("Owner")) {
                    paramlist.add(witem.getAssignedTo());
                }
                if (columnlist.contains("Specification")) {
                    paramlist.add(witem.getSpecificationID());
                }
                if (columnlist.contains("Count")) {
                    paramlist.add(new Long(witem.getCount()).toString());
                }
                if (columnlist.contains("Enabled-Completed")) {
                    paramlist.add(DateTransform.convertRelativeTime(witem.getFired2Complete()));
                }
                if (columnlist.contains("Started-Completed")) {
                    paramlist.add(DateTransform.convertRelativeTime(witem.getStarted2Complete()));
                }
                if (columnlist.contains("Enabled-Started")) {
                    paramlist.add(DateTransform.convertRelativeTime(witem.getFired2Started()));
                }
                if (columnlist.contains("Average Enabled-Completed")) {
                    paramlist.add(DateTransform.convertRelativeTime(witem.getFired2Complete()));
                }
                if (columnlist.contains("Average Started-Completed")) {
                    paramlist.add(DateTransform.convertRelativeTime(witem.getStarted2Complete()));
                }
                if (columnlist.contains("Average Enabled-Started")) {
                    paramlist.add(DateTransform.convertRelativeTime(witem.getFired2Started()));
                }

            } else {
                YLogIdentifier ylog = (YLogIdentifier) parseList.get(i);
               
View Full Code Here

       
        LinkedList aggregated = new LinkedList();
        HashMap map = new HashMap();
       
        for (int i = 0; i < parseList.size(); i++) {
            AggregatedWorkItemRecord witem = (AggregatedWorkItemRecord) parseList.get(i);
           
            AggregatedWorkItemRecord previous = null;
            if (grouping.equals("Specification")) {
                previous = (AggregatedWorkItemRecord) map.get(witem.getSpecificationID());
            } else if (grouping.equals("Resource")) {
                previous = (AggregatedWorkItemRecord) map.get(witem.getWhoStartedMe());
            } else {
                previous = (AggregatedWorkItemRecord) map.get(witem.getTaskID());
            }
           
            if (previous == null) {
                witem.setCount(1);
                if (grouping.equals("Specification")) {
                    map.put(witem.getSpecificationID(),witem);
                } else if (grouping.equals("Resource")) {
                    map.put(witem.getWhoStartedMe(),witem);
                } else {
                    map.put(witem.getTaskID(),witem);
                }
               
            }  else {
               
               
                previous.setFired2Complete(previous.getFired2Complete() + witem.getFired2Complete());
                previous.setStarted2Complete(previous.getStarted2Complete() + witem.getStarted2Complete());
                previous.setFired2Started(previous.getFired2Started() + witem.getFired2Started());
               
                previous.setCount(previous.getCount() + 1);
            }
           
        }
       
        Iterator it = map.values().iterator();
        while (it.hasNext()) {
            AggregatedWorkItemRecord awir = (AggregatedWorkItemRecord) it.next();
            awir.setFired2Started(awir.getFired2Started() / awir.getCount());
            awir.setFired2Complete(awir.getFired2Complete() / awir.getCount());
            awir.setStarted2Complete(awir.getStarted2Complete() / awir.getCount());
           
           
            aggregated.add(awir);
            System.out.println("Calculating Averages....!!!!!!!!! ");
        }
View Full Code Here

       
       
        System.out.println("MAX SIZE: " + maxSize);
       
        for (int i = 0; i < reallyfinal.size();i++) {
            AggregatedWorkItemRecord witem = (AggregatedWorkItemRecord) reallyfinal.get(i);
           
            if (reducedList.size() < maxSize) {
                reducedList.add(witem);
            } else {
                long timetaken = 0;
                long old_timetaken = 0;
                boolean replaced = false;
                for (int k = 0; k < reducedList.size() && !replaced ;k++) {
                    AggregatedWorkItemRecord old = (AggregatedWorkItemRecord) reducedList.get(k);
                   
                    if (filter.intervaloption.equals("Started - Completed")) {
                        old_timetaken = old.getStarted2Complete();
                        timetaken = witem.getStarted2Complete();
                    } else if (filter.intervaloption.equals("Enabled - Started")) {
                        old_timetaken = old.getFired2Started();
                        timetaken = witem.getFired2Started();
                    } else if (filter.intervaloption.equals("Enabled - Completed")) {
                        old_timetaken = old.getFired2Complete();
                        timetaken = witem.getFired2Complete();
                    }
                   
                    if (filter.LessThan) {
                        if (old_timetaken > timetaken) {
View Full Code Here

TOP

Related Classes of au.edu.qut.yawl.worklist.model.AggregatedWorkItemRecord

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.