List of usage examples for java.util Calendar setTimeZone
public void setTimeZone(TimeZone value)
From source file:org.apache.oozie.coord.CoordELFunctions.java
/** * @param tm/* w w w. j av a2 s.c o m*/ * @return a new Evaluator to be used for URI-template evaluation */ private static ELEvaluator getUriEvaluator(Calendar tm) { tm.setTimeZone(DateUtils.getOozieProcessingTimeZone()); ELEvaluator retEval = new ELEvaluator(); retEval.setVariable("YEAR", tm.get(Calendar.YEAR)); retEval.setVariable("MONTH", (tm.get(Calendar.MONTH) + 1) < 10 ? "0" + (tm.get(Calendar.MONTH) + 1) : (tm.get(Calendar.MONTH) + 1)); retEval.setVariable("DAY", tm.get(Calendar.DAY_OF_MONTH) < 10 ? "0" + tm.get(Calendar.DAY_OF_MONTH) : tm.get(Calendar.DAY_OF_MONTH)); retEval.setVariable("HOUR", tm.get(Calendar.HOUR_OF_DAY) < 10 ? "0" + tm.get(Calendar.HOUR_OF_DAY) : tm.get(Calendar.HOUR_OF_DAY)); retEval.setVariable("MINUTE", tm.get(Calendar.MINUTE) < 10 ? "0" + tm.get(Calendar.MINUTE) : tm.get(Calendar.MINUTE)); return retEval; }
From source file:com.orange.oidc.tim.service.SDCardStorage.java
public String save_tokens(OpenidConnectParams ocp, String id_token, String refresh_token, String expires_in) { if (ocp != null) { int expires = 0; try {/* ww w . j a v a 2s . co m*/ expires = Integer.parseInt(expires_in); } catch (Exception e) { } Calendar cal = Calendar.getInstance(); cal.setTimeZone(TimeZone.getTimeZone("GMT")); long timems = cal.getTimeInMillis() + 1000 * expires; RequestTokens.save_tokens(ocp, id_token, refresh_token, "" + (timems / 1000), ocp.m_server_scope); return ""; } return null; }
From source file:info.magnolia.jcr.util.PropertyUtil.java
/** * Transforms a string to a jcr value object. *//* w w w.j ava 2s. c o m*/ public static Value createValue(String valueStr, int type, ValueFactory valueFactory) { Value value = null; if (type == PropertyType.STRING) { value = valueFactory.createValue(valueStr); } else if (type == PropertyType.BOOLEAN) { value = valueFactory.createValue(BooleanUtils.toBoolean(valueStr)); } else if (type == PropertyType.DOUBLE) { try { value = valueFactory.createValue(Double.parseDouble(valueStr)); } catch (NumberFormatException e) { value = valueFactory.createValue(0d); } } else if (type == PropertyType.LONG) { try { value = valueFactory.createValue(Long.parseLong(valueStr)); } catch (NumberFormatException e) { value = valueFactory.createValue(0L); } } else if (type == PropertyType.DATE) { try { Calendar date = new GregorianCalendar(); try { String newDateAndTime = valueStr; String[] dateAndTimeTokens = newDateAndTime.split("T"); String newDate = dateAndTimeTokens[0]; String[] dateTokens = newDate.split("-"); int hour = 0; int minute = 0; int second = 0; int year = Integer.parseInt(dateTokens[0]); int month = Integer.parseInt(dateTokens[1]) - 1; int day = Integer.parseInt(dateTokens[2]); if (dateAndTimeTokens.length > 1) { String newTime = dateAndTimeTokens[1]; String[] timeTokens = newTime.split(":"); hour = Integer.parseInt(timeTokens[0]); minute = Integer.parseInt(timeTokens[1]); second = Integer.parseInt(timeTokens[2]); } date.set(year, month, day, hour, minute, second); // this is used in the searching date.set(Calendar.MILLISECOND, 0); date.setTimeZone(TimeZone.getTimeZone("GMT")); } // todo time zone?? catch (Exception e) { // ignore, it sets the current date / time } value = valueFactory.createValue(date); } catch (Exception e) { log.debug("Exception caught: " + e.getMessage(), e); } } return value; }
From source file:kobytest.KobyTest.java
public static void pedir_historico(final int id_valor, String symbol, int weeks_ago) throws SQLException, ParseException { System.out.println("Requesting historic data for :" + id_valor); //0 weeks ago is this weekd Calendar cal = Calendar.getInstance(); int current_week = cal.get(Calendar.WEEK_OF_YEAR); int current_day = cal.get(Calendar.DAY_OF_MONTH); int current_month = cal.get(Calendar.MONTH) + 1; int current_year = cal.get(Calendar.YEAR); System.out.println("Current day is " + current_day); System.out.println("Current week is " + current_week); String year = "" + current_year; if (current_month == 1) current_month = 12;/* w w w . ja v a 2 s . co m*/ String month = "" + current_month; String day = "01"; for (int i = 0; i < weeks_ago; i++) { System.out.println("i = " + i + ". id_valor=" + id_valor + ". valorestabla[id_valor]" + valores_tabla.get(id_valor)); historico_valores.get(valores_tabla.get(id_valor)).put(i, null); } final Contract contract = new Contract(); //contract.m_comboLegs //contract.m_comboLegsDescrip //contract.m_conId = 11; contract.m_currency = "USD"; contract.m_exchange = "SMART"; //contract.m_expiry; contract.m_includeExpired = false; //contract.m_localSymbol = "KO"; //contract.m_multiplier; // contract.m_primaryExch = "NASDAQ"; // contract.m_right = "CALL"; //contract.m_secId; //contract.m_secIdType; contract.m_secType = "STK"; // stock String simbolo = valores_tabla.get(id_valor); contract.m_symbol = simbolo; // symbol //contract.m_tradingClass; //int id, Contract contract, String endDateTime, String durationStr, String barSizeSetting, String whatToShow, int useRTH, int formatDate, List<TagValue> chartOptions //TODO // -semana: buscar el fin de la semana. Calcular a partir de la semana // format yyyymmdd hh:mm:ss tmz, where the time zone is allowed (optionally) after a space at the end. Calendar cal_last_sunday = Calendar.getInstance(); // cal_last_sunday.set(Calendar.WEEK_OF_YEAR, current_week); cal_last_sunday.set(Calendar.WEEK_OF_YEAR, current_week - 1); cal_last_sunday.set(Calendar.DAY_OF_WEEK, Calendar.SUNDAY); // cal_last_sunday.set(Calendar.DAY_OF_WEEK, Calendar.FRIDAY); int last_sunday_day = cal_last_sunday.get(Calendar.DAY_OF_MONTH); int last_sunday_month = cal_last_sunday.get(Calendar.MONTH) + 1; // int last_sunday_month = cal_last_sunday.get(Calendar.MONTH); int last_sunday_year = cal_last_sunday.get(Calendar.YEAR); String last_sunday_year_str = String.valueOf(last_sunday_year); String last_sunday_month_str = String.valueOf(last_sunday_month); if (last_sunday_month < 10) { last_sunday_month_str = "0" + last_sunday_month_str; } String last_sunday_day_str = String.valueOf(last_sunday_day); if (last_sunday_day < 10) { last_sunday_day_str = "0" + last_sunday_day_str; } String semana = last_sunday_year_str + last_sunday_month_str + last_sunday_day_str + " 16:00:00 EST"; // de la primera semana String current_year_str = String.valueOf(current_year); String current_month_str = String.valueOf(current_month); if (current_month < 10) { current_month_str = "0" + current_month_str; } String current_day_str = String.valueOf(current_day); if (current_day < 10) { current_day_str = "0" + current_day_str; } Calendar c = Calendar.getInstance(); Calendar c1 = Calendar.getInstance(); c.add(Calendar.DATE, 0); SimpleDateFormat d = new SimpleDateFormat("yyyyMMdd"); Date date = c.getTime(); Date dateW = c1.getTime(); strSemana = d.format(date); strWeek = d.format(dateW); Calendar calendar = Calendar.getInstance(Locale.forLanguageTag("en-US")); calendar.setTimeZone(TimeZone.getTimeZone("America/New_York")); String hour = calendar.get(Calendar.HOUR_OF_DAY) + ":" + calendar.get(Calendar.MINUTE) + ":00"; //semana = current_year_str + current_month_str + current_day_str + " "+hour+" America/New_York";//EST semana = strSemana + " 09:00:00 EST"; final String semanaTimer = semana; System.out.println("Requestion values for " + strSemana); final String duracion = 1 + " D"; // pedimos todas las semanas final String duracionTimer = 1 + " D"; // pedimos todas las semanas final String barSizeSetting = "1 day"; final String whatToShow = "TRADES"; final int useRTH = 1; //only data that falls within regular trading hours. final int formatDate = 1;//1 - dates applying to bars returned in the format:yyyymmdd{space}{space}hh:mm:dd 2 - dates are returned as a long integer specifying the number of seconds since 1/1/1970 GMT. // List chartOptions = null; final Vector chartOptions = new Vector(); symbol_current = symbol; String fecha = current_year + "-" + current_month + "-" + current_day; // ResultSet exsiste = DDBB.lowHighFecha(fecha); // ResultSet exsisteTicker = DDBB.lowHighFechaName(fecha, symbol);d? count++; HistoricalDataReq historial = new HistoricalDataReq(); peticionesHistorical[count].id = id_valor; peticionesHistorical[count].contract = contract; peticionesHistorical[count].endDateTime = semana; peticionesHistorical[count].durationStr = duracion; peticionesHistorical[count].barSizeSetting = barSizeSetting; peticionesHistorical[count].whatToShow = whatToShow; peticionesHistorical[count].useRTH = useRTH; peticionesHistorical[count].formatDate = formatDate; peticionesHistorical[count].chartOptions = chartOptions; peticionesHistorical[count].ticker = symbol; // peticionesHistorical[count] = historial; System.out.println("--------------------------------------------------------------------------------------" + historial.id + " " + symbol); // connection.reqHistoricalData(id_valor, contract, semanaTimer, duracion, barSizeSetting, whatToShow, useRTH, formatDate, chartOptions); // try { // // Thread t = new Thread(new Runnable() { // // @Override // public void run() { // int num = 1000; // ResultSet dat = DDBB.TickersAll(); // try { // Thread.sleep((int)(Math.random()*((16000*num)-1000+1)+1000)); // } catch (InterruptedException ex) { // Logger.getLogger(KobyTest.class.getName()).log(Level.SEVERE, null, ex); // } // // try { // if(dat.next())num=dat.getInt("id"); // } catch (SQLException ex) { // Logger.getLogger(KobyTest.class.getName()).log(Level.SEVERE, null, ex); // } // Timer timer = new Timer ((int)(Math.random()*((16000*num)-1000+1)+1000), new ActionListener () { // public void actionPerformed(ActionEvent e) // { // connection.reqHistoricalData(id_valor, contract, semanaTimer, duracionTimer, barSizeSetting, whatToShow, useRTH, formatDate, chartOptions); // } // }); // timer.start(); // // } // }); // t.start(); // // } catch (Exception ex) { // Logger.getLogger(Semaforo.class.getName()).log(Level.SEVERE, null, ex); // } // id_ant = id_valor; // connection.reqHistoricalData(id_valor, contract, semana, "300 S", "1 secs", whatToShow, useRTH, formatDate, chartOptions); // if(!exsiste.next()){ System.out.println("eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee"); // DDBB.deleteLowHigh(); // connection.reqHistoricalData(id_valor, contract, semana, duracion, barSizeSetting, whatToShow, useRTH, formatDate, chartOptions); // }else if(newTicker){ // System.out.println("iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii"); // connection.reqHistoricalData(id_valor, contract, semana, duracion, barSizeSetting, whatToShow, useRTH, formatDate, chartOptions); // newTicker = false; // }else if(!exsisteTicker.next()){ // System.out.println("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"); // connection.reqHistoricalData(id_valor, contract, semana, duracion, barSizeSetting, whatToShow, useRTH, formatDate, chartOptions); // newTicker = false; // } }
From source file:ch.algotrader.service.CalendarServiceImpl.java
/** * takes year, month & day from date * and takes hour_of_day, minute, second & millisecond from time * and takes the specified timeZone// w ww. ja v a 2s . c o m */ private Date getDateTime(final TimeZone timeZone, final Date date, final Date time) { Calendar dateCal = Calendar.getInstance(); dateCal.setTime(date); Calendar timeCal = Calendar.getInstance(); timeCal.setTime(time); dateCal.setTimeZone(timeZone); dateCal.set(Calendar.HOUR_OF_DAY, timeCal.get(Calendar.HOUR_OF_DAY)); dateCal.set(Calendar.MINUTE, timeCal.get(Calendar.MINUTE)); dateCal.set(Calendar.SECOND, timeCal.get(Calendar.SECOND)); dateCal.set(Calendar.MILLISECOND, timeCal.get(Calendar.MILLISECOND)); return dateCal.getTime(); }
From source file:osh.busdriver.MieleGatewayBusDriver.java
@Override public void run() { while (true) { synchronized (mieleGatewayDispatcher) { try { // wait for new data mieleGatewayDispatcher.wait(); } catch (InterruptedException e) { getGlobalLogger().logError("should not happen", e); break; }/*from w w w. j a va 2 s .com*/ long timestamp = getTimer().getUnixTime(); if (mieleGatewayDispatcher.getDeviceData().isEmpty()) { // an error has occurred for (UUID uuid : deviceProperties.keySet()) { BusDeviceStatusDetails bs = new BusDeviceStatusDetails(uuid, timestamp); bs.setState(ConnectionStatus.ERROR); getDriverRegistry().setStateOfSender(BusDeviceStatusDetails.class, bs); } } for (MieleDeviceHomeBusData dev : mieleGatewayDispatcher.getDeviceData()) { // build UUID long uuidHigh = UUIDGenerationHelper.getMieleUUIDHigherPart(dev.getUid()); long uuidLow; try { uuidLow = UUIDGenerationHelper.getHomeApplianceUUIDLowerPart((short) dev.getDeviceClass(), mieleGatewayAddr); } catch (Exception e) { getGlobalLogger().logError("should not happen: UUID generation failed", e); continue; } final UUID devUUID = new UUID(uuidHigh, uuidLow); // register UUID as command receiver to the registry if (!deviceProperties.containsKey(devUUID)) { // device already known? IEventReceiver eventReceiver = new IEventReceiver() { @Override public Object getSyncObject() { return MieleGatewayBusDriver.this; } @Override public void onQueueEventReceived(EventExchange event) throws OSHException { MieleGatewayBusDriver.this.onQueueEventReceived(event); } @Override public UUID getUUID() { return devUUID; } }; // register device try { getDriverRegistry().register(StartDeviceRequest.class, eventReceiver); getDriverRegistry().register(StopDeviceRequest.class, eventReceiver); getDriverRegistry().register(SwitchRequest.class, eventReceiver); deviceProperties.put(devUUID, new HashMap<String, String>()); } catch (OSHException e) { // nop. happens. getGlobalLogger().logError("should not happen", e); } } // check if all data is available BusDeviceStatusDetails bs = new BusDeviceStatusDetails(devUUID, timestamp); if (dev.getDeviceDetails() == null) { bs.setState(ConnectionStatus.ERROR); getDriverRegistry().setStateOfSender(BusDeviceStatusDetails.class, bs); continue; } else { bs.setState(ConnectionStatus.ATTACHED); getDriverRegistry().setStateOfSender(BusDeviceStatusDetails.class, bs); } // create program details GenericApplianceProgramDriverDetails programdetails = new GenericApplianceProgramDriverDetails( devUUID, timestamp); programdetails.setLoadProfiles(null); programdetails.setProgramName(dev.getDeviceDetails().getProgramName()); programdetails.setPhaseName(dev.getDeviceDetails().getPhaseName()); // create Miele specific details // duration MieleApplianceDriverDetails mieledetails = new MieleApplianceDriverDetails(devUUID, timestamp); if (dev.getDuration() != null) mieledetails.setExpectedProgramDuration(dev.getDuration().duration() * 60); else mieledetails.setExpectedProgramDuration(-1); // remaining time if (dev.getRemainingTime() != null) mieledetails.setProgramRemainingTime(dev.getRemainingTime().duration() * 60); else mieledetails.setProgramRemainingTime(-1); // start time if (dev.getStartTime() != null) { Calendar cal = Calendar.getInstance(); long nowInMillies = getTimer().getUnixTime() * 1000L; cal.setTimeInMillis(nowInMillies); cal.setTimeZone(getTimer().getHostTimeZone()); cal.set(Calendar.HOUR_OF_DAY, dev.getStartTime().hour()); cal.set(Calendar.MINUTE, dev.getStartTime().minute()); cal.set(Calendar.SECOND, 0); if (cal.getTimeInMillis() <= nowInMillies) cal.add(Calendar.DAY_OF_YEAR, 1); mieledetails.setStartTime(cal.getTimeInMillis() / 1000L); } else mieledetails.setStartTime(-1); // set state of the UUID try { getDriverRegistry().setStateOfSender(GenericApplianceDriverDetails.class, createApplianceDetails(devUUID, timestamp, dev)); getDriverRegistry().setStateOfSender(StartTimeDetails.class, createStartTimeDetails(devUUID, timestamp, dev)); getDriverRegistry().setStateOfSender(GenericApplianceProgramDriverDetails.class, programdetails); getDriverRegistry().setStateOfSender(MieleApplianceDriverDetails.class, mieledetails); } catch (OSHException e1) { bs.setState(ConnectionStatus.ERROR); getDriverRegistry().setStateOfSender(BusDeviceStatusDetails.class, bs); getGlobalLogger().logError(e1); } // extract additional information for invoking commands String detailsUrl = dev.getDetailsUrl(); // extract type and id from details url if (detailsUrl != null) { Map<String, String> devProps = deviceProperties.get(devUUID); try { URIBuilder uri = new URIBuilder(detailsUrl); for (NameValuePair pair : uri.getQueryParams()) { if ("type".equals(pair.getName()) || "id".equals(pair.getName())) { devProps.put(pair.getName(), pair.getValue()); } } } catch (URISyntaxException e) { // nop. shit happens. getGlobalLogger().logError("should not happen", e); } } } } } }
From source file:com.ebay.pulsar.analytics.resources.PulsarQueryResource.java
@POST @Path("today") @Consumes(MediaType.APPLICATION_JSON)/*from w w w . j a v a 2 s .co m*/ @Produces(MediaType.APPLICATION_JSON) public Response today(@Context HttpServletRequest request, CoreRequest req) { if (logger.isDebugEnabled()) { logger.debug("Today API called from IP: " + request.getRemoteAddr()); } req.setNamespace(RequestNameSpace.today); req.setGranularity("fifteen_minute"); Calendar c = Calendar.getInstance(); long msEnd = c.getTimeInMillis(); c.setTimeZone(TimeZone.getTimeZone("MST")); c.set(Calendar.HOUR_OF_DAY, 0); c.set(Calendar.MINUTE, 0); c.set(Calendar.SECOND, 0); c.set(Calendar.MILLISECOND, 0); long msStart = c.getTimeInMillis(); long msDiff = msEnd - msStart; if (msDiff < 0) { msStart = msStart - 86400000; msDiff = msDiff + 86400000; } if (msDiff < MS_15MINS) { // If the now time is 00:00:00 - 00:14:59 (Round to 0), let's do no // rounding. if (msDiff < 1000) { // If we really have the exact 00:00:00 time, let's just add 1 // sec for end time. msEnd = msStart + 1000; } else { msEnd = msStart + msDiff; } } else { long msOffset = msDiff / MS_15MINS * MS_15MINS; // normalize to 0, // 15, 30, 45min of // each hour msEnd = msStart + msOffset; } Date end = new Date(msEnd); Date start = new Date(msStart); DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss", Locale.US); dateFormat.setTimeZone(TimeZone.getTimeZone("MST")); req.setStartTime(dateFormat.format(start)); req.setEndTime(dateFormat.format(end)); boolean trace = request.getParameter("debug") == null ? false : true; return processRequest(req, trace); }
From source file:lucee.commons.io.res.type.ftp.FTPResource.java
@Override public boolean setLastModified(long time) { //if(isRoot()) return false; FTPResourceClient client = null;/*from www .jav a 2s .c om*/ try { provider.lock(this); client = provider.getClient(data); PageContext pc = ThreadLocalPageContext.get(); Calendar c = JREDateTimeUtil.getThreadCalendar(); if (pc != null) c.setTimeZone(pc.getTimeZone()); c.setTimeInMillis(time); FTPFile file = client.getFTPFile(this); if (file == null) return false; file.setTimestamp(c); client.unregisterFTPFile(this); return true; } catch (IOException e) { } finally { provider.returnClient(client); provider.unlock(this); } return false; }
From source file:ch.dbs.actions.reports.ILVReport.java
private Map<String, Object> reportCharite(final IlvReportForm ilvf, final UserInfo ui) { final Map<String, Object> result = new HashMap<String, Object>(); final ThreadSafeSimpleDateFormat tf = new ThreadSafeSimpleDateFormat("dd.MM.yyyy"); tf.setTimeZone(TimeZone.getTimeZone(ui.getKonto().getTimezone())); final Calendar cal = new GregorianCalendar(); cal.setTimeZone(TimeZone.getTimeZone(ui.getKonto().getTimezone())); // fill in labels result.put("reporttitle", ilvf.getReporttitle() + " " + tf.format(cal.getTime(), ui.getKonto().getTimezone())); result.put("labelfrom", ilvf.getLabelfrom()); result.put("labelto", ilvf.getLabelto()); result.put("labelsignatur", ilvf.getLabelsignatur()); result.put("labeljournaltitel", ilvf.getLabeljournaltitel()); result.put("labelcustomer", ilvf.getLabelcustomer()); result.put("labelname", ilvf.getLabelname()); result.put("labelissn", ilvf.getLabelissn()); result.put("labelpmid", ilvf.getLabelpmid()); result.put("labelyear", ilvf.getLabelyear()); result.put("labelvolumevintage", ilvf.getLabelvolumevintage()); result.put("labelbooklet", ilvf.getLabelbooklet()); result.put("labelclinicinstitutedepartment", ilvf.getLabelclinicinstitutedepartment()); result.put("labelphone", ilvf.getLabelphone()); result.put("labelfax", ilvf.getLabelfax()); result.put("labelsendto", ilvf.getLabelsendto()); result.put("labelpages", ilvf.getLabelpages()); result.put("labelauthorofessay", ilvf.getLabelauthorofessay()); result.put("labeltitleofessay", ilvf.getLabeltitleofessay()); result.put("labelendorsementsofdeliveringlibrary", ilvf.getLabelendorsementsofdeliveringlibrary()); result.put("labelnotesfromrequestinglibrary", ilvf.getLabelnotesfromrequestinglibrary()); // fill in values if (ui.getKonto().getIsil() != null) { result.put("isil", ui.getKonto().getIsil()); } else {/*from w w w .ja v a2 s . co m*/ result.put("isil", ""); } result.put("from", ui.getKonto().getBibliotheksname()); // cannot be null result.put("to", ilvf.getLieferant()); result.put("signatur", ilvf.getSignatur()); result.put("journaltitel", ilvf.getJournaltitel()); result.put("name", ilvf.getName()); result.put("issn", ilvf.getIssn()); result.put("pmid", ilvf.getPmid()); result.put("year", ilvf.getYear()); result.put("volumevintage", ilvf.getVolumevintage()); result.put("booklet", ilvf.getBooklet()); result.put("phone", ilvf.getPhone()); if (ui.getKonto().getTelefon() != null) { result.put("phonekonto", ui.getKonto().getTelefon()); } else { result.put("phonekonto", ""); } if (ui.getKonto().getFax_extern() != null) { result.put("fax", ui.getKonto().getFax_extern()); } else { result.put("fax", ""); } result.put("adresse", ilvf.getPost()); result.put("clinicinstitutedepartment", ilvf.getClinicinstitutedepartment()); result.put("pages", ilvf.getPages()); result.put("authorofessay", ilvf.getAuthorofessay()); result.put("titleofessay", ilvf.getTitleofessay()); result.put("notesfromrequestinglibrary", ilvf.getNotesfromrequestinglibrary()); result.put("footer", "Brought to you by " + ReadSystemConfigurations.getApplicationName() + ": " + ReadSystemConfigurations.getServerWelcomepage()); return result; }
From source file:ch.dbs.actions.reports.ILVReport.java
private Map<String, Object> reportMainz(final IlvReportForm ilvf, final UserInfo ui) { final Map<String, Object> result = new HashMap<String, Object>(); final ThreadSafeSimpleDateFormat tf = new ThreadSafeSimpleDateFormat("dd.MM.yyyy"); tf.setTimeZone(TimeZone.getTimeZone(ui.getKonto().getTimezone())); final Calendar cal = new GregorianCalendar(); cal.setTimeZone(TimeZone.getTimeZone(ui.getKonto().getTimezone())); // fill in labels result.put("reporttitle", ilvf.getReporttitle() + " " + tf.format(cal.getTime(), ui.getKonto().getTimezone())); result.put("labelfrom", ilvf.getLabelfrom()); result.put("labelto", ilvf.getLabelto()); result.put("labelsignatur", ilvf.getLabelsignatur()); result.put("labeljournaltitel", ilvf.getLabeljournaltitel()); result.put("labelcustomer", ilvf.getLabelcustomer()); result.put("labelname", ilvf.getLabelname()); result.put("labellibrarycard", ilvf.getLabellibrarycard()); result.put("labelissn", ilvf.getLabelissn()); result.put("labelpmid", ilvf.getLabelpmid()); result.put("labelyear", ilvf.getLabelyear()); result.put("labelvolumevintage", ilvf.getLabelvolumevintage()); result.put("labelbooklet", ilvf.getLabelbooklet()); result.put("labelclinicinstitutedepartment", ilvf.getLabelclinicinstitutedepartment()); result.put("labelphone", ilvf.getLabelphone()); result.put("labelfax", ilvf.getLabelfax()); result.put("labelsendto", ilvf.getLabelsendto()); result.put("labelpages", ilvf.getLabelpages()); result.put("labelauthorofessay", ilvf.getLabelauthorofessay()); result.put("labeltitleofessay", ilvf.getLabeltitleofessay()); result.put("labelendorsementsofdeliveringlibrary", ilvf.getLabelendorsementsofdeliveringlibrary()); result.put("labelnotesfromrequestinglibrary", ilvf.getLabelnotesfromrequestinglibrary()); // fill in values if (ui.getKonto().getIsil() != null) { result.put("isil", ui.getKonto().getIsil()); } else {/*from w ww .j a v a 2 s . c om*/ result.put("isil", ""); } result.put("from", ui.getKonto().getBibliotheksname()); // cannot be null result.put("to", ilvf.getLieferant()); result.put("signatur", ilvf.getSignatur()); result.put("journaltitel", ilvf.getJournaltitel()); result.put("name", ilvf.getName()); result.put("issn", ilvf.getIssn()); result.put("pmid", ilvf.getPmid()); result.put("librarycard", ilvf.getLibrarycard()); result.put("year", ilvf.getYear()); result.put("volumevintage", ilvf.getVolumevintage()); result.put("booklet", ilvf.getBooklet()); result.put("phone", ilvf.getPhone()); if (ui.getKonto().getTelefon() != null) { result.put("phonekonto", ui.getKonto().getTelefon()); } else { result.put("phonekonto", ""); } if (ui.getKonto().getFax_extern() != null) { result.put("fax", ui.getKonto().getFax_extern()); } else { result.put("fax", ""); } result.put("adresse", ilvf.getPost()); result.put("clinicinstitutedepartment", ilvf.getClinicinstitutedepartment()); result.put("pages", ilvf.getPages()); result.put("authorofessay", ilvf.getAuthorofessay()); result.put("titleofessay", ilvf.getTitleofessay()); result.put("notesfromrequestinglibrary", ilvf.getNotesfromrequestinglibrary()); result.put("footer", "Brought to you by " + ReadSystemConfigurations.getApplicationName() + ": " + ReadSystemConfigurations.getServerWelcomepage()); return result; }