当前位置: 首页>>代码示例>>Java>>正文


Java DataTablesInput类代码示例

本文整理汇总了Java中org.springframework.data.jpa.datatables.mapping.DataTablesInput的典型用法代码示例。如果您正苦于以下问题:Java DataTablesInput类的具体用法?Java DataTablesInput怎么用?Java DataTablesInput使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


DataTablesInput类属于org.springframework.data.jpa.datatables.mapping包,在下文中一共展示了DataTablesInput类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getPageable

import org.springframework.data.jpa.datatables.mapping.DataTablesInput; //导入依赖的package包/类
/**
 * Creates a 'LIMIT .. OFFSET .. ORDER BY ..' clause for the given
 * {@link DataTablesInput}.
 * 
 * @param input
 *            the {@link DataTablesInput} mapped from the Ajax request
 * @return a {@link Pageable}, must not be {@literal null}.
 */
@Transactional
private Pageable getPageable(DataTablesInput input) {

	List<Order> orders = new ArrayList<Order>();
	for (OrderParameter order : input.getOrder()) {
		log.debug("order column: " + order.getColumn() + "");
		ColumnParameter column = input.getColumns().get(order.getColumn());
		if (column.getOrderable()) {
			String sortColumn = column.getData();
			Direction sortDirection = Direction.fromString(order.getDir());
			orders.add(new Order(sortDirection, sortColumn));
		}
	}
	Sort sort = orders.isEmpty() ? null : new Sort(orders);
	if (input.getLength() == -1) {
		input.setStart(0);
		input.setLength(Integer.MAX_VALUE);
	}

	return new PageRequest(input.getStart() / input.getLength(), input.getLength(), sort);
}
 
开发者ID:TransparencyInternationalEU,项目名称:lobbycal,代码行数:30,代码来源:CalendarDTRepositoryImpl.java

示例2: getDataTablesResidences

import org.springframework.data.jpa.datatables.mapping.DataTablesInput; //导入依赖的package包/类
@JsonView(DataTablesOutput.View.class)
@RequestMapping(value = "/datatables/residences", method = RequestMethod.GET)
public DataTablesOutput<Residence> getDataTablesResidences(@RequestParam(name = "client", required = false) Long id,
		@Valid DataTablesInput input) {
	if (id != null)
		return dtResidenceRepository.findAll(input, null, new ResidenceSpecification(id));
	else
		return dtResidenceRepository.findAll(input);
}
 
开发者ID:marcin-pwr,项目名称:hotel,代码行数:10,代码来源:ApiReceptionController.java

示例3: getBasicInput

import org.springframework.data.jpa.datatables.mapping.DataTablesInput; //导入依赖的package包/类
private static DataTablesInput getBasicInput() {
    DataTablesInput input = new DataTablesInput();
    input.addColumn("id", true, true, "");
    input.addColumn("firstName", true, true, "");
    input.addColumn("lastName", true, true, "");
    input.addColumn("fullName", false, true, "");
    input.addColumn("position", true, true, "");
    input.addColumn("age", true, true, "");
    input.addColumn("isWorkingRemotely", true, true, "");
    input.addColumn("comment", true, true, "");

    input.addColumn("action_column", false, false, "");

    input.addColumn("office.id", true, false, "");
    input.addColumn("office.city", true, true, "");
    input.addColumn("office.country", true, true, "");

    return input;
}
 
开发者ID:darrachequesne,项目名称:spring-data-jpa-datatables,代码行数:20,代码来源:EmployeeRepositoryTest.java

示例4: getDataTablesResidences

import org.springframework.data.jpa.datatables.mapping.DataTablesInput; //导入依赖的package包/类
@JsonView(DataTablesOutput.View.class)
@RequestMapping(value = "/datatables/residences", method = RequestMethod.GET)
public DataTablesOutput<Residence> getDataTablesResidences(@Valid DataTablesInput input) {
	DataTablesOutput<Residence> dataTablesOutput = dtResidenceRepository.findAll(input, null,
			new ResidenceSpecification(clientService.getClient().getId()));
	for (Residence residence : dataTablesOutput.getData()) {
		Double overallPriceCalc = residenceService.countOverallPrice(residence);
		residence.setOverallPriceCalc(overallPriceCalc);
	}
	return dataTablesOutput;
}
 
开发者ID:marcin-pwr,项目名称:hotel,代码行数:12,代码来源:ApiClientController.java

示例5: getAllForDatatable

import org.springframework.data.jpa.datatables.mapping.DataTablesInput; //导入依赖的package包/类
@RequestMapping(value = "/meetings/dt", method = RequestMethod.GET)
@Timed
@JsonView(DataTablesOutput.View.class)
@Transactional(readOnly = true)
public DataTablesOutput<MeetingDTO> getAllForDatatable(@Valid
DataTablesInput input) throws URISyntaxException {

	mepIds = "";
	userRepository.findAll().stream().forEach(user -> {
		mepIds += user.getId() + ",";
	});
	return getAllForDatatable(mepIds, input);
}
 
