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.apache.atlas.web.integration.EntityJerseyResourceIT.java

@Test
public void testGetEntityByAttribute() throws Exception {
    Referenceable db1 = new Referenceable(DATABASE_TYPE_BUILTIN);
    String dbName = randomString();
    db1.set(NAME, dbName);//  w ww .  jav  a 2s. c  o  m
    db1.set(DESCRIPTION, randomString());
    db1.set(AtlasClient.REFERENCEABLE_ATTRIBUTE_NAME, dbName);
    db1.set("owner", "user1");
    db1.set(CLUSTER_NAME, "cl1");
    db1.set("parameters", Collections.EMPTY_MAP);
    db1.set("location", "/tmp");
    createInstance(db1);

    //get entity by attribute
    Referenceable referenceable = atlasClientV1.getEntity(DATABASE_TYPE_BUILTIN, QUALIFIED_NAME, dbName);
    Assert.assertEquals(referenceable.getTypeName(), DATABASE_TYPE_BUILTIN);
    Assert.assertEquals(referenceable.get(QUALIFIED_NAME), dbName);
}

From source file:eu.openanalytics.rsb.RestJobsITCase.java

@Test
@SuppressWarnings("unchecked")
public void submitMultipartValidSingleFileJob() throws Exception {
    final String applicationName = newTestApplicationName();
    final Document resultDoc = doSubmitValidMultipartJob(applicationName,
            Collections.singletonList(new UploadedFile("test.R")), Collections.EMPTY_MAP);
    final String resultUri = getResultUri(resultDoc);
    ponderRetrieveAndValidateZipResult(resultUri);
}

From source file:com.igormaznitsa.mvngolang.AbstractGolangMojo.java

@Nonnull
public Map<?, ?> getEnv() {
    return GetUtils.ensureNonNull(this.env, Collections.EMPTY_MAP);
}

From source file:org.apache.jackrabbit.core.security.authorization.acl.ACLTemplate.java

/**
 * @see org.apache.jackrabbit.api.jsr283.security.AccessControlList#addAccessControlEntry(Principal, Privilege[])
 *///  www .j  a v a 2s.  c  o m
public boolean addAccessControlEntry(Principal principal, Privilege[] privileges)
        throws AccessControlException, RepositoryException {
    return addEntry(principal, privileges, true, Collections.EMPTY_MAP);
}

From source file:com.jredrain.startup.AgentProcessor.java

private Map<String, String> serializableToMap(Object obj) {
    if (isEmpty(obj)) {
        return Collections.EMPTY_MAP;
    }//w  w  w  .ja  v  a  2 s . com

    Map<String, String> resultMap = new HashMap<String, String>(0);
    // 
    try {
        PropertyDescriptor[] pds = Introspector.getBeanInfo(obj.getClass()).getPropertyDescriptors();
        for (int index = 0; pds.length > 1 && index < pds.length; index++) {
            if (Class.class == pds[index].getPropertyType() || pds[index].getReadMethod() == null) {
                continue;
            }
            Object value = pds[index].getReadMethod().invoke(obj);
            if (notEmpty(value)) {
                if (isPrototype(pds[index].getPropertyType())//java()
                        || pds[index].getPropertyType().isPrimitive()//
                        || ReflectUitls.isPrimitivePackageType(pds[index].getPropertyType())
                        || pds[index].getPropertyType() == String.class) {

                    resultMap.put(pds[index].getName(), value.toString());

                } else {
                    resultMap.put(pds[index].getName(), JSON.toJSONString(value));
                }
            }
        }
    } catch (Exception e) {
        e.printStackTrace();
    }
    return resultMap;
}

From source file:eu.openanalytics.rsb.RestJobsITCase.java

@Test
@SuppressWarnings("unchecked")
public void submitMultipartValidMultiFilesJob() throws Exception {
    final String applicationName = newTestApplicationName();
    final Document resultDoc = doSubmitValidMultipartJob(applicationName,
            Arrays.asList(new UploadedFile("testSweave.Rnw"), new UploadedFile("testSweave.R")),
            Collections.EMPTY_MAP);
    final String resultUri = getResultUri(resultDoc);
    ponderRetrieveAndValidateZipResult(resultUri);
}

From source file:org.apache.ode.utils.HierarchicalProperties.java

/**
 * Return a map containing all the properties for the given port. The map is an immutable snapshot of the properties.
 * Meaning that futur changes to the properties will NOT be reflected in the returned map.
 *
 * @param service//from  w w w  .j  a v  a2s .  c  om
 * @param port
 * @return a map containing all the properties for the given port
 */
