IDEMPIERE-1132 Improve AD_Index; AD_View; foreign keys management

This commit is contained in:
Elaine Tan 2013-07-05 14:46:21 +08:00
parent 61a0d9ca4b
commit 9c5a73d4dd
19 changed files with 8965 additions and 1 deletions

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,196 @@
/******************************************************************************
* Product: iDempiere ERP & CRM Smart Business Solution *
* Copyright (C) 1999-2012 ComPiere, Inc. All Rights Reserved. *
* This program is free software, you can redistribute it and/or modify it *
* under the terms version 2 of the GNU General Public License as published *
* by the Free Software Foundation. This program is distributed in the hope *
* that it will be useful, but WITHOUT ANY WARRANTY, without even the implied *
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
* See the GNU General Public License for more details. *
* You should have received a copy of the GNU General Public License along *
* with this program, if not, write to the Free Software Foundation, Inc., *
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
* For the text or an alternative of this public license, you may reach us *
* ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA *
* or via info@compiere.org or http://www.compiere.org/license.html *
*****************************************************************************/
package org.compiere.model;
import java.math.BigDecimal;
import java.sql.Timestamp;
import org.compiere.util.KeyNamePair;
/** Generated Interface for AD_IndexColumn
* @author iDempiere (generated)
* @version Release 1.0c
*/
public interface I_AD_IndexColumn
{
/** TableName=AD_IndexColumn */
public static final String Table_Name = "AD_IndexColumn";
/** AD_Table_ID=200086 */
public static final int Table_ID = 200086;
KeyNamePair Model = new KeyNamePair(Table_ID, Table_Name);
/** AccessLevel = 4 - System
*/
BigDecimal accessLevel = BigDecimal.valueOf(4);
/** Load Meta Data */
/** Column name AD_Client_ID */
public static final String COLUMNNAME_AD_Client_ID = "AD_Client_ID";
/** Get Client.
* Client/Tenant for this installation.
*/
public int getAD_Client_ID();
/** Column name AD_Column_ID */
public static final String COLUMNNAME_AD_Column_ID = "AD_Column_ID";
/** Set Column.
* Column in the table
*/
public void setAD_Column_ID (int AD_Column_ID);
/** Get Column.
* Column in the table
*/
public int getAD_Column_ID();
public org.compiere.model.I_AD_Column getAD_Column() throws RuntimeException;
/** Column name AD_IndexColumn_ID */
public static final String COLUMNNAME_AD_IndexColumn_ID = "AD_IndexColumn_ID";
/** Set Table Index Column */
public void setAD_IndexColumn_ID (int AD_IndexColumn_ID);
/** Get Table Index Column */
public int getAD_IndexColumn_ID();
/** Column name AD_IndexColumn_UU */
public static final String COLUMNNAME_AD_IndexColumn_UU = "AD_IndexColumn_UU";
/** Set AD_IndexColumn_UU */
public void setAD_IndexColumn_UU (String AD_IndexColumn_UU);
/** Get AD_IndexColumn_UU */
public String getAD_IndexColumn_UU();
/** Column name AD_Org_ID */
public static final String COLUMNNAME_AD_Org_ID = "AD_Org_ID";
/** Set Organization.
* Organizational entity within client
*/
public void setAD_Org_ID (int AD_Org_ID);
/** Get Organization.
* Organizational entity within client
*/
public int getAD_Org_ID();
/** Column name AD_TableIndex_ID */
public static final String COLUMNNAME_AD_TableIndex_ID = "AD_TableIndex_ID";
/** Set Table Index */
public void setAD_TableIndex_ID (int AD_TableIndex_ID);
/** Get Table Index */
public int getAD_TableIndex_ID();
public org.compiere.model.I_AD_TableIndex getAD_TableIndex() throws RuntimeException;
/** Column name ColumnSQL */
public static final String COLUMNNAME_ColumnSQL = "ColumnSQL";
/** Set Column SQL.
* Virtual Column (r/o)
*/
public void setColumnSQL (String ColumnSQL);
/** Get Column SQL.
* Virtual Column (r/o)
*/
public String getColumnSQL();
/** Column name Created */
public static final String COLUMNNAME_Created = "Created";
/** Get Created.
* Date this record was created
*/
public Timestamp getCreated();
/** Column name CreatedBy */
public static final String COLUMNNAME_CreatedBy = "CreatedBy";
/** Get Created By.
* User who created this records
*/
public int getCreatedBy();
/** Column name EntityType */
public static final String COLUMNNAME_EntityType = "EntityType";
/** Set Entity Type.
* Dictionary Entity Type;
Determines ownership and synchronization
*/
public void setEntityType (String EntityType);
/** Get Entity Type.
* Dictionary Entity Type;
Determines ownership and synchronization
*/
public String getEntityType();
/** Column name IsActive */
public static final String COLUMNNAME_IsActive = "IsActive";
/** Set Active.
* The record is active in the system
*/
public void setIsActive (boolean IsActive);
/** Get Active.
* The record is active in the system
*/
public boolean isActive();
/** Column name SeqNo */
public static final String COLUMNNAME_SeqNo = "SeqNo";
/** Set Sequence.
* Method of ordering records;
lowest number comes first
*/
public void setSeqNo (int SeqNo);
/** Get Sequence.
* Method of ordering records;
lowest number comes first
*/
public int getSeqNo();
/** Column name Updated */
public static final String COLUMNNAME_Updated = "Updated";
/** Get Updated.
* Date this record was updated
*/
public Timestamp getUpdated();
/** Column name UpdatedBy */
public static final String COLUMNNAME_UpdatedBy = "UpdatedBy";
/** Get Updated By.
* User who updated this records
*/
public int getUpdatedBy();
}

View File

@ -334,6 +334,15 @@ public interface I_AD_Table
public org.compiere.model.I_AD_Window getPO_Window() throws RuntimeException;
/** Column name Processing */
public static final String COLUMNNAME_Processing = "Processing";
/** Set Process Now */
public void setProcessing (boolean Processing);
/** Get Process Now */
public boolean isProcessing();
/** Column name ReplicationType */
public static final String COLUMNNAME_ReplicationType = "ReplicationType";

View File

@ -0,0 +1,238 @@
/******************************************************************************
* Product: iDempiere ERP & CRM Smart Business Solution *
* Copyright (C) 1999-2012 ComPiere, Inc. All Rights Reserved. *
* This program is free software, you can redistribute it and/or modify it *
* under the terms version 2 of the GNU General Public License as published *
* by the Free Software Foundation. This program is distributed in the hope *
* that it will be useful, but WITHOUT ANY WARRANTY, without even the implied *
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
* See the GNU General Public License for more details. *
* You should have received a copy of the GNU General Public License along *
* with this program, if not, write to the Free Software Foundation, Inc., *
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
* For the text or an alternative of this public license, you may reach us *
* ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA *
* or via info@compiere.org or http://www.compiere.org/license.html *
*****************************************************************************/
package org.compiere.model;
import java.math.BigDecimal;
import java.sql.Timestamp;
import org.compiere.util.KeyNamePair;
/** Generated Interface for AD_TableIndex
* @author iDempiere (generated)
* @version Release 1.0c
*/
public interface I_AD_TableIndex
{
/** TableName=AD_TableIndex */
public static final String Table_Name = "AD_TableIndex";
/** AD_Table_ID=200085 */
public static final int Table_ID = 200085;
KeyNamePair Model = new KeyNamePair(Table_ID, Table_Name);
/** AccessLevel = 4 - System
*/
BigDecimal accessLevel = BigDecimal.valueOf(4);
/** Load Meta Data */
/** Column name AD_Client_ID */
public static final String COLUMNNAME_AD_Client_ID = "AD_Client_ID";
/** Get Client.
* Client/Tenant for this installation.
*/
public int getAD_Client_ID();
/** Column name AD_Message_ID */
public static final String COLUMNNAME_AD_Message_ID = "AD_Message_ID";
/** Set Message.
* System Message
*/
public void setAD_Message_ID (int AD_Message_ID);
/** Get Message.
* System Message
*/
public int getAD_Message_ID();
public org.compiere.model.I_AD_Message getAD_Message() throws RuntimeException;
/** Column name AD_Org_ID */
public static final String COLUMNNAME_AD_Org_ID = "AD_Org_ID";
/** Set Organization.
* Organizational entity within client
*/
public void setAD_Org_ID (int AD_Org_ID);
/** Get Organization.
* Organizational entity within client
*/
public int getAD_Org_ID();
/** Column name AD_Table_ID */
public static final String COLUMNNAME_AD_Table_ID = "AD_Table_ID";
/** Set Table.
* Database Table information
*/
public void setAD_Table_ID (int AD_Table_ID);
/** Get Table.
* Database Table information
*/
public int getAD_Table_ID();
public org.compiere.model.I_AD_Table getAD_Table() throws RuntimeException;
/** Column name AD_TableIndex_ID */
public static final String COLUMNNAME_AD_TableIndex_ID = "AD_TableIndex_ID";
/** Set Table Index */
public void setAD_TableIndex_ID (int AD_TableIndex_ID);
/** Get Table Index */
public int getAD_TableIndex_ID();
/** Column name AD_TableIndex_UU */
public static final String COLUMNNAME_AD_TableIndex_UU = "AD_TableIndex_UU";
/** Set AD_TableIndex_UU */
public void setAD_TableIndex_UU (String AD_TableIndex_UU);
/** Get AD_TableIndex_UU */
public String getAD_TableIndex_UU();
/** Column name Created */
public static final String COLUMNNAME_Created = "Created";
/** Get Created.
* Date this record was created
*/
public Timestamp getCreated();
/** Column name CreatedBy */
public static final String COLUMNNAME_CreatedBy = "CreatedBy";
/** Get Created By.
* User who created this records
*/
public int getCreatedBy();
/** Column name Description */
public static final String COLUMNNAME_Description = "Description";
/** Set Description.
* Optional short description of the record
*/
public void setDescription (String Description);
/** Get Description.
* Optional short description of the record
*/
public String getDescription();
/** Column name EntityType */
public static final String COLUMNNAME_EntityType = "EntityType";
/** Set Entity Type.
* Dictionary Entity Type;
Determines ownership and synchronization
*/
public void setEntityType (String EntityType);
/** Get Entity Type.
* Dictionary Entity Type;
Determines ownership and synchronization
*/
public String getEntityType();
/** Column name Help */
public static final String COLUMNNAME_Help = "Help";
/** Set Comment/Help.
* Comment or Hint
*/
public void setHelp (String Help);
/** Get Comment/Help.
* Comment or Hint
*/
public String getHelp();
/** Column name IsActive */
public static final String COLUMNNAME_IsActive = "IsActive";
/** Set Active.
* The record is active in the system
*/
public void setIsActive (boolean IsActive);
/** Get Active.
* The record is active in the system
*/
public boolean isActive();
/** Column name IsCreateConstraint */
public static final String COLUMNNAME_IsCreateConstraint = "IsCreateConstraint";
/** Set Create Constraint */
public void setIsCreateConstraint (boolean IsCreateConstraint);
/** Get Create Constraint */
public boolean isCreateConstraint();
/** Column name IsUnique */
public static final String COLUMNNAME_IsUnique = "IsUnique";
/** Set Unique */
public void setIsUnique (boolean IsUnique);
/** Get Unique */
public boolean isUnique();
/** Column name Name */
public static final String COLUMNNAME_Name = "Name";
/** Set Name.
* Alphanumeric identifier of the entity
*/
public void setName (String Name);
/** Get Name.
* Alphanumeric identifier of the entity
*/
public String getName();
/** Column name Processing */
public static final String COLUMNNAME_Processing = "Processing";
/** Set Process Now */
public void setProcessing (boolean Processing);
/** Get Process Now */
public boolean isProcessing();
/** Column name Updated */
public static final String COLUMNNAME_Updated = "Updated";
/** Get Updated.
* Date this record was updated
*/
public Timestamp getUpdated();
/** Column name UpdatedBy */
public static final String COLUMNNAME_UpdatedBy = "UpdatedBy";
/** Get Updated By.
* User who updated this records
*/
public int getUpdatedBy();
}

