Java Code Examples for org.springframework.format.annotation.DateTimeFormat.ISO#DATE_TIME

The following examples show how to use org.springframework.format.annotation.DateTimeFormat.ISO#DATE_TIME . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: EventController.java    From sos with Apache License 2.0 6 votes vote down vote up
@GetMapping("events")
HttpEntity<Resources<?>> events(PagedResourcesAssembler<AbstractEvent<?>> assembler,
		@SortDefault("publicationDate") Pageable pageable,
		@RequestParam(required = false) @DateTimeFormat(iso = ISO.DATE_TIME) LocalDateTime since,
		@RequestParam(required = false) String type) {

	QAbstractEvent $ = QAbstractEvent.abstractEvent;

	BooleanBuilder builder = new BooleanBuilder();

	// Apply date
	Optional.ofNullable(since).ifPresent(it -> builder.and($.publicationDate.after(it)));

	// Apply type
	Optional.ofNullable(type) //
			.flatMap(events::findEventTypeByName) //
			.ifPresent(it -> builder.and($.instanceOf(it)));

	Page<AbstractEvent<?>> result = events.findAll(builder, pageable);

	PagedResources<Resource<AbstractEvent<?>>> resource = assembler.toResource(result, event -> toResource(event));
	resource
			.add(links.linkTo(methodOn(EventController.class).events(assembler, pageable, since, type)).withRel("events"));

	return ResponseEntity.ok(resource);
}
 
Example 2
Source File: AbstractAnnotationSearchController.java    From elucidate-server with MIT License 6 votes vote down vote up
@RequestMapping(value = REQUEST_PATH_TEMPORAL, method = RequestMethod.GET)
public ResponseEntity<?> getSearchTemporal(@RequestParam(value = URLConstants.PARAM_LEVELS, required = true) List<String> levels, @RequestParam(value = URLConstants.PARAM_TYPES, required = true) List<String> types, @RequestParam(value = URLConstants.PARAM_SINCE, required = true) @DateTimeFormat(iso = ISO.DATE_TIME) Date since, @RequestParam(value = URLConstants.PARAM_PAGE, required = false) Integer page, @RequestParam(value = URLConstants.PARAM_IRIS, required = false, defaultValue = "false") boolean iris, @RequestParam(value = URLConstants.PARAM_DESC, required = false, defaultValue = "false") boolean descriptions, HttpServletRequest request) {
    if (page == null) {

        AnnotationCollectionSearch<C> annotationCollectionSearch = (ClientPreference clientPref) -> annotationCollectionSearchService.searchAnnotationCollectionByTemporal(levels, types, since, clientPref);

        return processCollectionSearchRequest(annotationCollectionSearch, request);
    } else {
        AnnotationPageSearch<P> annotationPageSearch = (boolean embeddedDescriptions) -> {

            ServiceResponse<List<A>> serviceResponse = annotationSearchService.searchAnnotationsByTemporal(levels, types, since);
            Status status = serviceResponse.getStatus();

            if (!status.equals(Status.OK)) {
                return new ServiceResponse<P>(status, null);
            }

            List<A> annotations = serviceResponse.getObj();

            return annotationPageSearchService.buildAnnotationPageByTemporal(annotations, levels, types, since, page, embeddedDescriptions);
        };

        return processPageSearchRequest(annotationPageSearch, iris, descriptions);
    }
}
 
Example 3
Source File: InstantFilter.java    From jhipster with Apache License 2.0 5 votes vote down vote up
/** {@inheritDoc} */
@Override
@DateTimeFormat(iso = ISO.DATE_TIME)
public InstantFilter setGreaterThanOrEqual(Instant equals) {
    super.setGreaterThanOrEqual(equals);
    return this;
}
 
Example 4
Source File: InstantFilter.java    From jhipster with Apache License 2.0 5 votes vote down vote up
/** {@inheritDoc} */
@Override
@DateTimeFormat(iso = ISO.DATE_TIME)
public InstantFilter setGreaterThan(Instant equals) {
    super.setGreaterThan(equals);
    return this;
}
 
Example 5
Source File: InstantFilter.java    From jhipster with Apache License 2.0 5 votes vote down vote up
/** {@inheritDoc} */
@Override
@DateTimeFormat(iso = ISO.DATE_TIME)
public InstantFilter setNotIn(List<Instant> notIn) {
    super.setNotIn(notIn);
    return this;
}
 
Example 6
Source File: InstantFilter.java    From jhipster with Apache License 2.0 5 votes vote down vote up
/** {@inheritDoc} */
@Override
@DateTimeFormat(iso = ISO.DATE_TIME)
public InstantFilter setIn(List<Instant> in) {
    super.setIn(in);
    return this;
}
 
Example 7
Source File: InstantFilter.java    From jhipster with Apache License 2.0 5 votes vote down vote up
/** {@inheritDoc} */
@Override
@DateTimeFormat(iso = ISO.DATE_TIME)
@Deprecated
public InstantFilter setLessOrEqualThan(Instant equals) {
    super.setLessOrEqualThan(equals);
    return this;
}
 
Example 8
Source File: InstantFilter.java    From jhipster with Apache License 2.0 5 votes vote down vote up
/** {@inheritDoc} */
@Override
@DateTimeFormat(iso = ISO.DATE_TIME)
public InstantFilter setEquals(Instant equals) {
    super.setEquals(equals);
    return this;
}
 
Example 9
Source File: InstantFilter.java    From jhipster with Apache License 2.0 5 votes vote down vote up
/** {@inheritDoc} */
@Override
@DateTimeFormat(iso = ISO.DATE_TIME)
public InstantFilter setLessThan(Instant equals) {
    super.setLessThan(equals);
    return this;
}
 
