@Test public void filterTestWithListPartLinkAsParameterTest(){ generateSomeReleasedRevisionWithSubstitutesFor("PART-001"); PartMaster partMaster = getPartMasterWith("PART-001"); List<PartLink> links = new ArrayList<>((partMaster.getLastRevision().getLastIteration().getComponents())); List<PartLink> result = updatePartIterationPSFilter.filter(links); assertFalse(result.isEmpty()); assertEquals(5,result.size()); assertEquals("PART-016-UsageLink", result.get(0).getReferenceDescription()); assertEquals("PART-018-Substitute", result.get(1).getReferenceDescription()); assertEquals("PART-015-Substitute", result.get(2).getReferenceDescription()); assertEquals("PART-009-Substitute", result.get(3).getReferenceDescription()); assertEquals("PART-012-Substitute", result.get(4).getReferenceDescription()); }
@Override public List<PartIteration> filter(PartMaster part) { if(part.getKey().equals(rootKey)){ return Collections.singletonList(partIteration); } List<PartIteration> partIterations = new ArrayList<>(); PartRevision partRevision = part.getLastRevision(); PartIteration lastIteration = partRevision.getLastIteration(); PartIteration lastCheckedInIteration = partRevision.getLastCheckedInIteration(); if(partRevision.isCheckedOut() && lastCheckedInIteration != null){ partIterations.add(lastCheckedInIteration); } partIterations.add(lastIteration); return partIterations; }
UpdatePartIterationPSFilter implements ProductStructureFilter, Serializable { @Override public List<PartIteration> filter(PartMaster part) { if(part.getKey().equals(rootKey)){ return Collections.singletonList(partIteration); } List<PartIteration> partIterations = new ArrayList<>(); PartRevision partRevision = part.getLastRevision(); PartIteration lastIteration = partRevision.getLastIteration(); PartIteration lastCheckedInIteration = partRevision.getLastCheckedInIteration(); if(partRevision.isCheckedOut() && lastCheckedInIteration != null){ partIterations.add(lastCheckedInIteration); } partIterations.add(lastIteration); return partIterations; } }
UpdatePartIterationPSFilter implements ProductStructureFilter, Serializable { @Override public List<PartIteration> filter(PartMaster part) { if(part.getKey().equals(rootKey)){ return Collections.singletonList(partIteration); } List<PartIteration> partIterations = new ArrayList<>(); PartRevision partRevision = part.getLastRevision(); PartIteration lastIteration = partRevision.getLastIteration(); PartIteration lastCheckedInIteration = partRevision.getLastCheckedInIteration(); if(partRevision.isCheckedOut() && lastCheckedInIteration != null){ partIterations.add(lastCheckedInIteration); } partIterations.add(lastIteration); return partIterations; } UpdatePartIterationPSFilter(PartIteration partIteration); }
UpdatePartIterationPSFilter implements ProductStructureFilter, Serializable { @Override public List<PartIteration> filter(PartMaster part) { if(part.getKey().equals(rootKey)){ return Collections.singletonList(partIteration); } List<PartIteration> partIterations = new ArrayList<>(); PartRevision partRevision = part.getLastRevision(); PartIteration lastIteration = partRevision.getLastIteration(); PartIteration lastCheckedInIteration = partRevision.getLastCheckedInIteration(); if(partRevision.isCheckedOut() && lastCheckedInIteration != null){ partIterations.add(lastCheckedInIteration); } partIterations.add(lastIteration); return partIterations; } UpdatePartIterationPSFilter(PartIteration partIteration); @Override List<PartIteration> filter(PartMaster part); @Override List<PartLink> filter(List<PartLink> path); }
UpdatePartIterationPSFilter implements ProductStructureFilter, Serializable { @Override public List<PartIteration> filter(PartMaster part) { if(part.getKey().equals(rootKey)){ return Collections.singletonList(partIteration); } List<PartIteration> partIterations = new ArrayList<>(); PartRevision partRevision = part.getLastRevision(); PartIteration lastIteration = partRevision.getLastIteration(); PartIteration lastCheckedInIteration = partRevision.getLastCheckedInIteration(); if(partRevision.isCheckedOut() && lastCheckedInIteration != null){ partIterations.add(lastCheckedInIteration); } partIterations.add(lastIteration); return partIterations; } UpdatePartIterationPSFilter(PartIteration partIteration); @Override List<PartIteration> filter(PartMaster part); @Override List<PartLink> filter(List<PartLink> path);  }