IDEMPIERE-3925 Export button - zip doesn't work for tables without single primary key

This commit is contained in:
Carlos Ruiz 2019-03-21 11:58:56 -03:00
parent cc3796e2b0
commit 760fd61bcc
13 changed files with 228 additions and 31 deletions

View File

@ -1026,7 +1026,7 @@ public class GridTable extends AbstractTableModel
} }
} }
return null; return null;
} // getKeyID } // getUUID
/** /**
* Get Key ColumnName * Get Key ColumnName

View File

@ -20,11 +20,12 @@ import java.util.List;
import javax.xml.transform.sax.TransformerHandler; import javax.xml.transform.sax.TransformerHandler;
import org.adempiere.exceptions.AdempiereException;
import org.adempiere.pipo2.AbstractElementHandler; import org.adempiere.pipo2.AbstractElementHandler;
import org.adempiere.pipo2.Element;
import org.adempiere.pipo2.PIPOContext; import org.adempiere.pipo2.PIPOContext;
import org.adempiere.pipo2.PackOut; import org.adempiere.pipo2.PackOut;
import org.adempiere.pipo2.PoExporter; import org.adempiere.pipo2.PoExporter;
import org.adempiere.pipo2.Element;
import org.adempiere.pipo2.PoFiller; import org.adempiere.pipo2.PoFiller;
import org.compiere.model.I_AD_Form_Access; import org.compiere.model.I_AD_Form_Access;
import org.compiere.model.MFormAccess; import org.compiere.model.MFormAccess;
@ -90,10 +91,28 @@ public class FormAccessElementHandler extends AbstractElementHandler {
filler.export(excludes); filler.export(excludes);
} }
@Override
public void packOut(PackOut packout, TransformerHandler packoutHandler, TransformerHandler docHandler, int recordId)
throws Exception {
throw new AdempiereException("AD_Form_Access doesn't have ID, use method with UUID");
}
@Override @Override
public void packOut(PackOut packout, TransformerHandler packoutHandler, public void packOut(PackOut packout, TransformerHandler packoutHandler,
TransformerHandler docHandler, TransformerHandler docHandler,
int recordId) throws Exception { int recordId, String uuid) throws Exception {
MFormAccess po = new Query(packout.getCtx().ctx, MFormAccess.Table_Name, "AD_Form_Access_UU=?", getTrxName(packout.getCtx()))
.setParameters(uuid)
.first();
if (po != null) {
Env.setContext(packout.getCtx().ctx, X_AD_Form.COLUMNNAME_AD_Form_ID, po.getAD_Form_ID());
Env.setContext(packout.getCtx().ctx, X_AD_Role.COLUMNNAME_AD_Role_ID, po.getAD_Role_ID());
this.create(packout.getCtx(), packoutHandler);
packout.getCtx().ctx.remove(X_AD_Form.COLUMNNAME_AD_Form_ID);
packout.getCtx().ctx.remove(X_AD_Role.COLUMNNAME_AD_Role_ID);
} else {
throw new AdempiereException("AD_Form_Access_UU not found = " + uuid);
}
} }
} }

View File

@ -29,6 +29,7 @@ import java.util.List;
import javax.xml.transform.sax.TransformerHandler; import javax.xml.transform.sax.TransformerHandler;
import org.adempiere.exceptions.AdempiereException;
import org.adempiere.pipo2.AbstractElementHandler; import org.adempiere.pipo2.AbstractElementHandler;
import org.adempiere.pipo2.Element; import org.adempiere.pipo2.Element;
import org.adempiere.pipo2.PIPOContext; import org.adempiere.pipo2.PIPOContext;
@ -90,7 +91,24 @@ public class InfoWindowAccessElementHandler extends AbstractElementHandler {
} }
@Override @Override
public void packOut(PackOut packout, TransformerHandler packoutHandler, TransformerHandler docHandler, int recordId) throws Exception { public void packOut(PackOut packout, TransformerHandler packoutHandler, TransformerHandler docHandler, int recordId)
create(packout.getCtx(), packoutHandler); throws Exception {
throw new AdempiereException("AD_InfoWindow_Access doesn't have ID, use method with UUID");
}
@Override
public void packOut(PackOut packout, TransformerHandler packoutHandler, TransformerHandler docHandler, int recordId, String uuid) throws Exception {
X_AD_InfoWindow_Access po = new Query(packout.getCtx().ctx, X_AD_InfoWindow_Access.Table_Name, "AD_InfoWindow_Access_UU=?", getTrxName(packout.getCtx()))
.setParameters(uuid)
.first();
if (po != null) {
Env.setContext(packout.getCtx().ctx, X_AD_InfoWindow.COLUMNNAME_AD_InfoWindow_ID, po.getAD_InfoWindow_ID());
Env.setContext(packout.getCtx().ctx, X_AD_Role.COLUMNNAME_AD_Role_ID, po.getAD_Role_ID());
this.create(packout.getCtx(), packoutHandler);
packout.getCtx().ctx.remove(X_AD_InfoWindow.COLUMNNAME_AD_InfoWindow_ID);
packout.getCtx().ctx.remove(X_AD_Role.COLUMNNAME_AD_Role_ID);
} else {
throw new AdempiereException("AD_InfoWindow_Access_UU not found = " + uuid);
}
} }
} }

View File

@ -20,6 +20,7 @@ import java.util.List;
import javax.xml.transform.sax.TransformerHandler; import javax.xml.transform.sax.TransformerHandler;
import org.adempiere.exceptions.AdempiereException;
import org.adempiere.pipo2.AbstractElementHandler; import org.adempiere.pipo2.AbstractElementHandler;
import org.adempiere.pipo2.Element; import org.adempiere.pipo2.Element;
import org.adempiere.pipo2.PIPOContext; import org.adempiere.pipo2.PIPOContext;
@ -59,7 +60,7 @@ public class OrgRoleElementHandler extends AbstractElementHandler {
public void create(PIPOContext ctx, TransformerHandler document) public void create(PIPOContext ctx, TransformerHandler document)
throws SAXException { throws SAXException {
int AD_Org_ID = Env.getContextAsInt(ctx.ctx, "AD_Org_ID"); int AD_Org_ID = Env.getContextAsInt(ctx.ctx, X_AD_Role.COLUMNNAME_AD_Org_ID);
int AD_Role_ID = Env.getContextAsInt(ctx.ctx, X_AD_Role.COLUMNNAME_AD_Role_ID); int AD_Role_ID = Env.getContextAsInt(ctx.ctx, X_AD_Role.COLUMNNAME_AD_Role_ID);
Query query = new Query(ctx.ctx, "AD_Role_OrgAccess", "AD_Role_ID=? and AD_Org_ID=?", getTrxName(ctx)); Query query = new Query(ctx.ctx, "AD_Role_OrgAccess", "AD_Role_ID=? and AD_Org_ID=?", getTrxName(ctx));
@ -86,10 +87,27 @@ public class OrgRoleElementHandler extends AbstractElementHandler {
filler.export(excludes); filler.export(excludes);
} }
@Override
public void packOut(PackOut packout, TransformerHandler packoutHandler, TransformerHandler docHandler, int recordId)
throws Exception {
throw new AdempiereException("AD_Role_OrgAccess doesn't have ID, use method with UUID");
}
@Override @Override
public void packOut(PackOut packout, TransformerHandler packoutHandler, public void packOut(PackOut packout, TransformerHandler packoutHandler,
TransformerHandler docHandler, TransformerHandler docHandler,
int recordId) throws Exception { int recordId, String uuid) throws Exception {
create(packout.getCtx(), packoutHandler); X_AD_Role_OrgAccess po = new Query(packout.getCtx().ctx, X_AD_Role_OrgAccess.Table_Name, "AD_Role_OrgAccess_UU=?", getTrxName(packout.getCtx()))
.setParameters(uuid)
.first();
if (po != null) {
Env.setContext(packout.getCtx().ctx, X_AD_Role.COLUMNNAME_AD_Org_ID, po.getAD_Org_ID());
Env.setContext(packout.getCtx().ctx, X_AD_Role.COLUMNNAME_AD_Role_ID, po.getAD_Role_ID());
this.create(packout.getCtx(), packoutHandler);
packout.getCtx().ctx.remove(X_AD_Role.COLUMNNAME_AD_Org_ID);
packout.getCtx().ctx.remove(X_AD_Role.COLUMNNAME_AD_Role_ID);
} else {
throw new AdempiereException("AD_Role_OrgAccess_UU not found = " + uuid);
}
} }
} }

View File

@ -20,13 +20,15 @@ import java.util.List;
import javax.xml.transform.sax.TransformerHandler; import javax.xml.transform.sax.TransformerHandler;
import org.adempiere.exceptions.AdempiereException;
import org.adempiere.pipo2.AbstractElementHandler; import org.adempiere.pipo2.AbstractElementHandler;
import org.adempiere.pipo2.Element;
import org.adempiere.pipo2.PIPOContext; import org.adempiere.pipo2.PIPOContext;
import org.adempiere.pipo2.PackOut; import org.adempiere.pipo2.PackOut;
import org.adempiere.pipo2.PoExporter; import org.adempiere.pipo2.PoExporter;
import org.adempiere.pipo2.Element;
import org.adempiere.pipo2.PoFiller; import org.adempiere.pipo2.PoFiller;
import org.compiere.model.I_AD_Process_Access; import org.compiere.model.I_AD_Process_Access;
import org.compiere.model.MProcessAccess;
import org.compiere.model.Query; import org.compiere.model.Query;
import org.compiere.model.X_AD_Process; import org.compiere.model.X_AD_Process;
import org.compiere.model.X_AD_Process_Access; import org.compiere.model.X_AD_Process_Access;
@ -88,10 +90,28 @@ public class ProcessAccessElementHandler extends AbstractElementHandler {
filler.export(excludes); filler.export(excludes);
} }
@Override
public void packOut(PackOut packout, TransformerHandler packoutHandler, TransformerHandler docHandler, int recordId)
throws Exception {
throw new AdempiereException("AD_Process_Access doesn't have ID, use method with UUID");
}
@Override @Override
public void packOut(PackOut packout, TransformerHandler packoutHandler, public void packOut(PackOut packout, TransformerHandler packoutHandler,
TransformerHandler docHandler, TransformerHandler docHandler,
int recordId) throws Exception { int recordId, String uuid) throws Exception {
create(packout.getCtx(), packoutHandler); MProcessAccess po = new Query(packout.getCtx().ctx, MProcessAccess.Table_Name, "AD_Process_Access_UU=?", getTrxName(packout.getCtx()))
.setParameters(uuid)
.first();
if (po != null) {
Env.setContext(packout.getCtx().ctx, X_AD_Process.COLUMNNAME_AD_Process_ID, po.getAD_Process_ID());
Env.setContext(packout.getCtx().ctx, X_AD_Role.COLUMNNAME_AD_Role_ID, po.getAD_Role_ID());
this.create(packout.getCtx(), packoutHandler);
packout.getCtx().ctx.remove(X_AD_Process.COLUMNNAME_AD_Process_ID);
packout.getCtx().ctx.remove(X_AD_Role.COLUMNNAME_AD_Role_ID);
} else {
throw new AdempiereException("AD_Process_Access_UU not found = " + uuid);
}
} }
} }

View File

@ -20,11 +20,12 @@ import java.util.List;
import javax.xml.transform.sax.TransformerHandler; import javax.xml.transform.sax.TransformerHandler;
import org.adempiere.exceptions.AdempiereException;
import org.adempiere.pipo2.AbstractElementHandler; import org.adempiere.pipo2.AbstractElementHandler;
import org.adempiere.pipo2.Element;
import org.adempiere.pipo2.PIPOContext; import org.adempiere.pipo2.PIPOContext;
import org.adempiere.pipo2.PackOut; import org.adempiere.pipo2.PackOut;
import org.adempiere.pipo2.PoExporter; import org.adempiere.pipo2.PoExporter;
import org.adempiere.pipo2.Element;
import org.adempiere.pipo2.PoFiller; import org.adempiere.pipo2.PoFiller;
import org.compiere.model.I_AD_Task_Access; import org.compiere.model.I_AD_Task_Access;
import org.compiere.model.Query; import org.compiere.model.Query;
@ -82,10 +83,28 @@ public class TaskAccessElementHandler extends AbstractElementHandler {
filler.export(excludes); filler.export(excludes);
} }
@Override
public void packOut(PackOut packout, TransformerHandler packoutHandler, TransformerHandler docHandler, int recordId)
throws Exception {
throw new AdempiereException("AD_Task_Access doesn't have ID, use method with UUID");
}
@Override @Override
public void packOut(PackOut packout, TransformerHandler packoutHandler, public void packOut(PackOut packout, TransformerHandler packoutHandler,
TransformerHandler docHandler, TransformerHandler docHandler,
int recordId) throws Exception { int recordId, String uuid) throws Exception {
create(packout.getCtx(), packoutHandler); X_AD_Task_Access po = new Query(packout.getCtx().ctx, X_AD_Task_Access.Table_Name, "AD_Task_Access_UU=?", getTrxName(packout.getCtx()))
.setParameters(uuid)
.first();
if (po != null) {
Env.setContext(packout.getCtx().ctx, X_AD_Task.COLUMNNAME_AD_Task_ID, po.getAD_Task_ID());
Env.setContext(packout.getCtx().ctx, X_AD_Role.COLUMNNAME_AD_Role_ID, po.getAD_Role_ID());
this.create(packout.getCtx(), packoutHandler);
packout.getCtx().ctx.remove(X_AD_Task.COLUMNNAME_AD_Task_ID);
packout.getCtx().ctx.remove(X_AD_Role.COLUMNNAME_AD_Role_ID);
} else {
throw new AdempiereException("AD_Task_Access_UU not found = " + uuid);
}
} }
} }

View File

@ -20,11 +20,12 @@ import java.util.List;
import javax.xml.transform.sax.TransformerHandler; import javax.xml.transform.sax.TransformerHandler;
import org.adempiere.exceptions.AdempiereException;
import org.adempiere.pipo2.AbstractElementHandler; import org.adempiere.pipo2.AbstractElementHandler;
import org.adempiere.pipo2.Element;
import org.adempiere.pipo2.PIPOContext; import org.adempiere.pipo2.PIPOContext;
import org.adempiere.pipo2.PackOut; import org.adempiere.pipo2.PackOut;
import org.adempiere.pipo2.PoExporter; import org.adempiere.pipo2.PoExporter;
import org.adempiere.pipo2.Element;
import org.adempiere.pipo2.PoFiller; import org.adempiere.pipo2.PoFiller;
import org.compiere.model.I_AD_User_Roles; import org.compiere.model.I_AD_User_Roles;
import org.compiere.model.Query; import org.compiere.model.Query;
@ -63,11 +64,10 @@ public class UserRoleElementHandler extends AbstractElementHandler {
throws SAXException { throws SAXException {
int AD_User_ID = Env.getContextAsInt(ctx.ctx, X_AD_User.COLUMNNAME_AD_User_ID); int AD_User_ID = Env.getContextAsInt(ctx.ctx, X_AD_User.COLUMNNAME_AD_User_ID);
int AD_Role_ID = Env.getContextAsInt(ctx.ctx, X_AD_Role.COLUMNNAME_AD_Role_ID); int AD_Role_ID = Env.getContextAsInt(ctx.ctx, X_AD_Role.COLUMNNAME_AD_Role_ID);
int AD_Org_ID = Env.getContextAsInt(ctx.ctx, "AD_Org_ID");
Query query = new Query(ctx.ctx, "AD_User_Roles", Query query = new Query(ctx.ctx, "AD_User_Roles",
"AD_User_ID = ? AND AD_Role_ID = ? AND AD_Org_ID = ?", getTrxName(ctx)); "AD_User_ID = ? AND AD_Role_ID = ?", getTrxName(ctx));
X_AD_User_Roles po = query.setParameters( X_AD_User_Roles po = query.setParameters(
new Object[] { AD_User_ID, AD_Role_ID, AD_Org_ID }).first(); new Object[] { AD_User_ID, AD_Role_ID}).first();
if (po != null) { if (po != null) {
if (!isPackOutElement(ctx, po)) if (!isPackOutElement(ctx, po))
return; return;
@ -90,10 +90,28 @@ public class UserRoleElementHandler extends AbstractElementHandler {
filler.export(excludes, true); filler.export(excludes, true);
} }
@Override
public void packOut(PackOut packout, TransformerHandler packoutHandler, TransformerHandler docHandler, int recordId)
throws Exception {
throw new AdempiereException("AD_User_Roles doesn't have ID, use method with UUID");
}
@Override @Override
public void packOut(PackOut packout, TransformerHandler packoutHandler, public void packOut(PackOut packout, TransformerHandler packoutHandler,
TransformerHandler docHandler, TransformerHandler docHandler,
int recordId) throws Exception { int recordId, String uuid) throws Exception {
create(packout.getCtx(), packoutHandler); X_AD_User_Roles po = new Query(packout.getCtx().ctx, X_AD_User_Roles.Table_Name, "AD_User_Roles_UU=?", getTrxName(packout.getCtx()))
.setParameters(uuid)
.first();
if (po != null) {
Env.setContext(packout.getCtx().ctx, X_AD_User.COLUMNNAME_AD_User_ID, po.getAD_User_ID());
Env.setContext(packout.getCtx().ctx, X_AD_Role.COLUMNNAME_AD_Role_ID, po.getAD_Role_ID());
this.create(packout.getCtx(), packoutHandler);
packout.getCtx().ctx.remove(X_AD_User.COLUMNNAME_AD_User_ID);
packout.getCtx().ctx.remove(X_AD_Role.COLUMNNAME_AD_Role_ID);
} else {
throw new AdempiereException("AD_User_Roles_UU not found = " + uuid);
}
} }
} }

View File

@ -20,13 +20,15 @@ import java.util.List;
import javax.xml.transform.sax.TransformerHandler; import javax.xml.transform.sax.TransformerHandler;
import org.adempiere.exceptions.AdempiereException;
import org.adempiere.pipo2.AbstractElementHandler; import org.adempiere.pipo2.AbstractElementHandler;
import org.adempiere.pipo2.Element;
import org.adempiere.pipo2.PIPOContext; import org.adempiere.pipo2.PIPOContext;
import org.adempiere.pipo2.PackOut; import org.adempiere.pipo2.PackOut;
import org.adempiere.pipo2.PoExporter; import org.adempiere.pipo2.PoExporter;
import org.adempiere.pipo2.Element;
import org.adempiere.pipo2.PoFiller; import org.adempiere.pipo2.PoFiller;
import org.compiere.model.I_AD_Window_Access; import org.compiere.model.I_AD_Window_Access;
import org.compiere.model.MWindowAccess;
import org.compiere.model.Query; import org.compiere.model.Query;
import org.compiere.model.X_AD_Role; import org.compiere.model.X_AD_Role;
import org.compiere.model.X_AD_Window; import org.compiere.model.X_AD_Window;
@ -83,10 +85,28 @@ public class WindowAccessElementHandler extends AbstractElementHandler {
filler.export(excludes); filler.export(excludes);
} }
@Override
public void packOut(PackOut packout, TransformerHandler packoutHandler, TransformerHandler docHandler, int recordId)
throws Exception {
throw new AdempiereException("AD_Window_Access doesn't have ID, use method with UUID");
}
@Override @Override
public void packOut(PackOut packout, TransformerHandler packoutHandler, public void packOut(PackOut packout, TransformerHandler packoutHandler,
TransformerHandler docHandler, TransformerHandler docHandler,
int recordId) throws Exception { int recordId, String uuid) throws Exception {
create(packout.getCtx(), packoutHandler); MWindowAccess po = new Query(packout.getCtx().ctx, MWindowAccess.Table_Name, "AD_Window_Access_UU=?", getTrxName(packout.getCtx()))
.setParameters(uuid)
.first();
if (po != null) {
Env.setContext(packout.getCtx().ctx, X_AD_Window.COLUMNNAME_AD_Window_ID, po.getAD_Window_ID());
Env.setContext(packout.getCtx().ctx, X_AD_Role.COLUMNNAME_AD_Role_ID, po.getAD_Role_ID());
this.create(packout.getCtx(), packoutHandler);
packout.getCtx().ctx.remove(X_AD_Window.COLUMNNAME_AD_Window_ID);
packout.getCtx().ctx.remove(X_AD_Role.COLUMNNAME_AD_Role_ID);
} else {
throw new AdempiereException("AD_Window_Access_UU not found = " + uuid);
}
} }
} }

View File

@ -20,11 +20,12 @@ import java.util.List;
import javax.xml.transform.sax.TransformerHandler; import javax.xml.transform.sax.TransformerHandler;
import org.adempiere.exceptions.AdempiereException;
import org.adempiere.pipo2.AbstractElementHandler; import org.adempiere.pipo2.AbstractElementHandler;
import org.adempiere.pipo2.Element;
import org.adempiere.pipo2.PIPOContext; import org.adempiere.pipo2.PIPOContext;
import org.adempiere.pipo2.PackOut; import org.adempiere.pipo2.PackOut;
import org.adempiere.pipo2.PoExporter; import org.adempiere.pipo2.PoExporter;
import org.adempiere.pipo2.Element;
import org.adempiere.pipo2.PoFiller; import org.adempiere.pipo2.PoFiller;
import org.compiere.model.I_AD_Workflow_Access; import org.compiere.model.I_AD_Workflow_Access;
import org.compiere.model.Query; import org.compiere.model.Query;
@ -86,10 +87,28 @@ public class WorkflowAccessElementHandler extends AbstractElementHandler {
filler.export(excludes); filler.export(excludes);
} }
@Override
public void packOut(PackOut packout, TransformerHandler packoutHandler, TransformerHandler docHandler, int recordId)
throws Exception {
throw new AdempiereException("AD_Workflow_Access doesn't have ID, use method with UUID");
}
@Override @Override
public void packOut(PackOut packout, TransformerHandler packoutHandler, public void packOut(PackOut packout, TransformerHandler packoutHandler,
TransformerHandler docHandler, TransformerHandler docHandler,
int recordId) throws Exception { int recordId, String uuid) throws Exception {
create(packout.getCtx(), packoutHandler); MWorkflowAccess po = new Query(packout.getCtx().ctx, MWorkflowAccess.Table_Name, "AD_Workflow_Access_UU=?", getTrxName(packout.getCtx()))
.setParameters(uuid)
.first();
if (po != null) {
Env.setContext(packout.getCtx().ctx, X_AD_Workflow.COLUMNNAME_AD_Workflow_ID, po.getAD_Workflow_ID());
Env.setContext(packout.getCtx().ctx, X_AD_Role.COLUMNNAME_AD_Role_ID, po.getAD_Role_ID());
this.create(packout.getCtx(), packoutHandler);
packout.getCtx().ctx.remove(X_AD_Workflow.COLUMNNAME_AD_Workflow_ID);
packout.getCtx().ctx.remove(X_AD_Role.COLUMNNAME_AD_Role_ID);
} else {
throw new AdempiereException("AD_Workflow_Access_UU not found = " + uuid);
}
} }
} }

View File

@ -52,4 +52,18 @@ public interface ElementHandler {
* @throws Exception * @throws Exception
*/ */
public void packOut(PackOut packout, TransformerHandler packoutHandler, TransformerHandler docHandler,int recordId) throws Exception; public void packOut(PackOut packout, TransformerHandler packoutHandler, TransformerHandler docHandler,int recordId) throws Exception;
/**
* @param packout
* @param packoutHandler
* @param docHandler
* @param recordId
* @param uuid
* @throws Exception
*/
default public void packOut(PackOut packout, TransformerHandler packoutHandler, TransformerHandler docHandler,int recordId, String uuid) throws Exception {
// element handlers for tables without ID must implement this method
packOut(packout, packoutHandler, docHandler, recordId); // defaults to calling the method without uuid
}
} }