View File

@ -0,0 +1,214 @@
/******************************************************************************
* Product: iDempiere ERP & CRM Smart Business Solution *
* Copyright (C) 1999-2012 ComPiere, Inc. All Rights Reserved. *
* This program is free software, you can redistribute it and/or modify it *
* under the terms version 2 of the GNU General Public License as published *
* by the Free Software Foundation. This program is distributed in the hope *
* that it will be useful, but WITHOUT ANY WARRANTY, without even the implied *
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
* See the GNU General Public License for more details. *
* You should have received a copy of the GNU General Public License along *
* with this program, if not, write to the Free Software Foundation, Inc., *
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
* For the text or an alternative of this public license, you may reach us *
* ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA *
* or via info@compiere.org or http://www.compiere.org/license.html *
*****************************************************************************/
package org.compiere.model;
import java.math.BigDecimal;
import java.sql.Timestamp;
import org.compiere.util.KeyNamePair;
/** Generated Interface for AD_ViewColumn
* @author iDempiere (generated)
* @version Release 1.0c
*/
public interface I_AD_ViewColumn
{
/** TableName=AD_ViewColumn */
public static final String Table_Name = "AD_ViewColumn";
/** AD_Table_ID=200088 */
public static final int Table_ID = 200088;
KeyNamePair Model = new KeyNamePair(Table_ID, Table_Name);
/** AccessLevel = 4 - System
*/
BigDecimal accessLevel = BigDecimal.valueOf(4);
/** Load Meta Data */
/** Column name AD_Client_ID */
public static final String COLUMNNAME_AD_Client_ID = "AD_Client_ID";
/** Get Client.
* Client/Tenant for this installation.
*/
public int getAD_Client_ID();
/** Column name AD_Org_ID */
public static final String COLUMNNAME_AD_Org_ID = "AD_Org_ID";
/** Set Organization.
* Organizational entity within client
*/
public void setAD_Org_ID (int AD_Org_ID);
/** Get Organization.
* Organizational entity within client
*/
public int getAD_Org_ID();
/** Column name AD_ViewColumn_ID */
public static final String COLUMNNAME_AD_ViewColumn_ID = "AD_ViewColumn_ID";
/** Set Database View Column */
public void setAD_ViewColumn_ID (int AD_ViewColumn_ID);
/** Get Database View Column */
public int getAD_ViewColumn_ID();
/** Column name AD_ViewColumn_UU */
public static final String COLUMNNAME_AD_ViewColumn_UU = "AD_ViewColumn_UU";
/** Set AD_ViewColumn_UU */
public void setAD_ViewColumn_UU (String AD_ViewColumn_UU);
/** Get AD_ViewColumn_UU */
public String getAD_ViewColumn_UU();
/** Column name AD_ViewComponent_ID */
public static final String COLUMNNAME_AD_ViewComponent_ID = "AD_ViewComponent_ID";
/** Set Database View Component */
public void setAD_ViewComponent_ID (int AD_ViewComponent_ID);
/** Get Database View Component */
public int getAD_ViewComponent_ID();
public org.compiere.model.I_AD_ViewComponent getAD_ViewComponent() throws RuntimeException;
/** Column name ColumnName */
public static final String COLUMNNAME_ColumnName = "ColumnName";
/** Set DB Column Name.
* Name of the column in the database
*/
public void setColumnName (String ColumnName);
/** Get DB Column Name.
* Name of the column in the database
*/
public String getColumnName();
/** Column name ColumnSQL */
public static final String COLUMNNAME_ColumnSQL = "ColumnSQL";
/** Set Column SQL.
* Virtual Column (r/o)
*/
public void setColumnSQL (String ColumnSQL);
/** Get Column SQL.
* Virtual Column (r/o)
*/
public String getColumnSQL();
/** Column name Created */
public static final String COLUMNNAME_Created = "Created";
/** Get Created.
* Date this record was created
*/
public Timestamp getCreated();
/** Column name CreatedBy */
public static final String COLUMNNAME_CreatedBy = "CreatedBy";
/** Get Created By.
* User who created this records
*/
public int getCreatedBy();
/** Column name DBDataType */
public static final String COLUMNNAME_DBDataType = "DBDataType";
/** Set Database Data Type */
public void setDBDataType (String DBDataType);
/** Get Database Data Type */
public String getDBDataType();
/** Column name Description */
public static final String COLUMNNAME_Description = "Description";
/** Set Description.
* Optional short description of the record
*/
public void setDescription (String Description);
/** Get Description.
* Optional short description of the record
*/
public String getDescription();
/** Column name EntityType */
public static final String COLUMNNAME_EntityType = "EntityType";
/** Set Entity Type.
* Dictionary Entity Type;
Determines ownership and synchronization
*/
public void setEntityType (String EntityType);
/** Get Entity Type.
* Dictionary Entity Type;
Determines ownership and synchronization
*/
public String getEntityType();
/** Column name Help */
public static final String COLUMNNAME_Help = "Help";
/** Set Comment/Help.
* Comment or Hint
*/
public void setHelp (String Help);
/** Get Comment/Help.
* Comment or Hint
*/
public String getHelp();
/** Column name IsActive */
public static final String COLUMNNAME_IsActive = "IsActive";
/** Set Active.
* The record is active in the system
*/
public void setIsActive (boolean IsActive);
/** Get Active.
* The record is active in the system
*/
public boolean isActive();
/** Column name Updated */
public static final String COLUMNNAME_Updated = "Updated";
/** Get Updated.
* Date this record was updated
*/
public Timestamp getUpdated();
/** Column name UpdatedBy */
public static final String COLUMNNAME_UpdatedBy = "UpdatedBy";
/** Get Updated By.
* User who updated this records
*/
public int getUpdatedBy();
}

View File

