-
Notifications
You must be signed in to change notification settings - Fork 63
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4924 from effective-webwork/calendar
Improve newspaper creation
- Loading branch information
Showing
18 changed files
with
578 additions
and
182 deletions.
There are no files selected for viewing
44 changes: 44 additions & 0 deletions
44
Kitodo/src/main/java/org/kitodo/production/converter/ProcessDetailConverter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
/* | ||
* (c) Kitodo. Key to digital objects e. V. <[email protected]> | ||
* | ||
* This file is part of the Kitodo project. | ||
* | ||
* It is licensed under GNU General Public License version 3 or later. | ||
* | ||
* For the full copyright and license information, please read the | ||
* GPL3-License.txt file that was distributed with this source code. | ||
*/ | ||
|
||
package org.kitodo.production.converter; | ||
|
||
import java.util.List; | ||
import java.util.Optional; | ||
|
||
import javax.faces.component.UIComponent; | ||
import javax.faces.context.FacesContext; | ||
import javax.faces.convert.Converter; | ||
import javax.faces.convert.ConverterException; | ||
import javax.inject.Named; | ||
|
||
import org.kitodo.production.forms.createprocess.ProcessDetail; | ||
import org.kitodo.production.forms.createprocess.ProcessFieldedMetadata; | ||
|
||
@Named | ||
public class ProcessDetailConverter implements Converter<ProcessDetail> { | ||
|
||
@Override | ||
public ProcessDetail getAsObject(FacesContext context, UIComponent component, String value) throws ConverterException { | ||
List<ProcessDetail> list = (List<ProcessDetail>) component.getAttributes().get("allMetadataTypes"); | ||
Optional<ProcessDetail> processDetail = list.parallelStream() | ||
.filter(metadata -> metadata.getMetadataID().equals(value)).findFirst(); | ||
return processDetail.orElseGet(ProcessFieldedMetadata::new); | ||
} | ||
|
||
@Override | ||
public String getAsString(FacesContext context, UIComponent component, ProcessDetail value) throws ConverterException { | ||
if (value != null) { | ||
return value.getMetadataID(); | ||
} | ||
return ""; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.