-
Notifications
You must be signed in to change notification settings - Fork 63
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement variable replacer for copy data #4112
Implement variable replacer for copy data #4112
Conversation
403fef5
to
ad864c7
Compare
aca0a1a
to
b5051a9
Compare
5b02879
to
0fd979e
Compare
@@ -19,6 +19,7 @@ | |||
import org.apache.commons.configuration.ConfigurationException; | |||
import org.apache.logging.log4j.LogManager; | |||
import org.apache.logging.log4j.Logger; | |||
import org.kitodo.production.services.ServiceManager; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
import org.kitodo.production.services.ServiceManager; |
import org.kitodo.production.services.data.ImportService; | ||
import org.primefaces.PrimeFaces; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
import org.kitodo.production.services.data.ImportService; | |
import org.primefaces.PrimeFaces; |
import org.kitodo.exceptions.MetadataException; | ||
import org.kitodo.production.helper.Helper; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
import org.kitodo.production.helper.Helper; |
ServiceManager.getMetsService().save(workpiece, out); | ||
ServiceManager.getProcessService().saveToIndex(data.getProcess(), false); | ||
} catch (IOException | CustomResponseException | DataException e) { | ||
System.out.println("log me"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use Helper or logger instead of System.out.println
*/ | ||
protected abstract int getMinObjects(); | ||
for (IncludedStructuralElement child : allIncludedStructuralElements) { | ||
Collection<Metadata> metadata = child.getMetadata(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Collection<Metadata> metadata = child.getMetadata(); |
metadata
is never used
import org.kitodo.data.elasticsearch.exceptions.CustomResponseException; | ||
import org.kitodo.data.exceptions.DataException; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
import org.kitodo.data.elasticsearch.exceptions.CustomResponseException; | |
import org.kitodo.data.exceptions.DataException; |
import org.kitodo.data.elasticsearch.exceptions.CustomResponseException; | ||
import org.kitodo.data.exceptions.DataException; | ||
import org.kitodo.production.helper.metadata.legacytypeimplementations.LegacyMetsModsDigitalDocumentHelper; | ||
import org.kitodo.production.services.ServiceManager; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
import org.kitodo.production.services.ServiceManager; |
List<Metadata> metadataCollectionCopy = new ArrayList<>(); | ||
metadataCollectionCopy.addAll(metadataCollection); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
List<Metadata> metadataCollectionCopy = new ArrayList<>(); | |
metadataCollectionCopy.addAll(metadataCollection); | |
List<Metadata> metadataCollectionCopy = new ArrayList<>(metadataCollection); |
Helper.setMessage("overwriteDataOk", currentProcessTitle); | ||
} | ||
} catch (IOException e) { | ||
Helper.setErrorMessage("overwriteDataError", currentProcessTitle + ":" + e.getMessage(), logger, e); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not sure if this will work. AFAIK only CDI managed beans have access to the FacesContext that is needed to render messages in the frontend pages. (same goes for the other usages of Helper.setMessage
or Helper.setErrorMessage
in this class.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is actually working!
|
||
import java.util.Collection; | ||
import java.util.List; | ||
import java.util.Objects; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
import java.util.Objects; |
List<IncludedStructuralElement> allIncludedStructuralElements = workpiece | ||
.getAllIncludedStructuralElements(); | ||
|
||
IncludedStructuralElement child = allIncludedStructuralElements.get(0); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as above. I think you should check if allIncludedStructuralElements
contains an element before "getting" it.
a5913ba
to
6660bca
Compare
integrates variable replacer for #3368
follow-up PR to #4111