@ -0,0 +1,261 @@
/******************************************************************************
* Product: iDempiere ERP & CRM Smart Business Solution *
* Copyright (C) 1999-2012 ComPiere, Inc. All Rights Reserved. *
* This program is free software, you can redistribute it and/or modify it *
* under the terms version 2 of the GNU General Public License as published *
* by the Free Software Foundation. This program is distributed in the hope *
* that it will be useful, but WITHOUT ANY WARRANTY, without even the implied *
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
* See the GNU General Public License for more details. *
* You should have received a copy of the GNU General Public License along *
* with this program, if not, write to the Free Software Foundation, Inc., *
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
* For the text or an alternative of this public license, you may reach us *
* ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA *
* or via info@compiere.org or http://www.compiere.org/license.html *
*****************************************************************************/
package org.compiere.model;
import java.math.BigDecimal;
import java.sql.Timestamp;
import org.compiere.util.KeyNamePair;
/** Generated Interface for AD_ViewComponent
* @author iDempiere (generated)
* @version Release 1.0c
*/
public interface I_AD_ViewComponent
{
/** TableName=AD_ViewComponent */
public static final String Table_Name = "AD_ViewComponent";
/** AD_Table_ID=200087 */
public static final int Table_ID = 200087;
KeyNamePair Model = new KeyNamePair(Table_ID, Table_Name);
/** AccessLevel = 4 - System
*/
BigDecimal accessLevel = BigDecimal.valueOf(4);
/** Load Meta Data */
/** Column name AD_Client_ID */
public static final String COLUMNNAME_AD_Client_ID = "AD_Client_ID";
/** Get Client.
* Client/Tenant for this installation.
*/
public int getAD_Client_ID();
/** Column name AD_Org_ID */
public static final String COLUMNNAME_AD_Org_ID = "AD_Org_ID";
/** Set Organization.
* Organizational entity within client
*/
public void setAD_Org_ID (int AD_Org_ID);
/** Get Organization.
* Organizational entity within client
*/
public int getAD_Org_ID();
/** Column name AD_Table_ID */
public static final String COLUMNNAME_AD_Table_ID = "AD_Table_ID";
/** Set Table.
* Database Table information
*/
public void setAD_Table_ID (int AD_Table_ID);
/** Get Table.
* Database Table information
*/
public int getAD_Table_ID();
public org.compiere.model.I_AD_Table getAD_Table() throws RuntimeException;
/** Column name AD_ViewComponent_ID */
public static final String COLUMNNAME_AD_ViewComponent_ID = "AD_ViewComponent_ID";
/** Set Database View Component */
public void setAD_ViewComponent_ID (int AD_ViewComponent_ID);
/** Get Database View Component */
public int getAD_ViewComponent_ID();
/** Column name AD_ViewComponent_UU */
public static final String COLUMNNAME_AD_ViewComponent_UU = "AD_ViewComponent_UU";
/** Set AD_ViewComponent_UU */
public void setAD_ViewComponent_UU (String AD_ViewComponent_UU);
/** Get AD_ViewComponent_UU */
public String getAD_ViewComponent_UU();
/** Column name Created */
public static final String COLUMNNAME_Created = "Created";
/** Get Created.
* Date this record was created
*/
public Timestamp getCreated();
/** Column name CreatedBy */
public static final String COLUMNNAME_CreatedBy = "CreatedBy";
/** Get Created By.
* User who created this records
*/
public int getCreatedBy();
/** Column name Description */
public static final String COLUMNNAME_Description = "Description";
/** Set Description.
* Optional short description of the record
*/
public void setDescription (String Description);
/** Get Description.
* Optional short description of the record
*/
public String getDescription();
/** Column name EntityType */
public static final String COLUMNNAME_EntityType = "EntityType";
/** Set Entity Type.
* Dictionary Entity Type;
Determines ownership and synchronization
*/
public void setEntityType (String EntityType);
/** Get Entity Type.
* Dictionary Entity Type;
Determines ownership and synchronization
*/
public String getEntityType();
/** Column name FromClause */
public static final String COLUMNNAME_FromClause = "FromClause";
/** Set Sql FROM.
* SQL FROM clause
*/
public void setFromClause (String FromClause);
/** Get Sql FROM.
* SQL FROM clause
*/
public String getFromClause();
/** Column name Help */
public static final String COLUMNNAME_Help = "Help";
/** Set Comment/Help.
* Comment or Hint
*/
public void setHelp (String Help);
/** Get Comment/Help.
* Comment or Hint
*/
public String getHelp();
/** Column name IsActive */
public static final String COLUMNNAME_IsActive = "IsActive";
/** Set Active.
* The record is active in the system
*/
public void setIsActive (boolean IsActive);
/** Get Active.
* The record is active in the system
*/
public boolean isActive();
/** Column name Name */
public static final String COLUMNNAME_Name = "Name";
/** Set Name.
* Alphanumeric identifier of the entity
*/
public void setName (String Name);
/** Get Name.
* Alphanumeric identifier of the entity
*/
public String getName();
/** Column name OtherClause */
public static final String COLUMNNAME_OtherClause = "OtherClause";
/** Set Other SQL Clause.
* Other SQL Clause
*/
public void setOtherClause (String OtherClause);
/** Get Other SQL Clause.
* Other SQL Clause
*/
public String getOtherClause();
/** Column name Referenced_Table_ID */
public static final String COLUMNNAME_Referenced_Table_ID = "Referenced_Table_ID";
/** Set Referenced Table */
public void setReferenced_Table_ID (int Referenced_Table_ID);
/** Get Referenced Table */
public int getReferenced_Table_ID();
public org.compiere.model.I_AD_Table getReferenced_Table() throws RuntimeException;
/** Column name SeqNo */
public static final String COLUMNNAME_SeqNo = "SeqNo";
/** Set Sequence.
* Method of ordering records;
lowest number comes first
*/
public void setSeqNo (int SeqNo);
/** Get Sequence.
* Method of ordering records;
lowest number comes first
*/
public int getSeqNo();
/** Column name Updated */
public static final String COLUMNNAME_Updated = "Updated";
/** Get Updated.
* Date this record was updated
*/
public Timestamp getUpdated();
/** Column name UpdatedBy */
public static final String COLUMNNAME_UpdatedBy = "UpdatedBy";
/** Get Updated By.
* User who updated this records
*/
public int getUpdatedBy();
/** Column name WhereClause */
public static final String COLUMNNAME_WhereClause = "WhereClause";
/** Set Sql WHERE.
* Fully qualified SQL WHERE clause
*/
public void setWhereClause (String WhereClause);
/** Get Sql WHERE.
* Fully qualified SQL WHERE clause
*/
public String getWhereClause();
}

View File

@ -0,0 +1,91 @@
/******************************************************************************
* Product: Compiere ERP & CRM Smart Business Solution *
* Copyright (C) 1999-2007 ComPiere, Inc. All Rights Reserved. *
* This program is free software, you can redistribute it and/or modify it *
* under the terms version 2 of the GNU General Public License as published *
* by the Free Software Foundation. This program is distributed in the hope *
* that it will be useful, but WITHOUT ANY WARRANTY, without even the implied *
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
* See the GNU General Public License for more details. *
* You should have received a copy of the GNU General Public License along *
* with this program, if not, write to the Free Software Foundation, Inc., *
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
* For the text or an alternative of this public license, you may reach us *
* ComPiere, Inc., 3600 Bridge Parkway #102, Redwood City, CA 94065, USA *
* or via info@compiere.org or http://www.compiere.org/license.html *
*****************************************************************************/
package org.compiere.model;
import java.sql.ResultSet;
import java.util.Properties;
public class MIndexColumn extends X_AD_IndexColumn {
/**
*
*/
private static final long serialVersionUID = -7588207529142215755L;
/**
* Standard constructor
* @param ctx context
* @param AD_IndexColumn_ID index column
* @param trxName trx name
*/
public MIndexColumn(Properties ctx, int AD_IndexColumn_ID, String trxName)
{
super(ctx, AD_IndexColumn_ID, trxName);
}
/**
* Load constructor
* @param ctx context
* @param rs result set
* @param trxName trx name
*/
public MIndexColumn(Properties ctx, ResultSet rs, String trxName)
{
super(ctx, rs, trxName);
}
/**
* Parent constructor
* @param parent parent
* @param column column
* @param seqNo sequence no
*/
public MIndexColumn(MTableIndex parent, MColumn column, int seqNo)
{
this(parent.getCtx(), 0, parent.get_TrxName());
setClientOrg(parent);
setAD_TableIndex_ID(parent.getAD_TableIndex_ID());
setAD_Column_ID(column.getAD_Column_ID());
setSeqNo(seqNo);
}
/**
* Get column name
* @return column name
*/
public String getColumnName()
{
String sql = getColumnSQL(); // Function Index
if (sql != null && sql.length() > 0)
return sql;
int AD_Column_ID = getAD_Column_ID();
return MColumn.getColumnName(getCtx(), AD_Column_ID);
}
/**
* String representation
* @return info
*/
@Override
public String toString()
{
StringBuilder sb = new StringBuilder("MIndexColumn[");
sb.append(get_ID()).append("-").append(getAD_Column_ID()).append("]");
return sb.toString();
}
}

View File

