Skip to content

Commit

Permalink
Merge pull request #20 from arbelatech/feature/FilterByObjectIds
Browse files Browse the repository at this point in the history
Add the object ID to objects that have an ID (not just tables), and a…
  • Loading branch information
caleblanchard authored Aug 26, 2022
2 parents 033af8d + 084e566 commit c466898
Show file tree
Hide file tree
Showing 7 changed files with 161 additions and 54 deletions.
59 changes: 59 additions & 0 deletions Metadata/AOTBrowser/AOTBrowser/AxClass/ARBAOTBrowserHelper.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
<?xml version="1.0" encoding="utf-8"?>
<AxClass xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
<Name>ARBAOTBrowserHelper</Name>
<SourceCode>
<Declaration><![CDATA[
using Microsoft.Dynamics.AX.Metadata.MetaModel;
using Microsoft.Dynamics.AX.Metadata.Core.MetaModel;
public final class ARBAOTBrowserHelper
{
}
]]></Declaration>
<Methods>
<Method>
<Name>getObjectIdByName</Name>
<Source><![CDATA[
public static int getObjectIdByName(anytype _object)
{
INamedObject namedObject = _object as INamedObject;
if (namedObject == null)
{
return 0;
}
str objectName = namedObject.Name;
int objectId;
switch (true)
{
case _object is AxTable:
case _object is AxView:
case _object is AxDataEntityView:
objectId = tableName2Id(objectName);
break;
case _object is AxEnum:
objectId = enumName2Id(objectName);
break;
case _object is AxClass:
objectId = className2Id(objectName);
break;
case _object is AxEdt:
objectId = extendedTypeName2Id(objectName);
break;
case _object is AxConfigurationKey:
objectId = configurationKeyName2Id(objectName);
break;
}
return objectId;
}
]]></Source>
</Method>
</Methods>
</SourceCode>
</AxClass>
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ class ARBAOTObjectPopulateService extends SysOperationServiceBase
aotObjects.Name = table.Name;
aotObjects.Label = SysLabel::labelId2String2(table.Label);
aotObjects.Type = ARBAOTObjectType::Table;
aotObjects.ObjectId = tableName2Id(table.Name);
aotObjectsInsertList.add(aotObjects);
}
Expand All @@ -51,6 +52,7 @@ class ARBAOTObjectPopulateService extends SysOperationServiceBase
aotObjects.Name = view.Name;
aotObjects.Label = SysLabel::labelId2String2(view.Label);
aotObjects.Type = ARBAOTObjectType::View;
aotObjects.ObjectId = tableName2Id(view.Name);
aotObjectsInsertList.add(aotObjects);
}
Expand All @@ -65,6 +67,7 @@ class ARBAOTObjectPopulateService extends SysOperationServiceBase
aotObjects.Name = enum.Name;
aotObjects.Label = SysLabel::labelId2String2(enum.Label);
aotObjects.Type = ARBAOTObjectType::BaseEnum;
aotObjects.ObjectId = enumName2Id(enum.Name);
aotObjectsInsertList.add(aotObjects);
}
Expand All @@ -79,6 +82,7 @@ class ARBAOTObjectPopulateService extends SysOperationServiceBase
aotObjects.Name = edt.Name;
aotObjects.Label = SysLabel::labelId2String2(edt.Label);
aotObjects.Type = ARBAOTObjectType::ExtendedDataType;
aotObjects.ObjectId = extendedtypeName2Id(edt.Name);
aotObjectsInsertList.add(aotObjects);
}
Expand All @@ -93,6 +97,7 @@ class ARBAOTObjectPopulateService extends SysOperationServiceBase
aotObjects.Name = dataEntityView.Name;
aotObjects.Label = SysLabel::labelId2String2(dataEntityView.Label);
aotObjects.Type = ARBAOTObjectType::DataEntity;
aotObjects.ObjectId = tableName2Id(dataEntityView.Name);
aotObjectsInsertList.add(aotObjects);
}
Expand Down Expand Up @@ -121,6 +126,7 @@ class ARBAOTObjectPopulateService extends SysOperationServiceBase
aotObjects.Name = aotClass.Name;
//aotObjects.Label = SysLabel::labelId2String2(aotClass.Label);
aotObjects.Type = ARBAOTObjectType::Class;
aotObjects.ObjectId = className2Id(aotClass.Name);
aotObjectsInsertList.add(aotObjects);
}
Expand Down Expand Up @@ -452,6 +458,7 @@ class ARBAOTObjectPopulateService extends SysOperationServiceBase
aotObjects.Name = object.Name;
aotObjects.Label = SysLabel::labelId2String2(object.Label);
aotObjects.Type = ARBAOTObjectType::ConfigKey;
aotObjects.ObjectId = configurationKeyName2Id(object.Name);
aotObjectsInsertList.add(aotObjects);
}
Expand Down
10 changes: 10 additions & 0 deletions Metadata/AOTBrowser/AOTBrowser/AxEdt/ARBObjectId.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<AxEdt xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns=""
i:type="AxEdtInt">
<Name>ARBObjectId</Name>
<Label>@AOTBrowser:ObjectId</Label>
<ArrayElements />
<Relations />
<TableReferences />
<ShowZero>No</ShowZero>
</AxEdt>
21 changes: 17 additions & 4 deletions Metadata/AOTBrowser/AOTBrowser/AxForm/ARBAOTBrowser.xml
Original file line number Diff line number Diff line change
Expand Up @@ -442,15 +442,16 @@ public class ARBAOTBrowser extends FormRun
object = _object;
}
if (object is AxTable)
int objectId = ARBAOTBrowserHelper::getObjectIdByName(object);
if (objectId)
{
AxTable table = object as AxTable;
ARBAOTObjectProperties.clear();
ARBAOTObjectProperties.Name = '_Id';
ARBAOTObjectProperties.Value = int2Str(tableName2Id(table.Name));
ARBAOTObjectProperties.Value = int2Str(objectId);
ARBAOTObjectProperties.insert();
}
else if (object is AxTableField)
if (object is AxTableField)
{
anytype parent = ObjectTree.getItem(ObjectTree.getRoot()).data();
ARBObjectModification objectMod = parent as ARBObjectModification;
Expand Down Expand Up @@ -1267,6 +1268,9 @@ public class ARBAOTBrowser extends FormRun
<AxFormDataSourceField>
<DataField>Name</DataField>
</AxFormDataSourceField>
<AxFormDataSourceField>
<DataField>ObjectId</DataField>
</AxFormDataSourceField>
<AxFormDataSourceField>
<DataField>Partition</DataField>
</AxFormDataSourceField>
Expand Down Expand Up @@ -1725,6 +1729,15 @@ public class ARBAOTBrowser extends FormRun
<DataSource>ARBAOTObjects</DataSource>
<Items />
</AxFormControl>
<AxFormControl xmlns=""
i:type="AxFormIntegerControl">
<Name>ARBAOTObjects_ObjectId</Name>
<Type>Integer</Type>
<FormControlExtension
i:nil="true" />
<DataField>ObjectId</DataField>
<DataSource>ARBAOTObjects</DataSource>
</AxFormControl>
</Controls>
<MultiSelect>No</MultiSelect>
<ShowRowLabels>No</ShowRowLabels>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,97 +1,99 @@
NewLabel0=Label files created on 12/04/2019 20:20:46 for label file Id AOTBrowser and language en-US
;Label file comment - see above label
CompositeDataEntities=Composite data entity
AggregateDataEntity=Aggregate data entity
;ARB_AOTBrowser
Maps=Map
AOTBrowser=AOT browser
;ARB_AOTBrowser
Macros=Macro
AOTBrowserMaintain=Maintain AOT browser
;ARB_AOTBrowser
Tiles=Tile
AOTBrowserUser=AOT browser user
;ARB_AOTBrowser
Menus=Menu
AOTObjectProperties=AOT object properties
;ARB_AOTBrowser
AOTBrowser=AOT browser
AOTObjectPropertiesDevDoc=Holds the properties for the AOT object
;ARB_AOTBrowser
BaseEnum=Base enum
AOTObjects=AOT objects
;ARB_AOTBrowser
MenuItemDisplay=Display menu item
AOTObjectsDevDoc=List of objects in the application object tree
;ARB_AOTBrowser
MenuItemOutput=Output menu item
BaseEnum=Base enum
;ARB_AOTBrowser
MenuItemAction=Action menu item
CompositeDataEntities=Composite data entity
;ARB_AOTBrowser
SecurityRole=Security role
ConfigKey=Configuration key
;ARB_AOTBrowser
SecurityDuty=Security duty
ConfigKeyGroup=Configuration key group
;ARB_AOTBrowser
SecurityPrivilege=Security privilege
LicenseCode=License code
;ARB_AOTBrowser
PopulateAOTObjectTable=AOTBrowser - Populate AOT object table
Macros=Macro
;ARB_AOTBrowser
ObjectType=Object type
Maps=Map
;ARB_AOTBrowser
Object=Object
MenuItemAction=Action menu item
;ARB_AOTBrowser
OpenInAOTBrowser=Open in AOT browser
MenuItemDisplay=Display menu item
;ARB_AOTBrowser
AOTObjects=AOT objects
MenuItemOutput=Output menu item
;ARB_AOTBrowser
AOTObjectsDevDoc=List of objects in the application object tree
Menus=Menu
;ARB_AOTBrowser
TableStatisticsDevDoc=Statistics about each table in the database
NewLabel0=Label files created on 12/04/2019 20:20:46 for label file Id AOTBrowser and language en-US
;Label file comment - see above label
Object=Object
;ARB_AOTBrowser
PropertyValue=Value
ObjectId=Object id
;AOTBrowser
ObjectType=Object type
;ARB_AOTBrowser
AOTObjectProperties=AOT object properties
OpenInAOTBrowser=Open in AOT browser
;ARB_AOTBrowser
AOTObjectPropertiesDevDoc=Holds the properties for the AOT object
OpenTableBrowserButton=Open table browser
;ARB_AOTBrowser
AggregateDataEntity=Aggregate data entity
PopulateAOTObjects=Populate AOT objects
;ARB_AOTBrowser
WorkflowCategory=Workflow category
PopulateAOTObjectTable=AOTBrowser - Populate AOT object table
;ARB_AOTBrowser
WorkflowApproval=Workflow approval
PropertyValue=Value
;ARB_AOTBrowser
WorkflowTask=Workflow task
Reference=Reference
;ARB_AOTBrowser
WorkflowAutomatedTask=Workflow automated task
Report=Report
;ARB_AOTBrowser
WorkflowType=Workflow type
Resource=Resource
;ARB_AOTBrowser
WorkflowHierarchyAssignmentProvider=Workflow hierarchy assignment provider
SecurityDuty=Security duty
;ARB_AOTBrowser
WorkflowParticipantAssignmentProvider=Workflow participant assignment provider
SecurityPrivilege=Security privilege
;ARB_AOTBrowser
WorkflowQueueAssignmentProvider=Workflow queue assignment provider
SecurityRole=Security role
;ARB_AOTBrowser
WorkflowDueDateCalculationProvider=Workflow due date calculation provider
Service=Service
;ARB_AOTBrowser
Resource=Resource
ServiceGroup=Service group
;ARB_AOTBrowser
LicenseCode=License code
TableStatisticsDevDoc=Statistics about each table in the database
;ARB_AOTBrowser
ConfigKey=Configuration key
Tiles=Tile
;ARB_AOTBrowser
ConfigKeyGroup=Configuration key group
ViewCode=View source code
;ARB_AOTBrowser
Reference=Reference
ViewCodeHelp=Toggles the ability to view the source code. (NOTE: Viewing metadata from 3rd parties provided by deployable package is not supported with this turned on)
ViewExtensionsInline=Show extensions inline
;ARB_AOTBrowser
Service=Service
WorkflowApproval=Workflow approval
;ARB_AOTBrowser
ServiceGroup=Service group
WorkflowAutomatedTask=Workflow automated task
;ARB_AOTBrowser
Report=Report
WorkflowCategory=Workflow category
;ARB_AOTBrowser
PopulateAOTObjects=Populate AOT objects
WorkflowDueDateCalculationProvider=Workflow due date calculation provider
;ARB_AOTBrowser
OpenTableBrowserButton=Open table browser
WorkflowHierarchyAssignmentProvider=Workflow hierarchy assignment provider
;ARB_AOTBrowser
AOTBrowserMaintain=Maintain AOT browser
WorkflowParticipantAssignmentProvider=Workflow participant assignment provider
;ARB_AOTBrowser
AOTBrowserUser=AOT browser user
WorkflowQueueAssignmentProvider=Workflow queue assignment provider
;ARB_AOTBrowser
ViewExtensionsInline=Show extensions inline
WorkflowTask=Workflow task
;ARB_AOTBrowser
ViewCode=View source code
WorkflowType=Workflow type
;ARB_AOTBrowser
ViewCodeHelp=Toggles the ability to view the source code. (NOTE: Viewing metadata from 3rd parties provided by deployable package is not supported with this turned on)
5 changes: 5 additions & 0 deletions Metadata/AOTBrowser/AOTBrowser/AxTable/ARBAOTObjects.xml
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,11 @@ public class ARBAOTObjects extends common
<Mandatory>Yes</Mandatory>
<EnumType>ARBAOTObjectType</EnumType>
</AxTableField>
<AxTableField xmlns=""
i:type="AxTableFieldInt">
<Name>ObjectId</Name>
<ExtendedDataType>ARBObjectId</ExtendedDataType>
</AxTableField>
</Fields>
<FullTextIndexes />
<Indexes>
Expand Down
11 changes: 11 additions & 0 deletions Projects/AOTBrowser/AOTBrowser/AOTBrowser.rnrproj
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
<Folder Include="Classes\" />
<Folder Include="Display Menu Items\" />
<Folder Include="EDT Enums\" />
<Folder Include="EDT Integers\" />
<Folder Include="Extended Data Types\" />
<Folder Include="Form Extensions\" />
<Folder Include="Forms\" />
Expand All @@ -56,6 +57,11 @@
<Name>ARBAOTBrowserConstants</Name>
<Link>Classes\ARBAOTBrowserConstants</Link>
</Content>
<Content Include="AxClass\ARBAOTBrowserHelper">
<SubType>Content</SubType>
<Name>ARBAOTBrowserHelper</Name>
<Link>Classes\ARBAOTBrowserHelper</Link>
</Content>
<Content Include="AxClass\ARBAOTObjectPopulateController">
<SubType>Content</SubType>
<Name>ARBAOTObjectPopulateController</Name>
Expand Down Expand Up @@ -136,6 +142,11 @@
<Name>ARBAOTPropertyValue</Name>
<Link>Extended Data Types\ARBAOTPropertyValue</Link>
</Content>
<Content Include="AxEdt\ARBObjectId">
<SubType>Content</SubType>
<Name>ARBObjectId</Name>
<Link>EDT Integers\ARBObjectId</Link>
</Content>
<Content Include="AxEnum\ARBAOTObjectType">
<SubType>Content</SubType>
<Name>ARBAOTObjectType</Name>
Expand Down

0 comments on commit c466898

Please sign in to comment.