All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.eurodyn.qlack.fuse.cm.mapper.NodeAttributeMapper Maven / Gradle / Ivy

There is a newer version: 3.6.8
Show newest version
package com.eurodyn.qlack.fuse.cm.mapper;

import com.eurodyn.qlack.fuse.cm.dto.NodeAttributeDTO;
import com.eurodyn.qlack.fuse.cm.model.Node;
import com.eurodyn.qlack.fuse.cm.model.NodeAttribute;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Named;
import org.mapstruct.ReportingPolicy;

@Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE)
public interface NodeAttributeMapper extends CMBaseMapper {

  @Override
  @Mapping(target = "nodeId", source = "node", qualifiedByName = "mapNode")
  NodeAttributeDTO mapToDTO(NodeAttribute nodeAttribute);

  /**
   * Maps the Node value
   *
   * @param node the Node of the attribute
   * @return the id of the Node
   */
  @Named("mapNode")
  default String mapNode(Node node) {
    if (node == null) {
      return null;
    }
    String id = node.getId();
    if (id == null) {
      return null;
    }
    return id;
  }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy