コード例 #1
0
        public IEnumerable<ObjectType> CreateFileObjects(fileeffectiverights53_object objectType,
            IEnumerable<string> filepaths, IEnumerable<string> filenames, IEnumerable<string> paths, IEnumerable<string> trusteeSIDs)
        {
            List<ObjectType> fileEffectiveRightsObjects = new List<ObjectType>();
            if (!objectType.IsFilePathDefined())
                this.CreateFileObjectsWithoutFilePath(objectType, filenames, paths, trusteeSIDs, fileEffectiveRightsObjects);
            else
                this.CreateFileObjectsWithFilePath(objectType, filepaths, trusteeSIDs, fileEffectiveRightsObjects);

            return fileEffectiveRightsObjects;
        }
コード例 #2
0
        private ObjectType CreateObjectTypeFrom(fileeffectiverights53_object objectType, 
            string filepath, string filename, string path, string trusteeSID)
        {
            EntityObjectStringType filePathFrom = null;
            EntityObjectStringType pathFrom = null;
            EntityObjectStringType fileNameFrom = null;
            EntityObjectStringType newFilePath = null;
            EntityObjectStringType newPath = null;
            EntityObjectStringType newFileName = null;

            var trusteeSIDFrom = (EntityObjectStringType)objectType.GetItemValue(fileeffectiverights53_object_ItemsChoices.trustee_sid);
            var newTrusteeSID = this.CreateObjectStringTypeFrom(trusteeSIDFrom);
            newTrusteeSID.Value = string.IsNullOrEmpty(trusteeSID) ? newTrusteeSID.Value : trusteeSID;

            if (objectType.IsFilePathDefined())
            {
                filePathFrom = (EntityObjectStringType)objectType.GetItemValue(fileeffectiverights53_object_ItemsChoices.filepath);
                newFilePath = this.CreateObjectStringTypeFrom(filePathFrom);
                newFilePath.Value = string.IsNullOrEmpty(filepath) ? newFilePath.Value : filepath;
                return this.CreateFileObject(newFilePath, null, null, newTrusteeSID);
            }
            else
            {
                pathFrom = (EntityObjectStringType)objectType.GetItemValue(fileeffectiverights53_object_ItemsChoices.path);
                fileNameFrom = (EntityObjectStringType)objectType.GetItemValue(fileeffectiverights53_object_ItemsChoices.filename);
                
                newPath = this.CreateObjectStringTypeFrom(pathFrom);
                newPath.Value = string.IsNullOrEmpty(path) ? newPath.Value: path;

                var isNil = ((fileNameFrom == null) && filename.Trim().Equals(string.Empty));
                newFileName = this.CreateObjectStringTypeFrom(fileNameFrom, isNil);
                newFileName.Value = string.IsNullOrEmpty(filename) ? newFileName.Value : filename;
                
                return this.CreateFileObject(null, newFileName, newPath, newTrusteeSID);
            }

        }
        private void AssertCorrectnessOfFileEntities(fileeffectiverights53_object createdObjectType)
        {
            if (createdObjectType.IsFilePathDefined())
            {
                Assert.IsNull(createdObjectType.GetAllObjectEntities()[ConstantHelper.PathEntityName]);
                Assert.IsNull(createdObjectType.GetAllObjectEntities()[ConstantHelper.FilenameEntityName]); 
                return;
            }

            Assert.IsNull(createdObjectType.GetAllObjectEntities()[ConstantHelper.FilepathEntityName]);
        }
コード例 #4
0
        public IEnumerable<ItemType> ProcessOperation(fileeffectiverights53_object objectToCollect)
        {
            IEnumerable<string> filenames = null;
            IEnumerable<string> paths = null;

            var allEntities = objectToCollect.GetAllObjectEntities();
            var trusteeSID = ((EntityObjectStringType)objectToCollect.GetItemValue(fileeffectiverights53_object_ItemsChoices.trustee_sid)).Value;
            
            if (objectToCollect.IsFilePathDefined())
            {
                var filepath = this.GetDictionaryWithElement(fileeffectiverights53_object_ItemsChoices.filepath, allEntities);
                var filePathOperationResult = this.PathOperatorEvaluator.ProcessOperationFilePath(filepath);
                paths = filePathOperationResult.Paths;

                filenames = new List<String>();
                foreach (var completeFilepath in filePathOperationResult.FileNames)
                    ((List<String>)filenames).Add(System.IO.Path.GetFileName(completeFilepath));
            }
            else
            {
                paths = this.ProcessOperationsPaths(allEntities);
                filenames = this.ProcessOperationsFileNames(allEntities, paths);
            }

            var trusteeSIDNames = this.ProcessOperationsTrusteeSID(objectToCollect);
            return
                CreateFileEffectiveRightsItemTypeFactory()
                    .CreateFileItemTypesByCombinationOfEntitiesFrom(paths, filenames, trusteeSIDNames);
        }