@@ -0,0 +1,1853 @@
+package com.sahana.inventory.user.service;%0A%0Aimport java.util.ArrayList;%0Aimport java.util.Iterator;%0Aimport java.util.List;%0Aimport java.util.concurrent.atomic.AtomicLong;%0A%0Aimport org.springframework.stereotype.Service;%0Aimport org.springframework.transaction.annotation.Transactional;%0A%0Aimport com.sahana.inventory.user.model.User;%0A%0A@Service(%22userService%22)%0A@Transactional%0Apublic class UserServiceImpl implements UserService%7B%0A%09%0A%09private static final AtomicLong counter = new AtomicLong();%0A%09%0A%09private static List%3CUser%3E users;%0A%09%0A%09static%7B%0A%09%09users= populateDummyUsers();%0A%09%7D%0A%0A%09public List%3CUser%3E findAllUsers() %7B%0A%09%09return users;%0A%09%7D%0A%09%0A%09public User findById(long id) %7B%0A%09%09for(User user : users)%7B%0A%09%09%09if(user.getId() == id)%7B%0A%09%09%09%09return user;%0A%09%09%09%7D%0A%09%09%7D%0A%09%09return null;%0A%09%7D%0A%09%0A%09public User findByName(String name) %7B%0A%09%09for(User user : users)%7B%0A%09%09%09if(user.getUsername().equalsIgnoreCase(name))%7B%0A%09%09%09%09return user;%0A%09%09%09%7D%0A%09%09%7D%0A%09%09return null;%0A%09%7D%0A%09%0A%09public void saveUser(User user) %7B%0A%09%09user.setId(counter.incrementAndGet());%0A%09%09users.add(user);%0A%09%7D%0A%0A%09public void updateUser(User user) %7B%0A%09%09int index = users.indexOf(user);%0A%09%09users.set(index, user);%0A%09%7D%0A%0A%09public void deleteUserById(long id) %7B%0A%09%09%0A%09%09for (Iterator%3CUser%3E iterator = users.iterator(); iterator.hasNext(); ) %7B%0A%09%09    User user = iterator.next();%0A%09%09    if (user.getId() == id) %7B%0A%09%09        iterator.remove();%0A%09%09    %7D%0A%09%09%7D%0A%09%7D%0A%0A%09public boolean isUserExist(User user) %7B%0A%09%09return findByName(user.getUsername())!=null;%0A%09%7D%0A%09%0A%09public void deleteAllUsers()%7B%0A%09%09users.clear();%0A%09%7D%0A%0A%09private static List%3CUser%3E populateDummyUsers()%7B%0A%09%09List%3CUser%3E users = new ArrayList%3CUser%3E();%0A%09%09users.add(new User(counter.incrementAndGet(),%22Sam%22, %22NY%22, %22sam@abc.com%22));%0A%09%09users.add(new User(counter.incrementAndGet(),%22Tomy%22, %22ALBAMA%22, %22tomy@abc.com%22));%0A%09%09users.add(new User(counter.incrementAndGet(),%22Kelly%22, %22NEBRASKA%22, %22kelly@abc.com%22));%0A%09%09return users;%0A%09%7D%0A%0A%7D%0A

Create UserServiceImpl.java