@ -210,6 +210,8 @@ public class MTable extends X_AD_Table
private Map<String, Integer> m_columnNameMap;
/** ad_column_id to index map **/
private Map<Integer, Integer> m_columnIdMap;
/** View Components */
private MViewComponent[] m_viewComponents = null;
/**
* Get Columns
@ -625,6 +627,29 @@ public class MTable extends X_AD_Table
return new Query(this.getCtx(), this, whereClause, trxName);
}
/**
* Get view components
* @param reload reload data
* @return array of view component
*/
public MViewComponent[] getViewComponent(boolean reload)
{
if (!isView() || !isActive())
return null;
if (m_viewComponents != null && !reload)
return m_viewComponents;
Query query = new Query(getCtx(), MViewComponent.Table_Name, MViewComponent.COLUMNNAME_AD_Table_ID + "=?", get_TrxName());
query.setParameters(getAD_Table_ID());
query.setOnlyActiveRecords(true);
List<MTableIndex> list = query.<MTableIndex>list();
m_viewComponents = new MViewComponent[list.size()];
list.toArray(m_viewComponents);
return m_viewComponents;
}
/**
* String Representation
* @return info

View File

@ -0,0 +1,218 @@
/******************************************************************************
* Product: Compiere ERP & CRM Smart Business Solution *
* Copyright (C) 1999-2007 ComPiere, Inc. All Rights Reserved. *
* This program is free software, you can redistribute it and/or modify it *
* under the terms version 2 of the GNU General Public License as published *
* by the Free Software Foundation. This program is distributed in the hope *
* that it will be useful, but WITHOUT ANY WARRANTY, without even the implied *
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
* See the GNU General Public License for more details. *
* You should have received a copy of the GNU General Public License along *
* with this program, if not, write to the Free Software Foundation, Inc., *
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
* For the text or an alternative of this public license, you may reach us *
* ComPiere, Inc., 3600 Bridge Parkway #102, Redwood City, CA 94065, USA *
* or via info@compiere.org or http://www.compiere.org/license.html *
*****************************************************************************/
package org.compiere.model;
import java.sql.ResultSet;
import java.util.List;
import java.util.Properties;
import org.adempiere.exceptions.AdempiereException;
import org.compiere.util.Msg;
public class MTableIndex extends X_AD_TableIndex {
/**
*
*/
private static final long serialVersionUID = 2672452678101398999L;
/**
* Get active indexes from table
* @param table table
* @return array of table index
*/
public static MTableIndex[] get(MTable table)
{
Query query = new Query(table.getCtx(), table, MTableIndex.COLUMNNAME_AD_Table_ID + "=?", table.get_TrxName());
query.setParameters(table.getAD_Table_ID());
query.setOnlyActiveRecords(true);
List<MTableIndex> list = query.<MTableIndex>list();
MTableIndex[] retValue = new MTableIndex[list.size()];
list.toArray(retValue);
return retValue;
}
/**
* Get table indexes with where clause
* @param ctx context
* @param whereClause where clause
* @return array of table index
*/
public static List<MTableIndex> getTableIndexesByQuery(Properties ctx, String whereClause)
{
Query query = new Query(ctx, MTableIndex.Table_Name, whereClause, null);
List<MTableIndex> list = query.<MTableIndex>list();
return list;
}
/**
* Standard constructor
* @param ctx context
* @param AD_TableIndex_ID table index
* @param trxName trx name
*/
public MTableIndex(Properties ctx, int AD_TableIndex_ID, String trxName)
{
super(ctx, AD_TableIndex_ID, trxName);
if (AD_TableIndex_ID == 0)
{
setEntityType(ENTITYTYPE_UserMaintained);
setIsUnique(false);
setIsCreateConstraint(false);
}
}
/**
* Load constructor
* @param ctx context
* @param rs result set
* @param trxName trx name
*/
public MTableIndex(Properties ctx, ResultSet rs, String trxName)
{
super(ctx, rs, trxName);
m_ddl = createDDL();
}
/**
* Parent constructor
* @param parent parent
* @param name name
*/
public MTableIndex(MTable parent, String name)
{
this(parent.getCtx(), 0, parent.get_TrxName());
setClientOrg(parent);
setAD_Table_ID(parent.getAD_Table_ID());
setEntityType(parent.getEntityType());
setName(name);
}
/** Lines */
private MIndexColumn[] m_columns = null;
/** Index Create DDL */
private String m_ddl = null;
/**
* Get index columns
* @param reload reload data
* @return array of index column
*/
public MIndexColumn[] getColumns(boolean reload)
{
if (m_columns != null && !reload)
return m_columns;
Query query = new Query(getCtx(), MIndexColumn.Table_Name, MIndexColumn.COLUMNNAME_AD_TableIndex_ID + "=?", get_TrxName());
query.setParameters(getAD_TableIndex_ID());
query.setOrderBy(MIndexColumn.COLUMNNAME_SeqNo);
List<MIndexColumn> list = query.<MIndexColumn>list();
m_columns = new MIndexColumn[list.size()];
list.toArray(m_columns);
return m_columns;
}
/**
* Get table name
* @return table name
*/
public String getTableName()
{
int AD_Table_ID = getAD_Table_ID();
return MTable.getTableName(getCtx(), AD_Table_ID);
}
/**
* Get SQL DDL
* @return DDL
*/
private String createDDL()
{
StringBuilder sql = null;
if (!isCreateConstraint())
{
sql = new StringBuilder("CREATE ");
if (isUnique())
sql.append ("UNIQUE ");
sql.append("INDEX ").append (getName())
.append(" ON ").append(getTableName())
.append(" (");
//
getColumns(false);
for (int i = 0; i < m_columns.length; i++)
{
MIndexColumn ic = m_columns[i];
if (i > 0)
sql.append(",");
sql.append (ic.getColumnName());
}
sql.append(")");
}
else if (isUnique())
{
sql = new StringBuilder("ALTER TABLE " + getTableName() + " ADD CONSTRAINT " + getName() + " UNIQUE (");
getColumns(false);
for (int i = 0; i < m_columns.length; i++)
{
MIndexColumn ic = m_columns[i];
if (i > 0)
sql.append(",");
sql.append(ic.getColumnName());
}
sql.append(")");
}
else
{
String errMsg = Msg.getMsg(getCtx(), "NeitherTableIndexNorUniqueConstraint", new Object[] { getTableName() });
log.severe(errMsg);
throw new AdempiereException(errMsg);
}
return sql.toString();
}
/**
* Get SQL index create DDL
* @return SQL DDL
*/
public String getDDL()
{
if (m_ddl == null)
m_ddl = createDDL();
return m_ddl;
}
/**
* String representation
* @return info
*/
@Override
public String toString()
{
StringBuilder sb = new StringBuilder("MTableIndex[");
sb.append(get_ID()).append("-")
.append(getName())
.append(",AD_Table_ID=").append(getAD_Table_ID())
.append("]");
return sb.toString();
}
}

View File

@ -0,0 +1,76 @@
/******************************************************************************
* Product: Compiere ERP & CRM Smart Business Solution *
* Copyright (C) 1999-2007 ComPiere, Inc. All Rights Reserved. *
* This program is free software, you can redistribute it and/or modify it *
* under the terms version 2 of the GNU General Public License as published *
* by the Free Software Foundation. This program is distributed in the hope *
* that it will be useful, but WITHOUT ANY WARRANTY, without even the implied *
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
* See the GNU General Public License for more details. *
* You should have received a copy of the GNU General Public License along *
* with this program, if not, write to the Free Software Foundation, Inc., *
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
* For the text or an alternative of this public license, you may reach us *
* ComPiere, Inc., 3600 Bridge Parkway #102, Redwood City, CA 94065, USA *
* or via info@compiere.org or http://www.compiere.org/license.html *
*****************************************************************************/
package org.compiere.model;
import java.sql.ResultSet;
import java.util.Properties;
public class MViewColumn extends X_AD_ViewColumn {
/**
*
*/
private static final long serialVersionUID = 1497519704377959238L;
/**
* Standard constructor
* @param ctx context
* @param AD_ViewColumn_ID view column
* @param trxName trx name
*/
public MViewColumn(Properties ctx, int AD_ViewColumn_ID, String trxName)
{
super(ctx, AD_ViewColumn_ID, trxName);
}
/**
* Load constructor
* @param ctx context
* @param rs result set
* @param trxName trx name
*/
public MViewColumn(Properties ctx, ResultSet rs, String trxName)
{
super(ctx, rs, trxName);
}
/**
* Parent constructor
* @param parent parent
*/
public MViewColumn(MViewComponent parent)
{
this(parent.getCtx(), 0, parent.get_TrxName());
setClientOrg(parent);
setAD_ViewComponent_ID(parent.getAD_ViewComponent_ID());
}
/**
* String representation
* @return info
*/
@Override
public String toString()
{
StringBuilder sb = new StringBuilder("MViewColumn[");
sb.append(get_ID()).append("-")
.append(getColumnName())
.append("]");
return sb.toString();
}
}

View File

@ -0,0 +1,169 @@
/******************************************************************************
* Product: Compiere ERP & CRM Smart Business Solution *
* Copyright (C) 1999-2007 ComPiere, Inc. All Rights Reserved. *
* This program is free software, you can redistribute it and/or modify it *
* under the terms version 2 of the GNU General Public License as published *
* by the Free Software Foundation. This program is distributed in the hope *
* that it will be useful, but WITHOUT ANY WARRANTY, without even the implied *
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
* See the GNU General Public License for more details. *
* You should have received a copy of the GNU General Public License along *
* with this program, if not, write to the Free Software Foundation, Inc., *
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
* For the text or an alternative of this public license, you may reach us *
* ComPiere, Inc., 3600 Bridge Parkway #102, Redwood City, CA 94065, USA *
* or via info@compiere.org or http://www.compiere.org/license.html *
*****************************************************************************/
package org.compiere.model;
import java.sql.ResultSet;
import java.util.List;
import java.util.Properties;
public class MViewComponent extends X_AD_ViewComponent {
/**
*
*/
private static final long serialVersionUID = -8915166706061086737L;
/**
* Standard constructor
* @param ctx context
* @param AD_ViewComponent_ID view component
* @param trxName trx name
*/
public MViewComponent(Properties ctx, int AD_ViewComponent_ID, String trxName)
{
super(ctx, AD_ViewComponent_ID, trxName);
}
/**
* Load constructor
* @param ctx context
* @param rs result set
* @param trxName trx name
*/
public MViewComponent(Properties ctx, ResultSet rs, String trxName)
{
super(ctx, rs, trxName);
}
/**
* Parent constructor
* @param parent parent
*/
public MViewComponent(MTable parent)
{
this(parent.getCtx(), 0, parent.get_TrxName());
setClientOrg(parent);
setAD_Table_ID(parent.getAD_Table_ID());
}
/** Columns */
private MViewColumn[] m_columns = null;
/**
* Get columns
* @param reload reload data
* @return array of view column
*/
public MViewColumn[] getColumns(boolean reload)
{
if (m_columns != null && !reload)
return m_columns;
Query query = new Query(getCtx(), MViewColumn.Table_Name, MViewColumn.COLUMNNAME_AD_ViewComponent_ID + "=?", get_TrxName());
query.setParameters(getAD_ViewComponent_ID());
query.setOrderBy(MViewColumn.COLUMNNAME_AD_ViewColumn_ID);
List<MViewColumn> list = query.<MViewColumn>list();
m_columns = new MViewColumn[list.size()];
list.toArray(m_columns);
return m_columns;
}
/**
* Get SQL select
* @param requery requery data
* @param vCols array of view column
* @return select statement
*/
public String getSelect(boolean requery, MViewColumn[] vCols)
{
getColumns(requery);
if (m_columns == null || m_columns.length == 0)
return null;
if (vCols == null)
vCols = m_columns;
StringBuilder sb = new StringBuilder("SELECT ");
//
for (int i = 0; i < vCols.length; i++)
{
String colName = vCols[i].getColumnName();
MViewColumn vc = null;
for (MViewColumn element : m_columns)
{
if (element.getColumnName().equals(colName))
{
vc = element;
break;
}
}
if (i>0)
sb.append(", ");
String colSQL = vc.getColumnSQL();
if (colSQL == null || colSQL.toUpperCase().equals("NULL"))
{
String dt = vc.getDBDataType();
if (dt != null)
{
if (dt.equals(MViewColumn.DBDATATYPE_CharacterFixed) ||
dt.equals(MViewColumn.DBDATATYPE_CharacterVariable))
colSQL = "NULLIF('a','a')";
else if (dt.equals(MViewColumn.DBDATATYPE_Decimal) ||
dt.equals(MViewColumn.DBDATATYPE_Integer) ||
dt.equals(MViewColumn.DBDATATYPE_Number))
colSQL = "NULLIF(1,1)";
else if (dt.equals(MViewColumn.DBDATATYPE_Timestamp))
colSQL = "NULL";
}
else
colSQL = "NULL";
}
sb.append(colSQL);
if (!colName.equals("*"))
sb.append(" AS ").append(colName);
}
sb.append(" ").append(getFromClause());
String t = getWhereClause();
if (t!=null && t.length()>0)
sb.append(" ").append(t);
t = getOtherClause();
if (t!=null && t.length()>0)
sb.append(" ").append(t);
return sb.toString();
}
/**
* String representation
* @return info
*/
@Override
public String toString()
{
StringBuffer sb = new StringBuffer("MViewComponent[")
.append(get_ID())
.append("-").append(getName());
sb.append("]");
return sb.toString();
}
}

