public void statementTreeViewInfoStateSetter(String courseState, Iterator<StatementTreeViewInfo> itr) { while(itr.hasNext()) { StatementTreeViewInfo statementTreeViewInfo = (StatementTreeViewInfo)itr.next(); statementTreeViewInfo.setState(courseState); List<ReqComponentInfo> reqComponents = statementTreeViewInfo.getReqComponents(); for(Iterator<ReqComponentInfo> it = reqComponents.iterator(); it.hasNext();) it.next().setState(courseState); statementTreeViewInfoStateSetter(courseState, statementTreeViewInfo.getStatements().iterator()); } } }
/** * This method will recursively set the state of all statements in the tree. * <p> * WARNING: you must call the statement service in order to update statements. * <p> * * @param state is the state we should set all statements in the tree to * @param statementTreeViewInfo the tree of statements * @throws Exception */ public static void updateStatementTreeViewInfoState(String state, StatementTreeViewInfo statementTreeViewInfo) { // Set the state on the statement tree itself statementTreeViewInfo.setState(state); // Get all the requirements components for this statement List<ReqComponentInfo> reqComponents = statementTreeViewInfo.getReqComponents(); // Loop over requirements and set the state for each requirement for(Iterator<ReqComponentInfo> it = reqComponents.iterator(); it.hasNext();) it.next().setState(state); // Loop over each statement and set the state for each statement (recursively calling this method) for(Iterator<StatementTreeViewInfo> itr = statementTreeViewInfo.getStatements().iterator(); itr.hasNext();) updateStatementTreeViewInfoState(state, (StatementTreeViewInfo)itr.next()); } /**
/** * This method will recursively set the state of all statements in the tree. * <p> * WARNING: you must call the statement service in order to update statements. * <p> * * @param state is the state we should set all statements in the tree to * @param statementTreeViewInfo the tree of statements * @throws Exception */ public static void updateStatementTreeViewInfoState(String state, StatementTreeViewInfo statementTreeViewInfo) { // Set the state on the statement tree itself statementTreeViewInfo.setState(state); // Get all the requirements components for this statement List<ReqComponentInfo> reqComponents = statementTreeViewInfo.getReqComponents(); // Loop over requirements and set the state for each requirement for(Iterator<ReqComponentInfo> it = reqComponents.iterator(); it.hasNext();) it.next().setState(state); // Loop over each statement and set the state for each statement (recursively calling this method) for(Iterator<StatementTreeViewInfo> itr = statementTreeViewInfo.getStatements().iterator(); itr.hasNext();) updateStatementTreeViewInfoState(state, (StatementTreeViewInfo)itr.next()); } /**
statementTreeViewInfo.setState(state);
statementTreeView.setState(newState);
public StatementTreeViewInfo toStatementTreeViewInfo(Statement stmt) { StatementTreeViewInfo treeView = new StatementTreeViewInfo(); treeView.setAttributes(toAttributeMap(stmt.getAttributes())); treeView.setDesc(toRichTextInfo(stmt.getDescr())); treeView.setId(stmt.getId()); treeView.setMetaInfo(toMetaInfo(stmt.getMeta(), stmt.getVersionNumber())); treeView.setName(stmt.getName()); treeView.setType(stmt.getStatementType().getId()); treeView.setState(stmt.getState()); for (ReqComponent reqComp : stmt.getRequiredComponents()) { treeView.getReqComponents().add(toReqComponentInfo(reqComp)); } treeView.setOperator(stmt.getOperator()); for (Statement childStmt : stmt.getChildren()) { treeView.getStatements().add(toStatementTreeViewInfo(childStmt)); } return treeView; } }