/// <summary> /// Splits all ItemTypes found by <see cref="FetchAllItemTypes" /> into ItemTypes, RelationshipTypes and /// PolyItem-types. /// </summary> internal void SplitAllItemTypes() { ItemTypes = AllItemTypes.getItemsByXPath( "//Item[is_relationship = '0' and not(boolean(Relationships/Item[@type = 'Morphae']))]"); RelationshipTypes = AllItemTypes.getItemsByXPath("//Item[is_relationship = '1']"); PolyItemTypes = AllItemTypes.getItemsByXPath( "//Item[is_relationship = '0' and boolean(Relationships/Item[@type = 'Morphae'])]"); }
/// <summary> /// Gets the desired data model from Aras and writes corresponding info to the console. /// </summary> /// <remarks> /// Logs out of Aras Innovator after the getting the data model, even if an error occurred during that fetch. /// </remarks> /// <exception cref="ItemApplyException">Thrown if an error occured using apply() on an Aras Item object.</exception> internal void RunExport() { Console.Write("Fetching all ItemTypes"); // ReSharper disable once AssignNullToNotNullAttribute // ReSharper does not realise that a null _prefixList is not possible here due to _prefixWasGiven if (_prefixWasGiven) { Console.Write($" with prefixes '{string.Join(", ", _prefixList)}'"); } if (_doConsiderPackage) { if (_useWiderSearch && _prefixWasGiven) { Console.Write(" or"); } Console.Write($" inside PackageDefinition '{_packageName}'"); } Console.WriteLine("..."); try { AllItemTypes = FetchAllItemTypes(); } finally { _arasLogin.LogOut(); } int allItemCount = AllItemTypes.getItemCount(); switch (allItemCount) { case -1: throw new ItemApplyException( $"Error when trying to find ItemTypes: {AllItemTypes.getErrorString()}"); case 0: Console.WriteLine("No ItemTypes found. Please check prefix(es) and/or package name and run again."); Environment.Exit(0); break; default: Console.WriteLine($"{allItemCount} ItemTypes found."); break; } }