View File

@ -0,0 +1,219 @@
/******************************************************************************
* Product: iDempiere ERP & CRM Smart Business Solution *
* Copyright (C) 1999-2012 ComPiere, Inc. All Rights Reserved. *
* This program is free software, you can redistribute it and/or modify it *
* under the terms version 2 of the GNU General Public License as published *
* by the Free Software Foundation. This program is distributed in the hope *
* that it will be useful, but WITHOUT ANY WARRANTY, without even the implied *
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
* See the GNU General Public License for more details. *
* You should have received a copy of the GNU General Public License along *
* with this program, if not, write to the Free Software Foundation, Inc., *
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
* For the text or an alternative of this public license, you may reach us *
* ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA *
* or via info@compiere.org or http://www.compiere.org/license.html *
*****************************************************************************/
/** Generated Model - DO NOT CHANGE */
package org.compiere.model;
import java.sql.ResultSet;
import java.util.Properties;
/** Generated Model for AD_IndexColumn
* @author iDempiere (generated)
* @version Release 1.0c - $Id$ */
public class X_AD_IndexColumn extends PO implements I_AD_IndexColumn, I_Persistent
{
/**
*
*/
private static final long serialVersionUID = 20130704L;
/** Standard Constructor */
public X_AD_IndexColumn (Properties ctx, int AD_IndexColumn_ID, String trxName)
{
super (ctx, AD_IndexColumn_ID, trxName);
/** if (AD_IndexColumn_ID == 0)
{
setAD_Column_ID (0);
setAD_IndexColumn_ID (0);
setAD_TableIndex_ID (0);
setEntityType (null);
// U
} */
}
/** Load Constructor */
public X_AD_IndexColumn (Properties ctx, ResultSet rs, String trxName)
{
super (ctx, rs, trxName);
}
/** AccessLevel
* @return 4 - System
*/
protected int get_AccessLevel()
{
return accessLevel.intValue();
}
/** Load Meta Data */
protected POInfo initPO (Properties ctx)
{
POInfo poi = POInfo.getPOInfo (ctx, Table_ID, get_TrxName());
return poi;
}
public String toString()
{
StringBuffer sb = new StringBuffer ("X_AD_IndexColumn[")
.append(get_ID()).append("]");
return sb.toString();
}
public org.compiere.model.I_AD_Column getAD_Column() throws RuntimeException
{
return (org.compiere.model.I_AD_Column)MTable.get(getCtx(), org.compiere.model.I_AD_Column.Table_Name)
.getPO(getAD_Column_ID(), get_TrxName()); }
/** Set Column.
@param AD_Column_ID
Column in the table
*/
public void setAD_Column_ID (int AD_Column_ID)
{
if (AD_Column_ID < 1)
set_ValueNoCheck (COLUMNNAME_AD_Column_ID, null);
else
set_ValueNoCheck (COLUMNNAME_AD_Column_ID, Integer.valueOf(AD_Column_ID));
}
/** Get Column.
@return Column in the table
*/
public int getAD_Column_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_AD_Column_ID);
if (ii == null)
return 0;
return ii.intValue();
}
/** Set Table Index Column.
@param AD_IndexColumn_ID Table Index Column */
public void setAD_IndexColumn_ID (int AD_IndexColumn_ID)
{
if (AD_IndexColumn_ID < 1)
set_ValueNoCheck (COLUMNNAME_AD_IndexColumn_ID, null);
else
set_ValueNoCheck (COLUMNNAME_AD_IndexColumn_ID, Integer.valueOf(AD_IndexColumn_ID));
}
/** Get Table Index Column.
@return Table Index Column */
public int getAD_IndexColumn_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_AD_IndexColumn_ID);
if (ii == null)
return 0;
return ii.intValue();
}
/** Set AD_IndexColumn_UU.
@param AD_IndexColumn_UU AD_IndexColumn_UU */
public void setAD_IndexColumn_UU (String AD_IndexColumn_UU)
{
set_Value (COLUMNNAME_AD_IndexColumn_UU, AD_IndexColumn_UU);
}
/** Get AD_IndexColumn_UU.
@return AD_IndexColumn_UU */
public String getAD_IndexColumn_UU ()
{
return (String)get_Value(COLUMNNAME_AD_IndexColumn_UU);
}
public org.compiere.model.I_AD_TableIndex getAD_TableIndex() throws RuntimeException
{
return (org.compiere.model.I_AD_TableIndex)MTable.get(getCtx(), org.compiere.model.I_AD_TableIndex.Table_Name)
.getPO(getAD_TableIndex_ID(), get_TrxName()); }
/** Set Table Index.
@param AD_TableIndex_ID Table Index */
public void setAD_TableIndex_ID (int AD_TableIndex_ID)
{
if (AD_TableIndex_ID < 1)
set_ValueNoCheck (COLUMNNAME_AD_TableIndex_ID, null);
else
set_ValueNoCheck (COLUMNNAME_AD_TableIndex_ID, Integer.valueOf(AD_TableIndex_ID));
}
/** Get Table Index.
@return Table Index */
public int getAD_TableIndex_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_AD_TableIndex_ID);
if (ii == null)
return 0;
return ii.intValue();
}
/** Set Column SQL.
@param ColumnSQL
Virtual Column (r/o)
*/
public void setColumnSQL (String ColumnSQL)
{
set_Value (COLUMNNAME_ColumnSQL, ColumnSQL);
}
/** Get Column SQL.
@return Virtual Column (r/o)
*/
public String getColumnSQL ()
{
return (String)get_Value(COLUMNNAME_ColumnSQL);
}
/** EntityType AD_Reference_ID=389 */
public static final int ENTITYTYPE_AD_Reference_ID=389;
/** Set Entity Type.
@param EntityType
Dictionary Entity Type; Determines ownership and synchronization
*/
public void setEntityType (String EntityType)
{
set_Value (COLUMNNAME_EntityType, EntityType);
}
/** Get Entity Type.
@return Dictionary Entity Type; Determines ownership and synchronization
*/
public String getEntityType ()
{
return (String)get_Value(COLUMNNAME_EntityType);
}
/** Set Sequence.
@param SeqNo
Method of ordering records; lowest number comes first
*/
public void setSeqNo (int SeqNo)
{
set_Value (COLUMNNAME_SeqNo, Integer.valueOf(SeqNo));
}
/** Get Sequence.
@return Method of ordering records; lowest number comes first
*/
public int getSeqNo ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_SeqNo);
if (ii == null)
return 0;
return ii.intValue();
}
}

View File

@ -30,7 +30,7 @@ public class X_AD_Table extends PO implements I_AD_Table, I_Persistent
/**
*
*/
private static final long serialVersionUID = 20130626L;
private static final long serialVersionUID = 20130704L;
/** Standard Constructor */
public X_AD_Table (Properties ctx, int AD_Table_ID, String trxName)
@ -501,6 +501,27 @@ public class X_AD_Table extends PO implements I_AD_Table, I_Persistent
return ii.intValue();
}
/** Set Process Now.
@param Processing Process Now */
public void setProcessing (boolean Processing)
{
set_Value (COLUMNNAME_Processing, Boolean.valueOf(Processing));
}
/** Get Process Now.
@return Process Now */
public boolean isProcessing ()
{
Object oo = get_Value(COLUMNNAME_Processing);
if (oo != null)
{
if (oo instanceof Boolean)
return ((Boolean)oo).booleanValue();
return "Y".equals(oo);
}
return false;
}
/** ReplicationType AD_Reference_ID=126 */
public static final int REPLICATIONTYPE_AD_Reference_ID=126;
/** Local = L */

View File

