Search in sources :

Example 6 with NetworkUserDAO

use of com.tomasio.projects.trainning.dao.NetworkUserDAO in project trainning by fernandotomasio.

the class UserServiceSimpleImpl method findAllUsers.

@Override
public NetworkUserDTO[] findAllUsers() {
    NetworkUserDAO dao = factory.getNetworkUserDAO();
    NetworkUserDTO[] usersArray = null;
    try {
        List<NetworkUserDTO> users = dao.findAll();
        if (users != null) {
            usersArray = new NetworkUserDTO[users.size()];
            users.toArray(usersArray);
        }
    } catch (DAOException ex) {
        throw new CoreException("Erro de acesso ao serviço de diretórios: " + ex.getMessage());
    }
    return usersArray;
}
Also used : DAOException(com.tomasio.projects.trainning.exception.DAOException) NetworkUserDTO(com.tomasio.projects.trainning.dto.NetworkUserDTO) CoreException(com.tomasio.projects.trainning.exeption.CoreException) NetworkUserDAO(com.tomasio.projects.trainning.dao.NetworkUserDAO)

Example 7 with NetworkUserDAO

use of com.tomasio.projects.trainning.dao.NetworkUserDAO in project trainning by fernandotomasio.

the class Ldap method main.

public static void main(String[] args) throws DAOException {
    @SuppressWarnings("resource") ApplicationContext context = new ClassPathXmlApplicationContext("spring-context.xml");
    NetworkUserDAO dao = (NetworkUserDAO) context.getBean("networkUserDAO");
    dao.authenticate("fernandofot", "fernandofot");
    System.out.println("");
}
Also used : ClassPathXmlApplicationContext(org.springframework.context.support.ClassPathXmlApplicationContext) ApplicationContext(org.springframework.context.ApplicationContext) ClassPathXmlApplicationContext(org.springframework.context.support.ClassPathXmlApplicationContext) NetworkUserDAO(com.tomasio.projects.trainning.dao.NetworkUserDAO)

Example 8 with NetworkUserDAO

use of com.tomasio.projects.trainning.dao.NetworkUserDAO in project trainning by fernandotomasio.

the class UserServiceSimpleImpl method searchUsers.

@Override
public NetworkUserDTO[] searchUsers(String term) {
    NetworkUserDAO dao = factory.getNetworkUserDAO();
    NetworkUserDTO[] usersArray = null;
    try {
        List<NetworkUserDTO> users = dao.search(term);
        if (users != null) {
            usersArray = new NetworkUserDTO[users.size()];
            users.toArray(usersArray);
        }
    } catch (DAOException ex) {
        throw new CoreException("Erro de acesso ao serviço de diretórios: " + ex.getMessage());
    }
    return usersArray;
}
Also used : DAOException(com.tomasio.projects.trainning.exception.DAOException) NetworkUserDTO(com.tomasio.projects.trainning.dto.NetworkUserDTO) CoreException(com.tomasio.projects.trainning.exeption.CoreException) NetworkUserDAO(com.tomasio.projects.trainning.dao.NetworkUserDAO)

Example 9 with NetworkUserDAO

use of com.tomasio.projects.trainning.dao.NetworkUserDAO in project trainning by fernandotomasio.

the class UserServiceSimpleImpl method updateUserPassword.

@Override
public void updateUserPassword(String password, String uid) {
    NetworkUserDAO dao = factory.getNetworkUserDAO();
    try {
        NetworkUserDTO user = dao.find(uid);
        user.setPassword(password);
        dao.update(user);
    } catch (DAOException ex) {
        throw new CoreException("Erro de acesso ao serviço de diretórios: " + ex.getMessage());
    }
}
Also used : DAOException(com.tomasio.projects.trainning.exception.DAOException) NetworkUserDTO(com.tomasio.projects.trainning.dto.NetworkUserDTO) CoreException(com.tomasio.projects.trainning.exeption.CoreException) NetworkUserDAO(com.tomasio.projects.trainning.dao.NetworkUserDAO)

Example 10 with NetworkUserDAO

use of com.tomasio.projects.trainning.dao.NetworkUserDAO in project trainning by fernandotomasio.

the class UserServiceSimpleImpl method findUser.

@Override
public NetworkUserDTO findUser(String uid) {
    NetworkUserDAO dao = factory.getNetworkUserDAO();
    NetworkUserDTO user = null;
    try {
        user = dao.find(uid);
    } catch (DAOException ex) {
        throw new CoreException("Erro de acesso ao serviço de diretórios: " + ex.getMessage());
    }
    return user;
}
Also used : DAOException(com.tomasio.projects.trainning.exception.DAOException) NetworkUserDTO(com.tomasio.projects.trainning.dto.NetworkUserDTO) CoreException(com.tomasio.projects.trainning.exeption.CoreException) NetworkUserDAO(com.tomasio.projects.trainning.dao.NetworkUserDAO)

Aggregations

NetworkUserDAO (com.tomasio.projects.trainning.dao.NetworkUserDAO)12 DAOException (com.tomasio.projects.trainning.exception.DAOException)11 NetworkUserDTO (com.tomasio.projects.trainning.dto.NetworkUserDTO)9 CoreException (com.tomasio.projects.trainning.exeption.CoreException)9 NetworkGroupDAO (com.tomasio.projects.trainning.dao.NetworkGroupDAO)5 OrganizacaoDAO (com.tomasio.projects.trainning.dao.OrganizacaoDAO)5 NetworkGroupDTO (com.tomasio.projects.trainning.dto.NetworkGroupDTO)5 Organizacao (com.tomasio.projects.trainning.model.Organizacao)5 Transactional (org.springframework.transaction.annotation.Transactional)4 BufferedReader (java.io.BufferedReader)1 FileNotFoundException (java.io.FileNotFoundException)1 FileReader (java.io.FileReader)1 IOException (java.io.IOException)1 ArrayList (java.util.ArrayList)1 ApplicationContext (org.springframework.context.ApplicationContext)1 ClassPathXmlApplicationContext (org.springframework.context.support.ClassPathXmlApplicationContext)1 ClassPathResource (org.springframework.core.io.ClassPathResource)1