1 package org.kuali.student.enrollment.class1.lpr.service.impl.mock; 2 3 4 import org.kuali.student.enrollment.class1.lpr.dao.LprDao; 5 import org.kuali.student.enrollment.class1.lpr.model.LprEntity; 6 import org.kuali.student.enrollment.class1.lui.dao.LuiDao; 7 import org.kuali.student.enrollment.class1.lui.dao.LuiLuiRelationDao; 8 import org.kuali.student.enrollment.class1.lui.model.LuiEntity; 9 import org.kuali.student.enrollment.class1.lui.model.LuiIdentifierEntity; 10 import org.kuali.student.r2.common.dto.ContextInfo; 11 import org.kuali.student.r2.common.exceptions.*; 12 import org.kuali.student.r2.common.util.constants.LuiServiceConstants; 13 14 import java.math.BigDecimal; 15 import java.util.ArrayList; 16 import java.util.Date; 17 import java.util.List; 18 19 public class LprTestDataLoader { 20 21 22 private LprDao lprDao; 23 24 private String principalId = LprTestDataLoader.class.getSimpleName(); 25 26 public LprTestDataLoader(LprDao lprDao){ 27 this.lprDao = lprDao; 28 } 29 public void loadData() throws DoesNotExistException, InvalidParameterException, 30 MissingParameterException, OperationFailedException, PermissionDeniedException, 31 DataValidationErrorException, ReadOnlyException, VersionMismatchException, 32 AlreadyExistsException, CircularRelationshipException { 33 loadLpr( "Lpr-1", "lui-1","Person-1", new BigDecimal (80.00F), "kuali.lpr.type.courseoffering.instructor.main", "kuali.lpr.state.draft"); 34 loadLpr("Lpr-2", "lui-1","Person-2", new BigDecimal (20.00F), "kuali.lpr.type.courseoffering.instructor.ta", "kuali.lpr.state.draft"); 35 loadLpr("Lpr-3","lui-2", "Person-1", new BigDecimal (100.00F), "kuali.lpr.type.courseoffering.instructor.main", "kuali.lpr.state.draft"); 36 37 } 38 39 private void loadLpr(String lprId, String luiId, String personId, BigDecimal commitmentPercent, String lprState, String lprType ) 40 throws DoesNotExistException, InvalidParameterException, 41 MissingParameterException, OperationFailedException, PermissionDeniedException, 42 DataValidationErrorException, ReadOnlyException, AlreadyExistsException { 43 44 LprEntity lprEntity = new LprEntity(); 45 lprEntity.setId(lprId); 46 lprEntity.setCommitmentPercent(commitmentPercent); 47 lprEntity.setLuiId(luiId); 48 lprEntity.setPersonId(personId); 49 lprEntity.setPersonRelationStateId(lprState); 50 lprEntity.setPersonRelationTypeId(lprType); 51 52 53 ContextInfo ctx = new ContextInfo(); 54 55 ctx.setPrincipalId(principalId); 56 57 Date d; 58 ctx.setCurrentDate(d = new Date()); 59 60 lprEntity.setEntityCreated(ctx); 61 62 63 64 lprDao.persist(lprEntity); 65 } 66 67 68 69 }