Show / Hide Table of Contents

Interface IViewService

Represent the API view service.

Namespace: Relativity.Testing.Framework.Api.Services
Assembly: Relativity.Testing.Framework.Api.dll
Syntax
public interface IViewService
Examples
IViewService _viewService = relativityFacade.Resolve<IViewService>();

Methods

| Improve this Doc View Source

Create(Int32, View)

Creates the specified View.

Declaration
View Create(int workspaceArtifactID, View view)
Parameters
Type Name Description
System.Int32 workspaceArtifactID

The ArtifactID of the workspace where you want to create the view, or use -1 to indicate the admin-level context.

View view

The View to create.

Returns
Type Description
View

The View entity or null.

Examples
int workspaceArtifactID = 1015427;
FixedLengthTextField field = relativityFacade.Resolve<IFieldService>().Get<FixedLengthTextField>(workspaceArtifactID, "Control Number");
View viewtoCreate = new View
{
	Name = "Test View Name",
	Fields = new[] { new NamedArtifact { Name = field.Name, ArtifactID = field.ArtifactID } },
}
View createdView = _viewService.Create(workspaceArtifactID, viewtoCreate);
| Improve this Doc View Source

Exists(Int32, Int32)

Determines whether the View with the specified ArtifactID exists.

Declaration
bool Exists(int workspaceArtifactID, int viewArtifactID)
Parameters
Type Name Description
System.Int32 workspaceArtifactID

The ArtifactID of the workspace where you want to check if a view exists, or use -1 to indicate the admin-level context.

System.Int32 viewArtifactID

The ArtifactID of the view.

Returns
Type Description
System.Boolean

true if a view exists; otherwise, false.

Examples
int workspaceArtifactID = 1015427;
int viewArtifactID = 1024345;
bool viewExists = _viewService.Exists(workspaceArtifactID, viewArtifactID);
| Improve this Doc View Source

Get(Int32, Int32)

Gets the View by the specified ArtifactID.

Declaration
View Get(int workspaceArtifactID, int viewArtifactID)
Parameters
Type Name Description
System.Int32 workspaceArtifactID

The ArtifactID of the workspace where you want to get the view, or use -1 to indicate the admin-level context.

System.Int32 viewArtifactID

The ArtifactID of the view.

Returns
Type Description
View

The View entity or null.

Examples
int workspaceArtifactID = 1015427;
int viewArtifactID = 1024345;
View view = _viewService.Get(workspaceArtifactID, viewArtifactID);
| Improve this Doc View Source

Get(Int32, String)

Gets the View by the specified name.

Declaration
View Get(int workspaceArtifactID, string viewName)
Parameters
Type Name Description
System.Int32 workspaceArtifactID

The ArtifactID of the workspace where you want to get the view, or use -1 to indicate the admin-level context.

System.String viewName

The name of the view.

Returns
Type Description
View

The View entity or null.

Examples
int workspaceArtifactID = 1015427;
int viewName = "Test View Name";
View view = _viewService.Get(workspaceArtifactID, viewName);
| Improve this Doc View Source

GetAll(Int32)

Gets all Views in workspace. Returns not all fields for faster response.

Declaration
View[] GetAll(int workspaceArtifactID)
Parameters
Type Name Description
System.Int32 workspaceArtifactID

The ArtifactID of the workspace where you want to get the view, or use -1 to indicate the admin-level context.

Returns
Type Description
View[]

The collection of View entities.

Examples
int workspaceArtifactID = 1015427;
View[] views = _viewService.GetAll(workspaceArtifactID);
| Improve this Doc View Source

GetEligibleObjectTypes(Int32)

Gets the list of of object types in a specific workspace.

Declaration
List<NamedArtifact> GetEligibleObjectTypes(int workspaceId)
Parameters
Type Name Description
System.Int32 workspaceId

The workspace ID.

Returns
Type Description
System.Collections.Generic.List<NamedArtifact>

The list of NamedArtifact objects.

Examples
int workspaceArtifactID = 1015427;
int existingViewArtifactID = 1024345;
var eligibleObjectTypes = _viewService.GetEligibleObjectTypes(workspaceArtifactID);
View view = _viewService.Get(workspaceArtifactID, existingViewArtifactID);
view.ObjectType = eligibleObjectTypes[0];
_viewService.Update(workspaceArtifactID, view);
| Improve this Doc View Source

