2
votes

I'm currently working on a system that will export all the nodes from my AX 2009 AOT to individual XPO files, for the purpose of tracking changes in a central version control repository. I'm having a fair amount of luck, but for some reason I cannot get the Forms or Data Sets node to export at all.

This is my current code set:

private void export(str parentNode)
{
    TreeNode            node, parent;
    str                 folderName;
    Set                 permissions = new Set(Types::Class);
    ;

    folderName = exportBaseDir + parentNode;

    permissions.add(new FileIoPermission(folderName, "r"));
    permissions.add(new InteropPermission(InteropKind::ClrInterop));

    CodeAccessPermission::assertMultiple(permissions);

    //Create Filesystem Folder if needed
    if (!WinApiServer::pathExists(folderName))
        System.IO.Directory::CreateDirectory(folderName);


    CodeAccessPermission::revertAssert();

    parent = TreeNode::findNode(parentNode);

    if (parent)
        node = parent.AOTfirstChild();
    else
        warning(strfmt("Could not parse node: %1", parentNode));

    while (node)
    {
        this.exportNode(node);
        node = node.AOTnextSibling();
    }
}

When I call export(@"\Forms"); or export(@"\Data Sets"); I get a "Could not parse node" message, meaning the TreeNode::findNode() didn't resolve correctly. Running it on any other node (such as Classes) does not have this issue. This also only happens when it is run in a Batch -- running it with the client (with the CodeAccessPermission parts removed) will export all nodes as expected.

Is there something that would prohibit Forms and Data Sets from being accessed from within a Batch? If so, what can I do to access those nodes?

1
Any reason why you arent using vss or built in source control? - AnthonyBlake
We are using the built-in MorphX VC, this is meant to be used in addition to it. Their VC system leaves a lot to be desired (like the ability to see what was or wasn't updated on any given day, off-site backups of the code, etc), and we feel this solution helps cover those gaps. - kingofzeal
sounds great - any reason you arent using vss? - AnthonyBlake
At the time, MorphX was the easiest system to implement and adopt on our team, and the benefits were considered acceptable for our purposes at the time. Switching VC systems now would cause a significant headache, so we opted to augment the current solution instead of redoing everything. One day we may implement a different system, but for the time being we aren't ready to take on that cost. - kingofzeal

1 Answers

1
votes

As far as I can tell it's a server/client issue/bug. The easy solution would be to create this method on your class:

client static TreeNode clientTreeNode(str _path)
{
    return TreeNode::findNode(_path);
}

Then in your code, below the parent = TreeNode::findNode(parentNode); line, put:

parent = parent ? parent : YourClassHere::clientTreeNode(parentNode);

And that should solve your issue. You'll have a bit of digging to do in order to find out why it doesn't work on the server tier if you just must know.