AX跟VSS整合的版本管理可以通过创建知识库将当前层的代码全部签入到VSS中,但是如果不是一个团队开发solution,而是针对客户的需求随时做得一些小改动,一般都希望以Project的形式组织代码和发布代码。AX与VSS的整合没有提供一种方法可以将一个Project的所有对象导出成一个个的XPO文件,既然没有就只能自己动手丰衣足食了。
如下代码是将Project中的对象导出成单独的XPO文件的:
Code
public void run()
{
#AOTExport
#AOT
#TreeNodeSysNodeType
TreeNode projectListNode = SysTreeNode::getPrivateProject();
ProjectGroupNode pNode;
TreeNodeIterator projectIt;
ProjectNode projectNode = projectListNode.AOTfindChild(projectName);
TreeNode exportTreeNode;
TreeNode treeNode;
//The Level To Be Exported
UtilEntryLevel expLevel(TreeNode _treeNode)
{
int layers = _treeNode.applObjectLayerMask();
UtilEntryLevel exportLevel;
int i,j=0;
;
for(i=0;i<enumcnt(UtilEntryLevel);i++)
{
if (layers & (1 << i))
exportLevel = i;
}
return exportLevel;
}
//Modify Classes and Tables
void exportElement(TreeNode _treeNode)
{
;
_treeNode = _treeNode.getNodeInLayer(expLevel(_treeNode));
if(_treeNode)
_treeNode.treeNodeExport(filePath+'\\'+_treeNode.AOTname()+'.xpo');
}
//Get the classes and tables to be modify
void exportElements(TreeNode _treeNode)
{
TreeNodeIterator projectGroupIt;
TreeNode projectSuperNode,projectGroupNode;
if(!_treeNode)
return;
//Project Group
if(_treeNode.sysNodeType() == #NT_PROJECT_GROUP)
{
projectGroupIt = _treeNode.AOTiterator();
projectGroupNode = projectGroupIt.next();
while(projectGroupNode != null)
{
exportElements(projectGroupNode);
projectGroupNode = projectGroupIt.next();
}
}
//Do not export Project Group Nodes
if ( (!(classidget(_treeNode) == classnum(ProjectNode))) &&
(!(strscan(_treeNode.treeNodePath(), #ProjectPath, 1, strlen(#ProjectPath))))
)
{
info(_treeNode.AOTname());
exportElement(_treeNode);
}
}
;
projectNode = projectNode.getRunNode();
projectIt = projectNode.AOTiterator();
pNode = projectIt.next();
while(pNode)
{
//info(pNode.AOTname());
exportElements(pNode);
pNode = projectIt.next();
}
}
把XPO文件也备份在这里。