Interface IObjectTypeService
Represents the object type API service.
Namespace: Relativity.Testing.Framework.Api.Services
Assembly: Relativity.Testing.Framework.Api.dll
Syntax
public interface IObjectTypeService
Examples
IObjectTypeService _objectTypeService = relativityFacade.Resolve<IObjectTypeService>();
Methods
| Improve this Doc View SourceCreate(Int32, ObjectType)
Creates the specified ObjectType.
Declaration
ObjectType Create(int workspaceId, ObjectType entity)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | workspaceId | The ArtifactID of the workspace where you want to add the new ObjectType, or use -1 to indicate the admin-level context. |
ObjectType | entity | The ObjectType to create. |
Returns
Type | Description |
---|---|
ObjectType | The created ObjectType. |
Examples
This example shows how to create new Object Type without providing any additional properties.
int workspaceArtifactID = 1015427;
var objectTypeToCreate = new ObjectType();
ObjectType createdObjectType = _objectTypeService.Create(workspaceArtifactID, objectTypeToCreate);
This example shows how to create new Object Type with some not required properties set and using "Document" object type template.
int workspaceArtifactID = 1015427;
ObjectType template = relativityFacade.Resolve<IGetWorkspaceEntityByNameStrategy<ObjectType>>().Get(workspaceArtifactID, "Document");
var objectTypeToCreate = new ObjectType
{
ParentObjectType = new ObjectType.WrappedObjectType { Value = template },
Name = "Object Type Name",
CopyInstancesOnParentCopy = true,
CopyInstancesOnCaseCreation = true,
EnableSnapshotAuditingOnDelete = true,
PersistentListsEnabled = true,
PivotEnabled = true,
SamplingEnabled = true
}
ObjectType createdObjectType = _objectTypeService.Create(workspaceArtifactID, objectTypeToCreate);
|
Improve this Doc
View Source
Delete(Int32, Int32)
Deletes the ObjectType by ArtifactID.
Declaration
void Delete(int workspaceId, int entityId)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | workspaceId | The ArtifactID of the workspace where you want to delete the ObjectType, or use -1 to indicate the admin-level context. |
System.Int32 | entityId | The ArtifactID of the ObjectType. |
Examples
int workspaceArtifactID = 1015427;
int existingObjectTypeArtifactID = 1016786;
_objectTypeService.Delete(workspaceArtifactID, existingObjectTypeArtifactID);
|
Improve this Doc
View Source
Get(Int32, Int32)
Gets the ObjectType by the specified ArtifactID.
Declaration
ObjectType Get(int workspaceId, int entityId)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | workspaceId | The ArtifactID of the workspace where you want to get the ObjectType, or use -1 to indicate the admin-level context. |
System.Int32 | entityId | The ArtifactID of the ObjectType. |
Returns
Type | Description |
---|---|
ObjectType | The ObjectType entity or null. |
Examples
int workspaceArtifactID = 1015427;
int existingObjectTypeArtifactID = 1016786;
ObjectType objectType = _objectTypeService.Get(workspaceArtifactID, existingObjectTypeArtifactID);
|
Improve this Doc
View Source
Get(Int32, String)
Gets the ObjectType by the specified name.
Declaration
ObjectType Get(int workspaceId, string entityName)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | workspaceId | The ArtifactID of the workspace where you want to get the ObjectType, or use -1 to indicate the admin-level context. |
System.String | entityName | The name of the ObjectType. |
Returns
Type | Description |
---|---|
ObjectType | The ObjectType entity or null. |
Examples
int workspaceArtifactID = 1015427;
int existingObjectTypeName = "Existing Object Type Name";
ObjectType objectType = _objectTypeService.Get(workspaceArtifactID, existingObjectTypeArtifactID);
|
Improve this Doc
View Source
GetAvailableParentObjectTypes(Int32)
Gets a list of all ObjectTypes available to be a parent ObjectType for a given workspace.
Declaration
List<ObjectType> GetAvailableParentObjectTypes(int workspaceId)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | workspaceId | The ArtifactID of the workspace to view all the available parent ObjectType. Use -1 to indicate the admin workspace. |
Returns
Type | Description |
---|---|
System.Collections.Generic.List<ObjectType> | All ObjectTypes available to be parents in a workspace. |
Examples
int workspaceArtifactID = 1015427;
List<ObjectType> availableParentObjectTypes = _objectTypeService.GetDependencies(workspaceArtifactID);
|
Improve this Doc
View Source
GetDependencies(Int32, Int32)
Gets the list of dependencies.
Declaration
List<Dependency> GetDependencies(int workspaceId, int entityId)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | workspaceId | The workspace ArtifactID. |
System.Int32 | entityId | The ArtifactID of the ObjectType. |
Returns
Type | Description |
---|---|
System.Collections.Generic.List<Dependency> | The list of dependencies. |
Examples
int workspaceArtifactID = 1015427;
int existingObjectTypeArtifactID = 1016786;
List<Dependency> dependencies = _objectTypeService.GetDependencies(workspaceArtifactID, existingObjectTypeArtifactID);
|
Improve this Doc
View Source
Require(Int32, ObjectType)
Requires the specified ObjectType.
- 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 [ObjectType](https://relativitydev.github.io/relativity.testing.framework/api/Relativity.Testing.Framework.Models.ObjectType.html) 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 [ObjectType](https://relativitydev.github.io/relativity.testing.framework/api/Relativity.Testing.Framework.Models.ObjectType.html) by name and updates it if it exists. - Otherwise creates a new [ObjectType](https://relativitydev.github.io/relativity.testing.framework/api/Relativity.Testing.Framework.Models.ObjectType.html).
Declaration
ObjectType Require(int workspaceId, ObjectType entity)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | workspaceId | The ArtifactID of the workspace where you want to require ObjectType, or use -1 to indicate the admin-level context. |
ObjectType | entity | The ObjectType to require. |
Returns
Type | Description |
---|---|
ObjectType | The ObjectType required. |
Examples
This example shows how to create new Object Type using Require method.
int workspaceArtifactID = 1015427;
var objectTypeToCreate = new ObjectType();
ObjectType createdObjectType = _objectTypeService.Require(workspaceArtifactID, objectTypeToCreate);
This example shows how to update and get Object Type by providing object type entity that has ArtifactID property filled.
int workspaceArtifactID = 1015427;
int existingObjectTypeArtifactID = 1016786;
var objectTypeToUpdate = new ObjectType
{
ArtifactID = existingObjectTypeArtifactID,
Name = "Updated Object Type Name",
SamplingEnabled = false
}
ObjectType updatedObjectType = _objectTypeService.Require(workspaceArtifactID, objectTypeToUpdate);
This example shows how to update and get Object Type by providing object type entity that has Name property filled.
int workspaceArtifactID = 1015427;
var objectTypeToUpdate = new ObjectType
{
Name = "Existing Object Type Name",
SamplingEnabled = false,
PersistentListsEnabled = true,
CopyInstancesOnParentCopy = true
}
ObjectType updatedObjectType = _objectTypeService.Require(workspaceArtifactID, objectTypeToUpdate);
|
Improve this Doc
View Source
Update(Int32, ObjectType)
Updates the specified ObjectType.
Declaration
void Update(int workspaceId, ObjectType entity)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | workspaceId | The ArtifactID of the workspace where you want to update the ObjectType, or use -1 to indicate the admin-level context. |
ObjectType | entity | The ObjectType to update. |
Examples
int workspaceArtifactID = 1015427;
int existingObjectTypeArtifactID = 1016786;
ObjectType objectTypeToUpdate = _objectTypeService.Get(workspaceArtifactID, existingObjectTypeArtifactID);
objectTypeToUpdate.Name = "Updated Object Type Name";
objectTypeToUpdate.PivotEnabled = true;
objectTypeToUpdate.EnableSnapshotAuditingOnDelete = true;
_objectTypeService.Update(workspaceArtifactID, objectTypeToUpdate);