Exemple #1
0
        /// <summary>
        /// Retrieves a list of <see cref="IshField"/> using a filter.
        /// </summary>
        /// <param name="fieldName">The field name.</param>
        /// <param name="fieldLevel">The field level <see cref="Enumerations.Level"/>.</param>
        /// <param name="valueType">The value type <see cref="Enumerations.ValueType"/>.</param>
        /// <returns>An array of <see cref="IshField"/>.</returns>
        /// <remarks></remarks>
        public IshField[] Retrieve(string fieldName, Enumerations.Level fieldLevel, Enumerations.ValueType valueType)
        {
            List <IshField> returnFields = new List <IshField>();

            foreach (IshField ishField in _fields)
            {
                if ((ishField.Name == fieldName) && (ishField.Level == fieldLevel))
                {
                    if (ishField is IshMetadataField)
                    {
                        if (((IshMetadataField)ishField).ValueType == valueType)
                        {
                            returnFields.Add(ishField);
                        }
                    }
                    else if (ishField is IshMetadataFilterField)
                    {
                        if (((IshMetadataFilterField)ishField).ValueType == valueType)
                        {
                            returnFields.Add(ishField);
                        }
                    }
                    else
                    {
                        returnFields.Add(ishField);
                    }
                }
            }
            return(returnFields.ToArray());
        }
Exemple #2
0
 /// <summary>
 /// Retrieves the first occurance out of the list of matching IshFields
 /// </summary>
 /// <returns>The first <see cref="IshField"/> in the current list.</returns>
 public IshField RetrieveFirst(string fieldName, Enumerations.Level fieldLevel, Enumerations.ValueType valueType)
 {
     IshField[] ishFields = Retrieve(fieldName, fieldLevel, valueType);
     if ((ishFields != null) && (ishFields.Length > 0))
     {
         return(ishFields[0]);
     }
     return(null);
 }
Exemple #3
0
        /// <summary>
        /// Generates a new ishfields object where all fields only have requested field information (e.g. no Value, but ValueType if available)
        /// Remove all level entries that do not match the filter.
        /// </summary>
        /// <param name="filterFieldLevel">Level attribute that should be matched to be part of the result.</param>
        /// <returns>The current list of <see cref="IshFields"/>.</returns>
        public IshFields ToRequestedFields(Enumerations.Level filterFieldLevel)
        {
            IshFields returnFields = new IshFields();

            foreach (IshField ishField in _fields)
            {
                if (ishField.Level.Equals(filterFieldLevel))
                {
                    returnFields.AddField(ishField.ToRequestedMetadataField());
                }
            }
            return(returnFields);
        }
Exemple #4
0
        /// <summary>
        /// Retrieves the first occurance out of the list of matching IshFields; preferring Id over Element and then Value.
        /// So first Id '4484', if not present then Element 'VUSERADMIN', again if not present Value 'Admin'.
        /// </summary>
        /// <returns>The first <see cref="IshField"/> in the current list.</returns>
        public IshField RetrieveFirst(string fieldName, Enumerations.Level fieldLevel)
        {
            IshField ishField = RetrieveFirst(fieldName, fieldLevel, Enumerations.ValueType.Id);

            if (ishField == null)
            {
                ishField = RetrieveFirst(fieldName, fieldLevel, Enumerations.ValueType.Element);
            }
            if (ishField == null)
            {
                ishField = RetrieveFirst(fieldName, fieldLevel, Enumerations.ValueType.Value);
            }
            return(ishField);
        }
Exemple #5
0
 /// <summary>
 /// IshTypeFieldDefinition creation with the bare descriptive identifiers, defaulting values to AllowOnRead only
 /// </summary>
 /// <param name="logger">Instance of the ILogger interface to allow some logging although Write-* is not very thread-friendly.</param>
 /// <param name="ishType">Card type identifier</param>
 /// <param name="level">The level of the field on this ISHType (card type)</param>
 /// <param name="name">The name of the field</param>
 /// <param name="dataType">The field data type, indicating reference field or simple type</param>
 internal IshTypeFieldDefinition(ILogger logger, Enumerations.ISHType ishType, Enumerations.Level level, string name, Enumerations.DataType dataType)
 {
     _logger       = logger;
     ISHType       = ishType;
     Level         = level;
     Name          = name;
     DataType      = dataType;
     IsMandatory   = false;
     IsMultiValue  = false;
     AllowOnRead   = true;
     AllowOnCreate = false;
     AllowOnUpdate = false;
     AllowOnSearch = false;
     IsSystem      = false;
     IsBasic       = false;
     IsDescriptive = false;
     Label         = "";
     Description   = "";
     ReferenceLov  = "";
     ReferenceType = new List <Enumerations.ISHType>();
 }
