Coverage Report - org.kuali.student.lum.program.client.requirements.ProgramRequirementsDataModel
 
Classes in this File Line Coverage Branch Coverage Complexity
ProgramRequirementsDataModel
0%
0/153
0%
0/76
2.405
ProgramRequirementsDataModel$1
0%
0/8
N/A
2.405
ProgramRequirementsDataModel$2
0%
0/8
0%
0/2
2.405
ProgramRequirementsDataModel$3
0%
0/9
0%
0/2
2.405
ProgramRequirementsDataModel$4
0%
0/21
0%
0/4
2.405
ProgramRequirementsDataModel$5
0%
0/29
0%
0/7
2.405
ProgramRequirementsDataModel$6
0%
0/1
N/A
2.405
ProgramRequirementsDataModel$requirementState
0%
0/1
N/A
2.405
 
 1  
 /**
 2  
  * Copyright 2010 The Kuali Foundation Licensed under the
 3  
  * Educational Community License, Version 2.0 (the "License"); you may
 4  
  * not use this file except in compliance with the License. You may
 5  
  * obtain a copy of the License at
 6  
  *
 7  
  * http://www.osedu.org/licenses/ECL-2.0
 8  
  *
 9  
  * Unless required by applicable law or agreed to in writing,
 10  
  * software distributed under the License is distributed on an "AS IS"
 11  
  * BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
 12  
  * or implied. See the License for the specific language governing
 13  
  * permissions and limitations under the License.
 14  
  */
 15  
 package org.kuali.student.lum.program.client.requirements;
 16  
 
 17  
 import java.util.*;
 18  
 
 19  
 import org.kuali.student.common.assembly.data.Data;
 20  
 import org.kuali.student.common.ui.client.application.KSAsyncCallback;
 21  
 import org.kuali.student.common.ui.client.mvc.*;
 22  
 import org.kuali.student.core.statement.dto.ReqCompFieldInfo;
 23  
 import org.kuali.student.core.statement.dto.ReqComponentInfo;
 24  
 import org.kuali.student.core.statement.dto.StatementTreeViewInfo;
 25  
 import org.kuali.student.core.statement.dto.StatementTypeInfo;
 26  
 import org.kuali.student.core.statement.ui.client.widgets.rules.RulesUtil;
 27  
 import org.kuali.student.lum.program.client.ProgramConstants;
 28  
 import org.kuali.student.lum.program.client.events.StoreRequirementIDsEvent;
 29  
 import org.kuali.student.lum.program.client.events.StoreSpecRequirementIDsEvent;
 30  
 import org.kuali.student.lum.program.client.rpc.MajorDisciplineRpcService;
 31  
 import org.kuali.student.lum.program.client.rpc.MajorDisciplineRpcServiceAsync;
 32  
 import org.kuali.student.lum.program.client.rpc.StatementRpcService;
 33  
 import org.kuali.student.lum.program.client.rpc.StatementRpcServiceAsync;
 34  
 import org.kuali.student.lum.program.dto.ProgramRequirementInfo;
 35  
 
 36  
 import com.google.gwt.core.client.GWT;
 37  
 import com.google.gwt.event.shared.HandlerManager;
 38  
 import com.google.gwt.user.client.Window;
 39  
 
 40  0
 public class ProgramRequirementsDataModel {
 41  
 
 42  0
     private final MajorDisciplineRpcServiceAsync programRemoteService = GWT.create(MajorDisciplineRpcService.class);
 43  0
     private StatementRpcServiceAsync statementRpcServiceAsync = GWT.create(StatementRpcService.class);
 44  0
     private Model model = null;
 45  
     private HandlerManager eventBus;
 46  
 
 47  
     //keeping track of rules and rule state
 48  0
     public enum requirementState {STORED, ADDED, EDITED, DELETED;}
 49  0
     private Map<Integer, ProgramRequirementInfo> progReqInfos = new LinkedHashMap<Integer, ProgramRequirementInfo>();
 50  0
     private Map<Integer, ProgramRequirementInfo> origProgReqInfos = new LinkedHashMap<Integer, ProgramRequirementInfo>();
 51  0
     private Map<Integer, requirementState> progReqState = new HashMap<Integer, requirementState>();
 52  0
     private Map<Integer, requirementState> origProgReqState = new HashMap<Integer, requirementState>();
 53  0
     private List<StatementTypeInfo> stmtTypes = new ArrayList<StatementTypeInfo>();
 54  0
     private boolean isInitialized = false;
 55  0
     private static Integer progReqIDs = 111111;
 56  
 
 57  0
     public ProgramRequirementsDataModel(HandlerManager eventBus) {
 58  0
         this.eventBus = eventBus;
 59  0
     }
 60  
 
 61  
     //find out whether we need to reset rules based on whether we have a new program ID or not
 62  
     public void setupRules(Controller parentController, final Callback<Boolean> onReadyCallback) {
 63  0
         parentController.requestModel(ProgramConstants.PROGRAM_MODEL_ID, new ModelRequestCallback() {
 64  
 
 65  
             @Override
 66  
             public void onRequestFail(Throwable cause) {
 67  0
                 GWT.log("Unable to retrieve program model for program summary view", cause);
 68  0
                 onReadyCallback.exec(false);
 69  0
             }
 70  
 
 71  
             @Override
 72  
             public void onModelReady(Model modelIn) {
 73  
                 //TODO how can we reliably know that we need to reload rules (or not)
 74  
                 //String programId = (model == null ? null : (String)((DataModel)model).getRoot().get("id"));
 75  
                 //String modelProgramId = ((DataModel)modelIn).getRoot().get(ProgramConstants.ID);
 76  
                 //if ((modelProgramId == null) || (!modelProgramId.equals(programId))) {
 77  0
                     resetRules();
 78  
                 //}
 79  0
                 model = modelIn;
 80  0
                 onReadyCallback.exec(true);
 81  0
             }
 82  
         });
 83  0
     }
 84  
 
 85  
     private void resetRules() {
 86  0
         progReqInfos = new LinkedHashMap<Integer, ProgramRequirementInfo>();
 87  0
         origProgReqInfos = new LinkedHashMap<Integer, ProgramRequirementInfo>();
 88  0
         progReqState = new HashMap<Integer, requirementState>();
 89  0
         origProgReqState = new HashMap<Integer, requirementState>();
 90  0
         stmtTypes = new ArrayList<StatementTypeInfo>();
 91  0
         model = null;
 92  0
         isInitialized = false;
 93  0
     }
 94  
 
 95  
     //retrieve rules based on IDs stored in this program
 96  
     public void retrieveProgramRequirements(Controller parentController, final Callback<Boolean> onReadyCallback) {
 97  
         
 98  0
         setupRules(parentController, new Callback<Boolean>() {
 99  
             @Override
 100  
             public void exec(Boolean result) {
 101  0
                 Data program = ((DataModel)model).getRoot().get(ProgramConstants.PROGRAM_REQUIREMENTS);
 102  
 
 103  0
                 Iterator<Data.Property> realPropertyIterator = program.realPropertyIterator();
 104  0
                 ArrayList<String> programRequirementIds = new ArrayList<String>();
 105  0
                 while(realPropertyIterator.hasNext()) {
 106  0
                     programRequirementIds.add((String)realPropertyIterator.next().getValue());
 107  
                 }
 108  0
                 retrieveStatementTypes(programRequirementIds, onReadyCallback);
 109  0
             }
 110  
         });               
 111  0
     }
 112  
 
 113  
     private void retrieveStatementTypes(final List<String> programRequirementIds, final Callback<Boolean> onReadyCallback) {
 114  
 
 115  
         //retrieve available program requirement types
 116  0
         statementRpcServiceAsync.getStatementTypesForStatementType("kuali.statement.type.program", new KSAsyncCallback<List<StatementTypeInfo>>() {
 117  
             @Override
 118  
             public void handleFailure(Throwable caught) {
 119  0
                     Window.alert(caught.getMessage());
 120  0
                     GWT.log("getStatementTypes failed", caught);
 121  0
                 onReadyCallback.exec(false);
 122  0
             }
 123  
 
 124  
             @Override
 125  
             public void onSuccess(List<StatementTypeInfo> stmtInfoTypes) {
 126  
                 //store the statement types
 127  0
                 for (StatementTypeInfo stmtInfoType : stmtInfoTypes) {
 128  0
                     stmtTypes.add(stmtInfoType);
 129  
                 }
 130  
 
 131  
                 //now retrieve the actual rules
 132  0
                 retrieveRules(programRequirementIds, onReadyCallback);
 133  0
             }
 134  
         });
 135  0
     }
 136  
 
 137  
     private void retrieveRules(List<String> programRequirementIds, final Callback<Boolean> onReadyCallback) {
 138  
 
 139  
         //true if no program requirements exist yet
 140  0
         if ((programRequirementIds == null) || programRequirementIds.isEmpty()) {
 141  0
             isInitialized = true;
 142  0
             onReadyCallback.exec(true);
 143  0
             return;
 144  
         }
 145  
 
 146  0
         programRemoteService.getProgramRequirements(programRequirementIds, new KSAsyncCallback<List<ProgramRequirementInfo>>() {
 147  
             @Override
 148  
             public void handleFailure(Throwable caught) {
 149  0
                 Window.alert(caught.getMessage());
 150  0
                 GWT.log("getProgramRequirement failed", caught);
 151  0
                 onReadyCallback.exec(false);
 152  0
             }
 153  
 
 154  
             @Override
 155  
             public void onSuccess(List<ProgramRequirementInfo> programReqInfos) {
 156  
                 //update rules list with new program requirements
 157  0
                 origProgReqInfos.clear();
 158  0
                 origProgReqState.clear();
 159  0
                 progReqInfos.clear();
 160  0
                 progReqState.clear();
 161  0
                 for (ProgramRequirementInfo programReqInfo : programReqInfos) {
 162  
 
 163  0
                     if (getStmtTypeInfo(programReqInfo.getStatement().getType()) == null) {
 164  0
                         Window.alert("Did not find corresponding statement type for program requirement of type: " + programReqInfo.getStatement().getType());
 165  0
                         GWT.log("Did not find corresponding statement type for program requirement of type: " + programReqInfo.getStatement().getType(), null);
 166  
                     }
 167  
 
 168  0
                     setRuleState(programReqInfo);
 169  0
                     origProgReqInfos.put(progReqIDs, cloneProgReq(programReqInfo));
 170  0
                     origProgReqState.put(progReqIDs, requirementState.STORED);
 171  0
                     progReqInfos.put(progReqIDs, programReqInfo);
 172  0
                     progReqState.put(progReqIDs++, requirementState.STORED);
 173  
                 }
 174  
 
 175  0
                 isInitialized = true;
 176  0
                 onReadyCallback.exec(true);
 177  0
             }
 178  
         });     
 179  0
     }
 180  
 
 181  
     public ProgramRequirementInfo updateRules(StatementTreeViewInfo newSubRule, Integer internalProgReqID, boolean isNewRule) {
 182  
 
 183  0
         ProgramRequirementInfo affectedRule = progReqInfos.get(internalProgReqID);
 184  
 
 185  0
         if (affectedRule == null) {
 186  0
             Window.alert("Cannot find program requirement with a statement that has id: '" + newSubRule.getId() + "'");
 187  0
             GWT.log("Cannot find program requirement with a statement that has id: '" + newSubRule.getId() + "'", null);
 188  0
             return null;
 189  
         }
 190  
 
 191  0
         if (progReqState.get(internalProgReqID) == ProgramRequirementsDataModel.requirementState.STORED) {
 192  0
             progReqState.put(internalProgReqID, ProgramRequirementsDataModel.requirementState.EDITED);
 193  
         }
 194  
 
 195  
         //if we don't have top level req. components wrapped in statement, do so before we add another statement
 196  0
         StatementTreeViewInfo affectedTopTree = affectedRule.getStatement();
 197  0
         if ((affectedTopTree.getReqComponents() != null) && !affectedTopTree.getReqComponents().isEmpty()) {
 198  0
             StatementTreeViewInfo stmtTree = new StatementTreeViewInfo();
 199  0
             stmtTree.setId(ProgramRequirementsSummaryView.generateStatementTreeId());
 200  0
             stmtTree.setType( affectedRule.getStatement().getType());
 201  0
             stmtTree.setReqComponents(affectedTopTree.getReqComponents());
 202  0
             List<StatementTreeViewInfo> stmtList = new ArrayList<StatementTreeViewInfo>();
 203  0
             stmtList.add(stmtTree);
 204  0
             affectedTopTree.setStatements(stmtList);
 205  
         }
 206  
 
 207  
         //now update the actual rule
 208  0
         List<StatementTreeViewInfo> affectedSubRules = affectedTopTree.getStatements();
 209  0
         if (isNewRule) {
 210  0
             affectedSubRules.add(newSubRule);
 211  
         } else {
 212  
             //update rule
 213  0
             if (affectedSubRules == null || affectedSubRules.isEmpty()) {
 214  0
                 affectedRule.setStatement(newSubRule);
 215  
             } else { //replace the related stored subrule with a new version
 216  0
                 for (StatementTreeViewInfo subRule : affectedSubRules) {
 217  0
                     if (subRule.getId().equals(newSubRule.getId())) {
 218  0
                         int treeIx = affectedSubRules.indexOf(subRule);
 219  
                         //only update if the rule is not empty
 220  0
                         if (!isEmptyRule(newSubRule)) {
 221  0
                             affectedSubRules.add(treeIx, newSubRule);
 222  
                         }
 223  0
                         affectedSubRules.remove(subRule);
 224  0
                         break;
 225  
                     }
 226  
                 }
 227  
             }
 228  
         }
 229  
 
 230  0
         return affectedRule;
 231  
     }
 232  
 
 233  
     public void updateProgramEntities(final Callback<List<ProgramRequirementInfo>> callback) {
 234  
 
 235  0
         final List<String> referencedProgReqIds = new ArrayList<String>();
 236  
 
 237  0
         programRemoteService.storeProgramRequirements(progReqState, progReqInfos, new KSAsyncCallback<Map<Integer, ProgramRequirementInfo>>() {
 238  
             @Override
 239  
             public void handleFailure(Throwable caught) {
 240  0
                 Window.alert(caught.getMessage());
 241  0
                 GWT.log("storeProgramRequirements failed", caught);
 242  0
             }
 243  
             @Override
 244  
             public void onSuccess(Map<Integer, ProgramRequirementInfo> storedRules) {
 245  
 
 246  0
                 for (Integer internalProgReqID : storedRules.keySet()) {
 247  0
                     ProgramRequirementInfo storedRule = storedRules.get(internalProgReqID);
 248  0
                     switch (progReqState.get(internalProgReqID)) {
 249  
                         case STORED:
 250  
                             //rule was not changed so continue
 251  0
                             referencedProgReqIds.add(progReqInfos.get(internalProgReqID).getId());
 252  0
                             break;
 253  
                         case ADDED:
 254  0
                             referencedProgReqIds.add(storedRule.getId());
 255  0
                             progReqInfos.put(internalProgReqID, storedRule);
 256  0
                             origProgReqInfos.put(internalProgReqID, cloneProgReq(storedRule));
 257  0
                             origProgReqState.put(internalProgReqID, ProgramRequirementsDataModel.requirementState.STORED);
 258  0
                             progReqState.put(internalProgReqID, ProgramRequirementsDataModel.requirementState.STORED);
 259  0
                             break;
 260  
                         case EDITED:
 261  0
                             referencedProgReqIds.add(storedRule.getId());
 262  0
                             progReqInfos.put(internalProgReqID, storedRule);
 263  0
                             origProgReqInfos.put(internalProgReqID, cloneProgReq(storedRule));
 264  0
                             origProgReqState.put(internalProgReqID, ProgramRequirementsDataModel.requirementState.STORED);
 265  0
                             progReqState.put(internalProgReqID, ProgramRequirementsDataModel.requirementState.STORED);
 266  0
                             break;
 267  
                         case DELETED:
 268  0
                             progReqInfos.remove(internalProgReqID);
 269  0
                             origProgReqInfos.remove(internalProgReqID);
 270  0
                             origProgReqState.remove(internalProgReqID);                            
 271  0
                             progReqState.remove(internalProgReqID);
 272  0
                             break;
 273  
                         default:
 274  
                             break;
 275  
                     }
 276  0
                 }
 277  
 
 278  0
                 saveRequirementIds(referencedProgReqIds, storedRules, callback);
 279  0
             }
 280  
         });        
 281  0
     }
 282  
 
 283  
     private void saveRequirementIds(final List<String> referencedProgReqIds, final Map<Integer, ProgramRequirementInfo> storedRules, final Callback<List<ProgramRequirementInfo>> callback) {
 284  0
         String programId = ((DataModel)model).getRoot().get("id");
 285  0
         String programType = ((DataModel)model).getRoot().get("type");
 286  
 
 287  
         //for some reason, credential program has type stored in 'credentialProgramType'
 288  0
         if (programType == null) {
 289  0
             programType = ((DataModel)model).getRoot().get("credentialProgramType");    
 290  
         }
 291  
 
 292  
         //specializations will be handled differently from Major
 293  0
         if (programType.equals(ProgramConstants.VARIATION_TYPE_KEY)) {
 294  0
             eventBus.fireEvent(new StoreSpecRequirementIDsEvent(programId, programType, referencedProgReqIds));
 295  
         } else {
 296  0
             eventBus.fireEvent(new StoreRequirementIDsEvent(programId, programType, referencedProgReqIds));
 297  
         }
 298  
 
 299  0
         callback.exec(new ArrayList(storedRules.values()));  //update display widgets
 300  0
     }
 301  
 
 302  
 
 303  
     public List<ProgramRequirementInfo> getProgReqInfo(String stmtTypeId) {
 304  0
         List<ProgramRequirementInfo> rules = new ArrayList<ProgramRequirementInfo>();
 305  0
         for(ProgramRequirementInfo progReqInfo : progReqInfos.values()) {
 306  0
             if (progReqInfo.getStatement().getType().equals(stmtTypeId)) {
 307  0
                 rules.add(progReqInfo);
 308  
             }
 309  
         }
 310  0
         return rules;
 311  
     }
 312  
 
 313  
     public Integer getInternalProgReqID(ProgramRequirementInfo progReqInfo) {
 314  0
         for(Integer key : progReqInfos.keySet()) {
 315  0
             if (progReqInfos.get(key) == progReqInfo) {
 316  0
                 return key;
 317  
             }
 318  
         }
 319  
 
 320  0
         Window.alert("Problem retrieving key for program requirement: " + progReqInfo.getId());
 321  0
         GWT.log("Problem retrieving key for program requirement: " + progReqInfo.getId(), null);        
 322  
 
 323  0
         return null;
 324  
     }
 325  
 
 326  
     public StatementTypeInfo getStmtTypeInfo(String stmtTypeId) {
 327  0
         for (StatementTypeInfo stmtInfo : stmtTypes) {
 328  0
             if (stmtInfo.getId().equals(stmtTypeId)) {
 329  0
                 return stmtInfo;
 330  
             }
 331  
         }
 332  
 
 333  0
         Window.alert("Did not find StatementTypeInfo based on type: " + stmtTypeId);
 334  0
         GWT.log("Did not find StatementTypeInfo based on type: " + stmtTypeId);
 335  
 
 336  0
         return null;
 337  
     }
 338  
 
 339  
     public void deleteRule(Integer internalProgReqID) {
 340  0
         if (progReqState.get(internalProgReqID) == ProgramRequirementsDataModel.requirementState.ADDED) {
 341  
             //user added a rule, didn't save it and now wants to delete it
 342  0
             progReqState.remove(internalProgReqID);
 343  0
             progReqInfos.remove(internalProgReqID);
 344  
         } else {
 345  0
             markRuleAsDeleted(internalProgReqID);
 346  
         }
 347  0
     }
 348  
 
 349  
     public void addRule(ProgramRequirementInfo programReqInfo) { 
 350  0
             setRuleState(programReqInfo);
 351  0
         progReqInfos.put(progReqIDs, programReqInfo);
 352  0
         progReqState.put(progReqIDs++, requirementState.ADDED);
 353  0
     }
 354  
 
 355  
     public void updateRule(Integer internalProgReqID, ProgramRequirementInfo programReqInfo) {
 356  0
             setRuleState(programReqInfo);            
 357  0
         progReqInfos.put(internalProgReqID, programReqInfo);
 358  0
         markRuleAsEdited(internalProgReqID);
 359  0
     }
 360  
     
 361  
     /**
 362  
      * Set the state of the program requirement to state of the program.
 363  
      * 
 364  
      * @param programReqInfo
 365  
      */
 366  
     protected void setRuleState(ProgramRequirementInfo programReqInfo) {
 367  0
         if (model != null) {
 368  0
             String programState = ((DataModel) model).get(ProgramConstants.STATE);
 369  0
             programReqInfo.setState(programState);
 370  
         }
 371  0
     }
 372  
 
 373  
     public void markRuleAsDeleted(Integer internalProgReqID) {
 374  0
         if ((progReqState.get(internalProgReqID) == ProgramRequirementsDataModel.requirementState.STORED) ||
 375  
             (progReqState.get(internalProgReqID) == ProgramRequirementsDataModel.requirementState.EDITED)) {
 376  0
             progReqState.put(internalProgReqID, ProgramRequirementsDataModel.requirementState.DELETED);
 377  
         }
 378  0
     }
 379  
 
 380  
     public void markRuleAsEdited(Integer internalProgReqID) {
 381  0
         if (progReqState.get(internalProgReqID) == ProgramRequirementsDataModel.requirementState.STORED) {
 382  0
             progReqState.put(internalProgReqID, ProgramRequirementsDataModel.requirementState.EDITED);
 383  
         }
 384  0
     }
 385  
 
 386  
     public String getStmtTypeName(String stmtTypeId) {
 387  0
         String name = getStmtTypeInfo(stmtTypeId).getName();
 388  0
         return (name == null ? "" : name);
 389  
     }
 390  
     
 391  
     public boolean isRuleExists(String stmtTypeId) {
 392  0
         boolean showNoRuleText = true;
 393  0
         for(ProgramRequirementInfo ruleInfo : progReqInfos.values()) {
 394  0
             if ((ruleInfo.getStatement().getType().equals(stmtTypeId)) && (progReqState.get(getInternalProgReqID(ruleInfo)) != ProgramRequirementsDataModel.requirementState.DELETED)) {
 395  0
                 showNoRuleText = false;
 396  
             }
 397  
         }
 398  0
         return showNoRuleText;
 399  
     }
 400  
 
 401  
     public boolean isDirty() {
 402  
 
 403  0
         if (progReqState.size() != origProgReqState.size()) {
 404  0
             return true;
 405  
         }
 406  
 
 407  0
         for(Integer key : progReqState.keySet()) {
 408  0
             if (!progReqState.get(key).equals(origProgReqState.get(key))) {
 409  0
                 return true;
 410  
             }
 411  
         }
 412  
 
 413  
         /*
 414  
         for(Integer key : progReqInfos.keySet()) {
 415  
             if (!progReqInfos.get(key).equals(origProgReqInfos.get(key))) {
 416  
                 return true;
 417  
             }
 418  
         } */
 419  0
         return false;
 420  
     }
 421  
 
 422  
     public void revertRuleChanges() {
 423  0
         progReqInfos = new HashMap<Integer, ProgramRequirementInfo>();
 424  0
         progReqState = new HashMap<Integer, requirementState>();
 425  0
         for(Integer key : origProgReqInfos.keySet()) {
 426  0
             progReqInfos.put(key, cloneProgReq(origProgReqInfos.get(key)));
 427  0
             progReqState.put(key, origProgReqState.get(key));
 428  
         }
 429  0
     }
 430  
 
 431  
     public ProgramRequirementInfo getProgReqByInternalId(Integer internalProgReqID) {
 432  0
         return progReqInfos.get(internalProgReqID);
 433  
     }
 434  
 
 435  
     public boolean isEmptyRule(StatementTreeViewInfo tree) {
 436  0
         return (tree.getStatements() == null || tree.getStatements().isEmpty() && (tree.getReqComponents() == null || tree.getReqComponents().isEmpty()));
 437  
     }  
 438  
 
 439  
     public boolean isInitialized() {
 440  0
         return isInitialized;
 441  
     }
 442  
 
 443  
     public void setInitialized(boolean initialized) {
 444  0
         isInitialized = initialized;
 445  0
     }
 446  
 
 447  
     public List<StatementTypeInfo> getStmtTypes() {
 448  0
         return stmtTypes;
 449  
     }
 450  
 
 451  
     private ProgramRequirementInfo cloneProgReq(ProgramRequirementInfo inProgReqInfo) {
 452  0
         ProgramRequirementInfo clonedProgReqInfo = null;
 453  0
         if (inProgReqInfo != null) {
 454  0
             clonedProgReqInfo = new ProgramRequirementInfo();
 455  0
             clonedProgReqInfo.setId(inProgReqInfo.getId());
 456  0
             clonedProgReqInfo.setShortTitle(inProgReqInfo.getShortTitle());
 457  0
             clonedProgReqInfo.setLongTitle(inProgReqInfo.getLongTitle());
 458  0
             clonedProgReqInfo.setDescr(inProgReqInfo.getDescr());
 459  0
             clonedProgReqInfo.setMinCredits(inProgReqInfo.getMinCredits());
 460  0
             clonedProgReqInfo.setMaxCredits(inProgReqInfo.getMaxCredits());
 461  0
             clonedProgReqInfo.setState(inProgReqInfo.getState());
 462  0
             clonedProgReqInfo.setType(inProgReqInfo.getType());
 463  0
             clonedProgReqInfo.setStatement(RulesUtil.clone(inProgReqInfo.getStatement()));
 464  
             //TODO clonedProgReqInfo.setAttributes();
 465  
             //TODO clonedProgReqInfo.setLearningObjectives();
 466  
             //TODO clonedProgReqInfo.setMetaInfo();
 467  
         }
 468  0
         return clonedProgReqInfo;
 469  
     }  
 470  
 }