Below code copies the row from AssignEOVO with primary id as AssignId and EmpId and creates a new record as duplicate:
try
{
AssignEOVOImpl VO1 = (AssignEOVOImpl)getAssignEOVO1();
VO1.initQuery(AssignId,EmpId); //Query the record which needs to be duplicated.
Row[] currentRow = VO1.getFilteredRows("AssignId", AssignId); //Get Queried records in a Array of Row
//System.out.println("currentRow.length" + currentRow.length);
AssignEOVORowImpl copyRow = (AssignEOVORowImpl)currentRow[0];
//System.out.println("copyRow.getEmpId" + copyRow.getEmpId());
//System.out.println("copyRow.getEmpNumber()" + copyRow.getEmpNumber());
AssignEOVOImpl VO= getAssignEOVO1();
if(!VO.isPreparedForExecution())
{
VO.executeQuery();
}
AssignEOVORowImpl row = (AssignEOVORowImpl)VO.createRow();
VO.insertRow(row);
row.setEmpId(copyRow.getEmpId());
row.setEmpNumber(copyRow.getEmpNumber());
}catch(Exception jbo)
{
throw new OAException("Exception.." + jbo,OAException.ERROR);
}
try
{
AssignEOVOImpl VO1 = (AssignEOVOImpl)getAssignEOVO1();
VO1.initQuery(AssignId,EmpId); //Query the record which needs to be duplicated.
Row[] currentRow = VO1.getFilteredRows("AssignId", AssignId); //Get Queried records in a Array of Row
//System.out.println("currentRow.length" + currentRow.length);
AssignEOVORowImpl copyRow = (AssignEOVORowImpl)currentRow[0];
//System.out.println("copyRow.getEmpId" + copyRow.getEmpId());
//System.out.println("copyRow.getEmpNumber()" + copyRow.getEmpNumber());
AssignEOVOImpl VO= getAssignEOVO1();
if(!VO.isPreparedForExecution())
{
VO.executeQuery();
}
AssignEOVORowImpl row = (AssignEOVORowImpl)VO.createRow();
VO.insertRow(row);
row.setEmpId(copyRow.getEmpId());
row.setEmpNumber(copyRow.getEmpNumber());
}catch(Exception jbo)
{
throw new OAException("Exception.." + jbo,OAException.ERROR);
}
No comments:
Post a Comment