public CommonModelField findCommonModelField(int fieldId) { for (CommonModel c : getCommonModelList()) { for (CommonModelField f : c.getCommonModelFieldList()) { if (f.getId() == fieldId) return f; } } return null; }
// 删除项目旧model的字段数据 public void removeCommonModelField(int id, Session session) { CommonModelField commonModelField = this.findCommonModelField(id); if (commonModelField != null && commonModelField.getCommonModel() != null && commonModelField.getCommonModel().getCommonModelFieldList() != null) { commonModelField.getCommonModel().getCommonModelFieldList().remove(commonModelField); session.delete(commonModelField); } }
private void getCommonModelHTMLSub(StringBuilder html, List<CommonModelField> list, short level) { for (CommonModelField f : list) { html // .append("<tr class=\"tr-level-" + level + "\">") // .append("<td class=\"td-name\">" + levelMark(level) + // StringUtils.escapeInH(p.getName()) + "</td>") .append( "<td class=\"td-identifier\">" + StringUtils.escapeInH(f.getIdentifier()) + "</td>") .append("<td class=\"td-type\">" + StringUtils.escapeInH(f.getDatatype()) + "</td>") // .append("<td class=\"td-need\">" + StringUtils.escapeInH(f.getNeeded()) + "</td>") .append("<td class=\"td-need\">" + (f.getNeeded() == 1 ? "是" : "否") + "</td>") .append("<td class=\"td-remark\">" + StringUtils.escapeInH(f.getDescription()) + "</td>") .append("</tr>"); /*if (p.getParameterList() != null || p.getParameterList().size() > 0) { getParameterListHTMLSub(html, p.getParameterList(), (short)(level + 1)); }*/ } }
public void addCommonModelField(CommonModelField commonModelField) { getCommonModelFieldList().add(commonModelField); commonModelField.setCommonModel(this); }