Subversion Repositories SmartDukaan

Rev

Rev 27123 | Rev 28395 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 27123 Rev 27285
Line 83... Line 83...
83
		{
83
		{
84
			put("image/png", "png");
84
			put("image/png", "png");
85
			put("image/jpeg", "jpeg");
85
			put("image/jpeg", "jpeg");
86
			put("image/pjpeg", "jpeg");
86
			put("image/pjpeg", "jpeg");
87
			put("application/pdf", "pdf");
87
			put("application/pdf", "pdf");
-
 
88
			put("application/msword", "doc");
-
 
89
			put("application/vnd.openxmlformats-officedocument.wordprocessingml.document", "docx");
-
 
90
			put("application/vnd.ms-excel", "xls");
-
 
91
			put("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", "xlsx");
88
		}
92
		}
89
	});
93
	});
90
 
94
 
91
	private static String getExportPath() {
95
	private static String getExportPath() {
92
		String exportPath = "/var/lib/tomcat7/webapps/export/html/entities/";
96
		String exportPath = "/var/lib/tomcat7/webapps/export/html/entities/";
-
 
97
		/*
93
/*		String exportPath = null;
98
		 * String exportPath = null;
94
 
-
 
95
		try {
99
		 * 
96
			ConfigClient client = ConfigClient.getClient();
100
		 * try { ConfigClient client = ConfigClient.getClient(); exportPath =
97
			exportPath = client.get("export_entities_path");
101
		 * client.get("export_entities_path"); } catch (Exception ce) {
98
		} catch (Exception ce) {
-
 
99
			logger.error("Unable to read export path from the config client: ", ce);
102
		 * logger.error("Unable to read export path from the config client: ", ce);
100
			logger.warn("Setting the default export path");
103
		 * logger.warn("Setting the default export path"); exportPath =
101
			exportPath = "/var/lib/tomcat7/webapps/export/html/entities/";
104
		 * "/var/lib/tomcat7/webapps/export/html/entities/"; }
102
		}*/
105
		 */
103
		return exportPath;
106
		return exportPath;
104
	}
107
	}
105
 
108
 