开发者ID:TransparencyInternationalEU,项目名称:lobbycal,代码行数:14,代码来源:MeetingResource.java

示例6: findAll

import org.springframework.data.jpa.datatables.mapping.DataTablesInput; //导入依赖的package包/类
@Override
@Transactional(readOnly = true)
public DataTablesOutput<T> findAll(DataTablesInput input) {

	log.info("");
	return findAll(input, null);
}
 
开发者ID:TransparencyInternationalEU,项目名称:lobbycal,代码行数:8,代码来源:CalendarDTRepositoryImpl.java

示例7: findAll

import org.springframework.data.jpa.datatables.mapping.DataTablesInput; //导入依赖的package包/类
@Override
public <R> DataTablesOutput<R> findAll(DataTablesInput input, Predicate additionalPredicate,
    Predicate preFilteringPredicate, Converter<T, R> converter) {
  DataTablesOutput<R> output = new DataTablesOutput<R>();
  output.setDraw(input.getDraw());
  if (input.getLength() == 0) {
    return output;
  }

  try {
    long recordsTotal = preFilteringPredicate == null ? count() : count(preFilteringPredicate);
    if (recordsTotal == 0) {
      return output;
    }
    output.setRecordsTotal(recordsTotal);

    PredicateBuilder predicateBuilder = new PredicateBuilder(this.builder, input);
    Page<T> data = findAll(
            new BooleanBuilder()
                .and(predicateBuilder.build())
                .and(additionalPredicate)
                .and(preFilteringPredicate).getValue(),
            predicateBuilder.createPageable());

    @SuppressWarnings("unchecked")
    List<R> content =
        converter == null ? (List<R>) data.getContent() : data.map(converter).getContent();
    output.setData(content);
    output.setRecordsFiltered(data.getTotalElements());

  } catch (Exception e) {
    output.setError(e.toString());
  }

  return output;
}
 
开发者ID:darrachequesne,项目名称:spring-data-jpa-datatables,代码行数:37,代码来源:QDataTablesRepositoryImpl.java

示例8: findAll

import org.springframework.data.jpa.datatables.mapping.DataTablesInput; //导入依赖的package包/类
@Override
public <R> DataTablesOutput<R> findAll(DataTablesInput input,
    Specification<T> additionalSpecification, Specification<T> preFilteringSpecification,
    Converter<T, R> converter) {
  DataTablesOutput<R> output = new DataTablesOutput<R>();
  output.setDraw(input.getDraw());
  if (input.getLength() == 0) {
    return output;
  }

  try {
    long recordsTotal =
        preFilteringSpecification == null ? count() : count(preFilteringSpecification);
    if (recordsTotal == 0) {
      return output;
    }
    output.setRecordsTotal(recordsTotal);

    SpecificationBuilder<T> specificationBuilder = new SpecificationBuilder<T>(input);
    Page<T> data = findAll(
            Specifications.where(specificationBuilder.build())
                    .and(additionalSpecification)
                    .and(preFilteringSpecification),
            specificationBuilder.createPageable());

    @SuppressWarnings("unchecked")
    List<R> content =
        converter == null ? (List<R>) data.getContent() : data.map(converter).getContent();
    output.setData(content);
    output.setRecordsFiltered(data.getTotalElements());

  } catch (Exception e) {
    output.setError(e.toString());
  }

  return output;
}
 
开发者ID:darrachequesne,项目名称:spring-data-jpa-datatables,代码行数:38,代码来源:DataTablesRepositoryImpl.java

示例9: AbstractPredicateBuilder

import org.springframework.data.jpa.datatables.mapping.DataTablesInput; //导入依赖的package包/类
AbstractPredicateBuilder(DataTablesInput input) {
    this.input = input;
    this.hasGlobalFilter = input.getSearch() != null && StringUtils.hasText(input.getSearch().getValue());
    if (this.hasGlobalFilter) {
        tree = new Node<Filter>(null, new GlobalFilter(input.getSearch().getValue()));
    } else {
        tree = new Node<Filter>(null);
    }
    initTree(input);
}
 
开发者ID:darrachequesne,项目名称:spring-data-jpa-datatables,代码行数:11,代码来源:AbstractPredicateBuilder.java

示例10: initTree

import org.springframework.data.jpa.datatables.mapping.DataTablesInput; //导入依赖的package包/类
private void initTree(DataTablesInput input) {
    for (Column column : input.getColumns()) {
        if (column.getSearchable()) {
            addChild(tree, 0, column.getData().split("\\."), column.getSearch());
        }
    }
}
 
开发者ID:darrachequesne,项目名称:spring-data-jpa-datatables,代码行数:8,代码来源:AbstractPredicateBuilder.java

示例11: getBasicInput

import org.springframework.data.jpa.datatables.mapping.DataTablesInput; //导入依赖的package包/类
private static DataTablesInput getBasicInput() {
    DataTablesInput input = new DataTablesInput();
    input.addColumn("name", true, true, "");
    input.addColumn("b.name", true, true, "");
    input.addColumn("b.value", true, true, "");
    input.addColumn("c.name", true, true, "");
    input.addColumn("c.value", true, true, "");
    input.addColumn("c.parent.name", true, true, "");
    input.addColumn("c.parent.value", true, true, "");
    input.addColumn("d.value", true, true, "");
    return input;
}
 
开发者ID:darrachequesne,项目名称:spring-data-jpa-datatables,代码行数:13,代码来源:RelationshipsRepositoryTest.java

示例12: getDataTablesClients

import org.springframework.data.jpa.datatables.mapping.DataTablesInput; //导入依赖的package包/类
@JsonView(DataTablesOutput.View.class)
@RequestMapping(value = "/datatables/clients", method = RequestMethod.GET)
public DataTablesOutput<Client> getDataTablesClients(@Valid DataTablesInput input) {
	return dtClientRepository.findAll(input);
}
 
开发者ID:marcin-pwr,项目名称:hotel,代码行数:6,代码来源:ApiReceptionController.java

示例13: getDataTablesResidences

import org.springframework.data.jpa.datatables.mapping.DataTablesInput; //导入依赖的package包/类
@JsonView(DataTablesOutput.View.class)
@RequestMapping(value = "/datatables/users", method = RequestMethod.GET)
public DataTablesOutput<User> getDataTablesResidences(@Valid DataTablesInput input) {
	return dtUserRepository.findAll(input);
}
 
开发者ID:marcin-pwr,项目名称:hotel,代码行数:6,代码来源:ApiOwnerController.java

示例14: findAllForOne

import org.springframework.data.jpa.datatables.mapping.DataTablesInput; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Override
@Transactional(readOnly = true)
public DataTablesOutput<T> findAllForOne(DataTablesInput input, Specification<T> additionalSpecification,
		boolean future) {
	log.info("find all for one mep, future?:" +future);
	DataTablesOutput<T> output = new DataTablesOutput<T>();
	output.setDraw(input.getDraw());

	try {
		output.setRecordsTotal(count());

		Page<T> data = null;
		if (future) {

			data = findAll(
					Specifications.where(new DataTablesSpecification<T>(input)).and(additionalSpecification)
							.or((Specification<T>) MeetingSpecifications
									.hasPartner(input.getSearch().getValue().toLowerCase(), null)).and(additionalSpecification)
							.or((Specification<T>) MeetingSpecifications
									.hasTag(input.getSearch().getValue().toLowerCase(), null)).and(additionalSpecification)
							.or((Specification<T>) MeetingSpecifications
									.hasUserName(input.getSearch().getValue().toLowerCase(), null)).and(additionalSpecification),
					getPageable(input));

		} else {
			data = findAll(Specifications.where(new DataTablesSpecification<T>(input)).and(additionalSpecification)
					.and((Specification<T>) MeetingSpecifications.past())

					.or((Specification<T>) MeetingSpecifications
							.hasPartner(input.getSearch().getValue().toLowerCase(), null))
					.and(additionalSpecification).and((Specification<T>) MeetingSpecifications.past())

					.or((Specification<T>) MeetingSpecifications.hasTag(input.getSearch().getValue().toLowerCase(),
							null))
					.and(additionalSpecification).and((Specification<T>) MeetingSpecifications.past())

					.or((Specification<T>) MeetingSpecifications
							.hasUserName(input.getSearch().getValue().toLowerCase(), null))
					.and(additionalSpecification).and((Specification<T>) MeetingSpecifications.past())

					, getPageable(input));
		}
		output.setData(data.getContent());
		output.setRecordsFiltered(data.getTotalElements());

	} catch (Exception e) {
		output.setError(e.toString());
		output.setRecordsFiltered(0L);
	}

	return output;
}
 
开发者ID:TransparencyInternationalEU,项目名称:lobbycal,代码行数:54,代码来源:CalendarDTRepositoryImpl.java

示例15: findAllForOne

import org.springframework.data.jpa.datatables.mapping.DataTablesInput; //导入依赖的package包/类
DataTablesOutput<Meeting> findAllForOne(DataTablesInput input, Specification<Meeting> additionalSpecification,
boolean future);
 
开发者ID:TransparencyInternationalEU,项目名称:lobbycal,代码行数:3,代码来源:MeetingDTRepository.java


注:本文中的org.springframework.data.jpa.datatables.mapping.DataTablesInput类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。