//1) can userId create application? anyone for now //2) what containerTypes are supported? just group containers for now //3) containerId is the group Guid, or any other application that has a nodeId //4) configurationDatabase is the properties set in the panel used to create the application public IApplication Create(int userId, Guid containerTypeId, Guid containerId, ConfigurationDataBase createConfigurationData) { try { foreach (Guid _containerTypeId in ContainerTypes) { //container types for groups is if (Apis.Get <IGroups>().ContainerTypeId == _containerTypeId) { int groupId = Apis.Get <IGroups>().Get(containerId).Id.Value; InternalApi.CoriaMapBook coriaMapBook = new InternalApi.CoriaMapBook(); coriaMapBook.ApplicationId = Guid.NewGuid(); coriaMapBook.ApplicationTypeId = CoriaMapBookType._applicationTypeId; coriaMapBook.AvatarUrl = createConfigurationData.GetStringValue("mapBookAvatarUrl", "/cfs-filesystemfile/__key/system/images/grid.svg"); coriaMapBook.Name = createConfigurationData.GetStringValue("mapBookName", "Map Book"); coriaMapBook.GroupId = groupId; coriaMapBook.IsEnabled = createConfigurationData.GetBoolValue("mapBookIsEnabled", true); coriaMapBook.Id = 0; coriaMapBook.OntologyId = 0; coriaMapBook.Description = createConfigurationData.GetStringValue("mapBookDesc", "a list of maps"); coriaMapBook.Url = createConfigurationData.GetStringValue("mapBookUrl", "mapbooks"); coriaMapBook.SafeName = createConfigurationData.GetStringValue("safeNameUrl", coriaMapBook.ApplicationId.ToString()); //coriaMapBook.SafeName = createConfigurationData.GetStringValue("mapBookUrl", "mapbook"); coriaMapBook = InternalApi.CoriaDataService.CreateUpdateMapBook(coriaMapBook); return(PublicApi.MapBooks.Get(coriaMapBook.Id)); } if (Apis.Get <IUsers>().ContainerTypeId == _containerTypeId) { //TODO: implement user's map applications return(null); } } } catch (Exception ex) { //IUserRenderableException. string exceptions = ex.Message; throw; } return(null); }
public static PagedList <Map> List(int groupId, string mapbooksafename, MapsListOptions query) { if (mapbooksafename == null) { return(null); } int pageIndex = query.PageIndex < 1 ? 0 : query.PageIndex; int pageSize = query.PageSize >= 10 ? query.PageSize : 10; string sortBy = query.SortBy; string sortOrder = query.SortOrder;// ? query.SortOrder : Entity.SortOrder.Ascending; //new InternalApi.CoriaMapBook(InternalApi.CoriaDataService.(groupId, mapbooksafename, "")); InternalApi.CoriaMapBook mapbook = InternalApi.CoriaDataService.GetCoriaMapBookByGroupId_MapBookName(groupId, mapbooksafename); PagedList <InternalApi.CoriaMap> map = InternalApi.CoriaDataService.CoriaMapPagedList(mapbook, pageIndex, pageSize, sortBy, sortOrder); return(new PagedList <PublicApi.Map>( map.Select(s => new Map(s)), map.PageIndex, map.PageSize, map.TotalCount)); }
internal MapBook(InternalApi.CoriaMapBook mapbook) : base() { _mapbook = mapbook; }