Пример #1
0
  /**
   * load purpose.
   *
   * <p>loads a new copy of data into this object.
   *
   * @param dto
   */
  public void load(ServiceDTO dto) {
    if (dto == null) {
      throw new NullPointerException();
    }

    service.setEnabled(dto.isEnabled());
    service.setName(dto.getName());
    service.setTitle(dto.getTitle());
    service.setAbstract(dto.getAbstract());
    service.getKeywords().clear();
    service.getKeywords().addAll(dto.getKeywords());
    service.setFees(dto.getFees());
    service.setAccessConstraints(dto.getAccessConstraints());
    service.setOnlineResource(
        dto.getOnlineResource() != null ? dto.getOnlineResource().toString() : null);

    if (dto.getMetadataLink() != null) {
      service.setMetadataLink(dto.getMetadataLink().getMetadataLink());
    } else {
      service.setMetadataLink(null);
    }

    setStrategy(dto.getStrategy());
    setPartialBufferSize(dto.getPartialBufferSize());

    // setEnabled(dto.isEnabled());
    // setName(dto.getName());
    // setTitle(dto.getTitle());
    // setAbtract(dto.getAbstract());
    // setKeywords(dto.getKeywords());
    // setFees(dto.getFees());
    // setAccessConstraints(dto.getAccessConstraints());
    // setMaintainer(dto.getMaintainer());
    // setOnlineResource(dto.getOnlineResource());
    // metadataLink = dto.getMetadataLink();
    // stategy = dto.getStrategy();
    // partialBufferSize = dto.getPartialBufferSize();
  }
Пример #2
0
  public Object toDTO() {
    ServiceDTO dto = new ServiceDTO();

    dto.setAccessConstraints(service.getAccessConstraints());
    dto.setEnabled(service.isEnabled());
    dto.setFees(service.getFees());

    dto.setKeywords(service.getKeywords());
    dto.setMaintainer(service.getMaintainer());
    dto.setName(service.getName());

    if (service.getOnlineResource() != null) {
      try {
        dto.setOnlineResource(new URL(service.getOnlineResource()));
      } catch (MalformedURLException e) {
        throw new RuntimeException(e);
      }
    }

    dto.setAbstract(service.getAbstract());
    dto.setTitle(service.getTitle());

    dto.setMetadataLink(getMetadataLink());
    dto.setStrategy(getStrategy());
    dto.setPartialBufferSize(getPartialBufferSize());

    // dto.setAccessConstraints(getAccessConstraints());
    // dto.setEnabled(isEnabled());
    // dto.setFees(getFees());
    // dto.setKeywords(getKeywords());
    // dto.setMaintainer(getMaintainer());
    // dto.setName(getName());
    // dto.setOnlineResource(getOnlineResource());
    // dto.setAbstract(getAbstract());
    // dto.setTitle(getTitle());
    // dto.setMetadataLink(metadataLink);
    // dto.setStrategy(strategy);
    // dto.setPartialBufferSize(partialBufferSize);

    return dto;
  }