Example usage for java.util Collections unmodifiableCollection

List of usage examples for java.util Collections unmodifiableCollection

Introduction

In this page you can find the example usage for java.util Collections unmodifiableCollection.

Prototype

public static <T> Collection<T> unmodifiableCollection(Collection<? extends T> c) 

Source Link

Document

Returns an unmodifiable view of the specified collection.

Usage

From source file:com.alibaba.wasp.fserver.FServer.java

/**
 * For tests and web ui. This method will only work if FServer is in the same
 * JVM as client; EntityGroup cannot be serialized to cross an rpc.
 *
 * @see #getOnlineEntityGroups()/*from  ww  w  . java2  s  . c o m*/
 */
public Collection<EntityGroup> getOnlineEntityGroupsLocalContext() {
    Collection<EntityGroup> entityGroups = this.onlineEntityGroups.values();
    return Collections.unmodifiableCollection(entityGroups);
}

From source file:com.smartitengineering.cms.spi.impl.workspace.WorkspaceServiceImpl.java

@Override
public Collection<ValidatorTemplate> getValidatorsWithoutData(WorkspaceId id, ResourceSortCriteria criteria) {
    List<QueryParameter> params = new ArrayList<QueryParameter>();
    final String info = WorkspaceObjectConverter.VAL_INFO;
    params.add(QueryParameterFactory.getPropProjectionParam(info));
    params.add(getIdParam(id));//from  w w w . j ava  2s.  c o  m
    final PersistentWorkspace single = commonReadDao.getSingle(params);
    List<? extends ValidatorTemplate> templates = new ArrayList(
            single == null ? Collections.<ValidatorTemplate>emptyList() : single.getValidatorTemplates());
    if (templates.isEmpty()) {
        return Collections.emptyList();
    }
    final Comparator<ValidatorTemplate> comp;
    if (ResourceSortCriteria.BY_DATE.equals(criteria)) {
        comp = VALIDATOR_DATE_COMPARATOR;
    } else {
        comp = VALIDATOR_NAME_COMPARATOR;
    }
    Collections.sort(templates, comp);
    return Collections.unmodifiableCollection(templates);
}

From source file:edu.stanford.muse.email.AddressBook.java

public synchronized Collection<String> getDataErrors() {
    if (dataErrors == null)
        dataErrors = new LinkedHashSet<String>();
    return Collections.unmodifiableCollection(dataErrors);
}

From source file:com.alfaariss.oa.engine.requestor.jdbc.JDBCFactory.java

/**
 * @see com.alfaariss.oa.engine.core.requestor.factory.IRequestorPoolFactory#getAllRequestorPools()
 *///ww  w.  ja v  a2 s .co  m
@Override
public Collection<RequestorPool> getAllRequestorPools() throws RequestorException {
    Collection<RequestorPool> collPools = new Vector<RequestorPool>();
    Connection oConnection = null;
    PreparedStatement oPreparedStatement = null;
    ResultSet oResultSet = null;
    try {
        oConnection = _oDataSource.getConnection();

        oPreparedStatement = oConnection.prepareStatement(_sQuerySelectAllRequestorpools);
        oResultSet = oPreparedStatement.executeQuery();
        while (oResultSet.next()) {
            JDBCRequestorPool oRequestorPool = new JDBCRequestorPool(oResultSet, _oDataSource, _sPoolsTable,
                    _sRequestorsTable, _sRequestorPropertiesTable, _sAuthenticationTable,
                    _sPoolPropertiesTable);

            if (oRequestorPool != null)
                collPools.add(oRequestorPool);
        }
    } catch (SQLException e) {
        _logger.error("Can not read requestorpools from database", e);
        throw new RequestorException(SystemErrors.ERROR_RESOURCE_RETRIEVE);
    } catch (RequestorException e) {
        throw e;
    } catch (Exception e) {
        _logger.fatal("Internal error during retrieving all requestorpools", e);
        throw new RequestorException(SystemErrors.ERROR_INTERNAL);
    } finally {
        try {
            if (oResultSet != null)
                oResultSet.close();
        } catch (Exception e) {
            _logger.error("Could not close resultset", e);
        }

        try {
            if (oPreparedStatement != null)
                oPreparedStatement.close();
        } catch (Exception e) {
            _logger.error("Could not close statement", e);
        }

        try {
            if (oConnection != null)
                oConnection.close();
        } catch (Exception e) {
            _logger.error("Could not close connection", e);
        }
    }

    return Collections.unmodifiableCollection(collPools);
}

From source file:io.nuun.kernel.core.internal.context.InitContextInternal.java

@Override
public Collection<String> propertiesFiles() {
    return Collections.unmodifiableCollection(propertiesFiles);
}

