[Ils-source] r1425 - in branches/1.6: . src/com/resolutions/ils src/com/resolutions/ils/data webapp webapp/WEB-INF/lib webapp/api/ccure/updatescore.vws

scribe at crosswire.org scribe at crosswire.org
Wed Apr 6 12:31:40 MST 2016


Author: scribe
Date: 2016-04-06 12:31:39 -0700 (Wed, 06 Apr 2016)
New Revision: 1425

Modified:
   branches/1.6/
   branches/1.6/src/com/resolutions/ils/Utils.java
   branches/1.6/src/com/resolutions/ils/data/CourseAttempt.java
   branches/1.6/src/com/resolutions/ils/data/UserProfile.java
   branches/1.6/webapp/WEB-INF/lib/crosswire.jar
   branches/1.6/webapp/WEB-INF/lib/ils.jar
   branches/1.6/webapp/api/ccure/updatescore.vws/index.jsp
   branches/1.6/webapp/report_employeecourseatt.jsp
Log:
merged update to use HashMap over deprecated Hashtable
merged CCURE integration updated to logging and course.userdata
merged fix to report course status on force pass




Property changes on: branches/1.6
___________________________________________________________________
Modified: svn:mergeinfo
   - /trunk:796-1303,1306-1307,1309-1311,1319-1320,1322-1323,1325,1328-1330,1332,1334-1335,1337,1339,1349-1356,1359-1365,1369,1373-1374,1380-1383,1391,1393,1401-1404,1407,1409,1412,1416-1419
   + /trunk:796-1303,1306-1307,1309-1311,1319-1320,1322-1323,1325,1328-1330,1332,1334-1335,1337,1339,1349-1356,1359-1365,1369,1373-1374,1380-1383,1391,1393,1401-1404,1407,1409,1412,1416-1419,1421-1424

Modified: branches/1.6/src/com/resolutions/ils/Utils.java
===================================================================
--- branches/1.6/src/com/resolutions/ils/Utils.java	2016-04-06 19:26:34 UTC (rev 1424)
+++ branches/1.6/src/com/resolutions/ils/Utils.java	2016-04-06 19:31:39 UTC (rev 1425)
@@ -7,7 +7,7 @@
 import java.util.Calendar;
 import java.util.Date;
 import java.util.GregorianCalendar;
-import java.util.Hashtable;
+import java.util.HashMap;
 import java.util.Properties;
 
 import javax.mail.Message;
@@ -62,7 +62,7 @@
         return sysConfig;
     }
     
-    public static String replaceParams(String inString, Hashtable values) {
+    public static String replaceParams(String inString, HashMap values) {
     	int i = 1;
         for (int offset = inString.indexOf('{', i); offset > -1; offset = inString.indexOf('{', i)) {
 			int end = inString.indexOf('}', offset);

Modified: branches/1.6/src/com/resolutions/ils/data/CourseAttempt.java
===================================================================
--- branches/1.6/src/com/resolutions/ils/data/CourseAttempt.java	2016-04-06 19:26:34 UTC (rev 1424)
+++ branches/1.6/src/com/resolutions/ils/data/CourseAttempt.java	2016-04-06 19:31:39 UTC (rev 1425)
@@ -12,6 +12,7 @@
 import java.util.Arrays;
 import java.util.Set;
 import java.util.HashSet;
+import java.util.HashMap;
 import java.util.Date;
 import java.util.TimeZone;
 import java.util.Calendar;
@@ -147,7 +148,7 @@
     			try {
 				String to = ca.getStringValue("USERPREMAIL");
 System.out.println("**** revokeAllExpired: sending email to: " + to);
-					java.util.Hashtable params = new java.util.Hashtable();
+					HashMap<String, Object> params = new HashMap<String, Object>();
 					params.put("SITEURL", sysConfig.getProperty("SiteURL", "your training site"));
 					params.putAll(ca.getData());
 					String subject = Utils.replaceParams(subjectTemplate, params);
@@ -225,7 +226,7 @@
         	for (Object o: results) {
         		CourseAttempt ca = (CourseAttempt)o;
     			try {
-					java.util.Hashtable params = new java.util.Hashtable();
+					HashMap<String, Object> params = new HashMap<String, Object>();
 					params.put("SITEURL", sysConfig.getProperty("SiteURL", "your training site"));
 					params.put("WARNDAYS", Integer.toString(warnDays));
 					params.putAll(ca.getData());

Modified: branches/1.6/src/com/resolutions/ils/data/UserProfile.java
===================================================================
--- branches/1.6/src/com/resolutions/ils/data/UserProfile.java	2016-04-06 19:26:34 UTC (rev 1424)
+++ branches/1.6/src/com/resolutions/ils/data/UserProfile.java	2016-04-06 19:31:39 UTC (rev 1425)
@@ -28,7 +28,7 @@
 
 import com.resolutions.ils.ILSSession;
 import com.resolutions.ils.Utils;
-import java.util.Hashtable;
+import java.util.HashMap;
 import java.io.StringWriter;
 
 public class UserProfile extends DataObject {
@@ -178,7 +178,7 @@
 	    			try {
 						String subject = Utils.getSysConfig(email).getProperty("EmailTemplate1Subject");
 						String body    = Utils.getSysConfig(email).getProperty("EmailTemplate1Body");
-						Hashtable<String, String> params = new Hashtable<String, String>();
+						HashMap<String, Object> params = new HashMap<String, Object>();
 						params.put("SITEURL", Utils.getSysConfig(email).getProperty("SiteURL", "your training site"));
 						params.put("ADMINCONTACTNAME", session.getCurrentCompany().getCompanyAdminContactName());
 						params.put("ADMINCONTACTPHONE", session.getCurrentCompany().getCompanyAdminContactPhone());
@@ -226,7 +226,7 @@
 				    if (emailNotice) {
 						String subject = sysConfig.getProperty("EmailTemplate6Subject");
 						String body    = sysConfig.getProperty("EmailTemplate6Body");
-						Hashtable<String, String> params = new Hashtable<String, String>();
+						HashMap<String, Object> params = new HashMap<String, Object>();
 						params.put("SITEURL", sysConfig.getProperty("SiteURL", "your training site"));
 						params.put("ADMINCONTACTNAME", session.getCurrentCompany().getCompanyAdminContactName());
 						params.put("ADMINCONTACTPHONE", session.getCurrentCompany().getCompanyAdminContactPhone());
@@ -947,7 +947,7 @@
         	UserProfile p = (UserProfile)o;
 			String subject = Utils.getSysConfig(httpSession).getProperty("EmailTemplate0Subject");
 			String body    = Utils.getSysConfig(httpSession).getProperty("EmailTemplate0Body");
-			Hashtable<String, String> params = new Hashtable<String, String>();
+			HashMap<String, Object> params = new HashMap<String, Object>();
 			params.putAll(company.getData());
 			params.putAll(p.getData());
 			subject = Utils.replaceParams(subject, params);
@@ -1041,7 +1041,7 @@
 		}
 		try {
 			String to = getUserProfileEMail();
-			java.util.Hashtable params = new java.util.Hashtable();
+			java.util.HashMap params = new java.util.HashMap();
 			params.put("CONAME", companyName);
 			params.put("SITEURL", sysConfig.getProperty("SiteURL", "your training site"));
 			params.putAll(this.getData());

Modified: branches/1.6/webapp/WEB-INF/lib/crosswire.jar
===================================================================
(Binary files differ)

Modified: branches/1.6/webapp/WEB-INF/lib/ils.jar
===================================================================
(Binary files differ)

Modified: branches/1.6/webapp/api/ccure/updatescore.vws/index.jsp
===================================================================
--- branches/1.6/webapp/api/ccure/updatescore.vws/index.jsp	2016-04-06 19:26:34 UTC (rev 1424)
+++ branches/1.6/webapp/api/ccure/updatescore.vws/index.jsp	2016-04-06 19:31:39 UTC (rev 1425)
@@ -53,36 +53,9 @@
 
 	Logger logger = Logger.getLogger(this.getClass());
 	Logger eventsLogger = Logger.getLogger("EVENTS");
+	Logger aicc = Logger.getLogger("AICC");
 
 
-	Map<String, String> courses = new HashMap<String, String>();
-	Map<String, String> courseEnums = new HashMap<String, String>();
-	int i = 1;
-	while (true) {
-		String courseName = Utils.getSysConfig(session).getProperty("CCURECourse."+i);
-		String courseEnum = Utils.getSysConfig(session).getProperty("CCURECourseEnum."+i);
-		if (courseName != null && courseEnum != null) {
-			courses.put(courseName, Integer.toString(i));
-			courseEnums.put(courseName, courseEnum);
-		}
-		else break;
-		i++;
-	}
-	// if our configuration isn't specifying course names and fields, then populate with defaults
-	if (courses.size() == 0) {
-		courses.put("Ramp Driving", "1");
-		courseEnums.put("Ramp Driving", "RAMPDRIVING");
-
-		courses.put("Airfield Driving", "2");
-		courseEnums.put("Airfield Driving", "AIRFIELDDRIVING");
-
-		courses.put("SIDA", "3");
-		courseEnums.put("SIDA", "SIDA");
-
-		courses.put("Sterile", "4");
-		courseEnums.put("Sterile", "STERILE");
-	}
-	
 	String guid = request.getParameter("userProfileUserData");
 	String userProfileID = request.getParameter("userProfileID");
 	String companyID = request.getParameter("companyID");
@@ -121,7 +94,7 @@
 
 	if (objectID != null) {
 
-		eventsLogger.debug("CCURE: objectID="+objectID+"; caCompleteDate="+caCompleteDateString+"; caStatusDesc="+caStatusDescription+"; courseName="+courseName+"; caScore="+caScore);
+		aicc.info("CCURE: updatescore.vws objectID="+objectID+"; caCompleteDate="+caCompleteDateString+"; caStatusDesc="+caStatusDescription+"; courseName="+courseName+"; caScore="+caScore);
 
 		String statusMsg = "";
 		SimpleDateFormat df  = new SimpleDateFormat("yyyy-MM-dd");
@@ -129,11 +102,9 @@
 		int personID = -1; try { personID = Integer.parseInt(objectID); } catch (Exception e) {}
 		Date caCompleteDate = new Date(); try { caCompleteDate = new SimpleDateFormat().parse(caCompleteDateString); } catch (Exception e) {}
 		String fieldName = request.getParameter("fieldSet");
-		String courseEnum  = null;
+		if (fieldName == null) fieldName = request.getParameter("courseUserData");
+		try { if (Integer.parseInt(fieldName) > 8) fieldName = null; } catch (Exception e) { fieldName = null; }
 
-		if (fieldName == null) fieldName = courses.get(courseName);
-		courseEnum = courseEnums.get(courseName);
-
 		++errCode;
 		if (personID < 0) {
 			out.print("<error code=\""+errCode+"\" message=\"You must pass a valid personID as userProfileUserData.\"/>");
@@ -156,13 +127,7 @@
 		}
 		++errCode;
 		if (fieldName == null) {
-			out.print("<error code=\""+errCode+"\" message=\"You must pass a valid Course CCURE Course Name as courseName. Valid course Names: [");
-			boolean first = true;
-			for (String cName : courses.keySet()) {
-				out.print((first?"":",") + HTTPUtils.canonize(cName));
-				first = false;
-			}
-			out.print("\"/>");
+			aicc.info("CCURE: course completed but not configured to report to CCURE");
 			return;
 		}
 

Modified: branches/1.6/webapp/report_employeecourseatt.jsp
===================================================================
--- branches/1.6/webapp/report_employeecourseatt.jsp	2016-04-06 19:26:34 UTC (rev 1424)
+++ branches/1.6/webapp/report_employeecourseatt.jsp	2016-04-06 19:31:39 UTC (rev 1425)
@@ -88,6 +88,10 @@
 		ca.setCourseAttemptForcePass(reason);
 		ca = ca.saveNew(ilsSession);
 	}
+	if (ca != null) {
+
+		ca.sendStatusUpdateEvent(session.getServletContext());
+	}
     }
     
     




More information about the Ils-source mailing list