Skip to content

Commit

Permalink
VUU25: Reformatting
Browse files Browse the repository at this point in the history
  • Loading branch information
cfisher-scottlogic committed Oct 5, 2023
1 parent 13142bb commit 681dd93
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,9 @@ public GetLayoutResponseDTO getLayout(@PathVariable UUID id) {
public List<MetadataResponseDTO> getMetadata() {

return layoutService.getMetadata()
.stream()
.map(metadata -> mapper.map(metadata, MetadataResponseDTO.class))
.toList();
.stream()
.map(metadata -> mapper.map(metadata, MetadataResponseDTO.class))
.toList();
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,22 @@ public ModelMapper modelMapper() {
ModelMapper mapper = new ModelMapper();

// LayoutRequestDTO to Layout
mapper.typeMap(LayoutRequestDTO.class, Layout.class).addMappings(m -> m.skip(Layout::setId));
mapper.typeMap(LayoutRequestDTO.class, Layout.class)
.addMappings(m -> m.skip(Layout::setId));

// Layout to CreateLayoutResponseDTO
mapper.typeMap(Layout.class, CreateLayoutResponseDTO.class)
.addMappings(m -> m.map(layout -> layout.getMetadata().getCreated(),
CreateLayoutResponseDTO::setCreated));
.addMappings(m -> m.map(layout -> layout.getMetadata().getCreated(),
CreateLayoutResponseDTO::setCreated));

// Metadata to MetadataResponseDTO
mapper.typeMap(Metadata.class, MetadataResponseDTO.class)
.addMappings(m -> m.map(metadata -> metadata.getLayout().getId(), MetadataResponseDTO::setLayoutId));
.addMappings(m -> m.map(metadata -> metadata.getLayout().getId(),
MetadataResponseDTO::setLayoutId));

// MetadataRequestDTO to Metadata
mapper.typeMap(MetadataRequestDTO.class, Metadata.class).addMappings(m -> m.skip(Metadata::setId));
mapper.typeMap(MetadataRequestDTO.class, Metadata.class)
.addMappings(m -> m.skip(Metadata::setId));

return mapper;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,8 @@
import jakarta.persistence.Id;
import jakarta.persistence.JoinColumn;
import jakarta.persistence.OneToOne;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.UUID;
import lombok.Data;

@Data
@Entity
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,10 @@
import jakarta.persistence.GenerationType;
import jakarta.persistence.Id;
import jakarta.persistence.OneToOne;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.ToString;

import java.util.Date;
import java.util.UUID;
import lombok.Data;
import lombok.ToString;

@Data
@Entity
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
package org.finos.vuu.layoutserver.repository;

import java.util.UUID;
import org.finos.vuu.layoutserver.model.Layout;
import org.springframework.data.repository.CrudRepository;
import org.springframework.stereotype.Repository;

import java.util.UUID;

@Repository
public interface LayoutRepository extends CrudRepository<Layout, UUID> {}
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
package org.finos.vuu.layoutserver.repository;

import java.util.UUID;
import org.finos.vuu.layoutserver.model.Metadata;
import org.springframework.data.repository.CrudRepository;
import org.springframework.stereotype.Repository;

import java.util.UUID;

@Repository
public interface MetadataRepository extends CrudRepository<Metadata, UUID> {}
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
package org.finos.vuu.layoutserver.service;

import java.util.ArrayList;
import java.util.List;
import lombok.RequiredArgsConstructor;
import org.finos.vuu.layoutserver.model.Metadata;
import org.finos.vuu.layoutserver.repository.MetadataRepository;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;

@RequiredArgsConstructor
@Service
public class MetadataService {
Expand Down

0 comments on commit 681dd93

Please sign in to comment.