use of com.artezio.arttime.filter.Filter in project ART-TIME by Artezio.
the class FilterService method createPredefinedFilter.
private Filter createPredefinedFilter(String name, String owner, List<Project> projects) {
Filter result = new Filter(name, owner, true);
result.setProjects(projects);
return result;
}
use of com.artezio.arttime.filter.Filter in project ART-TIME by Artezio.
the class ManageEffortsBean method initSpreadSheet.
protected SpreadSheet initSpreadSheet() {
Filter currentFilter = filterBean.getCurrentFilter();
filterRepository.fetchProjects(currentFilter);
return getSpreadSheetBuildingStrategy().buildSpreadSheet(currentFilter);
}
use of com.artezio.arttime.filter.Filter in project ART-TIME by Artezio.
the class FilterBeanTest method testSetSelectedProjects_FilterHasFilledProjectList_EmployeeIsPM.
@Test
public void testSetSelectedProjects_FilterHasFilledProjectList_EmployeeIsPM() throws NoSuchFieldException {
Project project1 = createProject(1L, null, "project1");
Project project11 = createProject(2L, project1, "project11");
Project project12 = createProject(3L, project1, "project12");
Project project2 = createProject(5L, null, "project2");
List<Project> projects = Arrays.asList(project11, project12, project2);
Filter filter = new Filter();
setField(filterBean, "currentFilter", filter);
expect(externalContext.isUserInRole("exec")).andReturn(false);
expect(projectService.getSubprojectsByProjects(projects)).andReturn(projects);
replay(externalContext, projectService);
filterBean.setSelectedProjects(projects);
verify(externalContext, projectService);
assertSame(projects, filter.getProjects());
}
use of com.artezio.arttime.filter.Filter in project ART-TIME by Artezio.
the class FilterBeanTest method testGetCurrentFilter_CurrentFilterIsNull.
@Test
public final void testGetCurrentFilter_CurrentFilterIsNull() throws NoSuchFieldException {
setField(filterBean, "currentFilter", null);
Filter expected = new Filter();
List<Project> projects = Collections.emptyList();
expected.setProjects(projects);
expect(filterService.getActiveProjectsFilter(loggedEmployee)).andReturn(expected);
expect(filterRepository.fetchDetails(expected)).andReturn(expected);
expect(projectService.getSubprojectsByProjects(projects)).andReturn(projects).anyTimes();
replay(filterService, filterRepository, externalContext, projectService);
Filter actual = filterBean.getCurrentFilter();
verify(filterService, filterRepository, externalContext, projectService);
assertSame(expected, actual);
}
use of com.artezio.arttime.filter.Filter in project ART-TIME by Artezio.
the class FilterBeanTest method testSetSelectedProjects_FilterHasEmptyProjectList.
@Test
public void testSetSelectedProjects_FilterHasEmptyProjectList() throws NoSuchFieldException {
List<Project> emptyProjectList = Collections.emptyList();
Filter filter = new Filter();
setField(filterBean, "currentFilter", filter);
expect(projectService.getSubprojectsByProjects(emptyProjectList)).andReturn(Collections.emptyList()).anyTimes();
replay(externalContext, projectService);
filterBean.setSelectedProjects(emptyProjectList);
verify(externalContext, projectService);
ListAssert.assertEquals(emptyProjectList, filter.getProjects());
}
Aggregations