Search in sources :

Example 11 with JsonCollection

use of io.lumeer.api.dto.JsonCollection in project engine by Lumeer.

the class SuggestionFacadeIT method configure.

@Before
public void configure() {
    JsonOrganization organization = new JsonOrganization();
    organization.setCode(ORGANIZATION_CODE);
    organization.setPermissions(new JsonPermissions());
    Organization storedOrganization = organizationDao.createOrganization(organization);
    projectDao.setOrganization(storedOrganization);
    User user = new User(USER);
    userDao.createUser(user);
    JsonProject project = new JsonProject();
    project.setPermissions(new JsonPermissions());
    project.setCode(PROJECT_CODE);
    Project storedProject = projectDao.createProject(project);
    workspaceKeeper.setWorkspace(ORGANIZATION_CODE, PROJECT_CODE);
    collectionDao.setProject(storedProject);
    collectionDao.createCollectionsRepository(storedProject);
    linkTypeDao.setProject(storedProject);
    linkTypeDao.createLinkTypeRepository(storedProject);
    viewDao.setProject(storedProject);
    viewDao.createViewsRepository(storedProject);
    collectionIds.clear();
    for (String name : COLLECTION_NAMES) {
        JsonPermissions collectionPermissions = new JsonPermissions();
        collectionPermissions.updateUserPermissions(new JsonPermission(USER, Project.ROLES.stream().map(Role::toString).collect(Collectors.toSet())));
        JsonCollection jsonCollection = new JsonCollection(name, name, COLLECTION_ICON, COLLECTION_COLOR, collectionPermissions);
        jsonCollection.setDocumentsCount(0);
        collectionIds.add(collectionDao.createCollection(jsonCollection).getId());
    }
    for (String name : COLLECTION_NAMES_NO_RIGHTS) {
        JsonCollection jsonCollection = new JsonCollection(name, name, COLLECTION_ICON, COLLECTION_COLOR, new JsonPermissions());
        jsonCollection.setDocumentsCount(0);
        collectionIdsNoRights.add(collectionDao.createCollection(jsonCollection).getId());
    }
}
Also used : JsonProject(io.lumeer.api.dto.JsonProject) Project(io.lumeer.api.model.Project) JsonPermissions(io.lumeer.api.dto.JsonPermissions) Organization(io.lumeer.api.model.Organization) JsonOrganization(io.lumeer.api.dto.JsonOrganization) User(io.lumeer.api.model.User) AuthenticatedUser(io.lumeer.core.AuthenticatedUser) JsonOrganization(io.lumeer.api.dto.JsonOrganization) JsonPermission(io.lumeer.api.dto.JsonPermission) JsonCollection(io.lumeer.api.dto.JsonCollection) JsonProject(io.lumeer.api.dto.JsonProject) Before(org.junit.Before)

Example 12 with JsonCollection

use of io.lumeer.api.dto.JsonCollection in project engine by Lumeer.

the class DocumentServiceIT method configureCollection.

@Before
public void configureCollection() {
    JsonOrganization organization = new JsonOrganization();
    organization.setCode(ORGANIZATION_CODE);
    organization.setPermissions(new JsonPermissions());
    Organization storedOrganization = organizationDao.createOrganization(organization);
    projectDao.setOrganization(storedOrganization);
    User user = new User(USER);
    userDao.createUser(user);
    JsonProject project = new JsonProject();
    project.setCode(PROJECT_CODE);
    JsonPermissions projectPermissions = new JsonPermissions();
    projectPermissions.updateUserPermissions(new JsonPermission(USER, Project.ROLES.stream().map(Role::toString).collect(Collectors.toSet())));
    project.setPermissions(projectPermissions);
    Project storedProject = projectDao.createProject(project);
    collectionDao.setProject(storedProject);
    collectionDao.createCollectionsRepository(storedProject);
    JsonPermissions collectionPermissions = new JsonPermissions();
    collectionPermissions.updateUserPermissions(new JsonPermission(USER, Project.ROLES.stream().map(Role::toString).collect(Collectors.toSet())));
    JsonCollection jsonCollection = new JsonCollection(COLLECTION_CODE, COLLECTION_NAME, COLLECTION_ICON, COLLECTION_COLOR, collectionPermissions);
    collection = collectionDao.createCollection(jsonCollection);
    documentDao.setProject(storedProject);
}
Also used : JsonProject(io.lumeer.api.dto.JsonProject) Project(io.lumeer.api.model.Project) JsonPermissions(io.lumeer.api.dto.JsonPermissions) Organization(io.lumeer.api.model.Organization) JsonOrganization(io.lumeer.api.dto.JsonOrganization) User(io.lumeer.api.model.User) AuthenticatedUser(io.lumeer.core.AuthenticatedUser) JsonOrganization(io.lumeer.api.dto.JsonOrganization) JsonPermission(io.lumeer.api.dto.JsonPermission) JsonCollection(io.lumeer.api.dto.JsonCollection) JsonProject(io.lumeer.api.dto.JsonProject) Before(org.junit.Before)

