From ef0c9b99058510e9d74af57752e8e6fff959d3fd Mon Sep 17 00:00:00 2001 From: Timothy Vertein Date: Tue, 18 Aug 2015 09:50:14 -0500 Subject: [PATCH 01/10] MUMPFL-113 Adds lastModified to TypeValue object --- .../main/java/edu/wisc/my/profile/model/TypeValue.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/my-profile-api/src/main/java/edu/wisc/my/profile/model/TypeValue.java b/my-profile-api/src/main/java/edu/wisc/my/profile/model/TypeValue.java index 1b59ab7..8cbbc87 100644 --- a/my-profile-api/src/main/java/edu/wisc/my/profile/model/TypeValue.java +++ b/my-profile-api/src/main/java/edu/wisc/my/profile/model/TypeValue.java @@ -1,6 +1,7 @@ package edu.wisc.my.profile.model; import org.apache.commons.lang3.StringUtils; +import org.joda.time.DateTime; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; @@ -18,6 +19,7 @@ public TypeValue(String type, String value) { private String type; private String value; + private DateTime lastModified; public String getType() { return type; @@ -32,6 +34,14 @@ public void setValue(String value) { this.value = value; } + public DateTime getLastModified() { + return lastModified; + } + + public void setLastModified(DateTime lastModified) { + this.lastModified = lastModified; + } + public boolean isEmpty() { return StringUtils.isBlank(type) && StringUtils.isBlank(value); } From a1e3684ce3db6a361521dcc325a375fd5998f84a Mon Sep 17 00:00:00 2001 From: Timothy Vertein Date: Tue, 18 Aug 2015 10:18:26 -0500 Subject: [PATCH 02/10] MUMPFL-113 Adds EmergencyPhoneNumber interfaces --- .../service/EmergencyPhoneNumberService.java | 23 ++++++++++++++++++ .../profile/dao/EmergencyPhoneNumberDao.java | 24 +++++++++++++++++++ 2 files changed, 47 insertions(+) create mode 100644 my-profile-api/src/main/java/edu/wisc/my/profile/service/EmergencyPhoneNumberService.java create mode 100644 my-profile-middleware-impl/src/main/java/edu/wisc/my/profile/dao/EmergencyPhoneNumberDao.java diff --git a/my-profile-api/src/main/java/edu/wisc/my/profile/service/EmergencyPhoneNumberService.java b/my-profile-api/src/main/java/edu/wisc/my/profile/service/EmergencyPhoneNumberService.java new file mode 100644 index 0000000..7f105bf --- /dev/null +++ b/my-profile-api/src/main/java/edu/wisc/my/profile/service/EmergencyPhoneNumberService.java @@ -0,0 +1,23 @@ +package edu.wisc.my.profile.service; + +import edu.wisc.my.profile.model.TypeValue; + +public interface EmergencyPhoneNumberService{ + + /** + * Gets a user's emergency Phone Numbers + * @param netid the uid or net id of user + * @return a TypeValue array representing the phone numbers + */ + public TypeValue[] getEmergencyPhoneNumbers(String netid); + + /** + * Sets the emergency phone number for a given user and returns the saved + * phone numbers + * @param phoneNumbers + * @return the phones number of that individual + * @throws Exception + */ + public TypeValue[] setEmergencyPhoneNumbers(String netid, TypeValue[] phoneNumbers) throws Exception; + +} diff --git a/my-profile-middleware-impl/src/main/java/edu/wisc/my/profile/dao/EmergencyPhoneNumberDao.java b/my-profile-middleware-impl/src/main/java/edu/wisc/my/profile/dao/EmergencyPhoneNumberDao.java new file mode 100644 index 0000000..7200f78 --- /dev/null +++ b/my-profile-middleware-impl/src/main/java/edu/wisc/my/profile/dao/EmergencyPhoneNumberDao.java @@ -0,0 +1,24 @@ +package edu.wisc.my.profile.dao; + +import edu.wisc.my.profile.model.TypeValue; + +public interface EmergencyPhoneNumberDao { + + /** + * Gets emergency phone numbers for user + * @param netid + * @return a TypeValue representing phone numbers + */ + TypeValue[] getPhoneNumber(String netId); + + + /** + * Sets emergency phone numbers returning the saved phone numbers + * @param netid + * @param phoneNumbers + * @return the saved phone numbers + * @throws Exception + */ + TypeValue[] setPhoneNumber(String netId, TypeValue[] phoneNumbers) throws Exception; + +} From 406faf15dee676a0e1b21597340a3b3200d57898 Mon Sep 17 00:00:00 2001 From: Timothy Vertein Date: Tue, 18 Aug 2015 12:41:34 -0500 Subject: [PATCH 03/10] MUMPFL-113 Adds MW Integration --- .../EmergencyContactMiddlewareDaoImpl.java | 7 +- .../profile/dao/EmergencyPhoneNumberDao.java | 4 +- .../dao/EmergencyPhoneNumberDaoImpl.java | 63 ++++++++++++++++++ ...mergencyPhoneNumberResultSetExtractor.java | 36 ++++++++++ .../dao/LocalContactMiddlewareDaoImpl.java | 7 +- .../mapper/ContactInformationMapper.java | 51 +++++++++++++-- .../EmergencyPhoneNumberServiceImpl.java | 25 +++++++ .../web/EmergencyPhoneNumberController.java | 65 +++++++++++++++++++ .../WEB-INF/context/applicationContext.xml | 4 ++ 9 files changed, 252 insertions(+), 10 deletions(-) create mode 100644 my-profile-middleware-impl/src/main/java/edu/wisc/my/profile/dao/EmergencyPhoneNumberDaoImpl.java create mode 100644 my-profile-middleware-impl/src/main/java/edu/wisc/my/profile/dao/EmergencyPhoneNumberResultSetExtractor.java create mode 100644 my-profile-middleware-impl/src/main/java/edu/wisc/my/profile/service/EmergencyPhoneNumberServiceImpl.java create mode 100644 my-profile-webapp/src/main/java/edu/wisc/my/profile/web/EmergencyPhoneNumberController.java diff --git a/my-profile-middleware-impl/src/main/java/edu/wisc/my/profile/dao/EmergencyContactMiddlewareDaoImpl.java b/my-profile-middleware-impl/src/main/java/edu/wisc/my/profile/dao/EmergencyContactMiddlewareDaoImpl.java index 755bebc..8e4c5f4 100644 --- a/my-profile-middleware-impl/src/main/java/edu/wisc/my/profile/dao/EmergencyContactMiddlewareDaoImpl.java +++ b/my-profile-middleware-impl/src/main/java/edu/wisc/my/profile/dao/EmergencyContactMiddlewareDaoImpl.java @@ -10,6 +10,7 @@ import edu.wisc.my.profile.mapper.ContactInformationMapper; import edu.wisc.my.profile.model.ContactInformation; +import edu.wisc.my.profile.model.TypeValue; public class EmergencyContactMiddlewareDaoImpl implements EmergencyContactMiddlewareDao { @@ -19,6 +20,9 @@ public class EmergencyContactMiddlewareDaoImpl implements EmergencyContactMiddle @Autowired private LocalContactMiddlewareDao lcdao; + @Autowired + private EmergencyPhoneNumberDao pNumDao; + public EmergencyContactMiddlewareDaoImpl(DataSource ds) { jdbcTemplate = new JdbcTemplate(ds); } @@ -34,7 +38,8 @@ public ContactInformation[] setData(String netId, ContactInformation[] emergency throws Exception { //TODO: Fix this gross hack ContactInformation localInfo = lcdao.getContactInfo(netId); - JSONObject json = ContactInformationMapper.convertToJSONObject(emergencyContacts, localInfo); + TypeValue[] phoneNumbers = pNumDao.getPhoneNumbers(netId); + JSONObject json = ContactInformationMapper.convertToJSONObject(emergencyContacts, localInfo, phoneNumbers); json.put("NETID", netId); if(logger.isTraceEnabled()) { logger.trace("Saving the following JSON: " + json.toString()); diff --git a/my-profile-middleware-impl/src/main/java/edu/wisc/my/profile/dao/EmergencyPhoneNumberDao.java b/my-profile-middleware-impl/src/main/java/edu/wisc/my/profile/dao/EmergencyPhoneNumberDao.java index 7200f78..31b77fc 100644 --- a/my-profile-middleware-impl/src/main/java/edu/wisc/my/profile/dao/EmergencyPhoneNumberDao.java +++ b/my-profile-middleware-impl/src/main/java/edu/wisc/my/profile/dao/EmergencyPhoneNumberDao.java @@ -9,7 +9,7 @@ public interface EmergencyPhoneNumberDao { * @param netid * @return a TypeValue representing phone numbers */ - TypeValue[] getPhoneNumber(String netId); + TypeValue[] getPhoneNumbers(String netId); /** @@ -19,6 +19,6 @@ public interface EmergencyPhoneNumberDao { * @return the saved phone numbers * @throws Exception */ - TypeValue[] setPhoneNumber(String netId, TypeValue[] phoneNumbers) throws Exception; + TypeValue[] setPhoneNumbers(String netId, TypeValue[] phoneNumbers) throws Exception; } diff --git a/my-profile-middleware-impl/src/main/java/edu/wisc/my/profile/dao/EmergencyPhoneNumberDaoImpl.java b/my-profile-middleware-impl/src/main/java/edu/wisc/my/profile/dao/EmergencyPhoneNumberDaoImpl.java new file mode 100644 index 0000000..e5976d8 --- /dev/null +++ b/my-profile-middleware-impl/src/main/java/edu/wisc/my/profile/dao/EmergencyPhoneNumberDaoImpl.java @@ -0,0 +1,63 @@ +package edu.wisc.my.profile.dao; + +import javax.sql.DataSource; + +import org.joda.time.DateTime; +import org.json.JSONObject; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.jdbc.core.JdbcTemplate; + +import edu.wisc.my.profile.mapper.ContactInformationMapper; +import edu.wisc.my.profile.model.ContactInformation; +import edu.wisc.my.profile.model.TypeValue; + +public class EmergencyPhoneNumberDaoImpl implements EmergencyPhoneNumberDao { + + protected final Logger logger = LoggerFactory.getLogger(getClass()); + + @Autowired + private EmergencyContactMiddlewareDao ecdao; + + @Autowired + private LocalContactMiddlewareDao lcdao; + + private JdbcTemplate jdbcTemplate; + + public EmergencyPhoneNumberDaoImpl(DataSource ds) { + jdbcTemplate = new JdbcTemplate(ds); + } + + @Override + public TypeValue[] getPhoneNumbers(String netId) { + TypeValue[] tv = jdbcTemplate.query("select PERSONPROFILE.PERSONPROFILE.GET_PERSON_PROFILE( ? ) from dual", new EmergencyPhoneNumberResultSetExtractor(), netId); + return tv; + } + + @Override + public TypeValue[] setPhoneNumbers(String netId, TypeValue[] phoneNumbers) throws Exception { + // Keep the hack alive as in EmergencyContactMiddleWareDaoImpl and LocalContactMiddlewareDaoImpl + // Get the other info, add the new stuff and save the one object + ContactInformation[] emergencyContacts = ecdao.getData(netId); + ContactInformation localInfo = lcdao.getContactInfo(netId); + TypeValue[] phNumberWithDate = phoneNumbers; + for(TypeValue phoneNumber: phoneNumbers){ + phoneNumber.setLastModified(DateTime.now()); + } + JSONObject json = ContactInformationMapper.convertToJSONObject(emergencyContacts, localInfo, phNumberWithDate); + json.put("NETID", netId); + if(logger.isTraceEnabled()) { + logger.trace("Saving the following JSON: " + json.toString()); + } + String result = jdbcTemplate.query("select PERSONPROFILE.PERSONPROFILE.SAVE_PERSON_PROFILE( ? ) from dual", new MiddlewareUpdateExtractor(), json.toString()); + + if(MiddlewareUpdateExtractor.SUCCESS.equals(result)) { + //return saved content + return phoneNumbers; + } else { + throw new Exception("There was an issue saving the emergency contacts"); + } + + } +} diff --git a/my-profile-middleware-impl/src/main/java/edu/wisc/my/profile/dao/EmergencyPhoneNumberResultSetExtractor.java b/my-profile-middleware-impl/src/main/java/edu/wisc/my/profile/dao/EmergencyPhoneNumberResultSetExtractor.java new file mode 100644 index 0000000..fca2b64 --- /dev/null +++ b/my-profile-middleware-impl/src/main/java/edu/wisc/my/profile/dao/EmergencyPhoneNumberResultSetExtractor.java @@ -0,0 +1,36 @@ +package edu.wisc.my.profile.dao; + +import java.sql.ResultSet; +import java.sql.SQLException; + +import org.json.JSONObject; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.dao.DataAccessException; +import org.springframework.jdbc.core.ResultSetExtractor; + +import edu.wisc.my.profile.mapper.ContactInformationMapper; +import edu.wisc.my.profile.model.TypeValue; + +public class EmergencyPhoneNumberResultSetExtractor implements ResultSetExtractor { + + protected final Logger logger = LoggerFactory.getLogger(getClass()); + + @Override + public TypeValue[] extractData(ResultSet rs) throws SQLException, DataAccessException { + if(rs.next()) { + String val = rs.getString(1); + TypeValue[] value = null; + try { + JSONObject json = new JSONObject(val); + value = ContactInformationMapper.convertToEmergencyPhoneNumber(json); + return value; + } catch (Exception e) { + logger.error("Issue fetching user info",e); + } + } + //error or empty + return null; + } + +} diff --git a/my-profile-middleware-impl/src/main/java/edu/wisc/my/profile/dao/LocalContactMiddlewareDaoImpl.java b/my-profile-middleware-impl/src/main/java/edu/wisc/my/profile/dao/LocalContactMiddlewareDaoImpl.java index 4152e21..cbfc96c 100644 --- a/my-profile-middleware-impl/src/main/java/edu/wisc/my/profile/dao/LocalContactMiddlewareDaoImpl.java +++ b/my-profile-middleware-impl/src/main/java/edu/wisc/my/profile/dao/LocalContactMiddlewareDaoImpl.java @@ -10,6 +10,7 @@ import edu.wisc.my.profile.mapper.ContactInformationMapper; import edu.wisc.my.profile.model.ContactInformation; +import edu.wisc.my.profile.model.TypeValue; public class LocalContactMiddlewareDaoImpl implements LocalContactMiddlewareDao { @@ -18,6 +19,9 @@ public class LocalContactMiddlewareDaoImpl implements LocalContactMiddlewareDao @Autowired private EmergencyContactMiddlewareDao ecdao; + @Autowired + private EmergencyPhoneNumberDao pNumDao; + private JdbcTemplate jdbcTemplate; public LocalContactMiddlewareDaoImpl(DataSource ds) { @@ -34,7 +38,8 @@ public ContactInformation getContactInfo(String netId) { public ContactInformation setContactInfo(String netId, ContactInformation updatedContactInformation) throws Exception { //hack until we refactor ContactInformation[] emergencyContacts = ecdao.getData(netId); - JSONObject json = ContactInformationMapper.convertToJSONObject(emergencyContacts, updatedContactInformation); + TypeValue[] phoneNumbers = pNumDao.getPhoneNumbers(netId); + JSONObject json = ContactInformationMapper.convertToJSONObject(emergencyContacts, updatedContactInformation, phoneNumbers); json.put("NETID", netId); if(logger.isTraceEnabled()) { logger.trace("Saving the following JSON: " + json.toString()); diff --git a/my-profile-middleware-impl/src/main/java/edu/wisc/my/profile/mapper/ContactInformationMapper.java b/my-profile-middleware-impl/src/main/java/edu/wisc/my/profile/mapper/ContactInformationMapper.java index 2064a6d..6bd71fa 100644 --- a/my-profile-middleware-impl/src/main/java/edu/wisc/my/profile/mapper/ContactInformationMapper.java +++ b/my-profile-middleware-impl/src/main/java/edu/wisc/my/profile/mapper/ContactInformationMapper.java @@ -1,6 +1,5 @@ package edu.wisc.my.profile.mapper; - import java.util.ArrayList; import java.util.List; @@ -108,10 +107,40 @@ public static ContactInformation convertToLocalContactInformation(JSONObject jso return ci; } - public static JSONObject convertToJSONObject(ContactInformation[] emergencyContacts, ContactInformation ci) { + /** + * Extracts Phone Number from JSONObject + * @param json + * @return A TypeValue representing phone numbers, TypeValue may be empty if + * no phone number exists, may return null if parameter is null + */ + public static TypeValue[] convertToEmergencyPhoneNumber(JSONObject json){ + if(json == null){ + return null; + } + List phoneNumbers = new ArrayList(); + //phoneNumbers + for(int i=1; i<=3; i++){ + try { + JSONObject phoneNumberLine = json.getJSONObject("PHONE COUNT " + i); + if(phoneNumberLine != null){ + TypeValue phoneNumber = new TypeValue(); + phoneNumber.setValue(phoneNumberLine.getString("PHONE NUMBER")); + phoneNumber.setType(phoneNumberLine.getString("PHONE COMMENT")); + phoneNumbers.add(phoneNumber); + } + }catch(JSONException ex){ + //Probably safe. Will throw exception if PHONE COUNT +i does not return object + logger.trace(ex.getMessage()); + } + } + return phoneNumbers.toArray(new TypeValue[phoneNumbers.size()]); + } + + public static JSONObject convertToJSONObject(ContactInformation[] emergencyContacts, ContactInformation ci, TypeValue[] phoneNumbers) { JSONObject json = new JSONObject(); //populate local contact info int count=1; + DateTimeFormatter formatter = DateTimeFormat.forPattern("dd-MMM-YY"); for(ContactAddress ca : ci.getAddresses()) { JSONObject address = new JSONObject(); int alcount = 1; @@ -134,13 +163,23 @@ public static JSONObject convertToJSONObject(ContactInformation[] emergencyConta } address.put("ADDRESS PRIORITY", count); - DateTimeFormatter formatter = DateTimeFormat.forPattern("dd-MMM-YY"); address.put("ADDRESS DTTM", formatter.print(ci.getLastModified())); json.put("ADDRESS COUNT " + count++, address); } - - //TODO : populate local phone - + + //Add Emergency Phone Number + count = 1; + for(TypeValue phoneNumber: phoneNumbers){ + if(phoneNumber.getType()!=null && phoneNumber.getValue()!=null){ + JSONObject emergencyPhoneNumber = new JSONObject(); + emergencyPhoneNumber.put("PHONE PRIORITY", count); + emergencyPhoneNumber.put("PHONE NUMBER", phoneNumber.getValue()); + emergencyPhoneNumber.put("PHONE COMMENT", phoneNumber.getType()); + emergencyPhoneNumber.put("PHONE DTTM", formatter.print(phoneNumber.getLastModified())); + json.put("PHONE COUNT "+count, emergencyPhoneNumber); + } + } + //populate emergency contact info count = 1; for(ContactInformation eci : emergencyContacts) { diff --git a/my-profile-middleware-impl/src/main/java/edu/wisc/my/profile/service/EmergencyPhoneNumberServiceImpl.java b/my-profile-middleware-impl/src/main/java/edu/wisc/my/profile/service/EmergencyPhoneNumberServiceImpl.java new file mode 100644 index 0000000..19ef8ba --- /dev/null +++ b/my-profile-middleware-impl/src/main/java/edu/wisc/my/profile/service/EmergencyPhoneNumberServiceImpl.java @@ -0,0 +1,25 @@ +package edu.wisc.my.profile.service; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import edu.wisc.my.profile.dao.EmergencyPhoneNumberDao; +import edu.wisc.my.profile.model.TypeValue; + +@Service +public class EmergencyPhoneNumberServiceImpl implements EmergencyPhoneNumberService { + + @Autowired + private EmergencyPhoneNumberDao dao; + + @Override + public TypeValue[] getEmergencyPhoneNumbers(String netId) { + return dao.getPhoneNumbers(netId); + } + + @Override + public TypeValue[] setEmergencyPhoneNumbers(String netId, TypeValue[] phoneNumbers) throws Exception{ + return dao.setPhoneNumbers(netId, phoneNumbers); + } + +} diff --git a/my-profile-webapp/src/main/java/edu/wisc/my/profile/web/EmergencyPhoneNumberController.java b/my-profile-webapp/src/main/java/edu/wisc/my/profile/web/EmergencyPhoneNumberController.java new file mode 100644 index 0000000..2325413 --- /dev/null +++ b/my-profile-webapp/src/main/java/edu/wisc/my/profile/web/EmergencyPhoneNumberController.java @@ -0,0 +1,65 @@ +package edu.wisc.my.profile.web; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.apache.commons.lang3.StringUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.ResponseBody; + +import com.google.gson.Gson; + +import edu.wisc.my.profile.model.TypeValue; +import edu.wisc.my.profile.service.EmergencyPhoneNumberService; + +@Controller +@RequestMapping("/emergencyPhoneNumber") +public class EmergencyPhoneNumberController { + + protected final Logger logger = LoggerFactory.getLogger(getClass()); + + @Autowired + private EmergencyPhoneNumberService emPhoneNumberService; + + @RequestMapping(method = RequestMethod.GET, value="/get.json") + public @ResponseBody void getPhoneNumber(HttpServletRequest request, HttpServletResponse response){ + try { + String username = request.getHeader("uid"); + if(StringUtils.isBlank(username)){ + logger.warn("User hit get emergency phone number service w/o username set"); + response.setStatus(HttpServletResponse.SC_UNAUTHORIZED); + } + TypeValue[] phoneNumbers = emPhoneNumberService.getEmergencyPhoneNumbers(username); + Gson gson = new Gson(); + response.getWriter().write("{\"emergencyPhoneNumbers\":"+gson.toJson(phoneNumbers)+"}"); + response.setContentType("application/json"); + response.setStatus(HttpServletResponse.SC_OK); + } catch (Exception e) { + logger.error("Issue happened during lookup", e); + response.setStatus(HttpServletResponse.SC_FORBIDDEN); + } + } + + @RequestMapping(method = RequestMethod.POST, value="/set") + public @ResponseBody void setPhoneNumber(HttpServletRequest request, @RequestBody TypeValue[] phoneNumbers, HttpServletResponse response){ + try { + final String uid = request.getHeader("uid"); + if(StringUtils.isBlank(uid)){ + logger.warn("User hit get emergency phone number service w/o username set"); + response.setStatus(HttpServletResponse.SC_UNAUTHORIZED); + } + emPhoneNumberService.setEmergencyPhoneNumbers(uid, (TypeValue[]) phoneNumbers); + response.setStatus(HttpServletResponse.SC_OK); + } catch (Exception e) { + logger.error("Issue setting emergency phone number data", e); + response.setStatus(HttpServletResponse.SC_SERVICE_UNAVAILABLE); + } + } + +} diff --git a/my-profile-webapp/src/main/webapp/WEB-INF/context/applicationContext.xml b/my-profile-webapp/src/main/webapp/WEB-INF/context/applicationContext.xml index d36285c..c9a227d 100644 --- a/my-profile-webapp/src/main/webapp/WEB-INF/context/applicationContext.xml +++ b/my-profile-webapp/src/main/webapp/WEB-INF/context/applicationContext.xml @@ -77,6 +77,10 @@ + + + + From 12fa48c965dfd0e64cb6f42a1754ac37ba5d87e4 Mon Sep 17 00:00:00 2001 From: Timothy Vertein Date: Wed, 19 Aug 2015 15:20:22 -0500 Subject: [PATCH 07/10] MUMPFL-113 Adds UI Polish to EmergencyPhoneNumber --- .../my-app/lec/partials/emergency-info.html | 14 +++++----- .../my-app/lec/partials/emergency-phone.html | 27 ++++++++++--------- 2 files changed, 20 insertions(+), 21 deletions(-) diff --git a/my-profile-webapp/src/main/webapp/my-app/lec/partials/emergency-info.html b/my-profile-webapp/src/main/webapp/my-app/lec/partials/emergency-info.html index 18e6574..6dd52af 100644 --- a/my-profile-webapp/src/main/webapp/my-app/lec/partials/emergency-info.html +++ b/my-profile-webapp/src/main/webapp/my-app/lec/partials/emergency-info.html @@ -13,18 +13,16 @@
-

State and federal laws require the university to collect emergency contact information for every student. Learn more here.

+

State and federal laws require the university to collect emergency contact information for every student. Learn more in the KnowledgeBase.

This information is being collected for the safety of our students. Only authorized UW personnel will be able to access it.

-
-
- -
-
-
+
+ +
+

Emergency Contact

@@ -45,7 +43,7 @@

Emergency Contact

-
+

My Local Address

diff --git a/my-profile-webapp/src/main/webapp/my-app/lec/partials/emergency-phone.html b/my-profile-webapp/src/main/webapp/my-app/lec/partials/emergency-phone.html index 7aee65f..b28a8ce 100644 --- a/my-profile-webapp/src/main/webapp/my-app/lec/partials/emergency-phone.html +++ b/my-profile-webapp/src/main/webapp/my-app/lec/partials/emergency-phone.html @@ -1,41 +1,42 @@
-

My Emergency Phone Number

+

My Phone Number

-

An emergency phone number where you can be reached in cases of safety

+

A number where you can be reached in an emergency.

- No Phone Number inserted yet! + No phone number entered yet.

- Emergency Phone: {{emergencyPhoneNumbers.emergencyPhoneNumbers[0].value}} ({{emergencyPhoneNumbers.emergencyPhoneNumbers[0].type}}) + {{emergencyPhoneNumbers.emergencyPhoneNumbers[0].value}} ({{emergencyPhoneNumbers.emergencyPhoneNumbers[0].type}})

-
+
- +
+

*Required

- +
+ + +
From 95e72dad39b3e620a22b9bb350c2b0093b8d5598 Mon Sep 17 00:00:00 2001 From: Timothy Vertein Date: Wed, 19 Aug 2015 15:30:48 -0500 Subject: [PATCH 08/10] Refactors log.trace statements for readability --- .../my/profile/dao/EmergencyContactMiddlewareDaoImpl.java | 4 +--- .../edu/wisc/my/profile/dao/EmergencyPhoneNumberDaoImpl.java | 4 +--- .../wisc/my/profile/dao/LocalContactMiddlewareDaoImpl.java | 4 +--- 3 files changed, 3 insertions(+), 9 deletions(-) diff --git a/my-profile-middleware-impl/src/main/java/edu/wisc/my/profile/dao/EmergencyContactMiddlewareDaoImpl.java b/my-profile-middleware-impl/src/main/java/edu/wisc/my/profile/dao/EmergencyContactMiddlewareDaoImpl.java index 8e4c5f4..bad81f5 100644 --- a/my-profile-middleware-impl/src/main/java/edu/wisc/my/profile/dao/EmergencyContactMiddlewareDaoImpl.java +++ b/my-profile-middleware-impl/src/main/java/edu/wisc/my/profile/dao/EmergencyContactMiddlewareDaoImpl.java @@ -41,9 +41,7 @@ public ContactInformation[] setData(String netId, ContactInformation[] emergency TypeValue[] phoneNumbers = pNumDao.getPhoneNumbers(netId); JSONObject json = ContactInformationMapper.convertToJSONObject(emergencyContacts, localInfo, phoneNumbers); json.put("NETID", netId); - if(logger.isTraceEnabled()) { - logger.trace("Saving the following JSON: " + json.toString()); - } + logger.trace("Saving the following JSON: {}" + json); String result = jdbcTemplate.query("select PERSONPROFILE.PERSONPROFILE.SAVE_PERSON_PROFILE( ? ) from dual", new MiddlewareUpdateExtractor(), json.toString()); if(MiddlewareUpdateExtractor.SUCCESS.equals(result)) { diff --git a/my-profile-middleware-impl/src/main/java/edu/wisc/my/profile/dao/EmergencyPhoneNumberDaoImpl.java b/my-profile-middleware-impl/src/main/java/edu/wisc/my/profile/dao/EmergencyPhoneNumberDaoImpl.java index e5976d8..9087af8 100644 --- a/my-profile-middleware-impl/src/main/java/edu/wisc/my/profile/dao/EmergencyPhoneNumberDaoImpl.java +++ b/my-profile-middleware-impl/src/main/java/edu/wisc/my/profile/dao/EmergencyPhoneNumberDaoImpl.java @@ -47,9 +47,7 @@ public TypeValue[] setPhoneNumbers(String netId, TypeValue[] phoneNumbers) throw } JSONObject json = ContactInformationMapper.convertToJSONObject(emergencyContacts, localInfo, phNumberWithDate); json.put("NETID", netId); - if(logger.isTraceEnabled()) { - logger.trace("Saving the following JSON: " + json.toString()); - } + logger.trace("Saving the following JSON: {}" + json); String result = jdbcTemplate.query("select PERSONPROFILE.PERSONPROFILE.SAVE_PERSON_PROFILE( ? ) from dual", new MiddlewareUpdateExtractor(), json.toString()); if(MiddlewareUpdateExtractor.SUCCESS.equals(result)) { diff --git a/my-profile-middleware-impl/src/main/java/edu/wisc/my/profile/dao/LocalContactMiddlewareDaoImpl.java b/my-profile-middleware-impl/src/main/java/edu/wisc/my/profile/dao/LocalContactMiddlewareDaoImpl.java index cbfc96c..03806b7 100644 --- a/my-profile-middleware-impl/src/main/java/edu/wisc/my/profile/dao/LocalContactMiddlewareDaoImpl.java +++ b/my-profile-middleware-impl/src/main/java/edu/wisc/my/profile/dao/LocalContactMiddlewareDaoImpl.java @@ -41,9 +41,7 @@ public ContactInformation setContactInfo(String netId, ContactInformation update TypeValue[] phoneNumbers = pNumDao.getPhoneNumbers(netId); JSONObject json = ContactInformationMapper.convertToJSONObject(emergencyContacts, updatedContactInformation, phoneNumbers); json.put("NETID", netId); - if(logger.isTraceEnabled()) { - logger.trace("Saving the following JSON: " + json.toString()); - } + logger.trace("Saving the following JSON: {}" + json); String result = jdbcTemplate.query("select PERSONPROFILE.PERSONPROFILE.SAVE_PERSON_PROFILE( ? ) from dual", new MiddlewareUpdateExtractor(), json.toString()); if(MiddlewareUpdateExtractor.SUCCESS.equals(result)) { From 7468ca2f449fa65e48e1b1527f2170563673b239 Mon Sep 17 00:00:00 2001 From: Timothy Vertein Date: Wed, 19 Aug 2015 15:33:04 -0500 Subject: [PATCH 09/10] MUMPFL-113 Adds better description for console log --- my-profile-webapp/src/main/webapp/my-app/lec/services.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/my-profile-webapp/src/main/webapp/my-app/lec/services.js b/my-profile-webapp/src/main/webapp/my-app/lec/services.js index 9093ef5..da03ee4 100644 --- a/my-profile-webapp/src/main/webapp/my-app/lec/services.js +++ b/my-profile-webapp/src/main/webapp/my-app/lec/services.js @@ -46,7 +46,7 @@ define(['angular'], function(angular) { function(data, status){ return data; }).error(function(data, status){ - miscService.redirectUser(status, "Get emergency contact info"); + miscService.redirectUser(status, "Get emergency phone number"); }); }; @@ -55,7 +55,7 @@ define(['angular'], function(angular) { function(data, status) { //success function return data; }).error(function(data, status) { // failure function - miscService.redirectUser(status, "Get emergency contact info"); + miscService.redirectUser(status, "Set emergency phone number"); }); }; From 1da02048c939b2f269f926e0851ab320e624b287 Mon Sep 17 00:00:00 2001 From: Timothy Vertein Date: Wed, 19 Aug 2015 15:58:47 -0500 Subject: [PATCH 10/10] MUMPFL-113 Adds accessibility resources --- .../my-app/lec/partials/emergency-phone.html | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/my-profile-webapp/src/main/webapp/my-app/lec/partials/emergency-phone.html b/my-profile-webapp/src/main/webapp/my-app/lec/partials/emergency-phone.html index b28a8ce..7c15ced 100644 --- a/my-profile-webapp/src/main/webapp/my-app/lec/partials/emergency-phone.html +++ b/my-profile-webapp/src/main/webapp/my-app/lec/partials/emergency-phone.html @@ -17,12 +17,12 @@

My Phone Number

- - + +
- - @@ -30,13 +30,13 @@

My Phone Number

*Required

- - + +
- - + +