Skip to content

Instantly share code, notes, and snippets.

@ArnisL
Created April 15, 2010 13:30
Show Gist options
  • Save ArnisL/367084 to your computer and use it in GitHub Desktop.
Save ArnisL/367084 to your computer and use it in GitHub Desktop.
/// <summary>
/// Validates that record is found in Aleph by GetDigitalObjectFromAleph method
/// or user has processed it.
/// Filters records which were not found in Aleph by GetDigitalObjectFromAleph method
/// and not processed by user.
/// </summary>
/// <param name="codeTableCode">The code table code.</param>
/// <param name="value">The value.</param>
/// <param name="elementId">The element id.</param>
/// <param name="elementName">Name of the element.</param>
private void CheckWheterRecordIsProcessed(string codeTableCode, string value, int elementId, string elementName)
{
#region Trace
DigitalObjectsTrace.Instance.TraceVerbose(
"CheckWheterRecordIsProcessed started\ncodeTableCode = {0} \nvalue = {1} \nelementId = {2} \nelementName = {3}",
codeTableCode == null ? "NULL" : codeTableCode,
value == null ? "NULL" : value,
elementId,
elementName == null ? "NULL" : elementName);
#endregion
if (string.IsNullOrEmpty(codeTableCode))
{
#region exception
DigitalObjectsTrace.Instance.TraceImportant(DigitalObjectsTraceId.DOM_ExtractingMetadata, DiBiTraceEventType.Error,
"Element '{0}' node in DigitalObjectVersion metadata XML contains value '{1}' with empty codeTableCode property. " +
"This means that AlephCodeValue is not found in ALEPH by GetDigitalObjectFromAleph method and " +
"user hasn't found it manually.",
elementName, value);
//TODO: Replace DefaultLanguageId with user UI language ID
string elementNameTranslation = DigitalObjectsHelper.ElementsManager.GetElementNameTranslation(elementId, elementName,
DigitalObjectsHelper.Configuration.DefaultLanguageId);
throw new ElementAlephCodeValueNotReadyForSaveException(elementNameTranslation, value);
#endregion
}
#region Trace
DigitalObjectsTrace.Instance.TraceVerbose(
"CheckWheterRecordIsProcessed completed \nelementId = {0} ",
elementId);
#endregion
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment