public EmlGroupVo getByName(String principal) { int i = principal.indexOf("@"); String userName = principal.substring(0, i); String host = principal.substring(i + 1); EmlGroup group = groupDao.selectGroup(userName, host); return new EmlGroupVo(group); }
@Transactional(value = "rest_tm") public void add(String clientId, EmlGroupVo groupVo) { groupVo.setClientId(clientId); // 그룹 설정 초기화 groupVo.setServerConfig(new EmlGroupConfigVo()); // 엔티티 생성 EmlGroup group = new EmlGroup(groupVo); // 아이디 생성 group.setId(idProvider.next()); StringWriter writer = new StringWriter(); try { objectMapper.writeValue(writer, groupVo.getServerConfig()); } catch (IOException e) { e.printStackTrace(); } group.setServerConfig(writer.toString()); // 그룹 엔티티 추가 logger.debug("그룹을 추가합니다.: " + group); groupDao.insert(group); groupVo.setId(group.getId()); }
public EmlGroupVo get(String clientId, String groupId) { EmlGroup emlGroup = groupDao.selectGroup(groupId); EmlGroupVo emlGroupVo = new EmlGroupVo(emlGroup); try { EmlGroupConfigVo emlGroupConfigVo = objectMapper.readValue(emlGroup.getServerConfig(), EmlGroupConfigVo.class); emlGroupVo.setServerConfig(emlGroupConfigVo); } catch (IOException e) { e.printStackTrace(); } return emlGroupVo; }
public List<EmlGroupVo> list(String clientId) { List<EmlGroup> emlGroupList = groupDao.list(clientId); List<EmlGroupVo> emlGroupVoList = new ArrayList<EmlGroupVo>(); for (EmlGroup emlGroup : emlGroupList) { EmlGroupVo emlGroupVo = new EmlGroupVo(emlGroup); try { EmlGroupConfigVo emlGroupConfigVo = objectMapper.readValue(emlGroup.getServerConfig(), EmlGroupConfigVo.class); emlGroupVo.setServerConfig(emlGroupConfigVo); } catch (IOException e) { e.printStackTrace(); } emlGroupVoList.add(emlGroupVo); } return emlGroupVoList; }
public EmlGroupVo getByName(String userName, String host) { EmlGroup group = groupDao.selectGroup(userName, host); return new EmlGroupVo(group); }
@Transactional(value = "rest_tm") public void updateState(String clientId, String groupId, String groupState) { groupDao.updateState(groupId, groupState); }
@Transactional(value = "rest_tm") public void updateQuota(String clientId, String groupId, long groupQuota) { groupDao.updateQuota(groupId, groupQuota); }
@Transactional(value = "rest_tm") public void updateName(String clientId, String groupId, String displayName) { groupDao.updateDisplayName(groupId, displayName); }
@Transactional(value = "rest_tm") public void remove(String clientId, String groupId) { groupDao.delete(groupId); }