Example usage for java.util Objects isNull

List of usage examples for java.util Objects isNull

Introduction

In this page you can find the example usage for java.util Objects isNull.

Prototype

public static boolean isNull(Object obj) 

Source Link

Document

Returns true if the provided reference is null otherwise returns false .

Usage

From source file:org.kitodo.production.forms.MassImportForm.java

/**
 * tests input fields for correct data./*  w  w w. j  a va  2 s  . c  om*/
 *
 * @return true if data is valid or false otherwise
 */

private boolean testForData() {
    return !(StringUtils.isEmpty(this.idList) && StringUtils.isEmpty(this.records)
            && Objects.isNull(this.importFile) && this.selectedFilenames.isEmpty());
}

From source file:org.kitodo.production.helper.tasks.EmptyTask.java

/**
 * The function getLongMessage() returns the read-only field "longMessage"
 * which will be shown in a pop-up window.
 *
 * @return the stack trace of the exception, if any
 *///from www  .java2s . c o m
public String getLongMessage() {
    if (Objects.isNull(exception)) {
        return null;
    }
    return ExceptionUtils.getStackTrace(exception);
}

From source file:org.openecomp.sdc.translator.services.heattotosca.HeatToToscaUtil.java

/**
 * Extract property optional./*from w  w w  . jav  a  2 s .  c  o  m*/
 *
 * @param propertyValue the property value
 * @return the optional
 */
public static Optional<AttachedResourceId> extractProperty(Object propertyValue) {

    Object entity;
    if (Objects.isNull(propertyValue)) {
        return Optional.empty();
    }

    ResourceReferenceType referenceType = ResourceReferenceType.OTHER;
    if (propertyValue instanceof Map && !((Map) propertyValue).isEmpty()) {
        Map<String, Object> propMap = (Map) propertyValue;
        Map.Entry<String, Object> entry = propMap.entrySet().iterator().next();
        entity = entry.getValue();
        String key = entry.getKey();
        switch (key) {
        case "get_resource":
            referenceType = ResourceReferenceType.GET_RESOURCE;
            break;
        case "get_param":
            referenceType = ResourceReferenceType.GET_PARAM;
            break;
        case "get_attr":
            referenceType = ResourceReferenceType.GET_ATTR;
            break;
        default:
        }

    } else {
        entity = propertyValue;
    }

    return Optional.of(new AttachedResourceId(null, entity, referenceType));
}

From source file:org.dbflute.intro.app.web.client.ClientAction.java

@NotAvailableDecommentServer
@Execute//from   w  ww  . j  ava 2s.com
public JsonResponse<Void> create(String projectName, ClientCreateBody clientCreateBody) {
    validate(clientCreateBody, messages -> {
        ClientPart client = clientCreateBody.client;
        if (clientInfoLogic.getProjectList().contains(projectName)) {
            messages.addErrorsWelcomeClientAlreadyExists("projectName", projectName);
        }
        TargetDatabase databaseCd = client.databaseCode;
        if (!databaseInfoLogic.isEmbeddedJar(databaseCd) && Objects.isNull(client.jdbcDriver)) {
            messages.addErrorsDatabaseNeedsJar("database", databaseCd.alias());
        }
        Optional.ofNullable(client.jdbcDriver).map(driverPart -> driverPart.fileName)
                .filter(s -> StringUtils.isNotEmpty(s) && !s.endsWith(".jar"))
                .ifPresent(fileName -> messages.addErrorsDatabaseNeedsJar("jdbcDriver", fileName));
    });
    ClientModel clientModel = mappingToClientModel(projectName, clientCreateBody.client);
    if (clientCreateBody.testConnection) {
        testConnectionIfPossible(clientModel);
    }
    clientUpdateLogic.createClient(clientModel);
    return JsonResponse.asEmptyBody();
}

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// w  ww .j  ava2 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.goobi.production.cli.helper.CopyProcess.java

