Example usage for com.liferay.portal.kernel.util ArrayUtil isEmpty

List of usage examples for com.liferay.portal.kernel.util ArrayUtil isEmpty

Introduction

In this page you can find the example usage for com.liferay.portal.kernel.util ArrayUtil isEmpty.

Prototype

public static boolean isEmpty(short[] array) 

Source Link

Usage

From source file:br.com.petrobras.ddm.type.region.internal.RegionDDMFormFieldContextHelper.java

License:Open Source License

protected boolean isSelected(String optionValue) {
    if (ArrayUtil.isEmpty(_values)) {
        return ArrayUtil.contains(_predefinedValues, optionValue);
    }/*  w  ww.j  a va2  s  .  c  o m*/

    if (ArrayUtil.contains(_values, optionValue)) {
        return true;
    }

    return false;
}

From source file:com.bemis.portal.order.service.impl.ReleaseLocalServiceImpl.java

License:Open Source License

@Override
public List<Release> getReleasesByOrderId(long[] orderIds) {
    if (ArrayUtil.isEmpty(orderIds)) {
        return Collections.emptyList();
    }// w w w  .j  a v  a 2  s.  co  m

    return releasePersistence.findByOrderId(orderIds);
}

From source file:com.bemis.portal.report.service.impl.ReportDefinitionLocalServiceImpl.java

License:Open Source License

@Override
public List<ReportDefinition> getReportDefinitions(String[] categories, long companyId, long groupId) {

    if (ArrayUtil.isEmpty(categories)) {
        return Collections.emptyList();
    }/*w ww. j a  v  a 2  s. c o  m*/

    return reportDefinitionPersistence.findByC_C_G(categories, companyId, groupId);
}

From source file:com.bemis.portal.report.service.impl.ReportRequestLocalServiceImpl.java

License:Open Source License

@Override
public List<ReportRequest> getReportRequestByRDC_U(String[] reportDefinitionCategories, long userId) {

    if (ArrayUtil.isEmpty(reportDefinitionCategories)) {
        return Collections.emptyList();
    }/*from w w  w.  ja  va  2 s  . co  m*/

    return reportRequestPersistence.findByRDC_U(reportDefinitionCategories, userId);
}

From source file:com.bemis.portal.report.service.impl.ReportRequestLocalServiceImpl.java

License:Open Source License

@Override
public List<ReportRequest> getReportRequestByRDC_U(String[] reportDefinitionCategories, long userId, int start,
        int end) {

    if (ArrayUtil.isEmpty(reportDefinitionCategories)) {
        return Collections.emptyList();
    }//w  ww  .j ava2  s . c om

    return reportRequestPersistence.findByRDC_U(reportDefinitionCategories, userId, start, end);
}

From source file:com.bemis.portal.shipment.service.impl.ShipmentLocalServiceImpl.java

License:Open Source License

@Override
public List<Shipment> getShipmentsByOrderIds(long[] orderIds) {
    if (ArrayUtil.isEmpty(orderIds)) {
        return Collections.emptyList();
    }//from  w  w w .  j a  v  a2  s .  c om

    return shipmentPersistence.findByOrderId(orderIds);
}

From source file:com.fb.filter.OpenGraphFilter.java

License:Open Source License

protected String getContent(HttpServletRequest request, String content) {
    if (ArrayUtil.isEmpty(_appNamespaces)) {
        if (_companyId == 0) {
            _companyId = PortalUtil.getCompanyId(request);
        }/* w ww . j  av a 2 s.  c om*/

        try {
            _appNamespaces = PrefsPropsUtil.getStringArray(_companyId, "APP_NAMESPACES", StringPool.NEW_LINE);
        } catch (Exception e) {
            _log.error(e);
        }
    }

    if (ArrayUtil.isEmpty(_appNamespaces)) {
        StringBundler sb = new StringBundler(2 + 4 * _appNamespaces.length);

        sb.append(_START_HEAD);
        sb.append(" og:http://ogp.me/ns fb:http://ogp.me/ns/fb ");

        for (String appNamespace : _appNamespaces) {
            sb.append(appNamespace);
            sb.append(":http://ogp.me/ns/fb/");
            sb.append(appNamespace);
            sb.append(StringPool.SPACE);
        }

        content = StringUtil.replaceFirst(content, _START_HEAD, sb.toString());
    }

    return content;
}

