Inserted into company view filter the specified label user setting
FEA: ItEr77S15FilteringEnhancements
This commit is contained in:
parent
08ec2695f3
commit
0fe7ace58c
1 changed files with 30 additions and 0 deletions
|
|
@ -31,10 +31,16 @@ import java.util.Map;
|
|||
|
||||
import org.apache.commons.lang.Validate;
|
||||
import org.libreplan.business.common.entities.ProgressType;
|
||||
import org.libreplan.business.common.exceptions.InstanceNotFoundException;
|
||||
import org.libreplan.business.planner.entities.TaskElement;
|
||||
import org.libreplan.business.users.daos.IUserDAO;
|
||||
import org.libreplan.business.users.entities.User;
|
||||
import org.libreplan.business.users.entities.UserRole;
|
||||
import org.libreplan.web.common.components.bandboxsearch.BandboxMultipleSearch;
|
||||
import org.libreplan.web.common.components.finders.FilterPair;
|
||||
import org.libreplan.web.common.components.finders.IFilterEnum;
|
||||
import org.libreplan.web.common.components.finders.OrderFilterEnum;
|
||||
import org.libreplan.web.common.components.finders.TaskGroupFilterEnum;
|
||||
import org.libreplan.web.planner.TaskGroupPredicate;
|
||||
import org.libreplan.web.planner.tabs.MultipleTabsPlannerController;
|
||||
import org.libreplan.web.security.SecurityUtils;
|
||||
|
|
@ -76,6 +82,9 @@ public class CompanyPlanningController implements Composer {
|
|||
@Autowired
|
||||
private ICompanyPlanningModel model;
|
||||
|
||||
@Autowired
|
||||
private IUserDAO userDAO;
|
||||
|
||||
private List<ICommandOnTask<TaskElement>> additional = new ArrayList<ICommandOnTask<TaskElement>>();
|
||||
|
||||
private Planner planner;
|
||||
|
|
@ -136,6 +145,8 @@ public class CompanyPlanningController implements Composer {
|
|||
bdFilters = (BandboxMultipleSearch) filterComponent
|
||||
.getFellow("bdFilters");
|
||||
bdFilters.setFinder("taskGroupsMultipleFiltersFinder");
|
||||
loadPredefinedBandboxFilter();
|
||||
|
||||
checkIncludeOrderElements = (Checkbox) filterComponent
|
||||
.getFellow("checkIncludeOrderElements");
|
||||
filterComponent.setVisible(true);
|
||||
|
|
@ -144,6 +155,24 @@ public class CompanyPlanningController implements Composer {
|
|||
|
||||
}
|
||||
|
||||
private void loadPredefinedBandboxFilter() {
|
||||
User user;
|
||||
try {
|
||||
user = this.userDAO.findByLoginName(SecurityUtils
|
||||
.getSessionUserLoginName());
|
||||
} catch (InstanceNotFoundException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
||||
// Calculate filter based on user preferences
|
||||
if ((user != null) && (user.getProjectsFilterLabel() != null)) {
|
||||
bdFilters.addSelectedElement(new FilterPair(
|
||||
TaskGroupFilterEnum.Label, user.getProjectsFilterLabel()
|
||||
.getCompleteName(), user
|
||||
.getProjectsFilterLabel()));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks the creation permissions of the current user and enables/disables
|
||||
* the create buttons accordingly.
|
||||
|
|
@ -305,6 +334,7 @@ public class CompanyPlanningController implements Composer {
|
|||
filterFinishDate.setValue(model.getFilterFinishDate().
|
||||
toDateMidnight().toDate());
|
||||
}
|
||||
|
||||
return predicate;
|
||||
}
|
||||
return new TaskGroupPredicate(listFilters, startDate, finishDate,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue