Coverage Report - org.kuali.student.r2.core.class1.scheduling.service.impl.SchedulingServiceMockImpl
 
Classes in this File Line Coverage Branch Coverage Complexity
SchedulingServiceMockImpl
0%
0/221
0%
0/116
2.672
 
 1  
 /*
 2  
  * Copyright 2011 The Kuali Foundation
 3  
  *
 4  
  * Licensed under the Educational Community License, Version 2.0 (the "License");
 5  
  * you may not use this file except in compliance with the License.
 6  
  * You may        obtain a copy of the License at
 7  
  *
 8  
  *         http://www.osedu.org/licenses/ECL-2.0
 9  
  *
 10  
  * Unless required by applicable law or agreed to in writing, software
 11  
  * distributed under the License is distributed on an "AS IS" BASIS,
 12  
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 13  
  * See the License for the specific language governing permissions and
 14  
  * limitations under the License.
 15  
  */
 16  
 package org.kuali.student.r2.core.class1.scheduling.service.impl;
 17  
 
 18  
 
 19  
 import org.kuali.rice.core.api.criteria.QueryByCriteria;
 20  
 import org.kuali.student.r2.common.dto.*;
 21  
 import org.kuali.student.r2.common.exceptions.*;
 22  
 import org.kuali.student.r2.core.scheduling.dto.*;
 23  
 import org.kuali.student.r2.core.scheduling.service.SchedulingService;
 24  
 
 25  
 import java.util.*;
 26  
 
 27  
 
 28  0
 public class SchedulingServiceMockImpl implements SchedulingService
 29  
 {
 30  
     ////////////////////////////
 31  
     // Data holders
 32  
     ////////////////////////////
 33  
 
 34  0
     private Map<String, TimeSlotInfo> timeSlotsMap = new LinkedHashMap<String, TimeSlotInfo>();
 35  0
     private Map<String, ScheduleInfo> scheduleMap = new LinkedHashMap<String, ScheduleInfo>();
 36  0
     private Map<String, ScheduleBatchInfo> scheduleBatchMap = new LinkedHashMap<String, ScheduleBatchInfo>();
 37  0
     private Map<String, ScheduleBatchRespInfo> scheduleBatchResponseMap = new LinkedHashMap<String, ScheduleBatchRespInfo>();
 38  0
     private Map<String, ScheduleRespInfo> scheduleResponseMap = new LinkedHashMap<String, ScheduleRespInfo>();
 39  
 
 40  
     /////////////////////////////
 41  
     // Implementing Methods
 42  
     /////////////////////////////
 43  
         @Override
 44  
         public ScheduleInfo getSchedule(String scheduleId, ContextInfo contextInfo)
 45  
                 throws DoesNotExistException
 46  
                       ,InvalidParameterException
 47  
                       ,MissingParameterException
 48  
                       ,OperationFailedException
 49  
                       ,PermissionDeniedException
 50  
         {
 51  0
                 if (!this.scheduleMap.containsKey(scheduleId)) {
 52  0
                    throw new DoesNotExistException(scheduleId);
 53  
                 }
 54  0
                 return this.scheduleMap.get (scheduleId);
 55  
         }
 56  
         
 57  
         @Override
 58  
         public List<ScheduleInfo> getSchedulesByIds(List<String> scheduleIds, ContextInfo contextInfo)
 59  
                 throws DoesNotExistException
 60  
                       ,InvalidParameterException
 61  
                       ,MissingParameterException
 62  
                       ,OperationFailedException
 63  
                       ,PermissionDeniedException
 64  
         {
 65  0
                 List<ScheduleInfo> list = new ArrayList<ScheduleInfo> ();
 66  0
                 for (String id: scheduleIds) {
 67  0
                     list.add (this.getSchedule(id, contextInfo));
 68  
                 }
 69  0
                 return list;
 70  
         }
 71  
         
 72  
         @Override
 73  
         public List<String> getScheduleIdsByType(String scheduleTypeKey, ContextInfo contextInfo)
 74  
                 throws InvalidParameterException
 75  
                       ,MissingParameterException
 76  
                       ,OperationFailedException
 77  
                       ,PermissionDeniedException
 78  
         {
 79  0
                 List<String> list = new ArrayList<String> ();
 80  0
                 for (ScheduleInfo info: scheduleMap.values ()) {
 81  0
                         if (scheduleTypeKey.equals(info.getTypeKey())) {
 82  0
                             list.add (info.getId ());
 83  
                         }
 84  
                 }
 85  0
                 return list;
 86  
         }
 87  
         
 88  
         @Override
 89  
         public List<String> searchForScheduleIds(QueryByCriteria criteria, ContextInfo contextInfo)
 90  
                 throws InvalidParameterException
 91  
                       ,MissingParameterException
 92  
                       ,OperationFailedException
 93  
                       ,PermissionDeniedException
 94  
         {
 95  0
                 throw new OperationFailedException ("searchForScheduleIds has not been implemented");
 96  
         }
 97  
         
 98  
         @Override
 99  
         public List<ScheduleInfo> searchForSchedules(QueryByCriteria criteria, ContextInfo contextInfo)
 100  
                 throws InvalidParameterException
 101  
                       ,MissingParameterException
 102  
                       ,OperationFailedException
 103  
                       ,PermissionDeniedException
 104  
         {
 105  0
                 throw new OperationFailedException ("searchForSchedules has not been implemented");
 106  
         }
 107  
         
 108  
         @Override
 109  
         public List<ValidationResultInfo> validateSchedule(String validationTypeKey, String scheduleTypeKey, ScheduleInfo scheduleInfo, ContextInfo contextInfo)
 110  
                 throws DoesNotExistException
 111  
                       ,InvalidParameterException
 112  
                       ,MissingParameterException
 113  
                       ,OperationFailedException
 114  
                       ,PermissionDeniedException
 115  
         {
 116  
                 // validate
 117  0
                 return new ArrayList<ValidationResultInfo> ();
 118  
         }
 119  
         // cache variable 
 120  
         // The LinkedHashMap is just so the values come back in a predictable order
 121  
         // private Map<String, ScheduleInfo> scheduleMap = new LinkedHashMap<String, ScheduleInfo>();
 122  
         
 123  
         @Override
 124  
         public ScheduleInfo createSchedule(String scheduleTypeKey, ScheduleInfo scheduleInfo, ContextInfo contextInfo)
 125  
                 throws DataValidationErrorException
 126  
                       ,DoesNotExistException
 127  
                       ,InvalidParameterException
 128  
                       ,MissingParameterException
 129  
                       ,OperationFailedException
 130  
                       ,PermissionDeniedException
 131  
                       ,ReadOnlyException
 132  
         {
 133  
                 // create 
 134  0
                 if (!scheduleTypeKey.equals (scheduleInfo.getTypeKey())) {
 135  0
                     throw new InvalidParameterException ("The type parameter does not match the type on the info object");
 136  
                 }
 137  0
                 ScheduleInfo copy = new ScheduleInfo(scheduleInfo);
 138  0
                 if (copy.getId() == null) {
 139  0
                    copy.setId(scheduleMap.size() + "");
 140  
                 }
 141  0
                 copy.setMeta(newMeta(contextInfo));
 142  0
                 scheduleMap.put(copy.getId(), copy);
 143  0
                 return new ScheduleInfo(copy);
 144  
         }
 145  
         
 146  
         @Override
 147  
         public ScheduleInfo updateSchedule(String scheduleId, ScheduleInfo scheduleInfo, ContextInfo contextInfo)
 148  
                 throws DataValidationErrorException
 149  
                       ,DoesNotExistException
 150  
                       ,InvalidParameterException
 151  
                       ,MissingParameterException
 152  
                       ,OperationFailedException
 153  
                       ,PermissionDeniedException
 154  
                       ,ReadOnlyException
 155  
                       ,VersionMismatchException
 156  
         {
 157  0
         throw new UnsupportedOperationException("Not supported yet.");
 158  
         }
 159  
         
 160  
         @Override
 161  
         public StatusInfo deleteSchedule(String scheduleId, ContextInfo contextInfo)
 162  
                 throws DoesNotExistException
 163  
                       ,InvalidParameterException
 164  
                       ,MissingParameterException
 165  
                       ,OperationFailedException
 166  
                       ,PermissionDeniedException
 167  
         {
 168  0
                 if (this.scheduleMap.remove(scheduleId) == null) {
 169  0
                    throw new DoesNotExistException(scheduleId);
 170  
                 }
 171  0
                 return newStatus();
 172  
         }
 173  
         
 174  
         @Override
 175  
         public ScheduleBatchInfo getScheduleBatch(String scheduleBatchId, ContextInfo contextInfo)
 176  
                 throws DoesNotExistException
 177  
                       ,InvalidParameterException
 178  
                       ,MissingParameterException
 179  
                       ,OperationFailedException
 180  
                       ,PermissionDeniedException
 181  
         {
 182  0
                 if (!this.scheduleBatchMap.containsKey(scheduleBatchId)) {
 183  0
                    throw new DoesNotExistException(scheduleBatchId);
 184  
                 }
 185  0
                 return this.scheduleBatchMap.get (scheduleBatchId);
 186  
         }
 187  
         
 188  
         @Override
 189  
         public List<ScheduleBatchInfo> getScheduleBatchesByIds(List<String> scheduleBatchIds, ContextInfo contextInfo)
 190  
                 throws DoesNotExistException
 191  
                       ,InvalidParameterException
 192  
                       ,MissingParameterException
 193  
                       ,OperationFailedException
 194  
                       ,PermissionDeniedException
 195  
         {
 196  0
                 List<ScheduleBatchInfo> list = new ArrayList<ScheduleBatchInfo> ();
 197  0
                 for (String id: scheduleBatchIds) {
 198  0
                     list.add (this.getScheduleBatch(id, contextInfo));
 199  
                 }
 200  0
                 return list;
 201  
         }
 202  
         
 203  
         @Override
 204  
         public List<String> getScheduleBatchIdsByType(String scheduleBatchTypeKey, ContextInfo contextInfo)
 205  
                 throws InvalidParameterException
 206  
                       ,MissingParameterException
 207  
                       ,OperationFailedException
 208  
                       ,PermissionDeniedException
 209  
         {
 210  0
                 List<String> list = new ArrayList<String> ();
 211  0
                 for (ScheduleBatchInfo info: scheduleBatchMap.values ()) {
 212  0
                         if (scheduleBatchTypeKey.equals(info.getTypeKey())) {
 213  0
                             list.add (info.getId ());
 214  
                         }
 215  
                 }
 216  0
                 return list;
 217  
         }
 218  
         
 219  
         @Override
 220  
         public List<ScheduleBatchInfo> getScheduleBatchesForScheduleRequest(String scheduleRequestId, ContextInfo contextInfo)
 221  
                 throws InvalidParameterException
 222  
                       ,MissingParameterException
 223  
                       ,OperationFailedException
 224  
                       ,PermissionDeniedException
 225  
         {
 226  0
                 throw new OperationFailedException ("getScheduleBatchesForScheduleRequest has not been implemented");
 227  
         }
 228  
         
 229  
         @Override
 230  
         public List<String> searchForScheduleBatchIds(QueryByCriteria criteria, ContextInfo contextInfo)
 231  
                 throws InvalidParameterException
 232  
                       ,MissingParameterException
 233  
                       ,OperationFailedException
 234  
                       ,PermissionDeniedException
 235  
         {
 236  0
                 throw new OperationFailedException ("searchForScheduleBatchIds has not been implemented");
 237  
         }
 238  
         
 239  
         @Override
 240  
         public List<ScheduleBatchInfo> searchForScheduleBatches(QueryByCriteria criteria, ContextInfo contextInfo)
 241  
                 throws InvalidParameterException
 242  
                       ,MissingParameterException
 243  
                       ,OperationFailedException
 244  
                       ,PermissionDeniedException
 245  
         {
 246  0
                 throw new OperationFailedException ("searchForScheduleBatches has not been implemented");
 247  
         }
 248  
         
 249  
         @Override
 250  
         public List<ValidationResultInfo> validateScheduleBatch(String validationTypeKey, String scheduleBatchTypeKey, ScheduleBatchInfo scheduleBatchInfo, ContextInfo contextInfo)
 251  
                 throws DoesNotExistException
 252  
                       ,InvalidParameterException
 253  
                       ,MissingParameterException
 254  
                       ,OperationFailedException
 255  
                       ,PermissionDeniedException
 256  
         {
 257  
                 // validate
 258  0
                 return new ArrayList<ValidationResultInfo> ();
 259  
         }
 260  
 
 261  
         
 262  
         @Override
 263  
         public ScheduleBatchInfo createScheduleBatch(String scheduleBatchTypeKey, ScheduleBatchInfo scheduleBatchInfo, ContextInfo contextInfo)
 264  
                 throws DataValidationErrorException
 265  
                       ,DoesNotExistException
 266  
                       ,InvalidParameterException
 267  
                       ,MissingParameterException
 268  
                       ,OperationFailedException
 269  
                       ,PermissionDeniedException
 270  
                       ,ReadOnlyException
 271  
         {
 272  
                 // create 
 273  0
                 if (!scheduleBatchTypeKey.equals (scheduleBatchInfo.getTypeKey())) {
 274  0
                     throw new InvalidParameterException ("The type parameter does not match the type on the info object");
 275  
                 }
 276  0
                 ScheduleBatchInfo copy = new ScheduleBatchInfo(scheduleBatchInfo);
 277  0
                 if (copy.getId() == null) {
 278  0
                    copy.setId(scheduleBatchMap.size() + "");
 279  
                 }
 280  0
                 copy.setMeta(newMeta(contextInfo));
 281  0
                 scheduleBatchMap.put(copy.getId(), copy);
 282  0
                 return new ScheduleBatchInfo(copy);
 283  
         }
 284  
         
 285  
         @Override
 286  
         public ScheduleBatchInfo updateScheduleBatch(String scheduleBatchId, ScheduleBatchInfo scheduleBatchInfo, ContextInfo contextInfo)
 287  
                 throws DataValidationErrorException
 288  
                       ,DoesNotExistException
 289  
                       ,InvalidParameterException
 290  
                       ,MissingParameterException
 291  
                       ,OperationFailedException
 292  
                       ,PermissionDeniedException
 293  
                       ,ReadOnlyException
 294  
                       ,VersionMismatchException
 295  
         {
 296  
                 // update
 297  0
                 if (!scheduleBatchId.equals (scheduleBatchInfo.getId())) {
 298  0
                     throw new InvalidParameterException ("The id parameter does not match the id on the info object");
 299  
                 }
 300  0
                 ScheduleBatchInfo copy = new ScheduleBatchInfo(scheduleBatchInfo);
 301  0
                 ScheduleBatchInfo old = this.getScheduleBatch(scheduleBatchInfo.getId(), contextInfo);
 302  0
                 if (!old.getMeta().getVersionInd().equals(copy.getMeta().getVersionInd())) {
 303  0
                     throw new VersionMismatchException(old.getMeta().getVersionInd());
 304  
                 }
 305  0
                 copy.setMeta(updateMeta(copy.getMeta(), contextInfo));
 306  0
                 this.scheduleBatchMap .put(scheduleBatchInfo.getId(), copy);
 307  0
                 return new ScheduleBatchInfo(copy);
 308  
         }
 309  
         
 310  
         @Override
 311  
         public StatusInfo deleteScheduleBatch(String scheduleBatchId, ContextInfo contextInfo)
 312  
                 throws DoesNotExistException
 313  
                       ,InvalidParameterException
 314  
                       ,MissingParameterException
 315  
                       ,OperationFailedException
 316  
                       ,PermissionDeniedException
 317  
         {
 318  0
                 if (this.scheduleBatchMap.remove(scheduleBatchId) == null) {
 319  0
                    throw new DoesNotExistException(scheduleBatchId);
 320  
                 }
 321  0
                 return newStatus();
 322  
         }
 323  
         
 324  
         @Override
 325  
         public StatusInfo addScheduleRequestsToScheduleBatch(List<String> scheduleRequestIds, List<String> scheduleBatchId, ContextInfo contextInfo)
 326  
                 throws DoesNotExistException
 327  
                       ,InvalidParameterException
 328  
                       ,MissingParameterException
 329  
                       ,OperationFailedException
 330  
                       ,PermissionDeniedException
 331  
         {
 332  0
                 throw new OperationFailedException ("addScheduleRequestsToScheduleBatch has not been implemented");
 333  
         }
 334  
         
 335  
         @Override
 336  
         public StatusInfo removeScheduleRequestsFromScheduleBatch(List<String> scheduleRequestIds, List<String> scheduleBatchId, ContextInfo contextInfo)
 337  
                 throws DoesNotExistException
 338  
                       ,InvalidParameterException
 339  
                       ,MissingParameterException
 340  
                       ,OperationFailedException
 341  
                       ,PermissionDeniedException
 342  
         {
 343  0
                 throw new OperationFailedException ("removeScheduleRequestsFromScheduleBatch has not been implemented");
 344  
         }
 345  
 
 346  
         @Override
 347  
         public ScheduleBatchRespInfo getScheduleBatchResp(String scheduleBatchResponseId, ContextInfo contextInfo)
 348  
                 throws DoesNotExistException
 349  
                       ,InvalidParameterException
 350  
                       ,MissingParameterException
 351  
                       ,OperationFailedException
 352  
                       ,PermissionDeniedException
 353  
         {
 354  0
                 if (!this.scheduleBatchResponseMap.containsKey(scheduleBatchResponseId)) {
 355  0
                    throw new DoesNotExistException(scheduleBatchResponseId);
 356  
                 }
 357  0
                 return this.scheduleBatchResponseMap.get (scheduleBatchResponseId);
 358  
         }
 359  
 
 360  
         @Override
 361  
         public List<ScheduleBatchRespInfo> getScheduleBatchRespsByIds(List<String> scheduleBatchResponseIds, ContextInfo contextInfo)
 362  
                 throws DoesNotExistException
 363  
                       ,InvalidParameterException
 364  
                       ,MissingParameterException
 365  
                       ,OperationFailedException
 366  
                       ,PermissionDeniedException
 367  
         {
 368  0
                 List<ScheduleBatchRespInfo> list = new ArrayList<ScheduleBatchRespInfo> ();
 369  0
                 for (String id: scheduleBatchResponseIds) {
 370  0
                     list.add (this.getScheduleBatchResp(id, contextInfo));
 371  
                 }
 372  0
                 return list;
 373  
         }
 374  
 
 375  
         @Override
 376  
         public List<String> getScheduleBatchRespIdsByType(String scheduleBatchResponseTypeKey, ContextInfo contextInfo)
 377  
                 throws InvalidParameterException
 378  
                       ,MissingParameterException
 379  
                       ,OperationFailedException
 380  
                       ,PermissionDeniedException
 381  
         {
 382  0
                 List<String> list = new ArrayList<String> ();
 383  0
                 for (ScheduleBatchRespInfo info: scheduleBatchResponseMap.values ()) {
 384  0
                         if (scheduleBatchResponseTypeKey.equals(info.getTypeKey())) {
 385  0
                             list.add (info.getId ());
 386  
                         }
 387  
                 }
 388  0
                 return list;
 389  
         }
 390  
 
 391  
         @Override
 392  
         public List<ScheduleBatchRespInfo> getScheduleBatchRespsByScheduleBatchRequest(String scheduleBatchId, ContextInfo contextInfo)
 393  
                 throws DoesNotExistException
 394  
                       ,InvalidParameterException
 395  
                       ,MissingParameterException
 396  
                       ,OperationFailedException
 397  
                       ,PermissionDeniedException
 398  
         {
 399  0
                 List<ScheduleBatchRespInfo> list = new ArrayList<ScheduleBatchRespInfo> ();
 400  0
                 for (ScheduleBatchRespInfo info: scheduleBatchResponseMap.values ()) {
 401  0
                         if (scheduleBatchId.equals(info.getId())) {
 402  0
                             list.add (info);
 403  
                         }
 404  
                 }
 405  0
                 return list;
 406  
         }
 407  
 
 408  
         @Override
 409  
         public ScheduleRequestInfo getScheduleRequest(String scheduleRequestId, ContextInfo contextInfo)
 410  
                 throws DoesNotExistException
 411  
                       ,InvalidParameterException
 412  
                       ,MissingParameterException
 413  
                       ,OperationFailedException
 414  
                       ,PermissionDeniedException
 415  
         {
 416  0
                 if (!this.scheduleRequestMap.containsKey(scheduleRequestId)) {
 417  0
                    throw new DoesNotExistException(scheduleRequestId);
 418  
                 }
 419  0
                 return this.scheduleRequestMap.get (scheduleRequestId);
 420  
         }
 421  
         
 422  
         @Override
 423  
         public List<ScheduleRequestInfo> getScheduleRequestsByIds(List<String> scheduleRequestIds, ContextInfo contextInfo)
 424  
                 throws DoesNotExistException
 425  
                       ,InvalidParameterException
 426  
                       ,MissingParameterException
 427  
                       ,OperationFailedException
 428  
                       ,PermissionDeniedException
 429  
         {
 430  0
                 List<ScheduleRequestInfo> list = new ArrayList<ScheduleRequestInfo> ();
 431  0
                 for (String id: scheduleRequestIds) {
 432  0
                     list.add (this.getScheduleRequest(id, contextInfo));
 433  
                 }
 434  0
                 return list;
 435  
         }
 436  
         
 437  
         @Override
 438  
         public List<String> getScheduleRequestIdsByType(String scheduleRequestTypeKey, ContextInfo contextInfo)
 439  
                 throws InvalidParameterException
 440  
                       ,MissingParameterException
 441  
                       ,OperationFailedException
 442  
                       ,PermissionDeniedException
 443  
         {
 444  0
                 List<String> list = new ArrayList<String> ();
 445  0
                 for (ScheduleRequestInfo info: scheduleRequestMap.values ()) {
 446  0
                         if (scheduleRequestTypeKey.equals(info.getTypeKey())) {
 447  0
                             list.add (info.getId ());
 448  
                         }
 449  
                 }
 450  0
                 return list;
 451  
         }
 452  
         
 453  
         @Override
 454  
         public List<String> getScheduleRequestsByRefObject(String refObjectType, String refObjectId, ContextInfo contextInfo)
 455  
                 throws InvalidParameterException
 456  
                       ,MissingParameterException
 457  
                       ,OperationFailedException
 458  
                       ,PermissionDeniedException
 459  
         {
 460  0
         throw new UnsupportedOperationException("Not supported yet.");
 461  
         }
 462  
         
 463  
         @Override
 464  
         public List<ScheduleRequestInfo> getScheduleRequestsForScheduleBatch(String scheduleBatchId, ContextInfo contextInfo)
 465  
                 throws InvalidParameterException
 466  
                       ,MissingParameterException
 467  
                       ,OperationFailedException
 468  
                       ,PermissionDeniedException
 469  
         {
 470  0
                 throw new OperationFailedException ("getScheduleRequestsForScheduleBatch has not been implemented");
 471  
         }
 472  
         
 473  
         @Override
 474  
         public List<String> searchForScheduleRequestIds(QueryByCriteria criteria, ContextInfo contextInfo)
 475  
                 throws InvalidParameterException
 476  
                       ,MissingParameterException
 477  
                       ,OperationFailedException
 478  
                       ,PermissionDeniedException
 479  
         {
 480  0
                 throw new OperationFailedException ("searchForScheduleRequestIds has not been implemented");
 481  
         }
 482  
         
 483  
         @Override
 484  
         public List<ScheduleRequestInfo> searchForScheduleRequests(QueryByCriteria criteria, ContextInfo contextInfo)
 485  
                 throws InvalidParameterException
 486  
                       ,MissingParameterException
 487  
                       ,OperationFailedException
 488  
                       ,PermissionDeniedException
 489  
         {
 490  0
                 throw new OperationFailedException ("searchForScheduleRequests has not been implemented");
 491  
         }
 492  
         
 493  
         @Override
 494  
         public List<ValidationResultInfo> validateScheduleRequest(String validationTypeKey, String scheduleRequestTypeKey, ScheduleRequestInfo scheduleRequestInfo, ContextInfo contextInfo)
 495  
                 throws DoesNotExistException
 496  
                       ,InvalidParameterException
 497  
                       ,MissingParameterException
 498  
                       ,OperationFailedException
 499  
                       ,PermissionDeniedException
 500  
         {
 501  
                 // validate
 502  0
                 return new ArrayList<ValidationResultInfo> ();
 503  
         }
 504  
         // cache variable 
 505  
         // The LinkedHashMap is just so the values come back in a predictable order
 506  0
         private Map<String, ScheduleRequestInfo> scheduleRequestMap = new LinkedHashMap<String, ScheduleRequestInfo>();
 507  
         
 508  
         @Override
 509  
         public ScheduleRequestInfo createScheduleRequest(String scheduleRequestTypeKey, ScheduleRequestInfo scheduleRequestInfo, ContextInfo contextInfo)
 510  
                 throws DataValidationErrorException
 511  
                       ,DoesNotExistException
 512  
                       ,InvalidParameterException
 513  
                       ,MissingParameterException
 514  
                       ,OperationFailedException
 515  
                       ,PermissionDeniedException
 516  
                       ,ReadOnlyException
 517  
         {
 518  
                 // create 
 519  0
                 if (!scheduleRequestTypeKey.equals (scheduleRequestInfo.getTypeKey())) {
 520  0
                     throw new InvalidParameterException ("The type parameter does not match the type on the info object");
 521  
                 }
 522  0
                 ScheduleRequestInfo copy = new ScheduleRequestInfo(scheduleRequestInfo);
 523  0
                 if (copy.getId() == null) {
 524  0
                    copy.setId(scheduleRequestMap.size() + "");
 525  
                 }
 526  0
                 copy.setMeta(newMeta(contextInfo));
 527  0
                 scheduleRequestMap.put(copy.getId(), copy);
 528  0
                 return new ScheduleRequestInfo(copy);
 529  
         }
 530  
         
 531  
         @Override
 532  
         public ScheduleRequestInfo updateScheduleRequest(String scheduleRequestId, ScheduleRequestInfo scheduleRequestInfo, ContextInfo contextInfo)
 533  
                 throws DataValidationErrorException
 534  
                       ,DoesNotExistException
 535  
                       ,InvalidParameterException
 536  
                       ,MissingParameterException
 537  
                       ,OperationFailedException
 538  
                       ,PermissionDeniedException
 539  
                       ,ReadOnlyException
 540  
                       ,VersionMismatchException
 541  
         {
 542  
                 // update
 543  0
                 if (!scheduleRequestId.equals (scheduleRequestInfo.getId())) {
 544  0
                     throw new InvalidParameterException ("The id parameter does not match the id on the info object");
 545  
                 }
 546  0
                 ScheduleRequestInfo copy = new ScheduleRequestInfo(scheduleRequestInfo);
 547  0
                 ScheduleRequestInfo old = this.getScheduleRequest(scheduleRequestInfo.getId(), contextInfo);
 548  0
                 if (!old.getMeta().getVersionInd().equals(copy.getMeta().getVersionInd())) {
 549  0
                     throw new VersionMismatchException(old.getMeta().getVersionInd());
 550  
                 }
 551  0
                 copy.setMeta(updateMeta(copy.getMeta(), contextInfo));
 552  0
                 this.scheduleRequestMap .put(scheduleRequestInfo.getId(), copy);
 553  0
                 return new ScheduleRequestInfo(copy);
 554  
         }
 555  
         
 556  
         @Override
 557  
         public StatusInfo deleteScheduleRequest(String scheduleRequestId, ContextInfo contextInfo)
 558  
                 throws DoesNotExistException
 559  
                       ,InvalidParameterException
 560  
                       ,MissingParameterException
 561  
                       ,OperationFailedException
 562  
                       ,PermissionDeniedException
 563  
         {
 564  0
                 if (this.scheduleRequestMap.remove(scheduleRequestId) == null) {
 565  0
                    throw new DoesNotExistException(scheduleRequestId);
 566  
                 }
 567  0
                 return newStatus();
 568  
         }
 569  
         
 570  
         @Override
 571  
         public TimeSlotInfo getTimeSlot(String timeSlotId, ContextInfo contextInfo)
 572  
                 throws DoesNotExistException
 573  
                       ,InvalidParameterException
 574  
                       ,MissingParameterException
 575  
                       ,OperationFailedException
 576  
                       ,PermissionDeniedException
 577  
         {
 578  0
                 if (!this.timeSlotsMap.containsKey(timeSlotId)) {
 579  0
                    throw new DoesNotExistException(timeSlotId);
 580  
                 }
 581  0
                 return this.timeSlotsMap.get (timeSlotId);
 582  
         }
 583  
         
 584  
         @Override
 585  
         public List<TimeSlotInfo> getTimeSlotsByIds(List<String> timeSlotIds, ContextInfo contextInfo)
 586  
                 throws DoesNotExistException
 587  
                       ,InvalidParameterException
 588  
                       ,MissingParameterException
 589  
                       ,OperationFailedException
 590  
                       ,PermissionDeniedException
 591  
         {
 592  0
                 List<TimeSlotInfo> list = new ArrayList<TimeSlotInfo> ();
 593  0
                 for (String id: timeSlotIds) {
 594  0
                     list.add (this.getTimeSlot(id, contextInfo));
 595  
                 }
 596  0
                 return list;
 597  
         }
 598  
         
 599  
         @Override
 600  
         public List<String> getTimeSlotIdsByType(String timeSlotTypeKey, ContextInfo contextInfo)
 601  
                 throws InvalidParameterException
 602  
                       ,MissingParameterException
 603  
                       ,OperationFailedException
 604  
                       ,PermissionDeniedException
 605  
         {
 606  0
                 List<String> list = new ArrayList<String> ();
 607  0
                 for (TimeSlotInfo info: timeSlotsMap.values ()) {
 608  0
                         if (timeSlotTypeKey.equals(info.getTypeKey())) {
 609  0
                             list.add (info.getId ());
 610  
                         }
 611  
                 }
 612  0
                 return list;
 613  
         }
 614  
         
 615  
         @Override
 616  
         public List<TimeSlotInfo> getTimeSlotsByDaysAndStartTime(String timeSlotTypeKey, List<Integer> daysOfWeek, TimeOfDayInfo startTime, ContextInfo contextInfo)
 617  
                 throws InvalidParameterException
 618  
                       ,MissingParameterException
 619  
                       ,OperationFailedException
 620  
                       ,PermissionDeniedException
 621  
         {
 622  0
                 List<TimeSlotInfo> list = new ArrayList<TimeSlotInfo> ();
 623  0
                 for (TimeSlotInfo info: timeSlotsMap.values ()) {
 624  0
                         if (timeSlotTypeKey.equals(info.getTypeKey())) {
 625  0
                                 if (daysOfWeek.equals(info.getWeekdays())) {
 626  0
                                         if (startTime.equals(info.getStartTime())) {
 627  0
                                             list.add (info);
 628  
                                         }
 629  
                                 }
 630  
                         }
 631  
                 }
 632  0
                 return list;
 633  
         }
 634  
 
 635  
     @Override
 636  
     public List<TimeSlotInfo> getTimeSlotsByDaysAndStartTimeAndEndTime(String timeSlotTypeKey, List<Integer> daysOfWeek, TimeOfDayInfo startTime, TimeOfDayInfo endTime, ContextInfo contextInfo)
 637  
             throws InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException {
 638  0
         List<TimeSlotInfo> list = new ArrayList<TimeSlotInfo> ();
 639  0
         for (TimeSlotInfo info: timeSlotsMap.values ()) {
 640  0
             if (timeSlotTypeKey.equals(info.getTypeKey())) {
 641  0
                 if (daysOfWeek.equals(info.getWeekdays())) {
 642  0
                     if (startTime.equals(info.getStartTime())) {
 643  0
                         if (endTime.equals(info.getEndTime())) {
 644  0
                             list.add (info);
 645  
                         }
 646  
                     }
 647  
                 }
 648  
             }
 649  
         }
 650  0
         return list;
 651  
     }
 652  
 
 653  
         @Override
 654  
         public List<String> searchForTimeSlotIds(QueryByCriteria criteria, ContextInfo contextInfo)
 655  
                 throws InvalidParameterException
 656  
                       ,MissingParameterException
 657  
                       ,OperationFailedException
 658  
                       ,PermissionDeniedException
 659  
         {
 660  0
                 throw new OperationFailedException ("searchForTimeSlotIds has not been implemented");
 661  
         }
 662  
         
 663  
         @Override
 664  
         public List<TimeSlotInfo> searchForTimeSlots(QueryByCriteria criteria, ContextInfo contextInfo)
 665  
                 throws InvalidParameterException
 666  
                       ,MissingParameterException
 667  
                       ,OperationFailedException
 668  
                       ,PermissionDeniedException
 669  
         {
 670  0
                 throw new OperationFailedException ("searchForTimeSlots has not been implemented");
 671  
         }
 672  
         
 673  
         @Override
 674  
         public List<ValidationResultInfo> validateTimeSlot(String validationTypeKey, String timeSlotTypeKey, TimeSlotInfo timeSlotInfo, ContextInfo contextInfo)
 675  
                 throws DoesNotExistException
 676  
                       ,InvalidParameterException
 677  
                       ,MissingParameterException
 678  
                       ,OperationFailedException
 679  
                       ,PermissionDeniedException
 680  
         {
 681  
                 // validate
 682  0
                 return new ArrayList<ValidationResultInfo> ();
 683  
         }
 684  
         
 685  
         @Override
 686  
         public TimeSlotInfo createTimeSlot(String timeSlotTypeKey, TimeSlotInfo timeSlotInfo, ContextInfo contextInfo)
 687  
                 throws DataValidationErrorException
 688  
                       ,DoesNotExistException
 689  
                       ,InvalidParameterException
 690  
                       ,MissingParameterException
 691  
                       ,OperationFailedException
 692  
                       ,PermissionDeniedException
 693  
                       ,ReadOnlyException
 694  
         {
 695  
                 // create 
 696  0
                 if (!timeSlotTypeKey.equals (timeSlotInfo.getTypeKey())) {
 697  0
                     throw new InvalidParameterException ("The type parameter does not match the type on the info object");
 698  
                 }
 699  0
                 TimeSlotInfo copy = new TimeSlotInfo(timeSlotInfo);
 700  0
                 if (copy.getId() == null) {
 701  0
                    copy.setId(timeSlotsMap.size() + "");
 702  
                 }
 703  0
                 copy.setMeta(newMeta(contextInfo));
 704  0
                 timeSlotsMap.put(copy.getId(), copy);
 705  0
                 return new TimeSlotInfo(copy);
 706  
         }
 707  
         
 708  
         @Override
 709  
         public TimeSlotInfo updateTimeSlot(String timeSlotId, TimeSlotInfo timeSlotInfo, ContextInfo contextInfo)
 710  
                 throws DataValidationErrorException
 711  
                       ,DoesNotExistException
 712  
                       ,InvalidParameterException
 713  
                       ,MissingParameterException
 714  
                       ,OperationFailedException
 715  
                       ,PermissionDeniedException
 716  
                       ,ReadOnlyException
 717  
                       ,VersionMismatchException
 718  
         {
 719  
                 // update
 720  0
                 if (!timeSlotId.equals (timeSlotInfo.getId())) {
 721  0
                     throw new InvalidParameterException ("The id parameter does not match the id on the info object");
 722  
                 }
 723  0
                 TimeSlotInfo copy = new TimeSlotInfo(timeSlotInfo);
 724  0
                 TimeSlotInfo old = this.getTimeSlot(timeSlotInfo.getId(), contextInfo);
 725  0
                 if (!old.getMeta().getVersionInd().equals(copy.getMeta().getVersionInd())) {
 726  0
                     throw new VersionMismatchException(old.getMeta().getVersionInd());
 727  
                 }
 728  0
                 copy.setMeta(updateMeta(copy.getMeta(), contextInfo));
 729  0
                 this.timeSlotsMap .put(timeSlotInfo.getId(), copy);
 730  0
                 return new TimeSlotInfo(copy);
 731  
         }
 732  
         
 733  
         @Override
 734  
         public StatusInfo deleteTimeSlot(String timeSlotId, ContextInfo contextInfo)
 735  
                 throws DoesNotExistException
 736  
                       ,InvalidParameterException
 737  
                       ,MissingParameterException
 738  
                       ,OperationFailedException
 739  
                       ,PermissionDeniedException
 740  
         {
 741  0
                 if (this.timeSlotsMap.remove(timeSlotId) == null) {
 742  0
                    throw new DoesNotExistException(timeSlotId);
 743  
                 }
 744  0
                 return newStatus();
 745  
         }
 746  
         
 747  
         @Override
 748  
         public ScheduleRespInfo getScheduleResp(String scheduleResponseId, ContextInfo contextInfo)
 749  
                 throws DoesNotExistException
 750  
                       ,InvalidParameterException
 751  
                       ,MissingParameterException
 752  
                       ,OperationFailedException
 753  
                       ,PermissionDeniedException
 754  
         {
 755  0
                 if (!this.scheduleResponseMap.containsKey(scheduleResponseId)) {
 756  0
                    throw new DoesNotExistException(scheduleResponseId);
 757  
                 }
 758  0
                 return this.scheduleResponseMap.get (scheduleResponseId);
 759  
         }
 760  
         
 761  
         @Override
 762  
         public List<ScheduleRespInfo> getScheduleRespsByIds(List<String> scheduleResponseIds, ContextInfo contextInfo)
 763  
                 throws DoesNotExistException
 764  
                       ,InvalidParameterException
 765  
                       ,MissingParameterException
 766  
                       ,OperationFailedException
 767  
                       ,PermissionDeniedException
 768  
         {
 769  0
                 List<ScheduleRespInfo> list = new ArrayList<ScheduleRespInfo> ();
 770  0
                 for (String id: scheduleResponseIds) {
 771  0
                     list.add (this.getScheduleResp(id, contextInfo));
 772  
                 }
 773  0
                 return list;
 774  
         }
 775  
         
 776  
         @Override
 777  
         public List<String> getScheduleRespIdsByType(String scheduleResponseTypeKey, ContextInfo contextInfo)
 778  
                 throws InvalidParameterException
 779  
                       ,MissingParameterException
 780  
                       ,OperationFailedException
 781  
                       ,PermissionDeniedException
 782  
         {
 783  0
                 List<String> list = new ArrayList<String> ();
 784  0
                 for (ScheduleRespInfo info: scheduleResponseMap.values ()) {
 785  0
                         if (scheduleResponseTypeKey.equals(info.getTypeKey())) {
 786  0
                             list.add (info.getId ());
 787  
                         }
 788  
                 }
 789  0
                 return list;
 790  
         }
 791  
         
 792  
         @Override
 793  
         public List<ScheduleRespInfo> getScheduleRespsByScheduleRequestIds(List<String> scheduleRequestIds, ContextInfo contextInfo)
 794  
                 throws DoesNotExistException
 795  
                       ,InvalidParameterException
 796  
                       ,MissingParameterException
 797  
                       ,OperationFailedException
 798  
                       ,PermissionDeniedException
 799  
         {
 800  0
         throw new UnsupportedOperationException("Not supported yet.");
 801  
         }
 802  
         
 803  
         @Override
 804  
         public List<ScheduleRespInfo> getScheduleRespsByScheduleBatchResp(String scheduleBatchResponseId, ContextInfo contextInfo)
 805  
                 throws DoesNotExistException
 806  
                       ,InvalidParameterException
 807  
                       ,MissingParameterException
 808  
                       ,OperationFailedException
 809  
                       ,PermissionDeniedException
 810  
         {
 811  0
                 List<ScheduleRespInfo> list = new ArrayList<ScheduleRespInfo> ();
 812  0
                 for (ScheduleRespInfo info: scheduleResponseMap.values ()) {
 813  0
                         if (scheduleBatchResponseId.equals(info.getId())) {
 814  0
                             list.add (info);
 815  
                         }
 816  
                 }
 817  0
                 return list;
 818  
         }
 819  
         
 820  
         @Override
 821  
         public ScheduleRespInfo submitScheduleBatch(String scheduleBatchId, ContextInfo contextInfo)
 822  
                 throws DoesNotExistException
 823  
                       ,InvalidParameterException
 824  
                       ,MissingParameterException
 825  
                       ,OperationFailedException
 826  
                       ,PermissionDeniedException
 827  
         {
 828  0
                 throw new OperationFailedException ("submitScheduleBatch has not been implemented");
 829  
         }
 830  
         
 831  
         @Override
 832  
         public StatusInfo commitSchedules(String scheduleBatchResponseId, ContextInfo contextInfo)
 833  
                 throws DoesNotExistException
 834  
                       ,InvalidParameterException
 835  
                       ,MissingParameterException
 836  
                       ,OperationFailedException
 837  
                       ,PermissionDeniedException
 838  
         {
 839  0
                 throw new OperationFailedException ("commitSchedules has not been implemented");
 840  
         }
 841  
         
 842  
         @Override
 843  
         public List<Integer> getValidDaysOfWeekByTimeSlotType(String timeSlotTypeKey, ContextInfo contextInfo)
 844  
                 throws InvalidParameterException
 845  
                       ,MissingParameterException
 846  
                       ,OperationFailedException
 847  
                       ,PermissionDeniedException
 848  
         {
 849  0
         List<String> tsIds = getTimeSlotIdsByType(timeSlotTypeKey, contextInfo);
 850  0
         List<TimeSlotInfo> ts = null;
 851  0
         try { ts = getTimeSlotsByIds(tsIds, contextInfo); }
 852  0
         catch (Exception e) { e.printStackTrace(); throw new OperationFailedException(); }
 853  0
                 List<Integer> days = new ArrayList<Integer> ();
 854  0
                 for (TimeSlotInfo tsI: ts) {
 855  0
                         for (Integer d: tsI.getWeekdays()) {
 856  0
                 if (!days.contains(d)) {
 857  0
                     days.add(d);
 858  
                 }
 859  
             }
 860  
                 }
 861  0
                 return days;
 862  
         }
 863  
 
 864  
         private MetaInfo newMeta(ContextInfo context) {
 865  0
              MetaInfo meta = new MetaInfo();
 866  0
              meta.setCreateId(context.getPrincipalId());
 867  0
              meta.setCreateTime(new Date());
 868  0
              meta.setUpdateId(context.getPrincipalId());
 869  0
              meta.setUpdateTime(meta.getCreateTime());
 870  0
              meta.setVersionInd("0");
 871  0
              return meta;
 872  
         }
 873  
         
 874  
         private StatusInfo newStatus() {
 875  0
              StatusInfo status = new StatusInfo();
 876  0
              status.setSuccess(Boolean.TRUE);
 877  0
              return status;
 878  
         }
 879  
         
 880  
         private MetaInfo updateMeta(MetaInfo old, ContextInfo context) {
 881  0
              MetaInfo meta = new MetaInfo(old);
 882  0
              meta.setUpdateId(context.getPrincipalId());
 883  0
              meta.setUpdateTime(new Date());
 884  0
              meta.setVersionInd((Integer.parseInt(meta.getVersionInd()) + 1) + "");
 885  0
              return meta;
 886  
         }
 887  
         
 888  
 }
 889