@ -0,0 +1,312 @@
/******************************************************************************
* Product: iDempiere ERP & CRM Smart Business Solution *
* Copyright (C) 1999-2012 ComPiere, Inc. All Rights Reserved. *
* This program is free software, you can redistribute it and/or modify it *
* under the terms version 2 of the GNU General Public License as published *
* by the Free Software Foundation. This program is distributed in the hope *
* that it will be useful, but WITHOUT ANY WARRANTY, without even the implied *
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
* See the GNU General Public License for more details. *
* You should have received a copy of the GNU General Public License along *
* with this program, if not, write to the Free Software Foundation, Inc., *
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
* For the text or an alternative of this public license, you may reach us *
* ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA *
* or via info@compiere.org or http://www.compiere.org/license.html *
*****************************************************************************/
/** Generated Model - DO NOT CHANGE */
package org.compiere.model;
import java.sql.ResultSet;
import java.util.Properties;
import org.compiere.util.KeyNamePair;
/** Generated Model for AD_TableIndex
* @author iDempiere (generated)
* @version Release 1.0c - $Id$ */
public class X_AD_TableIndex extends PO implements I_AD_TableIndex, I_Persistent
{
/**
*
*/
private static final long serialVersionUID = 20130704L;
/** Standard Constructor */
public X_AD_TableIndex (Properties ctx, int AD_TableIndex_ID, String trxName)
{
super (ctx, AD_TableIndex_ID, trxName);
/** if (AD_TableIndex_ID == 0)
{
setAD_Table_ID (0);
setAD_TableIndex_ID (0);
setEntityType (null);
// U
setIsCreateConstraint (false);
// N
setIsUnique (false);
// N
setName (null);
} */
}
/** Load Constructor */
public X_AD_TableIndex (Properties ctx, ResultSet rs, String trxName)
{
super (ctx, rs, trxName);
}
/** AccessLevel
* @return 4 - System
*/
protected int get_AccessLevel()
{
return accessLevel.intValue();
}
/** Load Meta Data */
protected POInfo initPO (Properties ctx)
{
POInfo poi = POInfo.getPOInfo (ctx, Table_ID, get_TrxName());
return poi;
}
public String toString()
{
StringBuffer sb = new StringBuffer ("X_AD_TableIndex[")
.append(get_ID()).append("]");
return sb.toString();
}
public org.compiere.model.I_AD_Message getAD_Message() throws RuntimeException
{
return (org.compiere.model.I_AD_Message)MTable.get(getCtx(), org.compiere.model.I_AD_Message.Table_Name)
.getPO(getAD_Message_ID(), get_TrxName()); }
/** Set Message.
@param AD_Message_ID
System Message
*/
public void setAD_Message_ID (int AD_Message_ID)
{
if (AD_Message_ID < 1)
set_Value (COLUMNNAME_AD_Message_ID, null);
else
set_Value (COLUMNNAME_AD_Message_ID, Integer.valueOf(AD_Message_ID));
}
/** Get Message.
@return System Message
*/
public int getAD_Message_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_AD_Message_ID);
if (ii == null)
return 0;
return ii.intValue();
}
public org.compiere.model.I_AD_Table getAD_Table() throws RuntimeException
{
return (org.compiere.model.I_AD_Table)MTable.get(getCtx(), org.compiere.model.I_AD_Table.Table_Name)
.getPO(getAD_Table_ID(), get_TrxName()); }
/** Set Table.
@param AD_Table_ID
Database Table information
*/
public void setAD_Table_ID (int AD_Table_ID)
{
if (AD_Table_ID < 1)
set_ValueNoCheck (COLUMNNAME_AD_Table_ID, null);
else
set_ValueNoCheck (COLUMNNAME_AD_Table_ID, Integer.valueOf(AD_Table_ID));
}
/** Get Table.
@return Database Table information
*/
public int getAD_Table_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_AD_Table_ID);
if (ii == null)
return 0;
return ii.intValue();
}
/** Set Table Index.
@param AD_TableIndex_ID Table Index */
public void setAD_TableIndex_ID (int AD_TableIndex_ID)
{
if (AD_TableIndex_ID < 1)
set_ValueNoCheck (COLUMNNAME_AD_TableIndex_ID, null);
else
set_ValueNoCheck (COLUMNNAME_AD_TableIndex_ID, Integer.valueOf(AD_TableIndex_ID));
}
/** Get Table Index.
@return Table Index */
public int getAD_TableIndex_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_AD_TableIndex_ID);
if (ii == null)
return 0;
return ii.intValue();
}
/** Set AD_TableIndex_UU.
@param AD_TableIndex_UU AD_TableIndex_UU */
public void setAD_TableIndex_UU (String AD_TableIndex_UU)
{
set_Value (COLUMNNAME_AD_TableIndex_UU, AD_TableIndex_UU);
}
/** Get AD_TableIndex_UU.
@return AD_TableIndex_UU */
public String getAD_TableIndex_UU ()
{
return (String)get_Value(COLUMNNAME_AD_TableIndex_UU);
}
/** Set Description.
@param Description
Optional short description of the record
*/
public void setDescription (String Description)
{
set_Value (COLUMNNAME_Description, Description);
}
/** Get Description.
@return Optional short description of the record
*/
public String getDescription ()
{
return (String)get_Value(COLUMNNAME_Description);
}
/** EntityType AD_Reference_ID=389 */
public static final int ENTITYTYPE_AD_Reference_ID=389;
/** Set Entity Type.
@param EntityType
Dictionary Entity Type; Determines ownership and synchronization
*/
public void setEntityType (String EntityType)
{
set_Value (COLUMNNAME_EntityType, EntityType);
}
/** Get Entity Type.
@return Dictionary Entity Type; Determines ownership and synchronization
*/
public String getEntityType ()
{
return (String)get_Value(COLUMNNAME_EntityType);
}
/** Set Comment/Help.
@param Help
Comment or Hint
*/
public void setHelp (String Help)
{
set_Value (COLUMNNAME_Help, Help);
}
/** Get Comment/Help.
@return Comment or Hint
*/
public String getHelp ()
{
return (String)get_Value(COLUMNNAME_Help);
}
/** Set Create Constraint.
@param IsCreateConstraint Create Constraint */
public void setIsCreateConstraint (boolean IsCreateConstraint)
{
set_Value (COLUMNNAME_IsCreateConstraint, Boolean.valueOf(IsCreateConstraint));
}
/** Get Create Constraint.
@return Create Constraint */
public boolean isCreateConstraint ()
{
Object oo = get_Value(COLUMNNAME_IsCreateConstraint);
if (oo != null)
{
if (oo instanceof Boolean)
return ((Boolean)oo).booleanValue();
return "Y".equals(oo);
}
return false;
}
/** Set Unique.
@param IsUnique Unique */
public void setIsUnique (boolean IsUnique)
{
set_Value (COLUMNNAME_IsUnique, Boolean.valueOf(IsUnique));
}
/** Get Unique.
@return Unique */
public boolean isUnique ()
{
Object oo = get_Value(COLUMNNAME_IsUnique);
if (oo != null)
{
if (oo instanceof Boolean)
return ((Boolean)oo).booleanValue();
return "Y".equals(oo);
}
return false;
}
/** Set Name.
@param Name
Alphanumeric identifier of the entity
*/
public void setName (String Name)
{
set_Value (COLUMNNAME_Name, Name);
}
/** Get Name.
@return Alphanumeric identifier of the entity
*/
public String getName ()
{
return (String)get_Value(COLUMNNAME_Name);
}
/** Get Record ID/ColumnName
@return ID/ColumnName pair
*/
public KeyNamePair getKeyNamePair()
{
return new KeyNamePair(get_ID(), getName());
}
/** Set Process Now.
@param Processing Process Now */
public void setProcessing (boolean Processing)
{
set_Value (COLUMNNAME_Processing, Boolean.valueOf(Processing));
}
/** Get Process Now.
@return Process Now */
public boolean isProcessing ()
{
Object oo = get_Value(COLUMNNAME_Processing);
if (oo != null)
{
if (oo instanceof Boolean)
return ((Boolean)oo).booleanValue();
return "Y".equals(oo);
}
return false;
}
}

View File

