Exemple #1
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());
  }
Exemple #2
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;
  }
Exemple #3
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;
  }