Example usage for java.util Collections EMPTY_MAP

List of usage examples for java.util Collections EMPTY_MAP

Introduction

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

Prototype

Map EMPTY_MAP

To view the source code for java.util Collections EMPTY_MAP.

Click Source Link

Document

The empty map (immutable).

Usage

From source file:org.eclipselabs.spray.xtext.ui.internal.RegisterPlatformGenmodelListener.java

private void registerEPackage(IFile file) {
    ResourceSet rs = new ResourceSetImpl();
    Resource emfResource = rs//from  ww  w .j  a v a 2s.  com
            .createResource(URI.createPlatformResourceURI((file.getFullPath().toPortableString()), true));
    try {
        emfResource.load(Collections.EMPTY_MAP);
        EPackage.Registry registry = EPackage.Registry.INSTANCE;
        for (EPackage pck : EcoreUtil2.eAllOfType(emfResource.getContents().get(0), EPackage.class)) {
            if (!registry.containsKey(pck.getNsURI())) {
                registry.put(pck.getNsURI(), pck);
                LOG.info("Registered EPackage " + pck.getNsURI());
            }
        }
        emfResource.unload();
    } catch (Exception e) {
        e.printStackTrace();
    }
}

From source file:org.codehaus.groovy.grails.scaffolding.DefaultScaffoldRequestHandler.java

public Map handleUpdate(HttpServletRequest request, HttpServletResponse reponse, ScaffoldCallback callback) {
    Serializable id = getRequestId();
    if (id == null) {
        LOG.debug("[ScaffoldRequestHandler] No ID parameter [" + id + "] for request [update]");
        callback.setInvoked(false);//www.  j  a  v a2s  .co  m
        return Collections.EMPTY_MAP;
    }

    Object domainObject = this.domain.get(id);
    WebRequest webRequest = (WebRequest) RequestContextHolder.currentRequestAttributes();
    InvokerHelper.setProperty(domainObject, "properties", webRequest.getParameterMap());

    Errors domainObjectErrors = (Errors) InvokerHelper.getProperty(domainObject, "errors");

    Map model = new HashMap();
    model.put(this.domain.getSingularName(), domainObject);
    model.put(PARAM_ID, id);
    // execute update
    if (!domainObjectErrors.hasErrors() && this.domain.update(domainObject, callback)) {
        callback.setInvoked(true);
    } else {
        callback.setInvoked(false);
    }
    return model;
}

From source file:com.creactiviti.piper.core.MapObject.java

public static MapObject empty() {
    return new MapObject(Collections.EMPTY_MAP);
}

From source file:fr.inria.atlanmod.neoemf.map.datastore.MapPersistenceBackendFactoryTest.java

@Test
public void testCreatePersistentEStoreDirectWriteOption() throws InvalidDataStoreException,
        NoSuchFieldException, SecurityException, IllegalArgumentException, IllegalAccessException {
    storeOptions.add(MapResourceOptions.EStoreMapOption.DIRECT_WRITE);
    PersistenceBackend persistentBackend = persistenceBackendFactory.createPersistentBackend(testFile,
            Collections.EMPTY_MAP);
    SearcheableResourceEStore eStore = persistenceBackendFactory.createPersistentEStore(null, persistentBackend,
            options);/*from  w  w w.ja v a2 s.  co m*/
    assert eStore instanceof DirectWriteMapResourceEStoreImpl : "Invalid EStore created";
    PersistenceBackend innerBackend = getInnerBackend((DirectWriteMapResourceEStoreImpl) eStore);
    assert innerBackend == persistentBackend : "The backend in the EStore is not the created one";
}

From source file:com.eucalyptus.blockstorage.async.SnapshotTransferCleaner.java

private void deleteExpiredUploads() {
    try (TransactionResource snapTran = Entities.transactionFor(SnapshotUploadInfo.class)) {
        Criterion criterion = Restrictions.and(
                Restrictions.or(Restrictions.like("state", SnapshotUploadState.cleaned),
                        Restrictions.like("state", SnapshotUploadState.uploaded)),
                Restrictions.le("purgeTime", System.currentTimeMillis()));
        List<SnapshotUploadInfo> snapshotUploadInfoList = Entities.query(new SnapshotUploadInfo(),
                Boolean.FALSE, criterion, Collections.EMPTY_MAP);
        for (SnapshotUploadInfo snapUploadInfo : snapshotUploadInfoList) {
            LOG.debug("Deleting expired entity from DB " + snapUploadInfo);
            Map<String, String> parameters = Maps.newHashMap();
            parameters.put("snapshotId", snapUploadInfo.getSnapshotId());
            parameters.put("bucketName", snapUploadInfo.getBucketName());
            parameters.put("keyName", snapUploadInfo.getKeyName());
            if (snapUploadInfo.getUploadId() != null) {
                parameters.put("uploadId", snapUploadInfo.getUploadId());
                Entities.deleteAllMatching(SnapshotPart.class,
                        "WHERE snapshot_id = :snapshotId AND bucket_name = :bucketName AND key_name = :keyName AND upload_id = :uploadId",
                        parameters);/*from  w ww  .ja  v  a  2  s  .  co m*/
            } else {
                Entities.deleteAllMatching(SnapshotPart.class,
                        "WHERE snapshot_id = :snapshotId AND bucket_name = :bucketName AND key_name = :keyName",
                        parameters);
            }
            Entities.delete(snapUploadInfo);
        }
        snapTran.commit();
    } catch (Exception e) {
        LOG.debug("Error deleting expired snapshot upload info entities" + e);
    }
}

