Ticket #1004012 IDEMPIERE-1954 Implement MaxQueryRecords for AD_InfoWindow.
This commit is contained in:
parent
8ae6fad8dc
commit
dc50ef3418
|
@ -0,0 +1,29 @@
|
|||
SET SQLBLANKLINES ON
|
||||
SET DEFINE OFF
|
||||
|
||||
-- May 16, 2014 1:53:34 PM MYT
|
||||
-- IDEMPIERE-1954 Implement MaxQueryRecords for AD_InfoWindow
|
||||
INSERT INTO AD_Column (SeqNoSelection,IsSyncDatabase,Version,AD_Column_ID,IsMandatory,IsTranslated,IsIdentifier,SeqNo,IsParent,FieldLength,IsSelectionColumn,AD_Reference_ID,IsKey,IsAutocomplete,IsAllowLogging,AD_Column_UU,IsUpdateable,ColumnName,Description,DefaultValue,Help,Name,IsAllowCopy,Updated,CreatedBy,AD_Org_ID,IsActive,Created,UpdatedBy,IsToolbarButton,IsAlwaysUpdateable,AD_Client_ID,EntityType,IsEncrypted,IsSecure,AD_Element_ID,AD_Table_ID) VALUES (0,'N',1,211240,'Y','N','N',0,'N',10,'N',11,'N','N','Y','8266be38-9b40-4d93-99cb-81cbe10035b5','Y','MaxQueryRecords','If defined, you cannot query more records as defined - the query criteria needs to be changed to query less records','0','Enter the number of records a user will be able to query to avoid unnecessary system load. If 0, no restrictions are imposed.','Max Query Records','Y',TO_DATE('2014-05-16 13:53:33','YYYY-MM-DD HH24:MI:SS'),100,0,'Y',TO_DATE('2014-05-16 13:53:33','YYYY-MM-DD HH24:MI:SS'),100,'N','N',0,'D','N','N',2854,895)
|
||||
;
|
||||
|
||||
-- May 16, 2014 1:54:51 PM MYT
|
||||
INSERT INTO AD_Field (SortNo,IsEncrypted,AD_Tab_ID,DisplayLength,IsSameLine,IsHeading,AD_Column_ID,SeqNo,IsCentrallyMaintained,AD_Field_ID,IsReadOnly,Help,Description,Name,AD_Field_UU,IsDisplayed,IsFieldOnly,UpdatedBy,AD_Org_ID,CreatedBy,Updated,IsActive,IsDisplayedGrid,SeqNoGrid,XPosition,IsQuickEntry,AD_Client_ID,ColumnSpan,NumLines,IsAdvancedField,IsDefaultFocus,EntityType,Created) VALUES (0,'N',842,0,'N','N',211240,180,'Y',203024,'N','Enter the number of records a user will be able to query to avoid unnecessary system load. If 0, no restrictions are imposed.','If defined, you cannot query more records as defined - the query criteria needs to be changed to query less records','Max Query Records','ad1bced3-2965-45be-8982-fd64639b6863','Y','N',100,0,100,TO_DATE('2014-05-16 13:54:50','YYYY-MM-DD HH24:MI:SS'),'Y','Y',100,2,'N',0,2,1,'N','N','D',TO_DATE('2014-05-16 13:54:50','YYYY-MM-DD HH24:MI:SS'))
|
||||
;
|
||||
|
||||
-- May 16, 2014 1:55:27 PM MYT
|
||||
UPDATE AD_Field SET XPosition=1,Updated=TO_DATE('2014-05-16 13:55:27','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=203024
|
||||
;
|
||||
|
||||
-- May 16, 2014 2:16:23 PM MYT
|
||||
-- IDEMPIERE-1954 Implement MaxQueryRecords for AD_InfoWindow
|
||||
ALTER TABLE AD_InfoWindow ADD MaxQueryRecords NUMBER(10) DEFAULT 0 NOT NULL
|
||||
;
|
||||
|
||||
-- May 16, 2014 3:01:57 PM MYT
|
||||
-- IDEMPIERE-1954 Implement MaxQueryRecords for AD_InfoWindow
|
||||
INSERT INTO AD_Message (MsgType,MsgText,AD_Message_ID,EntityType,AD_Message_UU,Value,IsActive,Updated,CreatedBy,UpdatedBy,AD_Client_ID,AD_Org_ID,Created) VALUES ('E','Your search returned more than the maximum number of results allowed.<br>Please narrow down your search criteria and try your search again.',200274,'D','62341bf3-576c-4c9a-9cd3-4cb88b9bb989','InfoFindOverMax','Y',TO_DATE('2014-05-16 15:01:56','YYYY-MM-DD HH24:MI:SS'),100,100,0,0,TO_DATE('2014-05-16 15:01:56','YYYY-MM-DD HH24:MI:SS'))
|
||||
;
|
||||
|
||||
SELECT register_migration_script('201405160715_IDEMPIERE-1954.sql') FROM dual
|
||||
;
|
||||
|
|
@ -0,0 +1,26 @@
|
|||
-- May 16, 2014 1:53:34 PM MYT
|
||||
-- IDEMPIERE-1954 Implement MaxQueryRecords for AD_InfoWindow
|
||||
INSERT INTO AD_Column (SeqNoSelection,IsSyncDatabase,Version,AD_Column_ID,IsMandatory,IsTranslated,IsIdentifier,SeqNo,IsParent,FieldLength,IsSelectionColumn,AD_Reference_ID,IsKey,IsAutocomplete,IsAllowLogging,AD_Column_UU,IsUpdateable,ColumnName,Description,DefaultValue,Help,Name,IsAllowCopy,Updated,CreatedBy,AD_Org_ID,IsActive,Created,UpdatedBy,IsToolbarButton,IsAlwaysUpdateable,AD_Client_ID,EntityType,IsEncrypted,IsSecure,AD_Element_ID,AD_Table_ID) VALUES (0,'N',1,211240,'Y','N','N',0,'N',10,'N',11,'N','N','Y','8266be38-9b40-4d93-99cb-81cbe10035b5','Y','MaxQueryRecords','If defined, you cannot query more records as defined - the query criteria needs to be changed to query less records','0','Enter the number of records a user will be able to query to avoid unnecessary system load. If 0, no restrictions are imposed.','Max Query Records','Y',TO_TIMESTAMP('2014-05-16 13:53:33','YYYY-MM-DD HH24:MI:SS'),100,0,'Y',TO_TIMESTAMP('2014-05-16 13:53:33','YYYY-MM-DD HH24:MI:SS'),100,'N','N',0,'D','N','N',2854,895)
|
||||
;
|
||||
|
||||
-- May 16, 2014 1:54:51 PM MYT
|
||||
INSERT INTO AD_Field (SortNo,IsEncrypted,AD_Tab_ID,DisplayLength,IsSameLine,IsHeading,AD_Column_ID,SeqNo,IsCentrallyMaintained,AD_Field_ID,IsReadOnly,Help,Description,Name,AD_Field_UU,IsDisplayed,IsFieldOnly,UpdatedBy,AD_Org_ID,CreatedBy,Updated,IsActive,IsDisplayedGrid,SeqNoGrid,XPosition,IsQuickEntry,AD_Client_ID,ColumnSpan,NumLines,IsAdvancedField,IsDefaultFocus,EntityType,Created) VALUES (0,'N',842,0,'N','N',211240,180,'Y',203024,'N','Enter the number of records a user will be able to query to avoid unnecessary system load. If 0, no restrictions are imposed.','If defined, you cannot query more records as defined - the query criteria needs to be changed to query less records','Max Query Records','ad1bced3-2965-45be-8982-fd64639b6863','Y','N',100,0,100,TO_TIMESTAMP('2014-05-16 13:54:50','YYYY-MM-DD HH24:MI:SS'),'Y','Y',100,2,'N',0,2,1,'N','N','D',TO_TIMESTAMP('2014-05-16 13:54:50','YYYY-MM-DD HH24:MI:SS'))
|
||||
;
|
||||
|
||||
-- May 16, 2014 1:55:27 PM MYT
|
||||
UPDATE AD_Field SET XPosition=1,Updated=TO_TIMESTAMP('2014-05-16 13:55:27','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=203024
|
||||
;
|
||||
|
||||
-- May 16, 2014 2:16:23 PM MYT
|
||||
-- IDEMPIERE-1954 Implement MaxQueryRecords for AD_InfoWindow
|
||||
ALTER TABLE AD_InfoWindow ADD COLUMN MaxQueryRecords NUMERIC(10) DEFAULT '0' NOT NULL
|
||||
;
|
||||
|
||||
-- May 16, 2014 3:01:57 PM MYT
|
||||
-- IDEMPIERE-1954 Implement MaxQueryRecords for AD_InfoWindow
|
||||
INSERT INTO AD_Message (MsgType,MsgText,AD_Message_ID,EntityType,AD_Message_UU,Value,IsActive,Updated,CreatedBy,UpdatedBy,AD_Client_ID,AD_Org_ID,Created) VALUES ('E','Your search returned more than the maximum number of results allowed.<br>Please narrow down your search criteria and try your search again.',200274,'D','62341bf3-576c-4c9a-9cd3-4cb88b9bb989','InfoFindOverMax','Y',TO_TIMESTAMP('2014-05-16 15:01:56','YYYY-MM-DD HH24:MI:SS'),100,100,0,0,TO_TIMESTAMP('2014-05-16 15:01:56','YYYY-MM-DD HH24:MI:SS'))
|
||||
;
|
||||
|
||||
SELECT register_migration_script('201405160715_IDEMPIERE-1954.sql') FROM dual
|
||||
;
|
||||
|
|
@ -273,6 +273,19 @@ public interface I_AD_InfoWindow
|
|||
*/
|
||||
public boolean isValid();
|
||||
|
||||
/** Column name MaxQueryRecords */
|
||||
public static final String COLUMNNAME_MaxQueryRecords = "MaxQueryRecords";
|
||||
|
||||
/** Set Max Query Records.
|
||||
* If defined, you cannot query more records as defined - the query criteria needs to be changed to query less records
|
||||
*/
|
||||
public void setMaxQueryRecords (int MaxQueryRecords);
|
||||
|
||||
/** Get Max Query Records.
|
||||
* If defined, you cannot query more records as defined - the query criteria needs to be changed to query less records
|
||||
*/
|
||||
public int getMaxQueryRecords();
|
||||
|
||||
/** Column name Name */
|
||||
public static final String COLUMNNAME_Name = "Name";
|
||||
|
||||
|
|
|
@ -30,7 +30,7 @@ public class X_AD_InfoWindow extends PO implements I_AD_InfoWindow, I_Persistent
|
|||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 20140124L;
|
||||
private static final long serialVersionUID = 20140516L;
|
||||
|
||||
/** Standard Constructor */
|
||||
public X_AD_InfoWindow (Properties ctx, int AD_InfoWindow_ID, String trxName)
|
||||
|
@ -51,6 +51,8 @@ public class X_AD_InfoWindow extends PO implements I_AD_InfoWindow, I_Persistent
|
|||
// Y
|
||||
setIsValid (false);
|
||||
// N
|
||||
setMaxQueryRecords (0);
|
||||
// 0
|
||||
setName (null);
|
||||
} */
|
||||
}
|
||||
|
@ -385,6 +387,26 @@ public class X_AD_InfoWindow extends PO implements I_AD_InfoWindow, I_Persistent
|
|||
return false;
|
||||
}
|
||||
|
||||
/** Set Max Query Records.
|
||||
@param MaxQueryRecords
|
||||
If defined, you cannot query more records as defined - the query criteria needs to be changed to query less records
|
||||
*/
|
||||
public void setMaxQueryRecords (int MaxQueryRecords)
|
||||
{
|
||||
set_Value (COLUMNNAME_MaxQueryRecords, Integer.valueOf(MaxQueryRecords));
|
||||
}
|
||||
|
||||
/** Get Max Query Records.
|
||||
@return If defined, you cannot query more records as defined - the query criteria needs to be changed to query less records
|
||||
*/
|
||||
public int getMaxQueryRecords ()
|
||||
{
|
||||
Integer ii = (Integer)get_Value(COLUMNNAME_MaxQueryRecords);
|
||||
if (ii == null)
|
||||
return 0;
|
||||
return ii.intValue();
|
||||
}
|
||||
|
||||
/** Set Name.
|
||||
@param Name
|
||||
Alphanumeric identifier of the entity
|
||||
|
|
|
@ -40,6 +40,7 @@ import org.adempiere.webui.event.ValueChangeEvent;
|
|||
import org.adempiere.webui.event.ValueChangeListener;
|
||||
import org.adempiere.webui.panel.InfoPanel;
|
||||
import org.adempiere.webui.session.SessionManager;
|
||||
import org.adempiere.webui.window.FDialog;
|
||||
import org.compiere.minigrid.ColumnInfo;
|
||||
import org.compiere.minigrid.EmbedWinInfo;
|
||||
import org.compiere.minigrid.IDColumn;
|
||||
|
@ -185,7 +186,7 @@ public class InfoWindow extends InfoPanel implements ValueChangeListener, EventL
|
|||
for (int i = 0; i < identifiers.size(); i++) {
|
||||
WEditor editor = identifiers.get(i);
|
||||
editor.setValue(queryValue);
|
||||
testCount();
|
||||
testCount(false);
|
||||
if (m_count > 0) {
|
||||
break;
|
||||
} else {
|
||||
|
@ -202,7 +203,7 @@ public class InfoWindow extends InfoPanel implements ValueChangeListener, EventL
|
|||
WEditor editor = identifiers.get(i);
|
||||
editor.setValue(values[i]);
|
||||
}
|
||||
testCount();
|
||||
testCount(false);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1090,6 +1091,15 @@ public class InfoWindow extends InfoPanel implements ValueChangeListener, EventL
|
|||
* @return true if display
|
||||
*/
|
||||
protected boolean testCount()
|
||||
{
|
||||
return testCount(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test Row Count
|
||||
* @return true if display
|
||||
*/
|
||||
private boolean testCount(boolean promptError)
|
||||
{
|
||||
long start = System.currentTimeMillis();
|
||||
String dynWhere = getSQLWhere();
|
||||
|
@ -1137,6 +1147,16 @@ public class InfoWindow extends InfoPanel implements ValueChangeListener, EventL
|
|||
if (log.isLoggable(Level.FINE))
|
||||
log.fine("#" + m_count + " - " + (System.currentTimeMillis()-start) + "ms");
|
||||
|
||||
if (infoWindow.getMaxQueryRecords() > 0 && m_count > infoWindow.getMaxQueryRecords())
|
||||
{
|
||||
if (promptError)
|
||||
{
|
||||
FDialog.error(getWindowNo(), this, "InfoFindOverMax",
|
||||
m_count + " > " + infoWindow.getMaxQueryRecords());
|
||||
}
|
||||
m_count = 0;
|
||||
}
|
||||
|
||||
return true;
|
||||
} // testCount
|
||||
|
||||
|
|
|
@ -352,14 +352,17 @@ public abstract class InfoPanel extends Window implements EventListener<Event>,
|
|||
cacheEnd = -1;
|
||||
|
||||
testCount();
|
||||
m_useDatabasePaging = (m_count > 1000);
|
||||
if (m_useDatabasePaging)
|
||||
if (m_count > 0)
|
||||
{
|
||||
return ;
|
||||
}
|
||||
else
|
||||
{
|
||||
readLine(0, -1);
|
||||
m_useDatabasePaging = (m_count > 1000);
|
||||
if (m_useDatabasePaging)
|
||||
{
|
||||
return ;
|
||||
}
|
||||
else
|
||||
{
|
||||
readLine(0, -1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue