コード例 #1
0
        internal static WsModel GetWs(string wsId, out IManWorkspace imWsOut, WsLoadType wsLoadType = WsLoadType.ALL, bool newSession = false, bool isAdmin = false)
        {
            IManWorkspace imWs = null;

            //imWs = WsUtility.GetObjectByID<IManWorkspace>(wsId, newSession);
            imWs = WsUtility.GetObjectByID_New <IManWorkspace>(wsId, true, isAdmin);

            imWsOut = imWs;

            if (imWs == null)
            {
                return(null);
            }

            //var wsModel = (new WsModel
            //{
            //    IsLoaded = wsLoadType != WsLoadType.None,
            //    Description = imWs.Description,
            //    Name = imWs.Name,
            //    ObjectID = imWs.ObjectID,
            //    Owner = WsUtility.GetWsUser(imWs.Owner),
            //    SubType = imWs.SubType,
            //    WorkspaceID = imWs.WorkspaceID,

            //    WsProfile = WsUtility.ToLoad(wsLoadType, WsComponentType.Profile) ? GetWsProfile(imWs.Profile, imWs) : null,
            //    WsFldrs = WsUtility.ToLoad(wsLoadType, WsComponentType.Fldrs) ? GetWsFldrs(imWs.SubFolders, string.Empty, isAdmin) : null,
            //    WsGroups = WsUtility.ToLoad(wsLoadType, WsComponentType.Groups) ? GetSecurity(imWs.Security) : null
            //});

            var wsModel = (new WsModel
            {
                IsLoaded = wsLoadType != WsLoadType.None,
                Description = imWs.Description,
                Name = imWs.Name,
                ObjectID = imWs.ObjectID,
                Owner = WsUtility.GetWsUser(imWs.Owner),
                SubType = imWs.SubType,
                WorkspaceID = imWs.WorkspaceID,

                //WsProfile = WsUtility.ToLoad(wsLoadType, WsComponentType.Profile) ? GetWsProfile(imWs.Profile, imWs) : null,
                //WsFldrs = WsUtility.ToLoad(wsLoadType, WsComponentType.Fldrs) ? GetWsFldrs(imWs.SubFolders, string.Empty, isAdmin) : null,
                //WsGroups = WsUtility.ToLoad(wsLoadType, WsComponentType.Groups) ? GetSecurity(imWs.Security) : null
            });

            wsModel.WsProfile = WsUtility.ToLoad(wsLoadType, WsComponentType.Profile) ? GetWsProfile(imWs.Profile, imWs) : null;
            wsModel.WsFldrs   = WsUtility.ToLoad(wsLoadType, WsComponentType.Fldrs) ? GetWsFldrs(imWs.SubFolders, string.Empty, isAdmin) : null;
            wsModel.WsGroups  = WsUtility.ToLoad(wsLoadType, WsComponentType.Groups) ? GetSecurity(imWs.Security) : null;

            return(wsModel);
        }