PDA

View Full Version : WMNotOwnerOfPacketException


ng-first
05-16-2007, 12:32 AM
Hi all,
I need to write an action in Model Manager, in order to export the PDF files attached to a drawing 2D.
I have written the following code:
WMElement cDrw = WMSession.getWMSession().openElement(infoDisegno, false);
if(cDrw instanceof DMDrawing2D)
{
File copyDirectory = WMFile.createTempDir();
DMDrawing2D dDrw2D = (DMDrawing2D) cDrw;
List attachedFiles = dDrw2D.getAttachmentFiles();
for (int ii = 0; ii < attachedFiles.size(); ii++)
{
if (attachedFiles.get(ii) instanceof WMFile)
{
WMFile attachedWMFile = (WMFile) attachedFiles.get(ii);
File attachedWMFile_copy = attachedWMFile.export(copyDirectory);
}
if (attachedFiles.get(ii) instanceof FileWrapper)
{
FileWrapper pdfWrapper = (FileWrapper) attachedFiles.get(ii);
File pdfFile_copy = pdfWrapper.export(new File(copyDirectory.toString() + File.separator + pdfWrapper.getFileName()));
}
}
}
But the first line of code (the open instruction) give me an "WMNotOwnerOfPacketException" exception.
This appens because the export command ran on the drawing, is being called by a user, logged in Model Manager, that has not reserved this drawing !!!!
Is there a way to export a drawing on the file system, without throwing this exception? :cool:
Thank you a lot :) ,
Nadia