Interface ILayoutService
Represents the layout API service.
Namespace: Relativity.Testing.Framework.Api.Services
Assembly: Relativity.Testing.Framework.Api.dll
Syntax
public interface ILayoutService
Examples
_layoutService = relatvityFacade.Resolve<ILayoutService>();
Methods
| Improve this Doc View SourceAddFields(Int32, Layout, List<CategoryField>)
Builds the layout.
Declaration
void AddFields(int workspaceId, Layout entity, List<CategoryField> categoryFields)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | workspaceId | The Artifact ID of the workspace where you want to update the layout, or use -1 to indicate the admin-level context. |
Layout | entity | The layout to build. If ArtifactId is provided, it will be used, otherwise it will be looked up by name. If neither are provided, this will put us in an exceptional state. |
System.Collections.Generic.List<CategoryField> | categoryFields | The fields to add to a category. |
Examples
var workspaceId = 1015427;
var existingObjectTypeId = 1;
var existingFieldId = 2;
var existingFieldTypeId = 3;
Layout layout = _layoutService.Get(workspaceId, existingLayoutId);
var fieldsToAdd = new List<CategoryField>
{
new CategoryField
{
DisplayName = "Some Field Name",
FieldArtifactID = existingFieldId,
FieldDisplayType = FieldDisplayType.Decimal,
FieldTypeID = existingFieldTypeId,
IsRequired = true
}
};
_layoutService.AddFields(workspaceId, layout, fieldsToAdd);
|
Improve this Doc
View Source
Create(Int32, Layout)
Creates the specified Layout.
Declaration
Layout Create(int workspaceId, Layout entity)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | workspaceId | The Artifact ID of the workspace where you want to add the new layout, or use -1 to indicate the admin-level context. |
Layout | entity | The entity to create. |
Returns
Type | Description |
---|---|
Layout | The created entity. |
Examples
var workspaceId = 1015427;
var existingObjectTypeId = 1;
ObjectType objectType = relatvityFacade.Resolve<IObjectTypeService>()
.Resolve(workspaceId, existingObjectTypeId);
var entity = new Layout
{
Name = "Sample Layout Name",
ObjectType = objectType
};
Layout createdLayout = _layoutService.Create(workspaceId, entity);
|
Improve this Doc
View Source
Delete(Int32, Int32)
Deletes the layout by ID.
Declaration
void Delete(int workspaceId, int entityId)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | workspaceId | The Artifact ID of the workspace where you want to delete the layout, or use -1 to indicate the admin-level context. |
System.Int32 | entityId | The artifact ID of the layout. |
Examples
var workspaceId = 1015427;
var existigLayoutId = 1;
_layoutService.Delete(workspaceId, existigLayoutId);
|
Improve this Doc
View Source
Get(Int32, Int32)
Gets the layout by the specified ID.
Declaration
Layout Get(int workspaceId, int entityId)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | workspaceId | The Artifact ID of the workspace where you want to get the layout, or use -1 to indicate the admin-level context. |
System.Int32 | entityId | The artifact ID of the layout. |
Returns
Type | Description |
---|---|
Layout | The Layout entity. |
Examples
var workspaceId = 1015427;
var existigLayoutId = 1;
Layout layout = _layoutService.Get(workspaceId, existigLayoutId);
|
Improve this Doc
View Source
GetCategories(Int32, Layout)
Gets the categories in a layout.
Declaration
List<Category> GetCategories(int workspaceId, Layout entity)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | workspaceId | The Artifact ID of the workspace where you want to update the layout, or use -1 to indicate the admin-level context. |
Layout | entity | The layout to get the categories for. If ArtifactId is provided, it will be used, otherwise it will be looked up by name. If neither are provided, this will put us in an exceptional state. |
Returns
Type | Description |
---|---|
System.Collections.Generic.List<Category> | The list of categories in layout. |
Examples
var workspaceId = 1015427;
var existingLayoutId = 1;
Layout layout = _layoutService.Get(workspaceId, existingLayoutId);
List<Category> categories = _layoutService.GetCategories(workspaceId, layout);
|
Improve this Doc
View Source
GetEligibleOwners(Int32)
Gets the list eligible to be a layout owner by the specified workspace ID.
Declaration
List<NamedArtifact> GetEligibleOwners(int workspaceId)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | workspaceId | The workspace ID. |
Returns
Type | Description |
---|---|
System.Collections.Generic.List<NamedArtifact> | The list eligible to be a layout owner. |
Examples
var workspaceId = 1015427;
List<NamedArtifact> eligibleOwners = _layoutService.GetEligibleOwners(workspaceId);
|
Improve this Doc
View Source
Require(Int32, Layout)
Requires the specified layout.
- If [ArtifactID](https://relativitydev.github.io/relativity.testing.framework/api/Relativity.Testing.Framework.Models.Artifact.html#Relativity_Testing_Framework_Models_Artifact_ArtifactID) property of
entity
has positive value, gets entity by ID and updates it. - If [Name](https://relativitydev.github.io/relativity.testing.framework/api/Relativity.Testing.Framework.Models.NamedArtifact.html#Relativity_Testing_Framework_Models_NamedArtifact_Name) property of
entity
have a value, gets entity by name and updates it if it exists. - Otherwise creates a new entity using Relativity.Testing.Framework.Api.Strategies.ICreateWorkspaceEntityStrategy`1
Declaration
Layout Require(int workspaceId, Layout entity)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | workspaceId | The Artifact ID of the workspace where you want to require layout, or use -1 to indicate the admin-level context. |
Layout | entity | The entity to require. |
Returns
Type | Description |
---|---|
Layout | The entity required. |
Examples
var workspaceId = 1015427;
var existingObjectTypeId = 1;
var existigLayoutId = 2;
ObjectType objectType = relatvityFacade.Resolve<IObjectTypeService>()
.Resolve(workspaceId, existingObjectTypeId);
var entityToUpdateById = new Layout
{
Name = "Sample Updated Layout Name",
ObjectType = objectType,
ArtifactID = existigLayoutId
};
Layout layoutUpdatedById = _layoutService.Require(workspaceId, entityToUpdateById);
var entityToUpdateByName = new Layout
{
Name = "Sample Existing Layout Name",
ObjectType = objectType,
AllowCopyFromPrevious = true
};
Layout layoutUpdatedByName = _layoutService.Require(workspaceId, entityToUpdateByName);
var entityToCreate = new Layout
{
Name = "Sample Not Existing Layout Name",
ObjectType = objectType,
};
Layout createdLayout = _layoutService.Require(workspaceId, entityToCreate);
|
Improve this Doc
View Source
Update(Int32, Layout)
Updates the specified layout.
Declaration
void Update(int workspaceId, Layout entity)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | workspaceId | The Artifact ID of the workspace where you want to update the layout, or use -1 to indicate the admin-level context. |
Layout | entity | The entity to update. |
Examples
var workspaceId = 1015427;
var existingLayoutId = 1;
Layout layoutToUpdate = _layoutService.Get(workspaceId, existingLayoutId);
layoutToUpdate.Name = "Some Updated Layout Name";
_layoutService.Update(workspaceId, layoutToUpdate);