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));
        }
Ejemplo n.º 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));
            }
        }