Beispiel #1
0
 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);
 }
Beispiel #2
0
  @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());
  }
Beispiel #3
0
  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;
  }
Beispiel #4
0
  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;
  }
Beispiel #5
0
 public EmlGroupVo getByName(String userName, String host) {
   EmlGroup group = groupDao.selectGroup(userName, host);
   return new EmlGroupVo(group);
 }
Beispiel #6
0
 @Transactional(value = "rest_tm")
 public void updateState(String clientId, String groupId, String groupState) {
   groupDao.updateState(groupId, groupState);
 }
Beispiel #7
0
 @Transactional(value = "rest_tm")
 public void updateQuota(String clientId, String groupId, long groupQuota) {
   groupDao.updateQuota(groupId, groupQuota);
 }
Beispiel #8
0
 @Transactional(value = "rest_tm")
 public void updateName(String clientId, String groupId, String displayName) {
   groupDao.updateDisplayName(groupId, displayName);
 }
Beispiel #9
0
 @Transactional(value = "rest_tm")
 public void remove(String clientId, String groupId) {
   groupDao.delete(groupId);
 }