Skip to content

Commit

Permalink
adapt after refactoring from metasfresh project
Browse files Browse the repository at this point in the history
  • Loading branch information
teosarca committed Apr 23, 2017
1 parent 991e3c3 commit d76bddd
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ private HUDocumentView createDocumentView(final int parent_HU_ID, final IHUProdu
private static JSONLookupValue createHUStatusLookupValue(final I_M_HU hu)
{
final String huStatusKey = hu.getHUStatus();
final String huStatusDisplayName = Services.get(IADReferenceDAO.class).retriveListName(Env.getCtx(), IHUDocumentView.HUSTATUS_AD_Reference_ID, huStatusKey);
final String huStatusDisplayName = Services.get(IADReferenceDAO.class).retrieveListNameTrl(IHUDocumentView.HUSTATUS_AD_Reference_ID, huStatusKey);
return JSONLookupValue.of(huStatusKey, huStatusDisplayName);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import java.util.stream.Stream;

import org.adempiere.ad.service.IADReferenceDAO;
import org.adempiere.ad.service.IADReferenceDAO.ADRefListItem;
import org.adempiere.exceptions.AdempiereException;
import org.adempiere.exceptions.FillMandatoryException;
import org.adempiere.model.InterfaceWrapperHelper;
Expand All @@ -21,7 +22,6 @@
import org.adempiere.util.lang.impl.TableRecordReference;
import org.compiere.Adempiere;
import org.compiere.model.I_AD_Process_Para;
import org.compiere.model.I_AD_Ref_List;
import org.compiere.util.Env;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Profile;
Expand Down Expand Up @@ -77,7 +77,7 @@ public class WEBUI_M_HU_Transform
extends HUViewProcessTemplate
implements IProcessPrecondition, IProcessDefaultParametersProvider
{
private static final String SYSCONFIG_ALLOW_INFINIT_CAPACITY_TUS = "de.metas.ui.web.handlingunits.process.WEBUI_M_HU_Transform.AllowNewTUsWithInfiniteCapacity";
private static final String SYSCONFIG_ALLOW_INFINIT_CAPACITY_TUS = "de.metas.ui.web.handlingunits.process.WEBUI_M_HU_Transform.AllowNewTUsWithInfiniteCapacity";

/**
*
Expand Down Expand Up @@ -378,10 +378,7 @@ private void action_SplitCU_To_NewCU(final HUDocumentView cuRow, final BigDecima
* @param tuPIItemProductId to TU
*/
private void action_SplitCU_To_NewTUs(
final HUDocumentView cuRow,
final I_M_HU_PI_Item_Product tuPIItemProduct,
final BigDecimal qtyCU,
final boolean isOwnPackingMaterials)
final HUDocumentView cuRow, final I_M_HU_PI_Item_Product tuPIItemProduct, final BigDecimal qtyCU, final boolean isOwnPackingMaterials)
{
final List<I_M_HU> createdHUs = HUTransferService.get(getCtx())
.withReferencedObjects(getM_ReceiptSchedules())
Expand All @@ -395,9 +392,7 @@ private void action_SplitCU_To_NewTUs(
// * existing LU (M_HU_ID)
// * QtyTUs
private void action_SplitTU_To_ExistingLU(
final HUDocumentView tuRow,
final I_M_HU luHU,
final BigDecimal qtyTU)
final HUDocumentView tuRow, final I_M_HU luHU, final BigDecimal qtyTU)
{
HUTransferService.get(getCtx())
.withReferencedObjects(getM_ReceiptSchedules())
Expand All @@ -417,10 +412,7 @@ private void action_SplitTU_To_ExistingLU(
* @param luPI
*/
private void action_SplitTU_To_NewLU(
final HUDocumentView tuRow,
final I_M_HU_PI_Item huPIItem,
final BigDecimal qtyTU,
final boolean isOwnPackingMaterials)
final HUDocumentView tuRow, final I_M_HU_PI_Item huPIItem, final BigDecimal qtyTU, final boolean isOwnPackingMaterials)
{
final List<I_M_HU> createdHUs = HUTransferService.get(getCtx())
.withReferencedObjects(getM_ReceiptSchedules())
Expand All @@ -438,8 +430,7 @@ private void action_SplitTU_To_NewLU(
* @param tuPI
*/
private void action_SplitTU_To_NewTUs(
final HUDocumentView tuRow,
final BigDecimal qtyTU)
final HUDocumentView tuRow, final BigDecimal qtyTU)
{
// TODO: if qtyTU is the "maximum", then don't do anything, but show a user message
final I_M_HU sourceTuHU = tuRow.getM_HU();
Expand All @@ -463,7 +454,7 @@ private LookupValuesList getActions()
final IADReferenceDAO adReferenceDAO = Services.get(IADReferenceDAO.class);

final I_AD_Process_Para processParameter = adProcessDAO.retriveProcessParameter(getCtx(), getProcessInfo().getAD_Process_ID(), PARAM_Action);
final Collection<I_AD_Ref_List> allActiveActionItems = adReferenceDAO.retrieveListItems(getCtx(), processParameter.getAD_Reference_Value_ID());
final Collection<ADRefListItem> allActiveActionItems = adReferenceDAO.retrieveListItems(processParameter.getAD_Reference_Value_ID());

final Set<String> selectableTypes = new HashSet<>();

Expand Down Expand Up @@ -505,11 +496,12 @@ else if (getSingleSelectedRow().isLU())
selectableTypes.add(ActionType.LU_Set_Ownership.toString());
}

final String adLanguage = Env.getAD_Language(getCtx());

return allActiveActionItems.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()))
.map(item -> StringLookupValue.of(item.getValueName(), item.getName().translate(adLanguage)))
.sorted(Comparator.comparing(lookupValue -> lookupValue.getDisplayName()))
.collect(LookupValuesList.collect());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
import com.google.common.base.MoreObjects;

import de.metas.i18n.ITranslatableString;
import de.metas.i18n.ImmutableTranslatableString;
import de.metas.ui.web.window.model.filters.DocumentFilter;
import groovy.transform.Immutable;

Expand Down Expand Up @@ -52,7 +51,7 @@ private DocumentReference(final ZoomInfo zoomInfo)
super();

id = zoomInfo.getId();
caption = ImmutableTranslatableString.constant(zoomInfo.getLabel());
caption = zoomInfo.getLabel();
AD_Window_ID = zoomInfo.getAD_Window_ID();
documentsCount = zoomInfo.getRecordCount();
filter = DocumentFilter.of(zoomInfo.getQuery());
Expand Down

0 comments on commit d76bddd

Please sign in to comment.