#breaks from psdi.common.action import ActionCustomClass from java.rmi import RemoteException from psdi.mbo import * from psdi.mbo import MboConstants from psdi.util import MXException from psdi.app.doclink import Docinfo from psdi.app.doclink import DocinfoSet from psdi.app.doclink import DocinfoSetRemote from psdi.app.doclink import DoclinksSetRemote from java.lang import SecurityException from psdi.server import MXServer import sys # COMMENT: function to check if the doclink owner is a commlog or the main mbo. def isCommLogOwner(doclink): ownertable = doclink.getString("OWNERTABLE") print('**** OWNERTABLE... '+ownertable) if (ownertable) == "COMMLOG": return True return False # COMMENT: function to delete the commlog doc physical file from the server. def deletecommlogfilefromserver(docinfo): docinfoid = docinfo.getString("DOCINFOID") commlogdocsSet = MXServer.getMXServer().getMboSet("COMMLOGDOCS", docinfo.getUserInfo()) commlogdocsSet.setWhere("DOCINFOID = '"+docinfoid+"'") commlogdocsSet.reset() print('**** DOCINFOID... '+docinfoid) k = 0 commlogdoc = commlogdocsSet.getMbo(k) while (commlogdoc is not None): k = k+1 commlogdoc.delete(2) commlogdoc = commlogdocsSet.getMbo(k); #commlogdocsSet.deleteAll(2) commlogdocsSet.save(2) # COMMENT: from the Action MBO get the associated DoclinksSet based on the 'DOCLINKS' relationship. print '\n*** PYFRO FRESA: ' + scriptName + ' *** On LaunchPoint: ' + launchPoint + '***\n' print '*** PY MBO name: '+mbo.name + ' owner ' + mbo.getOwner().name + ' *** \n' print 'Starting doclink delete .....' doclinksSet = mbo.getThisMboSet() if doclinksSet is not None: i = 0 doclink = doclinksSet.getMbo(i) while (doclink != None): docinfoSet = doclink.getMboSet("DOCINFO") if (docinfoSet is not None): j=0 docinfo = docinfoSet.getMbo(j) while (docinfo != None): if(docinfo.getString("doctype") =='EMAIL'): if (isCommLogOwner(doclink)): deletecommlogfilefromserver(docinfo) else: print('**** deletefilefromserver... ') docinfo.delete(2) doclink.delete(2) j=j+1 docinfo = docinfoSet.getMbo(j); i=i+1 doclink = doclinksSet.getMbo(i);
Run
Reset
Share
Import
Link
Embed
Language▼
English
中文
Python Fiddle
Python Cloud IDE
Follow @python_fiddle
Browser Version Not Supported
Due to Python Fiddle's reliance on advanced JavaScript techniques, older browsers might have problems running it correctly. Please download the latest version of your favourite browser.
Chrome 10+
Firefox 4+
Safari 5+
IE 10+
Let me try anyway!
url:
Go
Python Snippet
Stackoverflow Question