cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

reloading instance.acl

ptc-1795223
1-Newbie

reloading instance.acl

Hi all,

I'm new to Epic development and need a bit of help with an existing system.

In the instance.acl file a number of java classes are loaded that perform actions when different elements are inserted into an xml document. I implemented a bug fix through a save callback that transforms the current document, closes it and re-opens the result of the transformation in its place. I tried various ways of doing this and came up with the version at the bottom of this post.

My problem is that once I have done this, none of the java actions are called when new elements are inserted into the new document. I'm guessing I need to reload instance.acl when I load the new document, but I don't know how to do that. Someone who posted here suggested edit that -current; would do this.

Can anyone show me a way to reload instance.acl, or let me know that this is already happening and I need to do something else (code snippets below)?

Thanks in advance

Chris

[[[[[[[how the java is loaded in the instance.acl]]]]]]]]

$obj = java_constructor('JavaClassName');
java_instance($obj, 'javaMethodName');



[[[[[acl code executed on save of original document]]]]]]]

function CB_SaveDoc(Document, Operation){

if (Operation==1) {

return 0 ; # Continue with the save.

} else if (Operation==2) {
if (doc_type()=='precedent3'){

save ;
#java_console(0) ;
#java_console(1) ;
$obj = java_static("NameSpaceFixer", "applyStyleSheet" \
, doc_path(), "$nsStyle", "C:\\temp.xml") ;

java_delete($obj);

local docPath = doc_path();

file_close();

remove_file -f "$docPath";
copy_file "C:\\temp.xml" $docPath

edit -xml $docPath;

#edit -current -- had no effect

return -1;

}
return 0 ; # Let Epic do the save.
}


doc_add_callback(0, 'save', 'CB_SaveDoc') ;

3 REPLIES 3

Chris,

You may want to try using either a 'doctype.acl' (or .js) file rather than the instance.acl (or .js) file.  Take a look at help 5716 and compare the differences between the two types of files that are discussed there.

If you haven't done it before, just type the 'help' and the number on the command line to have the help file open the appropriate help screen.

Wow, I actually remember how to hit the reply button to adepters. 😄  Been awhile. 

Lynn
---- Chris Parr <christopher.parr@thomson.com> wrote:
>  Hi all,
>  I'm new to Epic development and need a bit of help with an existing system.
>  In the instance.acl file a number of java classes are loaded that perform actions when different elements are inserted into an xml document. I implemented a bug fix through a save callback that transforms the current document, closes it and re-opens the result of the transformation in its place. I tried various ways of doing this and came up with the version at the bottom of this post.
>  My problem is that once I have done this, none of the java actions are called when new elements are inserted into the new document. I'm guessing I need to reload instance.acl when I load the new document, but I don't know how to do that. Someone who posted here suggested edit that -current; would do this.
> Can anyone show me a way to reload instance.acl, or let me know that this is already happening and I need to do something else (code snippets below)?
> Thanks in advance
> Chris
> [[[[[[[how the java is loaded in the instance.acl]]]]]]]]
> $obj = java_constructor('JavaClassName');
>     java_instance($obj, 'javaMethodName');

> [[[[[acl code executed on save of original document]]]]]]]
> function CB_SaveDoc(Document, Operation){
>
>   if (Operation==1) {
>  
>     return 0 ; # Continue with the save.
>    
>   } else if (Operation==2) {
>     if (doc_type()=='precedent3'){
>      
>       save ;
>       #java_console(0) ;
>       #java_console(1) ;
>       $obj = java_static("NameSpaceFixer", "applyStyleSheet" \
>                 , doc_path(), "$nsStyle", "C:\\temp.xml") ;
>           
>       java_delete($obj);
>      
>       local docPath = doc_path();
>      
>       file_close();
>      
>       remove_file -f "$docPath";
>       copy_file "C:\\temp.xml" $docPath
>      
>       edit -xml $docPath;
>       #edit -current -- had no effect
>
>       return -1;
>    
>     }
>     return 0 ; # Let Epic do the save.
>   }

> doc_add_callback(0, 'save', 'CB_SaveDoc') ;
>
>      
> ----------     

Hi Chris,
The simplest way to validate if/when instance.acl is running is to put in an
old-school debug "print" statement. Specifically:
response('Hi, I'm in instance.acl');

I was having a similar problem. Take a look at http://portal.ptcuser.org/p/fo/st/thread=33908

These may be unrelated, but this could be a solution.

Announcements