Skip to content

Commit

Permalink
Merge pull request #425 from qbicsoftware/release/0.30.0
Browse files Browse the repository at this point in the history
Release/0.30.0
  • Loading branch information
Steffengreiner authored Nov 14, 2023
2 parents 9faf892 + 40a5bf4 commit 3750208
Show file tree
Hide file tree
Showing 114 changed files with 1,730 additions and 751 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,9 @@ public enum ErrorCode {
INVALID_PROJECT_TITLE,
INVALID_PROJECT_CODE,
DUPLICATE_PROJECT_CODE,
DUPLICATE_GROUP_SELECTED,
UNDEFINED_VARIABLE_LEVEL,
NO_CONDITION_SELECTED,
NO_SPECIES_DEFINED,
NO_SPECIMEN_DEFINED,
NO_ANALYTE_DEFINED,
Expand Down
21 changes: 21 additions & 0 deletions finances-api/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>life.qbic</groupId>
<artifactId>datamanager</artifactId>
<version>0.29.0</version>
</parent>

<groupId>life.qbic.finances</groupId>
<artifactId>finances-api</artifactId>

<properties>
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>

</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
package life.qbic.finances.api;

import java.util.Collection;
import java.util.Optional;

/**
* <b>Finance service</b>
* <p>
* Interface to enable clients to look up basic offer information.
*
* @since 1.0.0
*/
public interface FinanceService {

/**
* Lists concise offer information for offers that contain a given character sequence in the
* project title or in the offerId.
* <p>
* The search is inclusive, so either a match in the title or the project id will be returned.
*
* @param projectTitle a character sequence to search for in the project title of an offer
* @param offerId a character sequence to search for in the offer id of an offer
* @return list of {@link OfferSummary} matching the criteria
* @since 1.0.0
*/
Collection<OfferSummary> findOfferContainingProjectTitleOrId(String projectTitle,
String offerId);

/**
* Same as {@link FinanceService#findOfferContainingProjectTitleOrId(String, String)} but with a
* possibility for pagination by providing an offset and query result size limit.
*
* @param projectTitle a character sequence to search for in the project title of an offer
* @param offerId a character sequence to search for in the offer id of an offer
* @param offset the offset to start listing the matching search results
* @param limit the maximum number of matching search results
* @return list of {@link OfferSummary} matching the criteria
* @since 1.0.0
*/
Collection<OfferSummary> findOfferContainingProjectTitleOrId(String projectTitle, String offerId,
int offset, int limit);


/**
* Searches for an offer based on a given offer id
*
* @param offerId the offer id
* @return an optional offer, is {@link Optional#empty()} if no matching offer was found
* @since 1.0.0
*/
Optional<Offer> findOfferById(String offerId);

}
19 changes: 19 additions & 0 deletions finances-api/src/main/java/life/qbic/finances/api/Offer.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package life.qbic.finances.api;

/**
* <b>Offer</b>
*
* <p>Holds offer information such as:</p>
*
* <ul>
* <li>offer id</li>
* <li>title</li>
* <li>objective</li>
* <li>experimental design</li>
* </ul>
*
* @since 1.0.0
*/
public record Offer(String id, String title, String objective, String experimentDescription) {

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package life.qbic.finances.api;

/**
* <b>Offer summary</b>
*
* <p>Holds title and id of an offer</p>
*
* @since 1.0.0
*/
public record OfferSummary(String title, String offerId) {

}
28 changes: 28 additions & 0 deletions finances-infrastructure/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>life.qbic</groupId>
<artifactId>datamanager</artifactId>
<version>0.29.0</version>
</parent>

<artifactId>finances-infrastructure</artifactId>

<properties>
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>life.qbic</groupId>
<artifactId>finances</artifactId>
<version>0.29.0</version>
<scope>compile</scope>
</dependency>
</dependencies>

</project>
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package life.qbic.projectmanagement.infrastructure;
package life.qbic.finance.infrastructure;

import java.util.List;
import life.qbic.controlling.domain.finances.offer.OfferPreview;
import life.qbic.finance.domain.model.OfferPreview;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.repository.PagingAndSortingRepository;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package life.qbic.projectmanagement.infrastructure;
package life.qbic.finance.infrastructure;

import life.qbic.controlling.domain.finances.offer.Offer;
import life.qbic.controlling.domain.finances.offer.OfferId;
import life.qbic.finance.domain.model.Offer;
import life.qbic.finance.domain.model.OfferId;
import org.springframework.data.repository.CrudRepository;

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package life.qbic.projectmanagement.infrastructure;
package life.qbic.finance.infrastructure;

import java.util.Objects;
import org.springframework.data.domain.Pageable;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
package life.qbic.projectmanagement.infrastructure;
package life.qbic.finance.infrastructure;

import java.util.List;
import java.util.Optional;
import life.qbic.controlling.application.finances.offer.OfferSearchService;
import life.qbic.controlling.domain.finances.offer.Offer;
import life.qbic.controlling.domain.finances.offer.OfferId;
import life.qbic.controlling.domain.finances.offer.OfferPreview;
import life.qbic.finance.application.OfferSearchService;
import life.qbic.finance.domain.model.Offer;
import life.qbic.finance.domain.model.OfferId;
import life.qbic.finance.domain.model.OfferPreview;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

Expand Down
6 changes: 6 additions & 0 deletions finances/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,12 @@
<groupId>jakarta.persistence</groupId>
<artifactId>jakarta.persistence-api</artifactId>
</dependency>
<dependency>
<groupId>life.qbic.finances</groupId>
<artifactId>finances-api</artifactId>
<version>0.29.0</version>
<scope>compile</scope>
</dependency>
</dependencies>

</project>

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
package life.qbic.finance.application;

import java.util.List;
import java.util.Optional;
import life.qbic.finance.domain.model.OfferPreview;
import life.qbic.finances.api.FinanceService;
import life.qbic.finances.api.Offer;
import life.qbic.finances.api.OfferSummary;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
* <b>Finance Service</b>
* <p>
* Enables search queries for offers.
*
* @since 1.0.0
*/
@Service
public class FinanceServiceImpl implements FinanceService {

private final OfferSearchService offerSearchService;

@Autowired
public FinanceServiceImpl(
OfferSearchService offerSearchService) {
this.offerSearchService = offerSearchService;
}

private static OfferSummary convert(OfferPreview offerPreview) {
return new OfferSummary(offerPreview.getProjectTitle().title(), offerPreview.offerId().id());
}

private static Offer convert(life.qbic.finance.domain.model.Offer offer) {
return new Offer(offer.offerId().id(), offer.projectTitle().title(),
offer.projectObjective().objective(), offer.experimentalDesignDescription().description());
}

/**
* @inheritDocs
*/
@Override
public List<OfferSummary> findOfferContainingProjectTitleOrId(String projectTitle,
String offerId) {
return offerSearchService.findByProjectTitleOrOfferId(projectTitle, offerId).stream()
.map(FinanceServiceImpl::convert).toList();
}

/**
* @inheritDocs
*/
@Override
public List<OfferSummary> findOfferContainingProjectTitleOrId(String projectTitle, String offerId,
int offset, int limit) {
return offerSearchService.findByProjectTitleOrOfferId(projectTitle, offerId, offset, limit)
.stream().map(FinanceServiceImpl::convert).toList();
}

/**
* @inheritDocs
*/
@Override
public Optional<life.qbic.finances.api.Offer> findOfferById(String offerId) {
return offerSearchService.findByOfferId(offerId).map(FinanceServiceImpl::convert);
}

}
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package life.qbic.controlling.application.finances.offer;
package life.qbic.finance.application;

import java.util.List;
import java.util.Optional;
import life.qbic.controlling.domain.finances.offer.Offer;
import life.qbic.controlling.domain.finances.offer.OfferPreview;
import life.qbic.finance.domain.model.Offer;
import life.qbic.finance.domain.model.OfferPreview;

/**
* <b>OfferPreview Search Service</b>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package life.qbic.controlling.domain.finances.offer;
package life.qbic.finance.domain.model;

import jakarta.persistence.AttributeConverter;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package life.qbic.controlling.domain.finances.offer;
package life.qbic.finance.domain.model;

import jakarta.persistence.Column;
import jakarta.persistence.Convert;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package life.qbic.controlling.domain.finances.offer;
package life.qbic.finance.domain.model;

import jakarta.persistence.AttributeConverter;
import java.util.Objects;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package life.qbic.controlling.domain.finances.offer;
package life.qbic.finance.domain.model;

import static java.util.Objects.requireNonNull;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package life.qbic.controlling.domain.finances.offer;
package life.qbic.finance.domain.model;

import jakarta.persistence.AttributeConverter;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package life.qbic.controlling.domain.finances.offer;
package life.qbic.finance.domain.model;

import jakarta.persistence.AttributeConverter;
import java.util.Objects;
Expand Down
Loading

0 comments on commit 3750208

Please sign in to comment.