Exemple #6
0
        /// <summary>
        /// Gets the value for a field.
        /// </summary>
        /// <param name="fieldName">The fieldname to get the value from.</param>
        /// <param name="fieldLevel">The fieldlevel (<see cref="Enumerations.Level"/>).</param>
        /// <param name="valueType">The valuetype (<see cref="Enumerations.ValueType"/>).</param>
        /// <returns></returns>
        public string GetFieldValue(string fieldName, Enumerations.Level fieldLevel, Enumerations.ValueType valueType)
        {
            if (_fields == null)
            {
                throw new InvalidOperationException("No fields are set.");
            }

            IshField field      = RetrieveFirst(fieldName, fieldLevel, valueType);
            string   fieldValue = string.Empty;

            if (field != null)
            {
                var filterField = field.ToMetadataFilterField() as IshMetadataFilterField;
                if (filterField == null)
                {
                    throw new InvalidOperationException("field.ToMetadataFilterField() is not IshMetadataFilterField");
                }

                fieldValue = filterField.Value;
            }
            return(fieldValue);
        }
Exemple #7
0
 /// <summary>
 /// IshTypeFieldDefinition creation with the full descriptive identifiers
 /// </summary>
 /// <param name="logger">Instance of the ILogger interface to allow some logging although Write-* is not very thread-friendly.</param>
 /// <param name="ishType">Card type identifier</param>
 /// <param name="level">The level of the field on this ISHType (card type)</param>
 /// <param name="isMandatory">Boolean attribute indicating whether the field is mandatory or not. </param>
 /// <param name="isMultiValue">Boolean attribute indicating whether the field can contain multiple values or not. </param>
 /// <param name="allowOnRead">Boolean attribute indicating whether the field can be passed as filter or passed as requested metadata to an API READ method (e.g. GetMetadata, RetrieveMetadata, Find,...). </param>
 /// <param name="allowOnCreate">Boolean attribute indicating whether the field can be set via metadata by an API CREATE method.  Note: Some fields(e.g.USERNAME) must be passed as a parameter to the CREATE method.So, although these fields are mandatory, they will have allowoncreate false! </param>
 /// <param name="allowOnUpdate">Boolean attribute indicating whether the field can be set via metadata by an API UPDATE method (e.g. SetMetadata, Update,...). </param>
 /// <param name="allowOnSearch">Boolean attribute indicating whether the field is part of the full text index and can be used as part of the search query. </param>
 /// <param name="isSystem">Boolean attribute indicating whether this field is part of the internal Content Manager business logic. </param>
 /// <param name="isBasic">Boolean attribute indicating whether this field is a basic field (e.g. FSTATUS) or a more advanced field (e.g. FISHSTATUSTYPE). </param>
 /// <param name="isDescriptive">Boolean attribute indicating whether this field is one of the fields that define an object. Note: These fields are also used by the internal Content Manager business code, therefore they don't require an extra call to the database when requested. </param>
 /// <param name="name">Name of the card field or the table column.</param>
 /// <param name="dataType">The field data type, indicating reference field or simple type</param>
 /// <param name="referenceLov">Lists the referenced list of values name (e.g. USERNAME or DBACKGROUNDTASKSTATUS)</param>
 /// <param name="description">Free text description, anything which can help an implementor</param>
 internal IshTypeFieldDefinition(ILogger logger, Enumerations.ISHType ishType, Enumerations.Level level,
                                 bool isMandatory, bool isMultiValue, bool allowOnRead, bool allowOnCreate, bool allowOnUpdate, bool allowOnSearch, bool isSystem, bool isBasic, bool isDescriptive,
                                 string name, Enumerations.DataType dataType, string referenceLov, string description)
 {
     _logger       = logger;
     ISHType       = ishType;
     Level         = level;
     Name          = name;
     DataType      = dataType;
     IsMandatory   = isMandatory;
     IsMultiValue  = isMultiValue;
     AllowOnRead   = allowOnRead;
     AllowOnCreate = allowOnCreate;
     AllowOnUpdate = allowOnUpdate;
     AllowOnSearch = allowOnSearch;
     IsSystem      = isSystem;
     IsBasic       = isBasic;
     IsDescriptive = isDescriptive;
     Label         = "";
     Description   = description;
     ReferenceLov  = referenceLov;
     ReferenceType = new List <Enumerations.ISHType>();
 }
