This is the codeAbility Sharing Platform! Learn more about the codeAbility Sharing Platform.

Commit 2c2f2050 authored by Michael Breu's avatar Michael Breu 💬
Browse files

Umstellung Search API auf Connector-Interface

parent a376c398
......@@ -4,7 +4,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>org.codeability.sharing</groupId>
<artifactId>SharingPluginPlatformAPI</artifactId>
<version>0.1.2</version>
<version>0.1.3</version>
<name>SharingPluginPlatformAPI</name>
<description>CodeAbility Sharing Plugin Platform API</description>
<packaging>jar</packaging>
......
......@@ -14,10 +14,7 @@ public class SearchInputDTO {
private List<String> selectedFileFormat;
private int page;
/**
* the default page size
*/
public static final int PAGE_SIZE = 10;
private int pageSize = 10;
/**
* empty constructor for JSON.
......@@ -48,7 +45,7 @@ public class SearchInputDTO {
/**
* returns the full text query
* @return
* @return the full text query
*/
public String getFulltextQuery() {
return fulltextQuery;
......@@ -56,7 +53,7 @@ public class SearchInputDTO {
/**
* sets the full text query
* @param fulltextQuery
* @param fulltextQuery the full text query
*/
public void setFulltextQuery(String fulltextQuery) {
this.fulltextQuery = fulltextQuery;
......@@ -64,7 +61,7 @@ public class SearchInputDTO {
/**
* returns the meta data
* @return
* @return the meta data
*/
public SearchInputMetadataDTO getMetadata() {
return metadata;
......@@ -79,40 +76,99 @@ public class SearchInputDTO {
/**
* returns the selected repository.
* @return
* @return the selected repository
* @deprecated not useful
*/
@Deprecated
public List<String> getSelectedRepository() {
return selectedRepository;
}
/**
* sets the selected repository.
* @param selectedRepository the selected repository
* @deprecated not useful
*/
@Deprecated
public void setSelectedRepository(List<String> selectedRepository) {
this.selectedRepository = selectedRepository;
}
/**
* gets the selected university
* @return the selected university
* @deprecated not used
*/
@Deprecated
public List<String> getSelectedUniversity() {
return selectedUniversity;
}
/**
* sets the selected university
* @param selectedUniversity the selected university
* @deprecated not used
*/
@Deprecated
public void setSelectedUniversity(List<String> selectedUniversity) {
this.selectedUniversity = selectedUniversity;
}
/**
*
* @return the selected file format
* @deprecated not used
*/
@Deprecated
public List<String> getSelectedFileFormat() {
return selectedFileFormat;
}
/**
*
* sets the selected file format
* @param selectedFileFormat the selected file format
* @deprecated not used
*/
@Deprecated
public void setSelectedFileFormat(List<String> selectedFileFormat) {
this.selectedFileFormat = selectedFileFormat;
}
/**
* gets the requested page
* @return the requested page
*/
public int getPage() {
return page;
}
/**
* sets the requested page
* @param page the requested page
*/
public void setPage(int page) {
this.page = page;
}
/**
* @return the page size
*/
public int getPageSize() {
return pageSize;
}
/**
* @param pageSize the page size to set
*/
public void setPageSize(int pageSize) {
this.pageSize = pageSize;
}
/**
* just a convenience method.
* @return true, iff metadata has input.
*/
public boolean hasMetadataInput() {
return this.metadata.hasMetadataInput();
}
......
package org.codeability.sharing.plugins.api.search;
import java.util.List;
import java.util.stream.Collectors;
import org.codeability.sharing.plugins.api.search.UserProvidedMetadataDTO.ExerciseType;
/**
* transfers the queried meta data
* @author Michael Breu
*
*/
public class SearchInputMetadataDTO {
private String programmingLanguage;
private String keyword;
......@@ -11,26 +17,69 @@ public class SearchInputMetadataDTO {
private String license;
private String author;
private List<UserProvidedMetadataDTO.ExerciseType> types;
private String format;
/**
* just for JSON
*/
public SearchInputMetadataDTO() {
// JSON
}
/**
* a convenience constructor.
* @param programmingLanguage the programmingLanguage
* @param keyword the keywords
* @param naturalLanguage the list of requested languages
* @param license the license(s)
* @param author the author
* @param format the format
*/
public SearchInputMetadataDTO(String programmingLanguage,
String keyword,
List<String> naturalLanguage,
String license,
String author) {
String author,
String format) {
this.programmingLanguage = mapEmptyString(programmingLanguage);
this.keyword = mapEmptyString(keyword);
this.naturalLanguage = naturalLanguage;
this.license = mapEmptyString(license);
this.author = mapEmptyString(author);
this.naturalLanguage = naturalLanguage;
this.format = mapEmptyString(format);
}
/**
* just a helper method to convert from list to string
* @param str the array of strings
* @return the concatenated strings
*/
private static List<String> mapEmptyString(List<String> str) {
if(str==null) return null;
return str.stream().map(s -> "".equals(s) ? null : s).collect(Collectors.toList());
}
/**
* just a helper method to deal with null strings
* @param str the string
* @return an empty string.
*/
private static String mapEmptyString(String str) {
return "".equals(str) ? null : str;
}
/**
*
* @return the format
*/
public String getFormat() {
return format;
}
public void setFormat(String format) {
this.format = format;
}
public boolean hasMetadataInput() {
return !(programmingLanguage == null
&& keyword == null
......@@ -38,42 +87,91 @@ public class SearchInputMetadataDTO {
&& license == null);
}
/**
* the programming language
* @return the programming language
*/
public String getProgrammingLanguage() {
return programmingLanguage;
}
/**
*
* @param programmingLanguage the programming language
*/
public void setProgrammingLanguage(String programmingLanguage) {
this.programmingLanguage = mapEmptyString(programmingLanguage);
}
/**
* a string containing the keywords
* @return a string containing the keywords
*/
public String getKeyword() {
return keyword;
}
/**
*
* @param keyword a string containing the keywords
*/
public void setKeyword(String keyword) {
this.keyword = mapEmptyString(keyword);
}
/**
*
* @return the selected natural languages
*/
public List<String> getNaturalLanguage() {
return naturalLanguage;
}
public void setNaturalLanguage(List<String> naturalLanguage) {
this.naturalLanguage = naturalLanguage;
/**
*
* @return the selected natural languages
*/
public String getNaturalLanguagesAsString() {
return naturalLanguage==null?"null":
naturalLanguage.stream().collect(Collectors.joining(", "));
}
/**
*
* @param naturalLanguages the list of selected natural languages
*/
public void setNaturalLanguage(List<String> naturalLanguages) {
this.naturalLanguage = mapEmptyString(naturalLanguages);
}
/**
* the license
* @return the requested license
*/
public String getLicense() {
return license;
}
/**
*
* @param license the requested license
*/
public void setLicense(String license) {
this.license = mapEmptyString(license);
}
/**
*
* @return the author
*/
public String getAuthor() {
return author;
}
/**
* setter for author
* @param author the author
*/
public void setAuthor(String author) {
this.author = mapEmptyString(author);
}
......@@ -92,12 +190,16 @@ public class SearchInputMetadataDTO {
this.types = types;
}
/**
* to string
*/
@Override
public String toString() {
return "programmingLanguage: " + this.programmingLanguage
+ ", keyword: " + this.keyword
+ ", naturalLanguage: " + this.naturalLanguage.toString()
+ ", naturalLanguage: " + getNaturalLanguagesAsString()
+ ", license: " + this.license
+ ", author: " + this.author;
+ ", author: " + this.author
+ ", format: " + this.format;
}
}
<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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.codeability.sharing</groupId>
<artifactId>SharingPluginPlatformAPI</artifactId>
<version>0.1.3</version>
<name>SharingPluginPlatformAPI</name>
<description>CodeAbility Sharing Plugin Platform API</description>
<packaging>jar</packaging>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<!-- Plugin versions -->
<maven-clean-plugin.version>3.1.0</maven-clean-plugin.version>
<maven-compiler-plugin.version>3.8.1</maven-compiler-plugin.version>
<maven-javadoc-plugin.version>3.2.0</maven-javadoc-plugin.version>
<maven-eclipse-plugin.version>2.10</maven-eclipse-plugin.version>
<maven-enforcer-plugin.version>3.0.0-M3</maven-enforcer-plugin.version>
<maven-failsafe-plugin.version>3.0.0-M4</maven-failsafe-plugin.version>
<maven-idea-plugin.version>2.2.1</maven-idea-plugin.version>
<maven-resources-plugin.version>3.1.0</maven-resources-plugin.version>
<maven-surefire-plugin.version>3.0.0-M4</maven-surefire-plugin.version>
<maven-war-plugin.version>3.2.3</maven-war-plugin.version>
<maven-checkstyle.version>3.1.1</maven-checkstyle.version>
<checkstyle.version>8.32</checkstyle.version>
<spring-nohttp-checkstyle.version>0.0.4.RELEASE</spring-nohttp-checkstyle.version>
<frontend-maven-plugin.version>1.10.0</frontend-maven-plugin.version>
<git-commit-id-plugin.version>4.0.0</git-commit-id-plugin.version>
<jacoco-maven-plugin.version>0.8.5</jacoco-maven-plugin.version>
<jib-maven-plugin.version>2.4.0</jib-maven-plugin.version>
<lifecycle-mapping.version>1.0.0</lifecycle-mapping.version>
<properties-maven-plugin.version>1.0.0</properties-maven-plugin.version>
<sonar-maven-plugin.version>3.7.0.1746</sonar-maven-plugin.version>
</properties>
<dependencies>
<!-- https://mvnrepository.com/artifact/com.fasterxml.jackson.module/jackson-module-jaxb-annotations -->
<dependency>
<groupId>com.fasterxml.jackson.module</groupId>
<artifactId>jackson-module-jaxb-annotations</artifactId>
<version>2.10.4</version>
</dependency>
</dependencies>
<distributionManagement>
<repository>
<id>target</id>
<name>Local target repository, to be promoted to git</name>
<url>file://${project.basedir}/target</url>
<layout>default</layout>
</repository>
</distributionManagement>
<build>
<defaultGoal>package</defaultGoal>
<sourceDirectory>src</sourceDirectory>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<source>11</source>
<target>11</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>${maven-checkstyle.version}</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>${maven-javadoc-plugin.version}</version>
<executions>
<execution>
<id>attach-javadocs</id>
<phase>deploy</phase>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-eclipse-plugin</artifactId>
<version>${maven-eclipse-plugin.version}</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>${maven-failsafe-plugin.version}</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-idea-plugin</artifactId>
<version>${maven-idea-plugin.version}</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>${maven-resources-plugin.version}</version>
<!-- unused <executions> <execution> <id>deploy-to-local-directory</id>
<phase>install</phase> <goals> <goal>copy-resources</goal> </goals> <configuration>
<outputDirectory>./target</outputDirectory> <resources> <resource> <directory>${project.build.directory}</directory>
<includes> <include>${project.build.finalName}.jar</include> </includes>
<filtering>false</filtering> </resource> </resources> </configuration> </execution>
</executions> -->
</plugin>
<plugin>
<artifactId>maven-source-plugin</artifactId>
<executions>
<execution>
<id>attach-sources</id>
<phase>deploy</phase>
<goals>
<goal>jar-no-fork</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>${maven-surefire-plugin.version}</version>
</plugin>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>${jacoco-maven-plugin.version}</version>
</plugin>
<plugin>
<groupId>org.sonarsource.scanner.maven</groupId>
<artifactId>sonar-maven-plugin</artifactId>
<version>${sonar-maven-plugin.version}</version>
</plugin>
</plugins>
</build>
</project>
\ No newline at end of file
......@@ -3,7 +3,7 @@
<groupId>org.codeability.sharing</groupId>
<artifactId>SharingPluginPlatformAPI</artifactId>
<versioning>
<release>0.1.2</release>
<release>0.1.3</release>
<versions>
<version>0.0.1</version>
<version>0.0.2</version>
......@@ -11,7 +11,9 @@
<version>0.1.0-Snapshot</version>
<version>0.1.1</version>
<version>0.1.2</version>
<version>0.1.3-SNAPSHOT</version>
<version>0.1.3</version>
</versions>
<lastUpdated>20210520154924</lastUpdated>
<lastUpdated>20210601113927</lastUpdated>
</versioning>
</metadata>
3dd5222ac4ffea0664f0fdc233282249
\ No newline at end of file
afa4c80578308458ad4562dcc095e756
\ No newline at end of file
b1ef5a336ed6fba6b1413f9ed3579c83a51a0031
\ No newline at end of file
672a16496a1ed8972bdf4aaafa07442d8cfeb2e0
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment