Skip to content

Commit 507f2b3

Browse files
authored
Merge pull request #195 from rosette-api/WS-2589-remove-genre-from-entities-example
WS-2589: Remove genre option from entities example & deprecated
2 parents f56ee5b + e1c5f06 commit 507f2b3

File tree

4 files changed

+75
-41
lines changed

4 files changed

+75
-41
lines changed

json/src/main/java/com/basistech/rosette/apimodel/jackson/AdmRequestMixin.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ protected AdmRequestMixin(
3636
@JsonProperty("profileId") String profileId,
3737
@JsonProperty("text") AnnotatedText text,
3838
@JsonProperty("options") Options options,
39-
@JsonProperty("genre") String genre,
39+
@Deprecated @JsonProperty("genre") String genre,
4040
@JsonProperty("language") LanguageCode language
4141
) {
4242
//

json/src/main/java/com/basistech/rosette/apimodel/jackson/DocumentRequestMixin.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ protected DocumentRequestMixin(
4747
@JsonProperty("content") Object content,
4848
@JsonProperty("contentUri") String contentUri,
4949
@JsonProperty("contentType") String contentType,
50-
@JsonProperty("genre") String genre,
50+
@Deprecated @JsonProperty("genre") String genre,
5151
@JsonProperty("options") Options options
5252
) {
5353
//

model/src/main/java/com/basistech/rosette/apimodel/AdmRequest.java

Lines changed: 32 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
/*
2-
* Copyright 2017 Basis Technology Corp.
3-
*
4-
* Licensed under the Apache License, Version 2.0 (the "License");
5-
* you may not use this file except in compliance with the License.
6-
* You may obtain a copy of the License at
7-
*
8-
* http://www.apache.org/licenses/LICENSE-2.0
9-
*
10-
* Unless required by applicable law or agreed to in writing, software
11-
* distributed under the License is distributed on an "AS IS" BASIS,
12-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13-
* See the License for the specific language governing permissions and
14-
* limitations under the License.
15-
*/
2+
* Copyright 2017 Basis Technology Corp.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
1616
package com.basistech.rosette.apimodel;
1717

1818
import com.basistech.rosette.dm.AnnotatedText;
@@ -41,19 +41,33 @@ public final class AdmRequest<O extends Options> extends Request {
4141
/**
4242
* @return genre
4343
*/
44+
@Deprecated
4445
private final String genre;
4546

4647
/**
4748
* @return language
4849
*/
4950
private final LanguageCode language;
5051

52+
53+
public AdmRequest(String profileId,
54+
AnnotatedText text,
55+
O options,
56+
LanguageCode language) {
57+
super(profileId);
58+
this.text = text;
59+
this.options = options;
60+
this.genre = null;
61+
this.language = language;
62+
}
63+
64+
5165
@Builder // workaround for inheritance https://github.com/rzwitserloot/lombok/issues/853
5266
public AdmRequest(String profileId,
53-
AnnotatedText text,
54-
O options,
55-
String genre,
56-
LanguageCode language) {
67+
AnnotatedText text,
68+
O options,
69+
@Deprecated String genre,
70+
LanguageCode language) {
5771
super(profileId);
5872
this.text = text;
5973
this.options = options;

model/src/main/java/com/basistech/rosette/apimodel/DocumentRequest.java

Lines changed: 41 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
/*
2-
* Copyright 2017 Basis Technology Corp.
3-
*
4-
* Licensed under the Apache License, Version 2.0 (the "License");
5-
* you may not use this file except in compliance with the License.
6-
* You may obtain a copy of the License at
7-
*
8-
* http://www.apache.org/licenses/LICENSE-2.0
9-
*
10-
* Unless required by applicable law or agreed to in writing, software
11-
* distributed under the License is distributed on an "AS IS" BASIS,
12-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13-
* See the License for the specific language governing permissions and
14-
* limitations under the License.
15-
*/
2+
* Copyright 2017 Basis Technology Corp.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
1616

1717
package com.basistech.rosette.apimodel;
1818

@@ -44,9 +44,6 @@
4444
* In this object the 'content' item is an {@link Object}; it contains a {@link String}
4545
* for plain text, or an {@link java.io.InputStream} for binary data. {@link DocumentRequest.DocumentRequestBuilder}
4646
* provides several alternative methods for setting this information.
47-
*
48-
* This class includes a 'genre' field. If no genre is specified, then the system
49-
* applies generic processing. Valid values for genre are specified in the API documentation.
5047
*/
5148
@Value
5249
public final class DocumentRequest<O extends Options> extends Request {
@@ -74,20 +71,37 @@ public final class DocumentRequest<O extends Options> extends Request {
7471
/**
7572
* @return request genre
7673
*/
74+
@Deprecated
7775
private final String genre;
7876

7977
/**
8078
* @return request options
8179
*/
8280
private final O options;
8381

82+
83+
public DocumentRequest(String profileId,
84+
LanguageCode language,
85+
Object content,
86+
String contentUri,
87+
String contentType,
88+
O options) {
89+
super(profileId);
90+
this.language = language;
91+
this.content = content;
92+
this.contentUri = contentUri;
93+
this.contentType = contentType;
94+
this.genre = null;
95+
this.options = options;
96+
}
97+
8498
@Builder // workaround for inheritance https://github.com/rzwitserloot/lombok/issues/853
8599
public DocumentRequest(String profileId,
86100
LanguageCode language,
87101
Object content,
88102
String contentUri,
89103
String contentType,
90-
String genre,
104+
@Deprecated String genre,
91105
O options) {
92106
super(profileId);
93107
this.language = language;
@@ -100,6 +114,7 @@ public DocumentRequest(String profileId,
100114

101115
/**
102116
* get content to process if it's a String.
117+
*
103118
* @return the content if a String, else null.
104119
*/
105120
public String getContent() {
@@ -112,18 +127,20 @@ public String getContent() {
112127

113128
/**
114129
* get the content as an array of bytes
130+
*
115131
* @return the content as bytes
116132
*/
117133
public InputStream getContentBytes() {
118134
if (content instanceof InputStream) {
119-
return (InputStream)content;
135+
return (InputStream) content;
120136
} else {
121137
return null;
122138
}
123139
}
124140

125141
/**
126142
* get content as an object
143+
*
127144
* @return the content as object
128145
*/
129146
public Object getRawContent() {
@@ -134,6 +151,7 @@ public Object getRawContent() {
134151
public static class DocumentRequestBuilder<O extends Options> {
135152
/**
136153
* Specify the content as String. Use this for plain text.
154+
*
137155
* @param data The data.
138156
* @return this.
139157
*/
@@ -145,7 +163,8 @@ public DocumentRequestBuilder<O> content(String data) {
145163
/**
146164
* Specify the content as bytes with a content type. Use this for
147165
* formats other than plain text.
148-
* @param bytes The data.
166+
*
167+
* @param bytes The data.
149168
* @param contentType the content type.
150169
* @return this.
151170
*/
@@ -158,7 +177,8 @@ public DocumentRequestBuilder<O> content(byte[] bytes, String contentType) {
158177
/**
159178
* Specify the content as bytes with a content type. Use this for
160179
* formats other than plain text.
161-
* @param bytes The data.
180+
*
181+
* @param bytes The data.
162182
* @param contentType the content type.
163183
* @return this.
164184
*/

0 commit comments

Comments
 (0)