public IEnumerable<ObjectType> CreateObjectTypeByCombinationOfEntities(fileeffectiverights_object fileEffectiveRights,IEnumerable<string> paths, IEnumerable<string> fileNames, IEnumerable<string> trustee_names)
        {
            List<ObjectType> fileEffectiveRightsObjects = new List<ObjectType>();

            foreach (string path in paths)
            {
                foreach (string fileName in fileNames)
                    foreach (string trustee_name in trustee_names)
                        fileEffectiveRightsObjects.Add(this.CreateObjectTypeFrom(fileEffectiveRights, path, fileName, trustee_name));
            }

            return fileEffectiveRightsObjects;
        }
        public IEnumerable<ItemType> ProcessOperation(fileeffectiverights_object fileEffectiveRights)
        {
            Dictionary<String, EntityObjectStringType> entities = OvalHelper.GetFileEffectiveRightsFromObjectType(fileEffectiveRights);

            IEnumerable<string> paths = this.processOperationPath(entities);
            IEnumerable<string> fileNames = this.processOperationFileName(entities, paths);
            IEnumerable<string> trustNames = this.processOperationTrustName(entities);

            var fileEffectiveRightsItemTypeFactory = 
                new FileEffectiveRightsItemTypeFactory(
                    SourceObjectTypes.FileEffectiveRights, (FileEffectiveRightsObjectCollector)systemDataSource);
            return fileEffectiveRightsItemTypeFactory.CreateFileItemTypesByCombinationOfEntitiesFrom(paths, fileNames, trustNames);
        }
        private ObjectType CreateObjectTypeFrom(fileeffectiverights_object fileEffectiveRights, string path, string fileName, string trustee_name)
        {
            EntityObjectStringType fileNameFrom = (EntityObjectStringType)fileEffectiveRights.GetItemValue(fileeffectiverights_object_ItemsChoices.filename);
            EntityObjectStringType pathFrom = (EntityObjectStringType)fileEffectiveRights.GetItemValue(fileeffectiverights_object_ItemsChoices.path);
            EntityObjectStringType trustee_nameFrom = (EntityObjectStringType)fileEffectiveRights.GetItemValue(fileeffectiverights_object_ItemsChoices.trustee_name);

            EntityObjectStringType newFileName = entityBaseTypeFactory.CreateEntityBasedOn<EntityObjectStringType>(fileNameFrom);
            newFileName.Value = !string.IsNullOrEmpty(fileName) ? fileName : newFileName.Value;
            EntityObjectStringType newPath = entityBaseTypeFactory.CreateEntityBasedOn<EntityObjectStringType>(pathFrom);
            newPath.Value = !string.IsNullOrEmpty(path) ? path : newPath.Value;
            EntityObjectStringType newTrustee_name = entityBaseTypeFactory.CreateEntityBasedOn<EntityObjectStringType>(trustee_nameFrom);
            newTrustee_name.Value = !string.IsNullOrEmpty(trustee_name) ? trustee_name : newTrustee_name.Value;

            return this.CreateFileEffectiveRights(newFileName, newPath, newTrustee_name);

        }
        private bool IsVariablesWasProcessed(fileeffectiverights_object fileEffectiveRights,IEnumerable<string> fileNames, IEnumerable<string> paths, IEnumerable<string> trustee_names)
        {
            EntitySimpleBaseType path = (EntitySimpleBaseType)fileEffectiveRights.GetItemValue(fileeffectiverights_object_ItemsChoices.path);
            EntitySimpleBaseType fileName = (EntitySimpleBaseType)fileEffectiveRights.GetItemValue(fileeffectiverights_object_ItemsChoices.filename);
            EntitySimpleBaseType trustee_name = (EntitySimpleBaseType)fileEffectiveRights.GetItemValue(fileeffectiverights_object_ItemsChoices.trustee_name);
            bool result = true;
            if (!string.IsNullOrEmpty(path.var_ref))
                result = result && ((paths.Count() > 0) && (!string.IsNullOrEmpty(paths.First())));
            
            if (!string.IsNullOrEmpty(fileName.var_ref))
                result = result && ((fileNames.Count() > 0) && (!string.IsNullOrEmpty(fileNames.First())));
            
            if (!string.IsNullOrEmpty(trustee_name.var_ref)) 
                result = result && ((trustee_names.Count() > 0) && (!string.IsNullOrEmpty(trustee_names.First())));

            return result;
        }
        private ObjectType CreateFileEffectiveRights(EntityObjectStringType newFileName, EntityObjectStringType newPath, EntityObjectStringType newTrustee_name)
        {
            List<EntityObjectStringType> items = new List<EntityObjectStringType>();
            List<fileeffectiverights_object_ItemsChoices> choices = new List<fileeffectiverights_object_ItemsChoices>();

            items.Add(newFileName);
            choices.Add(fileeffectiverights_object_ItemsChoices.filename);
            items.Add(newPath);
            choices.Add(fileeffectiverights_object_ItemsChoices.path);
            items.Add(newTrustee_name);
            choices.Add(fileeffectiverights_object_ItemsChoices.trustee_name);

            fileeffectiverights_object newFileEffectiveRights = new fileeffectiverights_object();
            newFileEffectiveRights.Items = items.ToArray();
            newFileEffectiveRights.FileeffectiverightsObjectItemsElementName = choices.ToArray();

            return newFileEffectiveRights;
        }
示例#6
0
        public static Dictionary<String, EntityObjectStringType> GetFileEffectiveRightsFromObjectType(fileeffectiverights_object fileEffectiveRightsObject)
        {
            string fileNameEntityName = fileeffectiverights_object_ItemsChoices.filename.ToString();
            string pathEntityName = fileeffectiverights_object_ItemsChoices.path.ToString();
            string trusteeEntityName = fileeffectiverights_object_ItemsChoices.trustee_name.ToString();

            object[] allEntities = fileEffectiveRightsObject.Items.ToArray();
            string[] allEntityNames = fileEffectiveRightsObject.FileeffectiverightsObjectItemsElementName.Select(i => i.ToString()).ToArray<String>();

            Dictionary<String, EntityObjectStringType> fileEntities = new Dictionary<String, EntityObjectStringType>();
            fileEntities.Add(fileNameEntityName, OvalHelper.GetEntityObjectByName(fileNameEntityName, allEntities, allEntityNames));
            fileEntities.Add(pathEntityName, OvalHelper.GetEntityObjectByName(pathEntityName, allEntities, allEntityNames));
            fileEntities.Add(trusteeEntityName, OvalHelper.GetEntityObjectByName(trusteeEntityName, allEntities, allEntityNames));

            return fileEntities;
        }
 private IEnumerable<string> processVariablesFromEntity(fileeffectiverights_object fileEffectiveRights,fileeffectiverights_object_ItemsChoices itemChoice)
 {
     List<string> values = new List<string>();
     EntityObjectStringType entity = (EntityObjectStringType)fileEffectiveRights.GetItemValue(itemChoice);
     if (entity != null)
     {
         values.AddRange(this.processVariableForEntity(entity));
     }
     return values;
 }