List of usage examples for java.util Objects nonNull
public static boolean nonNull(Object obj)
From source file:org.kitodo.production.helper.VariableReplacer.java
private String getResultAccordingToMetadataLevel(MetadataLevel metadataLevel, String metadata, String resultFirst, String resultTop) { String result = ""; switch (metadataLevel) { case FIRSTCHILD: // without existing FirstChild, this can not be returned if (Objects.isNull(resultFirst)) { logger.info("Can not replace firstChild-variable for METS: {}", metadata); } else {/*from w w w .j av a 2 s.co m*/ result = resultFirst; } break; case TOPSTRUCT: if (Objects.isNull(resultTop)) { logger.warn("Can not replace topStruct-variable for METS: {}", metadata); } else { result = resultTop; } break; case ALL: if (Objects.nonNull(resultFirst)) { result = resultFirst; } else if (Objects.nonNull(resultTop)) { result = resultTop; } else { logger.warn("Can not replace variable for METS: {}", metadata); } break; default: break; } return result; }
From source file:org.eclipse.winery.accountability.AccountabilityManagerImpl.java
protected ModelProvenanceElement verifyManifest(List<ModelProvenanceElement> historyElements, String manifestId, Map<String, File> files, Map<String, ProvenanceVerification> verificationMap, AuthorizationInfo authorizationInfo) throws NoSuchAlgorithmException, IOException { LOGGER.info("Start validating manifest file..."); ModelProvenanceElement validHistoryElement = null; ProvenanceVerification manifestVerification = INVALID; if (Objects.nonNull(historyElements) && historyElements.size() > 0) { File manifestFile = files.remove(manifestId); String checksum = HashingUtil.getChecksum(manifestFile, TOSCAMetaFileAttributes.HASH); for (ModelProvenanceElement element : historyElements) { String retrievedChecksum = HashingUtil.getChecksum( IOUtils.toInputStream(element.getFingerprint(), StandardCharsets.UTF_8), TOSCAMetaFileAttributes.HASH); if (retrievedChecksum.compareTo(checksum) == 0) { validHistoryElement = element; manifestVerification = authorizationInfo.isAuthorized(validHistoryElement.getAuthorAddress()) ? VERIFIED//from w ww .j a v a2 s . c om : UNAUTHORIZED; break; } } } else { manifestVerification = NO_MANIFEST_FILE_IN_PROVENANCE_LAYER; } LOGGER.info("Manifest verification resulted in " + manifestVerification); verificationMap.put(manifestId, manifestVerification); return validHistoryElement; }
From source file:org.kitodo.production.forms.dataeditor.StructurePanel.java
private void buildMediaTreeRecursively(MediaUnit mediaUnit, DefaultTreeNode parentTreeNode) { String displayLabel = mediaUnit.getType(); // TODO translate type with ruleset DefaultTreeNode treeNode = new DefaultTreeNode( new StructureTreeNode(this, displayLabel, false, false, mediaUnit), parentTreeNode); treeNode.setExpanded(true);//from w w w . j ava 2 s .c om if (Objects.nonNull(mediaUnit.getChildren())) { for (MediaUnit child : mediaUnit.getChildren()) { buildMediaTreeRecursively(child, treeNode); } } }
From source file:org.esa.s3tbx.olci.radiometry.rayleigh.RayleighAux.java
public double[] getCosOZARads() { if (Objects.nonNull(cosOZARads)) { return cosOZARads; }//from w ww .j a va2 s . c om throw new NullPointerException("The view zenith angles is null."); }
From source file:org.kitodo.production.forms.MassImportForm.java
private void removeImportFileNameFromSelectedFileNames(ImportObject io) { URI importFileName = io.getImportFileName(); Helper.setErrorMessage("importFailedError", new Object[] { io.getProcessTitle(), io.getErrorMessage() }); if (Objects.nonNull(importFileName) && !ServiceManager.getFileService().getFileName(importFileName).isEmpty() && Objects.nonNull(selectedFilenames) && !selectedFilenames.isEmpty()) { selectedFilenames.remove(importFileName.getRawPath()); }/*from w ww. j a v a 2 s .com*/ }
From source file:org.esa.s3tbx.olci.radiometry.rayleigh.RayleighAux.java
public void setCosOZARads(double[] zenithAnglesRad) { if (Objects.nonNull(zenithAnglesRad)) { cosOZARads = Arrays.stream(zenithAnglesRad).map(Math::cos).toArray(); }//from w w w . j a va 2 s .com }
From source file:org.kitodo.production.services.data.ProcessService.java
private BoolQueryBuilder createUserProcessesQuery(Map filters) throws DataException { BoolQueryBuilder query = new BoolQueryBuilder(); if (Objects.nonNull(filters) && !filters.isEmpty()) { query.must(readFilters(filters)); }/*from w w w . java 2 s. c om*/ query.must(createUserProjectQuery()); if (!this.showClosedProcesses) { query.mustNot(getQuerySortHelperStatus(true)); } if (!this.showInactiveProjects) { query.mustNot(getQueryProjectActive(false)); } return query; }
From source file:org.kitodo.production.exporter.ExportXmlLog.java
private Element preparePropertyElement(Namespace xmlns, Property property) { Element propertyElement = new Element(PROPERTY, xmlns); propertyElement.setAttribute(PROPERTY_IDENTIFIER, property.getTitle()); if (Objects.nonNull(property.getValue())) { propertyElement.setAttribute(VALUE, replacer(property.getValue())); } else {//w w w. ja va 2 s. c o m propertyElement.setAttribute(VALUE, ""); } return propertyElement; }
From source file:org.kitodo.export.ExportDms.java
private void asyncExportWithImport(Process process, LegacyMetsModsDigitalDocumentHelper gdzfile, URI userHome) throws IOException { String fileFormat = process.getProject().getFileFormatDmsExport(); if (Objects.nonNull(exportDmsTask)) { exportDmsTask.setWorkDetail(atsPpnBand + ".xml"); }//from w ww .j a va 2s. c o m if (MetadataFormat.findFileFormatsHelperByName(fileFormat) == MetadataFormat.METS) { // if METS, then write by writeMetsFile... writeMetsFile(process, fileService.createResource(userHome, File.separator + atsPpnBand + ".xml"), gdzfile); } else { // ...if not, just write a fileformat gdzfile.write(userHome + File.separator + atsPpnBand + ".xml"); } // if necessary, METS and RDF should be written in the export if (MetadataFormat.findFileFormatsHelperByName(fileFormat) == MetadataFormat.METS_AND_RDF) { writeMetsFile(process, fileService.createResource(userHome, File.separator + atsPpnBand + ".mets.xml"), gdzfile); } Helper.setMessage(process.getTitle() + ": ", "DMS-Export started"); if (!ConfigCore.getBooleanParameterOrDefaultValue(ParameterCore.EXPORT_WITHOUT_TIME_LIMIT)) { exportWithTimeLimit(process); } if (Objects.nonNull(exportDmsTask)) { exportDmsTask.setProgress(100); } }
From source file:org.esa.s3tbx.olci.radiometry.rayleigh.RayleighAux.java
public double[] getSinSZARads() { if (Objects.nonNull(sinSZARads)) { return sinSZARads; }/*from w w w . java2 s. c om*/ throw new NullPointerException("The sun zenith angles is null."); }