| 1 |  | package org.kuali.student.lum.program.server; | 
            
  
    | 2 |  |  | 
            
  
    | 3 |  | import java.util.ArrayList; | 
            
  
    | 4 |  | import java.util.List; | 
            
  
    | 5 |  |  | 
            
  
    | 6 |  | import org.apache.log4j.Logger; | 
            
  
    | 7 |  | import org.kuali.student.common.dictionary.old.dto.ObjectStructure; | 
            
  
    | 8 |  | import org.kuali.student.common.exceptions.DoesNotExistException; | 
            
  
    | 9 |  | import org.kuali.student.common.search.dto.SearchCriteriaTypeInfo; | 
            
  
    | 10 |  | import org.kuali.student.common.search.dto.SearchRequest; | 
            
  
    | 11 |  | import org.kuali.student.common.search.dto.SearchResult; | 
            
  
    | 12 |  | import org.kuali.student.common.search.dto.SearchResultTypeInfo; | 
            
  
    | 13 |  | import org.kuali.student.common.search.dto.SearchTypeInfo; | 
            
  
    | 14 |  | import org.kuali.student.common.ui.client.widgets.rules.ReqComponentInfoUi; | 
            
  
    | 15 |  | import org.kuali.student.common.versionmanagement.dto.VersionDisplayInfo; | 
            
  
    | 16 |  | import org.kuali.student.core.statement.dto.ReqComponentInfo; | 
            
  
    | 17 |  | import org.kuali.student.core.statement.dto.ReqComponentTypeInfo; | 
            
  
    | 18 |  | import org.kuali.student.core.statement.dto.StatementTreeViewInfo; | 
            
  
    | 19 |  | import org.kuali.student.core.statement.dto.StatementTypeInfo; | 
            
  
    | 20 |  | import org.kuali.student.core.statement.service.StatementService; | 
            
  
    | 21 |  | import org.kuali.student.lum.lu.dto.CluInfo; | 
            
  
    | 22 |  | import org.kuali.student.lum.lu.service.LuService; | 
            
  
    | 23 |  | import org.kuali.student.lum.program.client.rpc.StatementRpcService; | 
            
  
    | 24 |  | import org.springframework.transaction.annotation.Transactional; | 
            
  
    | 25 |  |  | 
            
  
    | 26 |  | @Transactional(readOnly=true,noRollbackFor={DoesNotExistException.class},rollbackFor={Throwable.class}) | 
               
        |  |  | 
           
           |  | 0% | Uncovered Elements: 61 (61) | Complexity: 22 | Complexity Density: 0.55 |  | 
  
  
    | 27 |  | public class StatementDataService implements StatementRpcService{ | 
            
  
    | 28 |  | final static Logger LOG = Logger.getLogger(StatementDataService.class); | 
            
  
    | 29 |  |  | 
            
  
    | 30 |  |  | 
            
  
    | 31 |  | private StatementService statementService; | 
            
  
    | 32 |  | private LuService luService; | 
            
  
    | 33 |  |  | 
            
  
    | 34 |  | private static final long serialVersionUID = 822326113643828855L; | 
               
        |  |  | 
           
           |  | 0% | Uncovered Elements: 8 (8) | Complexity: 1 | Complexity Density: 0.12 |  | 
  
  
    | 35 | 0 |  @Override... | 
            
  
    | 36 |  | public List<StatementTypeInfo> getStatementTypesForStatementTypeForCourse(String statementTypeKey) throws Exception { | 
            
  
    | 37 |  |  | 
            
  
    | 38 | 0 | List<StatementTypeInfo> allStatementTypes = new ArrayList<StatementTypeInfo>(); | 
            
  
    | 39 |  |  | 
            
  
    | 40 | 0 | List<String> topStatementTypes = statementService.getStatementTypesForStatementType(statementTypeKey); | 
            
  
    | 41 |  |  | 
            
  
    | 42 |  |  | 
            
  
    | 43 | 0 | for (String topStatementType : topStatementTypes) { | 
            
  
    | 44 | 0 | allStatementTypes.add(statementService.getStatementType(topStatementType)); | 
            
  
    | 45 | 0 | List<String> subStatementTypeNames = statementService.getStatementTypesForStatementType(topStatementType); | 
            
  
    | 46 |  |  | 
            
  
    | 47 |  |  | 
            
  
    | 48 | 0 | for (String subStatementTypeName : subStatementTypeNames) { | 
            
  
    | 49 | 0 | allStatementTypes.add(statementService.getStatementType(subStatementTypeName)); | 
            
  
    | 50 |  | } | 
            
  
    | 51 |  | } | 
            
  
    | 52 |  |  | 
            
  
    | 53 | 0 | return allStatementTypes; | 
            
  
    | 54 |  | } | 
            
  
    | 55 |  |  | 
               
        |  |  | 
           
           |  | 0% | Uncovered Elements: 5 (5) | Complexity: 1 | Complexity Density: 0.2 |  | 
  
  
    | 56 | 0 |  @Override... | 
            
  
    | 57 |  | public List<StatementTypeInfo> getStatementTypesForStatementType(String statementTypeKey) throws Exception { | 
            
  
    | 58 | 0 | List<String> statementTypeNames = statementService.getStatementTypesForStatementType(statementTypeKey); | 
            
  
    | 59 | 0 | List<StatementTypeInfo> statementTypes = new ArrayList<StatementTypeInfo>(); | 
            
  
    | 60 | 0 | for (String statementTypeName : statementTypeNames) { | 
            
  
    | 61 | 0 | statementTypes.add(statementService.getStatementType(statementTypeName)); | 
            
  
    | 62 |  | } | 
            
  
    | 63 | 0 | return statementTypes; | 
            
  
    | 64 |  | } | 
               
        |  |  | 
           
           |  | 0% | Uncovered Elements: 6 (6) | Complexity: 2 | Complexity Density: 0.33 |  | 
  
  
    | 65 | 0 |  @Override... | 
            
  
    | 66 |  | public List<ReqComponentTypeInfo> getReqComponentTypesForStatementType(String luStatementTypeKey) throws Exception { | 
            
  
    | 67 |  |  | 
            
  
    | 68 | 0 | List<ReqComponentTypeInfo> reqComponentTypeInfoList; | 
            
  
    | 69 | 0 | try { | 
            
  
    | 70 | 0 | reqComponentTypeInfoList = statementService.getReqComponentTypesForStatementType(luStatementTypeKey); | 
            
  
    | 71 |  | } catch (Exception ex) { | 
            
  
    | 72 | 0 | LOG.error(ex); | 
            
  
    | 73 | 0 | throw new Exception("Unable to find Requirement Component Types based on LU Statement Type Key:" + luStatementTypeKey, ex); | 
            
  
    | 74 |  | } | 
            
  
    | 75 |  |  | 
            
  
    | 76 | 0 | return reqComponentTypeInfoList; | 
            
  
    | 77 |  | } | 
            
  
    | 78 |  |  | 
               
        |  |  | 
           
           |  | 0% | Uncovered Elements: 1 (1) | Complexity: 1 | Complexity Density: 1 |  | 
  
  
    | 79 | 0 |  @Override... | 
            
  
    | 80 |  | public String translateStatementTreeViewToNL(StatementTreeViewInfo statementTreeViewInfo, String nlUsageTypeKey, String language) throws Exception { | 
            
  
    | 81 | 0 | return statementService.translateStatementTreeViewToNL(statementTreeViewInfo, nlUsageTypeKey, language); | 
            
  
    | 82 |  | } | 
            
  
    | 83 |  |  | 
               
        |  |  | 
           
           |  | 0% | Uncovered Elements: 1 (1) | Complexity: 1 | Complexity Density: 1 |  | 
  
  
    | 84 | 0 |  @Override... | 
            
  
    | 85 |  | public String translateReqComponentToNL(ReqComponentInfo reqComponentInfo, String nlUsageTypeKey, String language) throws Exception { | 
            
  
    | 86 | 0 | return statementService.translateReqComponentToNL(reqComponentInfo, nlUsageTypeKey, language); | 
            
  
    | 87 |  | } | 
            
  
    | 88 |  |  | 
               
        |  |  | 
           
           |  | 0% | Uncovered Elements: 4 (4) | Complexity: 1 | Complexity Density: 0.25 |  | 
  
  
    | 89 | 0 |  @Override... | 
            
  
    | 90 |  | public List<String> translateReqComponentToNLs(ReqComponentInfoUi reqComponentInfo, String[] nlUsageTypeKeys, String language) throws Exception { | 
            
  
    | 91 | 0 | List<String> nls = new ArrayList<String>(nlUsageTypeKeys.length); | 
            
  
    | 92 | 0 | for (String typeKey : nlUsageTypeKeys) { | 
            
  
    | 93 | 0 | nls.add(statementService.translateReqComponentToNL(reqComponentInfo, typeKey, language)); | 
            
  
    | 94 |  | } | 
            
  
    | 95 | 0 | return nls; | 
            
  
    | 96 |  | } | 
            
  
    | 97 |  |  | 
               
        |  |  | 
           
           |  | 0% | Uncovered Elements: 1 (1) | Complexity: 1 | Complexity Density: 1 |  | 
  
  
    | 98 | 0 |  @Override... | 
            
  
    | 99 |  | public CluInfo getClu(String cluId) throws Exception { | 
            
  
    | 100 | 0 | return luService.getClu(cluId); | 
            
  
    | 101 |  | } | 
            
  
    | 102 |  |  | 
               
        |  |  | 
           
           |  | 0% | Uncovered Elements: 1 (1) | Complexity: 1 | Complexity Density: 1 |  | 
  
  
    | 103 | 0 |  @Override... | 
            
  
    | 104 |  | public VersionDisplayInfo getCurrentVersion(String refObjectTypeURI, String refObjectId) throws Exception { | 
            
  
    | 105 | 0 | return luService.getCurrentVersion(refObjectTypeURI, refObjectId); | 
            
  
    | 106 |  | } | 
            
  
    | 107 |  |  | 
               
        |  |  | 
           
           |  | 0% | Uncovered Elements: 1 (1) | Complexity: 1 | Complexity Density: 1 |  | 
  
  
    | 108 | 0 |  public void setStatementService(StatementService statementService) {... | 
            
  
    | 109 | 0 | this.statementService = statementService; | 
            
  
    | 110 |  | } | 
            
  
    | 111 |  |  | 
               
        |  |  | 
           
           |  | 0% | Uncovered Elements: 1 (1) | Complexity: 1 | Complexity Density: 1 |  | 
  
  
    | 112 | 0 |  public void setLuService(LuService luService) {... | 
            
  
    | 113 | 0 | this.luService = luService; | 
            
  
    | 114 |  | } | 
            
  
    | 115 |  |  | 
               
        |  |  | 
           
           |  | 0% | Uncovered Elements: 1 (1) | Complexity: 1 | Complexity Density: 1 |  | 
  
  
    | 116 | 0 |  @Override... | 
            
  
    | 117 |  | public List<String> getObjectTypes() { | 
            
  
    | 118 | 0 | throw new UnsupportedOperationException(); | 
            
  
    | 119 |  | } | 
            
  
    | 120 |  |  | 
               
        |  |  | 
           
           |  | 0% | Uncovered Elements: 1 (1) | Complexity: 1 | Complexity Density: 1 |  | 
  
  
    | 121 | 0 |  @Override... | 
            
  
    | 122 |  | public ObjectStructure getObjectStructure(String objectTypeKey) { | 
            
  
    | 123 | 0 | throw new UnsupportedOperationException(); | 
            
  
    | 124 |  | } | 
            
  
    | 125 |  |  | 
               
        |  |  | 
           
           |  | 0% | Uncovered Elements: 1 (1) | Complexity: 1 | Complexity Density: 1 |  | 
  
  
    | 126 | 0 |  @Override... | 
            
  
    | 127 |  | public List<SearchTypeInfo> getSearchTypes() { | 
            
  
    | 128 | 0 | throw new UnsupportedOperationException(); | 
            
  
    | 129 |  | } | 
            
  
    | 130 |  |  | 
               
        |  |  | 
           
           |  | 0% | Uncovered Elements: 1 (1) | Complexity: 1 | Complexity Density: 1 |  | 
  
  
    | 131 | 0 |  @Override... | 
            
  
    | 132 |  | public SearchTypeInfo getSearchType(String searchTypeKey) { | 
            
  
    | 133 | 0 | throw new UnsupportedOperationException(); | 
            
  
    | 134 |  | } | 
            
  
    | 135 |  |  | 
               
        |  |  | 
           
           |  | 0% | Uncovered Elements: 1 (1) | Complexity: 1 | Complexity Density: 1 |  | 
  
  
    | 136 | 0 |  @Override... | 
            
  
    | 137 |  | public List<SearchTypeInfo> getSearchTypesByResult( | 
            
  
    | 138 |  | String searchResultTypeKey) { | 
            
  
    | 139 | 0 | throw new UnsupportedOperationException(); | 
            
  
    | 140 |  | } | 
            
  
    | 141 |  |  | 
               
        |  |  | 
           
           |  | 0% | Uncovered Elements: 1 (1) | Complexity: 1 | Complexity Density: 1 |  | 
  
  
    | 142 | 0 |  @Override... | 
            
  
    | 143 |  | public List<SearchTypeInfo> getSearchTypesByCriteria( | 
            
  
    | 144 |  | String searchCriteriaTypeKey) { | 
            
  
    | 145 | 0 | throw new UnsupportedOperationException(); | 
            
  
    | 146 |  | } | 
            
  
    | 147 |  |  | 
               
        |  |  | 
           
           |  | 0% | Uncovered Elements: 1 (1) | Complexity: 1 | Complexity Density: 1 |  | 
  
  
    | 148 | 0 |  @Override... | 
            
  
    | 149 |  | public List<SearchResultTypeInfo> getSearchResultTypes() { | 
            
  
    | 150 | 0 | throw new UnsupportedOperationException(); | 
            
  
    | 151 |  | } | 
            
  
    | 152 |  |  | 
               
        |  |  | 
           
           |  | 0% | Uncovered Elements: 1 (1) | Complexity: 1 | Complexity Density: 1 |  | 
  
  
    | 153 | 0 |  @Override... | 
            
  
    | 154 |  | public SearchResultTypeInfo getSearchResultType(String searchResultTypeKey) { | 
            
  
    | 155 | 0 | throw new UnsupportedOperationException(); | 
            
  
    | 156 |  | } | 
            
  
    | 157 |  |  | 
               
        |  |  | 
           
           |  | 0% | Uncovered Elements: 1 (1) | Complexity: 1 | Complexity Density: 1 |  | 
  
  
    | 158 | 0 |  @Override... | 
            
  
    | 159 |  | public List<SearchCriteriaTypeInfo> getSearchCriteriaTypes() { | 
            
  
    | 160 | 0 | throw new UnsupportedOperationException(); | 
            
  
    | 161 |  | } | 
            
  
    | 162 |  |  | 
               
        |  |  | 
           
           |  | 0% | Uncovered Elements: 1 (1) | Complexity: 1 | Complexity Density: 1 |  | 
  
  
    | 163 | 0 |  @Override... | 
            
  
    | 164 |  | public SearchCriteriaTypeInfo getSearchCriteriaType( | 
            
  
    | 165 |  | String searchCriteriaTypeKey) { | 
            
  
    | 166 | 0 | throw new UnsupportedOperationException(); | 
            
  
    | 167 |  | } | 
            
  
    | 168 |  |  | 
               
        |  |  | 
           
           |  | 0% | Uncovered Elements: 1 (1) | Complexity: 1 | Complexity Density: 1 |  | 
  
  
    | 169 | 0 |  @Override... | 
            
  
    | 170 |  | public SearchResult search(SearchRequest searchRequest) { | 
            
  
    | 171 | 0 | throw new UnsupportedOperationException(); | 
            
  
    | 172 |  | } | 
            
  
    | 173 |  | } |