public static ReqCompFieldInfo toReqCompFieldInfo(ReqComponentField entity) { if (null == entity) { return null; } ReqCompFieldInfo dto = new ReqCompFieldInfo(); dto.setId(entity.getId()); dto.setType(entity.getType()); dto.setValue(entity.getValue()); return dto; }
/** * Gets requirement component fields as a map. * * @param reqComponent Requirement component * @return Map of requirement component fields */ protected Map<String, String> getReqComponentFieldMap(ReqComponentInfo reqComponent) throws OperationFailedException { //validateReqComponentFields(reqComponent); List<ReqCompFieldInfo> fields = reqComponent.getReqCompFields(); Map<String, String> map = new HashMap<String, String>(); for (ReqCompFieldInfo field : fields) { String type = field.getType(); String value = field.getValue(); map.put(type, value); } return map; }
reqComp.setId(null); for(ReqCompFieldInfo field:reqComp.getReqCompFields()){ field.setId(null); if(ReqComponentFieldTypes.COURSE_CLUSET_KEY.getId().equals(field.getType())|| ReqComponentFieldTypes.PROGRAM_CLUSET_KEY.getId().equals(field.getType())|| ReqComponentFieldTypes.CLUSET_KEY.getId().equals(field.getType())){ try { CluSetInfo cluSet = cluService.getCluSet(field.getValue(),contextInfo); cluSet.setId(null); field.setValue(cluSet.getId()); } catch (Exception e) { throw new OperationFailedException("Error copying clusets.", e);
field.setId(null);
reqComp.setState(newState); for(ReqCompFieldInfo field:reqComp.getReqCompFields()){ field.setId(null); if(ReqComponentFieldTypes.COURSE_CLUSET_KEY.getId().equals(field.getType())|| ReqComponentFieldTypes.PROGRAM_CLUSET_KEY.getId().equals(field.getType())|| ReqComponentFieldTypes.CLUSET_KEY.getId().equals(field.getType())){ try { CluSetInfo cluSet = cluService.getCluSet(field.getValue(), contextInfo); cluSet.setId(null); cluSet.setStateKey(newState); field.setValue(cluSet.getId()); } catch (Exception e) { throw new OperationFailedException("Error copying clusets.", e);
field.setId(null);
private static void findCluSetIds(StatementTreeViewInfo rule, Set<String> list) { List<StatementTreeViewInfo> statements = rule.getStatements(); List<ReqComponentInfo> reqComponentInfos = rule.getReqComponents(); if ((statements != null) && (statements.size() > 0)) { // retrieve all statements for (StatementTreeViewInfo statement : statements) { findCluSetIds(statement, list); // inside set the children of this statementTreeViewInfo } } else if ((reqComponentInfos != null) && (reqComponentInfos.size() > 0)) { // retrieve all req. component LEAFS for (ReqComponentInfo reqComponent : reqComponentInfos) { List<ReqCompFieldInfo> fieldInfos = reqComponent.getReqCompFields(); for (ReqCompFieldInfo fieldInfo : fieldInfos) { if (RulesUtil.isCluSetWidget(fieldInfo.getType())) { list.add(fieldInfo.getValue()); } } } } }