private void addProperties(ImportObject io) {
    ProcessGenerator.addPropertyForWorkpiece(this.prozessKopie, "DocType", this.docType);
    ProcessGenerator.addPropertyForWorkpiece(this.prozessKopie, "TifHeaderImagedescription",
            this.tifHeaderImageDescription);
    ProcessGenerator.addPropertyForWorkpiece(this.prozessKopie, "TifHeaderDocumentname",
            this.tifHeaderDocumentName);

    if (Objects.isNull(io)) {
        addAdditionalFields(this.additionalFields, this.prozessKopie);
    } else {/*from   w  w w .j a va2  s. com*/
        for (Property processProperty : io.getProcessProperties()) {
            ProcessGenerator.copyPropertyForProcess(this.prozessKopie, processProperty);
        }
        for (Property workpieceProperty : io.getWorkProperties()) {
            ProcessGenerator.copyPropertyForWorkpiece(this.prozessKopie, workpieceProperty);
        }

        for (Property templateProperty : io.getTemplateProperties()) {
            ProcessGenerator.copyPropertyForTemplate(this.prozessKopie, templateProperty);
        }
        ProcessGenerator.addPropertyForProcess(this.prozessKopie, "Template", this.template.getTitle());
        ProcessGenerator.addPropertyForProcess(this.prozessKopie, "TemplateID",
                String.valueOf(this.template.getId()));
    }
}

From source file:com.caricah.iotracah.datastore.ignitecache.IgniteDatastore.java

@Override
public Observable<IotSubscriptionFilter> getOrCreateSubscriptionFilter(String partition, String topic) {

    return Observable.create(observer -> {

        List<String> topicNavigationRoute = getTopicNavigationRoute(topic);

        IotSubscriptionFilterKey filterKey = subscriptionFilterHandler.keyFromList(partition,
                topicNavigationRoute);//from w  w w.j  a v  a2 s .  c  om

        Observable<IotSubscriptionFilter> filterObservable = subscriptionFilterHandler
                .getByKeyWithDefault(filterKey, null);

        filterObservable.subscribe(

                subscriptionFilter -> {

                    if (Objects.isNull(subscriptionFilter)) {

                        subscriptionFilterHandler.createTree(partition, topicNavigationRoute).single()
                                .subscribe(observer::onNext, observer::onError, observer::onCompleted);
                    } else {
                        observer.onNext(subscriptionFilter);
                    }

                }, observer::onError, observer::onCompleted);

    });

}

From source file:org.kitodo.config.ConfigProject.java

private String processNullValues(String value) {
    if (Objects.isNull(value)) {
        value = "";
    }
    return value;
}

From source file:com.qpark.maven.plugin.flowmapper.AbstractGenerator.java

protected String getMethodArgs(final List<ComplexTypeChild> children) {
    final StringBuffer sb = new StringBuffer(128);
    final int i = 0;
    children.stream().filter(child -> Objects.isNull(child.getDefaultValue())).forEach(child -> {
        if (sb.length() > 0) {
            sb.append(", ");
        }//from  w  w  w  . j av a 2s  .  c  om
        sb.append(child.getJavaVarDefinitionFullQualified());
    });
    return sb.toString();
}

From source file:org.kitodo.production.forms.MassImportForm.java

private void addProcessToList(ImportObject importObject) throws IOException {
    URI importFileName = importObject.getImportFileName();
    Process process = JobCreation.generateProcess(importObject, this.template);
    if (Objects.isNull(process)) {
        if (Objects.nonNull(importFileName)
                && !ServiceManager.getFileService().getFileName(importFileName).isEmpty()
                && Objects.nonNull(selectedFilenames) && !selectedFilenames.isEmpty()) {
            selectedFilenames.remove(importFileName.getRawPath());
        }/* ww w. jav a 2 s . c  o  m*/
        Helper.setErrorMessage(
                "import failed for " + importObject.getProcessTitle() + ", process generation failed");
    } else {
        Helper.setMessage(
                ImportReturnValue.EXPORT_FINISHED.getValue() + " for " + importObject.getProcessTitle());
        this.processList.add(process);
    }
}