@Override @Transactional(readOnly=false,noRollbackFor={DoesNotExistException.class},rollbackFor={Throwable.class}) public StatementTreeViewInfo createStatementTreeView(final StatementTreeViewInfo statementTreeViewInfo) throws AlreadyExistsException, DataValidationErrorException, DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException, CircularReferenceException { try { // insert statements and reqComponents if they do not already exists in database updateSTVHelperCreateStatements(statementTreeViewInfo); updateStatementTreeViewHelper(statementTreeViewInfo); StatementTreeViewInfo test = getStatementTreeView(statementTreeViewInfo.getId()); return test; } catch (VersionMismatchException e) { throw new OperationFailedException("Create failed.", e); } }
@Override public BaseDTOAssemblyNode<StatementTreeViewInfo, StatementTreeViewInfo> disassemble( StatementTreeViewInfo newTree, NodeOperation operation, ContextInfo contextInfo) throws AssemblyException { if (newTree == null) { // FIXME Unsure now if this is an exception or just return null or // empty assemblyNode LOG.error("StatementTreeView to disassemble is null!"); throw new AssemblyException("StatementTreeView can not be null"); } BaseDTOAssemblyNode<StatementTreeViewInfo, StatementTreeViewInfo> result = new BaseDTOAssemblyNode<StatementTreeViewInfo, StatementTreeViewInfo>(this); if(newTree.getId()==null|newTree.getId().isEmpty()){ result.setOperation(NodeOperation.CREATE); }else{ result.setOperation(operation); } result.setBusinessDTORef(newTree); result.setNodeData(newTree); return result; }
/** * @param courseId * @param statementTreeViewInfo * @return reference exists * @throws InvalidParameterException * @throws MissingParameterException * @throws OperationFailedException * @throws DoesNotExistException */ private RefStatementRelationInfo findStatementReference(String courseId, StatementTreeViewInfo statementTreeViewInfo, ContextInfo contextInfo) throws InvalidParameterException, MissingParameterException, OperationFailedException, DoesNotExistException { List<RefStatementRelationInfo> course = R1R2ConverterUtil.convertLists(statementService.getRefStatementRelationsByRef(CourseAssemblerConstants.COURSE_TYPE, courseId), RefStatementRelationInfo.class); if (course != null) { for (RefStatementRelationInfo refRelation : course) { if (refRelation.getStatementId().equals(statementTreeViewInfo.getId())) { return refRelation; } } } return null; }
throws CircularReferenceException, DataValidationErrorException, DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException, VersionMismatchException { Statement stmt = this.statementDao.fetch(Statement.class, statementTreeViewInfo.getId()); if (stmt == null) { throw new DoesNotExistException("Statement does not exist for id: " + statementTreeViewInfo.getId());
Window.alert("Cannot find program requirement with a statement that has id: '" + newSubRule.getId() + "'"); GWT.log("Cannot find program requirement with a statement that has id: '" + newSubRule.getId() + "'", null); return null; } else { //replace the related stored subrule with a new version for (StatementTreeViewInfo subRule : affectedSubRules) { if (subRule.getId().equals(newSubRule.getId())) { int treeIx = affectedSubRules.indexOf(subRule);
@Override @Transactional(readOnly = false, noRollbackFor = {DoesNotExistException.class}, rollbackFor = {Throwable.class}) public StatusInfo deleteCourseStatement(String courseId, StatementTreeViewInfo statementTreeViewInfo, ContextInfo contextInfo) throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException { checkForMissingParameter(courseId, "courseId"); checkForMissingParameter(statementTreeViewInfo, "statementTreeViewInfo"); RefStatementRelationInfo relation = findStatementReference(courseId, statementTreeViewInfo, contextInfo); if (relation != null) { statementService.deleteRefStatementRelation(relation.getId()); statementService.deleteStatementTreeView(statementTreeViewInfo.getId()); StatusInfo result = new StatusInfo(); return result; } throw new DoesNotExistException("Course does not have this StatemenTree"); }
public StatementInfo toStatementInfo(final StatementTreeViewInfo statementTreeViewInfo) { StatementInfo statementInfo = null; if (statementTreeViewInfo == null) return null; statementInfo = new StatementInfo(); copyValues(statementInfo, statementTreeViewInfo); // goes through the list of reqComponents in statementTreeViewInfo and extract the reqComponent ids if (statementTreeViewInfo.getReqComponents() != null) { List<String> reqCompIds = new ArrayList<String>(7); for (ReqComponentInfo reqComponentInfo : statementTreeViewInfo.getReqComponents()) { reqCompIds.add(reqComponentInfo.getId()); } statementInfo.setReqComponentIds(reqCompIds); } statementInfo.setState(statementTreeViewInfo.getState()); // TODO goes through the list of statements in statementTreeViewInfo and extract the statement ids if (statementTreeViewInfo.getStatements() != null) { List<String> statementIds = new ArrayList<String>(7); for (StatementTreeViewInfo subStatementTreeViewInfo : statementTreeViewInfo.getStatements()) { statementIds.add(subStatementTreeViewInfo.getId()); } statementInfo.setStatementIds(statementIds); } statementInfo.setType(statementTreeViewInfo.getType()); return statementInfo; }
private void updateStatementTreeViewHelper(StatementTreeViewInfo statementTreeViewInfo) throws CircularReferenceException, DataValidationErrorException, DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException, VersionMismatchException { if (statementTreeViewInfo.getStatements() != null) { for (StatementTreeViewInfo subStatement : statementTreeViewInfo.getStatements()) { updateStatementTreeViewHelper(subStatement); } } if (statementTreeViewInfo.getReqComponents() != null) { List<ReqComponentInfo> updatedReqComponentInfos = new ArrayList<ReqComponentInfo>(7); for (ReqComponentInfo reqComponentInfo : statementTreeViewInfo.getReqComponents()) { ReqComponentInfo updatedReqComponentInfo = updateReqComponent(reqComponentInfo.getId(), reqComponentInfo); updatedReqComponentInfos.add(updatedReqComponentInfo); } statementTreeViewInfo.setReqComponents(updatedReqComponentInfos); } StatementInfo updatedStatementInfo = updateStatement(statementTreeViewInfo.getId(), statementAssembler.toStatementInfo( statementTreeViewInfo)); statementAssembler.copyValues(statementTreeViewInfo, updatedStatementInfo); }
@Override @Transactional(readOnly = false, noRollbackFor = {DoesNotExistException.class}, rollbackFor = {Throwable.class}) public StatementTreeViewInfo updateCourseStatement(String courseId, String statementId, StatementTreeViewInfo statementTreeViewInfo, ContextInfo contextInfo) throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException, DataValidationErrorException, VersionMismatchException { checkForMissingParameter(courseId, "courseId"); checkForMissingParameter(statementTreeViewInfo, "statementTreeViewInfo"); // Validate List<ValidationResultInfo> validationResults = validateCourseStatement(courseId, statementTreeViewInfo, contextInfo); if (ValidatorUtils.hasErrors(validationResults)) { throw new DataValidationErrorException("Validation error!", validationResults); } if (findStatementReference(courseId, statementTreeViewInfo, contextInfo) == null) { throw new InvalidParameterException("Statement is not part of this course"); } try { return statementService.updateStatementTreeView(statementTreeViewInfo.getId(), statementTreeViewInfo); } catch (CircularReferenceException e) { e.printStackTrace(); } return null; }
statementId = statementTreeViewInfo.getId(); if (statementId != null) { try {
@Override @Transactional(readOnly = false, noRollbackFor = {DoesNotExistException.class}, rollbackFor = {Throwable.class}) public StatementTreeViewInfo createCourseStatement(String courseId, StatementTreeViewInfo statementTreeViewInfo, ContextInfo contextInfo) throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException, DataValidationErrorException { checkForMissingParameter(courseId, "courseId"); checkForMissingParameter(statementTreeViewInfo, "statementTreeViewInfo"); // Validate List<ValidationResultInfo> validationResults = validateCourseStatement(courseId, statementTreeViewInfo, contextInfo); if (ValidatorUtils.hasErrors(validationResults)) { throw new DataValidationErrorException("Validation error!", validationResults); } if (findStatementReference(courseId, statementTreeViewInfo, contextInfo) != null) { throw new InvalidParameterException("Statement is already referenced by this course"); } try { StatementTreeViewInfo tree = statementService.createStatementTreeView(statementTreeViewInfo); RefStatementRelationInfo relation = new RefStatementRelationInfo(); relation.setRefObjectId(courseId); relation.setRefObjectTypeKey(CourseAssemblerConstants.COURSE_TYPE); relation.setStatementId(tree.getId()); relation.setType(CourseAssemblerConstants.COURSE_REFERENCE_TYPE); relation.setState(CourseAssemblerConstants.ACTIVE); statementService.createRefStatementRelation(R1R2ConverterUtil.convert(relation, org.kuali.student.r1.core.statement.dto.RefStatementRelationInfo.class)); } catch (Exception e) { throw new OperationFailedException("Unable to create clu/tree relation", e); } return statementTreeViewInfo; }
statement.setId(UUIDHelper.genStringUUID(statement.getId())); BaseDTOAssemblyNode<StatementTreeViewInfo, StatementTreeViewInfo> statementTree; try { relation.setRefObjectId(clu.getId()); relation.setRefObjectTypeKey(ProgramAssemblerConstants.PROGRAM_REQUIREMENT); relation.setStatementId(statement.getId());
StatementTreeViewInfo updated = statementService.updateStatementTreeView(treeView.getId(), treeView); if(results.getAssembler() != null && results.getBusinessDTORef() != null) { results.getAssembler().assemble(updated, results.getBusinessDTORef(), true, contextInfo); statementService.deleteStatementTreeView(treeView.getId()); break;