本文整理匯總了Java中com.packtpub.mmj.user.domain.model.entity.User類的典型用法代碼示例。如果您正苦於以下問題:Java User類的具體用法?Java User怎麽用?Java User使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
User類屬於com.packtpub.mmj.user.domain.model.entity包,在下文中一共展示了User類的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: findByName
import com.packtpub.mmj.user.domain.model.entity.User; //導入依賴的package包/類
/**
* Fetch users with the specified name. A partial case-insensitive match is
* supported. So <code>http://.../user/rest</code> will find any users with
* upper or lower case 'rest' in their name.
*
* @param name
* @return A non-null, non-empty collection of users.
*/
@HystrixCommand(fallbackMethod = "defaultUsers")
@RequestMapping(method = RequestMethod.GET)
public ResponseEntity<Collection<User>> findByName(@RequestParam("name") String name) {
logger.info(String.format("user-service findByName() invoked:%s for %s ", userService.getClass().getName(), name));
name = name.trim().toLowerCase();
Collection<User> users;
try {
users = userService.findByName(name);
} catch (Exception ex) {
logger.log(Level.SEVERE, "Exception raised findByName REST Call", ex);
return new ResponseEntity<>(HttpStatus.INTERNAL_SERVER_ERROR);
}
return users.size() > 0 ? new ResponseEntity<>(users, HttpStatus.OK)
: new ResponseEntity<>(HttpStatus.NO_CONTENT);
}
開發者ID:PacktPublishing,項目名稱:Mastering-Microservices-with-Java-9-Second-Edition,代碼行數:24,代碼來源:UserController.java
示例2: add
import com.packtpub.mmj.user.domain.model.entity.User; //導入依賴的package包/類
/**
* Add user with the specified information.
*
* @param userVO
* @return A non-null user.
*/
@RequestMapping(method = RequestMethod.POST)
public ResponseEntity<User> add(@RequestBody UserVO userVO) {
logger.info(String.format("user-service add() invoked: %s for %s", userService.getClass().getName(), userVO.getName()));
System.out.println(userVO);
User user = new User(null, null, null, null, null);
BeanUtils.copyProperties(userVO, user);
try {
userService.add(user);
} catch (Exception ex) {
logger.log(Level.WARNING, "Exception raised add Booking REST Call {0}", ex);
return new ResponseEntity<>(HttpStatus.UNPROCESSABLE_ENTITY);
}
return new ResponseEntity<>(HttpStatus.CREATED);
}
開發者ID:PacktPublishing,項目名稱:Mastering-Microservices-with-Java-9-Second-Edition,代碼行數:21,代碼來源:UserController.java
示例3: add
import com.packtpub.mmj.user.domain.model.entity.User; //導入依賴的package包/類
/**
* Add user with the specified information.
*
* @param userVO
* @return A non-null user.
*/
@RequestMapping(method = RequestMethod.POST)
public ResponseEntity<User> add(@RequestBody UserVO userVO) {
logger.info(String.format("user-service add() invoked: %s for %s", userService.getClass().getName(), userVO.getName()));
System.out.println(userVO);
User user = new User(null, null, null, null, null);
BeanUtils.copyProperties(userVO, user);
try {
userService.add(user);
} catch (Exception ex) {
logger.log(Level.WARNING, "Exception raised add User REST Call {0}", ex);
return new ResponseEntity<>(HttpStatus.UNPROCESSABLE_ENTITY);
}
return new ResponseEntity<>(HttpStatus.CREATED);
}
開發者ID:PacktPublishing,項目名稱:Mastering-Microservices-with-Java-9-Second-Edition,代碼行數:21,代碼來源:UserController.java
示例4: findByName
import com.packtpub.mmj.user.domain.model.entity.User; //導入依賴的package包/類
/**
* Fetch users with the specified name. A partial case-insensitive match is
* supported. So <code>http://.../user/rest</code> will find any users with
* upper or lower case 'rest' in their name.
*
* @param name
* @return A non-null, non-empty collection of users.
*/
@HystrixCommand(fallbackMethod = "defaultUsers")
@RequestMapping(method = RequestMethod.GET)
public ResponseEntity<Collection<User>> findByName(@RequestParam("name") String name) {
logger.info(String.format("user-service findByName() invoked:{} for {} ", userService.getClass().getName(), name));
name = name.trim().toLowerCase();
Collection<User> users;
try {
users = userService.findByName(name);
} catch (Exception ex) {
logger.log(Level.SEVERE, "Exception raised findByName REST Call", ex);
return new ResponseEntity<>(HttpStatus.INTERNAL_SERVER_ERROR);
}
return users.size() > 0 ? new ResponseEntity<>(users, HttpStatus.OK)
: new ResponseEntity<>(HttpStatus.NO_CONTENT);
}
示例5: findByName
import com.packtpub.mmj.user.domain.model.entity.User; //導入依賴的package包/類
/**
* Fetch users with the specified name. A partial case-insensitive match is
* supported. So <code>http://.../user/rest</code> will find any users with
* upper or lower case 'rest' in their name.
*
* @param name
* @return A non-null, non-empty collection of users.
*/
@RequestMapping(method = RequestMethod.GET)
public ResponseEntity<Collection<User>> findByName(@RequestParam("name") String name) {
logger.info(String.format("user-service findByName() invoked:{} for {} ", userService.getClass().getName(), name));
name = name.trim().toLowerCase();
Collection<User> users;
try {
users = userService.findByName(name);
} catch (Exception ex) {
logger.log(Level.SEVERE, "Exception raised findByName REST Call", ex);
return new ResponseEntity<>(HttpStatus.INTERNAL_SERVER_ERROR);
}
return users.size() > 0 ? new ResponseEntity<>(users, HttpStatus.OK)
: new ResponseEntity<>(HttpStatus.NO_CONTENT);
}
開發者ID:PacktPublishing,項目名稱:Mastering-Microservices-with-Java-9-Second-Edition,代碼行數:23,代碼來源:UserController.java
示例6: InMemUserRepository
import com.packtpub.mmj.user.domain.model.entity.User; //導入依賴的package包/類
/**
* Initialize the in-memory User Repository with empty Map
*/
public InMemUserRepository() {
entities = new HashMap();
User user = new User("1", "User Name 1", "Address 1", "City 1", "9999911111");
entities.put("1", user);
User user2 = new User("1", "User Name 2", "Address 2", "City 2", "9999922222");
entities.put("2", user2);
}
開發者ID:PacktPublishing,項目名稱:Mastering-Microservices-with-Java-9-Second-Edition,代碼行數:11,代碼來源:InMemUserRepository.java
示例7: update
import com.packtpub.mmj.user.domain.model.entity.User; //導入依賴的package包/類
/**
*
* @param entity
*/
@Override
public void update(User entity) {
if (entities.containsKey(entity.getId())) {
entities.put(entity.getId(), entity);
}
}
開發者ID:PacktPublishing,項目名稱:Mastering-Microservices-with-Java-9-Second-Edition,代碼行數:11,代碼來源:InMemUserRepository.java
示例8: findByName
import com.packtpub.mmj.user.domain.model.entity.User; //導入依賴的package包/類
/**
*
* @param name
* @return
* @throws Exception
*/
@Override
public Collection<User> findByName(String name) throws Exception {
Collection<User> users = new ArrayList();
int noOfChars = name.length();
entities.forEach((k, v) -> {
if (v.getName().toLowerCase().contains(name.toLowerCase().subSequence(0, noOfChars))) {
users.add(v);
}
});
return users;
}
開發者ID:PacktPublishing,項目名稱:Mastering-Microservices-with-Java-9-Second-Edition,代碼行數:18,代碼來源:InMemUserRepository.java
示例9: add
import com.packtpub.mmj.user.domain.model.entity.User; //導入依賴的package包/類
@Override
public void add(User user) throws Exception {
if (userRepository.containsName(user.getName())) {
throw new Exception(String.format("There is already a product with the name - %s", user.getName()));
}
if (user.getName() == null || "".equals(user.getName())) {
throw new Exception("Booking name cannot be null or empty string.");
}
super.add(user);
}
開發者ID:PacktPublishing,項目名稱:Mastering-Microservices-with-Java-9-Second-Edition,代碼行數:12,代碼來源:UserServiceImpl.java
示例10: InMemUserRepository
import com.packtpub.mmj.user.domain.model.entity.User; //導入依賴的package包/類
/**
* Initialize the in-memory Restaurant Repository with empty Map
*/
public InMemUserRepository() {
entities = new HashMap();
User user = new User("1", "User Name 1", "Address 1", "City 1", "9999911111");
entities.put("1", user);
User user2 = new User("1", "User Name 2", "Address 2", "City 2", "9999922222");
entities.put("2", user2);
}
開發者ID:PacktPublishing,項目名稱:Mastering-Microservices-with-Java-9-Second-Edition,代碼行數:11,代碼來源:InMemUserRepository.java