本文整理匯總了Java中ch.ralscha.extdirectspring.bean.ExtDirectStoreResult類的典型用法代碼示例。如果您正苦於以下問題:Java ExtDirectStoreResult類的具體用法?Java ExtDirectStoreResult怎麽用?Java ExtDirectStoreResult使用的例子?那麽恭喜您, 這裏精選的類代碼示例或許可以為您提供幫助。
ExtDirectStoreResult類屬於ch.ralscha.extdirectspring.bean包,在下文中一共展示了ExtDirectStoreResult類的14個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於我們的係統推薦出更棒的Java代碼示例。
示例1: read
點讚 3
import ch.ralscha.extdirectspring.bean.ExtDirectStoreResult; //導入依賴的package包/類
@ExtDirectMethod(STORE_READ)
@Transactional(readOnly = true)
public ExtDirectStoreResult read(ExtDirectStoreReadRequest request) {
JPQLQuery query = this.jpaQueryFactory.selectFrom(QUser.user);
if (!request.getFilters().isEmpty()) {
StringFilter filter = (StringFilter) request.getFilters().iterator().next();
BooleanBuilder bb = new BooleanBuilder();
bb.or(QUser.user.loginName.containsIgnoreCase(filter.getValue()));
bb.or(QUser.user.lastName.containsIgnoreCase(filter.getValue()));
bb.or(QUser.user.firstName.containsIgnoreCase(filter.getValue()));
bb.or(QUser.user.email.containsIgnoreCase(filter.getValue()));
query.where(bb);
}
query.where(QUser.user.deleted.isFalse());
QuerydslUtil.addPagingAndSorting(query, request, User.class, QUser.user);
QueryResults searchResult = query.fetchResults();
return new ExtDirectStoreResult<>(searchResult.getTotal(),
searchResult.getResults());
}
開發者ID:ralscha,項目名稱:eds-starter6-jpa,代碼行數:25,
示例2: read
點讚 2
import ch.ralscha.extdirectspring.bean.ExtDirectStoreResult; //導入依賴的package包/類
@ExtDirectMethod(STORE_READ)
public ExtDirectStoreResult read(ExtDirectStoreReadRequest readRequest) {
StringFilter nameFilter = readRequest.getFirstFilterForField("name");
StringFilter departmentFilter = readRequest.getFirstFilterForField("department");
String name = null;
if (nameFilter != null) {
name = nameFilter.getValue();
}
String department = null;
if (departmentFilter != null) {
department = departmentFilter.getValue();
}
Page pageResult;
Pageable pageRequest = RepositoryUtil.createPageable(readRequest);
if (StringUtils.hasText(name) && !StringUtils.hasText(department)) {
pageResult = this.userRepository
.findByFirstNameStartsWithIgnoreCaseOrLastNameStartsWithIgnoreCaseOrEmailStartsWithIgnoreCase(
name, name, name, pageRequest);
}
else if (!StringUtils.hasText(name) && StringUtils.hasText(department)) {
pageResult = this.userRepository.findByDepartment(department, pageRequest);
}
else if (StringUtils.hasText(name) && StringUtils.hasText(department)) {
pageResult = this.userRepository.findByNameAndDepartment("^" + name,
department, pageRequest);
}
else {
pageResult = this.userRepository.findAll(pageRequest);
}
return new ExtDirectStoreResult<>(pageResult.getTotalElements(),
pageResult.getContent());
}
開發者ID:ralscha,項目名稱:eds-starter6-simple-mongodb,代碼行數:39,
示例3: read
點讚 2
import ch.ralscha.extdirectspring.bean.ExtDirectStoreResult; //導入依賴的package包/類
@ExtDirectMethod(STORE_READ)
public ExtDirectStoreResult read(ExtDirectStoreReadRequest readRequest) {
StringFilter nameFilter = readRequest.getFirstFilterForField("name");
StringFilter departmentFilter = readRequest.getFirstFilterForField("department");
String name = null;
if (nameFilter != null) {
name = nameFilter.getValue();
}
String department = null;
if (departmentFilter != null) {
department = departmentFilter.getValue();
}
Page pageResult;
Pageable pageRequest = RepositoryUtil.createPageable(readRequest);
if (StringUtils.hasText(name) && !StringUtils.hasText(department)) {
pageResult = this.userRepository
.findByFirstNameStartsWithIgnoreCaseOrLastNameStartsWithIgnoreCaseOrEmailStartsWithIgnoreCase(
name, name, name, pageRequest);
}
else if (!StringUtils.hasText(name) && StringUtils.hasText(department)) {
pageResult = this.userRepository.findByDepartment(department, pageRequest);
}
else if (StringUtils.hasText(name) && StringUtils.hasText(department)) {
pageResult = this.userRepository.findByNameAndDepartment(name + "%",
department, pageRequest);
}
else {
pageResult = this.userRepository.findAll(pageRequest);
}
return new ExtDirectStoreResult<>(pageResult.getTotalElements(),
pageResult.getContent());
}
開發者ID:ralscha,項目名稱:eds-starter6-simple-jpa,代碼行數:39,
示例4: readSettings
點讚 2
import ch.ralscha.extdirectspring.bean.ExtDirectStoreResult; //導入依賴的package包/類
@ExtDirectMethod(STORE_READ)
@Transactional(readOnly = true)
public ExtDirectStoreResult readSettings(
@AuthenticationPrincipal JpaUserDetails jpaUserDetails) {
UserSettings userSettings = new UserSettings(
jpaUserDetails.getUser(this.jpaQueryFactory));
return new ExtDirectStoreResult<>(userSettings);
}
開發者ID:ralscha,項目名稱:eds-starter6-jpa,代碼行數:9,
示例5: destroy
點讚 2
import ch.ralscha.extdirectspring.bean.ExtDirectStoreResult; //導入依賴的package包/類
@ExtDirectMethod(STORE_MODIFY)
@Transactional
public ExtDirectStoreResult destroy(User destroyUser) {
ExtDirectStoreResult result = new ExtDirectStoreResult<>();
if (!isLastAdmin(destroyUser.getId())) {
User user = this.jpaQueryFactory.getEntityManager().find(User.class,
destroyUser.getId());
this.jpaQueryFactory.getEntityManager().remove(user);
result.setSuccess(Boolean.TRUE);
}
else {
result.setSuccess(Boolean.FALSE);
}
return result;
}
開發者ID:ralscha,項目名稱:eds-starter6-jpa,代碼行數:16,
示例6: destroy
點讚 2
import ch.ralscha.extdirectspring.bean.ExtDirectStoreResult; //導入依賴的package包/類
@ExtDirectMethod(STORE_MODIFY)
@Transactional
public ExtDirectStoreResult destroy(Long id) {
T dbEntity = this.entityManager.find(getTypeClass(), id);
this.entityManager.remove(dbEntity);
ExtDirectStoreResult result = new ExtDirectStoreResult<>();
result.setSuccess(Boolean.TRUE);
return result;
}
開發者ID:khun777,項目名稱:edsutil,代碼行數:11,
示例7: read
點讚 2
import ch.ralscha.extdirectspring.bean.ExtDirectStoreResult; //導入依賴的package包/類
@ExtDirectMethod(STORE_READ)
public ExtDirectStoreResult read(ExtDirectStoreReadRequest request) {
List andFilters = new ArrayList<>();
StringFilter filter = request.getFirstFilterForField("filter");
if (filter != null) {
List orFilters = new ArrayList<>();
orFilters.add(Filters.regex(CUser.loginName, filter.getValue(), "i"));
orFilters.add(Filters.regex(CUser.lastName, filter.getValue(), "i"));
orFilters.add(Filters.regex(CUser.firstName, filter.getValue(), "i"));
orFilters.add(Filters.regex(CUser.email, filter.getValue(), "i"));
andFilters.add(Filters.or(orFilters));
}
andFilters.add(Filters.eq(CUser.deleted, false));
long total = this.mongoDb.getCollection(User.class)
.count(Filters.and(andFilters));
FindIterable find = this.mongoDb.getCollection(User.class)
.find(Filters.and(andFilters));
find.sort(Sorts.orderBy(QueryUtil.getSorts(request)));
find.skip(request.getStart());
find.limit(request.getLimit());
return new ExtDirectStoreResult<>(total, QueryUtil.toList(find));
}
開發者ID:ralscha,項目名稱:eds-starter6-mongodb,代碼行數:28,
示例8: destroy
點讚 2
import ch.ralscha.extdirectspring.bean.ExtDirectStoreResult; //導入依賴的package包/類
@ExtDirectMethod(STORE_MODIFY)
public ExtDirectStoreResult destroy(User destroyUser) {
ExtDirectStoreResult result = new ExtDirectStoreResult<>();
if (!isLastAdmin(destroyUser.getId())) {
this.mongoDb.getCollection(User.class)
.deleteOne(Filters.eq(CUser.id, destroyUser.getId()));
result.setSuccess(Boolean.TRUE);
deletePersistentLogins(destroyUser.getId());
}
else {
result.setSuccess(Boolean.FALSE);
}
return result;
}
開發者ID:ralscha,項目名稱:eds-starter6-mongodb,代碼行數:16,
示例9: read
點讚 2
import ch.ralscha.extdirectspring.bean.ExtDirectStoreResult; //導入依賴的package包/類
@ExtDirectMethod(STORE_READ)
public ExtDirectStoreResult read(ExtDirectStoreReadRequest readRequest) {
Filter nameFilter = readRequest.getFirstFilterForField("name");
Filter categoryFilter = readRequest.getFirstFilterForField("category");
String name = null;
String category = null;
if (nameFilter != null) {
name = ((StringFilter) nameFilter).getValue();
}
if (categoryFilter != null) {
category = ((StringFilter) categoryFilter).getValue();
}
BooleanBuilder bb = new BooleanBuilder();
if (name != null && StringUtils.hasText(name)) {
bb.and(QCustomer.customer.firstName.containsIgnoreCase(name)
.or(QCustomer.customer.lastName.containsIgnoreCase(name)));
}
if (category != null && StringUtils.hasText(category) && !"All".equals(category)) {
bb.and(QCustomer.customer.category.eq(Category.valueOf(category)));
}
Pageable pageable = RepositoryUtil.createPageable(readRequest);
Page page = this.customerRepository.findAll(bb, pageable);
return new ExtDirectStoreResult<>(page.getTotalElements(), page.getContent());
}
開發者ID:ralscha,項目名稱:mycustomer,代碼行數:30,
示例10: create
點讚 2
import ch.ralscha.extdirectspring.bean.ExtDirectStoreResult; //導入依賴的package包/類
@ExtDirectMethod(STORE_MODIFY)
public ExtDirectStoreResult create(User newUser) {
newUser.setId(null);
User insertedUser = this.userRepository.save(newUser);
return new ExtDirectStoreResult<>(insertedUser);
}
開發者ID:ralscha,項目名稱:eds-starter6-simple-mongodb,代碼行數:7,
示例11: update
點讚 2
import ch.ralscha.extdirectspring.bean.ExtDirectStoreResult; //導入依賴的package包/類
@ExtDirectMethod(STORE_MODIFY)
public ExtDirectStoreResult update(User changedUser) {
User updatedUser = this.userRepository.save(changedUser);
return new ExtDirectStoreResult<>(updatedUser);
}
開發者ID:ralscha,項目名稱:eds-starter6-simple-mongodb,代碼行數:6,
示例12: create
點讚 2
import ch.ralscha.extdirectspring.bean.ExtDirectStoreResult; //導入依賴的package包/類
@ExtDirectMethod(STORE_MODIFY)
public ExtDirectStoreResult create(User newUser) {
User insertedUser = this.userRepository.save(newUser);
return new ExtDirectStoreResult<>(insertedUser);
}
開發者ID:ralscha,項目名稱:eds-starter6-simple-jpa,代碼行數:6,
示例13: read
點讚 2
import ch.ralscha.extdirectspring.bean.ExtDirectStoreResult; //導入依賴的package包/類
@ExtDirectMethod(STORE_READ)
@Transactional(readOnly = true)
public ExtDirectStoreResult read(ExtDirectStoreReadRequest request) {
PathBuilder pathBuilder = createPathBuilder();
JPQLQuery query = new JPAQuery(this.entityManager).from(pathBuilder);
addPagingAndSorting(request, query, pathBuilder);
if (!request.getFilters().isEmpty()) {
for (Filter filter : request.getFilters()) {
if (filter instanceof NumericFilter) {
NumericFilter nf = (NumericFilter) filter;
int pointPos = nf.getField().indexOf('.');
if (pointPos == -1) {
query.where(pathBuilder.get(nf.getField(), Long.class).eq(
nf.getValue().longValue()));
}
else {
String property = nf.getField().substring(0, pointPos);
String field = nf.getField().substring(pointPos + 1);
query.where(pathBuilder.get(property).get(field, Long.class)
.eq(nf.getValue().longValue()));
}
}
else if (filter instanceof StringFilter && filter.getField().equals("id")) {
String value = ((StringFilter) filter).getValue();
try {
List ids = this.objectMapper.readValue(value,
new TypeReference>() {
// nothing here
});
query.where(pathBuilder.get(filter.getField(), Long.class)
.in(ids));
}
catch (IOException e) {
// ignore this for now
e.printStackTrace();
}
}
}
}
SearchResults result = query.listResults(pathBuilder);
return new ExtDirectStoreResult<>(result.getTotal(), result.getResults());
}
開發者ID:khun777,項目名稱:edsutil,代碼行數:47,
示例14: readSettings
點讚 2
import ch.ralscha.extdirectspring.bean.ExtDirectStoreResult; //導入依賴的package包/類
@ExtDirectMethod(STORE_READ)
public ExtDirectStoreResult readSettings(
@AuthenticationPrincipal MongoUserDetails userDetails) {
UserSettings userSettings = new UserSettings(userDetails.getUser(this.mongoDb));
return new ExtDirectStoreResult<>(userSettings);
}
開發者ID:ralscha,項目名稱:eds-starter6-mongodb,代碼行數:7,
注:本文中的ch.ralscha.extdirectspring.bean.ExtDirectStoreResult類示例整理自Github/MSDocs等源碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。