From source file:com.liferay.adaptive.media.image.internal.processor.util.TiffOrientationTransformer.java

License:Open Source License

private BufferedImage _getBufferedImage(RenderedImage renderedImage) {
    if (renderedImage instanceof BufferedImage) {
        return (BufferedImage) renderedImage;
    }/*from   w w w . ja va  2 s.c o m*/

    ColorModel colorModel = renderedImage.getColorModel();

    WritableRaster writableRaster = colorModel.createCompatibleWritableRaster(renderedImage.getWidth(),
            renderedImage.getHeight());

    Hashtable<String, Object> properties = new Hashtable<>();

    String[] keys = renderedImage.getPropertyNames();

    if (!ArrayUtil.isEmpty(keys)) {
        for (String key : keys) {
            properties.put(key, renderedImage.getProperty(key));
        }
    }

    BufferedImage bufferedImage = new BufferedImage(colorModel, writableRaster,
            colorModel.isAlphaPremultiplied(), properties);

    renderedImage.copyData(writableRaster);

    return bufferedImage;
}

From source file:com.liferay.asset.categories.internal.search.AssetCategoryIndexer.java

License:Open Source License

@Override
public void postProcessContextBooleanFilter(BooleanFilter contextBooleanFilter, SearchContext searchContext)
        throws Exception {

    long[] parentCategoryIds = (long[]) searchContext.getAttribute(Field.ASSET_PARENT_CATEGORY_IDS);

    if (!ArrayUtil.isEmpty(parentCategoryIds)) {
        TermsFilter parentCategoryTermsFilter = new TermsFilter(Field.ASSET_PARENT_CATEGORY_ID);

        parentCategoryTermsFilter.addValues(ArrayUtil.toStringArray(parentCategoryIds));

        contextBooleanFilter.add(parentCategoryTermsFilter, BooleanClauseOccur.MUST);
    }//from   w  w  w. j  a v  a 2 s  . co  m

    long[] vocabularyIds = (long[]) searchContext.getAttribute(Field.ASSET_VOCABULARY_IDS);

    if (!ArrayUtil.isEmpty(vocabularyIds)) {
        TermsFilter vocabularyTermsFilter = new TermsFilter(Field.ASSET_VOCABULARY_ID);

        vocabularyTermsFilter.addValues(ArrayUtil.toStringArray(vocabularyIds));

        contextBooleanFilter.add(vocabularyTermsFilter, BooleanClauseOccur.MUST);
    }
}

From source file:com.liferay.asset.publisher.internal.util.AssetPublisherHelperImpl.java

License:Open Source License

@Override
public long[] getAssetCategoryIds(PortletPreferences portletPreferences) {
    long[] assetCategoryIds = new long[0];

    for (int i = 0; true; i++) {
        String[] queryValues = portletPreferences.getValues("queryValues" + i, null);

        if (ArrayUtil.isEmpty(queryValues)) {
            break;
        }/*from  www.ja va 2 s.  c  om*/

        boolean queryContains = GetterUtil
                .getBoolean(portletPreferences.getValue("queryContains" + i, StringPool.BLANK));
        boolean queryAndOperator = GetterUtil
                .getBoolean(portletPreferences.getValue("queryAndOperator" + i, StringPool.BLANK));
        String queryName = portletPreferences.getValue("queryName" + i, StringPool.BLANK);

        if (Objects.equals(queryName, "assetCategories") && queryContains
                && (queryAndOperator || (queryValues.length == 1))) {

            assetCategoryIds = ArrayUtil.append(assetCategoryIds, GetterUtil.getLongValues(queryValues));
        }
    }

    return assetCategoryIds;
}