@Override @SuppressWarnings("unchecked") public void setDataMap(Map<String, Object> dataMap) throws FormEncodingException { FormRepresentationDecoder decoder = FormEncodingFactory.getDecoder(); this.mimeType = (String) dataMap.get("mimeType"); this.name = (String) dataMap.get("name"); this.value = (String) dataMap.get("value"); this.formatter = (Formatter) decoder .decode((Map<String, Object>) dataMap.get("formatter")); }
@Override @SuppressWarnings("unchecked") public void setDataMap(Map<String, Object> dataMap) throws FormEncodingException { FormRepresentationDecoder decoder = FormEncodingFactory.getDecoder(); this.mimeType = (String) dataMap.get("mimeType"); this.name = (String) dataMap.get("name"); this.value = (String) dataMap.get("value"); this.formatter = (Formatter) decoder .decode((Map<String, Object>) dataMap.get("formatter")); }
@Override @SuppressWarnings("unchecked") public void setDataMap(Map<String, Object> data) throws FormEncodingException { super.setDataMap(data); this.inputName = (String) data.get("inputName"); this.variableName = (String) data.get("variableName"); this.loopBlock = (FormItemRepresentation) FormEncodingFactory.getDecoder().decode((Map<String, Object>) data.get("loopBlock")); }
@Override @SuppressWarnings("unchecked") public void setDataMap(Map<String, Object> data) throws FormEncodingException { super.setDataMap(data); this.inputName = (String) data.get("inputName"); this.variableName = (String) data.get("variableName"); this.loopBlock = (FormItemRepresentation) FormEncodingFactory.getDecoder().decode((Map<String, Object>) data.get("loopBlock")); }
@Override @SuppressWarnings("unchecked") public void setDataMap(Map<String, Object> data) throws FormEncodingException { super.setDataMap(data); this.borderWidth = data.get("borderWidth") == null ? null : ((Number) data.get("borderWidth")).intValue(); this.spacing = data.get("spacing") == null ? null : ((Number) data.get("spacing")).intValue(); this.cssClassName = (String) data.get("cssClassName"); this.horizontalAlignment = (String) data.get("horizontalAlignment"); this.verticalAlignment = (String) data.get("verticalAlignment"); this.title = (String) data.get("title"); this.id = (String) data.get("id"); this.items.clear(); FormRepresentationDecoder decoder = FormEncodingFactory.getDecoder(); List<Map<String, Object>> mapItems = (List<Map<String, Object>>) data.get("items"); if (mapItems != null) { for (Map<String, Object> mapItem : mapItems) { this.items.add((FormItemRepresentation) decoder.decode(mapItem)); } } }
@Override @SuppressWarnings("unchecked") public void setDataMap(Map<String, Object> data) throws FormEncodingException { super.setDataMap(data); this.borderWidth = data.get("borderWidth") == null ? null : ((Number) data.get("borderWidth")).intValue(); this.spacing = data.get("spacing") == null ? null : ((Number) data.get("spacing")).intValue(); this.cssClassName = (String) data.get("cssClassName"); this.horizontalAlignment = (String) data.get("horizontalAlignment"); this.verticalAlignment = (String) data.get("verticalAlignment"); this.title = (String) data.get("title"); this.id = (String) data.get("id"); this.items.clear(); FormRepresentationDecoder decoder = FormEncodingFactory.getDecoder(); List<Map<String, Object>> mapItems = (List<Map<String, Object>>) data.get("items"); if (mapItems != null) { for (Map<String, Object> mapItem : mapItems) { this.items.add((FormItemRepresentation) decoder.decode(mapItem)); } } }
@Override @SuppressWarnings("unchecked") public void setDataMap(Map<String, Object> data) throws FormEncodingException { super.setDataMap(data); this.text = (String) data.get("text"); this.name = (String) data.get("name"); this.id = (String) data.get("id"); Map<String, String> i18nMap = (Map<String, String>) data.get("i18n"); if (i18nMap != null) { this.i18n = new HashMap<String, String>(); this.i18n.putAll(i18nMap); } this.format = (String) data.get("format"); FormRepresentationDecoder decoder = FormEncodingFactory.getDecoder(); this.onClickScript = (ScriptRepresentation) decoder.decode((Map<String, Object>) data.get("onClickScript")); }
@Override @SuppressWarnings("unchecked") public void setDataMap(Map<String, Object> data) throws FormEncodingException { super.setDataMap(data); this.cssClassName = (String) data.get("cssClassName"); this.id = (String) data.get("id"); this.cssStylesheetUrl = (String) data.get("cssStylesheetUrl"); this.items.clear(); List<Object> mapItems = (List<Object>) data.get("items"); FormRepresentationDecoder decoder = FormEncodingFactory.getDecoder(); if (mapItems != null) { for (Object obj : mapItems) { Map<String, Object> itemMap = (Map<String, Object>) obj; FormItemRepresentation item = (FormItemRepresentation) decoder.decode(itemMap); this.items.add(item); } } }
@Override @SuppressWarnings("unchecked") public void setDataMap(Map<String, Object> data) throws FormEncodingException { super.setDataMap(data); this.text = (String) data.get("text"); this.name = (String) data.get("name"); this.id = (String) data.get("id"); Map<String, String> i18nMap = (Map<String, String>) data.get("i18n"); if (i18nMap != null) { this.i18n = new HashMap<String, String>(); this.i18n.putAll(i18nMap); } this.format = (String) data.get("format"); FormRepresentationDecoder decoder = FormEncodingFactory.getDecoder(); this.onClickScript = (ScriptRepresentation) decoder.decode((Map<String, Object>) data.get("onClickScript")); }
@Override @SuppressWarnings("unchecked") public void setDataMap(Map<String, Object> data) throws FormEncodingException { super.setDataMap(data); this.id = (String) data.get("id"); this.items.clear(); List<Map<String, Object>> mapItems = (List<Map<String, Object>>) data.get("items"); FormRepresentationDecoder decoder = FormEncodingFactory.getDecoder(); if (mapItems != null) { for (Map<String, Object> entry : mapItems) { int x = entry.get("x") == null ? 0 : ((Number) entry.get("x")).intValue(); int y = entry.get("y") == null ? 0 : ((Number) entry.get("y")).intValue(); Position pos = new Position(x, y); FormItemRepresentation item = (FormItemRepresentation) decoder.decode(entry); this.items.put(pos, item); } } }
@Override @SuppressWarnings("unchecked") public void setDataMap(Map<String, Object> data) throws FormEncodingException { super.setDataMap(data); this.condition = (String) data.get("condition"); FormRepresentationDecoder decoder = FormEncodingFactory.getDecoder(); this.ifBlock = (FormItemRepresentation) decoder.decode((Map<String, Object>) data.get("ifBlock")); this.elseBlock = (FormItemRepresentation) decoder.decode((Map<String, Object>) data.get("elseBlock")); }
@Override @SuppressWarnings("unchecked") public void setDataMap(Map<String, Object> data) throws FormEncodingException { super.setDataMap(data); this.id = (String) data.get("id"); this.items.clear(); List<Map<String, Object>> mapItems = (List<Map<String, Object>>) data.get("items"); FormRepresentationDecoder decoder = FormEncodingFactory.getDecoder(); if (mapItems != null) { for (Map<String, Object> entry : mapItems) { int x = entry.get("x") == null ? 0 : ((Number) entry.get("x")).intValue(); int y = entry.get("y") == null ? 0 : ((Number) entry.get("y")).intValue(); Position pos = new Position(x, y); FormItemRepresentation item = (FormItemRepresentation) decoder.decode(entry); this.items.put(pos, item); } } }
@Override @SuppressWarnings("unchecked") public void setDataMap(Map<String, Object> data) throws FormEncodingException { super.setDataMap(data); this.cssClassName = (String) data.get("cssClassName"); this.id = (String) data.get("id"); this.cssStylesheetUrl = (String) data.get("cssStylesheetUrl"); this.items.clear(); List<Object> mapItems = (List<Object>) data.get("items"); FormRepresentationDecoder decoder = FormEncodingFactory.getDecoder(); if (mapItems != null) { for (Object obj : mapItems) { Map<String, Object> itemMap = (Map<String, Object>) obj; FormItemRepresentation item = (FormItemRepresentation) decoder.decode(itemMap); this.items.add(item); } } }
@Override @SuppressWarnings("unchecked") public void setDataMap(Map<String, Object> data) throws FormEncodingException { super.setDataMap(data); this.condition = (String) data.get("condition"); FormRepresentationDecoder decoder = FormEncodingFactory.getDecoder(); this.ifBlock = (FormItemRepresentation) decoder.decode((Map<String, Object>) data.get("ifBlock")); this.elseBlock = (FormItemRepresentation) decoder.decode((Map<String, Object>) data.get("elseBlock")); }
@Override @SuppressWarnings("unchecked") public void setDataMap(Map<String, Object> data) throws FormEncodingException { super.setDataMap(data); this.cssClassName = (String) data.get("cssClassName"); this.id = (String) data.get("id"); this.items.clear(); List<Object> mapItems = (List<Object>) data.get("items"); FormRepresentationDecoder decoder = FormEncodingFactory.getDecoder(); if (mapItems != null) { for (Object obj : mapItems) { Map<String, Object> itemMap = (Map<String, Object>) obj; FormItemRepresentation item = (FormItemRepresentation) decoder .decode(itemMap); this.items.add(item); } } }
@Override @SuppressWarnings("unchecked") public void setDataMap(Map<String, Object> data) throws FormEncodingException { super.setDataMap(data); this.cssClassName = (String) data.get("cssClassName"); this.id = (String) data.get("id"); this.items.clear(); List<Object> mapItems = (List<Object>) data.get("items"); FormRepresentationDecoder decoder = FormEncodingFactory.getDecoder(); if (mapItems != null) { for (Object obj : mapItems) { Map<String, Object> itemMap = (Map<String, Object>) obj; FormItemRepresentation item = (FormItemRepresentation) decoder .decode(itemMap); this.items.add(item); } } }
@Override @SuppressWarnings("unchecked") public void setDataMap(Map<String, Object> data) throws FormEncodingException { super.setDataMap(data); this.cssClassName = (String) data.get("cssClassName"); this.id = (String) data.get("id"); this.items.clear(); List<Object> mapItems = (List<Object>) data.get("items"); FormRepresentationDecoder decoder = FormEncodingFactory.getDecoder(); if (mapItems != null) { for (Object obj : mapItems) { Map<String, Object> itemMap = (Map<String, Object>) obj; FormItemRepresentation item = (FormItemRepresentation) decoder .decode(itemMap); this.items.add(item); } } }
@Override @SuppressWarnings("unchecked") public void setDataMap(Map<String, Object> data) throws FormEncodingException { super.setDataMap(data); this.name = (String) data.get("name"); this.id = (String) data.get("id"); this.elements = new ArrayList<OptionRepresentation>(); List<Map<String, Object>> elems = (List<Map<String, Object>>) data.get("elements"); FormRepresentationDecoder decoder = FormEncodingFactory.getDecoder(); if (elems != null) { for (Map<String, Object> map : elems) { this.elements.add((OptionRepresentation) decoder.decode(map)); } } this.elementsPopulationScript = (ScriptRepresentation) decoder.decode((Map<String, Object>) data.get("elementsPopulationScript")); }
@Override @SuppressWarnings("unchecked") public void setDataMap(Map<String, Object> data) throws FormEncodingException { super.setDataMap(data); this.name = (String) data.get("name"); this.id = (String) data.get("id"); this.elements = new ArrayList<OptionRepresentation>(); List<Map<String, Object>> elems = (List<Map<String, Object>>) data.get("elements"); FormRepresentationDecoder decoder = FormEncodingFactory.getDecoder(); if (elems != null) { for (Map<String, Object> map : elems) { this.elements.add((OptionRepresentation) decoder.decode(map)); } } this.elementsPopulationScript = (ScriptRepresentation) decoder.decode((Map<String, Object>) data.get("elementsPopulationScript")); }
@Override public Map<String, List<MenuItemDescription>> listMenuItems() throws MenuServiceException { Map<String, List<MenuItemDescription>> retval = null; try { FormRepresentationDecoder decoder = FormEncodingFactory.getDecoder(); URL url = asURL("/menuItems.json"); String json = readURL(url); retval = decoder.decodeMenuItemsMap(json); } catch (FormEncodingException e) { throw new MenuServiceException("Problem parsing menu items json file", e); } catch (URISyntaxException e) { throw new MenuServiceException("Problem finding menu items json file", e); } catch (FileNotFoundException e) { throw new MenuServiceException("No menu items json file found", e); } catch (IOException e) { throw new MenuServiceException("Problem reading menu items json file", e); } catch (Exception e) { throw new MenuServiceException("Unexpected error", e); } return retval; }