Package org.compiere.process
Class DatabaseViewImport
java.lang.Object
org.compiere.process.SvrProcess
org.compiere.process.DatabaseViewImport
- All Implemented Interfaces:
ProcessCall
Process to create the view definition (AD_ViewComponent and AD_ViewColumn) of a table
from the view that exists in the database. It is the opposite of
DatabaseViewValidate.-
Field Summary
Fields inherited from class org.compiere.process.SvrProcess
log, MSG_InvalidArguments, MSG_SaveErrorRowNotFound, PROCESS_INFO_CTX_KEY, PROCESS_UI_CTX_KEY, processUI -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected StringdoIt()Process implementation class will override this method to execution process actions.static StringimportDatabaseView(Properties ctx, MTable table, boolean deleteOld, boolean createColumns, boolean removeCasts, String trxName, ProcessInfo pi) Create AD_ViewComponent and AD_ViewColumn records from the definition of the view in the database.
The view is searched in the database by the table name of the table (case insensitive).protected voidprepare()Prepare process - e.g., get Parameters.Methods inherited from class org.compiere.process.SvrProcess
addBufferLog, addLog, addLog, addLog, commit, commitEx, doIt, get_TrxName, getAD_Client_ID, getAD_PInstance_ID, getAD_User_ID, getCtx, getName, getParameter, getProcessInfo, getRecord_ID, getRecord_IDs, getRecord_UU, getRecord_UUs, getTable_ID, isLocked, lockObject, postProcess, rollback, saveProgress, saveStatus, setProcessUI, startProcess, statusUpdate, unlockObject, updateProgress
-
Constructor Details
-
DatabaseViewImport
public DatabaseViewImport()
-
-
Method Details
-
prepare
protected void prepare()Description copied from class:SvrProcessPrepare process - e.g., get Parameters.ProcessInfoParameter[] para = getParameter(); for (int i = 0; i < para.length; i++) { String name = para[i].getParameterName(); if (para[i].getParameter() == null) ; else if (name.equals("A_Asset_Group_ID")) p_A_Asset_Group_ID = para[i].getParameterAsInt(); else if (name.equals("GuaranteeDate")) p_GuaranteeDate = (Timestamp)para[i].getParameter(); else if (name.equals("AttachAsset")) p_AttachAsset = "Y".equals(para[i].getParameter()); else log.log(Level.SEVERE, "Unknown Parameter: " + name); }- Specified by:
preparein classSvrProcess- See Also:
-
doIt
Description copied from class:SvrProcessProcess implementation class will override this method to execution process actions.- Specified by:
doItin classSvrProcess- Returns:
- Message (variables are parsed)
- Throws:
Exception- if not successful e.g. throw new AdempiereUserError ("@FillMandatory@ @C_BankAccount_ID@");
-
importDatabaseView
public static String importDatabaseView(Properties ctx, MTable table, boolean deleteOld, boolean createColumns, boolean removeCasts, String trxName, ProcessInfo pi) throws Exception Create AD_ViewComponent and AD_ViewColumn records from the definition of the view in the database.
The view is searched in the database by the table name of the table (case insensitive).- Parameters:
ctx-table- table that is a viewdeleteOld- true to delete the existing view components of the table, false to fail if the table has view componentscreateColumns- true to also create the dictionary columns (AD_Column) that are missing in the tableremoveCasts- true to remove the PostgreSQL type casts (::type), so the definition can be used in Oracle, the process log lists where they were removed; false to keep the definition as the database returns ittrxName-pi- optional process info to add log- Returns:
- info message
- Throws:
Exception- if the view doesn't exist in the database or its definition can't be represented as view components
-