Skip to content

Commit

Permalink
#181 sort process parameter items
Browse files Browse the repository at this point in the history
FRESH-1504 #181 Transforming HU in Handling
Unit Editor
  • Loading branch information
metas-ts committed Mar 4, 2017
1 parent 58dec77 commit 7228fa3
Showing 1 changed file with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import java.math.BigDecimal;
import java.util.Collection;
import java.util.Comparator;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
Expand Down Expand Up @@ -373,6 +374,7 @@ private LookupValuesList getActions()
return allActionItems.stream()
.filter(item -> selectableTypes.contains(item.getValueName()))
.map(item -> InterfaceWrapperHelper.translate(item, I_AD_Ref_List.class)) // replace 'item' with its translated version
.sorted(Comparator.comparing(I_AD_Ref_List::getName))
.map(item -> StringLookupValue.of(item.getValueName(), item.getName()))
.collect(LookupValuesList.collect());
}
Expand All @@ -390,6 +392,7 @@ private LookupValuesList getTULookupValues()
return getView()
.streamAllRecursive()
.filter(row -> row.isTU())
.sorted(Comparator.comparing(HUDocumentView::getM_HU_ID))
.map(row -> row.toLookupValue())
.collect(LookupValuesList.collect());
}
Expand All @@ -412,6 +415,7 @@ private LookupValuesList getLULookupValues()
return getView()
.streamAllRecursive()
.filter(row -> row.isLU())
.sorted(Comparator.comparing(HUDocumentView::getM_HU_ID))
.map(row -> row.toLookupValue())
.collect(LookupValuesList.collect());
}
Expand All @@ -432,7 +436,7 @@ private LookupValuesList getM_HU_PI_Item_Products()

case TU_To_NewTUs:
return retrieveHUPItemProductsForNewTU();

case TU_To_NewLU:
return retrieveHUPItemProductsForNewTU(); // here we also create new TUs, in addition to the new LU

Expand All @@ -450,7 +454,9 @@ private LookupValuesList retrieveHUPItemProductsForNewTU()
final Stream<I_M_HU_PI_Item_Product> stream = hupiItemProductDAO
.retrieveTUs(getCtx(), huRow.getM_Product(), huRow.getM_HU().getC_BPartner())
.stream();

return stream
.sorted(Comparator.comparing(I_M_HU_PI_Item_Product::getName))
.map(huPIItemProduct -> IntegerLookupValue.of(huPIItemProduct.getM_HU_PI_Item_Product_ID(), huPIItemProduct.getName()))
.collect(LookupValuesList.collect());
}
Expand Down Expand Up @@ -480,7 +486,9 @@ private LookupValuesList getM_LU_HU_PI_ID()
.create()
.list();

return luPIs.stream().map(luPI -> IntegerLookupValue.of(luPI.getM_HU_PI_ID(), luPI.getName()))
return luPIs.stream()
.sorted(Comparator.comparing(I_M_HU_PI::getName))
.map(luPI -> IntegerLookupValue.of(luPI.getM_HU_PI_ID(), luPI.getName()))
.collect(LookupValuesList.collect());
}
}

0 comments on commit 7228fa3

Please sign in to comment.