Exemple #8
0
 /// <summary>
 /// Retrieves all occurances out of the list of IshFields
 /// </summary>
 /// <returns>An array of <see cref="IshFields"/>.</returns>
 public IshField[] Retrieve(string fieldName, Enumerations.Level fieldLevel)
 {
     return(Retrieve(fieldName, fieldLevel, Enumerations.ValueType.Value));
 }
Exemple #9
0
        /// <summary>
        /// Remove a field from the current list.
        /// </summary>
        /// <param name="fieldName">The name of the field.</param>
        /// <param name="fieldLevel">The level of the field (<see cref="Enumerations.Level"/>).</param>
        /// <param name="valueType">The type of the field (<see cref="Enumerations.ValueType"/>).</param>
        /// <returns>The current list of <see cref="IshFields"/>.</returns>
        public IshFields RemoveField(string fieldName, Enumerations.Level fieldLevel, Enumerations.ValueType valueType)
        {
            var compareField = new IshRequestedMetadataField(fieldName, fieldLevel, valueType);

            return(RemoveField(compareField));
        }
Exemple #10
0
 /// <summary>
 /// Unique descriptive identifier of an IshTypeFieldDefinition concatenating type, level (respecting log/version/lng), and field name
 /// </summary>
 internal static string Key(Enumerations.ISHType ishType, Enumerations.Level level, string fieldName)
 {
     return(ishType + "=" + (int)level + level + "=" + fieldName);
 }
Exemple #11
0
 /// <summary>
 /// Constructs a Get/Requested IshField
 /// </summary>
 public IshMetadataField(string fieldName, Enumerations.Level fieldLevel, Enumerations.ValueType valueType, string value)
     : base(fieldName, fieldLevel, valueType)
 {
     _value = value;
 }
Exemple #12
0
 /// <summary>
 /// Constructs a Set IshField
 /// </summary>
 public IshMetadataField(string fieldName, Enumerations.Level fieldLevel, string value)
     : base(fieldName, fieldLevel, Enumerations.ValueType.Value)
 {
     _value = (value == null) ? "" : value;
 }
Exemple #13
0
 /// <summary>
 /// Constructs a Set IshField
 /// </summary>
 public IshMetadataFilterField(string fieldName, Enumerations.Level fieldLevel, Enumerations.FilterOperator filterOperator, string value, Enumerations.ValueType valueType)
     : base(fieldName, fieldLevel, valueType)
 {
     _filterOperator = filterOperator;
     _value          = (value == null) ? "" : value;
 }
Exemple #14
0
 public IshField(string fieldName, Enumerations.Level fieldLevel, Enumerations.ValueType valueType)
 {
     _fieldName  = (fieldName == null) ? "" : fieldName;
     _fieldLevel = fieldLevel;
     _valueType  = valueType;
 }
Exemple #15
0
 protected IshField()
 {
     _fieldName  = "";
     _fieldLevel = Enumerations.Level.None;
     _valueType  = Enumerations.ValueType.Value;
 }
 /// <summary>
 /// Constructs a Set IshField
 /// </summary>
 public IshRequestedMetadataField(string fieldName, Enumerations.Level fieldLevel, Enumerations.ValueType valueType)
     : base(fieldName, fieldLevel, valueType)
 {
 }