List of usage examples for java.util Objects isNull
public static boolean isNull(Object obj)
From source file:com.epam.dlab.backendapi.dao.ComputationalDAO.java
/** * Checks if computational resource exists. * * @param user user name./*from www . j av a2 s . c o m*/ * @param exploratoryName the name of exploratory. * @param computationalName the name of computational resource. */ public boolean isComputationalExist(String user, String exploratoryName, String computationalName) { return !Objects.isNull(fetchComputationalFields(user, exploratoryName, computationalName)); }
From source file:org.kitodo.production.forms.IndexingForm.java
private SearchService getService(ObjectType objectType) { if (!searchServices.containsKey(objectType) || Objects.isNull(searchServices.get(objectType))) { switch (objectType) { case BATCH: searchServices.put(objectType, ServiceManager.getBatchService()); break; case DOCKET: searchServices.put(objectType, ServiceManager.getDocketService()); break; case PROCESS: searchServices.put(objectType, ServiceManager.getProcessService()); break; case PROJECT: searchServices.put(objectType, ServiceManager.getProjectService()); break; case PROPERTY: searchServices.put(objectType, ServiceManager.getPropertyService()); break; case RULESET: searchServices.put(objectType, ServiceManager.getRulesetService()); break; case TASK: searchServices.put(objectType, ServiceManager.getTaskService()); break; case TEMPLATE: searchServices.put(objectType, ServiceManager.getTemplateService()); break; case WORKFLOW: searchServices.put(objectType, ServiceManager.getWorkflowService()); break; case FILTER: searchServices.put(objectType, ServiceManager.getFilterService()); break; default:/* w w w.ja va2s . com*/ return null; } } return searchServices.get(objectType); }
From source file:org.cloudfoundry.identity.client.UaaContextFactory.java
/** * Sets the requested scopes on the resource details, if and only if the requested scopes are not null * @param tokenRequest the token request containing the requested scopes, if any * @param details the details object that will be configured *///from ww w .j a v a 2 s . co m protected void setRequestScopes(TokenRequest tokenRequest, BaseOAuth2ProtectedResourceDetails details) { if (!Objects.isNull(tokenRequest.getScopes())) { details.setScope(new LinkedList(tokenRequest.getScopes())); } }
From source file:org.openecomp.sdc.validation.impl.util.ResourceValidationHeatValidator.java
private static void initVisitedPortsMap(String filename, Map<String, Resource> resourceMap, Map<String, Integer> numberOfVisitsInPort, GlobalValidationContext globalContext) { for (Map.Entry<String, Resource> resourceEntry : resourceMap.entrySet()) { String resourceType = resourceEntry.getValue().getType(); if (Objects.isNull(resourceType)) { globalContext.addMessage(filename, ErrorLevel.WARNING, ErrorMessagesFormatBuilder.getErrorWithParameters( Messages.INVALID_RESOURCE_TYPE.getErrorMessage(), "null", resourceEntry.getKey())); } else {//from ww w.j av a2 s . c om if (resourceType.equals(HeatResourcesTypes.NEUTRON_PORT_RESOURCE_TYPE.getHeatResource())) { numberOfVisitsInPort.put(resourceEntry.getKey(), 0); } } } }
From source file:com.mac.holdempoker.app.impl.util.HandMatrix.java
@Override public int compare(Card o1, Card o2) { if (Objects.nonNull(o1) && Objects.nonNull(o2)) { return o1.compareTo(o2); } else if (Objects.isNull(o1)) { return 1; } else {/* w w w . ja v a2 s. c o m*/ return -1; } }
From source file:org.kitodo.production.services.command.KitodoScriptService.java
private boolean isActionParameterInvalid(String parameter) { if (Objects.isNull(this.parameters.get(parameter)) || Objects.equals(this.parameters.get(parameter), "")) { Helper.setErrorMessage(KITODO_SCRIPT_FIELD, "missing parameter: ", parameter); return true; }/*from w w w . j a v a 2 s . c o m*/ return false; }
From source file:org.kitodo.production.services.data.TaskService.java
/** * Performs creating images when this happens automatically in a task. * * @param executingThread/* w ww .j av a 2 s .c o m*/ * Executing thread (displayed in the taskmanager) * @param task * Task that generates images * @param automatic * Whether it is an automatic task * @throws DataException * if the task cannot be saved */ public void generateImages(EmptyTask executingThread, Task task, boolean automatic) throws DataException { try { Process process = task.getProcess(); Subfolder sourceFolder = new Subfolder(process, process.getProject().getGeneratorSource()); List<Subfolder> foldersToGenerate = SubfolderFactoryService.createAll(process, task.getContentFolders()); ImageGenerator generator = new ImageGenerator(sourceFolder, GenerationMode.ALL, foldersToGenerate); generator.setSupervisor(executingThread); generator.run(); finishOrReturnAutomaticTask(task, automatic, Objects.isNull(executingThread.getException())); } catch (IOException e) { Helper.setErrorMessage(e.getLocalizedMessage(), logger, e); } }
From source file:it.greenvulcano.gvesb.api.controller.GvConfigurationControllerRest.java
@GET @Path("/deploy/xml/{name}") @Produces(MediaType.APPLICATION_XML)/*from ww w . j a va 2 s . co m*/ @RolesAllowed({ Authority.ADMINISTRATOR, Authority.MANAGER }) public Document getConfigurationFile(@PathParam("name") String name) { Document document = null; try { document = XMLConfig.getDocument(name); } catch (XMLConfigException e) { if (e.getCause() instanceof FileNotFoundException) { throw new WebApplicationException(Response.status(Response.Status.NOT_FOUND) .entity("<error><![CDATA[File not found: " + name + "]]></error>").build()); } LOG.error("Failed to retrieve configuration file " + name, e); throw new WebApplicationException(Response.status(Response.Status.SERVICE_UNAVAILABLE) .entity("<error><![CDATA[" + e.getMessage() + "]]></error>").build()); } if (Objects.isNull(document)) throw new WebApplicationException(Response.status(Response.Status.NOT_FOUND) .entity("<error><![CDATA[File not found: " + name + "]]></error>").build()); return document; }
From source file:org.kitodo.services.data.LdapServerService.java
private BasicAttribute proceedPassword(String identifier, String newPassword, JDKMessageDigest.MD4 digester) { try {//from w w w . j a v a2 s. co m byte[] hash; if (Objects.isNull(digester)) { hash = LdapUser.lmHash(newPassword); } else { hash = digester.digest(newPassword.getBytes("UnicodeLittleUnmarked")); } return new BasicAttribute(identifier, LdapUser.toHexString(hash)); // TODO: Don't catch super class exception, make sure that // the password isn't logged here } catch (InvalidKeyException | UnsupportedEncodingException | NoSuchAlgorithmException | NoSuchPaddingException | IllegalBlockSizeException | BadPaddingException | RuntimeException e) { logger.error(e.getMessage(), e); return null; } }
From source file:org.kitodo.production.services.data.LdapServerService.java
private BasicAttribute proceedPassword(String identifier, String newPassword, JDKMessageDigest.MD4 digester) { try {/*ww w.java2s . c om*/ byte[] hash; if (Objects.isNull(digester)) { hash = LdapUser.lmHash(newPassword); } else { hash = digester.digest(newPassword.getBytes(StandardCharsets.UTF_16LE)); } return new BasicAttribute(identifier, LdapUser.toHexString(hash)); // TODO: Don't catch super class exception, make sure that // the password isn't logged here } catch (InvalidKeyException | NoSuchAlgorithmException | NoSuchPaddingException | IllegalBlockSizeException | BadPaddingException | RuntimeException e) { logger.error(e.getMessage(), e); return null; } }