Search in sources :

Example 41 with GetSchema

use of org.activityinfo.legacy.shared.command.GetSchema in project activityinfo by bedatadriven.

the class PartnerTest method testAddNewPartner.

@Test
public void testAddNewPartner() throws Exception {
    PartnerDTO newPartner = new PartnerDTO();
    newPartner.setName("VDE");
    newPartner.setFullName("Vision d'Espoir");
    CreateResult cr = execute(new UpdatePartner(1, newPartner));
    SchemaDTO schema = execute(new GetSchema());
    PartnerDTO partner = schema.getDatabaseById(1).getPartnerById(cr.getNewId());
    Assert.assertNotNull(partner);
    Assert.assertEquals("VDE", partner.getName());
    Assert.assertEquals("Vision d'Espoir", partner.getFullName());
}
Also used : PartnerDTO(org.activityinfo.legacy.shared.model.PartnerDTO) CreateResult(org.activityinfo.legacy.shared.command.result.CreateResult) DuplicateCreateResult(org.activityinfo.legacy.shared.command.result.DuplicateCreateResult) SchemaDTO(org.activityinfo.legacy.shared.model.SchemaDTO) GetSchema(org.activityinfo.legacy.shared.command.GetSchema) UpdatePartner(org.activityinfo.legacy.shared.command.UpdatePartner) Test(org.junit.Test)

Example 42 with GetSchema

use of org.activityinfo.legacy.shared.command.GetSchema 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());
            }
        }
    });
}
Also used : UserDatabaseDTO(org.activityinfo.legacy.shared.model.UserDatabaseDTO) ActivityDTO(org.activityinfo.legacy.shared.model.ActivityDTO) GetSchema(org.activityinfo.legacy.shared.command.GetSchema) SchemaDTO(org.activityinfo.legacy.shared.model.SchemaDTO)

Aggregations

GetSchema (org.activityinfo.legacy.shared.command.GetSchema)42 Test (org.junit.Test)27 SchemaDTO (org.activityinfo.legacy.shared.model.SchemaDTO)22 UserDatabaseDTO (org.activityinfo.legacy.shared.model.UserDatabaseDTO)11 AsyncCallback (com.google.gwt.user.client.rpc.AsyncCallback)9 CreateResult (org.activityinfo.legacy.shared.command.result.CreateResult)7 GetActivityForm (org.activityinfo.legacy.shared.command.GetActivityForm)6 CreateEntity (org.activityinfo.legacy.shared.command.CreateEntity)4 UpdatePartner (org.activityinfo.legacy.shared.command.UpdatePartner)4 ActivityDTO (org.activityinfo.legacy.shared.model.ActivityDTO)4 CloneDatabase (org.activityinfo.legacy.shared.command.CloneDatabase)3 OnDataSet (org.activityinfo.server.database.OnDataSet)3 Delete (org.activityinfo.legacy.shared.command.Delete)2 DuplicateCreateResult (org.activityinfo.legacy.shared.command.result.DuplicateCreateResult)2 ActivityFormDTO (org.activityinfo.legacy.shared.model.ActivityFormDTO)2 CacheResult (org.activityinfo.ui.client.dispatch.remote.cache.CacheResult)2 NullCallback (com.bedatadriven.rebar.async.NullCallback)1 LocalDate (com.bedatadriven.rebar.time.calendar.LocalDate)1 BaseListLoadResult (com.extjs.gxt.ui.client.data.BaseListLoadResult)1 TreeStore (com.extjs.gxt.ui.client.store.TreeStore)1