use of com.opentext.ia.sdk.dto.Contents in project infoarchive-sip-sdk by Enterprise-Content-Management.
the class PropertiesBasedApplicationConfigurer method ensureContents.
private void ensureContents(LinkContainer state, String configurationName, String format) throws IOException {
Contents contents = restClient.follow(state, LINK_CONTENTS, Contents.class);
if (contents.hasItems()) {
return;
}
String content = configured(configurationName);
try (InputStream stream = new ByteArrayInputStream(content.getBytes(StandardCharsets.UTF_8))) {
perform(() -> restClient.post(state.getUri(LINK_CONTENTS), null, new TextPart("content", MediaTypes.HAL, "{ \"format\": \"" + format + "\" }"), new BinaryPart("file", stream, configurationName)));
}
}
Aggregations