-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
18 changed files
with
474 additions
and
433 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package tla.backend.api; | ||
|
||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.web.bind.annotation.RequestMapping; | ||
import org.springframework.web.bind.annotation.RestController; | ||
|
||
import tla.backend.es.model.SentenceEntity; | ||
import tla.backend.service.EntityService; | ||
import tla.backend.service.TokenService; | ||
import tla.domain.dto.SentenceDto; | ||
|
||
@RestController | ||
public class TokenController extends EntityController<SentenceEntity, SentenceDto> { | ||
|
||
@Autowired | ||
private TokenService service; | ||
|
||
@Override | ||
public EntityService<SentenceEntity, ?, SentenceDto> getService() { | ||
return this.service; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
package tla.backend.api; | ||
|
||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.http.HttpStatus; | ||
import org.springframework.http.MediaType; | ||
import org.springframework.http.ResponseEntity; | ||
import org.springframework.web.bind.annotation.PathVariable; | ||
import org.springframework.web.bind.annotation.RequestMapping; | ||
import org.springframework.web.bind.annotation.RequestMethod; | ||
import org.springframework.web.bind.annotation.RestController; | ||
import org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping; | ||
|
||
|
||
@RestController | ||
@RequestMapping("/typeofid") | ||
public class TypeOfIdController { | ||
|
||
//Controller Beginn | ||
@Autowired | ||
private LemmaController lemmaController; | ||
|
||
@Autowired | ||
private SentenceController sentenceController; | ||
|
||
@Autowired | ||
private TextController textController; | ||
|
||
@Autowired | ||
private CorpusObjectController corpusObjectController; | ||
|
||
@Autowired | ||
private ThesaurusController thesaurusController; | ||
|
||
@Autowired | ||
private TokenController tokenController; | ||
//Controller Ende | ||
|
||
@Autowired | ||
private RequestMappingHandlerMapping handlerMapping; | ||
|
||
/** | ||
* checks if id exists and returns index name | ||
*/ | ||
@RequestMapping( | ||
value = "/{id}", | ||
method = RequestMethod.GET, | ||
consumes = MediaType.ALL_VALUE, | ||
produces = MediaType.ALL_VALUE | ||
) | ||
public ResponseEntity<String> getTypeOfId(@PathVariable String id){ | ||
//TODO List of Controller aus Vererbung | ||
EntityController [] controllers = { | ||
lemmaController, | ||
sentenceController, | ||
textController, | ||
corpusObjectController, | ||
thesaurusController, | ||
tokenController | ||
}; | ||
for(EntityController controller : controllers) { | ||
System.out.println(controller.existsById(id)); | ||
if(controller.existsById(id)) { | ||
return new ResponseEntity<String>( | ||
controller.getPath(), | ||
HttpStatus.OK | ||
); | ||
} | ||
} | ||
return new ResponseEntity<String>( | ||
"false", | ||
HttpStatus.OK | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
package tla.backend.es.model; | ||
|
||
import java.util.List; | ||
|
||
import org.springframework.data.elasticsearch.annotations.Document; | ||
import org.springframework.data.elasticsearch.annotations.Field; | ||
import org.springframework.data.elasticsearch.annotations.FieldType; | ||
import org.springframework.data.elasticsearch.annotations.Setting; | ||
|
||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
import lombok.Setter; | ||
import lombok.experimental.SuperBuilder; | ||
import tla.backend.es.model.meta.Recursable; | ||
import tla.backend.es.model.meta.UserFriendlyEntity; | ||
import tla.backend.es.model.parts.ObjectPath; | ||
import tla.backend.es.model.parts.Translations; | ||
import tla.domain.dto.TextDto; | ||
import tla.domain.model.meta.BTSeClass; | ||
import tla.domain.model.meta.TLADTO; | ||
|
||
/** | ||
* Text and Subtext model | ||
*/ | ||
@Getter | ||
@Setter | ||
@SuperBuilder | ||
@NoArgsConstructor | ||
@BTSeClass("BTSText") | ||
@TLADTO(TextDto.class) | ||
@Document(indexName = "text") | ||
@Setting(settingPath = "/elasticsearch/settings/indices/text.json") | ||
public class TextObjectEntity extends UserFriendlyEntity implements Recursable { | ||
|
||
@Field(type = FieldType.Search_As_You_Type, name = "hash") | ||
private String SUID; | ||
|
||
@Field(type = FieldType.Keyword) | ||
private String corpus; | ||
|
||
@Field(type = FieldType.Object) | ||
private ObjectPath[] paths; | ||
|
||
@Field(type = FieldType.Object) | ||
private List<Translations> translations; | ||
|
||
@Field(type = FieldType.Object) | ||
private WordCount wordCount; | ||
|
||
@Getter | ||
@Setter | ||
@NoArgsConstructor | ||
public static class WordCount { | ||
@Field(type = FieldType.Integer) | ||
int min = 0; | ||
@Field(type = FieldType.Integer) | ||
int max = 0; | ||
/** | ||
* for compatibility | ||
*/ | ||
public WordCount(int count) { | ||
this.min = count; | ||
this.max = count; | ||
} | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.