IDEMPIERE-4607 Cannot export windows via 2pack if any field has a Fie… (#483)
* IDEMPIERE-4607 Cannot export windows via 2pack if any field has a Field Group * IDEMPIERE-4607 Implement changes discussed in JIRA - Add a new isList method to DisplayType * IDEMPIERE-4607 Fixed typo * IDEMPIERE-4607 Implement default method to return false by default - PR CarlosRuiz
This commit is contained in:
parent
9093f31709
commit
da6d6b83aa
|
@ -29,6 +29,9 @@ public interface IDisplayTypeFactory {
|
|||
public Integer getDefaultPrecision(int displayType);
|
||||
public boolean isText(int displayType);
|
||||
public boolean isDate (int displayType);
|
||||
public default boolean isList (int displayType) {
|
||||
return false;
|
||||
}
|
||||
public boolean isLookup(int displayType);
|
||||
public boolean isLOB (int displayType);
|
||||
public DecimalFormat getNumberFormat(int displayType, Language language, String pattern);
|
||||
|
|
|
@ -609,7 +609,7 @@ public class CreateAdempiere
|
|||
values.append("NULL");
|
||||
}
|
||||
else if (DisplayType.isText(dt) || dt == DisplayType.YesNo
|
||||
|| dt == DisplayType.List || dt == DisplayType.Button
|
||||
|| DisplayType.isList(dt) || dt == DisplayType.Button
|
||||
|| columnName.equals("AD_Language"))
|
||||
{
|
||||
String s = rs.getString(columnName);
|
||||
|
|
|
@ -800,7 +800,7 @@ public class MColumn extends X_AD_Column implements ImmutablePOSupport
|
|||
foreignTable = "AD_Org";
|
||||
else if ("C_ProjectType_ID".equalsIgnoreCase(getColumnName()))
|
||||
foreignTable = "C_ProjectType";
|
||||
} else if (DisplayType.List == refid || DisplayType.Payment == refid) {
|
||||
} else if (DisplayType.isList(refid) || DisplayType.Payment == refid) {
|
||||
foreignTable = "AD_Ref_List";
|
||||
} else if (DisplayType.Location == refid) {
|
||||
foreignTable = "C_Location";
|
||||
|
@ -941,7 +941,7 @@ public class MColumn extends X_AD_Column implements ImmutablePOSupport
|
|||
if (!column.isKey() && !column.getColumnName().equals(PO.getUUIDColumnName(table.getTableName())) && !column.isVirtualColumn())
|
||||
{
|
||||
int refid = column.getAD_Reference_ID();
|
||||
if (refid != DisplayType.List && refid != DisplayType.Payment)
|
||||
if (!DisplayType.isList(refid) && refid != DisplayType.Payment)
|
||||
{
|
||||
String referenceTableName = column.getReferenceTableName();
|
||||
if (referenceTableName != null)
|
||||
|
@ -1153,7 +1153,7 @@ public class MColumn extends X_AD_Column implements ImmutablePOSupport
|
|||
return "";
|
||||
|
||||
int refid = column.getAD_Reference_ID();
|
||||
if (refid != DisplayType.List && refid != DisplayType.Payment)
|
||||
if (!DisplayType.isList(refid) && refid != DisplayType.Payment)
|
||||
{
|
||||
String referenceTableName = column.getReferenceTableName();
|
||||
if (referenceTableName != null)
|
||||
|
|
|
@ -188,7 +188,7 @@ public class MLookupFactory
|
|||
MLookupInfo info = null;
|
||||
boolean needToAddSecurity = true;
|
||||
// List
|
||||
if (AD_Reference_ID == DisplayType.List || AD_Reference_ID == DisplayType.ChosenMultipleSelectionList || AD_Reference_ID == DisplayType.RadiogroupList) // 17
|
||||
if (DisplayType.isList(AD_Reference_ID)) // 17
|
||||
{
|
||||
info = getLookup_List(language, AD_Reference_Value_ID);
|
||||
needToAddSecurity = false;
|
||||
|
@ -925,7 +925,7 @@ public class MLookupFactory
|
|||
displayColumn.append("(").append(embeddedSQL).append(")");
|
||||
}
|
||||
// List
|
||||
else if (ldc.DisplayType == DisplayType.List)
|
||||
else if (DisplayType.isList(ldc.DisplayType))
|
||||
{
|
||||
String embeddedSQL = getLookup_ListEmbed(language, ldc.AD_Reference_ID, ldc.ColumnName);
|
||||
if (embeddedSQL != null)
|
||||
|
|
|
@ -348,7 +348,7 @@ public class MProcessPara extends X_AD_Process_Para implements ImmutablePOSuppor
|
|||
if (rt != null)
|
||||
foreignTable = rt.getAD_Table().getTableName();
|
||||
}
|
||||
} else if (DisplayType.List == getAD_Reference_ID()) {
|
||||
} else if (DisplayType.isList(getAD_Reference_ID())) {
|
||||
foreignTable = "AD_Ref_List";
|
||||
}
|
||||
|
||||
|
|
|
@ -456,7 +456,7 @@ public class DataEngine
|
|||
}
|
||||
|
||||
// -- List or Button with ReferenceValue --
|
||||
else if (AD_Reference_ID == DisplayType.List
|
||||
else if (DisplayType.isList(AD_Reference_ID)
|
||||
|| (AD_Reference_ID == DisplayType.Button && AD_Reference_Value_ID != 0))
|
||||
{
|
||||
if (ColumnSQL.length() > 0)
|
||||
|
|
|
@ -121,7 +121,7 @@ public class RColumn
|
|||
else if (displayType == DisplayType.Integer)
|
||||
m_colClass = Integer.class;
|
||||
// List
|
||||
else if (displayType == DisplayType.List)
|
||||
else if (DisplayType.isList(displayType))
|
||||
{
|
||||
Language language = Language.getLanguage(Env.getAD_Language(ctx));
|
||||
m_colSQL = "(" + MLookupFactory.getLookup_ListEmbed(
|
||||
|
|
|
@ -363,6 +363,35 @@ public final class DisplayType
|
|||
|
||||
return false;
|
||||
} // isDate
|
||||
|
||||
/**
|
||||
* Returns true if DisplayType is a List.
|
||||
* (stored as Text)
|
||||
* @param displayType Display Type
|
||||
* @return true if List
|
||||
*/
|
||||
public static boolean isList(int displayType)
|
||||
{
|
||||
if (DisplayType.List == displayType || DisplayType.RadiogroupList == displayType
|
||||
|| DisplayType.ChosenMultipleSelectionList == displayType)
|
||||
return true;
|
||||
|
||||
IServiceReferenceHolder<IDisplayTypeFactory> cache = s_displayTypeFactoryCache.get(displayType);
|
||||
if (cache != null) {
|
||||
IDisplayTypeFactory service = cache.getService();
|
||||
if (service != null)
|
||||
return service.isList(displayType);
|
||||
}
|
||||
Optional<IServiceReferenceHolder<IDisplayTypeFactory>> found = getDisplayTypeFactories().stream()
|
||||
.filter(e -> e.getService() != null && e.getService().isList(displayType))
|
||||
.findFirst();
|
||||
if (found.isPresent()) {
|
||||
s_displayTypeFactoryCache.put(displayType, found.get());
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
} // isList
|
||||
|
||||
/**
|
||||
* Returns true if DisplayType is a VLookup (List, Table, TableDir, Search).
|
||||
|
|
|
@ -197,7 +197,7 @@ public class PackRollProcess extends SvrProcess {
|
|||
if (v_AD_Reference_ID == DisplayType.String
|
||||
|| v_AD_Reference_ID == DisplayType.Text
|
||||
|| v_AD_Reference_ID == DisplayType.Memo
|
||||
|| v_AD_Reference_ID == DisplayType.List
|
||||
|| DisplayType.isList(v_AD_Reference_ID)
|
||||
// Carlos Ruiz globalqss, special
|
||||
// treatment for EntityType
|
||||
// it's a Table reference but must
|
||||
|
|
|
@ -255,7 +255,7 @@ public class PoExporter {
|
|||
tableName = columnName.substring(0, columnName.length() - 3);
|
||||
}
|
||||
addTableReference(columnName, tableName, new AttributesImpl());
|
||||
} else if (DisplayType.List == displayType) {
|
||||
} else if (DisplayType.isList(displayType)) {
|
||||
add(columnName, "", new AttributesImpl());
|
||||
} else if (DisplayType.isLookup(displayType)) {
|
||||
String tableName = null;
|
||||
|
|
|
@ -546,7 +546,7 @@ public class WWFActivity extends ADForm implements EventListener<Event>
|
|||
}
|
||||
fAnswerList.setVisible(true);
|
||||
}
|
||||
else if (dt == DisplayType.List)
|
||||
else if (DisplayType.isList(dt))
|
||||
{
|
||||
ValueNamePair[] values = MRefList.getList(Env.getCtx(), m_column.getAD_Reference_Value_ID(), false);
|
||||
for(int i = 0; i < values.length; i++)
|
||||
|
@ -680,7 +680,7 @@ public class WWFActivity extends ADForm implements EventListener<Event>
|
|||
// Do we have an answer?
|
||||
int dt = m_column.getAD_Reference_ID();
|
||||
String value = fAnswerText.getText();
|
||||
if (dt == DisplayType.YesNo || dt == DisplayType.List)
|
||||
if (dt == DisplayType.YesNo || DisplayType.isList(dt))
|
||||
{
|
||||
ListItem li = fAnswerList.getSelectedItem();
|
||||
if(li != null) value = li.getValue().toString();
|
||||
|
|
|
@ -1412,7 +1412,7 @@ public class DB_Oracle implements AdempiereDatabase
|
|||
&& ( ! (DisplayType.isID(column.getAD_Reference_ID()) && defaultValue.equals("-1") ) ) ) // not for ID's with default -1
|
||||
{
|
||||
if (DisplayType.isText(column.getAD_Reference_ID())
|
||||
|| column.getAD_Reference_ID() == DisplayType.List
|
||||
|| DisplayType.isList(column.getAD_Reference_ID())
|
||||
|| column.getAD_Reference_ID() == DisplayType.YesNo
|
||||
// Two special columns: Defined as Table but DB Type is String
|
||||
|| column.getColumnName().equals("EntityType") || column.getColumnName().equals("AD_Language")
|
||||
|
@ -1485,7 +1485,7 @@ public class DB_Oracle implements AdempiereDatabase
|
|||
&& ( ! (DisplayType.isID(column.getAD_Reference_ID()) && defaultValue.equals("-1") ) ) ) // not for ID's with default -1
|
||||
{
|
||||
if (DisplayType.isText(column.getAD_Reference_ID())
|
||||
|| column.getAD_Reference_ID() == DisplayType.List
|
||||
|| DisplayType.isList(column.getAD_Reference_ID())
|
||||
|| column.getAD_Reference_ID() == DisplayType.YesNo
|
||||
|| column.getAD_Reference_ID() == DisplayType.Payment
|
||||
// Two special columns: Defined as Table but DB Type is String
|
||||
|
|
|
@ -1313,7 +1313,7 @@ public class DB_PostgreSQL implements AdempiereDatabase
|
|||
&& ( ! (DisplayType.isID(column.getAD_Reference_ID()) && defaultValue.equals("-1") ) ) ) // not for ID's with default -1
|
||||
{
|
||||
if (DisplayType.isText(column.getAD_Reference_ID())
|
||||
|| column.getAD_Reference_ID() == DisplayType.List
|
||||
|| DisplayType.isList(column.getAD_Reference_ID())
|
||||
|| column.getAD_Reference_ID() == DisplayType.YesNo
|
||||
// Two special columns: Defined as Table but DB Type is String
|
||||
|| column.getColumnName().equals("EntityType") || column.getColumnName().equals("AD_Language")
|
||||
|
|
|
@ -39,6 +39,11 @@ public class FakeDisplayTypeFactory implements IDisplayTypeFactory {
|
|||
public boolean isDate(int displayType) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isList(int displayType) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isLookup(int displayType) {
|
||||
|
|
|
@ -1095,7 +1095,7 @@ public class ModelADServiceImpl extends AbstractService implements ModelADServic
|
|||
AD_Reference_ID = ((MLookup)lookup).getDisplayType();
|
||||
}
|
||||
|
||||
if(AD_Reference_ID==DisplayType.List)
|
||||
if(DisplayType.isList(AD_Reference_ID))
|
||||
{
|
||||
if (lookup.getSize() == 0)
|
||||
lookup.refresh();
|
||||
|
|
|
@ -543,7 +543,7 @@ public class Process {
|
|||
Object value = valueString;
|
||||
if (valueString != null && valueString.length() == 0)
|
||||
value = null;
|
||||
if (value != null && (DisplayType.List == displayType ||
|
||||
if (value != null && (DisplayType.isList(displayType) ||
|
||||
DisplayType.TableDir== displayType ||
|
||||
DisplayType.Table== displayType)&& value.equals("-1"))
|
||||
value= null;
|
||||
|
|
Loading…
Reference in New Issue