GetViewOwners(Int32)

Gets a list of users eligible to be view owners in a specific workspace. You can then use this list to assign owners to a view.

Declaration
NamedArtifact[] GetViewOwners(int workspaceId)
Parameters
Type Name Description
System.Int32 workspaceId

The workspace ID.

Returns
Type Description
NamedArtifact[]

An array of NamedArtifact objects.

Examples
int workspaceArtifactID = 1015427;
int existingViewArtifactID = 1024345;
var owners = _viewService.GetViewOwners(workspaceArtifactID);
View view = _viewService.Get(workspaceArtifactID, existingViewArtifactID);
view.Owner = owners[0];
_viewService.Update(workspaceArtifactID, view);
| Improve this Doc View Source

Require(Int32, View)

Requires the specified View.

  1. If [ArtifactID](https://relativitydev.github.io/relativity.testing.framework/api/Relativity.Testing.Framework.Models.Artifact.html#Relativity_Testing_Framework_Models_Artifact_ArtifactID) property of view has positive value, gets view by ArtifactID and updates it.
  2. If [Name](https://relativitydev.github.io/relativity.testing.framework/api/Relativity.Testing.Framework.Models.NamedArtifact.html#Relativity_Testing_Framework_Models_NamedArtifact_Name) property of view has a value, gets view by name and updates it if it exists.
  3. Otherwise creates a new [View](https://relativitydev.github.io/relativity.testing.framework/api/Relativity.Testing.Framework.Models.View.html).
Declaration
View Require(int workspaceArtifactID, View view)
Parameters
Type Name Description
System.Int32 workspaceArtifactID

The ArtifactID of the workspace where you want to require view.

View view

The view to require.

Returns
Type Description
View

The View entity.

Examples

This shows how to update view by using Require method with View entity that hase ArtifactID field filled.

int workspaceArtifactID = 1015427;
int existingViewArtifactID = 1024345;
int updatedOrder = 5;
FixedLengthTextField field = relativityFacade.Resolve<IFieldService>().Get<FixedLengthTextField>(workspaceArtifactID, "Control Number");
View viewToUpdate = new View
{
	ArtifactID = existingViewArtifactID,
	Name = "Test Existing View Name",
	Fields = new[] { new NamedArtifact { Name = field.Name, ArtifactID = field.ArtifactID } },
	Order = updatedOrder
}
View updatedView = _viewService.Require(workspaceArtifactID, viewToUpdate);

This shows how to update view by using Require method with View entity that hase Name field filled.

int workspaceArtifactID = 1015427;
int existingViewName = "Test Existing View Name",
int updatedOrder = 5;
FixedLengthTextField field = relativityFacade.Resolve<IFieldService>().Get<FixedLengthTextField>(workspaceArtifactID, "Control Number");
View viewToUpdate = new View
{
	Name = existingViewName
	Fields = new[] { new NamedArtifact { Name = field.Name, ArtifactID = field.ArtifactID } },
	Order = updatedOrder
}
View updatedView = _viewService.Require(workspaceArtifactID, viewToUpdate);

This shows how to create new view by using Require method with View entity that doesn't have ArtifactID field filled and Name that doesn't match any existing View.

int workspaceArtifactID = 1015427;
FixedLengthTextField field = relativityFacade.Resolve<IFieldService>().Get<FixedLengthTextField>(workspaceArtifactID, "Control Number");
View viewtoCreate = new View
{
	Name = "Test Not Existing View Name",
	Fields = new[] { new NamedArtifact { Name = field.Name, ArtifactID = field.ArtifactID } },
}
View createdView = _viewService.Require(workspaceArtifactID, viewtoCreate);
| Improve this Doc View Source

Update(Int32, View)

Updates the specified View.

Declaration
void Update(int workspaceArtifactID, View view)
Parameters
Type Name Description
System.Int32 workspaceArtifactID

The ArtifactID of the workspace where you want to update the view.

View view

The View to update.

Examples
int workspaceArtifactID = 1015427;
int existingViewArtifactID = 1024345;
View viewToUpdate = _viewService.Get(workspaceArtifactID, existingViewArtifactID);
viewToUpdate.Name = "Updated View Name";
viewToUpdate.Order = 345;
_viewService.Update(workspaceArtifactID, view);
  • Improve this Doc
  • View Source
In This Article
Back to top Generated by DocFX