Search in sources :

Example 1 with RpcMap

use of com.extjs.gxt.ui.client.data.RpcMap in project activityinfo by bedatadriven.

the class CreateSiteHandlerAsync method insertSite.

private void insertSite(SqlTransaction tx, CreateSite cmd) {
    RpcMap properties = cmd.getProperties();
    // deal with the possibility that we've already received this command
    // but its completion was not acknowledged because of network problems
    tx.executeSql("delete from indicatorvalue Where ReportingPeriodId in " + "(select reportingperiodid from reportingperiod where siteid=" + cmd.getSiteId() + ")");
    SqlUpdate.delete(Tables.REPORTING_PERIOD).where("SiteId", cmd.getSiteId()).execute(tx);
    SqlUpdate.delete(Tables.SITE_HISTORY).where("siteid", cmd.getSiteId()).execute(tx);
    SqlUpdate.delete(Tables.SITE).where("SiteId", cmd.getSiteId()).execute(tx);
    SqlInsert.insertInto(Tables.SITE).value("SiteId", cmd.getSiteId()).value("LocationId", cmd.getLocationId()).value("ActivityId", cmd.getActivityId()).value("Date1", properties.get("date1")).value("Date2", properties.get("date2")).value("Comments", properties.get("comments")).value("PartnerId", properties.get("partnerId")).value("ProjectId", properties.get("projectId")).value("DateCreated", new Date()).value("DateEdited", new Date()).value("timeEdited", new Date().getTime()).execute(tx);
    insertAttributeValues(tx, cmd);
}
Also used : RpcMap(com.extjs.gxt.ui.client.data.RpcMap) Date(java.util.Date) LocalDate(com.bedatadriven.rebar.time.calendar.LocalDate)

Example 2 with RpcMap

use of com.extjs.gxt.ui.client.data.RpcMap in project activityinfo by bedatadriven.

the class CreateLocationHandlerAsync method createLocation.

private void createLocation(SqlTransaction tx, CreateLocation command) {
    RpcMap properties = command.getProperties();
    SqlInsert.insertInto("location").value("LocationId", properties.get("id")).value("LocationTypeId", properties.get("locationTypeId")).value("Name", properties.get("name")).value("Axe", properties.get("axe")).value("X", properties.get("longitude")).value("Y", properties.get("latitude")).value("timeEdited", new Date().getTime()).execute(tx);
    insertAdminLinks(tx, properties);
}
Also used : RpcMap(com.extjs.gxt.ui.client.data.RpcMap) Date(java.util.Date)

Example 3 with RpcMap

use of com.extjs.gxt.ui.client.data.RpcMap in project activityinfo by bedatadriven.

the class ReportMetadataDTO method readObject.

@GwtIncompatible
private void readObject(java.io.ObjectInputStream o) throws IOException, java.lang.ClassNotFoundException {
    freq = (EmailDelivery) o.readObject();
    subscribers = (List) o.readObject();
    allowNestedValues = o.readBoolean();
    HashMap<String, Object> readMap = (HashMap<String, Object>) o.readObject();
    map = new RpcMap();
    if (readMap != null && !readMap.isEmpty()) {
        for (Map.Entry<String, Object> entry : readMap.entrySet()) {
            map.put(entry.getKey(), entry.getValue());
        }
    }
}
Also used : RpcMap(com.extjs.gxt.ui.client.data.RpcMap) HashMap(java.util.HashMap) RpcMap(com.extjs.gxt.ui.client.data.RpcMap) Map(java.util.Map) HashMap(java.util.HashMap) GwtIncompatible(com.google.gwt.core.shared.GwtIncompatible)

Example 4 with RpcMap

use of com.extjs.gxt.ui.client.data.RpcMap in project activityinfo by bedatadriven.

the class RpcMapDeserializer method deserialize.

@Override
public RpcMap deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException, JsonProcessingException {
    ObjectMapper mapper = (ObjectMapper) jp.getCodec();
    ObjectNode root = (ObjectNode) mapper.readTree(jp);
    RpcMap map = new RpcMap();
    Iterator<Map.Entry<String, JsonNode>> fieldIt = root.getFields();
    while (fieldIt.hasNext()) {
        Map.Entry<String, JsonNode> field = fieldIt.next();
        if (field.getValue().isNumber()) {
            map.put(field.getKey(), field.getValue().getNumberValue());
        } else if (field.getValue().isBoolean()) {
            map.put(field.getKey(), field.getValue().asBoolean());
        } else if (field.getValue().isTextual()) {
            map.put(field.getKey(), field.getValue().asText());
        }
    }
    return map;
}
Also used : RpcMap(com.extjs.gxt.ui.client.data.RpcMap) ObjectNode(org.codehaus.jackson.node.ObjectNode) JsonNode(org.codehaus.jackson.JsonNode) RpcMap(com.extjs.gxt.ui.client.data.RpcMap) Map(java.util.Map) ObjectMapper(org.codehaus.jackson.map.ObjectMapper)

Example 5 with RpcMap

use of com.extjs.gxt.ui.client.data.RpcMap in project activityinfo by bedatadriven.

the class RequestChange method update.

public static Command update(EntityDTO model, String... propertiesToChange) {
    RequestChange request = new RequestChange();
    request.setChangeType(UPDATE);
    request.setEntityId(model.getId());
    request.setEntityType(model.getEntityName());
    RpcMap map = new RpcMap();
    for (String property : propertiesToChange) {
        map.put(property, model.get(property));
    }
    request.setPropertyMap(map);
    return request;
}
Also used : RpcMap(com.extjs.gxt.ui.client.data.RpcMap)

Aggregations

RpcMap (com.extjs.gxt.ui.client.data.RpcMap)5 Date (java.util.Date)2 Map (java.util.Map)2 LocalDate (com.bedatadriven.rebar.time.calendar.LocalDate)1 GwtIncompatible (com.google.gwt.core.shared.GwtIncompatible)1 HashMap (java.util.HashMap)1 JsonNode (org.codehaus.jackson.JsonNode)1 ObjectMapper (org.codehaus.jackson.map.ObjectMapper)1 ObjectNode (org.codehaus.jackson.node.ObjectNode)1