Search in sources :

Example 1 with SProjectSmall

use of org.bimserver.interfaces.objects.SProjectSmall in project BIMserver by opensourceBIM.

the class GetAllProjectsSmallDatabaseAction method execute.

@Override
public List<SProjectSmall> execute() throws UserException, BimserverLockConflictException, BimserverDatabaseException {
    List<SProjectSmall> list = new ArrayList<SProjectSmall>();
    User user = getUserByUoid(authorization.getUoid());
    IfcModelInterface model = getDatabaseSession().getAllOfType(StorePackage.eINSTANCE.getProject(), OldQuery.getDefault());
    List<Project> projects = model.getAll(Project.class);
    for (Project project : projects) {
        if (project.getParent() == null && !project.getName().equals(Database.STORE_PROJECT_NAME)) {
            Project rootProject = getRootProject(project);
            addProjects(list, rootProject, user);
        }
    }
    return list;
}
Also used : Project(org.bimserver.models.store.Project) User(org.bimserver.models.store.User) IfcModelInterface(org.bimserver.emf.IfcModelInterface) ArrayList(java.util.ArrayList) SProjectSmall(org.bimserver.interfaces.objects.SProjectSmall)

Example 2 with SProjectSmall

use of org.bimserver.interfaces.objects.SProjectSmall in project BIMserver by opensourceBIM.

the class GetAllRelatedProjectsDatabaseAction method execute.

@Override
public List<SProjectSmall> execute() throws UserException, BimserverLockConflictException, BimserverDatabaseException {
    List<SProjectSmall> list = new ArrayList<SProjectSmall>();
    Project project = getDatabaseSession().get(StorePackage.eINSTANCE.getProject(), poid, OldQuery.getDefault());
    Project rootProject = getRootProject(project);
    User user = getUserByUoid(authorization.getUoid());
    addProjects(list, rootProject, user);
    return list;
}
Also used : Project(org.bimserver.models.store.Project) User(org.bimserver.models.store.User) ArrayList(java.util.ArrayList) SProjectSmall(org.bimserver.interfaces.objects.SProjectSmall)

Example 3 with SProjectSmall

use of org.bimserver.interfaces.objects.SProjectSmall in project BIMserver by opensourceBIM.

the class GetAllProjectsSmallDatabaseAction method createSmallProject.

public static SProjectSmall createSmallProject(Authorization authorization, BimServer bimServer, Project project, User user) {
    SProjectSmall small = new SProjectSmall();
    small.setName(project.getName());
    small.setOid(project.getOid());
    small.setLastRevisionId(project.getLastRevision() == null ? -1 : project.getLastRevision().getOid());
    small.setNrRevisions(project.getRevisions().size());
    small.setSchema(project.getSchema());
    small.setNrSubProjects(project.getSubProjects().size());
    small.setHasCheckinRights(authorization.hasRightsOnProject(user, project));
    small.setState(bimServer.getSConverter().convertToSObject(project.getState()));
    small.setParentId(project.getParent() == null ? -1 : project.getParent().getOid());
    return small;
}
Also used : SProjectSmall(org.bimserver.interfaces.objects.SProjectSmall)

Aggregations

SProjectSmall (org.bimserver.interfaces.objects.SProjectSmall)3 ArrayList (java.util.ArrayList)2 Project (org.bimserver.models.store.Project)2 User (org.bimserver.models.store.User)2 IfcModelInterface (org.bimserver.emf.IfcModelInterface)1