From source file:org.alfresco.repo.dictionary.DictionaryDAOImpl.java

@Override
public Collection<String> getPrefixes() {
    return Collections.unmodifiableCollection(getTenantDictionaryRegistry().getPrefixesCache().keySet());
}

From source file:org.alfresco.repo.dictionary.DictionaryDAOImpl.java

@Override
public Collection<String> getURIs() {
    return Collections.unmodifiableCollection(getTenantDictionaryRegistry().getUrisCache());
}

From source file:com.matthewtamlin.sliding_intro_screen_library.core.IntroActivity.java

/**
 * Returns an unmodifiable Collection containing the pages.
 *
 * @return the pages of this activity//from www.  ja v  a 2s . com
 */
public final Collection<Fragment> getPages() {
    return Collections.unmodifiableCollection(pages);
}

From source file:com.alfaariss.oa.engine.requestor.jdbc.JDBCFactory.java

/**
 * @see com.alfaariss.oa.engine.core.requestor.factory.IRequestorPoolFactory#getAllEnabledRequestorPools()
 *///from  w w  w  .ja v  a2s .c  om
@Override
public Collection<RequestorPool> getAllEnabledRequestorPools() throws RequestorException {
    Collection<RequestorPool> collPools = new Vector<RequestorPool>();
    Connection oConnection = null;
    PreparedStatement oPreparedStatement = null;
    ResultSet oResultSet = null;
    try {
        oConnection = _oDataSource.getConnection();

        oPreparedStatement = oConnection.prepareStatement(_sQuerySelectAllEnabledRequestorpools);
        oPreparedStatement.setBoolean(1, true);
        oResultSet = oPreparedStatement.executeQuery();
        while (oResultSet.next()) {
            JDBCRequestorPool oRequestorPool = new JDBCRequestorPool(oResultSet, _oDataSource, _sPoolsTable,
                    _sRequestorsTable, _sRequestorPropertiesTable, _sAuthenticationTable,
                    _sPoolPropertiesTable);

            if (oRequestorPool != null)
                collPools.add(oRequestorPool);
        }
    } catch (SQLException e) {
        _logger.error("Can not read enabled requestorpools from database", e);
        throw new RequestorException(SystemErrors.ERROR_RESOURCE_RETRIEVE);
    } catch (RequestorException e) {
        throw e;
    } catch (Exception e) {
        _logger.fatal("Internal error during retrieving all enabled requestorpools", e);
        throw new RequestorException(SystemErrors.ERROR_INTERNAL);
    } finally {
        try {
            if (oResultSet != null)
                oResultSet.close();
        } catch (Exception e) {
            _logger.error("Could not close resultset", e);
        }

        try {
            if (oPreparedStatement != null)
                oPreparedStatement.close();
        } catch (Exception e) {
            _logger.error("Could not close statement", e);
        }

        try {
            if (oConnection != null)
                oConnection.close();
        } catch (Exception e) {
            _logger.error("Could not close connection", e);
        }
    }

    return Collections.unmodifiableCollection(collPools);
}

From source file:com.smartitengineering.cms.spi.impl.workspace.WorkspaceServiceImpl.java

public Collection<ContentCoProcessorTemplate> getContentCoProcessorsWithoutData(WorkspaceId id,
        ResourceSortCriteria criteria) {
    List<QueryParameter> params = new ArrayList<QueryParameter>();
    final String info = WorkspaceObjectConverter.CCP_INFO;
    params.add(QueryParameterFactory.getPropProjectionParam(info));
    params.add(getIdParam(id));/*from  w  w w  .  j av a 2 s.  c  o  m*/
    final PersistentWorkspace single = commonReadDao.getSingle(params);
    if (logger.isDebugEnabled()) {
        if (single == null) {
            logger.debug("Query result is null!");
        } else {
            logger.debug("Loaded CCP " + single.isContentCoProcessorPopulated() + " "
                    + single.getContentCoProcessorTemplates());
        }
    }
    List<? extends ContentCoProcessorTemplate> templates = new ArrayList(
            single == null ? Collections.<ContentCoProcessorTemplate>emptyList()
                    : single.getContentCoProcessorTemplates());
    if (templates.isEmpty()) {
        return Collections.emptyList();
    }
    final Comparator<ResourceTemplate> comp;
    if (ResourceSortCriteria.BY_DATE.equals(criteria)) {
        comp = TEMPLATE_DATE_COMPARATOR;
    } else {
        comp = TEMPLATE_NAME_COMPARATOR;
    }
    Collections.sort(templates, comp);
    return Collections.unmodifiableCollection(templates);
}