List of usage examples for java.util Objects nonNull
public static boolean nonNull(Object obj)
From source file:org.eclipse.hono.service.credentials.impl.FileBasedCredentialsService.java
private JsonObject getCredentials(final String tenantId, final String authId, final String type) { Objects.nonNull(tenantId); Objects.nonNull(authId);/*from w w w. j av a 2 s . c om*/ Objects.nonNull(type); final Map<String, JsonArray> credentialsForTenant = credentials.get(tenantId); if (credentialsForTenant != null) { JsonArray authIdCredentials = credentialsForTenant.get(authId); if (authIdCredentials == null) { return null; } for (Object authIdCredentialEntry : authIdCredentials) { JsonObject authIdCredential = (JsonObject) authIdCredentialEntry; // return the first matching type entry for this authId if (type.equals(authIdCredential.getString(FIELD_TYPE))) { return authIdCredential; } } } return null; }
From source file:org.esa.s3tbx.olci.radiometry.rayleigh.RayleighAux.java
public void setSunAzimuthAnglesRad(double[] sunAzimuthAngles) { if (Objects.nonNull(sunAzimuthAngles)) { sunAzimuthAnglesRad = SmileCorrectionUtils.convertDegreesToRadians(sunAzimuthAngles); }/* w w w . java 2 s. c o m*/ }
From source file:org.esa.s3tbx.olci.radiometry.rayleigh.RayleighAux.java
public double[] getViewAzimuthAnglesRad() { if (Objects.nonNull(viewAzimuthAnglesRad)) { return viewAzimuthAnglesRad; }/*w ww.j a v a 2 s .c o m*/ throw new NullPointerException("The view azimuth angles is null."); }
From source file:org.kitodo.production.plugin.importer.massimport.PicaMassImport.java
private void readCurrentTitle(LegacyDocStructHelperInterface logicalDS) { LegacyMetadataTypeHelper titleType = prefs.getMetadataTypeByName("TitleDocMain"); List<? extends LegacyMetadataHelper> mdList = logicalDS.getAllMetadataByType(titleType); if (Objects.nonNull(mdList) && !mdList.isEmpty()) { LegacyMetadataHelper title = mdList.get(0); currentTitle = title.getValue(); }//from ww w . j a va 2 s . c o m }
From source file:org.kitodo.production.services.data.ProcessService.java
@Override public void save(Process process) throws DataException { if (Objects.nonNull(process.getParent())) { save(process.getParent());// www . j ava 2 s . c o m } super.save(process); }
From source file:org.eclipse.winery.repository.rest.resources._support.AbstractComponentsResource.java
private List<NamespaceAndDefinedLocalNamesForAngular> getGroupedListOfIds( SortedSet<? extends DefinitionsChildId> allDefinitionsChildIds, String full, String includeVersions) { Map<Namespace, ? extends List<? extends DefinitionsChildId>> groupedIds = allDefinitionsChildIds.stream() .collect(Collectors.groupingBy(DefinitionsChildId::getNamespace)); return groupedIds.keySet().stream().sorted().map(namespace -> { List<LocalNameForAngular> names = groupedIds.get(namespace).stream().map(definition -> { Definitions fullDefinition = null; if (Objects.nonNull(full)) { fullDefinition = getFullComponentData(definition); }//from www . ja va2s . co m String qName = definition.getQName().toString(); String id = definition.getXmlId().toString(); if ("componentVersionOnly".equals(includeVersions)) { qName = VersionUtils.getQNameWithComponentVersionOnly(definition); id = qName.split("}")[1]; } return new LocalNameForAngular(qName, id, fullDefinition); }).distinct().collect(Collectors.toList()); return new NamespaceAndDefinedLocalNamesForAngular(namespace, names); }).collect(Collectors.toList()); }
From source file:org.kitodo.production.helper.VariableReplacer.java
/** * Metadatum von FirstChild oder TopStruct ermitteln (vorzugsweise vom * FirstChild) und zurckgeben.// w w w . j a v a 2s.com */ private String getMetadataFromDigitalDocument(MetadataLevel inLevel, String metadata) { if (Objects.nonNull(this.dd)) { /* TopStruct und FirstChild ermitteln */ LegacyDocStructHelperInterface topstruct = this.dd.getLogicalDocStruct(); LegacyDocStructHelperInterface firstchildstruct = null; if (Objects.nonNull(topstruct.getAllChildren()) && !topstruct.getAllChildren().isEmpty()) { firstchildstruct = topstruct.getAllChildren().get(0); } /* MetadataType ermitteln und ggf. Fehler melden */ LegacyMetadataTypeHelper mdt; try { mdt = LegacyPrefsHelper.getMetadataType(this.prefs, metadata); } catch (IllegalArgumentException e) { Helper.setErrorMessage(e.getLocalizedMessage(), logger, e); return ""; } String resultTop = getMetadataValue(topstruct, mdt); String resultFirst = null; if (Objects.nonNull(firstchildstruct)) { resultFirst = getMetadataValue(firstchildstruct, mdt); } return getResultAccordingToMetadataLevel(inLevel, metadata, resultFirst, resultTop); } else { return ""; } }
From source file:org.esa.s3tbx.olci.radiometry.rayleigh.RayleighAux.java
public void setViewAzimuthAnglesRad(double[] viewAzimuthAngles) { if (Objects.nonNull(viewAzimuthAngles)) { viewAzimuthAnglesRad = SmileCorrectionUtils.convertDegreesToRadians(viewAzimuthAngles); }/*w w w . j av a2 s . c o m*/ }
From source file:org.kitodo.production.helper.tasks.CreateNewspaperProcessesTask.java
/** * The function createFirstChild() creates the first level of the logical * document structure available at the given parent. * * @param docStruct/*from w w w. ja v a 2 s . co m*/ * level of the logical document structure to create a child in * @param document * document to create the child in * @param ruleset * rule set the document is based on * @return the created child */ private LegacyDocStructHelperInterface createFirstChild(LegacyDocStructHelperInterface docStruct, LegacyMetsModsDigitalDocumentHelper document, LegacyPrefsHelper ruleset) { String firstAddable = null; try { firstAddable = docStruct.getDocStructType().getAllAllowedDocStructTypes().get(0); throw new UnsupportedOperationException("Dead code pending removal"); } catch (RuntimeException e) { StringBuilder message = new StringBuilder(); message.append("Could not add child "); if (Objects.nonNull(firstAddable)) { message.append(firstAddable); message.append(' '); } message.append("to DocStrct"); if (Objects.isNull(docStruct.getDocStructType())) { message.append(" without type"); } else { message.append("Type "); message.append(docStruct.getDocStructType().getName()); } message.append(": "); if (e instanceof NullPointerException) { message.append("No child type available."); } else { message.append(e.getClass().getSimpleName()); } throw new ProcessCreationException(message.toString(), e); } }
From source file:org.seaborne.auth.DigestHttp.java
/** From the digest header, and the expected credentials, * calculate the string expected in the "response" field of the * "Authorization" header.// w w w. j a v a2s. c om * Method and URI are taken from the AuthHeader */ private static String calcDigest(AuthHeader auth, String password) { String a1 = A1_MD5(auth.username, auth.realm, password); if (auth.qop == null) { // RFC 2069 // Firefox seems to prefer this form?? return KD(H(a1), auth.nonce + ":" + H(A2_auth(auth.method, auth.uri))); } else { Objects.nonNull(auth.cnonce); Objects.nonNull(auth.nc); return KD(H(a1), auth.nonce + ":" + auth.nc + ":" + auth.cnonce + ":" + auth.qop + ":" + H(A2_auth(auth.method, auth.uri))); } }