hg merge release-2.0 (merge release2 into development)

This commit is contained in:
Carlos Ruiz 2013-11-21 21:27:43 -05:00
commit 456824b20d
3 changed files with 44 additions and 5 deletions

View File

@ -18,6 +18,7 @@ package org.adempiere.pipo2.handler;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.List;
import java.util.logging.Level;
@ -28,13 +29,14 @@ import org.adempiere.exceptions.AdempiereException;
import org.adempiere.model.GenericPO;
import org.adempiere.pipo2.AbstractElementHandler;
import org.adempiere.pipo2.DataElementParameters;
import org.adempiere.pipo2.Element;
import org.adempiere.pipo2.ElementHandler;
import org.adempiere.pipo2.PIPOContext;
import org.adempiere.pipo2.PackOut;
import org.adempiere.pipo2.PackoutItem;
import org.adempiere.pipo2.PoExporter;
import org.adempiere.pipo2.Element;
import org.adempiere.pipo2.PackOut;
import org.adempiere.pipo2.PoFiller;
import org.compiere.model.MColumn;
import org.compiere.model.MRole;
import org.compiere.model.MTable;
import org.compiere.model.PO;
@ -88,6 +90,7 @@ public class GenericPOElementHandler extends AbstractElementHandler {
return;
}
po.saveEx();
element.recordId = po.get_ID();
}
public void endElement(PIPOContext ctx, Element element) throws SAXException {
@ -108,6 +111,7 @@ public class GenericPOElementHandler extends AbstractElementHandler {
int tableId = Env.getContextAsInt(ctx.ctx, DataElementParameters.AD_TABLE_ID);
String tableName = MTable.getTableName(ctx.ctx, tableId);
List<String> excludes = defaultExcludeList(tableName);
boolean checkExcluded = ! sql.toLowerCase().startsWith("select *");
Statement stmt = null;
ResultSet rs = null;
try {
@ -122,6 +126,31 @@ public class GenericPOElementHandler extends AbstractElementHandler {
boolean createElement = isPackOutElement(ctx, po);
if (checkExcluded) { // IDEMPIERE-1563
MTable table = MTable.get(ctx.ctx, tableId);
for (MColumn column : table.getColumns(false)) {
try {
rs.findColumn(column.getColumnName());
} catch (SQLException e) {
if (column.getColumnName().equals("AD_Client_ID") || column.getColumnName().equals("AD_Org_ID")) {
throw new Exception("SQL Statement must include AD_Client_ID and AD_Org_ID");
}
if (!excludes.contains(column.getColumnName().toLowerCase())) {
excludes.add(column.getColumnName().toLowerCase());
}
}
}
for (String keycol : po.get_KeyColumns()) {
if (excludes.contains(keycol.toLowerCase())) {
throw new Exception("SQL Statement must include key columns");
}
}
if (excludes.contains(po.getUUIDColumnName().toLowerCase())) {
throw new Exception("SQL Statement must include UUID column");
}
checkExcluded = false;
}
if (createElement) {
if (po.get_ID() > 0) {
ElementHandler handler = ctx.packOut.getHandler(po.get_TableName());
@ -136,6 +165,12 @@ public class GenericPOElementHandler extends AbstractElementHandler {
document.startElement("","", tableName, atts);
PoExporter filler = new PoExporter(ctx, document, po);
filler.export(excludes, true);
ctx.packOut.getCtx().ctx.put("Table_Name",tableName);
try {
new CommonTranslationHandler().packOut(ctx.packOut,document,null,po.get_ID());
} catch(Exception e) {
if (log.isLoggable(Level.INFO)) log.info(e.toString());
}
}
}

View File

@ -39,8 +39,8 @@
</condition>
<echo message="Windows=${isWindows}" />
<copy file="plugins/org.adempiere.tomcat.config_1.0.0/META-INF/tomcat/serverTemplate.xml"
tofile="plugins/org.adempiere.tomcat.config_1.0.0/META-INF/tomcat/server.xml" filtering="yes" overwrite="yes"/>
<copy file="plugins/org.adempiere.tomcat.config_2.0.0/META-INF/tomcat/serverTemplate.xml"
tofile="plugins/org.adempiere.tomcat.config_2.0.0/META-INF/tomcat/server.xml" filtering="yes" overwrite="yes"/>
</target>

View File

@ -7,6 +7,10 @@ cp idempiere.ini idempiere.ini.sav
if exist server.xml.sav del /q server.xml.sav
if exist plugins/org.adempiere.tomcat.config_1.0.0/META-INF/tomcat/server.xml (
copy plugins/org.adempiere.tomcat.config_1.0.0/META-INF/tomcat/server.xml server.xml.sav
del /q plugins/org.adempiere.tomcat.config_1.0.0/META-INF/tomcat/server.xml
)
if exist plugins/org.adempiere.tomcat.config_2.0.0/META-INF/tomcat/server.xml (
copy plugins/org.adempiere.tomcat.config_2.0.0/META-INF/tomcat/server.xml server.xml.sav
)
java -Dosgi.noShutdown=false -Dosgi.compatibility.bootdelegation=true -Dosgi.install.area=director -jar plugins/org.eclipse.osgi_3.7.*.jar -application org.eclipse.equinox.p2.director -consoleLog -profileProperties org.eclipse.update.install.features=true -destination %~dp0 -repository %1 -u org.adempiere.server.product
@ -15,6 +19,6 @@ java -Dosgi.noShutdown=false -Dosgi.compatibility.bootdelegation=true -Dosgi.ins
cp idempiere.ini.sav idempiere.ini
if exist server.xml.sav (
copy server.xml.sav plugins/org.adempiere.tomcat.config_1.0.0/META-INF/tomcat/server.xml
copy server.xml.sav plugins/org.adempiere.tomcat.config_2.0.0/META-INF/tomcat/server.xml
del /q server.xml.sav
)