Search in sources :

Example 1 with TablePlace

use of org.activityinfo.ui.client.table.TablePlace in project activityinfo by bedatadriven.

the class AppPlaceHistoryMapper method getPlace.

@Override
public Place getPlace(String token) {
    String[] parts = token.split("/");
    if (parts[0].equals("table")) {
        return new TablePlace(ResourceId.valueOf(parts[1]));
    } else if (parts[0].equals("analysis")) {
        if (parts.length > 1) {
            return new AnalysisPlace(parts[1]);
        } else {
            return new AnalysisPlace(ResourceId.generateCuid());
        }
    } else if (parts[0].equals("record")) {
        ResourceId formId = ResourceId.valueOf(parts[1]);
        ResourceId recordId = ResourceId.valueOf(parts[2]);
        return new RecordPlace(formId, recordId);
    } else if (parts[0].equals("catalog")) {
        Optional<String> parentId = Optional.absent();
        if (parts.length > 1) {
            parentId = Optional.of(parts[1]);
        }
        return new CatalogPlace(parentId);
    } else {
        return null;
    }
}
Also used : Optional(com.google.common.base.Optional) ResourceId(org.activityinfo.model.resource.ResourceId) CatalogPlace(org.activityinfo.ui.client.catalog.CatalogPlace) TablePlace(org.activityinfo.ui.client.table.TablePlace) AnalysisPlace(org.activityinfo.ui.client.analysis.AnalysisPlace) RecordPlace(org.activityinfo.ui.client.input.RecordPlace)

Aggregations

Optional (com.google.common.base.Optional)1 ResourceId (org.activityinfo.model.resource.ResourceId)1 AnalysisPlace (org.activityinfo.ui.client.analysis.AnalysisPlace)1 CatalogPlace (org.activityinfo.ui.client.catalog.CatalogPlace)1 RecordPlace (org.activityinfo.ui.client.input.RecordPlace)1 TablePlace (org.activityinfo.ui.client.table.TablePlace)1