manoj 10 years ago
commit d0b553d26a

@ -17,11 +17,8 @@
*/
package org.wso2.carbon.device.mgt.core;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.wso2.carbon.device.mgt.common.DeviceManagementException;
import org.wso2.carbon.device.mgt.common.spi.DeviceManager;
import org.wso2.carbon.device.mgt.core.dao.DeviceManagementDAOException;
import org.wso2.carbon.device.mgt.core.util.DeviceManagerUtil;
import java.util.HashMap;

@ -257,24 +257,16 @@ public class DeviceManagementServiceProviderImpl implements DeviceManagementServ
StringBuilder messageBuilder = new StringBuilder();
try {
String title = "";
if (emailMessageProperties.getTitle() != null){
title = emailMessageProperties.getTitle();
}
messageHeader = messageHeader.replaceAll("\\{" + EmailConstants.EnrolmentEmailConstants.TITLE + "\\}",
URLEncoder.encode(title, EmailConstants.EnrolmentEmailConstants.ENCODED_SCHEME));
messageHeader = messageHeader.replaceAll("\\{" + EmailConstants.EnrolmentEmailConstants.FIRST_NAME + "\\}",
URLEncoder.encode(emailMessageProperties.getFirstName(),
EmailConstants.EnrolmentEmailConstants.ENCODED_SCHEME));
messageBody = messageBody + System.getProperty("line.separator") + url.replaceAll("\\{"
+ EmailConstants.EnrolmentEmailConstants.DOwN_LOAD_URL + "\\}",
+ EmailConstants.EnrolmentEmailConstants.DOWNLOAD_URL + "\\}",
URLDecoder.decode(emailMessageProperties.getEnrolmentUrl(),
EmailConstants.EnrolmentEmailConstants.ENCODED_SCHEME));
messageBuilder.append(messageHeader).append(System.getProperty("line.separator")).append(
System.getProperty("line.separator"));
messageBuilder.append(messageBody).append(System.getProperty("line.separator")).append(
System.getProperty("line.separator")).append(messageFooter);
messageBuilder.append(messageHeader).append(System.getProperty("line.separator"));
messageBuilder.append(messageBody).append(System.getProperty("line.separator")).append(messageFooter);
} catch (IOException e) {
log.error("IO error in processing enrol email message "+emailMessageProperties);
@ -312,12 +304,6 @@ public class DeviceManagementServiceProviderImpl implements DeviceManagementServ
StringBuilder messageBuilder = new StringBuilder();
try {
String title = "";
if (emailMessageProperties.getTitle() != null){
title = emailMessageProperties.getTitle();
}
messageHeader = messageHeader.replaceAll("\\{" + EmailConstants.EnrolmentEmailConstants.TITLE + "\\}",
URLEncoder.encode(title, EmailConstants.EnrolmentEmailConstants.ENCODED_SCHEME));
messageHeader = messageHeader.replaceAll("\\{" + EmailConstants.EnrolmentEmailConstants.FIRST_NAME + "\\}",
URLEncoder.encode(emailMessageProperties.getFirstName(),
EmailConstants.EnrolmentEmailConstants.ENCODED_SCHEME));
@ -327,18 +313,16 @@ public class DeviceManagementServiceProviderImpl implements DeviceManagementServ
.ENCODED_SCHEME));
messageBody = messageBody.replaceAll("\\{" + EmailConstants.EnrolmentEmailConstants.PASSWORD + "\\}",
URLEncoder.encode(emailMessageProperties.getUserName(), EmailConstants.EnrolmentEmailConstants
URLEncoder.encode(emailMessageProperties.getPassword(), EmailConstants.EnrolmentEmailConstants
.ENCODED_SCHEME));
messageBody = messageBody + System.getProperty("line.separator") + url.replaceAll("\\{"
+ EmailConstants.EnrolmentEmailConstants.DOwN_LOAD_URL + "\\}",
+ EmailConstants.EnrolmentEmailConstants.DOWNLOAD_URL + "\\}",
URLDecoder.decode(emailMessageProperties.getEnrolmentUrl(),
EmailConstants.EnrolmentEmailConstants.ENCODED_SCHEME));
messageBuilder.append(messageHeader).append(System.getProperty("line.separator")).append(
System.getProperty("line.separator"));
messageBuilder.append(messageBody).append(System.getProperty("line.separator")).append(
System.getProperty("line.separator")).append(messageFooter);
messageBuilder.append(messageHeader).append(System.getProperty("line.separator"));
messageBuilder.append(messageBody).append(System.getProperty("line.separator")).append(messageFooter);
} catch (IOException e) {
log.error("IO error in processing enrol email message "+emailMessageProperties);

@ -20,9 +20,8 @@ package org.wso2.carbon.device.mgt.core.email;
public final class EmailConstants {
public static final class EnrolmentEmailConstants {
public static final String TITLE = "title";
public static final String USERNAME = "user-name";
public static final String DOwN_LOAD_URL = "downloadUrl";
public static final String DOWNLOAD_URL = "downloadUrl";
public static final String ENCODED_SCHEME = "UTF-8";
public static final String PASSWORD = "password";
public static final String FIRST_NAME = "first-name";

@ -19,29 +19,34 @@
<Notifications>
<NotificationMessage type="enrol">
<Header>Dear {title} {first-name},</Header>
<Body>You have been registered to the WSO2 MDM. Below is the link to enroll.</Body>
<Url>{downloadUrl}</Url>
<Footer>
<Subject>Enroll your Device with WSO2 MDM</Subject>
<Header>Dear {first-name},</Header>
<Body>
You have been registered to the WSO2 MDM. Below is the link to enroll.
</Body>
<Url>{downloadUrl}</Url>
<Footer>
Best Regards,
WSO2 MDM Team
WSO2 MDM Team.
http://www.wso2.com
</Footer>
<Subject>Enrol your device with WSO2 MDM</Subject>
</Footer>
</NotificationMessage>
<NotificationMessage type="userRegistration">
<Header>Dear {title} {first-name},</Header>
<Body>You have been registered to WSO2 MDM with following credentials.
<Subject>Enroll your Device with WSO2 MDM</Subject>
<Header>Dear {first-name},</Header>
<Body>
You have been registered to WSO2 MDM with following credentials.
Username: {user-name}
Password: {password}
Below is the link to enroll.
</Body>
<Url>{downloadUrl}</Url>
<Footer>
Best Regards,
WSO2 MDM Team
WSO2 MDM Team.
http://www.wso2.com
</Footer>
<Subject>Enrol your device with WSO2 MDM</Subject>
</NotificationMessage>
</Notifications>
Loading…
Cancel
Save