106
	public static String getRechargeDisplayStatus(RechargeOrderStatus status) {
109
	public static String getRechargeDisplayStatus(RechargeOrderStatus status) {
107
		if (status == null) {
110
		if (status == null) {
Line 148... Line 151...
148
		paramsMap.put("password", "Smart@91");
151
		paramsMap.put("password", "Smart@91");
149
		paramsMap.put("senderID", "SMTDKN");
152
		paramsMap.put("senderID", "SMTDKN");
150
		paramsMap.put("message", text);
153
		paramsMap.put("message", text);
151
		paramsMap.put("mobile", mobileNumber);
154
		paramsMap.put("mobile", mobileNumber);
152
		paramsMap.put("messageType", "Text");
155
		paramsMap.put("messageType", "Text");
153
		//rc.getResponse(SMS_GATEWAY, paramsMap, null);
156
		// rc.getResponse(SMS_GATEWAY, paramsMap, null);
154
	}
157
	}
155
 
158
 
156
	public static void sendMailWithAttachments(JavaMailSender mailSender, String emailTo, String[] cc, String subject,
159
	public static void sendMailWithAttachments(JavaMailSender mailSender, String emailTo, String[] cc, String subject,
157
			String body, List<File> attachments) throws Exception {
160
			String body, List<File> attachments) throws Exception {
158
		MimeMessage message = mailSender.createMimeMessage();
161
		MimeMessage message = mailSender.createMimeMessage();
Line 161... Line 164...
161
		helper.setText(body);
164
		helper.setText(body);
162
		if (cc != null) {
165
		if (cc != null) {
163
			helper.setCc(cc);
166
			helper.setCc(cc);
164
		}
167
		}
165
		helper.setTo(emailTo);
168
		helper.setTo(emailTo);
166
		//helper.setTo("amit.gupta@smartdukaan.com");
169
		// helper.setTo("amit.gupta@smartdukaan.com");
167
		InternetAddress senderAddress = new InternetAddress("noreply@smartdukaan.com", "SmartDukaan Care");
170
		InternetAddress senderAddress = new InternetAddress("noreply@smartdukaan.com", "SmartDukaan Care");
168
		helper.setFrom(senderAddress);
171
		helper.setFrom(senderAddress);
169
		if (attachments != null) {
172
		if (attachments != null) {
170
			for (File file : attachments) {
173
			for (File file : attachments) {
171
				helper.addAttachment(file.getName(), file);
174
				helper.addAttachment(file.getName(), file);
Line 299... Line 302...
299
 
302
 
300
	public static String getIconUrl(int entityId, String host, int port, String webapp) {
303
	public static String getIconUrl(int entityId, String host, int port, String webapp) {
301
		return "";
304
		return "";
302
	}
305
	}
303
 
306
 
304
 
-
 
305
	private static CatalogService.Client getCatalogClient() throws Exception {
307
	private static CatalogService.Client getCatalogClient() throws Exception {
306
		try {
308
		try {
307
			CatalogClient client = new CatalogClient();
309
			CatalogClient client = new CatalogClient();
308
			CatalogService.Client catalogClient = client.getClient();
310
			CatalogService.Client catalogClient = client.getClient();
309
			return catalogClient;
311
			return catalogClient;
Line 461... Line 463...
461
			String body, Map<? extends Serializable, File> map) throws Exception {
463
			String body, Map<? extends Serializable, File> map) throws Exception {
462
		MimeMessage message = mailSender.createMimeMessage();
464
		MimeMessage message = mailSender.createMimeMessage();
463
		MimeMessageHelper helper = new MimeMessageHelper(message, true);
465
		MimeMessageHelper helper = new MimeMessageHelper(message, true);
464
		helper.setSubject(subject);
466
		helper.setSubject(subject);
465
		Multipart mp = new MimeMultipart();
467
		Multipart mp = new MimeMultipart();
466
		
468
 
467
		MimeBodyPart messageBodyPart = new MimeBodyPart();
469
		MimeBodyPart messageBodyPart = new MimeBodyPart();
468
        messageBodyPart.setContent(body, "text/html");
470
		messageBodyPart.setContent(body, "text/html");
469
		mp.addBodyPart(messageBodyPart);
471
		mp.addBodyPart(messageBodyPart);
470
		
472
 
471
		// helper.setText(body, true);
473
		// helper.setText(body, true);
472
		if (cc != null) {
474
		if (cc != null) {
473
			helper.setCc(cc);
475
			helper.setCc(cc);
474
		}
476
		}
475
		helper.setTo(emailTo);
477
		helper.setTo(emailTo);
Line 487... Line 489...
487
		}
489
		}
488
		message.setContent(mp);
490
		message.setContent(mp);
489
		mailSender.send(message);
491
		mailSender.send(message);
490
 
492
 
491
	}
493
	}
492
	
494
 
493
	public String htmlJson(Object object) {
495
	public String htmlJson(Object object) {
494
		return StringEscapeUtils.escapeHtml4(gson.toJson(object));
496
		return StringEscapeUtils.escapeHtml4(gson.toJson(object));
495
	}
497
	}
496
	
-
 
497
 
498
 
498
	public static String getHyphenatedString(String s) {
499
	public static String getHyphenatedString(String s) {
499
		s = s.trim().replaceAll("\\s+", " ");
500
		s = s.trim().replaceAll("\\s+", " ");
500
		s = s.replaceAll("\\s", "-");
501
		s = s.replaceAll("\\s", "-");
501
		return s.toLowerCase();
502
		return s.toLowerCase();
502
	}
503
	}
503
	
504
 
504
	public static void sendMailWithAttachments(JavaMailSender mailSender, String[] emailTo, String[] cc, String subject,
505
	public static void sendMailWithAttachments(JavaMailSender mailSender, String[] emailTo, String[] cc, String subject,
505
			String body, Attachment... attachments) throws Exception {
506
			String body, Attachment... attachments) throws Exception {
506
		MimeMessage message = mailSender.createMimeMessage();
507
		MimeMessage message = mailSender.createMimeMessage();
507
		MimeMessageHelper helper = new MimeMessageHelper(message, true);
508
		MimeMessageHelper helper = new MimeMessageHelper(message, true);
508
		helper.setSubject(subject);
509
		helper.setSubject(subject);