|
|
@ -255,7 +255,9 @@ public class DeviceManagementServiceProviderImpl implements DeviceManagementServ
|
|
|
|
|
|
|
|
|
|
|
|
String messageHeader = "";
|
|
|
|
String messageHeader = "";
|
|
|
|
String messageBody = "";
|
|
|
|
String messageBody = "";
|
|
|
|
String messageFooter = "";
|
|
|
|
String messageFooter1 = "";
|
|
|
|
|
|
|
|
String messageFooter2 = "";
|
|
|
|
|
|
|
|
String messageFooter3 = "";
|
|
|
|
String url = "";
|
|
|
|
String url = "";
|
|
|
|
String subject = "";
|
|
|
|
String subject = "";
|
|
|
|
|
|
|
|
|
|
|
@ -264,7 +266,9 @@ public class DeviceManagementServiceProviderImpl implements DeviceManagementServ
|
|
|
|
equals(notificationMessage.getType())) {
|
|
|
|
equals(notificationMessage.getType())) {
|
|
|
|
messageHeader = notificationMessage.getHeader();
|
|
|
|
messageHeader = notificationMessage.getHeader();
|
|
|
|
messageBody = notificationMessage.getBody();
|
|
|
|
messageBody = notificationMessage.getBody();
|
|
|
|
messageFooter = notificationMessage.getFooter();
|
|
|
|
messageFooter1 = notificationMessage.getFooterLine1();
|
|
|
|
|
|
|
|
messageFooter2 = notificationMessage.getFooterLine2();
|
|
|
|
|
|
|
|
messageFooter3 = notificationMessage.getFooterLine3();
|
|
|
|
url = notificationMessage.getUrl();
|
|
|
|
url = notificationMessage.getUrl();
|
|
|
|
subject = notificationMessage.getSubject();
|
|
|
|
subject = notificationMessage.getSubject();
|
|
|
|
break;
|
|
|
|
break;
|
|
|
@ -277,13 +281,19 @@ public class DeviceManagementServiceProviderImpl implements DeviceManagementServ
|
|
|
|
messageHeader = messageHeader.replaceAll("\\{" + EmailConstants.EnrolmentEmailConstants.FIRST_NAME + "\\}",
|
|
|
|
messageHeader = messageHeader.replaceAll("\\{" + EmailConstants.EnrolmentEmailConstants.FIRST_NAME + "\\}",
|
|
|
|
URLEncoder.encode(emailMessageProperties.getFirstName(),
|
|
|
|
URLEncoder.encode(emailMessageProperties.getFirstName(),
|
|
|
|
EmailConstants.EnrolmentEmailConstants.ENCODED_SCHEME));
|
|
|
|
EmailConstants.EnrolmentEmailConstants.ENCODED_SCHEME));
|
|
|
|
messageBody = messageBody + System.getProperty("line.separator") + url.replaceAll("\\{"
|
|
|
|
messageBody = messageBody.trim() + System.getProperty("line.separator") +
|
|
|
|
|
|
|
|
System.getProperty("line.separator") + url.replaceAll("\\{"
|
|
|
|
+ EmailConstants.EnrolmentEmailConstants.DOWNLOAD_URL + "\\}",
|
|
|
|
+ EmailConstants.EnrolmentEmailConstants.DOWNLOAD_URL + "\\}",
|
|
|
|
URLDecoder.decode(emailMessageProperties.getEnrolmentUrl(),
|
|
|
|
URLDecoder.decode(emailMessageProperties.getEnrolmentUrl(),
|
|
|
|
EmailConstants.EnrolmentEmailConstants.ENCODED_SCHEME));
|
|
|
|
EmailConstants.EnrolmentEmailConstants.ENCODED_SCHEME));
|
|
|
|
|
|
|
|
|
|
|
|
messageBuilder.append(messageHeader).append(System.getProperty("line.separator"));
|
|
|
|
messageBuilder.append(messageHeader).append(System.getProperty("line.separator"))
|
|
|
|
messageBuilder.append(messageBody).append(System.getProperty("line.separator")).append(messageFooter);
|
|
|
|
.append(System.getProperty("line.separator"));
|
|
|
|
|
|
|
|
messageBuilder.append(messageBody);
|
|
|
|
|
|
|
|
messageBuilder.append(System.getProperty("line.separator")).append(System.getProperty("line.separator"));
|
|
|
|
|
|
|
|
messageBuilder.append(messageFooter1.trim())
|
|
|
|
|
|
|
|
.append(System.getProperty("line.separator")).append(messageFooter2.trim()).append(System
|
|
|
|
|
|
|
|
.getProperty("line.separator")).append(messageFooter3.trim());
|
|
|
|
|
|
|
|
|
|
|
|
} catch (IOException e) {
|
|
|
|
} catch (IOException e) {
|
|
|
|
log.error("IO error in processing enrol email message " + emailMessageProperties);
|
|
|
|
log.error("IO error in processing enrol email message " + emailMessageProperties);
|
|
|
@ -302,7 +312,9 @@ public class DeviceManagementServiceProviderImpl implements DeviceManagementServ
|
|
|
|
|
|
|
|
|
|
|
|
String messageHeader = "";
|
|
|
|
String messageHeader = "";
|
|
|
|
String messageBody = "";
|
|
|
|
String messageBody = "";
|
|
|
|
String messageFooter = "";
|
|
|
|
String messageFooter1 = "";
|
|
|
|
|
|
|
|
String messageFooter2 = "";
|
|
|
|
|
|
|
|
String messageFooter3 = "";
|
|
|
|
String url = "";
|
|
|
|
String url = "";
|
|
|
|
String subject = "";
|
|
|
|
String subject = "";
|
|
|
|
|
|
|
|
|
|
|
@ -311,7 +323,9 @@ public class DeviceManagementServiceProviderImpl implements DeviceManagementServ
|
|
|
|
equals(notificationMessage.getType())) {
|
|
|
|
equals(notificationMessage.getType())) {
|
|
|
|
messageHeader = notificationMessage.getHeader();
|
|
|
|
messageHeader = notificationMessage.getHeader();
|
|
|
|
messageBody = notificationMessage.getBody();
|
|
|
|
messageBody = notificationMessage.getBody();
|
|
|
|
messageFooter = notificationMessage.getFooter();
|
|
|
|
messageFooter1 = notificationMessage.getFooterLine1();
|
|
|
|
|
|
|
|
messageFooter2 = notificationMessage.getFooterLine2();
|
|
|
|
|
|
|
|
messageFooter3 = notificationMessage.getFooterLine3();
|
|
|
|
url = notificationMessage.getUrl();
|
|
|
|
url = notificationMessage.getUrl();
|
|
|
|
subject = notificationMessage.getSubject();
|
|
|
|
subject = notificationMessage.getSubject();
|
|
|
|
break;
|
|
|
|
break;
|
|
|
@ -325,7 +339,9 @@ public class DeviceManagementServiceProviderImpl implements DeviceManagementServ
|
|
|
|
URLEncoder.encode(emailMessageProperties.getFirstName(),
|
|
|
|
URLEncoder.encode(emailMessageProperties.getFirstName(),
|
|
|
|
EmailConstants.EnrolmentEmailConstants.ENCODED_SCHEME));
|
|
|
|
EmailConstants.EnrolmentEmailConstants.ENCODED_SCHEME));
|
|
|
|
|
|
|
|
|
|
|
|
messageBody = messageBody.replaceAll("\\{" + EmailConstants.EnrolmentEmailConstants.USERNAME + "\\}",
|
|
|
|
messageBody = messageBody.trim().replaceAll("\\{" + EmailConstants.EnrolmentEmailConstants
|
|
|
|
|
|
|
|
.USERNAME
|
|
|
|
|
|
|
|
+ "\\}",
|
|
|
|
URLEncoder.encode(emailMessageProperties.getUserName(), EmailConstants.EnrolmentEmailConstants
|
|
|
|
URLEncoder.encode(emailMessageProperties.getUserName(), EmailConstants.EnrolmentEmailConstants
|
|
|
|
.ENCODED_SCHEME));
|
|
|
|
.ENCODED_SCHEME));
|
|
|
|
|
|
|
|
|
|
|
@ -339,7 +355,9 @@ public class DeviceManagementServiceProviderImpl implements DeviceManagementServ
|
|
|
|
EmailConstants.EnrolmentEmailConstants.ENCODED_SCHEME));
|
|
|
|
EmailConstants.EnrolmentEmailConstants.ENCODED_SCHEME));
|
|
|
|
|
|
|
|
|
|
|
|
messageBuilder.append(messageHeader).append(System.getProperty("line.separator"));
|
|
|
|
messageBuilder.append(messageHeader).append(System.getProperty("line.separator"));
|
|
|
|
messageBuilder.append(messageBody).append(System.getProperty("line.separator")).append(messageFooter);
|
|
|
|
messageBuilder.append(messageBody).append(System.getProperty("line.separator")).append(messageFooter1.trim());
|
|
|
|
|
|
|
|
messageBuilder.append(System.getProperty("line.separator")).append(messageFooter2.trim());
|
|
|
|
|
|
|
|
messageBuilder.append(System.getProperty("line.separator")).append(messageFooter3.trim());
|
|
|
|
|
|
|
|
|
|
|
|
} catch (IOException e) {
|
|
|
|
} catch (IOException e) {
|
|
|
|
log.error("IO error in processing enrol email message " + emailMessageProperties);
|
|
|
|
log.error("IO error in processing enrol email message " + emailMessageProperties);
|
|
|
@ -509,8 +527,8 @@ public class DeviceManagementServiceProviderImpl implements DeviceManagementServ
|
|
|
|
}
|
|
|
|
}
|
|
|
|
devicesOfUser.add(convertedDevice);
|
|
|
|
devicesOfUser.add(convertedDevice);
|
|
|
|
} catch (DeviceManagementDAOException e) {
|
|
|
|
} catch (DeviceManagementDAOException e) {
|
|
|
|
log.error("Error occurred while obtaining the device type of DeviceTypeId '"+
|
|
|
|
log.error("Error occurred while obtaining the device type of DeviceTypeId '" +
|
|
|
|
device.getDeviceTypeId() + "'",e);
|
|
|
|
device.getDeviceTypeId() + "'", e);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return devicesOfUser;
|
|
|
|
return devicesOfUser;
|
|
|
@ -539,7 +557,7 @@ public class DeviceManagementServiceProviderImpl implements DeviceManagementServ
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//Obtaining the devices per user
|
|
|
|
//Obtaining the devices per user
|
|
|
|
for(org.wso2.carbon.device.mgt.user.common.User user:users){
|
|
|
|
for (org.wso2.carbon.device.mgt.user.common.User user : users) {
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
userName = user.getUserName();
|
|
|
|
userName = user.getUserName();
|
|
|
|
devicesList = this.getDeviceDAO().getDeviceListOfUser(userName, tenantId);
|
|
|
|
devicesList = this.getDeviceDAO().getDeviceListOfUser(userName, tenantId);
|
|
|
@ -560,8 +578,8 @@ public class DeviceManagementServiceProviderImpl implements DeviceManagementServ
|
|
|
|
}
|
|
|
|
}
|
|
|
|
devicesOfRole.add(convertedDevice);
|
|
|
|
devicesOfRole.add(convertedDevice);
|
|
|
|
} catch (DeviceManagementDAOException e) {
|
|
|
|
} catch (DeviceManagementDAOException e) {
|
|
|
|
log.error("Error occurred while obtaining the device type of DeviceTypeId '"+
|
|
|
|
log.error("Error occurred while obtaining the device type of DeviceTypeId '" +
|
|
|
|
device.getDeviceTypeId() + "'",e);
|
|
|
|
device.getDeviceTypeId() + "'", e);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} catch (DeviceManagementDAOException e) {
|
|
|
|
} catch (DeviceManagementDAOException e) {
|
|
|
|