From source file:com.acc.fulfilmentprocess.test.PaymentIntegrationTest.java

@Before
public void setUpProductCatalogue() {
    try {// www .  j av  a  2 s.  com
        new CoreBasicDataCreator().createEssentialData(Collections.EMPTY_MAP, null);
        importCsv("/bncfulfilmentprocess/test/testBasics.csv", "windows-1252");
        importCsv("/bncfulfilmentprocess/test/testCatalog.csv", "windows-1252");
        baseSiteService.setCurrentBaseSite(baseSiteService.getBaseSiteForUID("testSite"), false);
        LOG.warn("Catalogue has been imported");
    } catch (final ImpExException e) {
        LOG.warn("Catalogue import has failed");
        e.printStackTrace();
    } catch (final Exception e) {
        LOG.warn("createEssentialData(...) has failed");
        e.printStackTrace();
    }
}

From source file:org.apache.cayenne.access.DataDomain.java

/**
 * @since 1.1//  ww  w  . ja v a  2 s  .c o m
 */
protected void resetProperties() {
    properties = Collections.EMPTY_MAP;

    sharedCacheEnabled = SHARED_CACHE_ENABLED_DEFAULT;
    validatingObjectsOnCommit = VALIDATING_OBJECTS_ON_COMMIT_DEFAULT;
    usingExternalTransactions = USING_EXTERNAL_TRANSACTIONS_DEFAULT;
}

From source file:org.beangle.model.persist.hibernate.CriterionUtils.java

/**
 * ?MatchMode.ANYWHERE?map/*from ww w.j  a  v a 2 s .co m*/
 * 
 * @param entity
 * @return
 */
public static Map<String, Object> getParamsMap(Entity<?> entity) {
    if (null == entity) {
        return Collections.EMPTY_MAP;
    }
    return getParamsMap(entity, MatchMode.ANYWHERE);
}

From source file:org.training.fulfilmentprocess.test.PaymentIntegrationTest.java

@Before
public void setUpProductCatalogue() {
    try {/*www.  j  a v a2 s  .c o m*/
        new CoreBasicDataCreator().createEssentialData(Collections.EMPTY_MAP, null);
        importCsv("/trainingfulfilmentprocess/test/testBasics.csv", "windows-1252");
        importCsv("/trainingfulfilmentprocess/test/testCatalog.csv", "windows-1252");
        baseSiteService.setCurrentBaseSite(baseSiteService.getBaseSiteForUID("testSite"), false);
        LOG.warn("Catalogue has been imported");
    } catch (final ImpExException e) {
        LOG.warn("Catalogue import has failed");
        e.printStackTrace();
    } catch (final Exception e) {
        LOG.warn("createEssentialData(...) has failed");
        e.printStackTrace();
    }
}

From source file:fr.inria.atlanmod.neoemf.graph.blueprints.datastore.BlueprintsPersistenceBackendFactoryTest.java

@Test
public void testCreatePersistentEStoreAutocommitOption() throws InvalidDataStoreException, NoSuchFieldException,
        SecurityException, IllegalArgumentException, IllegalAccessException {
    storeOptions.add(BlueprintsResourceOptions.EStoreGraphOption.AUTOCOMMIT);
    PersistenceBackend persistentBackend = persistenceBackendFactory.createPersistentBackend(testFile,
            Collections.EMPTY_MAP);
    SearcheableResourceEStore eStore = persistenceBackendFactory.createPersistentEStore(null, persistentBackend,
            options);//from ww w .j av a2  s .com
    assert eStore instanceof AutocommitBlueprintsResourceEStoreImpl : "Invalid EStore created";
    PersistenceBackend innerBackend = getInnerBackend(eStore);
    assert innerBackend == persistentBackend : "The backend in the EStore is not the created one";
}