List of usage examples for java.util Date setMinutes
@Deprecated public void setMinutes(int minutes)
From source file:com.dalamar.model.LateTrainDaoImpl.java
private Conjunction createDateCriterion(Date d) { d.setHours(0);// w ww . ja v a2 s . c o m d.setMinutes(0); d.setSeconds(0); Date beginDate = d; Date endDate = new Date(beginDate.getTime() + TimeUnit.DAYS.toMillis(1)); Conjunction andOperator = Restrictions.conjunction(); andOperator.add(Restrictions.ge("dateCaptured", beginDate)); andOperator.add(Restrictions.lt("dateCaptured", endDate)); return andOperator; }
From source file:v2.ClientTest.java
@Test public void testDatesLaptop() throws APIException { Laptop laptop = new Laptop(); laptop.setStatus(Laptop.TAGGED_S0);/* www . j a va 2 s . c o m*/ Date dateDelivered = new Date(); dateDelivered.setHours(12); dateDelivered.setMinutes(45); dateDelivered.setSeconds(10); dateDelivered.setMonth(3); dateDelivered.setYear(2012); laptop.setDateDelivered(dateDelivered); Date dateReceived = new Date(); dateReceived.setHours(1); dateReceived.setMinutes(41); dateReceived.setSeconds(10); dateReceived.setMonth(5); dateReceived.setYear(2012); laptop.setDateReceived(dateReceived); Date dateRecycled = new Date(); dateRecycled.setHours(1); dateRecycled.setMinutes(35); dateRecycled.setSeconds(10); dateRecycled.setMonth(4); dateRecycled.setYear(2012); laptop.setDateRecycled(dateRecycled); String nid = client.addLaptop(laptop); // Check date laptop // Laptop laptop = client.getLaptop(nid); // log.info(laptop); // log.info("Response test: "+nid); boolean result = client.deleteLaptop(nid); // log.info("It was deleted: "+result); Assert.assertTrue(result); }
From source file:com.dalamar.model.LateTrainDaoImpl.java
private Conjunction createDateCriterion(Date begin, Date end) { begin.setHours(0);// w w w . ja v a 2 s . com begin.setMinutes(0); begin.setSeconds(0); end.setHours(0); end.setMinutes(0); end.setSeconds(0); Date beginDate = begin; Date endDate = new Date(end.getTime() + TimeUnit.DAYS.toMillis(1)); Conjunction andOperator = Restrictions.conjunction(); andOperator.add(Restrictions.ge("dateCaptured", beginDate)); andOperator.add(Restrictions.lt("dateCaptured", endDate)); return andOperator; }
From source file:br.com.hslife.orcamento.task.AgendamentoTask.java
@Scheduled(fixedDelay = 3600000) @SuppressWarnings("deprecation") public void enviarEmailNotificacao() { try {//w w w. j a v a 2 s .c om Date inicio = new Date(); inicio.setHours(0); inicio.setMinutes(0); inicio.setSeconds(0); Date fim = new Date(inicio.getTime()); fim.setHours(23); fim.setMinutes(59); fim.setSeconds(59); List<Agenda> agendamentos = getService().buscarAgendamentoPorOuDataInicioOuDataFimEAlerta(inicio, fim, true); // Itera a lista de agendamentos encontrados, e para cada uma envia um e-mail para o usurio for (Agenda a : agendamentos) { // Se o usurio marcou para no receber notificao o e-mail no ser enviado if (getOpcaoSistemaComponent().getNotificarAgendamentosEmail(a.getUsuario())) { StringBuilder mensagemEmail = new StringBuilder(); mensagemEmail.append("Prezado " + a.getUsuario().getNome() + ",\n\n"); mensagemEmail.append("O seguinte agendamento foi marcado para notific-lo:\n\n"); mensagemEmail.append(a.getDescricao() + "\n"); mensagemEmail.append("Tipo: " + a.getTipoAgendamento() + "\n"); mensagemEmail.append("Perodo: \n" + a.getDateLabel() + "\n"); mensagemEmail.append("Dia inteiro: " + (a.isDiaInteiro() ? "SIM" : "NO") + "\n"); mensagemEmail.append("Notas: " + (a.getNotas() == null ? "-" : a.getNotas()) + "\n\n"); mensagemEmail.append( "Caso no queira mais receber notificaes a respeito desse evento, desmarque a caixa 'Emitir Alerta' nas propriedades do agendamento.\n\n\n"); mensagemEmail.append("Administrador do Sistema"); emailComponent.setDestinatario(a.getUsuario().getNome()); emailComponent.setEmailDestinatario(a.getUsuario().getEmail()); emailComponent.setAssunto("Oramento Domstico - Lembrete de agendamento"); emailComponent.setMensagem(mensagemEmail.toString()); emailComponent.enviarEmail(); } } } catch (Exception e) { logger.catching(e); e.printStackTrace(); } }
From source file:de.janrenz.app.mediathek.RemoteImageCursorAdapter.java
@SuppressWarnings("deprecation") @Override/*from www . ja v a 2 s . c o m*/ public void bindView(View v, Context context, Cursor c) { String title = c.getString(c.getColumnIndexOrThrow("title")); String subtitle = c.getString(c.getColumnIndexOrThrow("subtitle")); String imagePath = c.getString(c.getColumnIndexOrThrow("image")); String startTime = c.getString(c.getColumnIndexOrThrow("startTime")); String startTimeAsTimestamp = c.getString(c.getColumnIndex("startTimeAsTimestamp")); String isLive = c.getString(c.getColumnIndex("isLive")); if (this.layout == R.layout.headline_item_grid) { final View vl = v; v.findViewById(R.id.thumbnail).getViewTreeObserver() .addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() { @Override public void onGlobalLayout() { try { View imgView = vl.findViewById(R.id.thumbnail); imgView.getViewTreeObserver().removeGlobalOnLayoutListener(this); ViewGroup.LayoutParams layout = imgView.getLayoutParams(); layout.height = imgView.getWidth() / 16 * 9; imgView.setLayoutParams(layout); } catch (Exception e) { } } }); } /** * Next set the text of the entry. */ if (isLive.equalsIgnoreCase("true")) { v.findViewById(R.id.live).setVisibility(View.VISIBLE); //v.setBackgroundColor( context.getResources().getColor(R.color.highlight_live_list)); } else { v.findViewById(R.id.live).setVisibility(View.GONE); //v.setBackgroundColor( context.getResources().getColor(R.color.list_background)); } TextView title_text = (TextView) v.findViewById(R.id.text_view); if (title_text != null) { title_text.setText(title); } TextView subtitle_text = (TextView) v.findViewById(R.id.text_view_sub); if (subtitle_text != null) { subtitle_text.setText(subtitle); } TextView subtitle2_text = (TextView) v.findViewById(R.id.text_view_sub2); if (subtitle2_text != null) { Date dt = new Date(); // z.B. 'Fri Jan 26 19:03:56 GMT+01:00 2001' dt.setTime(Integer.parseInt(startTimeAsTimestamp) * 1000); dt.setHours(0); dt.setMinutes(0); dt.setSeconds(0); subtitle2_text.setText("ARD > " + startTime + " Uhr"); } /** * Set the image */ DisplayImageOptions loadingOptions = new DisplayImageOptions.Builder() ///.showStubImage(R.drawable.abs__item_background_holo_light) //.imageScaleType(ImageScaleType.EXACTLY) // .showImageForEmptyUri(R.drawable.ic_empty) // .memoryCache(new WeakMemoryCache()) .cacheInMemory() //.cacheOnDisc() .build(); ImageView image_view = (ImageView) v.findViewById(R.id.thumbnail); if (image_view != null) { if (this.layout == R.layout.headline_item_grid) { imagePath = imagePath + "/" + 320; } else { imagePath = imagePath + "/" + 150; } ImageLoader.getInstance().displayImage(imagePath, image_view, loadingOptions); } }
From source file:py.una.pol.karaku.test.test.DateUtilsTest.java
/** * Test method for/*from www . ja v a2s . c o m*/ * {@link py.una.pol.karaku.util.DateUtils#cloneDate(java.util.Date)}. */ @SuppressWarnings("deprecation") @Test public void testGetCopy() { Date date = new Date(); assertNotSame(date, cloneDate(date)); assertEquals(date, cloneDate(date)); Date copy = cloneDate(date); copy.setMinutes(copy.getMinutes() + 1); assertNotEquals(date, copy); }
From source file:org.benjp.portlet.chat.ChatApplication.java
@Ajax @Resource/*w w w.j av a 2s. c om*/ public Response.Content createTask(String username, String dueDate, String task) { SimpleDateFormat sdf = new SimpleDateFormat("MM/dd/yyyy HH:mm"); Date today = new Date(); today.setHours(0); today.setMinutes(0); try { calendarService_.saveTask(remoteUser_, username, task, today, sdf.parse(dueDate + " 23:59")); } catch (ParseException e) { log.info("parse exception during task creation"); return Response.notFound("Error during task creation"); } catch (Exception e) { log.info("exception during task creation"); return Response.notFound("Error during task creation"); } return Response.ok("{\"status\":\"ok\"}").withMimeType("application/json; charset=UTF-8") .withHeader("Cache-Control", "no-cache"); }
From source file:org.exoplatform.chat.portlet.chat.ChatApplication.java
@Ajax @Resource/*from www . j av a2 s . c o m*/ public Response.Content createTask(String username, String dueDate, String task) { SimpleDateFormat sdf = new SimpleDateFormat("MM/dd/yyyy HH:mm"); Date today = new Date(); today.setHours(0); today.setMinutes(0); try { calendarService_.saveTask(remoteUser_, username, task, today, sdf.parse(dueDate + " 23:59")); } catch (ParseException e) { LOG.info("parse exception during task creation"); return Response.notFound("Error during task creation"); } catch (Exception e) { LOG.info("exception during task creation"); return Response.notFound("Error during task creation"); } return Response.ok("{\"status\":\"ok\"}").withMimeType("application/json; charset=UTF-8") .withHeader("Cache-Control", "no-cache"); }
From source file:com.andco.salasucc.bean.nuevaBean.java
public String siguiente() { FacesContext context = FacesContext.getCurrentInstance(); horaInicio.setYear(fecha.getYear()); horaInicio.setMonth(fecha.getMonth()); horaInicio.setDate(fecha.getDate()); horaFin.setYear(fecha.getYear());/*from w w w . jav a 2s .c om*/ horaFin.setMonth(fecha.getMonth()); horaFin.setDate(fecha.getDate()); if ((horaFin.getTime() - horaInicio.getTime()) < 3600000) { FacesMessage errorMessage = new FacesMessage("Fecha Invalida"); errorMessage.setSeverity(FacesMessage.SEVERITY_ERROR); context.addMessage(null, errorMessage); horaFin = null; return null; } else { SalasJpaController salasCont = new SalasJpaController(); listaSalasDisponibles = new ArrayList<>(); if (!recurrente) { listaSalasDisponibles = salasCont.buscarSalasDisponibles(Integer.parseInt(numEstudiantes), Integer.parseInt(software), horaInicio, horaFin); } else { Date fechaFinSemestre = new Date(); fechaFinSemestre.setHours(23); fechaFinSemestre.setMinutes(59); if (fecha.getMonth() >= 1 && fecha.getMonth() <= 4) { fechaFinSemestre.setMonth(4); fechaFinSemestre.setDate(31); } else { fechaFinSemestre.setMonth(10); fechaFinSemestre.setDate(30); } listaFechasInicio = generaFechasRecurrentes(horaInicio, fechaFinSemestre); listaFechasFin = generaFechasRecurrentes(horaFin, fechaFinSemestre); HashMap<Salas, Integer> map = new HashMap<>(); int tam = listaFechasInicio.size(); for (int i = 0; i < tam; i++) { List<Salas> lSalas = salasCont.buscarSalasDisponibles(Integer.parseInt(numEstudiantes), Integer.parseInt(software), listaFechasInicio.get(i), listaFechasFin.get(i)); for (int j = 0; j < lSalas.size(); j++) { Salas salaActual = lSalas.get(j); Integer previousValue = map.get(salaActual); map.put(salaActual, previousValue == null ? 1 : previousValue + 1); } } for (Salas key : map.keySet()) { if (map.get(key) == tam) { listaSalasDisponibles.add(key); } } } if (listaSalasDisponibles.isEmpty()) { FacesMessage warnMessage = new FacesMessage("No hay salas disponibles"); warnMessage.setSeverity(FacesMessage.SEVERITY_WARN); context.addMessage(null, warnMessage); return null; } else { return "disponibles"; } } }
From source file:com.daphne.es.personal.calendar.web.controller.CalendarController.java
@RequestMapping("/load") @ResponseBody//from www. j a v a2s. com public Collection<Map> ajaxLoad(Searchable searchable, @CurrentUser User loginUser) { searchable.addSearchParam("userId_eq", loginUser.getId()); List<Calendar> calendarList = calendarService.findAllWithNoPageNoSort(searchable); return Lists.<Calendar, Map>transform(calendarList, new Function<Calendar, Map>() { @Override public Map apply(Calendar c) { Map<String, Object> m = Maps.newHashMap(); Date startDate = new Date(c.getStartDate().getTime()); Date endDate = DateUtils.addDays(startDate, c.getLength() - 1); boolean allDays = c.getStartTime() == null && c.getEndTime() == null; if (!allDays) { startDate.setHours(c.getStartTime().getHours()); startDate.setMinutes(c.getStartTime().getMinutes()); startDate.setSeconds(c.getStartTime().getSeconds()); endDate.setHours(c.getEndTime().getHours()); endDate.setMinutes(c.getEndTime().getMinutes()); endDate.setSeconds(c.getEndTime().getSeconds()); } m.put("id", c.getId()); m.put("start", DateFormatUtils.format(startDate, "yyyy-MM-dd HH:mm:ss")); m.put("end", DateFormatUtils.format(endDate, "yyyy-MM-dd HH:mm:ss")); m.put("allDay", allDays); m.put("title", c.getTitle()); m.put("details", c.getDetails()); if (StringUtils.isNotEmpty(c.getBackgroundColor())) { m.put("backgroundColor", c.getBackgroundColor()); m.put("borderColor", c.getBackgroundColor()); } if (StringUtils.isNotEmpty(c.getTextColor())) { m.put("textColor", c.getTextColor()); } return m; } }); }