0

我创建了一个导出 AOT(应用程序对象树)对象的方法。它可以工作,但是当我导出 Forms-Treenodes 时找不到它。

该方法是一种服务器方法,它在 BatchServer 上运行。

我的想法是每 2 小时将对象导出为 xpo 文件。通过备份,我可以跟踪代码更改。

void run(str Path)
{
    List                _ValueList = new List(Types::String);
    Counter             _ListCounter;
    ListIterator        _ListIterator;
    str                 _RootFolder;
    str                 _FileName;
    str                 _FolderName;
    TreeNode            _TreeNode;
    TreeNode            _InnerTreeNode;
    TreeNodeIterator    _TreeNodeIt;
    FileIoPermission    _Perm;
    #define.ExportMode("w")
    ;

    _RootFolder = Path;
    //Objektbaum definition
    _ValueList.addEnd("Forms");
    _ValueList.addEnd("Reports");
    _ValueList.addEnd("Queries");
    _ValueList.addEnd("Classes");
    _ValueList.addEnd("Macros");
    _ValueList.addEnd("Jobs");
    _ValueList.addEnd(@"Data Dictionary\Tables");
    _ValueList.addEnd(@"Data Dictionary\Maps");
    _ValueList.addEnd(@"Data Dictionary\Views");
    _ValueList.addEnd(@"Data Dictionary\Extended Data Types");
    _ValueList.addEnd(@"Data Dictionary\Base Enums");

    _ListIterator = new ListIterator(_ValueList);
    info(strfmt("RootExportPath: %1",_RootFolder));

    // durch die zuvor definierte Liste laufen
    while(_ListIterator.more())
    {
        try
        {
            info(strfmt(@"\%1",_ListIterator.value()));
            //Haupttreenode objekt laden
            _TreeNode = TreeNode::findNode(strfmt(@"\%1",_ListIterator.value()));

            if (_TreeNode != null)
            {
                //Splitten des HauptNodes
                _TreeNodeIt = _TreeNode.AOTiterator();
                _InnerTreeNode = _TreeNodeIt.next();
                //Durchlaufen der SubNodes
                info(strfmt("Object found in Node: %1 ",_TreeNode.AOTchildNodeCount()));
                while(_InnerTreeNode)
                {
                    //Pfad und Filename bereitstellen
                    _FolderName = strfmt(@"%1\%2",_RootFolder,strreplace(_ListIterator.value(),@" ","_"));
                    _FileName = strfmt(@"\%1.xpo",strreplace(_InnerTreeNode.AOTname(),@" ","_"));
                    //Fileperms setzen ("w") = Write (OverWrite)
                    _Perm = new FileIoPermission(_FolderName+_FileName , #ExportMode);
                    if (_Perm == null)
                    {
                        return;
                    }

                    _Perm.assert();

                    try
                    {
                        if(!WinApi::pathExists(_FolderName))
                        {
                            if(WinApi::createDirectory(_FolderName))
                            {
                                throw error(strfmt("Pfad konnte nicht erstellt werden %1\n",_FolderName));
                            }
                            if(!WinApi::pathExists(_FolderName))
                            {
                                throw error(strfmt("Fehler beim erstellen des Pfades %1\n",_FolderName));
                            }
                        }
                        //Export in definierten Filename
                        if(WinApi::fileLocked(_FolderName+_FileName))
                        {
                                throw error("File ist ReadOnly\n");
                        }
                        _InnerTreeNode.treeNodeExport(_Foldername+_FileName);
                     }
                     catch
                     {
                        error(strfmt(@"xpo File %1 konnte nicht geschrieben werden\n",_FolderName+_Filename));
                        throw error("Abbruch des Jobs\n");
                     }
                    CodeAccessPermission::revertAssert();

                   _InnerTreeNode = _TreeNodeIt.next();
                }
                // BP deviation documented.
                _TreeNode.treeNodeExport(_FileName);
            }
            else
            {
                error(strfmt("TreeNode empty %1",_ListIterator.value()));
            }
         }
         catch
         {
            throw error("Fehler in der Verarbeitungsroutine\n");
         }
        _ListIterator.next();
    }
}
4

2 回答 2

0

Forms 文件夹是否存在于您的导出位置?

您正在尝试在检查文件夹是否存在并创建它之前声明对文件夹的权限。

于 2013-06-06T08:05:14.873 回答
0

批处理服务器无法导出表单,因为表单的 ar 不是 loadet。这有点奇怪,但批处理服务器只调用 AOT 中的类层......表单是它的分层顶部,等等不可导出。

于 2014-01-20T13:29:26.120 回答