@Override public Authentication toModel(String json) { WSUtils utils = WSUtils.getINSTANCE(); Object map = utils.parse(json); Boolean validJson = utils.getBoolean(map, "valid"); return new Authentication().setValid(validJson != null ? validJson : false); }
/** * {@inheritDoc} */ @Override protected Profile parse(Object json) { WSUtils utils = WSUtils.getINSTANCE(); Profile profile = new Profile(); profile.setLanguage(utils.getString(json, "language")) .setName(utils.getString(json, "name")) .setDefaultProfile(utils.getBoolean(json, "default")); if (utils.getString(json, "parent") != null) { profile.setParentName(utils.getString(json, "parent")); } if (utils.getBoolean(json, "provided") != null) { profile.setProvided(utils.getBoolean(json, "provided")); } return profile; }
@Override protected Metric parse(Object json) { WSUtils utils = WSUtils.getINSTANCE(); return new Metric() .setKey(utils.getString(json, "key")) .setName(utils.getString(json, "name")) .setDomain(utils.getString(json, "domain")) .setDescription(utils.getString(json, "description")) .setDirection(utils.getInteger(json, "direction")) .setType(utils.getString(json, "val_type")) .setUserManaged(utils.getBoolean(json, "user_managed")) .setHidden(utils.getBoolean(json, "hidden")); } }
@Override protected Profile parse(Object json) { WSUtils utils = WSUtils.getINSTANCE(); Profile profile = new Profile(); Boolean defaultProfile = utils.getBoolean(json, "default"); profile .setLanguage(utils.getString(json, "language")) .setName(utils.getString(json, "name")) .setDefaultProfile(defaultProfile != null ? defaultProfile : false) .setParentName(utils.getString(json, "parent")); parseRules(utils, profile, json); return profile; }