Oct 23, 2018

Get a private project in X++

원본소소코드 : 김철호
수정자 : 박병욱
아래 소스코드는 원본을 수정한 소스코드임.

static void Get_PrivateProject(Args _args)
{
    #define.Shared("Private")
    ProjectName                 _ProjectName = "TEST_Projects";
    ProjectListNode             _list   = infolog.projectRootNode().AOTfindChild(#Shared);
    ProjectNode                 _pnProj;
    ProjectNode                 _pn = _list.AOTfindChild(_ProjectName);
    str                         _GroupName  = '';
    str                         _ObjectName = '';
    str                         _ObjectPath = '';
    str                         _Objecttype = '';
    UtilElementType             _UtilElementType;
 
    void return_objecttype()
    {
        if (_ObjectPath like '*Tables*')
        {
            _Objecttype = 'Tables';
            _UtilElementType = UtilElementType::Table;
        }
        else if (_ObjectPath like '*Maps*')
        {
            _Objecttype = 'Maps';
            _UtilElementType = UtilElementType::TableMap;
        }
        else if (_ObjectPath like '*Views*')
        {
            _Objecttype = 'Views';
            _UtilElementType = UtilElementType::Table;
        }
        else if (_ObjectPath like '*Extended*')
        {
            _Objecttype = 'EDT';
            _UtilElementType = UtilElementType::ExtendedType;
        }
        else if (_ObjectPath like '*Base*')
        {
            _Objecttype = 'Base Enums';
            _UtilElementType = UtilElementType::Enum;
        }
        else if (_ObjectPath like '*License*')
        {
            _Objecttype = 'License';
            _UtilElementType = UtilElementType::LicenseCode;
        }
        else if (_ObjectPath like '*Configuration*')
        {
            _Objecttype = 'Configuration Keys';
            _UtilElementType = UtilElementType::ConfigurationKey;
        }
        else if (_ObjectPath like '*Security*')
        {
            _Objecttype = 'Security Keys';
            _UtilElementType = UtilElementType::SecurityKey;
        }
        else if (_ObjectPath like '*Collections*')
        {
            _Objecttype = 'Table Collections';
            _UtilElementType = UtilElementType::TableCollection;
        }
        else if (_ObjectPath like '*Perspectives*')
        {
            _Objecttype = 'Perspectives';
            _UtilElementType = UtilElementType::Perspective;
        }
        else if (_ObjectPath like '*Macros*')
        {
            _Objecttype = 'Macros';
            _UtilElementType = UtilElementType::Macro;
        }
        else if (_ObjectPath like '*Classes*')
        {
            _Objecttype = 'Classes';
            _UtilElementType = UtilElementType::Class;
        }
        else if (_ObjectPath like '*Forms*')
        {
            _Objecttype = 'Forms';
            _UtilElementType = UtilElementType::Form;
        }
        else if (_ObjectPath like '*Parts*')
        {
            _Objecttype = 'Parts';
            _UtilElementType = UtilElementType::FormPart;
        }
        else if (_ObjectPath like '*Sets*')
        {
            _Objecttype = 'Data Sets';
            _UtilElementType = UtilElementType::DataSet;
        }
        else if (_ObjectPath like '*SSRS*')
        {
            _Objecttype = 'SSRS Reports';
            _UtilElementType = UtilElementType::SSRSReport;
        }
        else if (_ObjectPath like '*Visual*')
        {
            _Objecttype = 'Visual Studio Projects';
            _UtilElementType = UtilElementType::VSProject_Analysis;
        }
        else if (_ObjectPath like '*Querie*')
        {
            _Objecttype = 'Queries';
            _UtilElementType = UtilElementType::Query;
        }
        else if (_ObjectPath like '*Job*')
        {
            _Objecttype = 'Jobs';
            _UtilElementType = UtilElementType::Job;
        }
        else if (_ObjectPath like '*Display*')
        {
            _Objecttype = 'Display';
            _UtilElementType = UtilElementType::DisplayTool;
        }
        else if (_ObjectPath like '*Output*')
        {
            _Objecttype = 'Output';
            _UtilElementType = UtilElementType::OutputTool;
        }
        else if (_ObjectPath like '*Action*')
        {
            _Objecttype = 'Action';
            _UtilElementType = UtilElementType::ActionTool;
        }
        else if (_ObjectPath like '*Web*')
        {
            _Objecttype = 'Web';
            _UtilElementType = UtilElementType::WebControl;
        }
        else if (_ObjectPath like '*Services*')
        {
            _Objecttype = 'Services';
            _UtilElementType = UtilElementType::Service;
        }
        else if (_ObjectPath like '*Service Groups*')
        {
            _Objecttype = 'Service Groups';
            _UtilElementType = UtilElementType::ServiceGroup;
        }
        else if (_ObjectPath like '*Workflow*')
        {
            _Objecttype = 'Workflow';
            _UtilElementType = UtilElementType::WorkflowType;
        }
        else if (_ObjectPath like '*Security*')
        {
            _Objecttype = 'Security';
            _UtilElementType = UtilElementType::SecRole;
        }
        else if (_ObjectPath like '*Resources*')
        {
            _Objecttype = 'Resources';
            _UtilElementType = UtilElementType::Resource;
        }
        else if (_ObjectPath like '*Label*')
        {
            _Objecttype = 'Label Files';
            _UtilElementType = UtilElementType::LabelFile;
        }
        else if (_ObjectPath like '*References*')
        {
            _Objecttype = 'References';
            _UtilElementType = UtilElementType::Reference;
        }
        else if (_ObjectPath like '*Menus*')
        {
            _Objecttype = 'Menus';
            _UtilElementType = UtilElementType::Menu;
        }
        else
        {
            _Objecttype = '';
        }
    }
 
    void insert_list()
    {
        info(strFmt("%1\t%2\t%3",_ProjectName, _UtilElementType, _ObjectName));
        _Objecttype = "";
        _ObjectName = "";
    }
 
    void searchAllObj(projectNode _rootNode)
    {
        #TreeNodeSysNodeType
        TreeNode          _childNode;
        TreeNodeIterator  _rootNodeIterator;

        if (_rootNode)
        {
            _rootNodeIterator = _rootNode.AOTiterator();
            _childNode        = _rootNodeIterator.next();

            while (_childnode)
            {
                if (_childNode.treeNodeType().id() == #NT_PROJECT_GROUP)
                {
                    if (_childNode.AOTparent().AOTname() == _ProjectName)
                    {
                        _GroupName = _childNode.AOTname();
                    }
                    searchAllObj(_childNode);
                }
                else
                {
                    _ObjectPath = _childNode.treeNodePath();
                    return_objecttype();
                    _ObjectName = _childNode.AOTname();
                    insert_list();
                }

                _childNode = _rootNodeIterator.next();
            }
        }
    }

    if (_pn)
    {
        _pnProj = _pn.loadForInspection();
        searchAllObj(_pnProj);
        _pnproj.treeNodeRelease();
    }
}


No comments:

Post a Comment