Class ObjectBase
- Namespace
- ArcanaDevelopment.adTempus.Client
- Assembly
- ArcanaDevelopment.adTempus.Client.dll
Base class for most adTempus data objects.
public abstract class ObjectBase
- Inheritance
-
objectObjectBase
- Derived
Properties
ClassKeyName
The key name for the class.
public abstract string ClassKeyName { get; }
Property Value
- string
Remarks
This name the name used by adTempus to identify the class and is intended for programmatic use only. Use the ClassName for a user-friendly name.
ClassName
Returns a descriptive name for the class suitable for display to users.
public virtual string ClassName { get; }
Property Value
- string
Remarks
For example, "Job" or "Program Execution Task".
IsDependent
Indicates whether the object is a dependent of (owned by) another object
public virtual bool IsDependent { get; }
Property Value
- bool
Remarks
An independent object (IsDependent is false) is an object that can exist on its own without being part of another object. For example, Jobs, Job Groups, etc.
A dependent object (IsDependent is true) is a part of another object. For example, a JobStep cannot exist independently of a Job, so the JobStep is dependent.
Dependent objects cannot be directly fetched from the server: they are only fetched as part of the object they belong to. They also cannot be saved or deleted independently: they are automatically saved or deleted when the owning object is saved or deleted.
IsDirty
Indicates whether the object is dirty (modified or new since last save).
public bool IsDirty { get; protected set; }
Property Value
- bool
IsNew
Indicates whether the object is new (has never been saved).
public bool IsNew { get; }
Property Value
- bool
IsReadOnly
Indicates whether this object is read-only.
public virtual bool IsReadOnly { get; }
Property Value
- bool
Remarks
IsReadOnly is True if the DataContext to which the object belongs is read-only. Attempting to modify or delete an object marked read-only will produce a ReadOnlyException.
IsStub
Indicates whether the object is a stub.
public bool IsStub { get; }
Property Value
- bool
Remarks
A stub is an object that been only partially fetched from the server. If you call a method or property that requires data that has not been fetched, the API will automatically perform a full fetch of the object, and IsStub will change to False.
ParentObject
Get the parent of this object.
public virtual ADTObject ParentObject { get; }
Property Value
- ADTObject
The object that owns this object, or null if the object is not owned by another object or the owner has not been set.
Methods
BeginEdit()
Creates an undo snapshot for the object graph.
public Guid BeginEdit()
Returns
- Guid
- See Also
BeginEdit(UndoLevelAction)
Creates an undo snapshot and returns an UndoLevel object that is used to automatically commit or revert changes when it goes out of scope.
public UndoLevel BeginEdit(UndoLevelAction defaultAction)
Parameters
| Name | Type | Description |
|---|---|---|
defaultAction |
UndoLevelAction | The action to take when the UndoLevel object is disposed, if a Commit or Undo is not performed explicitly. |
Returns
Remarks
BeginEdit returns an UndoLevel object, which implements IDisposable. When
the UndoLevel object is disposed, it applies the defaultAction to the object
if the snapshot created by BeginEdit has not already been explicitly committed or discarded.
void EditAnObject(ObjectBase anObject)
{
using(anObject.BeginEdit(UndoLevelAction.Revert))
{
//...perform operations on the object.
anObject.CommitEdit(); //explicitly commit the changes.
} //when UndoLevel goes out of scope, nothing happens, because changes have already been committed.
using(anObject.BeginEdit(UndoLevelAction.Revert))
{
//...perform operations on the object.
//...No explicit Commit or Undo call.
} //when UndoLevel goes out of scope, the UndoLevel calls UndoEdit to revert the changes.
}
CheckForStub(string, string)
Checks to see if the facade is a stub, and attempts to fetch the full object if so.
protected virtual void CheckForStub(string className, string location)
Parameters
| Name | Type | Description |
|---|---|---|
className |
string | |
location |
string |
Remarks
A Facade that is not an ADTObject should never be a stub, so this method does nothing in ObjectBase. It is overridden in ADTObject to perform the necessary checks and retrieval.
CommitEdit()
Commits the current changes, discarding the latest undo snapshot.
public void CommitEdit()
Remarks
The changes are committed in memory only. They are not sent to the server until Save() is called on the object or its owner.
Exceptions
- InvalidOperationException
Thrown if there is no snapshot to revert to.
CommitEdit(Guid)
Commits the current changes, discarding the latest undo snapshot.
public bool CommitEdit(Guid snapshotID)
Parameters
| Name | Type | Description |
|---|---|---|
snapshotID |
Guid | The snapshot ID returned by BeginEdit(). |
Returns
- bool
Remarks
This method commits the changes only if the current snapshot matches the snapshotID. This
method can be used instead of CommitEdit() to guard against redundant calls to CommitEdit
or UndoEdit.
The changes are committed in memory only. They are not sent to the server until Save() is called on the object or its owner.
FindOwningObject()
Finds the current owner based on relations.
protected virtual ADTObject FindOwningObject()
Returns
Remarks
Called by ParentObject to get the parent.
GetDescription()
Gets a user-friendly description of the object.
public virtual string GetDescription()
Returns
- string
Remarks
This method returns a description that can be used to describe the object in lists, etc. For example, for a Job, GetDescription returns the job name. To include the class name (e.g., "Job"), use GetDescriptionWithClassName().
GetDescriptionWithClassName()
Gets a user-friendly description of the object, including the ClassName.
public virtual string GetDescriptionWithClassName()
Returns
- string
Remarks
This method returns the ClassName plus the GetDescription(), similar to
GetObjectDescription()
Gets a description of the object's key settings.
protected abstract string GetObjectDescription()
Returns
- string
Remarks
This method is called by GetDescription() to get a user-friendly description of the object (such as its key settings) for display to the user. The description should contain enough information to distinguish this object from others of the same class.
HideFieldValueInTextOutput(string)
Return true if the field's value should be hidden on comparison reports, object configuration reports, dataset projections
protected virtual bool HideFieldValueInTextOutput(string fieldName)
Parameters
| Name | Type | Description |
|---|---|---|
fieldName |
string |
Returns
- bool
OnEntityReloaded()
Called when the entity is reloaded from a DTO.
protected virtual void OnEntityReloaded()
OnNewEntity()
Called when a new entity is created.
protected virtual void OnNewEntity()
UndoEdit()
Reverts to the previous undo snapshot created by BeginEdit().
public void UndoEdit()
Exceptions
- InvalidOperationException
Thrown if there is no snapshot to revert to.
UndoEdit(Guid)
Discards the current changes, reverting to the latest undo snapshot.
public bool UndoEdit(Guid snapshotID)
Parameters
| Name | Type | Description |
|---|---|---|
snapshotID |
Guid | The snapshot ID returned by BeginEdit(). |
Returns
- bool
Remarks
This method reverts the changes only if the current snapshot matches the snapshotID. This
method can be used instead of UndoEdit() to guard against redundant calls to CommitEdit
or UndoEdit.
Note: This method cannot be used to revert to an arbitrary undo snapshot. If the specified snapshot is not at the top of the snapshot stack, the method returns False and no changes are reverted.
WriteToConfigurationReport(IADTObjectConfigurationReportWriter)
Writes the object and any contained objects to a configuration report
public virtual void WriteToConfigurationReport(IADTObjectConfigurationReportWriter reportBuilder)
Parameters
| Name | Type | Description |
|---|---|---|
reportBuilder |
IADTObjectConfigurationReportWriter | The report builder to write the object to. |