Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/refactoring #94

Merged
merged 12 commits into from
Jun 26, 2024
7 changes: 4 additions & 3 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,12 @@ jobs:

steps:
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v4

- uses: actions/setup-java@v1
- uses: actions/setup-java@v3
with:
java-version: 17
java-version: 21
distribution: temurin

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/maven.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@ jobs:
name: Build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
- name: Set up JDK 17
- name: Set up JDK 21
uses: actions/setup-java@v3
with:
java-version: '17'
java-version: '21'
distribution: 'temurin'
- name: Cache SonarQube packages
uses: actions/cache@v1
Expand Down
14 changes: 14 additions & 0 deletions Infrastructure/templateImport.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"AWSTemplateFormatVersion": "2010-09-09",
"Description": "Import test",
"Resources": {
"ApplicationBackend": {
"Type": "AWS::ElasticBeanstalk::Application",
"DeletionPolicy": "Retain",
"Properties": {
"Description": "ApplicationBackend",
"ApplicationName": "fgai4h-oci-annotation-backend"
}
}
}
}
5 changes: 4 additions & 1 deletion documentation/Contributing.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,10 @@ aws s3 ls --profile ai4h
```
5. Get session ID from ~/.aws/cli/cache/<latest-file>
Use the value from AccessKeyId, SecretAccessKey and SessionToken and set them in the environment variables.

- AWS_ACCESS_KEY_ID=[AccessKeyId];
- AWS_REGION=eu-central-1;
- AWS_SECRET_ACCESS_KEY=[SecretAccessKey];
- AWS_SESSION_TOKEN=[SessionToken];

## Getting Started

Expand Down
80 changes: 70 additions & 10 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,21 @@
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>3.0.4</version>
<version>3.2.5</version>
</parent>
<groupId>org.fgai4h</groupId>
<artifactId>annotation</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>Annotation backend</name>
<description>Annotation backend</description>
<properties>
<java.version>17</java.version>
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
<java.version>21</java.version>
<maven.compiler.source>21</maven.compiler.source>
<maven.compiler.target>21</maven.compiler.target>
<org.mapstruct.version>1.4.2.Final</org.mapstruct.version>
<org.projectlombok.version>1.18.24</org.projectlombok.version>
<org.projectlombok.version>1.18.32</org.projectlombok.version>
</properties>

<dependencyManagement>
<dependencies>
<dependency>
Expand All @@ -35,30 +36,36 @@
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-oauth2-resource-server</artifactId>
<version>3.2.5</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
<version>3.2.5</version>
</dependency>

<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-oauth2-jose</artifactId>
<version>6.2.4</version>
</dependency>

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<version>3.2.5</version>
</dependency>

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-hateoas</artifactId>
<version>3.2.5</version>
</dependency>

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
<version>3.2.5</version>
</dependency>

<dependency>
Expand Down Expand Up @@ -134,6 +141,11 @@
<artifactId>swagger-annotations</artifactId>
<version>2.2.8</version>
</dependency>
<dependency>
<groupId>com.google.code.findbugs</groupId>
<artifactId>jsr305</artifactId>
<version>3.0.2</version>
</dependency>
<dependency>
<groupId>org.mapstruct</groupId>
<artifactId>mapstruct</artifactId>
Expand All @@ -145,6 +157,18 @@
<version>3.12.0</version>
</dependency>

<dependency>
<groupId>com.squareup.okhttp3</groupId>
<artifactId>okhttp</artifactId>
<version>4.12.0</version>
</dependency>

<dependency>
<groupId>com.squareup.okhttp3</groupId>
<artifactId>logging-interceptor</artifactId>
<version>4.12.0</version>
</dependency>

<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
Expand All @@ -156,6 +180,42 @@
<version>17.0.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.10.1</version>
</dependency>

<dependency>
<groupId>io.gsonfire</groupId>
<artifactId>gson-fire</artifactId>
<version>1.9.0</version>
</dependency>

<dependency>
<groupId>javax.annotation</groupId>
<artifactId>javax.annotation-api</artifactId>
<version>1.3.2</version>
</dependency>

<dependency>
<groupId>io.swagger</groupId>
<artifactId>swagger-annotations</artifactId>
<version>1.6.14</version>
</dependency>

<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<version>5.10.1</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>javax.ws.rs</groupId>
<artifactId>javax.ws.rs-api</artifactId>
<version>2.1.1</version>
</dependency>

</dependencies>

Expand All @@ -169,7 +229,7 @@
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.8.8</version>
<version>0.8.11</version>
</plugin>
<plugin>
<groupId>org.springframework.boot</groupId>
Expand All @@ -187,7 +247,7 @@
<groupId>org.openapitools</groupId>
<artifactId>openapi-generator-maven-plugin</artifactId>
<!-- RELEASE_VERSION -->
<version>6.3.0</version>
<version>6.6.0</version>
<!-- /RELEASE_VERSION -->
<executions>
<execution>
Expand Down Expand Up @@ -217,10 +277,10 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<version>3.13.0</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
<source>21</source>
<target>21</target>
<annotationProcessorPaths>
<path>
<groupId>org.mapstruct</groupId>
Expand Down
6 changes: 5 additions & 1 deletion src/main/java/org/fgai4h/ap/DataSourceConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.jdbc.DataSourceBuilder;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
Expand All @@ -16,6 +18,8 @@
@Profile("prod")
public class DataSourceConfig {

private static final Logger LOGGER = LoggerFactory.getLogger(DataSourceConfig.class);

@Bean
public DataSource getDataSource() {
DataSourceBuilder dataSourceBuilder = DataSourceBuilder.create();
Expand All @@ -29,7 +33,7 @@ public DataSource getDataSource() {
dataSourceBuilder.password(secretsJson.get("password").textValue());

} catch (JsonProcessingException e) {
e.printStackTrace();
LOGGER.error("Error processing JSON", e);
}

return dataSourceBuilder.build();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,60 +32,71 @@ public class CampaignEntity implements Serializable {
@Id
@GeneratedValue(generator = "uuid2")
@GenericGenerator(name = "uuid2", strategy = "uuid2")
@Column(columnDefinition = "BINARY(16)")

private UUID campaignUUID;

/**
* The name for the campaign.
*/
private String name;

/**
* The description for the campaign.
*/
private String description;

/**
* The status of the campaign.
*/
private String status;

/**
* The kind of annotation that is to be performed in the campaign.
*/
private String annotationKind;

/**
* The tool that is to be used for annotation.
*/
private String annotationTool;

/**
* The model that is to be used for annotation.
* The pre annotation tool used to pre-process the annotations.
*/
private String preAnnotationTool;

/**
* The model that is to be used for annotation.
*/
private String preAnnotationModel;

/**
* The method that is to be used for annotation.
*/
private String annotationMethod;

/**
* The instructions for annotation.
*/
private String annotationInstructions;

/**
* The quality assurance for annotation.
*/
private String qualityAssurance;

/**
* The kind of quality assurance that is to be performed in the campaign.
*/
private Boolean isInstanceLabel;

/**
* The kind of quality assurance that is to be performed in the campaign.
*/
private Integer minAnnotation;

/**
* The class labels for the campaign.
* The annotation class labels for the campaign.
*/
@OneToMany(mappedBy = "campaignEntity")
private List<ClassLabelEntity> classLabels = new java.util.ArrayList<>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public class ClassLabelEntity implements Serializable
@Id
@GeneratedValue(generator = "uuid2")
@GenericGenerator(name = "uuid2", strategy = "uuid2")
@Column(columnDefinition = "BINARY(16)")

private UUID classLabelUUID;

private String name;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonRootName;
import lombok.*;

import org.fgai4h.ap.domain.dataset.model.DatasetModel;
import org.fgai4h.ap.domain.user.model.UserModel;
import org.springframework.hateoas.RepresentationModel;
Expand Down Expand Up @@ -31,11 +32,15 @@ public class CampaignModel extends RepresentationModel<CampaignModel> {
private List<UserModel> reviewers;
private List<UserModel> supervisors;
private List<ClassLabelModel> classLabels;

private String annotationKind;

private String annotationTool;
private String preAnnotationTool;
private String preAnnotationModel;

private String annotationMethod;

private String annotationInstructions;
private String qualityAssurance;
private Boolean isInstanceLabel;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ public void generateTasks(UUID campaignId) {
List<AnnotationTaskEntity> annotationTaskEntityList = new ArrayList<>();
annotationTaskEntityList.add(annotationTaskRepository.save(AnnotationTaskEntity.builder()
.kind(campaign.getAnnotationKind())
.title(campaign.getAnnotationKind())
.title(String.valueOf(campaign.getAnnotationKind()))
.build()));

for (int i = 0; i < objects.size(); i++) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public class DataAccessRequestEntity {
@Id
@GeneratedValue(generator = "uuid2")
@GenericGenerator(name = "uuid2", strategy = "uuid2")
@Column(columnDefinition = "BINARY(16)")

private UUID dataAccessRequestUUID;

private LocalDateTime requestDate;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public class DataCatalogEntity implements Serializable {
@Id
@GeneratedValue(generator = "uuid2")
@GenericGenerator(name = "uuid2", strategy = "uuid2")
@Column(columnDefinition = "BINARY(16)")

private UUID dataCatalogUUID;

private String name;
Expand Down
Loading
Loading