use of org.activityinfo.legacy.shared.model.SchemaDTO in project activityinfo by bedatadriven.
the class ProjectTest method constraintViolation.
@Test(expected = Exception.class)
public void constraintViolation() {
setUser(1);
SchemaDTO schema = execute(new GetSchema());
ProjectDTO project = schema.getProjectById(2);
project.setName(null);
execute(RequestChange.update(project, "name"));
}
use of org.activityinfo.legacy.shared.model.SchemaDTO in project activityinfo by bedatadriven.
the class ProjectTest method updateProject.
@Test
public void updateProject() {
setUser(1);
SchemaDTO schema = execute(new GetSchema());
ProjectDTO project = schema.getProjectById(2);
project.setName("RRMP II");
project.setDescription("RRMP The Next Generation");
execute(RequestChange.update(project, "name", "description"));
schema = execute(new GetSchema());
assertThat(schema.getProjectById(2).getName(), equalTo("RRMP II"));
assertThat(schema.getProjectById(2).getDescription(), equalTo("RRMP The Next Generation"));
project.setName("RRMP III");
project.setDescription(null);
execute(RequestChange.update(project, "name", "description"));
}
use of org.activityinfo.legacy.shared.model.SchemaDTO in project activityinfo by bedatadriven.
the class ProjectTest method deleteProject.
@Test
public void deleteProject() {
setUser(1);
long originalDatabaseVersion = lookupDbVersion(1);
int projectId = 2;
execute(RequestChange.delete("Project", projectId));
SchemaDTO schema = execute(new GetSchema());
assertThat(schema.getProjectById(projectId), nullValue());
// make sure it's gone from sites
Filter filter = new Filter();
filter.addRestriction(DimensionType.Activity, 1);
filter.addRestriction(DimensionType.Site, 3);
SiteResult sites = execute(new GetSites(filter));
assertThat(sites.getData().get(0).getProject(), is(nullValue()));
// and doesn't show up in pivoting...
PivotSites pivot = new PivotSites();
Dimension projectDimension = new Dimension(DimensionType.Project);
pivot.setDimensions(projectDimension);
pivot.setFilter(filter);
PivotResult buckets = execute(pivot);
assertThat(buckets.getBuckets().size(), equalTo(1));
assertThat(buckets.getBuckets().get(0).getCategory(projectDimension), is(nullValue()));
// make sure the version number of the database is updated
assertThat(lookupDbVersion(1), not(equalTo(originalDatabaseVersion)));
}
use of org.activityinfo.legacy.shared.model.SchemaDTO in project activityinfo by bedatadriven.
the class SiteGridPanel method updateHeading.
private void updateHeading(final Filter filter) {
setHeadingText(I18N.CONSTANTS.sitesHeader());
dispatcher.execute(new GetSchema(), new AsyncCallback<SchemaDTO>() {
@Override
public void onFailure(Throwable caught) {
// TODO Auto-generated method stub
}
@Override
public void onSuccess(SchemaDTO result) {
if (filter.isDimensionRestrictedToSingleCategory(DimensionType.Activity)) {
int activityId = filter.getRestrictedCategory(DimensionType.Activity);
ActivityDTO activity = result.getActivityById(activityId);
setHeadingText(activity.getDatabaseName() + " - " + activity.getName());
} else if (filter.isDimensionRestrictedToSingleCategory(DimensionType.Database)) {
int databaseId = filter.getRestrictedCategory(DimensionType.Database);
UserDatabaseDTO db = result.getDatabaseById(databaseId);
setHeadingText(db.getName());
}
}
});
}
Aggregations