Example 13 with JsonCollection

use of io.lumeer.api.dto.JsonCollection in project engine by Lumeer.

the class DocumentFacadeIT method configureCollection.

@Before
public void configureCollection() {
    JsonOrganization organization = new JsonOrganization();
    organization.setCode(ORGANIZATION_CODE);
    organization.setPermissions(new JsonPermissions());
    Organization storedOrganization = organizationDao.createOrganization(organization);
    projectDao.setOrganization(storedOrganization);
    User user = new User(USER);
    userDao.createUser(user);
    JsonProject project = new JsonProject();
    project.setCode(PROJECT_CODE);
    JsonPermissions projectPermissions = new JsonPermissions();
    projectPermissions.updateUserPermissions(new JsonPermission(USER, Project.ROLES.stream().map(Role::toString).collect(Collectors.toSet())));
    project.setPermissions(projectPermissions);
    Project storedProject = projectDao.createProject(project);
    workspaceKeeper.setWorkspace(ORGANIZATION_CODE, PROJECT_CODE);
    collectionDao.setProject(storedProject);
    collectionDao.createCollectionsRepository(storedProject);
    JsonPermissions collectionPermissions = new JsonPermissions();
    collectionPermissions.updateUserPermissions(new JsonPermission(USER, Project.ROLES.stream().map(Role::toString).collect(Collectors.toSet())));
    JsonCollection jsonCollection = new JsonCollection(null, COLLECTION_NAME, COLLECTION_ICON, COLLECTION_COLOR, collectionPermissions);
    jsonCollection.setDocumentsCount(0);
    collection = collectionDao.createCollection(jsonCollection);
}
Also used : JsonProject(io.lumeer.api.dto.JsonProject) Project(io.lumeer.api.model.Project) JsonPermissions(io.lumeer.api.dto.JsonPermissions) Organization(io.lumeer.api.model.Organization) JsonOrganization(io.lumeer.api.dto.JsonOrganization) User(io.lumeer.api.model.User) AuthenticatedUser(io.lumeer.core.AuthenticatedUser) JsonOrganization(io.lumeer.api.dto.JsonOrganization) JsonPermission(io.lumeer.api.dto.JsonPermission) JsonCollection(io.lumeer.api.dto.JsonCollection) JsonProject(io.lumeer.api.dto.JsonProject) Before(org.junit.Before)

Aggregations

JsonCollection (io.lumeer.api.dto.JsonCollection)13 JsonOrganization (io.lumeer.api.dto.JsonOrganization)9 JsonPermission (io.lumeer.api.dto.JsonPermission)9 JsonPermissions (io.lumeer.api.dto.JsonPermissions)9 JsonProject (io.lumeer.api.dto.JsonProject)9 Organization (io.lumeer.api.model.Organization)9 Project (io.lumeer.api.model.Project)9 User (io.lumeer.api.model.User)9 AuthenticatedUser (io.lumeer.core.AuthenticatedUser)9 Before (org.junit.Before)9 Collection (io.lumeer.api.model.Collection)5 Response (javax.ws.rs.core.Response)4 Test (org.junit.Test)4 LinkType (io.lumeer.api.model.LinkType)2 Entity (javax.ws.rs.client.Entity)2 SoftAssertions (org.assertj.core.api.SoftAssertions)2 JsonAttribute (io.lumeer.api.dto.JsonAttribute)1 Attribute (io.lumeer.api.model.Attribute)1 Pagination (io.lumeer.api.model.Pagination)1 Permission (io.lumeer.api.model.Permission)1