Hi
CS23.4
I have inherited a module that overrides some functions when you drag and drop a document into classic view, so it can perform some additional checks before deciding if it needs to write into an additional table for later.
Part of the module is this code:
override function Void __Init()
Object lliApi = $LLIAPI
List initObjs = lliApi.f__InitObjs
Object obj
Dynamic result
//Checking OS Name
for obj in initObjs
if ( obj.OSName == "Document" )
this.fDocument = obj
break
end
end
//
//Over ridding Post call back scripts for document copy, create and move
//
if ( IsDefined(.fDocument) )
List overrideFeatures = {'NodeCreateSubclassPost','NodeCopySubclassPost','NodeMoveSubclassPost','NodeDeleteSubclassPost','NodeDeleteSubclassPre'}
String featureName = ""
for featureName in overrideFeatures
if OS.IsFeature(.fDocument,featureName)
String previousFeatureName = featureName + "_OLD"
if OS.ISFeature(.fDocument,previousFeatureName)
continue
else
//Adding Feature with _OLD having old definition of the Feature.
OS.AddFeature(.fDocument,previousFeatureName)
.fDocument.(previousFeatureName) = .fDocument.(featureName)
end
end
//override
.fDocument.(featureName) = .(featureName)
end
end
end
And from that I can see there is a NodeCreateSubclassPost_OLD for example in LLIAPI::LLNode::Document, and the NodeCreateSubclassPost is now the new code version.
Now the complaint is that it doesn't work for Emails.
I noticed that it does use the overridden functions if you move or copy or delete an Email, but not if you are creating a new one. So an email is a document unless it is created so to speak.
I then found OTEmail module, which has OTEMAIL::LLNode_Document_::EMail.
so I thought, I'll just do what the init function does now, and add email specific bit that I need. So I've added:
object otemail = $OTEMAIL
List initObjs2 = otemail.f__InitObjs
//Checking OS Name
for obj in initObjs2
if ( obj.OSName == "EMail" && obj.OSParent.OSName == "LLNode (Document)" )
this.fEmail = obj
break
end
end
//
if ( IsDefined(.fEmail) )
List overrideFeatures = {'NodeCreateSubclassPost'}
String featureName = ""
String newFeatureName = ""
for featureName in overrideFeatures
if OS.IsFeature(.fEmail,featureName)
String previousFeatureName = featureName + "_OLD"
newFeatureName = featureName + "_NEW"
if OS.ISFeature(.fEmail,previousFeatureName)
//continue
else
//Adding Feature with _OLD having old definition of the Feature.
OS.AddFeature(.fEmail,previousFeatureName)
.fEmail.(previousFeatureName) = .fEmail.(featureName)
end
//override
.fEmail.(featureName) = this.(newFeatureName)
end
end
end
and I created a new NodeCreateClassSubclassPost_NEW function in the module.
Now though, when I start CS or run my new init function in Eclipse, I get a NodeCreateSubclassPost_OLD ok:
but the original NodeCreateSubclassPost hasn't change to my new function, and I can't work out why.
Any pointers please?
thanks Guy.