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 Integer getDefaultPrecision(int displayType);
|
||||||
public boolean isText(int displayType);
|
public boolean isText(int displayType);
|
||||||
public boolean isDate (int displayType);
|
public boolean isDate (int displayType);
|
||||||
|
public default boolean isList (int displayType) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
public boolean isLookup(int displayType);
|
public boolean isLookup(int displayType);
|
||||||
public boolean isLOB (int displayType);
|
public boolean isLOB (int displayType);
|
||||||
public DecimalFormat getNumberFormat(int displayType, Language language, String pattern);
|
public DecimalFormat getNumberFormat(int displayType, Language language, String pattern);
|
||||||
|
|
|
@ -609,7 +609,7 @@ public class CreateAdempiere
|
||||||
values.append("NULL");
|
values.append("NULL");
|
||||||
}
|
}
|
||||||
else if (DisplayType.isText(dt) || dt == DisplayType.YesNo
|
else if (DisplayType.isText(dt) || dt == DisplayType.YesNo
|
||||||
|| dt == DisplayType.List || dt == DisplayType.Button
|
|| DisplayType.isList(dt) || dt == DisplayType.Button
|
||||||
|| columnName.equals("AD_Language"))
|
|| columnName.equals("AD_Language"))
|
||||||
{
|
{
|
||||||
String s = rs.getString(columnName);
|
String s = rs.getString(columnName);
|
||||||
|
|
|
@ -800,7 +800,7 @@ public class MColumn extends X_AD_Column implements ImmutablePOSupport
|
||||||
foreignTable = "AD_Org";
|
foreignTable = "AD_Org";
|
||||||
else if ("C_ProjectType_ID".equalsIgnoreCase(getColumnName()))
|
else if ("C_ProjectType_ID".equalsIgnoreCase(getColumnName()))
|
||||||
foreignTable = "C_ProjectType";
|
foreignTable = "C_ProjectType";
|
||||||
} else if (DisplayType.List == refid || DisplayType.Payment == refid) {
|
} else if (DisplayType.isList(refid) || DisplayType.Payment == refid) {
|
||||||
foreignTable = "AD_Ref_List";
|
foreignTable = "AD_Ref_List";
|
||||||
} else if (DisplayType.Location == refid) {
|
} else if (DisplayType.Location == refid) {
|
||||||
foreignTable = "C_Location";
|
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())
|
if (!column.isKey() && !column.getColumnName().equals(PO.getUUIDColumnName(table.getTableName())) && !column.isVirtualColumn())
|
||||||
{
|
{
|
||||||
int refid = column.getAD_Reference_ID();
|
int refid = column.getAD_Reference_ID();
|
||||||
if (refid != DisplayType.List && refid != DisplayType.Payment)
|
if (!DisplayType.isList(refid) && refid != DisplayType.Payment)
|
||||||
{
|
{
|
||||||
String referenceTableName = column.getReferenceTableName();
|
String referenceTableName = column.getReferenceTableName();
|
||||||
if (referenceTableName != null)
|
if (referenceTableName != null)
|
||||||
|
@ -1153,7 +1153,7 @@ public class MColumn extends X_AD_Column implements ImmutablePOSupport
|
||||||
return "";
|
return "";
|
||||||
|
|
||||||
int refid = column.getAD_Reference_ID();
|
int refid = column.getAD_Reference_ID();
|
||||||
if (refid != DisplayType.List && refid != DisplayType.Payment)
|
if (!DisplayType.isList(refid) && refid != DisplayType.Payment)
|
||||||
{
|
{
|
||||||
String referenceTableName = column.getReferenceTableName();
|
String referenceTableName = column.getReferenceTableName();
|
||||||
if (referenceTableName != null)
|
if (referenceTableName != null)
|
||||||
|
|
|
@ -188,7 +188,7 @@ public class MLookupFactory
|
||||||
MLookupInfo info = null;
|
MLookupInfo info = null;
|
||||||
boolean needToAddSecurity = true;
|
boolean needToAddSecurity = true;
|
||||||
// List
|
// 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);
|
info = getLookup_List(language, AD_Reference_Value_ID);
|
||||||
needToAddSecurity = false;
|
needToAddSecurity = false;
|
||||||
|
@ -925,7 +925,7 @@ public class MLookupFactory
|
||||||
displayColumn.append("(").append(embeddedSQL).append(")");
|
displayColumn.append("(").append(embeddedSQL).append(")");
|
||||||
}
|
}
|
||||||
// List
|
// List
|
||||||
else if (ldc.DisplayType == DisplayType.List)
|
else if (DisplayType.isList(ldc.DisplayType))
|
||||||
{
|
{
|
||||||
String embeddedSQL = getLookup_ListEmbed(language, ldc.AD_Reference_ID, ldc.ColumnName);
|
String embeddedSQL = getLookup_ListEmbed(language, ldc.AD_Reference_ID, ldc.ColumnName);
|
||||||
if (embeddedSQL != null)
|
if (embeddedSQL != null)
|
||||||
|
|
|
@ -348,7 +348,7 @@ public class MProcessPara extends X_AD_Process_Para implements ImmutablePOSuppor
|
||||||
if (rt != null)
|
if (rt != null)
|
||||||
foreignTable = rt.getAD_Table().getTableName();
|
foreignTable = rt.getAD_Table().getTableName();
|
||||||
}
|
}
|
||||||
} else if (DisplayType.List == getAD_Reference_ID()) {
|
} else if (DisplayType.isList(getAD_Reference_ID())) {
|
||||||
foreignTable = "AD_Ref_List";
|
foreignTable = "AD_Ref_List";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -456,7 +456,7 @@ public class DataEngine
|
||||||
}
|
}
|
||||||
|
|
||||||
// -- List or Button with ReferenceValue --
|
// -- 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))
|
|| (AD_Reference_ID == DisplayType.Button && AD_Reference_Value_ID != 0))
|
||||||
{
|
{
|
||||||
if (ColumnSQL.length() > 0)
|
if (ColumnSQL.length() > 0)
|
||||||
|
|
|
@ -121,7 +121,7 @@ public class RColumn
|
||||||
else if (displayType == DisplayType.Integer)
|
else if (displayType == DisplayType.Integer)
|
||||||
m_colClass = Integer.class;
|
m_colClass = Integer.class;
|
||||||
// List
|
// List
|
||||||
else if (displayType == DisplayType.List)
|
else if (DisplayType.isList(displayType))
|
||||||
{
|
{
|
||||||
Language language = Language.getLanguage(Env.getAD_Language(ctx));
|
Language language = Language.getLanguage(Env.getAD_Language(ctx));
|
||||||
m_colSQL = "(" + MLookupFactory.getLookup_ListEmbed(
|
m_colSQL = "(" + MLookupFactory.getLookup_ListEmbed(
|
||||||
|
|
|
@ -364,6 +364,35 @@ public final class DisplayType
|
||||||
return false;
|
return false;
|
||||||
} // isDate
|
} // 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).
|
* Returns true if DisplayType is a VLookup (List, Table, TableDir, Search).
|
||||||
* (stored as Integer)
|
* (stored as Integer)
|
||||||
|
|
|
@ -197,7 +197,7 @@ public class PackRollProcess extends SvrProcess {
|
||||||
if (v_AD_Reference_ID == DisplayType.String
|
if (v_AD_Reference_ID == DisplayType.String
|
||||||
|| v_AD_Reference_ID == DisplayType.Text
|
|| v_AD_Reference_ID == DisplayType.Text
|
||||||
|| v_AD_Reference_ID == DisplayType.Memo
|
|| v_AD_Reference_ID == DisplayType.Memo
|
||||||
|| v_AD_Reference_ID == DisplayType.List
|
|| DisplayType.isList(v_AD_Reference_ID)
|
||||||
// Carlos Ruiz globalqss, special
|
// Carlos Ruiz globalqss, special
|
||||||
// treatment for EntityType
|
// treatment for EntityType
|
||||||
// it's a Table reference but must
|
// it's a Table reference but must
|
||||||
|
|
|
@ -255,7 +255,7 @@ public class PoExporter {
|
||||||
tableName = columnName.substring(0, columnName.length() - 3);
|
tableName = columnName.substring(0, columnName.length() - 3);
|
||||||
}
|
}
|
||||||
addTableReference(columnName, tableName, new AttributesImpl());
|
addTableReference(columnName, tableName, new AttributesImpl());
|
||||||
} else if (DisplayType.List == displayType) {
|
} else if (DisplayType.isList(displayType)) {
|
||||||
add(columnName, "", new AttributesImpl());
|
add(columnName, "", new AttributesImpl());
|
||||||
} else if (DisplayType.isLookup(displayType)) {
|
} else if (DisplayType.isLookup(displayType)) {
|
||||||
String tableName = null;
|
String tableName = null;
|
||||||
|
|
|
@ -546,7 +546,7 @@ public class WWFActivity extends ADForm implements EventListener<Event>
|
||||||
}
|
}
|
||||||
fAnswerList.setVisible(true);
|
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);
|
ValueNamePair[] values = MRefList.getList(Env.getCtx(), m_column.getAD_Reference_Value_ID(), false);
|
||||||
for(int i = 0; i < values.length; i++)
|
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?
|
// Do we have an answer?
|
||||||
int dt = m_column.getAD_Reference_ID();
|
int dt = m_column.getAD_Reference_ID();
|
||||||
String value = fAnswerText.getText();
|
String value = fAnswerText.getText();
|
||||||
if (dt == DisplayType.YesNo || dt == DisplayType.List)
|
if (dt == DisplayType.YesNo || DisplayType.isList(dt))
|
||||||
{
|
{
|
||||||
ListItem li = fAnswerList.getSelectedItem();
|
ListItem li = fAnswerList.getSelectedItem();
|
||||||
if(li != null) value = li.getValue().toString();
|
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
|
&& ( ! (DisplayType.isID(column.getAD_Reference_ID()) && defaultValue.equals("-1") ) ) ) // not for ID's with default -1
|
||||||
{
|
{
|
||||||
if (DisplayType.isText(column.getAD_Reference_ID())
|
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.YesNo
|
||||||
// Two special columns: Defined as Table but DB Type is String
|
// Two special columns: Defined as Table but DB Type is String
|
||||||
|| column.getColumnName().equals("EntityType") || column.getColumnName().equals("AD_Language")
|
|| 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
|
&& ( ! (DisplayType.isID(column.getAD_Reference_ID()) && defaultValue.equals("-1") ) ) ) // not for ID's with default -1
|
||||||
{
|
{
|
||||||
if (DisplayType.isText(column.getAD_Reference_ID())
|
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.YesNo
|
||||||
|| column.getAD_Reference_ID() == DisplayType.Payment
|
|| column.getAD_Reference_ID() == DisplayType.Payment
|
||||||
// Two special columns: Defined as Table but DB Type is String
|
// 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
|
&& ( ! (DisplayType.isID(column.getAD_Reference_ID()) && defaultValue.equals("-1") ) ) ) // not for ID's with default -1
|
||||||
{
|
{
|
||||||
if (DisplayType.isText(column.getAD_Reference_ID())
|
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.YesNo
|
||||||
// Two special columns: Defined as Table but DB Type is String
|
// Two special columns: Defined as Table but DB Type is String
|
||||||
|| column.getColumnName().equals("EntityType") || column.getColumnName().equals("AD_Language")
|
|| column.getColumnName().equals("EntityType") || column.getColumnName().equals("AD_Language")
|
||||||
|
|
|
@ -40,6 +40,11 @@ public class FakeDisplayTypeFactory implements IDisplayTypeFactory {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isList(int displayType) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isLookup(int displayType) {
|
public boolean isLookup(int displayType) {
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -1095,7 +1095,7 @@ public class ModelADServiceImpl extends AbstractService implements ModelADServic
|
||||||
AD_Reference_ID = ((MLookup)lookup).getDisplayType();
|
AD_Reference_ID = ((MLookup)lookup).getDisplayType();
|
||||||
}
|
}
|
||||||
|
|
||||||
if(AD_Reference_ID==DisplayType.List)
|
if(DisplayType.isList(AD_Reference_ID))
|
||||||
{
|
{
|
||||||
if (lookup.getSize() == 0)
|
if (lookup.getSize() == 0)
|
||||||
lookup.refresh();
|
lookup.refresh();
|
||||||
|
|
|
@ -543,7 +543,7 @@ public class Process {
|
||||||
Object value = valueString;
|
Object value = valueString;
|
||||||
if (valueString != null && valueString.length() == 0)
|
if (valueString != null && valueString.length() == 0)
|
||||||
value = null;
|
value = null;
|
||||||
if (value != null && (DisplayType.List == displayType ||
|
if (value != null && (DisplayType.isList(displayType) ||
|
||||||
DisplayType.TableDir== displayType ||
|
DisplayType.TableDir== displayType ||
|
||||||
DisplayType.Table== displayType)&& value.equals("-1"))
|
DisplayType.Table== displayType)&& value.equals("-1"))
|
||||||
value= null;
|
value= null;
|
||||||
|
|
Loading…
Reference in New Issue