use of org.bimserver.models.store.Project in project BIMserver by opensourceBIM.
the class TestDatabase method checkLists.
private void checkLists() {
DatabaseSession session = database.createSession(OperationType.READ_WRITE);
long uoid = -1;
try {
Project p1 = session.create(Project.class);
p1.setName("p1");
Project p2 = session.create(Project.class);
p2.setName("p2");
User u1 = session.create(User.class);
uoid = u1.getOid();
p1.getHasAuthorizedUsers().add(u1);
p2.getHasAuthorizedUsers().add(u1);
session.commit();
} catch (BimserverDatabaseException e) {
e.printStackTrace();
} catch (ServiceException e) {
e.printStackTrace();
} finally {
session.close();
session = database.createSession(OperationType.READ_WRITE);
try {
User user = session.get(uoid, OldQuery.getDefault());
for (Project p : user.getHasRightsOn()) {
System.out.println(p.getName());
}
} catch (BimserverDatabaseException e) {
e.printStackTrace();
} finally {
session.close();
}
}
}
use of org.bimserver.models.store.Project in project BIMserver by opensourceBIM.
the class TestDatabase method create.
private void create() {
DatabaseSession session = database.createSession(OperationType.READ_WRITE);
try {
Project project = session.create(Project.class);
poid = project.getOid();
project.setName("testproject");
User user = session.create(User.class);
uoid = user.getOid();
user.setName("testuser");
project.getHasAuthorizedUsers().add(user);
session.commit();
} catch (BimserverDatabaseException e) {
e.printStackTrace();
} catch (ServiceException e) {
e.printStackTrace();
} finally {
session.close();
}
}
Aggregations