Changeset 17932

Show
Ignore:
Timestamp:
08/22/08 13:48:54 (3 months ago)
Author:
ritesh
Message:

Paging in Assignment(Beta) for tree view and flat view.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/core/db/oracle/create-scripts/versions/8.5.0/update_system_properties.sql

    r17930 r17932  
    248248values (2000,'en','text','prm.wiki.edit.describe.label','Edit summary (describe the changes you have made):','','A',0,1); 
    249249 
     250insert into PN_PROPERTY (CONTEXT_ID, LANGUAGE, PROPERTY_TYPE, PROPERTY, PROPERTY_VALUE, RECORD_STATUS, IS_SYSTEM_PROPERTY, IS_TRANSLATABLE_PROPERTY, PROPERTY_VALUE_CLOB) 
     251values (2000, 'en', 'text', 'prm.personal.assignments.defaultpagesize.value', '50', 'A', 0, 1, null); 
     252 
    250253commit; 
    251254prompt 0 records loaded 
  • trunk/core/src/net/project/hibernate/dao/IPnAssignmentDAO.java

    r17870 r17932  
    8383                Date endDate, 
    8484                Integer statusId, 
    85                 Integer percentComplete, 
     85                Double percentComplete, 
     86                String PercentCompleteComparator, 
     87                String assignmentName, 
     88                String assignmentNameComparator, 
     89                int offset,  
     90                int range 
     91    ); 
     92     
     93    public Integer getTotalAssignmentCountWithFilters( 
     94                Integer personId, 
     95                String assigneeORAssignor, 
     96                Integer[] projectIds, 
     97                Integer businessId, 
     98                String[] assignmentTypes, 
     99                boolean lateAssignment, 
     100                boolean comingDueDate, 
     101                boolean shouldHaveStart, 
     102                boolean inProgress, 
     103                Date startDate, 
     104                Date endDate, 
     105                Integer statusId, 
     106                Double percentComplete, 
    86107                String PercentCompleteComparator, 
    87108                String assignmentName, 
  • trunk/core/src/net/project/hibernate/dao/impl/PnAssignmentDAOImpl.java

    r17884 r17932  
    713713                Date endDate, 
    714714                Integer statusId, 
    715                 Integer percentComplete, 
     715                Double percentComplete, 
    716716                String PercentCompleteComparator, 
    717717                String assignmentName, 
    718                 String assignmentNameComparator 
     718                String assignmentNameComparator, 
     719                int offset,  
     720                int range 
    719721    ){ 
    720722        List<PnAssignment> assignments = new ArrayList<PnAssignment>();          
    721                 String sql = "SELECT new PnAssignment ("  
    722                                         +" p1.displayName, (SELECT p.displayName FROM PnPerson p WHERE p.personId = a.pnAssignor.personId ), "  
     723                 
     724        String sql = "SELECT new PnAssignment ("  
     725                                        +" p.displayName, assignor.displayName, " 
    723726                                        +" a.comp_id.spaceId, on1.name, " 
    724727                                        +" o2.pnObjectType.objectType, "  
    725728                                        +" a.work, a.workUnits, a.workComplete, a.startDate, a.endDate, a.percentAllocated,"  
    726                                         +" a.comp_id.objectId, on2.name) " 
    727                                         +" FROM PnAssignment a, "  
    728                                 +" PnObject o1, PnObject o2, "  
     729                                        +" a.comp_id.objectId, on2.name ) " 
     730                                        +" FROM PnAssignment a left join  a.pnAssignor assignor, " 
     731                                       +" PnObject o1, PnObject o2, "  
    729732                                +" PnObjectName on1, PnObjectName on2, "  
    730                                 +" PnPerson p1
     733                                +" PnPerson p
    731734                                        +" WHERE o1.objectId = a.comp_id.spaceId " 
    732735                                        +" AND o2.objectId = a.comp_id.objectId " 
     
    736739                                        +" AND o1.recordStatus = 'A' " 
    737740                                        +" AND o2.recordStatus = 'A' " 
    738                                         +" AND p1.personId = a.comp_id.personId "; 
     741                                        +" AND p.personId = a.comp_id.personId "; 
    739742 
    740743                if(assigneeORAssignor.equalsIgnoreCase("assignor")){//assignor Assignment 
     
    865868                         
    866869                        if (percentComplete != null && PercentCompleteComparator != null) { 
    867                                 query.setInteger("percentComplete", percentComplete); 
     870                                query.setDouble("percentComplete", percentComplete); 
    868871                        } 
    869872                         
     
    875878                                } 
    876879                        } 
     880                        if(offset != 0){ 
     881                                query.setFirstResult(offset); 
     882                        } 
     883                        if(range != 0){ 
     884                                query.setMaxResults(range); 
     885                        } 
    877886                        assignments = query.list(); 
    878887                } catch (Exception e) { 
    879                         log.error("Error occured while getting resource assignment details "+e.getMessage());                  
     888                        log.error("Error occured while getting person Assignment "+e.getMessage());                    
    880889                } 
    881890                return assignments;      
    882891    } 
     892     
     893    public Integer getTotalAssignmentCountWithFilters( 
     894                Integer personId, 
     895                String assigneeORAssignor, 
     896                Integer[] projectIds, 
     897                Integer businessId, 
     898                String[] assignmentTypes, 
     899                boolean lateAssignment, 
     900                boolean comingDueDate, 
     901                boolean shouldHaveStart, 
     902                boolean inProgress, 
     903                Date startDate, 
     904                Date endDate, 
     905                Integer statusId, 
     906                Double percentComplete, 
     907                String PercentCompleteComparator, 
     908                String assignmentName, 
     909                String assignmentNameComparator 
     910    ){ 
     911                Integer nAssignment = 0; 
     912        String sql = " SELECT count(a.comp_id.objectId) " 
     913                                        +" FROM PnAssignment a left join  a.pnAssignor assignor, " 
     914                                        +" PnObject o1, PnObject o2, "  
     915                                +" PnObjectName on1, PnObjectName on2, "  
     916                                +" PnPerson p " 
     917                                        +" WHERE o1.objectId = a.comp_id.spaceId " 
     918                                        +" AND o2.objectId = a.comp_id.objectId " 
     919                                        +" AND on1.objectId = a.comp_id.spaceId " 
     920                                        +" AND on2.objectId = a.comp_id.objectId " 
     921                                        +" AND a.recordStatus = 'A' "  
     922                                        +" AND o1.recordStatus = 'A' " 
     923                                        +" AND o2.recordStatus = 'A' " 
     924                                        +" AND p.personId = a.comp_id.personId "; 
     925 
     926                if(assigneeORAssignor.equalsIgnoreCase("assignor")){//assignor Assignment 
     927                        sql += " AND a.pnAssignor.personId = :personId "; 
     928                         
     929                } else if(assigneeORAssignor.equalsIgnoreCase("assignee")){//resource Assignment  
     930                        sql += " AND a.comp_id.personId = :personId ";                                   
     931                } else { 
     932                        sql += " AND( a.pnAssignor.personId = :personId OR a.comp_id.personId = :personId )"; 
     933                } 
     934                 
     935                //project ids clause 
     936                if(projectIds != null){ 
     937                        sql += " AND a.comp_id.spaceId IN( :projectIds )"; 
     938                } 
     939                 
     940                if(businessId != null){ 
     941                        sql += " AND a.comp_id.spaceId IN(" 
     942                                +" select distinct shs.comp_id.childSpaceId from PnSpaceHasSpace shs "  
     943                                +" where shs.parentSpaceType = 'business' " 
     944                                +" and  shs.comp_id.parentSpaceId = :businessId and shs.recordStatus = 'A')"; 
     945                } 
     946                 
     947                //Assignment type clause 
     948                if(assignmentTypes != null){ 
     949                        sql += " AND o2.pnObjectType.objectType IN( :assignmentTypes )"; 
     950                } 
     951  
     952                if(lateAssignment){ 
     953                        sql += " AND ((a.percentComplete is null) OR "  
     954                            +" (a.endDate <  :toDayDate AND "  
     955                            +" (a.percentComplete < 1))) "; 
     956                } 
     957  
     958                if(comingDueDate){ 
     959                        sql += " AND ((a.endDate <= :toDayDatePlus7 ) AND (a.endDate >= :toDayDate))"; 
     960                } 
     961                 
     962                if(shouldHaveStart){ 
     963                        sql += " AND ((a.percentComplete is null) OR "  
     964                            +" (a.startDate <=  :toDayDate AND "  
     965                            +" (a.percentComplete = 0))) "; 
     966                } 
     967                 
     968                if(inProgress){ 
     969                        sql += " AND (a.percentComplete > 0 and a.percentComplete < 1)"; 
     970                } 
     971 
     972                if(startDate != null && endDate != null){ 
     973                        if(startDate.equals(endDate)){ 
     974                                sql += " AND a.startDate <= :startDate "; 
     975                                sql += " AND a.endDate >= :endDate "; 
     976                        } else { 
     977                                sql += " AND ( a.startDate between :startDate and :endDate "; 
     978                                sql += " or a.endDate between :startDate and :endDate ) "; 
     979                        } 
     980                } 
     981                 
     982                if(statusId != null){ 
     983                        sql += " AND a.statusId = :statusId"; 
     984                } 
     985                 
     986                if( percentComplete!=null && PercentCompleteComparator != null){ 
     987                        if(PercentCompleteComparator.equalsIgnoreCase("equals")){ 
     988                                sql += " AND a.percentComplete = :percentComplete "; 
     989                        } 
     990                        if(PercentCompleteComparator.equalsIgnoreCase("notequals")){ 
     991                                sql += " AND a.percentComplete != :percentComplete "; 
     992                        } 
     993                        if(PercentCompleteComparator.equalsIgnoreCase("lessthan")){ 
     994                                sql += " AND a.percentComplete < :percentComplete ";     
     995                        } 
     996                        if(PercentCompleteComparator.equalsIgnoreCase("greaterthan")){ 
     997                                sql += " AND a.percentComplete > :percentComplete ";     
     998                        } 
     999                } 
     1000                if( assignmentName!=null && assignmentNameComparator != null){ 
     1001                        if(assignmentNameComparator.equalsIgnoreCase("equals")){ 
     1002                                sql += " AND on2.name = :assignmentName "; 
     1003                        } 
     1004                        if(assignmentNameComparator.equalsIgnoreCase("notequals")){ 
     1005                                sql += " AND on2.name != :assignmentName "; 
     1006                        } 
     1007                        if(assignmentNameComparator.equalsIgnoreCase("contains")){ 
     1008                                sql += " AND upper(on2.name) like upper(:assignmentName) ";      
     1009                        } 
     1010                } 
     1011                 
     1012                sql += " ORDER BY on1.name , a.comp_id.spaceId "; 
     1013                 
     1014                try{ 
     1015                        Query query = getHibernateTemplate().getSessionFactory().getCurrentSession().createQuery(sql); 
     1016                        query.setInteger("personId", personId); 
     1017                         
     1018                        if (projectIds != null) { 
     1019                                query.setParameterList("projectIds", projectIds); 
     1020                        } 
     1021                         
     1022                        if(businessId != null){ 
     1023                                query.setParameter("businessId", businessId); 
     1024                        } 
     1025 
     1026                        if (assignmentTypes != null) { 
     1027                                query.setParameterList("assignmentTypes", assignmentTypes); 
     1028                        } 
     1029 
     1030                        if (lateAssignment || comingDueDate || shouldHaveStart) { 
     1031                                query.setDate("toDayDate", new Date()); 
     1032                        } 
     1033 
     1034                        if (comingDueDate) { 
     1035                                Calendar cal = Calendar.getInstance(); 
     1036                                cal.add(Calendar.DATE, 8); 
     1037                                query.setDate("toDayDatePlus7", cal.getTime()); 
     1038                        } 
     1039 
     1040                        if (startDate != null) { 
     1041                                query.setDate("startDate", startDate); 
     1042                        } 
     1043 
     1044                        if (endDate != null) { 
     1045                                query.setDate("endDate", endDate); 
     1046                        } 
     1047 
     1048                        if (statusId != null) { 
     1049                                query.setInteger("statusId", statusId); 
     1050                        } 
     1051                         
     1052                        if (percentComplete != null && PercentCompleteComparator != null) { 
     1053                                query.setDouble("percentComplete", percentComplete); 
     1054                        } 
     1055                         
     1056                        if (assignmentName != null && assignmentNameComparator != null) { 
     1057                                if (assignmentNameComparator.equalsIgnoreCase("contains")) { 
     1058                                        query.setParameter("assignmentName", "%" + assignmentName + "%"); 
     1059                                } else { 
     1060                                        query.setParameter("assignmentName", assignmentName); 
     1061                                } 
     1062                        } 
     1063                        nAssignment = Integer.parseInt(query.uniqueResult().toString()); 
     1064                 
     1065                } catch (Exception e) { 
     1066                        log.error("Error occured while getting count of Assignment "+e.getMessage());                    
     1067                } 
     1068                return nAssignment;      
     1069    } 
    8831070 
    8841071} 
  • trunk/core/src/net/project/hibernate/model/PnAssignment.java

    r17870 r17932  
    102102         
    103103        private net.project.hibernate.model.PnObjectType pnObjectType; 
    104          
    105         private String assignorName; 
    106104         
    107105        private net.project.hibernate.model.PnObjectName pnObjectName; 
     
    233231            Integer percentAllocated,  
    234232            Integer assignmentId, 
    235             String assignmentName ) { 
     233            String assignmentName) { 
    236234        this.personName = personName; 
    237         this.assignorName = assignorName; 
     235        this.pnAssignor = new PnPerson(); 
     236        pnAssignor.setDisplayName(assignorName); 
    238237        PnProjectSpace pnProjectSpace = new PnProjectSpace(projectId, projectName); 
    239238        this.pnProjectSpace = pnProjectSpace; 
     
    644643 
    645644        /** 
    646          * @return the assignorName 
    647          */ 
    648         public String getAssignorName() { 
    649                 return assignorName; 
    650         } 
    651  
    652         /** 
    653          * @param assignorName the assignorName to set 
    654          */ 
    655         public void setAssignorName(String assignorName) { 
    656                 this.assignorName = assignorName; 
    657         } 
    658  
    659         /** 
    660645         * @return the pnObjectName 
    661646         */ 
     
    670655                this.pnObjectName = pnObjectName; 
    671656        } 
    672          
    673                  
    674657 
    675658} 
  • trunk/core/src/net/project/hibernate/service/IPnAssignmentService.java

    r17884 r17932  
    5959    public List<Assignment> getAssigmentsByAssignor(Integer assignorId); 
    6060     
     61    public Integer getTotalAssignmentCountWithFilters( 
     62                Integer personId, 
     63                String assigneeORAssignor, 
     64                Integer[] projectIds, 
     65                Integer businessId, 
     66                String[] assignmentTypes, 
     67                boolean lateAssignment, 
     68                boolean comingDueDate, 
     69                boolean shouldHaveStart, 
     70                boolean InProgress, 
     71                Date startDate, 
     72                Date endDate, 
     73                Integer statusId, 
     74                Double percentComplete, 
     75                String PercentCompleteComparator, 
     76                String assignmentName, 
     77                String assignmentNameComparator 
     78    ); 
     79     
    6180    public String getAssignmentsTreeData( 
    6281                Integer personId, 
     
    7291                Date endDate, 
    7392                Integer statusId, 
    74                 Integer percentComplete, 
     93                Double percentComplete, 
    7594                String PercentCompleteComparator, 
    7695                String assignmentName, 
    7796                String assignmentNameComparator, 
    7897                DateFormat userDateFormat, 
    79                 String treeViewParamerer 
     98                String assignmentViewParameter, 
     99                int offset,  
     100                int range 
    80101    ); 
    81102     
  • trunk/core/src/net/project/hibernate/service/impl/PnAssignmentServiceImpl.java

    r17903 r17932  
    665665    } 
    666666     
     667    public Integer getTotalAssignmentCountWithFilters( 
     668                Integer personId, 
     669                String assigneeORAssignor, 
     670                Integer[] projectIds, 
     671                Integer businessId, 
     672                String[] assignmentTypes, 
     673                boolean lateAssignment, 
     674                boolean comingDueDate, 
     675                boolean shouldHaveStart, 
     676                boolean InProgress, 
     677                Date startDate, 
     678                Date endDate, 
     679                Integer statusId, 
     680                Double percentComplete, 
     681                String PercentCompleteComparator, 
     682                String assignmentName, 
     683                String assignmentNameComparator 
     684    ) { 
     685        return pnAssignmentDAO.getTotalAssignmentCountWithFilters(personId, assigneeORAssignor, projectIds, businessId, 
     686                                assignmentTypes, lateAssignment, comingDueDate, shouldHaveStart, InProgress, startDate, endDate, 
     687                                statusId, percentComplete, PercentCompleteComparator, assignmentName, assignmentNameComparator); 
     688        } 
     689     
    667690    public String getAssignmentsTreeData( 
    668691                Integer personId, 
     
    678701                Date endDate, 
    679702                Integer statusId, 
    680                 Integer percentComplete, 
     703                Double percentComplete, 
    681704                String PercentCompleteComparator, 
    682705                String assignmentName, 
    683706                String assignmentNameComparator, 
    684707                DateFormat userDateFormat, 
    685                 String treeViewParamerer 
     708                String assignmentViewParameter, 
     709                int offset,  
     710                int range 
    686711    ) { 
    687                       return getMyAssignmentGridDataString(pnAssignmentDAO.getAssignmentDetailsWithFilters(personId, assigneeORAssignor, 
     712              return getMyAssignmentGridDataString(pnAssignmentDAO.getAssignmentDetailsWithFilters(personId, assigneeORAssignor, 
    688713                                        projectIds, businessId, assignmentTypes, lateAssignment, comingDueDate, shouldHaveStart, 
    689714                                        InProgress, startDate, endDate, statusId, percentComplete, PercentCompleteComparator, 
    690                                         assignmentName, assignmentNameComparator), userDateFormat, treeViewParamerer); 
     715                                        assignmentName, assignmentNameComparator, offset, range), userDateFormat, assignmentViewParameter); 
    691716        } 
    692717         
     
    707732        } 
    708733 
    709         private String getMyAssignmentGridDataString(List<PnAssignment> assignments, DateFormat userDateFormat, String treeViewParamerer){ 
    710         final List<String> columns = new ArrayList<String>(3); 
     734        private String getMyAssignmentGridDataString(List<PnAssignment> assignments, DateFormat userDateFormat, String assignmentViewParameter){ 
     735               final List<String> columns = new ArrayList<String>(3); 
    711736        columns.add("objectId"); 
    712737        columns.add("objectName"); 
     
    725750                        for (PnAssignment assignment : assignments) { 
    726751                                if (isAssignableType(assignment.getPnObjectType().getObjectType())) { 
    727                                         if (projectId != assignment.getPnProjectSpace().getProjectId() && !treeViewParamerer.equals("flat")) { 
     752                                        if (projectId != assignment.getPnProjectSpace().getProjectId() && !assignmentViewParameter.equals("flat")) { 
    728753                                                parentNode = factory.nextNode(); 
    729754                                                parentNode.set("objectId", assignment.getPnProjectSpace().getProjectId()); 
     
    744769                                                        .getWorkComplete(), assignment.getWorkUnits())); 
    745770                                        childNode.set("workSpace", assignment.getPnProjectSpace().getProjectName().replaceAll("'", "&acute;")); 
    746                                         childNode.set("assignorName", (StringUtils.isNotEmpty(assignment.getAssignorName()) ?  
    747                                                         assignment.getAssignorName().replaceAll("'", "&acute;") : "")); 
     771                                        childNode.set("assignorName", (StringUtils.isNotEmpty(assignment.getPnAssignor().getDisplayName()) ?  
     772                                                        assignment.getPnAssignor().getDisplayName().replaceAll("'", "&acute;") : "")); 
    748773                                        childNode.set("assigneeName", assignment.getPersonName().replaceAll("'", "&acute;")); 
    749774                                        if(parentNode!= null){ 
     
    774799            json.deleteCharAt(json.length()-1); 
    775800        } 
    776         return "[" + json.toString() + "]"
     801        return json.toString()
    777802    } 
    778803         
  • trunk/core/src/net/project/view/pages/assignments/MyAssignments.java

    r17903 r17932  
    2323import net.project.hibernate.model.PnWeblogEntry; 
    2424import net.project.hibernate.service.IBlogProvider; 
     25import net.project.hibernate.service.IPnAssignmentService; 
    2526import net.project.hibernate.service.IPnAssignmentWorkService; 
    2627import net.project.hibernate.service.IPnObjectTypeService; 
     
    8485 
    8586        @Persist 
    86         private String[] assignmentTypes
     87        private String[] assignmentTypes = new String [5]
    8788 
    8889        @Persist 
     
    108109 
    109110        @Persist 
    110         private Integer percentComplete; 
     111        private Double percentComplete; 
    111112 
    112113        @Persist 
     
    126127         
    127128        @Persist 
    128         private String treeViewParamerer; 
     129        private String assignmentViewParameter; 
    129130         
    130131        @Persist 
    131132        private String userId; 
    132133         
    133         private final String COLUMN_PROPERTY_CONTEXT = "net.project.column.MyProject"; 
    134          
    135         private static final String PROPERTY = "MyAssignmentscolumn"; 
     134        private final String COLUMN_PROPERTY_CONTEXT = "net.project.column.MyAssignments"; 
     135         
     136        private static final String PROPERTY = "MyAssignmentsColumn"; 
    136137         
    137138        private String myAssignmentsColumn; 
    138  
     139         
     140        @Persist 
     141        private Integer totalAssignment; 
     142         
     143        @Persist 
     144        private String defaultPageSize; 
     145         
     146        private IPnAssignmentService pnAssignmentService; 
    139147         
    140148        private enum AssignmentsAction { 
     
    158166                        validationMessageForBlogEntry = PropertyProvider.get("prm.blog.addweblogentry.validation.message"); 
    159167                        validationMessageForBlogComment = PropertyProvider.get("prm.blog.addweblogentrycomment.validation.message"); 
     168                        defaultPageSize = PropertyProvider.get("prm.personal.assignments.defaultpagesize.value"); 
     169                        pnAssignmentService = ServiceFactory.getInstance().getPnAssignmentService(); 
     170                         
     171                        //initializing defaut parameter for getting assignment data. 
    160172                        assigneeOrAssignorParameter = "assignee"; 
    161                         treeViewParamerer = "indent"; 
     173                        assignmentTypes[0] = "task"; 
     174                        percentComplete = 1.00; 
     175                        percentCompleteComparator = "lessthan"; 
     176                        assignmentViewParameter = "indent"; 
     177                         
    162178                } catch (Exception e) { 
    163179                        log.error("Error occured while getting property tokens : " + e.getMessage()); 
     
    169185                createUserBusinessOptionsString(); 
    170186                createUserProjectOptionsString(); 
     187                initializeMyTotalAssignmentsCount(); 
    171188                initializeMyAssignmentsColumn(); 
    172189        } 
     
    193210                if (action != null) { 
    194211                        if (action.equalsIgnoreCase(AssignmentsAction.SETVIEWPARAMETER.toString())) { 
    195                                 setTreeViewParamerer(StringUtils.isNotEmpty(request.getParameter("view")) ? request 
     212                                setAssignmentViewParameter(StringUtils.isNotEmpty(request.getParameter("view")) ? request 
    196213                                                .getParameter("view") : "indent"); 
    197214                        } 
    198215                        else if (action.equalsIgnoreCase(AssignmentsAction.SETFILTERPARAMETER.toString())) { 
    199216                                setAllFilterParameter(request); 
     217                                initializeMyTotalAssignmentsCount(); 
    200218                        } 
    201219                        else if (action.equalsIgnoreCase(AssignmentsAction.GETASSIGNMENTSTREEDATA.toString())) { 
    202                                 return getAssignmentTreeData(); 
     220                                return getAssignmentTreeData(request); 
    203221                        }                        
    204222                        else if (action.equalsIgnoreCase((AssignmentsAction.LOADBLOGENTRIES).toString())) { 
     
    256274        } 
    257275         
    258         public TextStreamResponse getAssignmentTreeData() { 
    259                 return new TextStreamResponse("text/json", ServiceFactory.getInstance().getPnAssignmentService().getAssignmentsTreeData(Integer 
    260                                 .parseInt(SessionManager.getUser().getID()), assigneeOrAssignorParameter, projectIds, businessId, assignmentTypes, lateAssignment, 
    261                                 comingDueDate, shouldHaveStart, inProgress, startDate, endDate, statusId, percentComplete, 
    262                                 percentCompleteComparator, assignmentName, assignmentNameComparator, userDateFormat, treeViewParamerer)); 
     276        public TextStreamResponse getAssignmentTreeData(HttpServletRequest request) { 
     277                int offset = StringUtils.isNotEmpty(request.getParameter("start")) ? Integer.parseInt(request.getParameter("start")) : 0; 
     278                int range = StringUtils.isNotEmpty(request.getParameter("limit")) ? Integer.parseInt(request.getParameter("limit")) : 0; 
     279 
     280                return new TextStreamResponse("text/json", "{\"success\":true,\"total\":" 
     281                                + totalAssignment 
     282                                + ",\"data\":[" 
     283                                + pnAssignmentService.getAssignmentsTreeData(Integer.parseInt(SessionManager.getUser().getID()), 
     284                                                assigneeOrAssignorParameter, projectIds, businessId, assignmentTypes, lateAssignment, 
     285                                                comingDueDate, shouldHaveStart, inProgress, startDate, endDate, statusId, percentComplete, 
     286                                                percentCompleteComparator, assignmentName, assignmentNameComparator, userDateFormat, 
     287                                                assignmentViewParameter, offset, range) 
     288 
     289                                + "]}"); 
    263290        } 
    264291         
     
    446473                if (StringUtils.isNotEmpty(request.getParameter("percentComplete")) 
    447474                                && StringUtils.isNotEmpty(request.getParameter("percentCompleteComparator"))) { 
    448                         percentComplete = Integer.parseInt(request.getParameter("percentComplete"))
     475                        percentComplete = Integer.parseInt(request.getParameter("percentComplete"))/100.0
    449476                        percentCompleteComparator = request.getParameter("percentCompleteComparator"); 
    450477                } else { 
     
    475502        } 
    476503         
     504        private void initializeMyTotalAssignmentsCount() { 
     505                totalAssignment = pnAssignmentService.getTotalAssignmentCountWithFilters(Integer.parseInt(SessionManager 
     506                                .getUser().getID()), assigneeOrAssignorParameter, projectIds, businessId, assignmentTypes, 
     507                                lateAssignment, comingDueDate, shouldHaveStart, inProgress, startDate, endDate, statusId, 
     508                                percentComplete, percentCompleteComparator, assignmentName, assignmentNameComparator); 
     509        } 
     510         
    477511        private void initializeMyAssignmentsColumn(){ 
    478512                String columns[] = {"objectName","workSpace","dueDate","workRemaining","objectId","objectType","assigneeName","assignorName"}; 
    479                 myAssignmentsColumn = "[{";  
     513                myAssignmentsColumn = "[{"; 
     514                PersonProperty personProperty = new PersonProperty(); 
     515                personProperty.setScope(ScopeType.GLOBAL.makeScope(SessionManager.getUser())); 
     516                 
    480517                for(String column : columns){ 
    481518                        if(!myAssignmentsColumn.equals("[{")){ 
    482519                                myAssignmentsColumn += ","; 
    483520                        } 
    484                         myAssignmentsColumn += "'" + column + "' : "+getColumnValue(column); 
     521                        myAssignmentsColumn += "'" + column + "' : "+getColumnValue(column, personProperty); 
    485522                } 
    486523                myAssignmentsColumn += "}]"; 
    487524        } 
    488525         
    489         private String getColumnValue(String column){ 
    490                 PersonProperty personProperty = new PersonProperty(); 
    491                 personProperty.setScope(ScopeType.GLOBAL.makeScope(SessionManager.getUser())); 
     526        private String getColumnValue(String column, PersonProperty personProperty){ 
    492527                return (personProperty.get(COLUMN_PROPERTY_CONTEXT + "_" + column, PROPERTY) != null  
    493528                                && personProperty.get(COLUMN_PROPERTY_CONTEXT + "_" + column, PROPERTY).length > 0  
     
    501536                if (StringUtils.isNotEmpty(column) && StringUtils.isNotEmpty(value)) { 
    502537                        PersonProperty personProperty = new PersonProperty(); 
     538                        personProperty.setScope(ScopeType.GLOBAL.makeScope(SessionManager.getUser())); 
    503539                        try { 
    504                                 personProperty.setScope(ScopeType.GLOBAL.makeScope(SessionManager.getUser())); 
    505540                                personProperty.removeAllValues(COLUMN_PROPERTY_CONTEXT + "_" + column, PROPERTY); 
    506541                                personProperty.put(COLUMN_PROPERTY_CONTEXT + "_" + column, PROPERTY, value); 
    507542                        } catch (PersistenceException pnetEx) { 
    508                                 pnetEx.printStackTrace(); 
     543                                log.error("Database error while replacing column property in MyAssignments.replaceMyAssignmentsColumn(): " 
     544                                                                + pnetEx.getMessage()); 
    509545                        } 
    510546                } 
     
    655691         * @return the percentComplete 
    656692         */ 
    657         public Integer getPercentComplete() { 
     693        public Double getPercentComplete() { 
    658694                return percentComplete; 
    659695        } 
     
    662698         * @param percentComplete the percentComplete to set 
    663699         */ 
    664         public void setPercentComplete(Integer percentComplete) { 
     700        public void setPercentComplete(Double percentComplete) { 
    665701                this.percentComplete = percentComplete; 
    666702        } 
     
    788824         * @return the treeViewParamerer 
    789825         */ 
    790         public String getTreeViewParamerer() { 
    791                 return treeViewParamerer; 
     826        public String getAssignmentViewParameter() { 
     827                return assignmentViewParameter; 
    792828        } 
    793829 
     
    795831         * @param treeViewParamerer the treeViewParamerer to set 
    796832         */ 
    797         public void setTreeViewParamerer(String treeViewParamerer) { 
    798                 this.treeViewParamerer = treeViewParamerer; 
     833        public void setAssignmentViewParameter(String assignmentViewParameter) { 
     834                this.assignmentViewParameter = assignmentViewParameter; 
    799835        } 
    800836 
     
    827863        } 
    828864 
     865        /** 
     866         * @return the defaultPageSize 
     867         */ 
     868        public String getDefaultPageSize() { 
     869                return defaultPageSize; 
     870        } 
     871 
     872        /** 
     873         * @param defaultPageSize the defaultPageSize to set 
     874         */ 
     875        public void setDefaultPageSize(String defaultPageSize) { 
     876                this.defaultPageSize = defaultPageSize; 
     877        } 
     878 
     879        /** 
     880         * @return the totalAssignment 
     881         */ 
     882        public Integer getTotalAssignment() { 
     883                return totalAssignment; 
     884        } 
     885 
     886        /** 
     887         * @param totalAssignment the totalAssignment to set 
     888         */ 
     889        public void setTotalAssignment(Integer totalAssignment) { 
     890                this.totalAssignment = totalAssignment; 
     891        } 
     892 
    829893} 
  • trunk/core/web/html/assignments/MyAssignments.html

    <
    r17903 r17932  
    5050        var projectOptionsData = ${projectOptionsString};