TargetingVersionMapperImpl.java

package io.featureprobe.api.mapper;

import io.featureprobe.api.dao.entity.TargetingVersion;
import io.featureprobe.api.dto.MetricIterationResponse.PublishRecord;
import io.featureprobe.api.dto.TargetingVersionResponse;
import javax.annotation.Generated;

@Generated(
    value = "org.mapstruct.ap.MappingProcessor",
    date = "2023-10-07T17:43:36+0800",
    comments = "version: 1.4.2.Final, compiler: javac, environment: Java 1.8.0_382 (Red Hat, Inc.)"
)
public class TargetingVersionMapperImpl implements TargetingVersionMapper {

    @Override
    public TargetingVersionResponse entityToResponse(TargetingVersion targetingVersion) {
        if ( targetingVersion == null ) {
            return null;
        }

        TargetingVersionResponse targetingVersionResponse = new TargetingVersionResponse();

        targetingVersionResponse.setProjectKey( targetingVersion.getProjectKey() );
        targetingVersionResponse.setEnvironmentKey( targetingVersion.getEnvironmentKey() );
        targetingVersionResponse.setToggleKey( targetingVersion.getToggleKey() );
        targetingVersionResponse.setComment( targetingVersion.getComment() );
        targetingVersionResponse.setDisabled( targetingVersion.getDisabled() );
        targetingVersionResponse.setVersion( targetingVersion.getVersion() );
        targetingVersionResponse.setCreatedTime( targetingVersion.getCreatedTime() );

        targetingVersionResponse.setContent( toTargetingContent(targetingVersion.getContent()) );
        targetingVersionResponse.setCreatedBy( getAccount(targetingVersion.getCreatedBy()) );

        return targetingVersionResponse;
    }

    @Override
    public PublishRecord entityToPublishRecord(TargetingVersion targetingVersion) {
        if ( targetingVersion == null ) {
            return null;
        }

        PublishRecord publishRecord = new PublishRecord();

        publishRecord.setPublishTime( targetingVersion.getCreatedTime() );
        publishRecord.setVersion( targetingVersion.getVersion() );
        publishRecord.setReleaseNote( targetingVersion.getComment() );

        return publishRecord;
    }
}