Posts

Showing posts from February, 2014

Extracting/Reading the CSV file and TXT file and Writing the data into CSV file

Exacting the CSV file. String exactedFile = "D:\\Temp\\test.csv"; CSVReader csvReader = new CSVReader(new FileReader( exactedFile ));  // Reading the CSV file . String[] row = null; while((row = csvReader.readNext()) != null) { // Reading the individual line                                                            row[0] // printing the first cell.                                  row[1] // printing the second cell.                           } We need to add  opencsv-1.7.jar in the class path. import au.com.bytecode.opencsv.CSVReader; Reading the TXT file. final String file1 = "D:\\Temp\\creds.txt"; BufferedReader br = null; String sCurrentLine; try {              br = new BufferedReader(new FileReader(file1)); // Reading the TXT file . while ((sCurrentLine = br.readLine()) != null) { // Reading the individual line .                                  System.out.println("sCurrentLine"+sCurrentLine ); // Printi

Creating Scheduler in liferay - creating the scheduler dynamically based on the user inputs

As we know creating the static scheduler  is very easy as we  defined in the following url as    http://liferaytutorial.blogspot.com/2013/08/creating-scheduler-in-liferay.html Sometimes it may require to create dynamic schedule. Liferay had some created predefined class. Scheduling : In Messageboard portlet , Take a look at the MBMailingListLocalServiceImpl of  " protected void scheduleMailingList(MBMailingList mailingList) " method               Calendar startDate = CalendarFactoryUtil.getCalendar(); CronText cronText = new CronText(startDate, CronText.MINUTELY_FREQUENCY, mailingList.getInReadInterval()); Trigger trigger = new CronTrigger(groupName, groupName, startDate.getTime(), null, cronText.toString());                 SchedulerEngineUtil.schedule( trigger , StorageType.MEMORY_CLUSTERED, null, DestinationNames.MESSAGE_BOARDS_MAILING_LIST, mailingListRequest, 0); UnScheduling :     protected void unscheduleMailingList(MBMailingL

Creating tabs in liferay

In Liferay creating tab is very easy task. In our jsp , example as view.jsp <%@taglib uri="http://liferay.com/tld/ui" prefix="liferay-ui"%> <% String tabValue = ParamUtil.getString(request, " tab ", "help"); String tabsURL = "/html/jsp/" + tabValue.trim() + ".jsp"; String names = "HELP,PREVIEW,PRINT"; String tabsValues = "help,preview,print"; %>     <portlet:renderURL var="url" />     <liferay-ui:tabs names="<%=names%>" tabsValues="<%=tabsValues%>" param=" tab " url="${url}"  />     <c:import url="<%=tabsURL%>" /> Here " /html/jsp/ " is the folder of the jsps where it resides. You can give your own name. Here we have given param name as tab . so we are reterving the parameter value in tab. In your class no logic will reside as sample as below         @Over