Example 10
Source File: ZonedDateTimeFilter.java    From jhipster with Apache License 2.0 5 votes vote down vote up
/** {@inheritDoc} */
@Override
@DateTimeFormat(iso = ISO.DATE_TIME)
public ZonedDateTimeFilter setLessThanOrEqual(ZonedDateTime equals) {
    super.setLessThanOrEqual(equals);
    return this;
}
 
Example 11
Source File: InstantFilter.java    From jhipster with Apache License 2.0 5 votes vote down vote up
/** {@inheritDoc} */
@Override
@DateTimeFormat(iso = ISO.DATE_TIME)
@Deprecated
public InstantFilter setGreaterOrEqualThan(Instant equals) {
    super.setGreaterOrEqualThan(equals);
    return this;
}
 
Example 12
Source File: ZonedDateTimeFilter.java    From jhipster with Apache License 2.0 5 votes vote down vote up
/** {@inheritDoc} */
@Override
@DateTimeFormat(iso = ISO.DATE_TIME)
public ZonedDateTimeFilter setGreaterThanOrEqual(ZonedDateTime equals) {
    super.setGreaterThanOrEqual(equals);
    return this;
}
 
Example 13
Source File: PerformanceController.java    From WeBASE-Node-Manager with Apache License 2.0 5 votes vote down vote up
/**
 * get ratio of performance.
 */
@GetMapping(value = "/ratio/{frontId}")
public BaseResponse getPerformanceRatio(@PathVariable("frontId") Integer frontId,
    @RequestParam("beginDate") @DateTimeFormat(iso = ISO.DATE_TIME) LocalDateTime beginDate,
    @RequestParam("endDate") @DateTimeFormat(iso = ISO.DATE_TIME) LocalDateTime endDate,
    @RequestParam(value = "contrastBeginDate", required = false)
    @DateTimeFormat(iso = ISO.DATE_TIME) LocalDateTime contrastBeginDate,
    @RequestParam(value = "contrastEndDate", required = false)
    @DateTimeFormat(iso = ISO.DATE_TIME) LocalDateTime contrastEndDate,
    @RequestParam(value = "gap", required = false, defaultValue = "1") int gap)
    throws NodeMgrException {
    Instant startTime = Instant.now();
    BaseResponse response = new BaseResponse(ConstantCode.SUCCESS);
    log.info(
        "start getPerformanceRatio. startTime:{} frontId:{} beginDate:{}"
            + " endDate:{} contrastBeginDate:{} contrastEndDate:{} gap:{}",
        startTime.toEpochMilli(), frontId, beginDate, endDate, contrastBeginDate,
        contrastEndDate, gap);

    Object rspObj = performanceService
        .getPerformanceRatio(frontId, beginDate, endDate, contrastBeginDate, contrastEndDate,
            gap);
    response.setData(rspObj);
    log.info("end getPerformanceRatio. useTime:{} response:{}",
        Duration.between(startTime, Instant.now()).toMillis(), JsonTools.toJSONString(response));

    return response;
}
 
Example 14
Source File: ZonedDateTimeFilter.java    From jhipster with Apache License 2.0 5 votes vote down vote up
/** {@inheritDoc} */
@Override
@DateTimeFormat(iso = ISO.DATE_TIME)
public ZonedDateTimeFilter setGreaterThan(ZonedDateTime equals) {
    super.setGreaterThan(equals);
    return this;
}
 
Example 15
Source File: ZonedDateTimeFilter.java    From jhipster with Apache License 2.0 5 votes vote down vote up
/** {@inheritDoc} */
@Override
@DateTimeFormat(iso = ISO.DATE_TIME)
public ZonedDateTimeFilter setNotIn(List<ZonedDateTime> notIn) {
    super.setNotIn(notIn);
    return this;
}
 
Example 16
Source File: ZonedDateTimeFilter.java    From jhipster with Apache License 2.0 5 votes vote down vote up
/** {@inheritDoc} */
@Override
@DateTimeFormat(iso = ISO.DATE_TIME)
public ZonedDateTimeFilter setIn(List<ZonedDateTime> in) {
    super.setIn(in);
    return this;
}
 
Example 17
Source File: ZonedDateTimeFilter.java    From jhipster with Apache License 2.0 5 votes vote down vote up
/** {@inheritDoc} */
@Override
@DateTimeFormat(iso = ISO.DATE_TIME)
public ZonedDateTimeFilter setNotEquals(ZonedDateTime equals) {
    super.setNotEquals(equals);
    return this;
}
 
Example 18
Source File: ZonedDateTimeFilter.java    From jhipster with Apache License 2.0 5 votes vote down vote up
/** {@inheritDoc} */
@Override
@DateTimeFormat(iso = ISO.DATE_TIME)
public ZonedDateTimeFilter setEquals(ZonedDateTime equals) {
    super.setEquals(equals);
    return this;
}
 
Example 19
Source File: LocalDateFilter.java    From jhipster with Apache License 2.0 5 votes vote down vote up
/** {@inheritDoc} */
@Override
@DateTimeFormat(iso = ISO.DATE_TIME)
@Deprecated
public LocalDateFilter setLessOrEqualThan(LocalDate equals) {
    super.setLessOrEqualThan(equals);
    return this;
}
 
Example 20
Source File: InstantFilter.java    From jhipster with Apache License 2.0 5 votes vote down vote up
/** {@inheritDoc} */
@Override
@DateTimeFormat(iso = ISO.DATE_TIME)
public InstantFilter setLessThanOrEqual(Instant equals) {
    super.setLessThanOrEqual(equals);
    return this;
}