package com.mustafaiev.tair.cts.facade;
import java.util.List;
import org.apache.log4j.Logger;
import org.dozer.Mapper;
import com.mustafaiev.tair.cts.dao.IGroupDAO;
import com.mustafaiev.tair.cts.dto.GroupDTO;
import com.mustafaiev.tair.cts.exeption.DataNotRemovedException;
import com.mustafaiev.tair.cts.exeption.DataNotRetrievedException;
import com.mustafaiev.tair.cts.exeption.DataNotStoredException;
import com.mustafaiev.tair.cts.model.Group;
public class GroupFacade implements IGroupFacade {
private final IGroupDAO groupDAO;
private final Mapper mapper;
private static final Logger LOGGER = Logger.getLogger(GroupFacade.class);
public GroupFacade(final IGroupDAO groupDAO, final Mapper mapper) {
this.groupDAO = groupDAO;
this.mapper = mapper;
}
@Override
public void saveGroup(final GroupDTO group) throws DataNotStoredException {
final Group t = this.mapper.map(group, Group.class);
try {
t.setPayer(group.getPayer());
this.groupDAO.doSave(t);
} catch (final Exception e) {
LOGGER.error(e.getLocalizedMessage(), e);
}
}
@Override
public void updateGroup(final GroupDTO group) throws DataNotStoredException {
final Group t = this.mapper.map(group, Group.class);
try {
this.groupDAO.doUpdate(t);
} catch (final Exception e) {
LOGGER.error(e.getLocalizedMessage(), e);
}
}
@Override
public List<GroupDTO> retrieveGroups() throws DataNotRetrievedException {
return null;
}
@Override
public GroupDTO retrieveGroup(final Long groupId)
throws DataNotRetrievedException {
return null;
}
@Override
public void deleteGroups(final List<GroupDTO> groupsToDelete)
throws DataNotRemovedException {
}
}