List of usage examples for java.util Objects isNull
public static boolean isNull(Object obj)
From source file:org.kitodo.filemanagement.FileManagement.java
@Override public URI rename(URI uri, String newName) throws IOException { if (Objects.isNull(uri) || Objects.isNull(newName)) { return null; }/*from w w w . j a va 2 s. co m*/ String substring = uri.toString().substring(0, uri.toString().lastIndexOf('/') + 1); if (newName.contains("/")) { newName = newName.substring(newName.lastIndexOf('/') + 1); } URI newFileUri = URI.create(substring + newName); URI mappedFileURI = fileMapper.mapUriToKitodoDataDirectoryUri(uri); URI mappedNewFileURI = fileMapper.mapUriToKitodoDataDirectoryUri(newFileUri); if (!fileExist(mappedFileURI)) { logger.debug("File {} does not exist for renaming.", uri.getPath()); throw new FileNotFoundException(uri + " does not exist for renaming."); } if (fileExist(mappedNewFileURI)) { String message = "Renaming of " + uri + " into " + newName + " failed: Destination exists."; logger.error(message); throw new IOException(message); } return performRename(mappedFileURI, mappedNewFileURI); }
From source file:org.kitodo.production.process.field.AdditionalField.java
/** * Set init start./*from w w w. j a v a 2 s . c om*/ * * @param newValue * String */ public void setInitStart(String newValue) { this.initStart = newValue; if (Objects.isNull(this.initStart)) { this.initStart = ""; } this.value = this.initStart + this.value; }
From source file:org.opendaylight.sxp.csit.libraries.DeviceTestLibrary.java
/** * @param nodeId NodeId of local SXP device * @return JSON formatted content of MasterDatabase * @throws JsonProcessingException If any error occurs during JSON generation *///from ww w.j a v a2 s . c o m @RobotKeyword("Get Master Database") @ArgumentNames({ "node_id" }) public synchronized String getMasterDatabase(String nodeId) throws JsonProcessingException { SxpNode node = LibraryServer.getNode(Objects.requireNonNull(nodeId)); if (Objects.isNull(node)) return "{\"output\":{\"binding\":[]}}"; return "{\"output\":{\"binding\":" + pojoBindingsSerializer.writeValueAsString( node.getDomain(SxpNode.DEFAULT_DOMAIN).getMasterDatabase().getBindings()) + "}}"; }
From source file:org.esa.s3tbx.olci.radiometry.rayleigh.RayleighAux.java
public double[] getAltitudes() { if (Objects.isNull(altitudes)) { double[] longitudes = getLongitude(); double[] latitudes = getLatitudes(); if (Objects.nonNull(longitudes) && Objects.nonNull(latitudes)) { double[] elevation = new double[latitudes.length]; for (int i = 0; i < longitudes.length; i++) { try { elevation[i] = elevationModel.getElevation(new GeoPos(latitudes[i], longitudes[i])); } catch (Exception e) { e.printStackTrace(); }//from w w w . j a va 2s . c o m } altitudes = elevation; } } return altitudes; }
From source file:org.dbflute.intro.app.web.welcome.WelcomeAction.java
private ProjectInfra prepareProjectMeta(ClientPart clientBody) { if (Objects.isNull(clientBody.jdbcDriver)) { return new ProjectInfra(clientBody.projectName, clientBody.dbfluteVersion); }/* www . j ava 2 s. c om*/ ExtlibFile extlibFile = clientPhysicalLogic.createExtlibFile(clientBody.projectName, clientBody.jdbcDriver.fileName, clientBody.jdbcDriver.data); return new ProjectInfra(clientBody.projectName, clientBody.dbfluteVersion, extlibFile); }
From source file:org.openecomp.sdc.tosca.services.impl.ToscaAnalyzerServiceImpl.java
private Optional<Boolean> isNodeTypeExistInImports(String nodeTypeToMatch, String nodeTypeToSearch, ServiceTemplate serviceTemplate, ToscaServiceModel toscaServiceModel, Set<String> analyzedImportFiles) { Map<String, Import> imports = serviceTemplate.getImports(); if (imports == null) { return Optional.empty(); }//w ww . j ava 2 s . c o m analyzedImportFiles = createAnalyzedImportFilesSet(analyzedImportFiles); for (Import anImport : imports.values()) { if (Objects.isNull(anImport) || Objects.isNull(anImport.getFile())) { throw new RuntimeException("import without file entry"); } String importFile = anImport.getFile(); if (analyzedImportFiles.contains(importFile)) { continue; } addImportFileToAnalyzedImportFilesSet(analyzedImportFiles, importFile); ServiceTemplate template = toscaServiceModel.getServiceTemplates().get(importFile); Optional<Boolean> nodeTypeExistInServiceTemplateHierarchy = isNodeTypeExistInServiceTemplateHierarchy( nodeTypeToMatch, nodeTypeToSearch, template, toscaServiceModel, analyzedImportFiles); if (nodeTypeExistInServiceTemplateHierarchy.isPresent()) { if (nodeTypeExistInServiceTemplateHierarchy.get()) { return Optional.of(true); } } } return Optional.of(false); }
From source file:org.kitodo.production.forms.dataeditor.StructurePanel.java
/** * Updates the live structure of a structure tree node and returns it, to * provide for updating the parent. If the tree node contains children which * arent structures, {@code null} is returned to skip them on the level * above.//from w w w. java 2s . c o m */ private static IncludedStructuralElement preserveLogicalRecursive(TreeNode treeNode) { StructureTreeNode structureTreeNode = (StructureTreeNode) treeNode.getData(); if (Objects.isNull(structureTreeNode) || !(structureTreeNode.getDataObject() instanceof IncludedStructuralElement)) { return null; } IncludedStructuralElement structure = (IncludedStructuralElement) structureTreeNode.getDataObject(); List<IncludedStructuralElement> childrenLive = structure.getChildren(); childrenLive.clear(); for (TreeNode child : treeNode.getChildren()) { IncludedStructuralElement maybeChildStructure = preserveLogicalRecursive(child); if (Objects.nonNull(maybeChildStructure)) { childrenLive.add(maybeChildStructure); } } return structure; }
From source file:org.kitodo.production.process.field.AdditionalField.java
/** * Set init end./*from ww w . j a va2s . c om*/ * * @param newValue * String */ public void setInitEnd(String newValue) { this.initEnd = newValue; if (Objects.isNull(this.initEnd)) { this.initEnd = ""; } this.value = this.value + this.initEnd; }
From source file:org.kitodo.forms.WorkflowForm.java
/** * Create new workflow./* w w w.j a v a 2s . c o m*/ * * @return page */ public String newWorkflow() { this.workflow = new Workflow(); return workflowEditPath + "&id=" + (Objects.isNull(this.workflow.getId()) ? 0 : this.workflow.getId()); }
From source file:org.eclipse.winery.repository.rest.resources.entitytemplates.artifacttemplates.FilesResource.java
@GET @Path("/{fileName}") public Response getFile(@PathParam("fileName") String fileName, @HeaderParam("If-Modified-Since") String modified, @QueryParam("path") String path) { path = Objects.isNull(path) ? "" : path; RepositoryFileReference ref = this.fileName2fileRef(fileName, path, true); return RestUtils.returnRepoPath(ref, modified); }