/** * Called by spring on bean initialisation, loads all serialized * notifications into allNotifications. */ public void deserializeAllNotifications() { String notificationsFolderPath = platformProperties.getProperty("localNotificationsFolderPath"); notificationsFilePath = notificationsFolderPath + File.separator + "local_notifications.txt"; final File file = new File(notificationsFilePath); if (!file.exists()) { try { file.createNewFile(); } catch (IOException e) { e.printStackTrace(); } } if (file.exists()) { try { List<String> alllines = Files.readAllLines(file.toPath()); for (String line : alllines) { JsonObject jsonObject = JsonUtils.toJsonObject(line); String uuid = jsonObject.get("uuid").getAsString(); allNotifications.put(uuid, jsonObject); } } catch (IOException e) { e.printStackTrace(); } } }
@Override public void init() { if ((loginSessionHolder != null) && (loginSessionHolder.getLoginResult() != null)) { final OperationData data = (OperationData) loginSessionHolder.getLoginResult().rootData(); container = JsonUtils.toJsonObject((String)data.getLinks().get("container")); user = JsonUtils.toJsonObject((String)data.getLinks().get("user")); account = JsonUtils.toJsonObject((String)data.getLinks().get("account")); mode = loginSessionHolder.getMode() == null ? RootContextMode.Connected : loginSessionHolder.getMode(); } }
/** * @throws OperationException * @{inheritedDoc} */ @Override public IOperationResult createNotification(JsonObject query) throws OperationException { try { String notif = query.get("notification").getAsString(); JsonObject jsonObject = JsonUtils.toJsonObject(notif); String uuid = UUID.randomUUID().toString(); jsonObject.addProperty("uuid", uuid); allNotifications.put(uuid, jsonObject); // dump all line to file StringBuffer buffer = dumpAllToString(); Files.write(new File(notificationsFilePath).toPath(), buffer.toString().getBytes(), StandardOpenOption.TRUNCATE_EXISTING); SingleResult result = new SingleResult.Builder().addMeta("done", "1").build(); return result; } catch (IOException e) { e.printStackTrace(); throw new OperationException(e); } }
@Override public void onResponse(Response response) throws IOException { try { IOperationResult o = JsonUtils.toJsonObject(response.body().string(), clazz); resHandler.accept(o); } catch (IOException e) { e.printStackTrace(); } finally { response.body().close(); } }
JsonObject jsonObject = JsonUtils.toJsonObject(jsonString);
/** * @{inheritedDoc} */ @Override public void editCommit(IEmaginController sourceController, VLViewComponentXML inlineActionConfiguration, List<IInputComponentWrapper> rows) { IPersistenceServiceDelegate.super.editCommit(sourceController, inlineActionConfiguration, rows); String action = inlineActionConfiguration.getPropertyValue(ACTION_NAME); Map<String, Object> vals = extracValue(rows); vals.put(HIDDEN_PREFIX + ACTION_NAME, action); // commit all mofications in same controller IInputComponentWrapper row0 = rows.get(0); Object model = row0.getController().getModel(); String rootModelOid = (String) ReflectionUIUtils.invokeGetterOn(model, DATA_TYPE); int version = (Integer) ReflectionUIUtils.invokeGetterOn(model, DATA_ATTRIBUTES_VERSION); vals.put(HIDDEN_PREFIX + PERSISTENCE_FULL_ID, rootModelOid); vals.put(HIDDEN_PREFIX + PERSISTENCE_VERSION, version); //persistableUpdateOperation.doOperation(JsonObject.fromObject(vals), this::successHandler, getErrorHandler()); persistableUpdateOperation.doOperation(JsonUtils.toJsonObject(vals), this::successHandler, getErrorHandler()); }
T o = JsonUtils.toJsonObject(response.body().string(), clazz); response.body().close(); return o;
System.out.println(">>>>>>>>>>>>>>>>>>> ERROR DO GET ERROR >>>>>>>>>>>>><"); } else { T o = JsonUtils.toJsonObject(response.body().string(), clazz); return o;
T o = JsonUtils.toJsonObject(response.body().string(), clazz); response.body().close(); return o;
T o = JsonUtils.toJsonObject(response.body().string(), clazz); response.body().close(); return o;