public Map getProperties(QName service, String port) {
    // no need to go further if no properties
    if (hierarchicalMap.isEmpty())
        return Collections.EMPTY_MAP;

    // else check the cache of ChainedMap already converted into immutable maps
    Map cachedMap = (Map) this.cacheOfImmutableMaps.get(service, port);
    if (cachedMap != null) {
        return cachedMap;
    }

    // else get the corresponding ChainedMap and convert it into a Map
    ChainedMap cm = (ChainedMap) hierarchicalMap.get(service, port);
    // if this port is not explicitly mentioned in the multimap, get the default values.
    if (cm == null) {
        cm = (ChainedMap) hierarchicalMap.get(service, null);
        if (cm == null) {
            // return the cached version of the root map
            return getProperties((QName) null, null);
        }
    }
    Map snapshotMap = new HashMap(cm.size() * 15 / 10);
    for (Object key : cm.keySet()) {
        snapshotMap.put(key, cm.get(key));
    }
    snapshotMap = Collections.unmodifiableMap(snapshotMap);
    // put it in cache to avoid creating one map at each invocation
    this.cacheOfImmutableMaps.put(service, port, snapshotMap);
    return snapshotMap;
}

From source file:com.alkacon.opencms.newsletter.CmsNewsletterManager.java

/**
 * Creates a new newsletter user with the specified email address.<p>
 * //from w  ww.  ja  v  a 2s.c o  m
 * Returns the created user or null if the user could not be created.<p>
 * 
 * The user will be activated or not depending on the activate parameter value.<p>
 * 
 * @param email the email address of the new user
 * @param groupName the name of the group to add the user to
 * @param activate if true, the user will be activated directly to receive newsletters, otherwise not
 * @return the new created user or null if the creation failed
 */
protected CmsUser createNewsletterUser(String email, String groupName, boolean activate) {

    CmsUser user = null;
    // create additional infos containing the active flag set to passed parameter

    try {
        String ouFqn = getAdminCms().readGroup(groupName).getOuFqn();
        try {
            // first try to read the user
            user = getAdminCms().readUser(ouFqn + email);
        } catch (CmsException e) {
            // user does not exist
        }
        if (user == null) {
            // create the user with additional infos
            user = getAdminCms().createUser(ouFqn + email, getPassword(), "Alkacon OpenCms Newsletter",
                    Collections.EMPTY_MAP);
            // set the users email address
            user.setEmail(email);
            if (!activate) {
                // set the additional info as marker that the new user is currently not active at all
                user.setAdditionalInfo(USER_ADDITIONALINFO_ACTIVE, Boolean.FALSE);
            }
        } else {
            Object o = user.getAdditionalInfo(USER_ADDITIONALINFO_ACTIVE + groupName);
            if (o != null) {
                // user tried to subscribe to this mailing list group before, return null to show error message
                return null;
            }
        }
        user.setAdditionalInfo(USER_ADDITIONALINFO_ACTIVE + groupName, Boolean.valueOf(activate));
        if (activate && (user.getAdditionalInfo().get(USER_ADDITIONALINFO_ACTIVE) != null)) {
            // remove flag that this user is not active at all
            user.deleteAdditionalInfo(USER_ADDITIONALINFO_ACTIVE);
        }
        // write the user
        getAdminCms().writeUser(user);
        // add the user to the given mailing list group
        getAdminCms().addUserToGroup(user.getName(), groupName);
    } catch (CmsException e) {
        // error creating or modifying the user
        LOG.error("Error while creating user or modifying user: " + email, e);
    }
    return user;
}

From source file:org.codehaus.groovy.grails.plugins.couchdb.domain.CouchDomainClass.java

public Map getMappedBy() {
    return Collections.EMPTY_MAP;
}

From source file:au.org.ala.delta.intkey.directives.invocation.DescribeDirectiveInvocation.java

private Map<Character, String> generateCharactersItemSubheadingMap(IntkeyDataset ds) {
    if (!ds.itemSubheadingsPresent()) {
        return Collections.EMPTY_MAP;
    }//from www. j a v a  2 s . com

    Map<Character, String> retMap = new HashMap<Character, String>();

    String currentSubHeading = null;

    for (Character ch : ds.getCharactersAsList()) {
        if (ch.getItemSubheading() != null) {
            currentSubHeading = ch.getItemSubheading();
        }

        retMap.put(ch, currentSubHeading);
    }

    return retMap;
}