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