Skip to content

Commit

Permalink
#181 HUDocumentView more convenient getters
Browse files Browse the repository at this point in the history
  • Loading branch information
teosarca committed Feb 24, 2017
1 parent 40ee445 commit bf7e834
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package de.metas.ui.web.handlingunits;

import java.math.BigDecimal;
import java.util.List;
import java.util.Map;
import java.util.Set;
Expand Down Expand Up @@ -87,7 +88,7 @@ public HUDocumentViewType getType()
{
return (HUDocumentViewType)delegate.getType();
}

@Override
public boolean isProcessed()
{
Expand Down Expand Up @@ -150,15 +151,15 @@ public String getValue()

public String getHUStatus()
{
JSONLookupValue jsonHUStatus = (JSONLookupValue)delegate.getFieldValueAsJson(I_WEBUI_HU_View.COLUMNNAME_HUStatus);
final JSONLookupValue jsonHUStatus = (JSONLookupValue)delegate.getFieldValueAsJson(I_WEBUI_HU_View.COLUMNNAME_HUStatus);
return jsonHUStatus == null ? null : jsonHUStatus.getKey();
}

public boolean isHUStatusPlanning()
{
return X_M_HU.HUSTATUS_Planning.equals(getHUStatus());
}

public boolean isHUStatusActive()
{
return X_M_HU.HUSTATUS_Active.equals(getHUStatus());
Expand All @@ -168,9 +169,33 @@ public boolean isPureHU()
{
return getType().isPureHU();
}

public boolean isCU()
{
return getType().isCU();
}

public String getSummary()
{
return getValue();
}

public int getM_Product_ID()
{
final JSONLookupValue productLV = (JSONLookupValue)delegate.getFieldValueAsJson(I_WEBUI_HU_View.COLUMNNAME_M_Product_ID);
return productLV == null ? -1 : productLV.getKeyAsInt();
}

public int getC_UOM_ID()
{
final JSONLookupValue uomLV = (JSONLookupValue)delegate.getFieldValueAsJson(I_WEBUI_HU_View.COLUMNNAME_C_UOM_ID);
return uomLV == null ? -1 : uomLV.getKeyAsInt();
}

public BigDecimal getQtyCU()
{
return (BigDecimal)delegate.getFieldValueAsJson(I_WEBUI_HU_View.COLUMNNAME_QtyCU);
}


}
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,11 @@ public boolean isPureHU()
{
return pureHU;
}

public boolean isCU()
{
return this == VHU || this == HUStorage;
}

public static final HUDocumentViewType ofHU_UnitType(final String huUnitType)
{
Expand Down

0 comments on commit bf7e834

Please sign in to comment.