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:de.hybris.platform.mpintgomsbackoffice.actions.approve.ConfirmApproveAction.java

@Override
public boolean canPerform(final ActionContext<TmallRefundRequestModel> actionContext) {
    final Object data = actionContext.getData();

    TmallRefundRequestModel tmallRefundRequest = null;
    if (data instanceof TmallRefundRequestModel) {
        tmallRefundRequest = (TmallRefundRequestModel) data;
    }/*  w w  w .j a  v a 2  s  . c  o m*/

    if (Objects.isNull(tmallRefundRequest)
            || Boolean.TRUE.equals(tmallRefundRequest.getWaitMarketPlaceResponse())) {
        return false;
    }

    //refund only at the first step
    if (RefundType.REFUND_ONLY.equals(tmallRefundRequest.getRefundType())
            && RefundAction.AWAITING_APPROVAL.equals(tmallRefundRequest.getRefundAction())) {
        return true;
    }

    //return and refund at the second step(refund step)
    if (RefundType.RETURN_REFUND.equals(tmallRefundRequest.getRefundType())
            && RefundAction.AWAITING_RETURN_CONFIRMATION.equals(tmallRefundRequest.getRefundAction())) {
        return true;
    }

    return false;
}

From source file:org.kitodo.production.process.field.AdditionalField.java

/**
 * Get list of select items.//from   ww w . j  ava  2s. com
 * 
 * @return list of select items.
 */
public List<SelectItem> getSelectList() {
    if (Objects.isNull(this.selectList)) {
        this.selectList = new ArrayList<>();
    }
    return this.selectList;
}

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

/**
 * Gets file data containing volume./*  w w  w .  j  a v a 2s  .  co m*/
 *
 * @param filesToSearch the files to search
 * @param resourceId    the resource id
 * @param translateTo   the translate to
 * @param types         the types
 * @return the file data containing volume
 */
public Optional<ResourceFileDataAndIDs> getFileDataContainingVolume(List<FileData> filesToSearch,
        String resourceId, TranslateTo translateTo, FileData.Type... types) {
    if (CollectionUtils.isEmpty(filesToSearch)) {
        return Optional.empty();
    }

    List<FileData> fileDatas = Objects.isNull(types) ? filesToSearch
            : HeatToToscaUtil.getFilteredListOfFileDataByTypes(filesToSearch, types);
    Optional<ResourceFileDataAndIDs> fileDataAndIDs = getResourceFileDataAndIDsForVolumeConnection(resourceId,
            translateTo, fileDatas);
    if (fileDataAndIDs.isPresent()) {
        return fileDataAndIDs;
    }
    return Optional.empty();
}

From source file:de.hybris.platform.mpintgomsbackoffice.actions.reject.ConfirmRejectAction.java

@Override
public boolean canPerform(final ActionContext<TmallRefundRequestModel> actionContext) {
    final Object data = actionContext.getData();

    TmallRefundRequestModel tmallRefundRequest = null;
    if (data instanceof TmallRefundRequestModel) {
        tmallRefundRequest = (TmallRefundRequestModel) data;
    }/*from  w  w w .  ja v  a 2 s .  co  m*/

    if (Objects.isNull(tmallRefundRequest)
            || Boolean.TRUE.equals(tmallRefundRequest.getWaitMarketPlaceResponse())) {
        return false;
    }

    //reject for return type at first step
    //currently refuse refund on second step(refund step) is not support
    if (RefundAction.AWAITING_APPROVAL.equals(tmallRefundRequest.getRefundAction())
            && RefundType.RETURN_REFUND.equals(tmallRefundRequest.getRefundType())) {
        return true;
    }
    //reject for refund type only when the goods are shipped
    if (RefundAction.AWAITING_APPROVAL.equals(tmallRefundRequest.getRefundAction())
            && RefundType.REFUND_ONLY.equals(tmallRefundRequest.getRefundType())) {
        if (tmallRefundRequest.getConsignment() != null && ConsignmentStatus.SHIPPED
                .equals(tmallRefundRequest.getConsignment().getStatus().getCode())) {
            return true;
        }
    }

    return false;
}

From source file:io.kamax.mxisd.controller.profile.v1.ProfileController.java

private String resolveProxyUrl(HttpServletRequest req) {
    URI target = URI.create(req.getRequestURL().toString()
            + (Objects.isNull(req.getQueryString()) ? "" : "?" + req.getQueryString()));
    URIBuilder builder = dns.transform(target);
    String urlToLogin = builder.toString();
    log.info("Proxy resolution: {} to {}", target.toString(), urlToLogin);
    return urlToLogin;
}

From source file:de.hybris.platform.mpintgomsbackoffice.actions.confirmreturn.ConfirmReturnAction.java

@Override
public boolean canPerform(final ActionContext<TmallRefundRequestModel> actionContext) {
    final Object data = actionContext.getData();

    TmallRefundRequestModel tmallRefundRequest = null;
    if (data instanceof TmallRefundRequestModel) {
        tmallRefundRequest = (TmallRefundRequestModel) data;
    }//ww w .j  av  a 2s.c om

    if (Objects.isNull(tmallRefundRequest)
            || Boolean.TRUE.equals(tmallRefundRequest.getWaitMarketPlaceResponse())) {
        return false;
    }

    //return only at the first step
    if (RefundType.RETURN_REFUND.equals(tmallRefundRequest.getRefundType())
            && RefundAction.AWAITING_APPROVAL.equals(tmallRefundRequest.getRefundAction())) {
        return true;
    }

    return false;
}

