Class ArcherContentExtensions
Provides extension methods to convert XElement and JSON records returned from the Archer Search and REST APIs via the Estrelica.Core Content resolver into IArcherContentAccess implementations for simplified access and editing.
Inherited Members
Namespace: Estrelica.Archer.Content
Assembly: Estrelica.Archer.Entities.dll
Syntax
[DoNotObfuscateType]
public static class ArcherContentExtensions
Methods
AsZipStream(IEnumerable<IArcherDocument>, string)
Returns a collection of IArcherDocument downloads as a Zip MemoryStream.
Declaration
public static MemoryStream AsZipStream(this IEnumerable<IArcherDocument> documents, string exceptionReportFilename = "_exceptionReport.txt")
Parameters
IEnumerable<IArcherDocument>
documents
The IArcherDocument references to be downloaded and included in the Zip |
string
exceptionReportFilename
Defaults to _exceptionReport.txt. If not null, any exceptions that arise during the export attempt will be logged in this file and included in the zip result. Pass null here if you don't want that report. |
Returns
MemoryStream
A MemoryStream representing the Zip result |
Remarks
If duplicate filenames are found in the documents returned from Archer, they will be distinguished in "Filename.txt", "Filename (1).txt", "Filename (2).txt" in the result.
ContentAccess(IArcherContent, IResolverProvider)
Converts a single JSON content record returned from the Archer REST API, seriliazed into a dictionary supporting the IArcherContent interface, into a more easily-accessible IArcherContentAccess implementation
Declaration
public static IArcherContentAccess ContentAccess(this IArcherContent record, IResolverProvider resolver)
Parameters
IArcherContent
record
A single IArcherContent (JSON) record obtained from the Archer REST API (typically via the Estrelica.Core Content resolver) |
IResolverProvider
resolver
IResolverProvider (typically the Estrelica.Core itself) providing access to all the resolvers needed to flesh out the record's content (e.g. metadata, values lists, users/groups, content update info, etc.) |
Returns
IArcherContentAccess
A single IArcherContentAccess implementation |
ContentAccess(IEnumerable<IArcherContent>, IResolverProvider)
Converts JSON content records returned from the Archer REST API, seriliazed into dictionaries supporting the IArcherContent interface, into more easily-accessible IArcherContentAccess implementations
Declaration
public static IEnumerable<IArcherContentAccess> ContentAccess(this IEnumerable<IArcherContent> records, IResolverProvider resolver)
Parameters
IEnumerable<IArcherContent>
records
IEnumerable set of IArcherContent (JSON) records obtained from the Archer REST API (typically via the Estrelica.Core Content resolver) |
IResolverProvider
resolver
IResolverProvider (typically the Estrelica.Core itself) providing access to all the resolvers needed to flesh out each record's content (e.g. metadata, values lists, users/groups, content update info, etc.) |
Returns
IEnumerable<IArcherContentAccess>
An IEnumerable set of IArcherContentAccess implementations |
ContentAccess(IEnumerable<XElement>, IResolverProvider)
Converts XML records returned from the Archer Search API into more easily-accessible IArcherContentAccess implementations
Declaration
public static IEnumerable<IArcherContentAccess> ContentAccess(this IEnumerable<XElement> records, IResolverProvider resolver)
Parameters
IEnumerable<XElement>
records
IEnumerable set of XElement records obtained from the Archer Search API (typically via the Estrelica.Core Content resolver) |
IResolverProvider
resolver
IResolverProvider (typically the Estrelica.Core itself) providing access to all the resolvers needed to flesh out each record's content (e.g. metadata, values lists, users/groups, content update info, etc.) |
Returns
IEnumerable<IArcherContentAccess>
An IEnumerable set of IArcherContentAccess implementations |
ContentAccess(XElement, IResolverProvider)
Converts a single XML record returned from the Archer Search API into a more easily-accessible IArcherContentAccess implementation
Declaration
public static IArcherContentAccess ContentAccess(this XElement record, IResolverProvider resolver)
Parameters
XElement
record
A single XElement record obtained from the Archer Search API (typically via the Estrelica.Core Content resolver) |
IResolverProvider
resolver
IResolverProvider (typically the Estrelica.Core itself) providing access to all the resolvers needed to flesh out the record's content (e.g. metadata, values lists, users/groups, content update info, etc.) |
Returns
IArcherContentAccess
A single IArcherContentAccess implementation |
CreateLinkedContent(IArcherContentAccess, IReferenceField, int?)
Returns a new IArcherContentEdit record linked to the current (this) record via one of its IReferenceField fields (i.e. a Cross Reference, Related Records or Subform field). If the field is a Cross-Reference field which targets multiple Levels, the target level Id for the created record must be specified via the referencedLevelId parameter. The returned IArcherContentEdit is not immediately created in Archer, but instead must be persisted (after the appropriate field value changes have been made) via a call to the Content resolver's Estrelica.Archer.Utility.IContentResolver.Update method.
Declaration
public static IArcherContentEdit CreateLinkedContent(this IArcherContentAccess record, IReferenceField referenceField, int? referencedLevelId = null)
Parameters
IArcherContentAccess
record
An IArcherContentAccess record to which a new cross-reference, related record, or subform record is to be added |
IReferenceField
referenceField
The Cross Reference, Related Record, or Subform field on the current record via which the new record should be linked |
int?
referencedLevelId
An optional parameter specifying the Level in which the new record should be created. This is optional for Related Record, Subform, and single-level Cross Reference fields (as the Level will be determined from the reference field itself) but must be explicitly specified in the case of a multi-level Cross Reference field. |
Returns
IArcherContentEdit
An IArcherContentEdit instance, ready for modification of its record values |
ForEdit(IArcherContent, IResolverProvider)
Prepares an IArcherContentAccess record for editing.
Declaration
public static IArcherContentEdit ForEdit(this IArcherContent record, IResolverProvider resolver)
Parameters
IArcherContent
record
An IArcherContentAccess to be edited and eventually persisted back to Archer via an Estrelica.Archer.Utility.IContentResolver.Update call |
IResolverProvider
resolver
IResolverProvider (typically the Estrelica.Core itself) providing access to all the resolvers needed to flesh out the record's content (e.g. metadata, values lists, users/groups, content update info, etc.) |
Returns
IArcherContentEdit
An IArcherContentEdit instance, ready for modification of its record values |
ForEdit(XElement, IResolverProvider)
Prepares an XElement search result record for editing.
Declaration
public static IArcherContentEdit ForEdit(this XElement record, IResolverProvider resolver)
Parameters
XElement
record
An XElement record returned from the Archer Search API to be edited and eventually persisted back to Archer via an Estrelica.Archer.Utility.IContentResolver.Update call |
IResolverProvider
resolver
IResolverProvider (typically the Estrelica.Core itself) providing access to all the resolvers needed to flesh out the record's content (e.g. metadata, values lists, users/groups, content update info, etc.) |
Returns
IArcherContentEdit
An IArcherContentEdit instance, ready for modification of its record values |
PerformWorkflowAction(IArcherContentAccess, IWorkflowAction)
Performs a selected workflow action on the record.
Declaration
public static bool PerformWorkflowAction(this IArcherContentAccess record, IWorkflowAction action)
Parameters
IArcherContentAccess
record
The Archer content record on which the workflow action is to be performed |
IWorkflowAction
action
The workflow action to be performed |
Returns
bool
True if the workflow action was successfully performed, otherwise False |
SaveToZipFile(IEnumerable<IArcherDocument>, string, string, bool)
Saves a collection of IArcherDocument downloads to a Zip file
Declaration
public static string SaveToZipFile(this IEnumerable<IArcherDocument> documents, string zipFilename, string exceptionReportFilename = "_exceptionReport.txt", bool overwriteIfFileExists = false)
Parameters
IEnumerable<IArcherDocument>
documents
The IArcherDocument references to be downloaded and included in the Zip |
string
zipFilename
The intended output filename of the zip file. If no extension is specified, .zip will be assumed. |
string
exceptionReportFilename
Defaults to _exceptionReport.txt. If not null, any exceptions that arise during the export attempt will be logged in this file and included in the zip result. Pass null here if you don't want that report. |
bool
overwriteIfFileExists
Indicates whether the zipFilename file should be overwritten if it already exists, or an InvalidOperationException should be raised. Defaults to false (throws exception). |
Returns
string
The fully-qualified filename of the Zip file containing the documents |
Remarks
If duplicate filenames are found in the documents returned from Archer, they will be distinguished in "Filename.txt", "Filename (1).txt", "Filename (2).txt" in the result.
WorkflowActions(IArcherContentAccess)
Returns the available workflow actions that may be performed on the record, or an empty IEnumerable<IWorkflowAction> if no actions are applicable.
Declaration
public static IEnumerable<IWorkflowAction> WorkflowActions(this IArcherContentAccess record)
Parameters
IArcherContentAccess record |
Returns
IEnumerable<IWorkflowAction> |
WorkflowNode(IArcherContentAccess)
Returns the workflow details for the content record, or null if the record is not enrolled in workflow.
Declaration
public static IWorkflowNode WorkflowNode(this IArcherContentAccess record)
Parameters
IArcherContentAccess record |
Returns
IWorkflowNode |