@ -0,0 +1,254 @@
/******************************************************************************
* Product: iDempiere ERP & CRM Smart Business Solution *
* Copyright (C) 1999-2012 ComPiere, Inc. All Rights Reserved. *
* This program is free software, you can redistribute it and/or modify it *
* under the terms version 2 of the GNU General Public License as published *
* by the Free Software Foundation. This program is distributed in the hope *
* that it will be useful, but WITHOUT ANY WARRANTY, without even the implied *
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
* See the GNU General Public License for more details. *
* You should have received a copy of the GNU General Public License along *
* with this program, if not, write to the Free Software Foundation, Inc., *
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
* For the text or an alternative of this public license, you may reach us *
* ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA *
* or via info@compiere.org or http://www.compiere.org/license.html *
*****************************************************************************/
/** Generated Model - DO NOT CHANGE */
package org.compiere.model;
import java.sql.ResultSet;
import java.util.Properties;
/** Generated Model for AD_ViewColumn
* @author iDempiere (generated)
* @version Release 1.0c - $Id$ */
public class X_AD_ViewColumn extends PO implements I_AD_ViewColumn, I_Persistent
{
/**
*
*/
private static final long serialVersionUID = 20130704L;
/** Standard Constructor */
public X_AD_ViewColumn (Properties ctx, int AD_ViewColumn_ID, String trxName)
{
super (ctx, AD_ViewColumn_ID, trxName);
/** if (AD_ViewColumn_ID == 0)
{
setAD_ViewColumn_ID (0);
setAD_ViewComponent_ID (0);
setEntityType (null);
// U
} */
}
/** Load Constructor */
public X_AD_ViewColumn (Properties ctx, ResultSet rs, String trxName)
{
super (ctx, rs, trxName);
}
/** AccessLevel
* @return 4 - System
*/
protected int get_AccessLevel()
{
return accessLevel.intValue();
}
/** Load Meta Data */
protected POInfo initPO (Properties ctx)
{
POInfo poi = POInfo.getPOInfo (ctx, Table_ID, get_TrxName());
return poi;
}
public String toString()
{
StringBuffer sb = new StringBuffer ("X_AD_ViewColumn[")
.append(get_ID()).append("]");
return sb.toString();
}
/** Set Database View Column.
@param AD_ViewColumn_ID Database View Column */
public void setAD_ViewColumn_ID (int AD_ViewColumn_ID)
{
if (AD_ViewColumn_ID < 1)
set_ValueNoCheck (COLUMNNAME_AD_ViewColumn_ID, null);
else
set_ValueNoCheck (COLUMNNAME_AD_ViewColumn_ID, Integer.valueOf(AD_ViewColumn_ID));
}
/** Get Database View Column.
@return Database View Column */
public int getAD_ViewColumn_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_AD_ViewColumn_ID);
if (ii == null)
return 0;
return ii.intValue();
}
/** Set AD_ViewColumn_UU.
@param AD_ViewColumn_UU AD_ViewColumn_UU */
public void setAD_ViewColumn_UU (String AD_ViewColumn_UU)
{
set_Value (COLUMNNAME_AD_ViewColumn_UU, AD_ViewColumn_UU);
}
/** Get AD_ViewColumn_UU.
@return AD_ViewColumn_UU */
public String getAD_ViewColumn_UU ()
{
return (String)get_Value(COLUMNNAME_AD_ViewColumn_UU);
}
public org.compiere.model.I_AD_ViewComponent getAD_ViewComponent() throws RuntimeException
{
return (org.compiere.model.I_AD_ViewComponent)MTable.get(getCtx(), org.compiere.model.I_AD_ViewComponent.Table_Name)
.getPO(getAD_ViewComponent_ID(), get_TrxName()); }
/** Set Database View Component.
@param AD_ViewComponent_ID Database View Component */
public void setAD_ViewComponent_ID (int AD_ViewComponent_ID)
{
if (AD_ViewComponent_ID < 1)
set_ValueNoCheck (COLUMNNAME_AD_ViewComponent_ID, null);
else
set_ValueNoCheck (COLUMNNAME_AD_ViewComponent_ID, Integer.valueOf(AD_ViewComponent_ID));
}
/** Get Database View Component.
@return Database View Component */
public int getAD_ViewComponent_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_AD_ViewComponent_ID);
if (ii == null)
return 0;
return ii.intValue();
}
/** Set DB Column Name.
@param ColumnName
Name of the column in the database
*/
public void setColumnName (String ColumnName)
{
set_Value (COLUMNNAME_ColumnName, ColumnName);
}
/** Get DB Column Name.
@return Name of the column in the database
*/
public String getColumnName ()
{
return (String)get_Value(COLUMNNAME_ColumnName);
}
/** Set Column SQL.
@param ColumnSQL
Virtual Column (r/o)
*/
public void setColumnSQL (String ColumnSQL)
{
set_Value (COLUMNNAME_ColumnSQL, ColumnSQL);
}
/** Get Column SQL.
@return Virtual Column (r/o)
*/
public String getColumnSQL ()
{
return (String)get_Value(COLUMNNAME_ColumnSQL);
}
/** DBDataType AD_Reference_ID=200070 */
public static final int DBDATATYPE_AD_Reference_ID=200070;
/** Binary LOB = B */
public static final String DBDATATYPE_BinaryLOB = "B";
/** Character Fixed = C */
public static final String DBDATATYPE_CharacterFixed = "C";
/** Decimal = D */
public static final String DBDATATYPE_Decimal = "D";
/** Integer = I */
public static final String DBDATATYPE_Integer = "I";
/** Character LOB = L */
public static final String DBDATATYPE_CharacterLOB = "L";
/** Number = N */
public static final String DBDATATYPE_Number = "N";
/** Timestamp = T */
public static final String DBDATATYPE_Timestamp = "T";
/** Character Variable = V */
public static final String DBDATATYPE_CharacterVariable = "V";
/** Set Database Data Type.
@param DBDataType Database Data Type */
public void setDBDataType (String DBDataType)
{
set_Value (COLUMNNAME_DBDataType, DBDataType);
}
/** Get Database Data Type.
@return Database Data Type */
public String getDBDataType ()
{
return (String)get_Value(COLUMNNAME_DBDataType);
}
/** Set Description.
@param Description
Optional short description of the record
*/
public void setDescription (String Description)
{
set_Value (COLUMNNAME_Description, Description);
}
/** Get Description.
@return Optional short description of the record
*/
public String getDescription ()
{
return (String)get_Value(COLUMNNAME_Description);
}
/** EntityType AD_Reference_ID=389 */
public static final int ENTITYTYPE_AD_Reference_ID=389;
/** Set Entity Type.
@param EntityType
Dictionary Entity Type; Determines ownership and synchronization
*/
public void setEntityType (String EntityType)
{
set_Value (COLUMNNAME_EntityType, EntityType);
}
/** Get Entity Type.
@return Dictionary Entity Type; Determines ownership and synchronization
*/
public String getEntityType ()
{
return (String)get_Value(COLUMNNAME_EntityType);
}
/** Set Comment/Help.
@param Help
Comment or Hint
*/
public void setHelp (String Help)
{
set_Value (COLUMNNAME_Help, Help);
}
/** Get Comment/Help.
@return Comment or Hint
*/
public String getHelp ()
{
return (String)get_Value(COLUMNNAME_Help);
}
}

View File

@ -0,0 +1,313 @@
/******************************************************************************
* Product: iDempiere ERP & CRM Smart Business Solution *
* Copyright (C) 1999-2012 ComPiere, Inc. All Rights Reserved. *
* This program is free software, you can redistribute it and/or modify it *
* under the terms version 2 of the GNU General Public License as published *
* by the Free Software Foundation. This program is distributed in the hope *
* that it will be useful, but WITHOUT ANY WARRANTY, without even the implied *
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
* See the GNU General Public License for more details. *
* You should have received a copy of the GNU General Public License along *
* with this program, if not, write to the Free Software Foundation, Inc., *
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
* For the text or an alternative of this public license, you may reach us *
* ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA *
* or via info@compiere.org or http://www.compiere.org/license.html *
*****************************************************************************/
/** Generated Model - DO NOT CHANGE */
package org.compiere.model;
import java.sql.ResultSet;
import java.util.Properties;
import org.compiere.util.KeyNamePair;
/** Generated Model for AD_ViewComponent
* @author iDempiere (generated)
* @version Release 1.0c - $Id$ */
public class X_AD_ViewComponent extends PO implements I_AD_ViewComponent, I_Persistent
{
/**
*
*/
private static final long serialVersionUID = 20130704L;
/** Standard Constructor */
public X_AD_ViewComponent (Properties ctx, int AD_ViewComponent_ID, String trxName)
{
super (ctx, AD_ViewComponent_ID, trxName);
/** if (AD_ViewComponent_ID == 0)
{
setAD_Table_ID (0);
setAD_ViewComponent_ID (0);
setEntityType (null);
// U
setName (null);
} */
}
/** Load Constructor */
public X_AD_ViewComponent (Properties ctx, ResultSet rs, String trxName)
{
super (ctx, rs, trxName);
}
/** AccessLevel
* @return 4 - System
*/
protected int get_AccessLevel()
{
return accessLevel.intValue();
}
/** Load Meta Data */
protected POInfo initPO (Properties ctx)
{
POInfo poi = POInfo.getPOInfo (ctx, Table_ID, get_TrxName());
return poi;
}
public String toString()
{
StringBuffer sb = new StringBuffer ("X_AD_ViewComponent[")
.append(get_ID()).append("]");
return sb.toString();
}
public org.compiere.model.I_AD_Table getAD_Table() throws RuntimeException
{
return (org.compiere.model.I_AD_Table)MTable.get(getCtx(), org.compiere.model.I_AD_Table.Table_Name)
.getPO(getAD_Table_ID(), get_TrxName()); }
/** Set Table.
@param AD_Table_ID
Database Table information
*/
public void setAD_Table_ID (int AD_Table_ID)
{
if (AD_Table_ID < 1)
set_ValueNoCheck (COLUMNNAME_AD_Table_ID, null);
else
set_ValueNoCheck (COLUMNNAME_AD_Table_ID, Integer.valueOf(AD_Table_ID));
}
/** Get Table.
@return Database Table information
*/
public int getAD_Table_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_AD_Table_ID);
if (ii == null)
return 0;
return ii.intValue();
}
/** Set Database View Component.
@param AD_ViewComponent_ID Database View Component */
public void setAD_ViewComponent_ID (int AD_ViewComponent_ID)
{
if (AD_ViewComponent_ID < 1)
set_ValueNoCheck (COLUMNNAME_AD_ViewComponent_ID, null);
else
set_ValueNoCheck (COLUMNNAME_AD_ViewComponent_ID, Integer.valueOf(AD_ViewComponent_ID));
}
/** Get Database View Component.
@return Database View Component */
public int getAD_ViewComponent_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_AD_ViewComponent_ID);
if (ii == null)
return 0;
return ii.intValue();
}
/** Set AD_ViewComponent_UU.
@param AD_ViewComponent_UU AD_ViewComponent_UU */
public void setAD_ViewComponent_UU (String AD_ViewComponent_UU)
{
set_Value (COLUMNNAME_AD_ViewComponent_UU, AD_ViewComponent_UU);
}
/** Get AD_ViewComponent_UU.
@return AD_ViewComponent_UU */
public String getAD_ViewComponent_UU ()
{
return (String)get_Value(COLUMNNAME_AD_ViewComponent_UU);
}
/** Set Description.
@param Description
Optional short description of the record
*/
public void setDescription (String Description)
{
set_Value (COLUMNNAME_Description, Description);
}
/** Get Description.
@return Optional short description of the record
*/
public String getDescription ()
{
return (String)get_Value(COLUMNNAME_Description);
}
/** EntityType AD_Reference_ID=389 */
public static final int ENTITYTYPE_AD_Reference_ID=389;
/** Set Entity Type.
@param EntityType
Dictionary Entity Type; Determines ownership and synchronization
*/
public void setEntityType (String EntityType)
{
set_Value (COLUMNNAME_EntityType, EntityType);
}
/** Get Entity Type.
@return Dictionary Entity Type; Determines ownership and synchronization
*/
public String getEntityType ()
{
return (String)get_Value(COLUMNNAME_EntityType);
}
/** Set Sql FROM.
@param FromClause
SQL FROM clause
*/
public void setFromClause (String FromClause)
{
set_Value (COLUMNNAME_FromClause, FromClause);
}
/** Get Sql FROM.
@return SQL FROM clause
*/
public String getFromClause ()
{
return (String)get_Value(COLUMNNAME_FromClause);
}
/** Set Comment/Help.
@param Help
Comment or Hint
*/
public void setHelp (String Help)
{
set_Value (COLUMNNAME_Help, Help);
}
/** Get Comment/Help.
@return Comment or Hint
*/
public String getHelp ()
{
return (String)get_Value(COLUMNNAME_Help);
}
/** Set Name.
@param Name
Alphanumeric identifier of the entity
*/
public void setName (String Name)
{
set_Value (COLUMNNAME_Name, Name);
}
/** Get Name.
@return Alphanumeric identifier of the entity
*/
public String getName ()
{
return (String)get_Value(COLUMNNAME_Name);
}
/** Get Record ID/ColumnName
@return ID/ColumnName pair
*/
public KeyNamePair getKeyNamePair()
{
return new KeyNamePair(get_ID(), getName());
}
/** Set Other SQL Clause.
@param OtherClause
Other SQL Clause
*/
public void setOtherClause (String OtherClause)
{
set_Value (COLUMNNAME_OtherClause, OtherClause);
}
/** Get Other SQL Clause.
@return Other SQL Clause
*/
public String getOtherClause ()
{
return (String)get_Value(COLUMNNAME_OtherClause);
}
public org.compiere.model.I_AD_Table getReferenced_Table() throws RuntimeException
{
return (org.compiere.model.I_AD_Table)MTable.get(getCtx(), org.compiere.model.I_AD_Table.Table_Name)
.getPO(getReferenced_Table_ID(), get_TrxName()); }
/** Set Referenced Table.
@param Referenced_Table_ID Referenced Table */
public void setReferenced_Table_ID (int Referenced_Table_ID)
{
if (Referenced_Table_ID < 1)
set_Value (COLUMNNAME_Referenced_Table_ID, null);
else
set_Value (COLUMNNAME_Referenced_Table_ID, Integer.valueOf(Referenced_Table_ID));
}
/** Get Referenced Table.
@return Referenced Table */
public int getReferenced_Table_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_Referenced_Table_ID);
if (ii == null)
return 0;
return ii.intValue();
}
/** Set Sequence.
@param SeqNo
Method of ordering records; lowest number comes first
*/
public void setSeqNo (int SeqNo)
{
set_Value (COLUMNNAME_SeqNo, Integer.valueOf(SeqNo));
}
/** Get Sequence.
@return Method of ordering records; lowest number comes first
*/
public int getSeqNo ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_SeqNo);
if (ii == null)
return 0;
return ii.intValue();
}
/** Set Sql WHERE.
@param WhereClause
Fully qualified SQL WHERE clause
*/
public void setWhereClause (String WhereClause)
{
set_Value (COLUMNNAME_WhereClause, WhereClause);
}
/** Get Sql WHERE.
@return Fully qualified SQL WHERE clause
*/
public String getWhereClause ()
{
return (String)get_Value(COLUMNNAME_WhereClause);
}
}

