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);
}
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);
}
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());
}
}
}
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;
}
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;
}
Aggregations