Beispiel #1
0
        private List <sc.ObjectType> ApplyFilterInObjectType(string filterValue, sc.ObjectType objectType)
        {
            List <sc.ObjectType> objectTypesAfterFilter = new List <sc.ObjectType>();
            IEnumerable <string> referenceIds           = objectType.GetReferenceTypesInString();

            foreach (string id in referenceIds)
            {
                ItemType            itemType   = this.systemCharacteristics.GetSystemDataByReferenceId(id);
                StateType           state      = this.GetStateById(filterValue);
                StateTypeComparator comparator = new StateTypeComparator(state, itemType, this.variables);
                if (!comparator.IsEquals())
                {
                    this.AddObjectTypeInList(objectType, objectTypesAfterFilter);
                }
            }
            return(objectTypesAfterFilter);
        }
Beispiel #2
0
        private SetResult ExecuteOperationForSetElement(set setElement, IEnumerable <sc.ObjectType> objectTypes)
        {
            sc.ObjectType        firstObjectType      = objectTypes.First();
            sc.ObjectType        secondObjectType     = null;
            IEnumerable <string> firstReferenceTypes  = firstObjectType.GetReferenceTypesInString();
            IEnumerable <string> secondReferenceTypes = new List <string>();
            FlagEnumeration      firstObjectFlag      = firstObjectType.flag;
            FlagEnumeration      secondObjectFlag     = FlagEnumeration.complete;

            if (objectTypes.Count() == MAX_NUMBER_OF_OBJECTS_IN_SET)
            {
                //the max number to the Object_Reference is 2 (reference: oval_definitions schema)
                secondObjectType     = objectTypes.ElementAt(1);
                secondReferenceTypes = secondObjectType.GetReferenceTypesInString();
                secondObjectFlag     = secondObjectType.flag;
            }
            SetOperation         operation  = this.GetOperation(setElement.set_operator);
            IEnumerable <string> results    = operation.Execute(firstReferenceTypes, secondReferenceTypes);
            FlagEnumeration      objectFlag = operation.GetObjectFlag(firstObjectFlag, secondObjectFlag);
            SetResult            result     = new SetResult(results, objectFlag);

            return(result);
        }