public void navigate(OperationData operationData) { SingleResult newmodel = new SingleResult(); newmodel.setData(operationData); setModel(newmodel); }
/** * @{inheritedDoc} */ @Override public String identityOf(IEmaginController controller, VLViewComponentXML component) { final SingleResult sr = (SingleResult) controller.getModel(); return identityOf(controller, component, sr.rootData()); }
/** * @{inheritedDoc} */ @Override public void count(IEmaginController controller, IOperationResult currentResult, Consumer<IOperationResult> consumer) { final SingleResult result = new SingleResult(); result.addMetaData("count", "0"); }
@Override public void doOperation(JsonObject params, Consumer<IOperationResult> resultHandler, Consumer<Throwable> exHandler) { final SingleResult sr = new SingleResult(); final Serializable sessionId = UUID.randomUUID().toString(); sr.addMetaData("session_id", sessionId); final OperationData operationData = new OperationData(); sr.setData(operationData); JsonObject account = new JsonObject(); account.addProperty("login", "lorenzo@nexitia.com"); account.addProperty("nickName", "lorenzo"); final JsonObject user = new JsonObject(); user.addProperty("nickName", "lorenzo"); account.addProperty("mail", "lorenzo@nexitia.com"); final JsonObject container = new JsonObject(); container.addProperty("fullId", "1:people"); container.addProperty("path", "/"); operationData.getLinks().put("container", JsonUtils.toString(container)); operationData.getLinks().put("account", JsonUtils.toString(account)); operationData.getLinks().put("user", JsonUtils.toString(user)); resultHandler.accept(sr); } }
/** * @param key * @param val */ public static void addImage(String key, byte[] val) { final IOperationResult res = new SingleResult(); res.addMetaData(key, val); IMAGES_CACHE.put(key, res); }
/** * Load model associated to this controller * * @param controller */ private static void loadModel(AbstractViewController controller) { // use only in edition mode if (controller.getModelProvider() != null) { IModelProvider modelProvider = controller.getModelProvider(); modelProvider.loadModel(controller, null); } // in create mode do not provide // a modelProvider to your wizard else { SingleResult sr = new SingleResult(); sr.setData(new OperationData()); controller.setModel(sr); // add container sr.getData().getAttributes().put("fullId", controller.getModelContainerFullId()); } }
/** * Loads all atributes definition of {@link ATypeManaged}. * <p> * * @param typeManagedFullId * @param res * @return {@link IOperationResult} */ public static IOperationResult loadAttributesDefinition(SingleResult res) { JsonObject q = new JsonObject(); q.addProperty("fullId", res.getData().getAttributes().get("fullId").toString()); List<IOperationResult> t = new ArrayList<>(); IOperation getTmAttributeDefinitionsOperation = (IOperation) Services.getBean("GetTmAttributeDefinitionsOperation"); getTmAttributeDefinitionsOperation.doOperation(q, r -> { MultipleResult mr = (MultipleResult) r; ((OperationData) res.rootData()).getBusinessType().put("softAttributes", mr.getData()); t.add(r); }, ex -> { ex.printStackTrace(); }); return t.get(0); }
/** * @{inheritedDoc} */ @Override public Node provideIcon(IEmaginController controller, VLViewComponentXML configuration, Object forModel) { final OperationData data = (OperationData) forModel; final String fullId = (String) data.getAttributes().get("fullId"); content.getStyleClass().setAll(getStyleClass().split(",")); if (StringUtils.isEmpty(fullId)) { displayEmptyThumb(); } else { if (contentInfo.getData() == null) { final JsonObject query = new JsonObject(); query.addProperty("fullId", fullId); query.addProperty("role", "primary"); getContentInfoOperation.doOperation(query, res -> { final MultipleResult f = (MultipleResult) res; if (f.getData().size() == 1) { contentInfo.setData(f.getData().get(0)); } }, ex -> { // ex.printStackTrace(); }); } displayThumb(); } return content; }
private void displayThumb(String fullId, String gender) { final JsonObject query = new JsonObject(); query.addProperty("fullId", fullId); getThumbOperation.doOperation(query, res -> { if (res == null || res.hasBusinessError()) { displayEmptyThumb(gender); } else { try { final SingleResult sr = (SingleResult) res; final byte[] imgbytes = (byte[]) sr.getMetaData().get("thumb"); if (imgbytes != null && imgbytes.length > 0) { getJavaFXImage(imgbytes, gender); } else { displayEmptyThumb(gender); } } catch (final Exception e) { e.printStackTrace(); displayEmptyThumb(gender); } } }, ex -> { ex.printStackTrace(); displayEmptyThumb(gender); }); }
public void createSavedSearch(JsonObject query, Consumer<IOperationResult> sa, Consumer<Throwable> object2) { String name = query.get("name").getAsString(); Integer id = datas.size() + 1; datas.add(id + "," + name + "," + "No description"); IOperationResult r = new SingleResult(); OperationData data = new OperationData(); data.getAttributes().put("fullId", id); data.getAttributes().put("id", id); data.getAttributes().put("name", name); data.getAttributes().put("description", "No description"); sa.accept(r); }
/** * @{inheritedDoc} */ @Override public void count(IEmaginController controller, IOperationResult currentResult, Consumer<IOperationResult> consumer) { final SingleResult result = new SingleResult(); result.addMetaData("count", "0"); }
protected void displayThumb(String fullId) { final JsonObject query = new JsonObject(); query.addProperty("fullId", fullId); getThumbOperation.doOperation(query, res -> { if (res == null || res.hasBusinessError()) { displayEmptyThumb(); } else { try { final SingleResult sr = (SingleResult) res; final byte[] imgbytes = (byte[]) sr.getMetaData().get("thumb"); if (imgbytes != null && imgbytes.length > 0) { getJavaFXImage(imgbytes); } else { displayEmptyThumb(); } } catch (final Exception e) { e.printStackTrace(); displayEmptyThumb(); } } }, ex -> { ex.printStackTrace(); displayEmptyThumb(); }); }
protected void leftPaneSelectedElementChange(OperationData selectedModel) { if (selectedModel != null) { final SingleResult result = new SingleResult(); result.setData(selectedModel); tableViewController.setModel(result); } }
public static IOperationResult loadLifecycleName(SingleResult res) { JsonObject q = new JsonObject(); q.addProperty("fullId", res.getData().getAttributes().get("fullId").toString()); List<IOperationResult> t = new ArrayList<>(); IOperation getLifecycleNameOperation = (IOperation) Services.getBean("GetLifecycleNameOperation"); getLifecycleNameOperation.doOperation(q, r -> { t.add(r); }, ex -> { ex.printStackTrace(); }); return t.get(0); }
@Override public IOperationResult getCurrentUserAccount() { try { int tries = 0; try { String url = rootUrl.concat(String.format(account_current_URL)); IOperationResult result = doGet(new JsonObject(), url, SingleResult.class); return result; } catch (Exception e) { if (tries < 2) { tries++; Thread.sleep(2000); return getCurrentUserAccount(); } } return new SingleResult(); } catch (Throwable e) { e.printStackTrace(); return IOperationResult.getGeneralSingleResultError(); } }
/** * @{inheritedDoc} */ @Override public String identityOf(IEmaginController controller, VLViewComponentXML component) { final SingleResult sr = (SingleResult) controller.getModel(); return identityOf(controller, component, sr.rootData()); }
String val = (String) r.getMetaData().get("isLinked"); if ("true".equalsIgnoreCase(val)) { rule.set(UIAccessRule.HIDDEN);
/** * {@inheritDoc} */ @Override public void doOperation(JsonObject params, Consumer<IOperationResult> resultHandler, Consumer<Throwable> exHandler) { final SingleResult result = new SingleResult(); final OperationData data = new OperationData(); result.setData(data); data.getAttributes().put("nickname", "Lorenzo"); data.getAttributes().put("fullId", "2:people.user"); resultHandler.accept(result); } }
public static IOperationResult getPrimaryContentFormat(SingleResult res) { final JsonObject q = new JsonObject(); q.addProperty("fullId", res.getData().getAttributes().get("fullId").toString()); q.addProperty("role", res.getData().getAttributes().get("primary").toString()); final List<IOperationResult> t = new ArrayList<>(); final IOperation getPrimaryContentFormat = (IOperation) Services.getBean("GetContentInfoOperation"); getPrimaryContentFormat.doOperation(q, r -> { if (((MultipleResult) r).getData().size() > 0) { final OperationData data = ((MultipleResult) r).getData().get(0); res.getData().getLinks().put("primaryContent", data.getAttributes()); } }, ex -> { ex.printStackTrace(); }); return t.size() > 0 ? (IOperationResult) t.get(0) : null; }