@Test public void visitLatestCheckedInFilterTest() throws Exception { Component result = psFilterVisitor.visit(WORKSPACE_ID, new LatestCheckedInPSFilter(false), getPartMasterWith("PART-006"), -1, callbacks); assertNotNull(result); assertEquals("B",result.getRetainedIteration().getVersion()); assertEquals("PART-006",result.getPartMaster().getNumber()); assertEquals(3, result.getComponents().size()); assertEquals(1, result.getComponents().get(0).getComponents().size()); assertEquals("A",result.getComponents().get(0).getRetainedIteration().getPartVersion()); assertEquals("PART-012",result.getComponents().get(0).getPartMaster().getNumber()); assertEquals(3, result.getComponents().get(1).getComponents().size()); assertEquals("B",result.getComponents().get(1).getRetainedIteration().getPartVersion()); assertEquals("PART-002",result.getComponents().get(1).getPartMaster().getNumber()); assertEquals(0, result.getComponents().get(2).getComponents().size()); assertEquals("A",result.getComponents().get(2).getRetainedIteration().getPartVersion()); assertEquals("PART-004",result.getComponents().get(2).getPartMaster().getNumber()); assertEquals("E",getPartMasterWith("PART-001").getLastRevision().getVersion()); assertTrue(getPartMasterWith("PART-001").getLastRevision().isCheckedOut()); assertEquals(1,getPartMasterWith("PART-001").getLastRevision().getPartIterations().size()); try { psFilterVisitor.visit(WORKSPACE_ID, new LatestCheckedInPSFilter(false), getPartMasterWith("PART-001"), -1, callbacks); fail(); }catch (NotAllowedException e){ assertTrue(true); } addIterationTo("PART-001", getPartMasterWith("PART-001").getLastRevision().createNextIteration(user)); assertEquals("E",getPartMasterWith("PART-001").getLastRevision().getVersion()); assertTrue(getPartMasterWith("PART-001").getLastRevision().isCheckedOut()); assertEquals(2,getPartMasterWith("PART-001").getLastRevision().getPartIterations().size()); result = psFilterVisitor.visit(WORKSPACE_ID, new LatestCheckedInPSFilter(false), getPartMasterWith("PART-001"), -1, callbacks); assertNotNull(result); assertEquals(1, result.getRetainedIteration().getIteration()); }
public Component visit(String workspaceId, ProductStructureFilter pFilter, PartMaster pNodeFrom, Integer pStopAtDepth, PSFilterVisitorCallbacks callbacks) throws PartMasterNotFoundException, EntityConstraintException, NotAllowedException { init(workspaceId, pStopAtDepth, pFilter, callbacks); return visit(pNodeFrom, new ArrayList<PartLink>() {{ add(createVirtualRootLink(pNodeFrom)); }}, new ArrayList<PartMaster>() {{ add(pNodeFrom); }} ); }
PSFilterVisitor { public Component visit(String workspaceId, ProductStructureFilter pFilter, PartMaster pNodeFrom, Integer pStopAtDepth, PSFilterVisitorCallbacks callbacks) throws PartMasterNotFoundException, EntityConstraintException, NotAllowedException { init(workspaceId, pStopAtDepth, pFilter, callbacks); return visit(pNodeFrom, new ArrayList<PartLink>() {{ add(createVirtualRootLink(pNodeFrom)); }}, new ArrayList<PartMaster>() {{ add(pNodeFrom); }} ); } }
PSFilterVisitor { public Component visit(String workspaceId, ProductStructureFilter pFilter, PartMaster pNodeFrom, Integer pStopAtDepth, PSFilterVisitorCallbacks callbacks) throws PartMasterNotFoundException, EntityConstraintException, NotAllowedException { init(workspaceId, pStopAtDepth, pFilter, callbacks); return visit(pNodeFrom, new ArrayList<PartLink>() {{ add(createVirtualRootLink(pNodeFrom)); }}, new ArrayList<PartMaster>() {{ add(pNodeFrom); }} ); }  }
PSFilterVisitor { public Component visit(String workspaceId, ProductStructureFilter pFilter, PartMaster pNodeFrom, Integer pStopAtDepth, PSFilterVisitorCallbacks callbacks) throws PartMasterNotFoundException, EntityConstraintException, NotAllowedException { init(workspaceId, pStopAtDepth, pFilter, callbacks); return visit(pNodeFrom, new ArrayList<PartLink>() {{ add(createVirtualRootLink(pNodeFrom)); }}, new ArrayList<PartMaster>() {{ add(pNodeFrom); }} ); }  Component visit(String workspaceId, ProductStructureFilter pFilter, PartMaster pNodeFrom, Integer pStopAtDepth, PSFilterVisitorCallbacks callbacks); Component visit(String workspaceId, ProductStructureFilter pFilter, List<PartLink> pStartingPath, Integer pStopAtDepth, PSFilterVisitorCallbacks callbacks); void stop(); }
PSFilterVisitor { public Component visit(String workspaceId, ProductStructureFilter pFilter, PartMaster pNodeFrom, Integer pStopAtDepth, PSFilterVisitorCallbacks callbacks) throws PartMasterNotFoundException, EntityConstraintException, NotAllowedException { init(workspaceId, pStopAtDepth, pFilter, callbacks); return visit(pNodeFrom, new ArrayList<PartLink>() {{ add(createVirtualRootLink(pNodeFrom)); }}, new ArrayList<PartMaster>() {{ add(pNodeFrom); }} ); }  Component visit(String workspaceId, ProductStructureFilter pFilter, PartMaster pNodeFrom, Integer pStopAtDepth, PSFilterVisitorCallbacks callbacks); Component visit(String workspaceId, ProductStructureFilter pFilter, List<PartLink> pStartingPath, Integer pStopAtDepth, PSFilterVisitorCallbacks callbacks); void stop();  }