Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Java
  4. Enterprise application architecture

Enterprise application architecture

Scheduled Pinned Locked Moved Java
javaasp-netarchitecture
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • N Offline
    N Offline
    Neo10101
    wrote on last edited by
    #1

    I took a look at someone's code here and I am trying to understand its architecture: We are looking at a classic enterprise architecture using Spring core for dependency injection.

    import org.springframework.beans.factory.annotation.Autowired;

    import java.util.ArrayList;
    import java.util.Arrays;
    import java.util.List;

    public class FavoriteService {
    @Autowired
    private Users users;

    public boolean checkLogin(String username, String password) {
        return users.login(username, password);
    }
    
    
    public void addUser(String root, String rootpasswd, String username, String password) {
        if(root.equals("root")&&rootpasswd.equals("rootpasswd")) {
            users.addUser(username, password);
        }
    }
    
    public User getUser(String username){
        return users.getUser(username);
    }
    
    public List<String> getFavorites(String username, String password) {
        if (getUser(username) == null) return new ArrayList<>();
    }
    
    public void addFavorite(String username, String password, String favorite1) {
            users.addFavorite(username,password,favorite1);
    }
    
    public void removeFavorite(String username, String password, String favorite1) {
        users.removeFavorite(username,password,favorite1);
    }
    
    public void addFavorite(String username, String password, String favorite1) {
    
    }
    

    }

    import java.util.ArrayList;
    import java.util.List;

    public class User {
    private final String username;
    private final String password;
    private final List favorites = new ArrayList<String>();

    public User(String username, String password) {
        this.username = username;
        this.password = password;
    }
    
    public String getPassword() {
        return password;
    }
    
    public String getUsername() {
        return username;
    }
    
    public List<String> getFavorites(){
        return favorites;
    }
    
    public void addFavorite(String favorite){
        favorites.add(favorite);
    }
    
    public void removeFavorite(String favorite) {
        favorites.remove(favorite);
    }
    

    }

    public interface UserDao {
    public void create(User user);

    public User getUser(String username);
    

    }

    import java.util.HashMap;
    import java.util.Map;

    public class UserDaoWithMap implements UserDao {

    L 1 Reply Last reply
    0
    • N Neo10101

      I took a look at someone's code here and I am trying to understand its architecture: We are looking at a classic enterprise architecture using Spring core for dependency injection.

      import org.springframework.beans.factory.annotation.Autowired;

      import java.util.ArrayList;
      import java.util.Arrays;
      import java.util.List;

      public class FavoriteService {
      @Autowired
      private Users users;

      public boolean checkLogin(String username, String password) {
          return users.login(username, password);
      }
      
      
      public void addUser(String root, String rootpasswd, String username, String password) {
          if(root.equals("root")&&rootpasswd.equals("rootpasswd")) {
              users.addUser(username, password);
          }
      }
      
      public User getUser(String username){
          return users.getUser(username);
      }
      
      public List<String> getFavorites(String username, String password) {
          if (getUser(username) == null) return new ArrayList<>();
      }
      
      public void addFavorite(String username, String password, String favorite1) {
              users.addFavorite(username,password,favorite1);
      }
      
      public void removeFavorite(String username, String password, String favorite1) {
          users.removeFavorite(username,password,favorite1);
      }
      
      public void addFavorite(String username, String password, String favorite1) {
      
      }
      

      }

      import java.util.ArrayList;
      import java.util.List;

      public class User {
      private final String username;
      private final String password;
      private final List favorites = new ArrayList<String>();

      public User(String username, String password) {
          this.username = username;
          this.password = password;
      }
      
      public String getPassword() {
          return password;
      }
      
      public String getUsername() {
          return username;
      }
      
      public List<String> getFavorites(){
          return favorites;
      }
      
      public void addFavorite(String favorite){
          favorites.add(favorite);
      }
      
      public void removeFavorite(String favorite) {
          favorites.remove(favorite);
      }
      

      }

      public interface UserDao {
      public void create(User user);

      public User getUser(String username);
      

      }

      import java.util.HashMap;
      import java.util.Map;

      public class UserDaoWithMap implements UserDao {

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      Neo10101 wrote:

      I took a look at someone's code here

      Then you should direct your question to that person.

      N 1 Reply Last reply
      0
      • L Lost User

        Neo10101 wrote:

        I took a look at someone's code here

        Then you should direct your question to that person.

        N Offline
        N Offline
        Neo10101
        wrote on last edited by
        #3

        There is no need to give me replies like that to every question I ask. My colleague is on vacation.

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups