本文整理汇总了Java中ch.ralscha.extdirectspring.annotation.ExtDirectMethod类的典型用法代码示例。如果您正苦于以下问题:Java ExtDirectMethod类的具体用法?Java ExtDirectMethod怎么用?Java ExtDirectMethod使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ExtDirectMethod类属于ch.ralscha.extdirectspring.annotation包,在下文中一共展示了ExtDirectMethod类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: resetRequest
import ch.ralscha.extdirectspring.annotation.ExtDirectMethod; //导入依赖的package包/类
@ExtDirectMethod(ExtDirectMethodType.FORM_POST)
public ExtDirectFormPostResult resetRequest(
@RequestParam("email") String emailOrLoginName) {
String token = UUID.randomUUID().toString();
User user = this.mongoDb.getCollection(User.class).findOneAndUpdate(
Filters.and(
Filters.or(Filters.eq(CUser.email, emailOrLoginName),
Filters.eq(CUser.loginName, emailOrLoginName)),
Filters.eq(CUser.deleted, false)),
Updates.combine(
Updates.set(CUser.passwordResetTokenValidUntil,
Date.from(ZonedDateTime.now(ZoneOffset.UTC).plusHours(4)
.toInstant())),
Updates.set(CUser.passwordResetToken, token)),
new FindOneAndUpdateOptions().returnDocument(ReturnDocument.AFTER)
.upsert(false));
if (user != null) {
this.mailService.sendPasswortResetEmail(user);
}
return new ExtDirectFormPostResult();
}
开发者ID:ralscha,项目名称:eds-starter6-mongodb,代码行数:26,代码来源:SecurityService.java
示例2: getTree
import ch.ralscha.extdirectspring.annotation.ExtDirectMethod; //导入依赖的package包/类
@ExtDirectMethod(TREE_LOAD)
public List<Node> getTree(String node) {
if ("root".equals(node) || !StringUtils.hasText(node)) {
List<Node> children = this.departmentRepository
.findAll(new Sort(Direction.ASC, "name")).stream()
.map(d -> new Node(d.getName(), d.getName(), false, false, null))
.collect(Collectors.toList());
Node root = new Node("Company", "Company", false, true, children);
return Collections.singletonList(root);
}
return this.userRepository.findByDepartmentOrderByLastNameAsc(node).stream()
.map(u -> {
return new Node(u.getId().toString(),
u.getLastName() + " " + u.getFirstName(), true, false, null);
}).collect(Collectors.toList());
}
开发者ID:ralscha,项目名称:eds-starter6-simple-mongodb,代码行数:22,代码来源:TreeLoadService.java
示例3: handleFormSubmit
import ch.ralscha.extdirectspring.annotation.ExtDirectMethod; //导入依赖的package包/类
@ExtDirectMethod(FORM_POST)
public ExtDirectFormPostResult handleFormSubmit(FormBean bean,
MultipartFile screenshot) {
String resultString = "Server received: \n" + bean.toString() + "\n";
if (!screenshot.isEmpty()) {
resultString += "ContentType: " + screenshot.getContentType() + "\n";
resultString += "Size: " + screenshot.getSize() + "\n";
resultString += "Name: " + screenshot.getOriginalFilename();
}
ExtDirectFormPostResult result = new ExtDirectFormPostResult();
result.addResultProperty("response", resultString);
return result;
}
开发者ID:ralscha,项目名称:eds-starter6-simple-mongodb,代码行数:17,代码来源:FormSubmitService.java
示例4: logClientCrash
import ch.ralscha.extdirectspring.annotation.ExtDirectMethod; //导入依赖的package包/类
@ExtDirectMethod
@Async
public void logClientCrash(@RequestHeader(value = HttpHeaders.USER_AGENT,
required = false) String userAgent, Map<String, Object> crashData) {
StringBuilder sb = new StringBuilder();
sb.append("JavaScript Error");
sb.append(lineSeparator);
sb.append("User-Agent: " + userAgent);
crashData.forEach((k, v) -> {
sb.append(lineSeparator);
sb.append(k);
sb.append(": ");
sb.append(v);
});
Application.logger.error(sb.toString());
}
开发者ID:ralscha,项目名称:eds-starter6-jpa,代码行数:19,代码来源:LogService.java
示例5: readPersistentLogins
import ch.ralscha.extdirectspring.annotation.ExtDirectMethod; //导入依赖的package包/类
@ExtDirectMethod(STORE_READ)
@Transactional(readOnly = true)
public List<PersistentLogin> readPersistentLogins(
@AuthenticationPrincipal JpaUserDetails jpaUserDetails) {
List<PersistentLogin> persistentLogins = this.jpaQueryFactory
.selectFrom(QPersistentLogin.persistentLogin)
.where(QPersistentLogin.persistentLogin.user.id
.eq(jpaUserDetails.getUserDbId()))
.fetch();
persistentLogins.forEach(p -> {
String ua = p.getUserAgent();
if (StringUtils.hasText(ua)) {
UserAgent userAgent = UserAgent.parseUserAgentString(ua);
p.setUserAgentName(userAgent.getBrowser().getGroup().getName());
p.setUserAgentVersion(userAgent.getBrowserVersion().getMajorVersion());
p.setOperatingSystem(userAgent.getOperatingSystem().getName());
}
});
return persistentLogins;
}
开发者ID:ralscha,项目名称:eds-starter6-jpa,代码行数:23,代码来源:UserConfigService.java
示例6: read
import ch.ralscha.extdirectspring.annotation.ExtDirectMethod; //导入依赖的package包/类
@ExtDirectMethod(STORE_READ)
@Transactional(readOnly = true)
public ExtDirectStoreResult<User> read(ExtDirectStoreReadRequest request) {
JPQLQuery<User> 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<User> searchResult = query.fetchResults();
return new ExtDirectStoreResult<>(searchResult.getTotal(),
searchResult.getResults());
}
开发者ID:ralscha,项目名称:eds-starter6-jpa,代码行数:25,代码来源:UserService.java
示例7: getAuthUser
import ch.ralscha.extdirectspring.annotation.ExtDirectMethod; //导入依赖的package包/类
@ExtDirectMethod
@Transactional
public UserDetailDto getAuthUser(
@AuthenticationPrincipal JpaUserDetails jpaUserDetails) {
if (jpaUserDetails != null) {
User user = jpaUserDetails.getUser(this.jpaQueryFactory);
UserDetailDto userDetailDto = new UserDetailDto(jpaUserDetails, user, null);
if (!jpaUserDetails.isPreAuth()) {
user.setLastAccess(ZonedDateTime.now(ZoneOffset.UTC));
}
return userDetailDto;
}
return null;
}
开发者ID:ralscha,项目名称:eds-starter6-jpa,代码行数:19,代码来源:SecurityService.java
示例8: switchUser
import ch.ralscha.extdirectspring.annotation.ExtDirectMethod; //导入依赖的package包/类
@ExtDirectMethod
@RequireAdminAuthority
@Transactional(readOnly = true)
public UserDetailDto switchUser(Long userId) {
User switchToUser = this.jpaQueryFactory.getEntityManager().find(User.class,
userId);
if (switchToUser != null) {
JpaUserDetails principal = new JpaUserDetails(switchToUser);
UsernamePasswordAuthenticationToken token = new UsernamePasswordAuthenticationToken(
principal, null, principal.getAuthorities());
SecurityContextHolder.getContext().setAuthentication(token);
return new UserDetailDto(principal, switchToUser, null);
}
return null;
}
开发者ID:ralscha,项目名称:eds-starter6-jpa,代码行数:20,代码来源:SecurityService.java
示例9: create
import ch.ralscha.extdirectspring.annotation.ExtDirectMethod; //导入依赖的package包/类
@ExtDirectMethod(STORE_MODIFY)
@Transactional
public ExtDirectStoreValidationResult<T> create(T newEntity) {
preModify(newEntity);
List<ValidationError> violations = validateEntity(newEntity);
if (violations.isEmpty()) {
this.entityManager.persist(newEntity);
return new ExtDirectStoreValidationResult<>(newEntity);
}
ExtDirectStoreValidationResult<T> result = new ExtDirectStoreValidationResult<>(
newEntity);
result.setValidations(violations);
return result;
}
开发者ID:khun777,项目名称:edsutil,代码行数:18,代码来源:BaseCRUDService.java
示例10: update
import ch.ralscha.extdirectspring.annotation.ExtDirectMethod; //导入依赖的package包/类
@ExtDirectMethod(STORE_MODIFY)
@Transactional
public ExtDirectStoreValidationResult<T> update(T updatedEntity) {
preModify(updatedEntity);
List<ValidationError> violations = validateEntity(updatedEntity);
if (violations.isEmpty()) {
return new ExtDirectStoreValidationResult<>(
this.entityManager.merge(updatedEntity));
}
ExtDirectStoreValidationResult<T> result = new ExtDirectStoreValidationResult<>(
updatedEntity);
result.setValidations(violations);
return result;
}
开发者ID:khun777,项目名称:edsutil,代码行数:17,代码来源:BaseCRUDService.java
示例11: readPersistentLogins
import ch.ralscha.extdirectspring.annotation.ExtDirectMethod; //导入依赖的package包/类
@ExtDirectMethod(STORE_READ)
public List<PersistentLogin> readPersistentLogins(
@AuthenticationPrincipal MongoUserDetails userDetails) {
return StreamSupport
.stream(this.mongoDb.getCollection(PersistentLogin.class)
.find(Filters.eq(CPersistentLogin.userId,
userDetails.getUserDbId()))
.spliterator(), false)
.peek(p -> {
String ua = p.getUserAgent();
if (StringUtils.hasText(ua)) {
UserAgent userAgent = UserAgent.parseUserAgentString(ua);
p.setUserAgentName(userAgent.getBrowser().getGroup().getName());
p.setUserAgentVersion(
userAgent.getBrowserVersion().getMajorVersion());
p.setOperatingSystem(userAgent.getOperatingSystem().getName());
}
}).collect(Collectors.toList());
}
开发者ID:ralscha,项目名称:eds-starter6-mongodb,代码行数:22,代码来源:UserConfigService.java
示例12: getAuthUser
import ch.ralscha.extdirectspring.annotation.ExtDirectMethod; //导入依赖的package包/类
@ExtDirectMethod
public UserDetailDto getAuthUser(
@AuthenticationPrincipal MongoUserDetails userDetails) {
if (userDetails != null) {
User user = userDetails.getUser(this.mongoDb);
UserDetailDto userDetailDto = new UserDetailDto(userDetails, user, null);
if (!userDetails.isPreAuth()) {
this.mongoDb.getCollection(User.class).updateOne(
Filters.eq(CUser.id, userDetails.getUserDbId()),
Updates.set(CUser.lastAccess, new Date()));
}
return userDetailDto;
}
return null;
}
开发者ID:ralscha,项目名称:eds-starter6-mongodb,代码行数:20,代码来源:SecurityService.java
示例13: switchUser
import ch.ralscha.extdirectspring.annotation.ExtDirectMethod; //导入依赖的package包/类
@ExtDirectMethod
@RequireAdminAuthority
public UserDetailDto switchUser(String userId) {
User switchToUser = this.mongoDb.getCollection(User.class)
.find(Filters.eq(CUser.id, userId)).first();
if (switchToUser != null) {
MongoUserDetails principal = new MongoUserDetails(switchToUser);
UsernamePasswordAuthenticationToken token = new UsernamePasswordAuthenticationToken(
principal, null, principal.getAuthorities());
SecurityContextHolder.getContext().setAuthentication(token);
return new UserDetailDto(principal, switchToUser, null);
}
return null;
}
开发者ID:ralscha,项目名称:eds-starter6-mongodb,代码行数:19,代码来源:SecurityService.java
示例14: create
import ch.ralscha.extdirectspring.annotation.ExtDirectMethod; //导入依赖的package包/类
@ExtDirectMethod(STORE_MODIFY)
public ValidationErrorsResult<Customer> create(Customer newCustomer) {
System.out.println(newCustomer);
List<ValidationErrors> violations = validateEntity(newCustomer);
ValidationErrors ve = isEmailUnique(newCustomer);
if (ve != null) {
violations.add(ve);
}
ValidationErrorsResult<Customer> result;
if (violations.isEmpty()) {
Customer insertedCustomer = this.customerRepository.save(newCustomer);
System.out.println("NEW CUSTOMER: " + insertedCustomer.getId());
result = new ValidationErrorsResult<>(insertedCustomer);
}
else {
result = new ValidationErrorsResult<>(newCustomer);
result.setValidations(violations);
}
return result;
}
开发者ID:ralscha,项目名称:mycustomer,代码行数:23,代码来源:CustomerService.java
示例15: update
import ch.ralscha.extdirectspring.annotation.ExtDirectMethod; //导入依赖的package包/类
@ExtDirectMethod(STORE_MODIFY)
public ValidationErrorsResult<Customer> update(Customer updatedCustomer) {
List<ValidationErrors> violations = validateEntity(updatedCustomer);
ValidationErrors ve = isEmailUnique(updatedCustomer);
if (ve != null) {
violations.add(ve);
}
ValidationErrorsResult<Customer> result;
if (violations.isEmpty()) {
Customer savedCustomer = this.customerRepository.save(updatedCustomer);
result = new ValidationErrorsResult<>(savedCustomer);
}
else {
result = new ValidationErrorsResult<>(updatedCustomer);
result.setValidations(violations);
}
return result;
}
开发者ID:ralscha,项目名称:mycustomer,代码行数:19,代码来源:CustomerService.java
示例16: getFormData
import ch.ralscha.extdirectspring.annotation.ExtDirectMethod; //导入依赖的package包/类
@ExtDirectMethod(FORM_LOAD)
public FormBean getFormData() {
OperatingSystemMXBean osBean = ManagementFactory.getOperatingSystemMXBean();
FormBean bean = new FormBean();
bean.setAvailableProcessors(osBean.getAvailableProcessors());
bean.setOsName(osBean.getName());
bean.setOsVersion(osBean.getVersion());
return bean;
}
开发者ID:ralscha,项目名称:eds-starter6-simple-mongodb,代码行数:11,代码来源:FormLoadService.java
示例17: read
import ch.ralscha.extdirectspring.annotation.ExtDirectMethod; //导入依赖的package包/类
@ExtDirectMethod(STORE_READ)
public ExtDirectStoreResult<User> 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<User> 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,代码来源:UserService.java
示例18: read
import ch.ralscha.extdirectspring.annotation.ExtDirectMethod; //导入依赖的package包/类
@ExtDirectMethod(STORE_READ)
public ExtDirectStoreResult<User> 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<User> 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,代码来源:UserService.java
示例19: getNavigation
import ch.ralscha.extdirectspring.annotation.ExtDirectMethod; //导入依赖的package包/类
@ExtDirectMethod(TREE_LOAD)
public List<NavigationNode> getNavigation(Locale locale,
@AuthenticationPrincipal JpaUserDetails jpaUserDetails) {
if (jpaUserDetails != null && !jpaUserDetails.isPreAuth()) {
return this.rootNodes.stream()
.map(n -> NavigationNode.copyOf(n, jpaUserDetails.getAuthorities(),
locale, this.messageSource))
.filter(Objects::nonNull).collect(Collectors.toList());
}
return Collections.emptyList();
}
开发者ID:ralscha,项目名称:eds-starter6-jpa,代码行数:14,代码来源:NavigationService.java
示例20: readSettings
import ch.ralscha.extdirectspring.annotation.ExtDirectMethod; //导入依赖的package包/类
@ExtDirectMethod(STORE_READ)
@Transactional(readOnly = true)
public ExtDirectStoreResult<UserSettings> readSettings(
@AuthenticationPrincipal JpaUserDetails jpaUserDetails) {
UserSettings userSettings = new UserSettings(
jpaUserDetails.getUser(this.jpaQueryFactory));
return new ExtDirectStoreResult<>(userSettings);
}
开发者ID:ralscha,项目名称:eds-starter6-jpa,代码行数:9,代码来源:UserConfigService.java
注:本文中的ch.ralscha.extdirectspring.annotation.ExtDirectMethod类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论