more service changes
This commit is contained in:
parent
8ff0762501
commit
94fce19fc1
|
@ -71,9 +71,14 @@ public class WordFileTransformerService implements FileTransformerClient {
|
|||
}
|
||||
default -> throw new InvalidApplicationException("Invalid type " + fileFormat);
|
||||
};
|
||||
String fileRef = this.storageService.storeFile(bytes);
|
||||
|
||||
FileEnvelopeModel wordFile = new FileEnvelopeModel();
|
||||
if (this.getConfiguration().isUseSharedStorage()) {
|
||||
String fileRef = this.storageService.storeFile(bytes);
|
||||
wordFile.setFileRef(fileRef);
|
||||
} else {
|
||||
wordFile.setFile(bytes);
|
||||
}
|
||||
wordFile.setFilename(filename);
|
||||
return wordFile;
|
||||
}
|
||||
|
@ -90,10 +95,14 @@ public class WordFileTransformerService implements FileTransformerClient {
|
|||
}
|
||||
default -> throw new InvalidApplicationException("Invalid type " + fileFormat);
|
||||
};
|
||||
String fileRef = this.storageService.storeFile(bytes);
|
||||
|
||||
FileEnvelopeModel wordFile = new FileEnvelopeModel();
|
||||
if (this.getConfiguration().isUseSharedStorage()) {
|
||||
String fileRef = this.storageService.storeFile(bytes);
|
||||
wordFile.setFileRef(fileRef);
|
||||
} else {
|
||||
wordFile.setFile(bytes);
|
||||
}
|
||||
wordFile.setFilename(filename);
|
||||
return wordFile;
|
||||
}
|
||||
|
@ -112,10 +121,10 @@ public class WordFileTransformerService implements FileTransformerClient {
|
|||
@Override
|
||||
public FileTransformerConfiguration getConfiguration() {
|
||||
FileTransformerConfiguration configuration = new FileTransformerConfiguration();
|
||||
configuration.setFileTransformerId("docx/pdf");
|
||||
configuration.setFileTransformerId(this.wordFileTransformerServiceProperties.getTransformerId());
|
||||
configuration.setExportVariants(FILE_FORMATS);
|
||||
configuration.setImportVariants(null);
|
||||
configuration.setUseSharedStorage(true);
|
||||
configuration.setUseSharedStorage(this.wordFileTransformerServiceProperties.isUseSharedStorage());
|
||||
return configuration;
|
||||
}
|
||||
|
||||
|
@ -323,13 +332,11 @@ public class WordFileTransformerService implements FileTransformerClient {
|
|||
runInput.setText("Input: ");
|
||||
runInput.setColor("000000");
|
||||
List<ReferenceModel> referenceModels = this.getReferenceModelOfTypeCode(dmpEntity, referenceField.getReferenceType().getCode(), referenceField.getId());
|
||||
if (referenceModels != null) {
|
||||
for (ReferenceModel reference : referenceModels) {
|
||||
XWPFRun runResearcher = systemFieldInput.createRun();
|
||||
runResearcher.setText("• " + reference.getLabel());
|
||||
runResearcher.setColor("116a78");
|
||||
}
|
||||
}
|
||||
|
||||
document.createParagraph();
|
||||
}
|
||||
|
|
|
@ -4,6 +4,8 @@ import org.springframework.boot.context.properties.ConfigurationProperties;
|
|||
|
||||
@ConfigurationProperties(prefix = "word-file-transformer")
|
||||
public class WordFileTransformerServiceProperties {
|
||||
private String transformerId;
|
||||
private boolean useSharedStorage;
|
||||
private String wordDmpTemplate;
|
||||
private String pidTemplate;
|
||||
private String wordDescriptionTemplate;
|
||||
|
@ -16,6 +18,14 @@ public class WordFileTransformerServiceProperties {
|
|||
private String datasetReferenceCode;
|
||||
private String publicationReferenceCode;
|
||||
|
||||
public String getTransformerId() {
|
||||
return transformerId;
|
||||
}
|
||||
|
||||
public void setTransformerId(String transformerId) {
|
||||
this.transformerId = transformerId;
|
||||
}
|
||||
|
||||
public String getOrganizationReferenceCode() {
|
||||
return organizationReferenceCode;
|
||||
}
|
||||
|
@ -103,4 +113,12 @@ public class WordFileTransformerServiceProperties {
|
|||
public void setWordDescriptionTemplate(String wordDescriptionTemplate) {
|
||||
this.wordDescriptionTemplate = wordDescriptionTemplate;
|
||||
}
|
||||
|
||||
public boolean isUseSharedStorage() {
|
||||
return useSharedStorage;
|
||||
}
|
||||
|
||||
public void setUseSharedStorage(boolean useSharedStorage) {
|
||||
this.useSharedStorage = useSharedStorage;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
word-file-transformer:
|
||||
transformerId: "docx/pdf"
|
||||
word-dmp-template: classpath:documents/h2020.docx
|
||||
pid-template: classpath:pidLinks.json
|
||||
word-description-template: classpath:documents/h2020_dataset.docx
|
||||
useSharedStorage: true
|
||||
organizationReferenceCode: "organisations"
|
||||
grantReferenceCode: "grants"
|
||||
funderReferenceCode: "funders"
|
Loading…
Reference in New Issue