| 1 | |
package org.kuali.student.enrollment.class1.lrc.service.impl; |
| 2 | |
|
| 3 | |
import java.util.ArrayList; |
| 4 | |
import java.util.List; |
| 5 | |
|
| 6 | |
import javax.jws.WebParam; |
| 7 | |
import javax.jws.WebService; |
| 8 | |
|
| 9 | |
import org.apache.commons.lang.StringUtils; |
| 10 | |
import org.kuali.student.enrollment.class1.lrc.dao.ResultScaleDao; |
| 11 | |
import org.kuali.student.enrollment.class1.lrc.dao.ResultValueDao; |
| 12 | |
import org.kuali.student.enrollment.class1.lrc.dao.ResultValuesGroupDao; |
| 13 | |
import org.kuali.student.enrollment.class1.lrc.model.ResultScaleEntity; |
| 14 | |
import org.kuali.student.enrollment.class1.lrc.model.ResultValueEntity; |
| 15 | |
import org.kuali.student.enrollment.class1.lrc.model.ResultValuesGroupEntity; |
| 16 | |
import org.kuali.student.r2.common.dto.ContextInfo; |
| 17 | |
import org.kuali.student.r2.common.dto.StatusInfo; |
| 18 | |
import org.kuali.student.r2.common.dto.ValidationResultInfo; |
| 19 | |
import org.kuali.student.r2.common.exceptions.AlreadyExistsException; |
| 20 | |
import org.kuali.student.r2.common.exceptions.DataValidationErrorException; |
| 21 | |
import org.kuali.student.r2.common.exceptions.DoesNotExistException; |
| 22 | |
import org.kuali.student.r2.common.exceptions.InvalidParameterException; |
| 23 | |
import org.kuali.student.r2.common.exceptions.MissingParameterException; |
| 24 | |
import org.kuali.student.r2.common.exceptions.OperationFailedException; |
| 25 | |
import org.kuali.student.r2.common.exceptions.PermissionDeniedException; |
| 26 | |
import org.kuali.student.r2.common.exceptions.VersionMismatchException; |
| 27 | |
import org.kuali.student.r2.core.state.service.StateService; |
| 28 | |
import org.kuali.student.r2.lum.lrc.dto.ResultScaleInfo; |
| 29 | |
import org.kuali.student.r2.lum.lrc.dto.ResultValueInfo; |
| 30 | |
import org.kuali.student.r2.lum.lrc.dto.ResultValuesGroupInfo; |
| 31 | |
import org.kuali.student.r2.lum.lrc.service.LRCService; |
| 32 | |
import org.springframework.transaction.annotation.Transactional; |
| 33 | |
|
| 34 | |
@WebService(name = "LrcService", serviceName = "LrcService", portName = "LrcService", targetNamespace = "http://student.kuali.org/wsdl/lrc") |
| 35 | |
@Transactional(readOnly = true, noRollbackFor = {DoesNotExistException.class}, rollbackFor = {Throwable.class}) |
| 36 | 0 | public class LRCServiceImpl implements LRCService { |
| 37 | |
|
| 38 | |
private ResultValuesGroupDao resultValuesGroupDao; |
| 39 | |
private ResultValueDao resultValueDao; |
| 40 | |
private ResultScaleDao resultScaleDao; |
| 41 | |
private StateService stateService; |
| 42 | |
|
| 43 | |
@Override |
| 44 | |
public ResultValuesGroupInfo getResultValuesGroup( |
| 45 | |
@WebParam(name = "resultValuesGroupId") String resultValuesGroupId, |
| 46 | |
@WebParam(name = "context") ContextInfo context) throws DoesNotExistException, InvalidParameterException, |
| 47 | |
MissingParameterException, OperationFailedException, PermissionDeniedException { |
| 48 | 0 | ResultValuesGroupEntity entity = resultValuesGroupDao.find(resultValuesGroupId); |
| 49 | 0 | if (entity != null) { |
| 50 | 0 | return entity.toDto(); |
| 51 | |
} |
| 52 | 0 | return null; |
| 53 | |
} |
| 54 | |
|
| 55 | |
@Override |
| 56 | |
public List<ResultValuesGroupInfo> getResultValuesGroupsByIds( |
| 57 | |
@WebParam(name = "resultValuesGroupIds") List<String> resultValuesGroupIds, |
| 58 | |
@WebParam(name = "context") ContextInfo context) throws DoesNotExistException, InvalidParameterException, |
| 59 | |
MissingParameterException, OperationFailedException, PermissionDeniedException { |
| 60 | 0 | List<ResultValuesGroupEntity> entities = resultValuesGroupDao.findByIds(resultValuesGroupIds); |
| 61 | 0 | List<ResultValuesGroupInfo> resultValuesGroupInfos = new ArrayList<ResultValuesGroupInfo>(); |
| 62 | 0 | for (ResultValuesGroupEntity entity : entities) { |
| 63 | 0 | resultValuesGroupInfos.add(entity.toDto()); |
| 64 | |
} |
| 65 | 0 | return resultValuesGroupInfos; |
| 66 | |
} |
| 67 | |
|
| 68 | |
@Override |
| 69 | |
public List<ResultValuesGroupInfo> getResultValuesGroupsByResultValue( |
| 70 | |
@WebParam(name = "resultValueId") String resultValueId, @WebParam(name = "context") ContextInfo context) |
| 71 | |
throws DoesNotExistException, InvalidParameterException, MissingParameterException, |
| 72 | |
OperationFailedException, PermissionDeniedException { |
| 73 | 0 | throw new UnsupportedOperationException("Method not implemented."); |
| 74 | |
} |
| 75 | |
|
| 76 | |
@Override |
| 77 | |
public List<String> getResultValuesGroupIdsByType( |
| 78 | |
@WebParam(name = "resultValuesGroupTypeKey") String resultValuesGroupTypeKey, |
| 79 | |
@WebParam(name = "context") ContextInfo context) throws DoesNotExistException, InvalidParameterException, |
| 80 | |
MissingParameterException, OperationFailedException, PermissionDeniedException { |
| 81 | 0 | throw new UnsupportedOperationException("Method not implemented."); |
| 82 | |
} |
| 83 | |
|
| 84 | |
@Override |
| 85 | |
public ResultValuesGroupInfo createResultValuesGroup( |
| 86 | |
@WebParam(name = "resultGroupInfo") ResultValuesGroupInfo gradeValuesGroupInfo, |
| 87 | |
@WebParam(name = "context") ContextInfo context) throws AlreadyExistsException, |
| 88 | |
DataValidationErrorException, InvalidParameterException, MissingParameterException, |
| 89 | |
OperationFailedException, PermissionDeniedException { |
| 90 | 0 | ResultValuesGroupEntity entity = resultValuesGroupDao.find(gradeValuesGroupInfo.getKey()); |
| 91 | 0 | if (entity != null) { |
| 92 | 0 | throw new AlreadyExistsException(gradeValuesGroupInfo.getKey() + " already exists"); |
| 93 | |
} |
| 94 | |
|
| 95 | 0 | ResultValuesGroupEntity newEntity = new ResultValuesGroupEntity(gradeValuesGroupInfo); |
| 96 | 0 | if (StringUtils.isNotBlank(gradeValuesGroupInfo.getStateKey())) { |
| 97 | 0 | newEntity.setState(gradeValuesGroupInfo.getStateKey()); |
| 98 | |
} |
| 99 | |
|
| 100 | 0 | if (StringUtils.isNotBlank(gradeValuesGroupInfo.getTypeKey())) { |
| 101 | 0 | newEntity.setType(gradeValuesGroupInfo.getTypeKey()); |
| 102 | |
} |
| 103 | |
|
| 104 | |
|
| 105 | |
|
| 106 | |
|
| 107 | |
|
| 108 | 0 | resultValuesGroupDao.persist(newEntity); |
| 109 | |
|
| 110 | 0 | return resultValuesGroupDao.find(newEntity.getId()).toDto(); |
| 111 | |
} |
| 112 | |
|
| 113 | |
@Override |
| 114 | |
public ResultValuesGroupInfo updateResultValuesGroup( |
| 115 | |
@WebParam(name = "resultValuesGroupId") String resultValuesGroupId, |
| 116 | |
@WebParam(name = "resultValuesGroupInfo") ResultValuesGroupInfo gradeValuesGroupInfo, |
| 117 | |
@WebParam(name = "context") ContextInfo context) throws DataValidationErrorException, |
| 118 | |
DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException, |
| 119 | |
PermissionDeniedException, VersionMismatchException { |
| 120 | 0 | throw new UnsupportedOperationException("Method not implemented."); |
| 121 | |
} |
| 122 | |
|
| 123 | |
@Override |
| 124 | |
public StatusInfo deleteResultValuesGroup(@WebParam(name = "resultValuesGroupId") String resultValuesGroupId, |
| 125 | |
@WebParam(name = "context") ContextInfo context) throws DoesNotExistException, InvalidParameterException, |
| 126 | |
MissingParameterException, OperationFailedException, PermissionDeniedException { |
| 127 | 0 | throw new UnsupportedOperationException("Method not implemented."); |
| 128 | |
} |
| 129 | |
|
| 130 | |
@Override |
| 131 | |
public List<ValidationResultInfo> validateResultValuesGroup( |
| 132 | |
@WebParam(name = "validationType") String validationType, |
| 133 | |
@WebParam(name = "resultGroupInfo") ResultValuesGroupInfo gradeValuesGroupInfo, |
| 134 | |
@WebParam(name = "context") ContextInfo context) throws DoesNotExistException, InvalidParameterException, |
| 135 | |
MissingParameterException, OperationFailedException { |
| 136 | 0 | throw new UnsupportedOperationException("Method not implemented."); |
| 137 | |
} |
| 138 | |
|
| 139 | |
@Override |
| 140 | |
public ResultValueInfo getResultValue(@WebParam(name = "resultValueId") String resultValueId, |
| 141 | |
@WebParam(name = "context") ContextInfo context) throws DoesNotExistException, InvalidParameterException, |
| 142 | |
MissingParameterException, OperationFailedException, PermissionDeniedException { |
| 143 | 0 | ResultValueEntity entity = resultValueDao.find(resultValueId); |
| 144 | 0 | if (entity != null) { |
| 145 | 0 | return entity.toDto(); |
| 146 | |
} |
| 147 | 0 | return null; |
| 148 | |
} |
| 149 | |
|
| 150 | |
@Override |
| 151 | |
public List<ResultValueInfo> getResultValuesByIds(@WebParam(name = "resultValueIds") List<String> resultValueIds, |
| 152 | |
@WebParam(name = "context") ContextInfo context) throws DoesNotExistException, InvalidParameterException, |
| 153 | |
MissingParameterException, OperationFailedException, PermissionDeniedException { |
| 154 | 0 | List<ResultValueEntity> entities = resultValueDao.findByIds(resultValueIds); |
| 155 | 0 | List<ResultValueInfo> infos = new ArrayList<ResultValueInfo>(); |
| 156 | 0 | for (ResultValueEntity entity : entities) { |
| 157 | 0 | infos.add(entity.toDto()); |
| 158 | |
} |
| 159 | 0 | return infos; |
| 160 | |
} |
| 161 | |
|
| 162 | |
@Override |
| 163 | |
public List<ResultValueInfo> getResultValuesForResultValuesGroup( |
| 164 | |
@WebParam(name = "resultValuesGroupId") String resultValuesGroupId, |
| 165 | |
@WebParam(name = "context") ContextInfo context) throws DoesNotExistException, InvalidParameterException, |
| 166 | |
MissingParameterException, OperationFailedException, PermissionDeniedException { |
| 167 | 0 | throw new UnsupportedOperationException("Method not implemented."); |
| 168 | |
} |
| 169 | |
|
| 170 | |
@Override |
| 171 | |
public ResultValueInfo createResultValue(@WebParam(name = "resultValueInfo") ResultValueInfo resultValueInfo, |
| 172 | |
@WebParam(name = "context") ContextInfo context) throws AlreadyExistsException, |
| 173 | |
DataValidationErrorException, DoesNotExistException, InvalidParameterException, MissingParameterException, |
| 174 | |
OperationFailedException, PermissionDeniedException { |
| 175 | 0 | throw new UnsupportedOperationException("Method not implemented."); |
| 176 | |
} |
| 177 | |
|
| 178 | |
@Override |
| 179 | |
public ResultValueInfo updateResultValue(@WebParam(name = "resultValueId") String resultValueId, |
| 180 | |
@WebParam(name = "resultValueInfo") ResultValueInfo resultValueInfo, |
| 181 | |
@WebParam(name = "context") ContextInfo context) throws DataValidationErrorException, |
| 182 | |
DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException, |
| 183 | |
PermissionDeniedException, VersionMismatchException { |
| 184 | 0 | throw new UnsupportedOperationException("Method not implemented."); |
| 185 | |
} |
| 186 | |
|
| 187 | |
@Override |
| 188 | |
public StatusInfo deleteResultValue(@WebParam(name = "resultValueId") String resultValueId, |
| 189 | |
@WebParam(name = "context") ContextInfo context) throws DoesNotExistException, InvalidParameterException, |
| 190 | |
MissingParameterException, OperationFailedException, PermissionDeniedException { |
| 191 | 0 | throw new UnsupportedOperationException("Method not implemented."); |
| 192 | |
} |
| 193 | |
|
| 194 | |
@Override |
| 195 | |
public List<ValidationResultInfo> validateResultValue(@WebParam(name = "validationType") String validationType, |
| 196 | |
@WebParam(name = "resultValueInfo") ResultValueInfo resultValueInfo, |
| 197 | |
@WebParam(name = "context") ContextInfo context) throws DoesNotExistException, InvalidParameterException, |
| 198 | |
MissingParameterException, OperationFailedException { |
| 199 | 0 | throw new UnsupportedOperationException("Method not implemented."); |
| 200 | |
} |
| 201 | |
|
| 202 | |
@Override |
| 203 | |
public ResultScaleInfo getResultScale(@WebParam(name = "resultScaleKey") String resultScaleKey, |
| 204 | |
@WebParam(name = "context") ContextInfo context) throws DoesNotExistException, InvalidParameterException, |
| 205 | |
MissingParameterException, OperationFailedException, PermissionDeniedException { |
| 206 | 0 | ResultScaleEntity entity = resultScaleDao.find(resultScaleKey); |
| 207 | 0 | if (entity != null) { |
| 208 | 0 | return entity.toDto(); |
| 209 | |
} |
| 210 | 0 | return null; |
| 211 | |
} |
| 212 | |
|
| 213 | |
@Override |
| 214 | |
public List<ResultValueInfo> getResultValuesForScale(@WebParam(name = "resultScaleKey") String resultScaleKey, |
| 215 | |
@WebParam(name = "context") ContextInfo context) throws DoesNotExistException, InvalidParameterException, |
| 216 | |
MissingParameterException, OperationFailedException, PermissionDeniedException { |
| 217 | 0 | throw new UnsupportedOperationException("Method not implemented."); |
| 218 | |
} |
| 219 | |
|
| 220 | |
|
| 221 | |
|
| 222 | |
|
| 223 | |
|
| 224 | |
|
| 225 | |
|
| 226 | |
|
| 227 | |
|
| 228 | |
|
| 229 | |
|
| 230 | |
|
| 231 | |
|
| 232 | |
|
| 233 | |
|
| 234 | |
|
| 235 | |
|
| 236 | |
public ResultValuesGroupDao getResultValuesGroupDao() { |
| 237 | 0 | return resultValuesGroupDao; |
| 238 | |
} |
| 239 | |
|
| 240 | |
public void setResultValuesGroupDao(ResultValuesGroupDao resultValuesGroupDao) { |
| 241 | 0 | this.resultValuesGroupDao = resultValuesGroupDao; |
| 242 | 0 | } |
| 243 | |
|
| 244 | |
public ResultValueDao getResultValueDao() { |
| 245 | 0 | return resultValueDao; |
| 246 | |
} |
| 247 | |
|
| 248 | |
public void setResultValueDao(ResultValueDao resultValueDao) { |
| 249 | 0 | this.resultValueDao = resultValueDao; |
| 250 | 0 | } |
| 251 | |
|
| 252 | |
public ResultScaleDao getResultScaleDao() { |
| 253 | 0 | return resultScaleDao; |
| 254 | |
} |
| 255 | |
|
| 256 | |
public void setResultScaleDao(ResultScaleDao resultScaleDao) { |
| 257 | 0 | this.resultScaleDao = resultScaleDao; |
| 258 | 0 | } |
| 259 | |
|
| 260 | |
public StateService getStateService() { |
| 261 | 0 | return stateService; |
| 262 | |
} |
| 263 | |
|
| 264 | |
public void setStateService(StateService stateService) { |
| 265 | 0 | this.stateService = stateService; |
| 266 | 0 | } |
| 267 | |
|
| 268 | |
} |