View File

@ -0,0 +1,91 @@
/******************************************************************************
* Product: Compiere ERP & CRM Smart Business Solution *
* Copyright (C) 1999-2007 ComPiere, Inc. All Rights Reserved. *
* This program is free software, you can redistribute it and/or modify it *
* under the terms version 2 of the GNU General Public License as published *
* by the Free Software Foundation. This program is distributed in the hope *
* that it will be useful, but WITHOUT ANY WARRANTY, without even the implied *
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
* See the GNU General Public License for more details. *
* You should have received a copy of the GNU General Public License along *
* with this program, if not, write to the Free Software Foundation, Inc., *
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
* For the text or an alternative of this public license, you may reach us *
* ComPiere, Inc., 3600 Bridge Parkway #102, Redwood City, CA 94065, USA *
* or via info@compiere.org or http://www.compiere.org/license.html *
*****************************************************************************/
package org.compiere.process;
import org.adempiere.exceptions.AdempiereException;
import org.compiere.model.MTable;
import org.compiere.model.MViewColumn;
import org.compiere.model.MViewComponent;
import org.compiere.util.DB;
import org.compiere.util.Msg;
public class DatabaseViewValidate extends SvrProcess {
private int p_AD_Table_ID = 0;
@Override
protected void prepare()
{
p_AD_Table_ID = getRecord_ID();
}
@Override
protected String doIt() throws Exception
{
MTable table = new MTable(getCtx(), p_AD_Table_ID, get_TrxName());
log.info(table.toString());
if (!table.isView() || !table.isActive())
throw new AdempiereException(Msg.getMsg(getCtx(), "NotActiveDatabaseView"));
StringBuilder sb = new StringBuilder("CREATE OR REPLACE VIEW ").append(table.getTableName());
//
MViewComponent[] m_vcs = table.getViewComponent(true);
if (m_vcs == null || m_vcs.length == 0)
throw new AdempiereException(Msg.getMsg(getCtx(), "NoViewComponentsSpecified"));
MViewColumn[] vCols = null;
for (int i = 0; i < m_vcs.length; i++)
{
MViewComponent vc = m_vcs[i];
if (i > 0)
sb.append(" UNION ");
else
{
vCols = vc.getColumns(true);
if (vCols == null || vCols.length == 0)
throw new AdempiereException(Msg.getMsg(getCtx(), "NoViewColumnsSpecified"));
boolean right = false;
for (int j = 0; j < vCols.length; j++)
{
if (vCols[j].getColumnName().equals("*"))
break;
if (j == 0)
{
sb.append("(");
right = true;
}
else
sb.append(", ");
sb.append(vCols[j].getColumnName());
}
if (right)
sb.append(")");
sb.append(" AS ");
}
sb.append(vc.getSelect(false, vCols));
}
int rvalue = DB.executeUpdate("DROP VIEW " + table.getTableName(), (Object[]) null, true, get_TrxName());
rvalue = DB.executeUpdate(sb.toString(), (Object[]) null, true, get_TrxName());
if(rvalue == -1)
throw new AdempiereException(Msg.getMsg(getCtx(), "FailedCreateOrReplaceView"));
else
return Msg.getMsg(getCtx(), "CreatedOrReplacedViewSuccess");
}
}

View File

@ -0,0 +1,149 @@
/******************************************************************************
* Product: Compiere ERP & CRM Smart Business Solution *
* Copyright (C) 1999-2007 ComPiere, Inc. All Rights Reserved. *
* This program is free software, you can redistribute it and/or modify it *
* under the terms version 2 of the GNU General Public License as published *
* by the Free Software Foundation. This program is distributed in the hope *
* that it will be useful, but WITHOUT ANY WARRANTY, without even the implied *
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
* See the GNU General Public License for more details. *
* You should have received a copy of the GNU General Public License along *
* with this program, if not, write to the Free Software Foundation, Inc., *
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
* For the text or an alternative of this public license, you may reach us *
* ComPiere, Inc., 3600 Bridge Parkway #102, Redwood City, CA 94065, USA *
* or via info@compiere.org or http://www.compiere.org/license.html *
*****************************************************************************/
package org.compiere.process;
import java.sql.DatabaseMetaData;
import java.sql.ResultSet;
import org.adempiere.exceptions.AdempiereException;
import org.compiere.model.MIndexColumn;
import org.compiere.model.MTableIndex;
import org.compiere.util.DB;
import org.compiere.util.Msg;
import org.compiere.util.Trx;
public class TableIndexValidate extends SvrProcess {
private int p_AD_TableIndex_ID = 0;
@Override
protected void prepare()
{
p_AD_TableIndex_ID = getRecord_ID();
}
@Override
protected String doIt() throws Exception
{
MTableIndex index = new MTableIndex(getCtx(), p_AD_TableIndex_ID, get_TrxName());
log.info(index.toString());
Trx trx = Trx.get(get_TrxName(), true);
DatabaseMetaData md = trx.getConnection().getMetaData();
String tableName = index.getTableName();
if (md.storesUpperCaseIdentifiers())
tableName = tableName.toUpperCase();
else if (md.storesLowerCaseIdentifiers())
tableName = tableName.toLowerCase();
String catalog = "REFERENCE";
String schema = null;
String[] indexColsFromDB = new String[30];
int numIndexColsFromDB = 0;
boolean indexNUniqueInDB = true;
boolean found = false;
ResultSet rs = md.getIndexInfo(catalog, schema, tableName, false, true);
while (rs.next())
{
String dbIndexName = rs.getString("INDEX_NAME");
if (dbIndexName == null)
continue;
if (index.getName().equalsIgnoreCase(dbIndexName))
{
found = true;
String columnName = rs.getString("COLUMN_NAME");
int pos = (rs.getShort("ORDINAL_POSITION"));
if (pos > 0)
indexColsFromDB[pos-1] = columnName;
indexNUniqueInDB = rs.getBoolean("NON_UNIQUE");
}
}
rs.close();
trx.close();
MIndexColumn[] indexCols = index.getColumns(true);
boolean modified = false;
if (indexCols.length <= 0)
throw new AdempiereException(Msg.getMsg(getCtx(), "NoIndexColumnsSpecified"));
else if (!found)
{
int rvalue = DB.executeUpdate(index.getDDL(), (Object[]) null, true, get_TrxName());
if (rvalue == -1)
throw new AdempiereException(Msg.getMsg(getCtx(), "Failed to create index"));
else
return Msg.getMsg(getCtx(), "CreatedIndexSuccess");
}
else
{
//Found the index in DB
for (int i = 0; i < 30; i++)
{
if (indexColsFromDB[i] != null)
numIndexColsFromDB++;
else
break;
}
if (numIndexColsFromDB != indexCols.length)
modified = true;
else if (!indexNUniqueInDB != index.isUnique())
modified = true;
else
{
for (int j = 0; j < indexCols.length; j++)
{
/*what if they are returned in a diff sequence ?*/
if (indexCols[j].getColumnName().equalsIgnoreCase(indexColsFromDB[j]))
continue;
else if ((indexColsFromDB[j].startsWith("\"")) && (indexColsFromDB[j].endsWith("\"")))
{
/* EDB returns varchar index columns wrapped with double quotes, hence comparing
* after stripping the quotes
*/
String cname = indexColsFromDB[j].substring(1, indexColsFromDB[j].length() - 1);
if (cname.equalsIgnoreCase(indexCols[j].getColumnName()))
continue;
else
{
modified = true;
break;
}
}
else
{
modified = true;
break;
}
}
}
if (modified)
{
int rvalue = DB.executeUpdate("DROP INDEX " + index.getName(), (Object[]) null, true, get_TrxName());
rvalue = DB.executeUpdate(index.getDDL(), (Object[]) null, true, get_TrxName());
if(rvalue == -1)
throw new AdempiereException(Msg.getMsg(getCtx(), "FailedModifyIndex"));
else
return Msg.getMsg(getCtx(), "ModifiedIndexSuccess");
}
else
return Msg.getMsg(getCtx(), "NoChangesToIndex");
}
}
}