From source file:com.mac.holdempoker.app.impl.SimpleGameDealer.java

private void validateBoard() throws InvalidBoardException {
    if (Objects.isNull(board)) {
        throw new InvalidBoardException(board);
    }/*  w w  w  . j  av  a 2s . c o m*/
}

From source file:com.qpark.eip.core.model.analysis.operation.GetFlowOperation.java

/**
 * @param message/*ww  w .  ja  v a  2  s  . c  om*/
 *            the {@link JAXBElement} containing a
 *            {@link GetFlowRequestType}.
 * @return the {@link JAXBElement} with a {@link GetFlowResponseType}.
 */
@Override
public final JAXBElement<GetFlowResponseType> invoke(final JAXBElement<GetFlowRequestType> message) {
    this.logger.debug("+getFlow");
    final GetFlowRequestType request = message.getValue();
    final GetFlowResponseType response = this.of.createGetFlowResponseType();
    final long start = System.currentTimeMillis();
    try {
        final List<String> namePattern = new ArrayList<>();
        request.getNamePattern().stream()
                .forEach(s -> translateNamePattern(s).ifPresent(translated -> namePattern.add(translated)));
        if (!namePattern.isEmpty()) {
            String modelVersion = request.getRevision();
            if (Objects.isNull(modelVersion) || modelVersion.trim().length() == 0) {
                modelVersion = this.dao.getLastModelVersion();
            }
            response.getFlow().addAll(this.dao.getFlowByNamePattern(modelVersion, namePattern));
        }
    } catch (final Throwable e) {
        /* Add a not covered error to the response. */
        this.logger.error(e.getMessage(), e);
    } finally {
        this.logger.debug(" getFlow duration {}", DateUtil.getDuration(start, System.currentTimeMillis()));
        this.logger.debug("-getFlow #{}", response.getFlow().size());
    }
    return this.of.createGetFlowResponse(response);
}

From source file:org.kitodo.filemanagement.locking.ImmutableReadFileManagement.java

/**
 * Checks if the copy in question can be disposed of, and if so, does it. A
 * copy can be discarded if it isnt noted by any user more than his or her
 * visible version of this file. To find this out, the entire map must be
 * searched below the original URI. This process can be parallelized very
 * well. If the copy can be disposed of, it must first be removed from the
 * map of up-to-date copies so that it will not be reissued during the
 * deletion, and then deleted. If the file cannot be deleted, a warning is
 * written to the logfile. System administrators should be on the lookout
 * for such alerts, because if they occur frequently, this could signal that
 * the partiton is filling up with temporary files. This can be a problem
 * especially on Windows, because the Java virtual machine occasionally has
 * problems deleting files here./*from w w w .j  av a 2s.co m*/
 *
 * @param copyInQuestion
 *            URI of the file that may be deleted
 * @param originUri
 *            URI of the file of which the file in question is a copy. Since
 *            the maps storing the temporary file information use the URI of
 *            the source file as a key, they are much more efficient to use
 *            if it is known. (It would work without, but then you would
 *            have to chew through the whole map every time.)
 */
private void cleanUp(URI copyInQuestion, URI originUri) {
    UserMapForURI userMapForURI = urisGivenToUsers.get(originUri);
    if (Objects.isNull(userMapForURI) || userMapForURI.entrySet().parallelStream()
            .map(userMapForUriEntry -> userMapForUriEntry.getValue().getKey())
            .noneMatch(readCopy -> readCopy.equals(copyInQuestion))) {

        URI upToDateCopy = upToDateCopies.get(originUri);
        if (Objects.nonNull(upToDateCopy) && upToDateCopy.equals(copyInQuestion)) {
            upToDateCopies.remove(originUri);
        }

        File fileToDelete = new File(copyInQuestion.getPath());
        if (FileUtils.deleteQuietly(fileToDelete)) {
            logger.debug("the temporary read copy {} was deleted", fileToDelete);
        } else {
            logger.warn("The temporary read file {} could not be deleted.", fileToDelete);
        }
    }
}

From source file:com.mac.holdempoker.app.impl.SimpleGameDealer.java

@Override
public void actionPerformed(Action action) {
    if (Objects.isNull(action)) {
        return;/* w w  w  .j av  a2  s.  com*/
    }
    simpleRound.actionPerformed(action);

    //        if(action instanceof MoneyAction){
    //            pot.increasePot((MoneyAction) action);
    //            System.out.println("ADD IMPLEMENTATION FOR BETTING/RAISING");
    //        }else{
    //            if(action.getActionName() == ActionName.FOLD){
    //                System.out.println("ADD IMPLEMENTATION FOR FOLDING");
    //            }else if(action.getActionName() == ActionName.CHECK){
    //                System.out.println("ADD IMPLEMENTATION FOR CHECKING");
    //            }
    //        }
}