View File

@ -20,6 +20,7 @@ import java.util.Date;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.UUID;
import org.adempiere.base.IGridTabExporter; import org.adempiere.base.IGridTabExporter;
import org.adempiere.exceptions.AdempiereException; import org.adempiere.exceptions.AdempiereException;
@ -87,13 +88,27 @@ public class GridTab2PackExporter implements IGridTabExporter {
packoutItems.add(packoutItem); packoutItems.add(packoutItem);
} else { } else {
if (currentRowOnly) { if (currentRowOnly) {
PackoutItem packoutItem = new PackoutItem(tableName, gridTab.getRecord_ID(), int recordID = gridTab.getRecord_ID();
properties); String uuid = null;
if (recordID == -1) {
UUID uuidObj = gridTab.getTableModel().getUUID(gridTab.getCurrentRow());
if (uuidObj != null) {
uuid = uuidObj.toString();
}
}
PackoutItem packoutItem = new PackoutItem(tableName, recordID, uuid, properties);
packoutItems.add(packoutItem); packoutItems.add(packoutItem);
} else { } else {
for(int i = 0; i < gridTab.getRowCount(); i++) { for(int i = 0; i < gridTab.getRowCount(); i++) {
PackoutItem packoutItem = new PackoutItem(tableName, gridTab.getKeyID(i), int recordID = gridTab.getKeyID(i);
properties); String uuid = null;
if (recordID == -1) {
UUID uuidObj = gridTab.getTableModel().getUUID(i);
if (uuidObj != null) {
uuid = uuidObj.toString();
}
}
PackoutItem packoutItem = new PackoutItem(tableName, recordID, uuid, properties);
packoutItems.add(packoutItem); packoutItems.add(packoutItem);
} }
} }

View File

@ -141,7 +141,7 @@ public class PackOut
ElementHandler handler = handlerRegistry.getHandler(type); ElementHandler handler = handlerRegistry.getHandler(type);
if (handler != null) if (handler != null)
handler.packOut(this,packoutHandler,docHandler,packoutItem.getRecordId()); handler.packOut(this,packoutHandler,docHandler,packoutItem.getRecordId(),packoutItem.getUUID());
else else
throw new IllegalArgumentException("Packout handler not found for type " + type); throw new IllegalArgumentException("Packout handler not found for type " + type);

View File

@ -24,6 +24,7 @@ public class PackoutItem {
private String type; private String type;
private int recordId; private int recordId;
private String uuid;
private Map<String, Object> properties; private Map<String, Object> properties;
/** /**
@ -31,9 +32,18 @@ public class PackoutItem {
* @param recordId * @param recordId
*/ */
public PackoutItem(String type, int recordId, Map<String, Object> properties) { public PackoutItem(String type, int recordId, Map<String, Object> properties) {
this(type, recordId, null, properties);
}
/**
* @param type
* @param recordId
*/
public PackoutItem(String type, int recordId, String uuid, Map<String, Object> properties) {
super(); super();
this.type = type; this.type = type;
this.recordId = recordId; this.recordId = recordId;
this.uuid = uuid;
this.properties = properties; this.properties = properties;
} }
@ -51,6 +61,13 @@ public class PackoutItem {
return recordId; return recordId;
} }
/**
* @return the uuid
*/
public String getUUID() {
return uuid;
}
/** /**
* *
* @param key * @param key