Feature Request [ 1677797 ] Store Archive In File System Or In DB

This commit is contained in:
kthiemann 2007-05-23 11:57:18 +00:00
parent 71bfeb38e2
commit 176f33cc62
4 changed files with 735 additions and 155 deletions

View File

@ -41,4 +41,18 @@ public class CalloutClient extends CalloutEngine
return "StoreAttachmentWarning";
} // storeAttachmentOnFilesystem
/**
* Shows a warning message if the archive storing method is changed.
* @param ctx context
* @param WindowNo window no
* @param mTab tab
* @param mField field
* @param value value
* @return null or error message
*/
public String storeArchiveOnFileSystem (Properties ctx, int WindowNo, GridTab mTab, GridField mField, Object value)
{
return "StoreArchiveWarning";
} // storeArchiveOnFileSystem
} // CalloutClient

View File

@ -16,60 +16,86 @@
*****************************************************************************/
package org.compiere.model;
import java.io.*;
import java.sql.*;
import java.util.*;
import java.util.logging.*;
import java.util.zip.*;
import org.compiere.util.*;
import java.io.BufferedOutputStream;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.util.ArrayList;
import java.util.Properties;
import java.util.logging.Level;
import java.util.zip.Deflater;
import java.util.zip.ZipEntry;
import java.util.zip.ZipInputStream;
import java.util.zip.ZipOutputStream;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.transform.Result;
import javax.xml.transform.Source;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult;
import org.compiere.util.CLogger;
import org.compiere.util.DB;
import org.compiere.util.Env;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import org.xml.sax.SAXException;
/**
* Archive Model
*
* @author Jorg Janke
* @version $Id: MArchive.java,v 1.3 2006/07/30 00:58:36 jjanke Exp $
* Archive Model
*
* @author Jorg Janke
* @version $Id: MArchive.java,v 1.3 2006/07/30 00:58:36 jjanke Exp $
*/
public class MArchive extends X_AD_Archive
{
public class MArchive extends X_AD_Archive {
/**
* Get Archives
* @param ctx context
* @param whereClause optional where clause (starting with AND)
* @return archives
* Get Archives
*
* @param ctx
* context
* @param whereClause
* optional where clause (starting with AND)
* @return archives
*/
public static MArchive[] get (Properties ctx, String whereClause)
{
public static MArchive[] get(Properties ctx, String whereClause) {
ArrayList<MArchive> list = new ArrayList<MArchive>();
PreparedStatement pstmt = null;
String sql = "SELECT * FROM AD_Archive WHERE AD_Client_ID=?";
if (whereClause != null && whereClause.length() > 0)
sql += whereClause;
sql += " ORDER BY Created";
try
{
pstmt = DB.prepareStatement (sql, null);
pstmt.setInt (1, Env.getAD_Client_ID(ctx));
ResultSet rs = pstmt.executeQuery ();
while (rs.next ())
list.add (new MArchive(ctx, rs, null));
rs.close ();
pstmt.close ();
try {
pstmt = DB.prepareStatement(sql, null);
pstmt.setInt(1, Env.getAD_Client_ID(ctx));
ResultSet rs = pstmt.executeQuery();
while (rs.next())
list.add(new MArchive(ctx, rs, null));
rs.close();
pstmt.close();
pstmt = null;
}
catch (Exception e)
{
} catch (Exception e) {
s_log.log(Level.SEVERE, sql, e);
}
try
{
try {
if (pstmt != null)
pstmt.close ();
pstmt.close();
pstmt = null;
}
catch (Exception e)
{
} catch (Exception e) {
pstmt = null;
}
if (list.size() == 0)
@ -80,46 +106,57 @@ public class MArchive extends X_AD_Archive
MArchive[] retValue = new MArchive[list.size()];
list.toArray(retValue);
return retValue;
} // get
} // get
/** Logger */
/** Logger */
private static CLogger s_log = CLogger.getCLogger(MArchive.class);
private Integer m_inflated = null;
private Integer m_deflated = null;
/**************************************************************************
* Standard Constructor
* @param ctx context
* @param AD_Archive_ID id
* @param trxName transaction
private Integer m_inflated = null;
private Integer m_deflated = null;
/***************************************************************************
* Standard Constructor
*
* @param ctx
* context
* @param AD_Archive_ID
* id
* @param trxName
* transaction
*/
public MArchive (Properties ctx, int AD_Archive_ID, String trxName)
{
super (ctx, AD_Archive_ID, trxName);
} // MArchive
public MArchive(Properties ctx, int AD_Archive_ID, String trxName) {
super(ctx, AD_Archive_ID, trxName);
initArchiveStoreDetails(ctx, trxName);
} // MArchive
/**
* Load Constructor
* @param ctx context
* @param rs result set
* @param trxName transaction
* Load Constructor
*
* @param ctx
* context
* @param rs
* result set
* @param trxName
* transaction
*/
public MArchive (Properties ctx, ResultSet rs, String trxName)
{
public MArchive(Properties ctx, ResultSet rs, String trxName) {
super(ctx, rs, trxName);
} // MArchive
initArchiveStoreDetails(ctx, trxName);
} // MArchive
/**
* Constructor
* @param ctx context
* @param info print info
* @param trxName transaction
* Constructor
*
* @param ctx
* context
* @param info
* print info
* @param trxName
* transaction
*/
public MArchive (Properties ctx, PrintInfo info, String trxName)
{
this (ctx, 0, trxName);
public MArchive(Properties ctx, PrintInfo info, String trxName) {
this(ctx, 0, trxName);
setName(info.getName());
setIsReport(info.isReport());
//
@ -127,16 +164,52 @@ public class MArchive extends X_AD_Archive
setAD_Table_ID(info.getAD_Table_ID());
setRecord_ID(info.getRecord_ID());
setC_BPartner_ID(info.getC_BPartner_ID());
} // MArchive
initArchiveStoreDetails(ctx, trxName);
} // MArchive
/** is this client using the file system for archive */
private boolean isStoreArchiveOnFileSystem = false;
/** archive (root) path - if file system is used */
private String m_archivePathRoot = "";
/**
* String Representation
* @return info
* string replaces the archive root in stored xml file to allow the
* changing of the attachment root.
*/
public String toString()
{
private final String ARCHIVE_FOLDER_PLACEHOLDER = "%ARCHIVE_FOLDER%";
/**
* Get the isStoreArchiveOnFileSystem and archivePath for the client.
*
* @param ctx
* @param trxName
*/
private void initArchiveStoreDetails(Properties ctx, String trxName) {
final MClient client = new MClient(ctx, this.getAD_Client_ID(), trxName);
isStoreArchiveOnFileSystem = client.isStoreArchiveOnFileSystem();
if (isStoreArchiveOnFileSystem) {
if (File.separatorChar == '\\') {
m_archivePathRoot = client.getWindowsArchivePath();
} else {
m_archivePathRoot = client.getUnixArchivePath();
}
if ("".equals(m_archivePathRoot)) {
log.severe("no archivePath defined");
} else if (!m_archivePathRoot.endsWith(File.separator)) {
log.warning("archive path doesn't end with " + File.separator);
m_archivePathRoot = m_archivePathRoot + File.separator;
log.fine(m_archivePathRoot);
}
}
}
/**
* String Representation
*
* @return info
*/
public String toString() {
StringBuffer sb = new StringBuffer("MArchive[");
sb.append(get_ID()).append(",Name=").append(getName());
if (m_inflated != null)
@ -145,15 +218,106 @@ public class MArchive extends X_AD_Archive
sb.append(",Deflated=" + m_deflated);
sb.append("]");
return sb.toString();
} // toString
} // toString
public byte[] getBinaryData() {
if (isStoreArchiveOnFileSystem) {
return getBinaryDataFromFileSystem();
}
return getBinaryDataFromDB();
}
/**
* Get Binary Data.
* (inflate)
* @return inflated data
* @return attachment data
*/
public byte[] getBinaryData()
{
private byte[] getBinaryDataFromFileSystem() {
if ("".equals(m_archivePathRoot)) {
throw new IllegalArgumentException("no attachmentPath defined");
}
byte[] data = super.getBinaryData();
m_deflated = null;
m_inflated = null;
if (data == null) {
return null;
}
final DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
try {
final DocumentBuilder builder = factory.newDocumentBuilder();
final Document document = builder.parse(new ByteArrayInputStream(data));
final NodeList entries = document.getElementsByTagName("entry");
if(entries.getLength()!=1){
log.severe("no archive entry found");
}
final Node entryNode = entries.item(0);
final NamedNodeMap attributes = entryNode.getAttributes();
final Node fileNode = attributes.getNamedItem("file");
if(fileNode==null ){
log.severe("no filename for entry");
return null;
}
String filePath = fileNode.getNodeValue();
log.fine("filePath: " + filePath);
if(filePath!=null){
filePath = filePath.replaceFirst(ARCHIVE_FOLDER_PLACEHOLDER, m_archivePathRoot.replaceAll("\\\\","\\\\\\\\"));
//just to be shure...
String replaceSeparator = File.separator;
if(!replaceSeparator.equals("/")){
replaceSeparator = "\\\\";
}
filePath = filePath.replaceAll("/", replaceSeparator);
filePath = filePath.replaceAll("\\\\", replaceSeparator);
}
log.fine("filePath: " + filePath);
final File file = new File(filePath);
if (file.exists()) {
// read files into byte[]
final byte[] dataEntry = new byte[(int) file.length()];
try {
final FileInputStream fileInputStream = new FileInputStream(file);
fileInputStream.read(dataEntry);
fileInputStream.close();
} catch (FileNotFoundException e) {
log.severe("File Not Found.");
e.printStackTrace();
} catch (IOException e1) {
log.severe("Error Reading The File.");
e1.printStackTrace();
}
return dataEntry;
} else {
log.severe("file not found: " + file.getAbsolutePath());
return null;
}
} catch (SAXException sxe) {
// Error generated during parsing)
Exception x = sxe;
if (sxe.getException() != null)
x = sxe.getException();
x.printStackTrace();
log.severe(x.getMessage());
} catch (ParserConfigurationException pce) {
// Parser with specified options can't be built
pce.printStackTrace();
log.severe(pce.getMessage());
} catch (IOException ioe) {
// I/O error
ioe.printStackTrace();
log.severe(ioe.getMessage());
}
return null;
}
/**
* Get Binary Data. (inflate)
*
* @return inflated data
*/
private byte[] getBinaryDataFromDB() {
byte[] deflatedData = super.getBinaryData();
m_deflated = null;
m_inflated = null;
@ -166,144 +330,239 @@ public class MArchive extends X_AD_Archive
return null;
byte[] inflatedData = null;
try
{
try {
ByteArrayInputStream in = new ByteArrayInputStream(deflatedData);
ZipInputStream zip = new ZipInputStream (in);
ZipInputStream zip = new ZipInputStream(in);
ZipEntry entry = zip.getNextEntry();
if (entry != null) // just one entry
if (entry != null) // just one entry
{
ByteArrayOutputStream out = new ByteArrayOutputStream();
byte[] buffer = new byte[2048];
int length = zip.read(buffer);
while (length != -1)
{
while (length != -1) {
out.write(buffer, 0, length);
length = zip.read(buffer);
}
//
inflatedData = out.toByteArray();
log.fine("Size=" + inflatedData.length + " - zip="
+ entry.getCompressedSize() + "(" + entry.getSize() + ") "
+ (entry.getCompressedSize()*100/entry.getSize())+ "%");
log.fine("Size=" + inflatedData.length + " - zip=" + entry.getCompressedSize()
+ "(" + entry.getSize() + ") "
+ (entry.getCompressedSize() * 100 / entry.getSize()) + "%");
m_inflated = new Integer(inflatedData.length);
}
}
catch (Exception e)
{
} catch (Exception e) {
log.log(Level.SEVERE, "", e);
inflatedData = null;
}
return inflatedData;
} // getBinaryData
} // getBinaryData
/**
* Get Data as Input Stream
* @return input stream or null
* Get Data as Input Stream
*
* @return input stream or null
*/
public InputStream getInputStream()
{
public InputStream getInputStream() {
byte[] inflatedData = getBinaryData();
if (inflatedData == null)
return null;
return new ByteArrayInputStream(inflatedData);
} // getInputStream
} // getInputStream
/**
* Save Binary Data.
* (deflate)
* @param inflatedData inflated data
* Save Binary Data to file system or db.
*
* @param inflatedData
* inflated data
*/
public void setBinaryData (byte[] inflatedData)
{
public void setBinaryData(byte[] inflatedData) {
if (isStoreArchiveOnFileSystem) {
saveBinaryDataIntoFileSystem(inflatedData);
} else {
saveBinaryDataIntoDB(inflatedData);
}
}
/**
* Save to file system. If the MArchive is not saved yet (id==0) it will
* first save the MArchive object because it uses the id as filename.
* @param inflatedData
*/
private void saveBinaryDataIntoFileSystem(byte[] inflatedData) {
if ("".equals(m_archivePathRoot)) {
throw new IllegalArgumentException("no attachmentPath defined");
}
if (inflatedData == null || inflatedData.length == 0) {
throw new IllegalArgumentException("InflatedData is NULL");
}
if(this.get_ID()==0){
//set binary data otherwise save will fail
super.setBinaryData(new byte[]{'0'});
if(!this.save()) {
throw new IllegalArgumentException("unable to save MArchive");
}
}
final DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
BufferedOutputStream out = null;
try {
// create destination folder
final File destFolder = new File(m_archivePathRoot + File.separator
+ getArchivePathSnippet());
if (!destFolder.exists()) {
if (!destFolder.mkdirs()) {
log.warning("unable to create folder: " + destFolder.getPath());
}
}
// write to pdf
final File destFile = new File(m_archivePathRoot + File.separator
+ getArchivePathSnippet() + this.get_ID() + ".pdf");
out = new BufferedOutputStream(new FileOutputStream(destFile));
out.write(inflatedData);
out.flush();
//create xml entry
final DocumentBuilder builder = factory.newDocumentBuilder();
final Document document = builder.newDocument();
final Element root = document.createElement("archive");
document.appendChild(root);
document.setXmlStandalone(true);
final Element entry = document.createElement("entry");
entry.setAttribute("file", ARCHIVE_FOLDER_PLACEHOLDER + getArchivePathSnippet() + this.get_ID() + ".pdf");
root.appendChild(entry);
final Source source = new DOMSource(document);
final ByteArrayOutputStream bos = new ByteArrayOutputStream();
final Result result = new StreamResult(bos);
final Transformer xformer = TransformerFactory.newInstance().newTransformer();
xformer.transform(source, result);
final byte[] xmlData = bos.toByteArray();
log.fine(bos.toString());
//store xml in db
super.setBinaryData(xmlData);
} catch (Exception e) {
log.log(Level.SEVERE, "saveLOBData", e);
m_deflated = null;
super.setBinaryData(null);
} finally {
if(out != null){
try {
out.close();
} catch (Exception e) { }
}
}
}
/**
* Save Binary Data to database.
*
* @param inflatedData
* inflated data
*/
private void saveBinaryDataIntoDB(byte[] inflatedData) {
if (inflatedData == null || inflatedData.length == 0)
throw new IllegalArgumentException("InflatedData is NULL");
m_inflated = new Integer(inflatedData.length);
ByteArrayOutputStream out = new ByteArrayOutputStream();
ByteArrayOutputStream out = new ByteArrayOutputStream();
ZipOutputStream zip = new ZipOutputStream(out);
zip.setMethod(ZipOutputStream.DEFLATED);
zip.setLevel(Deflater.BEST_COMPRESSION);
zip.setComment("adempiere");
//
byte[] deflatedData = null;
try
{
try {
ZipEntry entry = new ZipEntry("AdempiereArchive");
entry.setTime(System.currentTimeMillis());
entry.setMethod(ZipEntry.DEFLATED);
zip.putNextEntry(entry);
zip.write (inflatedData, 0, inflatedData.length);
zip.write(inflatedData, 0, inflatedData.length);
zip.closeEntry();
log.fine(entry.getCompressedSize() + " (" + entry.getSize() + ") "
+ (entry.getCompressedSize()*100/entry.getSize())+ "%");
+ (entry.getCompressedSize() * 100 / entry.getSize()) + "%");
//
// zip.finish();
// zip.finish();
zip.close();
deflatedData = out.toByteArray();
log.fine("Length=" + inflatedData.length);
log.fine("Length=" + inflatedData.length);
m_deflated = new Integer(deflatedData.length);
}
catch (Exception e)
{
} catch (Exception e) {
log.log(Level.SEVERE, "saveLOBData", e);
deflatedData = null;
m_deflated = null;
}
super.setBinaryData (deflatedData);
} // setBinaryData
super.setBinaryData(deflatedData);
} // setBinaryData
/**
* Get Created By (User) Name
* @return name
* Get Created By (User) Name
*
* @return name
*/
public String getCreatedByName()
{
public String getCreatedByName() {
String name = "?";
String sql = "SELECT Name FROM AD_User WHERE AD_User_ID=?";
PreparedStatement pstmt = null;
try
{
pstmt = DB.prepareStatement (sql, null);
pstmt.setInt (1, getCreatedBy());
ResultSet rs = pstmt.executeQuery ();
if (rs.next ())
try {
pstmt = DB.prepareStatement(sql, null);
pstmt.setInt(1, getCreatedBy());
ResultSet rs = pstmt.executeQuery();
if (rs.next())
name = rs.getString(1);
rs.close ();
pstmt.close ();
rs.close();
pstmt.close();
pstmt = null;
}
catch (Exception e)
{
} catch (Exception e) {
log.log(Level.SEVERE, sql, e);
}
try
{
try {
if (pstmt != null)
pstmt.close ();
pstmt.close();
pstmt = null;
}
catch (Exception e)
{
} catch (Exception e) {
pstmt = null;
}
return name;
} // getCreatedByName
} // getCreatedByName
/**
* Before Save
* @param newRecord new
* @return true if can be saved
* Returns the archive path (snippet), containing client, org and archive
* id. The process, table and record id are only included when they are not
* null.
*
* @return String
*/
protected boolean beforeSave (boolean newRecord)
{
// Binary Data is Mandatory
private String getArchivePathSnippet() {
String path = this.getAD_Client_ID() + File.separator + this.getAD_Org_ID()
+ File.separator;
if (this.getAD_Process_ID() > 0) {
path = path + this.getAD_Process_ID() + File.separator;
}
if (this.getAD_Table_ID() > 0) {
path = path + this.getAD_Table_ID() + File.separator;
}
if (this.getRecord_ID() > 0) {
path = path + this.getRecord_ID() + File.separator;
}
// path = path + this.get_ID() + ".pdf";
return path;
}
/**
* Before Save
*
* @param newRecord
* new
* @return true if can be saved
*/
protected boolean beforeSave(boolean newRecord) {
// Binary Data is Mandatory
byte[] data = super.getBinaryData();
if (data == null || data.length == 0)
return false;
//
log.fine(toString());
return true;
} // beforeSave
} // MArchive
} // beforeSave
} // MArchive

View File

@ -48,6 +48,7 @@ setIsSmtpAuthorization (false); // N
setIsUseBetaFunctions (true); // Y
setMMPolicy (null); // F
setName (null);
setStoreArchiveOnFileSystem (false);
setStoreAttachmentsOnFileSystem (false);
setValue (null);
}
@ -62,13 +63,13 @@ public X_AD_Client (Properties ctx, ResultSet rs, String trxName)
{
super (ctx, rs, trxName);
}
/** AD_Table_ID=112 */
public static final int Table_ID=MTable.getTable_ID("AD_Client");
/** TableName=AD_Client */
public static final String Table_Name="AD_Client";
protected static KeyNamePair Model = new KeyNamePair(Table_ID,"AD_Client");
/** AD_Table_ID=112 */
public static final int Table_ID=MTable.getTable_ID(Table_Name);
protected static KeyNamePair Model = new KeyNamePair(Table_ID, Table_Name);
protected BigDecimal accessLevel = BigDecimal.valueOf(6);
/** AccessLevel
@ -500,6 +501,26 @@ return (String)get_Value("SMTPHost");
}
/** Column name SMTPHost */
public static final String COLUMNNAME_SMTPHost = "SMTPHost";
/** Set Store Archive On File System.
@param StoreArchiveOnFileSystem Store Archive On File System */
public void setStoreArchiveOnFileSystem (boolean StoreArchiveOnFileSystem)
{
set_Value ("StoreArchiveOnFileSystem", Boolean.valueOf(StoreArchiveOnFileSystem));
}
/** Get Store Archive On File System.
@return Store Archive On File System */
public boolean isStoreArchiveOnFileSystem()
{
Object oo = get_Value("StoreArchiveOnFileSystem");
if (oo != null)
{
if (oo instanceof Boolean) return ((Boolean)oo).booleanValue();
return "Y".equals(oo);
}
return false;
}
/** Column name StoreArchiveOnFileSystem */
public static final String COLUMNNAME_StoreArchiveOnFileSystem = "StoreArchiveOnFileSystem";
/** Set Store Attachments On File System.
@param StoreAttachmentsOnFileSystem Store Attachments On File System */
public void setStoreAttachmentsOnFileSystem (boolean StoreAttachmentsOnFileSystem)
@ -520,6 +541,25 @@ return false;
}
/** Column name StoreAttachmentsOnFileSystem */
public static final String COLUMNNAME_StoreAttachmentsOnFileSystem = "StoreAttachmentsOnFileSystem";
/** Set Unix Archive Path.
@param UnixArchivePath Unix Archive Path - If you change this value make sure to copy the archive entries to the new path! */
public void setUnixArchivePath (String UnixArchivePath)
{
if (UnixArchivePath != null && UnixArchivePath.length() > 255)
{
log.warning("Length > 255 - truncated");
UnixArchivePath = UnixArchivePath.substring(0,254);
}
set_Value ("UnixArchivePath", UnixArchivePath);
}
/** Get Unix Archive Path.
@return Unix Archive Path - If you change this value make sure to copy the archive entries to the new path! */
public String getUnixArchivePath()
{
return (String)get_Value("UnixArchivePath");
}
/** Column name UnixArchivePath */
public static final String COLUMNNAME_UnixArchivePath = "UnixArchivePath";
/** Set Unix Attachment Path.
@param UnixAttachmentPath Unix Attachment Path */
public void setUnixAttachmentPath (String UnixAttachmentPath)
@ -559,6 +599,25 @@ return (String)get_Value("Value");
}
/** Column name Value */
public static final String COLUMNNAME_Value = "Value";
/** Set Windows Archive Path.
@param WindowsArchivePath Windows Archive Path - If you change this value make sure to copy the archive entries to the new path! */
public void setWindowsArchivePath (String WindowsArchivePath)
{
if (WindowsArchivePath != null && WindowsArchivePath.length() > 255)
{
log.warning("Length > 255 - truncated");
WindowsArchivePath = WindowsArchivePath.substring(0,254);
}
set_Value ("WindowsArchivePath", WindowsArchivePath);
}
/** Get Windows Archive Path.
@return Windows Archive Path - If you change this value make sure to copy the archive entries to the new path! */
public String getWindowsArchivePath()
{
return (String)get_Value("WindowsArchivePath");
}
/** Column name WindowsArchivePath */
public static final String COLUMNNAME_WindowsArchivePath = "WindowsArchivePath";
/** Set Windows Attachment Path.
@param WindowsAttachmentPath Windows Attachment Path */
public void setWindowsAttachmentPath (String WindowsAttachmentPath)

View File

@ -0,0 +1,248 @@
INSERT INTO ad_element
(ad_element_id, ad_client_id, ad_org_id, isactive,
created, createdby,
updated, updatedby,
columnname, entitytype, NAME,
printname
)
VALUES (50071, 0, 0, 'Y',
TO_DATE ('02/26/2007 12:30:00', 'MM/DD/YYYY HH24:MI:SS'), 100,
TO_DATE ('02/26/2007 12:30:00', 'MM/DD/YYYY HH24:MI:SS'), 100,
'StoreArchiveOnFileSystem', 'D', 'Store Archive On File System',
'Store Archive On File System'
);
INSERT INTO ad_column
(ad_column_id, ad_client_id, ad_org_id, isactive,
created,
updated, createdby,
updatedby, NAME, description, VERSION,
entitytype, columnname, ad_table_id, ad_reference_id,
fieldlength, iskey, isparent, ismandatory, isupdateable,
isidentifier, seqno, istranslated, isencrypted,
isselectioncolumn, ad_element_id, callout, issyncdatabase,
isalwaysupdateable
)
VALUES (50214, 0, 0, 'Y',
TO_DATE ('02/26/2007 12:30:00', 'MM/DD/YYYY HH24:MI:SS'),
TO_DATE ('02/26/2007 12:30:00', 'MM/DD/YYYY HH24:MI:SS'), 100,
100, 'Store Archive On File System', 'Store Archive On File System', 1,
'D', 'StoreArchiveOnFileSystem', 112, 20,
1, 'N', 'N', 'Y', 'Y',
'N', 0, 'N', 'N',
'N', 50071, 'org.compiere.model.CalloutClient.storeArchiveOnFileSystem', 'N',
'N'
);
INSERT INTO ad_field
(ad_field_id, ad_client_id, ad_org_id, isactive,
created, createdby,
updated, updatedby,
NAME, description, iscentrallymaintained, seqno, ad_tab_id,
ad_column_id, isdisplayed, displaylength, isreadonly,
issameline, isheading, isfieldonly, isencrypted, entitytype
)
VALUES (50184, 0, 0, 'Y',
TO_DATE ('02/26/2007 12:30:00', 'MM/DD/YYYY HH24:MI:SS'), 100,
TO_DATE ('02/26/2007 12:30:00', 'MM/DD/YYYY HH24:MI:SS'), 100,
'Store Archive On File System', 'Store Archive On File System', 'Y', 250, 145,
50214, 'Y', 1, 'N',
'N', 'N', 'N', 'N', 'D'
);
INSERT INTO ad_element
(ad_element_id, ad_client_id, ad_org_id, isactive,
created, createdby,
updated, updatedby,
columnname, entitytype, NAME,
printname
)
VALUES (50072, 0, 0, 'Y',
TO_DATE ('02/26/2007 12:30:00', 'MM/DD/YYYY HH24:MI:SS'), 100,
TO_DATE ('02/26/2007 12:30:00', 'MM/DD/YYYY HH24:MI:SS'), 100,
'WindowsArchivePath', 'D', 'Windows Archive Path',
'Windows Archive Path'
);
INSERT INTO ad_column
(ad_column_id, ad_client_id, ad_org_id, isactive,
created,
updated, createdby,
updatedby, NAME, description,
help, VERSION,
entitytype, columnname, ad_table_id, ad_reference_id,
fieldlength, iskey, isparent, ismandatory, isupdateable,
isidentifier, seqno, istranslated, isencrypted,
isselectioncolumn, ad_element_id, issyncdatabase,
isalwaysupdateable
)
VALUES (50215, 0, 0, 'Y',
TO_DATE ('02/26/2007 12:30:00', 'MM/DD/YYYY HH24:MI:SS'),
TO_DATE ('02/26/2007 12:30:00', 'MM/DD/YYYY HH24:MI:SS'), 100,
100, 'Windows Archive Path', 'Windows Archive Path - If you change this value make sure to copy the archive entries to the new path!',
'Path of the adempiere archive entries in the file system. If you change this value make sure to copy the archive entries to the new path!', 1,
'D', 'WindowsArchivePath', 112, 10,
255, 'N', 'N', 'N', 'Y',
'N', 0, 'N', 'N',
'N', 50072, 'N',
'N'
);
INSERT INTO ad_field
(ad_field_id, ad_client_id, ad_org_id, isactive,
created, createdby,
updated, updatedby,
NAME, description,
help,
iscentrallymaintained, seqno, ad_tab_id,
ad_column_id, isdisplayed, displaylength, isreadonly,
issameline, isheading, isfieldonly, isencrypted, entitytype, displaylogic
)
VALUES (50185, 0, 0, 'Y',
TO_DATE ('02/26/2007 12:30:00', 'MM/DD/YYYY HH24:MI:SS'), 100,
TO_DATE ('02/26/2007 12:30:00', 'MM/DD/YYYY HH24:MI:SS'), 100,
'Windows Archive Path', 'Windows Archive Path',
'If you change this value make sure to copy the archive entries to the new path!',
'Y', 260, 145,
50215, 'Y', 1, 'N',
'N', 'N', 'N', 'N', 'D','@StoreArchiveOnFileSystem@=''Y'''
);
INSERT INTO ad_element
(ad_element_id, ad_client_id, ad_org_id, isactive,
created, createdby,
updated, updatedby,
columnname, entitytype, NAME,
printname
)
VALUES (50073, 0, 0, 'Y',
TO_DATE ('02/26/2007 12:30:00', 'MM/DD/YYYY HH24:MI:SS'), 100,
TO_DATE ('02/26/2007 12:30:00', 'MM/DD/YYYY HH24:MI:SS'), 100,
'UnixArchivePath', 'D', 'Unix Archive Path',
'Unix Archive Path'
);
INSERT INTO ad_column
(ad_column_id, ad_client_id, ad_org_id, isactive,
created,
updated, createdby,
updatedby, NAME, description,
help, VERSION,
entitytype, columnname, ad_table_id, ad_reference_id,
fieldlength, iskey, isparent, ismandatory, isupdateable,
isidentifier, seqno, istranslated, isencrypted,
isselectioncolumn, ad_element_id, issyncdatabase,
isalwaysupdateable
)
VALUES (50216, 0, 0, 'Y',
TO_DATE ('02/26/2007 12:30:00', 'MM/DD/YYYY HH24:MI:SS'),
TO_DATE ('02/26/2007 12:30:00', 'MM/DD/YYYY HH24:MI:SS'), 100,
100, 'Unix Archive Path', 'Unix Archive Path - If you change this value make sure to copy the archive entries to the new path!',
'Path of the adempiere archive entries in the file system. If you change this value make sure to copy the archive entries to the new path!', 1,
'D', 'UnixArchivePath', 112, 10,
255, 'N', 'N', 'N', 'Y',
'N', 0, 'N', 'N',
'N', 50073, 'N',
'N'
);
INSERT INTO ad_field
(ad_field_id, ad_client_id, ad_org_id, isactive,
created, createdby,
updated, updatedby,
NAME, description,
help,
iscentrallymaintained, seqno, ad_tab_id,
ad_column_id, isdisplayed, displaylength, isreadonly,
issameline, isheading, isfieldonly, isencrypted, entitytype, displaylogic
)
VALUES (50186, 0, 0, 'Y',
TO_DATE ('02/26/2007 12:30:00', 'MM/DD/YYYY HH24:MI:SS'), 100,
TO_DATE ('02/26/2007 12:30:00', 'MM/DD/YYYY HH24:MI:SS'), 100,
'Unix Archive Path', 'Unix Archive Path',
'If you change this value make sure to copy the archive entries to the new path!',
'Y', 270 ,145,
50216, 'Y', 1, 'N',
'Y', 'N', 'N', 'N', 'D','@StoreArchiveOnFileSystem@=''Y'''
);
INSERT INTO ad_message
(ad_message_id, ad_client_id, ad_org_id, isactive,
created, createdby,
updated, updatedby,
value, msgtext, msgtype
)
VALUES (50015, 0, 0, 'Y',
TO_DATE ('02/26/2007 12:30:00', 'MM/DD/YYYY HH24:MI:SS'), 100,
TO_DATE ('02/26/2007 12:30:00', 'MM/DD/YYYY HH24:MI:SS'), 100,
'StoreArchiveWarning',
'If you change the archive storage method, the old archive entries are no longer available to your client.','I'
);
INSERT INTO ad_message
(ad_message_id, ad_client_id, ad_org_id, isactive,
created, createdby,
updated, updatedby,
value, msgtext, msgtype
)
VALUES (50016, 0, 0, 'Y',
TO_DATE ('02/26/2007 12:30:00', 'MM/DD/YYYY HH24:MI:SS'), 100,
TO_DATE ('02/26/2007 12:30:00', 'MM/DD/YYYY HH24:MI:SS'), 100,
'ArchivePathWarning','Make sure to copy the archive entries to the new path!','I'
);
INSERT INTO ad_message_trl
(ad_message_id, ad_language, ad_client_id, ad_org_id, isactive,
created, createdby, updated, updatedby, msgtext, msgtip,
istranslated)
SELECT m.ad_message_id, lang.ad_language, m.ad_client_id, m.ad_org_id, 'Y',
m.created, m.createdby, m.updated, m.updatedby, m.msgtext, m.msgtip,
'N'
FROM ad_message m, ad_language lang
WHERE m.ad_message_id in (50015, 50016)
AND lang.issystemlanguage = 'Y'
AND lang.isbaselanguage = 'N'
AND NOT EXISTS (
SELECT *
FROM ad_message_trl m2
WHERE m2.ad_message_id = m.ad_message_id
AND m2.ad_language = lang.ad_language);
COMMIT ;
UPDATE ad_sequence
SET currentnextsys = (SELECT MAX (ad_element_id) + 1
FROM ad_element
WHERE ad_element_id < 1000000)
WHERE NAME = 'AD_Element';
UPDATE ad_sequence
SET currentnextsys = (SELECT MAX (ad_column_id) + 1
FROM ad_column
WHERE ad_column_id < 1000000)
WHERE NAME = 'AD_Column';
UPDATE ad_sequence
SET currentnextsys = (SELECT MAX (ad_field_id) + 1
FROM ad_field
WHERE ad_field_id < 1000000)
WHERE NAME = 'AD_Field';
UPDATE ad_sequence
SET currentnextsys = (SELECT MAX (ad_message_id) + 1
FROM ad_message
WHERE ad_message_id < 1000000)
WHERE NAME = 'AD_Message';
ALTER TABLE ad_client ADD StoreArchiveOnFilesystem CHAR(1 BYTE) DEFAULT 'N' NOT NULL;
ALTER TABLE ad_client ADD WindowsArchivePath NVARCHAR2(255);
ALTER TABLE ad_client ADD UnixArchivePath NVARCHAR2(255);
COMMIT ;