Exemplo n.º 1
0
 /// <summary>
 /// Convert a ishType to an enumeration value
 /// </summary>
 /// <param name="ishType">The folder type that needs to be converted.</param>
 /// <returns>eISHFolderType enumeration value.</returns>
 public static TResult ToIshType <TResult>(Enumerations.ISHType ishType)
 {
     if (!typeof(TResult).IsEnum)
     {
         throw new NotSupportedException("TResult must be an Enum");
     }
     return((TResult)Enum.Parse(typeof(TResult), ishType.ToString(), true));
 }
Exemplo n.º 2
0
 /// <summary>
 /// IshObject creation through an IshField can (I think?!!) be done if you explicitly list all fields.
 /// </summary>
 /// <remarks>IshObject is typically only returned from the repository through an xml container.</remarks>
 /// <param name="ishType">Type indication, like ISHOutputFormat, ISHLibrary,...</param>
 /// <param name="ishRef">An element name, not that for some types this will be overwritten with a generated one</param>
 /// <param name="ishFields">The functions down the line will extract the required ishfields for real object creation.</param>
 public IshObject(Enumerations.ISHType ishType, string ishRef, IshFields ishFields)
 {
     _ishType   = ishType;
     _ishRef    = (ishRef == null) ? "" : ishRef;
     _objectRef = new Dictionary <Enumerations.ReferenceType, string>();
     _ishFields = ishFields;
     _ishData   = null;
 }
Exemplo n.º 3
0
        /// <summary>
        /// Creates a management object to work with the ISHType and FieldDefinitions.
        /// </summary>
        public IshTypeFieldSetup(ILogger logger, string xmlIshFieldSetup)
        {
            _logger = logger;
            _ishTypeFieldDefinitions = new SortedDictionary <string, IshTypeFieldDefinition>();
            XmlDocument xmlDocument = new XmlDocument();

            xmlDocument.LoadXml(xmlIshFieldSetup);
            foreach (XmlNode xmlIshTypeDefinition in xmlDocument.SelectNodes("ishfieldsetup/ishtypedefinition"))
            {
                Enumerations.ISHType ishType = (Enumerations.ISHType)Enum.Parse(typeof(Enumerations.ISHType), xmlIshTypeDefinition.Attributes.GetNamedItem("name").Value);
                _logger.WriteDebug($"IshTypeFieldSetup ishType[{ishType}]");
                foreach (XmlNode xmlIshFieldDefinition in xmlIshTypeDefinition.SelectNodes("ishfielddefinition"))
                {
                    IshTypeFieldDefinition ishTypeFieldDefinition = new IshTypeFieldDefinition(_logger, ishType, (XmlElement)xmlIshFieldDefinition);
                    _ishTypeFieldDefinitions.Add(ishTypeFieldDefinition.Key, ishTypeFieldDefinition);
                }
            }
        }
Exemplo n.º 4
0
        /// <summary>
        /// IshObject creation through an ishobject xml element.
        /// Incoming is: <ishobject ishref="D1E1030" ishtype="ISHModule" ishlogicalref="26288" ishversionref="26291" ishlngref="39490" />
        /// </summary>
        /// <param name="xmlIshObject">One ishobject xml.</param>
        public IshObject(XmlElement xmlIshObject)
        {
            _ishType   = (Enumerations.ISHType)Enum.Parse(typeof(Enumerations.ISHType), xmlIshObject.Attributes["ishtype"].Value);
            _ishRef    = xmlIshObject.Attributes["ishref"].Value;
            _objectRef = new Dictionary <Enumerations.ReferenceType, string>();
            StringEnum stringEnum = new StringEnum(typeof(Enumerations.ReferenceType));

            // Loop all reference attributes present in the xml
            foreach (string refType in stringEnum.GetStringValues())
            {
                if (xmlIshObject.HasAttribute(refType))
                {
                    Enumerations.ReferenceType enumValue = (Enumerations.ReferenceType)StringEnum.Parse(typeof(Enumerations.ReferenceType), refType);
                    _objectRef.Add(enumValue, xmlIshObject.Attributes[refType].Value);
                }
            }
            _ishFields = new IshFields((XmlElement)xmlIshObject.SelectSingleNode("ishfields"));
            _ishData   = new IshData((XmlElement)xmlIshObject.SelectSingleNode("ishdata"));
        }
Exemplo n.º 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>();
 }
Exemplo n.º 6
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>();
 }
Exemplo n.º 7
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);
 }
Exemplo n.º 8
0
        /// <summary>
        /// IshTypeFieldDefinition creation through an xml element. See Settings25.RetrieveFieldSetupByIshType
        /// </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="xmlDef">One IshTypeFieldDefinition xml.</param>
        internal IshTypeFieldDefinition(ILogger logger, Enumerations.ISHType ishType, XmlElement xmlDef)
        {
            _logger       = logger;
            ISHType       = ishType;
            Level         = (Enumerations.Level)StringEnum.Parse(typeof(Enumerations.Level), xmlDef.Attributes["level"].Value);
            Name          = xmlDef.Attributes["name"].Value;
            IsMandatory   = Boolean.Parse(xmlDef.Attributes["ismandatory"].Value);
            IsMultiValue  = Boolean.Parse(xmlDef.Attributes["ismultivalue"].Value);
            AllowOnRead   = Boolean.Parse(xmlDef.Attributes["allowonread"].Value);
            AllowOnCreate = Boolean.Parse(xmlDef.Attributes["allowoncreate"].Value);
            AllowOnUpdate = Boolean.Parse(xmlDef.Attributes["allowonupdate"].Value);
            AllowOnSearch = Boolean.Parse(xmlDef.Attributes["allowonsearch"].Value);
            IsSystem      = Boolean.Parse(xmlDef.Attributes["issystem"].Value);
            IsBasic       = Boolean.Parse(xmlDef.Attributes["isbasic"].Value);
            IsDescriptive = Boolean.Parse(xmlDef.Attributes["isdescriptive"].Value);
            Label         = xmlDef.SelectSingleNode("label").InnerText;
            Description   = xmlDef.SelectSingleNode("description").InnerText;
            ReferenceLov  = "";
            ReferenceType = new List <Enumerations.ISHType>();

            string type = xmlDef.Attributes["type"].Value;

            switch (type)
            {
            case "ishreference":
                if (xmlDef.SelectSingleNode("ishreference/ishlov") != null)
                {
                    DataType     = Enumerations.DataType.ISHLov;
                    ReferenceLov = xmlDef.SelectSingleNode("ishreference/ishlov").Attributes["ishref"].Value;
                }
                else if (xmlDef.SelectSingleNode("ishreference") != null)
                {
                    DataType = Enumerations.DataType.ISHType;
                    foreach (XmlNode xmlNode in xmlDef.SelectSingleNode("ishreference").SelectNodes("ishtype"))
                    {
                        ReferenceType.Add((Enumerations.ISHType)Enum.Parse(typeof(Enumerations.ISHType), xmlNode.Attributes["ishref"].Value));
                    }
                }
                else
                {
                    DataType     = Enumerations.DataType.ISHLov;
                    ReferenceLov = "MISSINGISHREFERENCE1";
                }
                break;

            case "longtext":
                DataType = Enumerations.DataType.LongText;
                break;

            case "number":
                DataType = Enumerations.DataType.Number;
                break;

            case "datetime":
                DataType = Enumerations.DataType.DateTime;
                break;

            case "string":
                DataType = Enumerations.DataType.String;
                break;

            default:
                // something went wrong
                DataType     = Enumerations.DataType.ISHLov;
                ReferenceLov = "MISSINGISHREFERENCE2";
                break;
            }
        }