private void setAttachedTagsConverter(AsyncQuery<List<Tags>> aQuery) { aQuery.converterCallback = source -> { if (source != null) { ArrayList<Tags> ret = new ArrayList<>(); for (Tags tags : (ArrayList<Tags>) source) { if (tags.getType() == TagsType.GeneralTag) { ret.add(tags); } } return ret; } return new ArrayList<>(); }; }
public void fillTagsRecursive(Tags tagToFill, List<Tags> children) { ArrayList<Tags> list = new ArrayList<>(); for (Tags tag : children) { // tags child = new tags(tag.description, tag.parent_id, tag.IsReadonly, tag.tag_id, tag.tag_name); if (tag.getType() == TagsType.GeneralTag) { list.add(tag); if (tag.getChildren() != null) { fillTagsRecursive(tag, tag.getChildren()); } } } tagToFill.setChildren(list); }
@Override public void update(Tags tag) { MapSqlParameterSource parameterSource = getCustomMapSqlParameterSource() .addValue("description", tag.getDescription()) .addValue("tag_id", tag.getTagId()) .addValue("tag_name", tag.getTagName()) .addValue("parent_id", tag.getParentId()) .addValue("readonly", tag.getIsReadonly()) .addValue("type", tag.getType()); getCallsHandler() .executeModification("Updatetags", parameterSource); }
@Override public void save(Tags tag) { Guid id = tag.getTagId(); if (Guid.isNullOrEmpty(id)) { id = Guid.newGuid(); tag.setTagId(id); } MapSqlParameterSource parameterSource = getCustomMapSqlParameterSource() .addValue("description", tag.getDescription()) .addValue("tag_id", tag.getTagId()) .addValue("tag_name", tag.getTagName()) .addValue("parent_id", tag.getParentId()) .addValue("readonly", tag.getIsReadonly()) .addValue("type", tag.getType()); getCallsHandler().executeModification("Inserttags", parameterSource); }
protected CustomMapSqlParameterSource getParamsSource(Tags tag) { CustomMapSqlParameterSource paramsSource = new CustomMapSqlParameterSource(dbEngineDialect); paramsSource.addValue("description", tag.getDescription()) .addValue("tag_id", tag.getTagId()) .addValue("tag_name", tag.getTagName()) .addValue("parent_id", tag.getParentId()) .addValue("readonly", tag.getIsReadonly()) .addValue("type", tag.getType()); return paramsSource; }