This question is relating to iCal4j library integration with a Java (Spring) application.
Use case -
In my application, when a user creates an event from the UI, the invitees should receive a calendar invitation, which they can add to their personal calendar (Google calendar, Outlook calendar or even Thundarbird calendar) by simply clicking on the event. Also, the event organizer should receive a calendar invitation of the same event.
Concern -
While attendees receive the calendar invitation to the created event in the correct format (Google Calendar, Outlook and Thundarbird) via an email, the organizer receives an empty email with an attachment (invite.ics). Please note that this concern only raises in Gmail mail and Outlook mail clients. In Thunderbird, even the organizer receives a complete event request.
(Please refer the attached code snippet and images for further clarification).
Please let me know how to resolve this issue or any alternate libraries or solutions I can use to get this done.
Thanks in advance.
StringBuffer buffer = sb.append( "BEGIN:VCALENDAR\n" +
"PRODID:-//PROD_NAME//PROD_ORG//EN\n" +
"VERSION:2.0\n" +
"X-WR-RELCALID:"+calendarEmail.getxWrRelcalid()+"\n" +
"METHOD:REQUEST\n" +
"BEGIN:VEVENT\n" +
calendarEmail.getAttendeeString() +
calendarEmail.getOrganizerString() +
"DTSTART:" + calendarEmail.getDtStart() + "\n" +
calendarEmail.getRruleString() +
"DTEND:" + calendarEmail.getDtEnd() + "\n" +
"LOCATION:" + calendarEmail.getLocation() + "\n" +
"TRANSP:OPAQUE\n" +
"SEQUENCE:"+calendarEmail.getSequence()+"\n" +
"UID:" + calendarEmail.getUid() + "\n" +
"DTSTAMP:" + calendarEmail.getDtStamp() + "\n" +
"STATUS:"+calendarEmail.getEventStatusString()+"\n" +
"CATEGORIES:" + calendarEmail.getCategory() + "\n" +
"DESCRIPTION:" + calendarEmail.getDescription() + "\n" +
"SUMMARY:" + calendarEmail.getSummary() + "\n" +
"PRIORITY:5\n" +
"CLASS:" + calendarEmail.getPublicity() + "\n" +
"BEGIN:VALARM\n" +
"TRIGGER:" + calendarEmail.getAlarmTrigger() + "\n" +
"ACTION:" + calendarEmail.getAlarmAction() + "\n" +
"DESCRIPTION:Reminder\n" +
"END:VALARM\n" +
"END:VEVENT\n" +
"END:VCALENDAR" );
I think this is more a question of how the iCalendar specification works. Specifically you may want to look at:
https://www.rfc-editor.org/rfc/rfc5546#section-3.2.2
In your case your program is acting on behalf of the Organizer, so I'm not sure you can send a "REQUEST" to the Organizer user.
You probably need to send a "PUBLISH" method to the Organizer user:
https://www.rfc-editor.org/rfc/rfc5546#section-3.2.1
You may also want to consider the SENT-BY parameter on your Organizer property to indicate the Organizer user didn't send the request (unless you want REPLYs to go back to your program):
https://www.rfc-editor.org/rfc/rfc5545#section-3.2.18
Related
I am a new programmer in javafx.
Using java FX in IDE I want to make a student information application.
I want to print the input data into the text area but it prints out in the console now.
(After clicking display button I want to show all the input data in textarea)
please help me out to solve this problem.
I am attaching my code below for your suggestion..
Main.java
Just place
textArea.setText("Name: " + t1.getText() +"\nAddress: " + t2.getText()
+"\nProvince: " + t3.getText() +"\nCity: " + t4.getText()
+"\nPostal Code: " + t5.getText() +"\nPhone Number: " + t6.getText()
+"\nEmail: " + t7.getText() + "\nCourses: "+comboBox.getItems()
+ "\nActivities: "+c1.getText() + "\n"+c2.getText());
into the action handler.
And remove the imports
import javax.swing.JTextArea;
import java.awt.*;
They are not JavaFX.
You are printing your result into the standard output stream (System.out). I assume you want to display what is printed by:
System.out.println("Name: " + t1.getText() +"\nAddress: " + t2.getText()
+"\nProvince: " + t3.getText() +"\nCity: " + t4.getText()
+"\nPostal Code: " + t5.getText() +"\nPhone Number: " + t6.getText()
+"\nEmail: " + t7.getText() + "\nCourses: "+comboBox.getItems()
+ "\nActivities: "+c1.getText() + "\n"+c2.getText());
Please visit the documentation of the TextArea class. Printing your result into the standard output stream has nothing to do with printing your result in your TextArea. Simply use a normal String that contains your result and set the text of your TextArea accordingly.
I have this code fragment in my java class:
catch (AuthenticationFailedException afe) {
IlientConf.logger.error("[" + accountID + "," + emailConf.getIncomingUser() + "#" + emailConf.getIncomingMailServer() + "] " + "E-Mail " + protocol + encStr + " login failed on " + emailConf.getIncomingUser() + "#" + emailConf.getIncomingMailServer());
IlientConf.logger.error("[" + accountID + "," + emailConf.getIncomingUser() + "#" + emailConf.getIncomingMailServer() + "] " + afe.getMessage());
IlientConf.logger.debug("Email integration AuthenticationFailedException", afe);
return false;
}
IlientConf.logger is a log4j logger.
The actual log that is printed contains only the first line. This is it:
[someuser,sapunlock#someuser.com#outlook.office365.com] E-Mail pop3
(SSL) login failed on sapunlock#someuser.com#outlook.office365.com
The second and the third log statements are lost somehow.
I really need the stack trace of the error, but I can't get it.
No other related error is shown in the log.
Please help me understand what the reason for this is.
P.S.: Of course I can change the log statements to show this better, but this is deployed at a customers environment and needs to be solved before the next version.
I am using GWT java. I have a report on the client side that I want to export to csv. So I am trying to create the report on the server side to pass back to the client side as a csv file so the user can store the csv file in their selected destination.
The following code works on the client side; however, does not work on the server side (i.e., "Print 6." is displayed and "Print 7." is not displayed on the server side). There is no error message. The dates are "2016-11-09" and "2000-02-02".
System.out.println(todays_date);
System.out.println(pack.getDob());
System.out.println("Print 6.");
float diffDOB = (CalendarUtil.getDaysBetween(pack.getDob(), todays_date));
System.out.println("Print 7.");
I was talking about this with a fiend, who is not a programmer, and she said why not just send the MS Excel formula. Brilliant! So I have removed all the calclations and am now sending:
fileContent.append(pack.getSurname() + "," + pack.getFirstname() + "," + pack.getScout_no() + "," +
pack.getgroup() + "," + pack.getDob() + "," + '"' + "=ROUNDDOWN(((TODAY()-E"+row+")/365),1)" + '"' + "," +
pack.getstartDate() + "," + '"' + "=ROUNDDOWN(((TODAY()-G"+row+")/365),1)" + '"' + "," +
'"' + "=EDATE(E"+row+",216)" + '"' + "\n");
The only issue now is that spaces in the string fields appear as + in the output file.
I would want to send statistical information to my clients showing the number of transactions processed on every terminal or branch. I am using Apache Commons Email to send HTML emails.
I would like to send a pie-chart data like this one on the site.
My java code is basic extracted from.
It goes like:
public void testHtmlEmailPiechart()
throws UnsupportedEncodingException, EmailException, MalformedURLException {
HtmlEmail email = new HtmlEmail();
email.setHostName(emailServer);
email.setSmtpPort(587);
email.setSSLOnConnect(true);
email.setAuthentication(userName, password);
email.setCharset(emailEncoding);
email.addTo(receiver, "Mwesigye John Bosco");
email.setFrom(userName, "Enovate system emailing alert");
email.setSubject("Conkev aml Engine Statistics");
URL url = new URL("https://encrypted-tbn1.gstatic.com/images?q=tbn:ANd9GcROXe8tn1ljtctM53TkLJhLs6gEX56CvL0shvyq1V6wg7tXUDH8KRyVP30");
// URL url = new URL("http://www.apache.org/images/asf_logo_wide.gif");
String cid2 = email.embed(url, "logo.gif");
email.setHtmlMsg("<html>\n" +
" <head>\n" +
" <script type=\"text/javascript\" src=\"https://www.gstatic.com/charts/loader.js\"></script>\n" +
" <script type=\"text/javascript\">\n" +
" google.charts.load(\"current\", {packages:[\"corechart\"]});\n" +
" google.charts.setOnLoadCallback(drawChart);\n" +
" function drawChart() {\n" +
" var data = google.visualization.arrayToDataTable([\n" +
" ['Task', 'Hours per Day'],\n" +
" ['Work', 11],\n" +
" ['Eat', 2],\n" +
" ['Commute', 2],\n" +
" ['Watch TV', 2],\n" +
" ['Sleep', 7]\n" +
" ]);\n" +
"\n" +
" var options = {\n" +
" title: 'My Daily Activities',\n" +
" is3D: true,\n" +
" };\n" +
"\n" +
" var chart = new google.visualization.PieChart(document.getElementById('piechart_3d'));\n" +
" chart.draw(data, options);\n" +
" }\n" +
" </script>\n" +
" </head>\n" +
" <body>\n" +
" <div id=\"piechart_3d\" style=\"width: 900px; height: 500px;\">Piechart Data</div>\n" +
" </body>\n" +
"</html>");
email.setTextMsg("Your email client does not support HTML messages");
email.send();
}
My guess is that the JavaScript is not recognized because the code works like sending images,styling fonts and I have sent to my email address some sample mail. I would like your help or recommendation of any material I can read to achieve this as long as am using Java.The processes is automated running in the background so no user interface is involved.
Thanks.
Now a days Internet access is very costly.The provider used charges like hell.
We do not use unlimited plan for internet.That's why I would like to develop an that can facilities to calculate(manage) network package/data usage.
Suppose I have activated 5GB data plan.So I need to check before surfing net,upload/download things.
I know some Data provider provides these facility .I want to capture network data packets on my android device by my app. But How can I do that into my own code.
Any help will be appreciated.
Thank you advance
Please check that.
TextView infoView = (TextView)findViewById(R.id.traffic_info);
String info = "";
info += "Mobile Interface:\n";
info += ("\tReceived: " + TrafficStats.getMobileRxBytes() + " bytes / " + TrafficStats.getMobileRxPackets() + " packets\n");
info += ("\tTransmitted: " + TrafficStats.getMobileTxBytes() + " bytes / " + TrafficStats.getMobileTxPackets() + " packets\n");
info += "All Network Interface:\n";
info += ("\tReceived: " + TrafficStats.getTotalRxBytes() + " bytes / " + TrafficStats.getTotalRxPackets() + " packets\n");
info += ("\tTransmitted: " + TrafficStats.getTotalTxBytes() + " bytes / " + TrafficStats.getTotalTxPackets() + " packets\n");
infoView.setText(info);
Use TrafficStats class starting in APILevel 8.
You get overall usage per radio access technology and per app.
See http://developer.android.com/reference/android/net/TrafficStats.html
It's all static methods, for example call TrafficStats.getMobileRxBytes()