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:com.redhat.rhn.frontend.taglibs.list.ListTag.java

private void setupManipulator() throws JspException {
    manip.setAlphaColumn(alphaBarColumn);
    manip.filter(filter, pageContext);//from  w w  w  . j  av a2s. co  m
    if (!StringUtils.isBlank(ListTagHelper.getFilterValue(pageContext.getRequest(), getUniqueName()))) {
        LocalizationService ls = LocalizationService.getInstance();

        ListTagUtil.write(pageContext, "<div class=\"site-info\">");

        if (manip.getTotalDataSetSize() != manip.getUnfilteredDataSize()) {
            if (manip.getAllData().size() == 0) {
                ListTagUtil.write(pageContext, ls.getMessage("listtag.filteredmessageempty",
                        new Integer(manip.getTotalDataSetSize())));
            } else {
                ListTagUtil.write(pageContext,
                        ls.getMessage("listtag.filteredmessage", new Integer(manip.getTotalDataSetSize())));
            }

            ListTagUtil.write(pageContext, "<br /><a href=\"");
            List<String> excludeParams = new ArrayList<String>();
            excludeParams.add(ListTagUtil.makeSelectActionName(getUniqueName()));
            excludeParams.add(ListTagUtil.makeFilterByLabel(getUniqueName()));
            excludeParams.add(ListTagUtil.makeFilterValueByLabel(getUniqueName()));
            excludeParams.add(ListTagUtil.makeOldFilterValueByLabel(getUniqueName()));
            excludeParams.add(ListTagUtil.makeFilterSearchChildLabel(getUniqueName()));
            excludeParams.add(ListTagUtil.makeFilterSearchParentLabel(getUniqueName()));
            excludeParams.add(ListTagUtil.makeParentIsAnElementLabel(getUniqueName()));
            excludeParams.add("submitted");

            ListTagUtil.write(pageContext, ListTagUtil.makeParamsLink(pageContext.getRequest(), name,
                    Collections.EMPTY_MAP, excludeParams));

            ListTagUtil.write(pageContext, "\">" + ls.getMessage("listtag.clearfilter"));
            ListTagUtil.write(pageContext,
                    ls.getMessage("listtag.seeall", new Integer(manip.getUnfilteredDataSize())));
            ListTagUtil.write(pageContext, "</a>");
        } else {
            ListTagUtil.write(pageContext, ls.getMessage("listtag.all_items_in_filter",
                    ListTagHelper.getFilterValue(pageContext.getRequest(), getUniqueName())));
        }

        ListTagUtil.write(pageContext, "</div>");
    }
}

From source file:br.msf.commons.util.CharSequenceUtils.java

public static Map<Character, Integer> getCharCount(final int fromIndex, final CharSequence sequence,
        final Boolean caseSensitive) {
    ArgumentUtils.rejectIfOutOfBounds(fromIndex, 0, length(sequence) - 1);
    if (isEmptyOrNull(sequence)) {
        return Collections.EMPTY_MAP;
    }/* w ww . j  av  a 2  s .c o  m*/
    final Map<Character, Integer> chars = new TreeMap<Character, Integer>();
    for (int i = fromIndex; i < length(sequence); i++) {
        Character ch = caseSensitive ? sequence.charAt(i) : Character.toLowerCase(sequence.charAt(i));
        Integer count = chars.get(ch);
        chars.put(ch, (count == null) ? 1 : count + 1);
    }
    return chars;
}

From source file:amfservices.actions.PGServicesAction.java

public Map<String, Object> destroyGiftAction(String uid, String giftID, long now) {
    UserGifts userGifts = UserGifts.getGift(uid);
    PGException.Assert(userGifts.contains(giftID), PGError.INVALID_GIFT,
            "Gift " + giftID + " not be " + uid + "'s gift");

    userGifts.remove(giftID);/*from   w w  w  .  ja va 2s . c om*/
    Gift.destroyGift(giftID);

    return Collections.EMPTY_MAP;
}

From source file:amfservices.actions.PGServicesAction.java

public Map<String, Object> loginAwardAction(String uid, long now) {
    UserDailyData uDailyData = UserDailyData.getData(uid, now);
    PGException.Assert(!Boolean.parseBoolean(uDailyData.getData(PGMacro.RECEIVED_LOGIN_PRIZE)),
            PGError.RECEIVED_LOGIN_PRIZE, "You have received this prize");

    UserTempData uTempData = UserTempData.getTempData(uid);
    int nRepLoginDay = PGHelper.toInteger(uTempData.getData(PGMacro.REPEATED_LOGIN_DAY));

    // prizing//from   w w  w .j  av  a  2s  .c  om
    Map<String, Object> prizeDesc = Collections.EMPTY_MAP;
    if (nRepLoginDay > 0) {
        PGPrize dailyLoginPrize = PrizeFactory
                .getPrize(PGConfig.inst().getPrizing().dailyLogin().prizeForDay(nRepLoginDay));

        EntityContext context = EntityContext.getContext(uid);
        prizeDesc = dailyLoginPrize.award(context, now);
        context.saveToDB();
    }

    uDailyData.setData(PGMacro.RECEIVED_LOGIN_PRIZE, true);

    Map<String, Object> resp = new HashMap(2);
    resp.put(PGMacro.REPEATED_LOGIN_DAY, nRepLoginDay);
    resp.put(PGMacro.PRIZE, prizeDesc);
    return resp;
}

From source file:eu.brokeratcloud.fpr.model.DivaRoot.java

public void saveModel(org.eclipse.emf.common.util.URI uri) {
    if (previousSaveUri == null)
        previousSaveUri = uri;//w ww .j  a  v  a  2s . c  om
    Resource res = new XMIResourceImpl(uri);
    res.getContents().add(root);
    try {
        res.save(Collections.EMPTY_MAP);
    } catch (IOException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
}

From source file:com.ning.maven.plugins.dependencyversionscheck.AbstractDependencyVersionsMojo.java

/**
 * Returns a Set of artifacts based off the given project. Artifacts can be filtered and optional dependencies can be excluded.
 *
 * It would be awesome if this method would also use the DependencyTreeBuilder which seems to yield better results (and is much closer to the actual compile tree in some cases)
 * than the artifactResolver. However, due to MNG-3236 the artifact filter is not applied when resolving dependencies and this method relies on the artifact filter to get
 * the scoping right. Well, maybe in maven 3.0 this will be better. Or different. Whatever comes first.
 *//*from www. j a va  2  s. c  o  m*/
private Set resolveDependenciesInItsOwnScope(final MavenProject project, final ArtifactFilter filter,
        final boolean includeOptional)
        throws InvalidDependencyVersionException, ArtifactResolutionException, ArtifactNotFoundException {
    Set dependencyArtifacts = MavenMetadataSource.createArtifacts(artifactFactory, project.getDependencies(),
            null, filter, null);

    ArtifactResolutionResult result = artifactResolver.resolveTransitively(dependencyArtifacts,
            project.getArtifact(), Collections.EMPTY_MAP, localRepository,
            project.getRemoteArtifactRepositories(), artifactMetadataSource,
            new ArtifactOptionalFilter(includeOptional));

    return result.getArtifacts();
}

From source file:com.xpn.xwiki.plugin.invitationmanager.impl.InvitationManagerImpl.java

/**
 * {@inheritDoc}/* w  ww . j a  v  a 2 s  .  co  m*/
 * 
 * @see com.xpn.xwiki.plugin.invitationmanager.api.InvitationManager#inviteUser(String, String,
 *      boolean, List, String, XWikiContext)
 */
public void inviteUser(String user, String space, boolean open, List roles, String templateMail,
        XWikiContext context) throws InvitationManagerException {
    inviteUser(user, space, open, roles, templateMail, Collections.EMPTY_MAP, context);
}

From source file:org.artificer.repository.jcr.mapper.ArtifactToJCRNodeVisitor.java

private void setRelationships(String relationshipType, int maxCardinality, int minCardinality,
        boolean isGeneric, boolean isDerived, List<? extends Target> targets, List<String> targetTypes)
        throws Exception {
    setRelationships(relationshipType, maxCardinality, minCardinality, isGeneric, isDerived, targets,
            targetTypes, Collections.EMPTY_MAP);
}

From source file:org.apereo.portal.layout.dlm.remoting.UpdatePreferencesServlet.java

/**
 * Update the user's preferred skin.//from  www.java  2 s .co  m
 *
 * @param request HTTP Request
 * @param response HTTP Response
 * @param skinName name of the Skin
 * @throws IOException
 * @throws PortalException
 */
@RequestMapping(method = RequestMethod.POST, params = "action=chooseSkin")
public ModelAndView chooseSkin(HttpServletRequest request, HttpServletResponse response,
        @RequestParam String skinName) throws IOException {

    this.stylesheetUserPreferencesService.setStylesheetParameter(request, PreferencesScope.THEME, "skin",
            skinName);

    return new ModelAndView("jsonView", Collections.EMPTY_MAP);
}

From source file:org.apache.atlas.web.resources.EntityJerseyResourceIT.java

@Test
public void testDeleteEntitiesViaRestApi() throws Exception {
    // Create 2 database entities
    Referenceable db1 = new Referenceable(DATABASE_TYPE_BUILTIN);
    String dbName = randomString();
    db1.set(NAME, dbName);//from ww w  .j  av a2  s  . com
    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");
    Id db1Id = createInstance(db1);

    Referenceable db2 = new Referenceable(DATABASE_TYPE_BUILTIN);
    String dbName2 = randomString();
    db2.set(NAME, dbName2);
    db2.set(QUALIFIED_NAME, dbName2);
    db2.set(CLUSTER_NAME, randomString());
    db2.set(DESCRIPTION, randomString());
    db2.set(AtlasClient.REFERENCEABLE_ATTRIBUTE_NAME, dbName2);
    db2.set("owner", "user2");
    db2.set(CLUSTER_NAME, "cl1");
    db2.set("parameters", Collections.EMPTY_MAP);
    db2.set("location", "/tmp");
    Id db2Id = createInstance(db2);

    // Delete the database entities
    MultivaluedMap<String, String> queryParams = new MultivaluedMapImpl();
    queryParams.add(AtlasClient.GUID.toLowerCase(), db1Id._getId());
    queryParams.add(AtlasClient.GUID.toLowerCase(), db2Id._getId());

    JSONObject response = atlasClientV1.callAPIWithQueryParams(AtlasClient.API.DELETE_ENTITIES, queryParams);
    List<String> deletedGuidsList = AtlasClient.EntityResult.fromString(response.toString())
            .getDeletedEntities();
    Assert.assertTrue(deletedGuidsList.contains(db1Id._getId()));
    Assert.assertTrue(deletedGuidsList.contains(db2Id._getId()));

    // Verify entities were deleted from the repository.
    for (String guid : deletedGuidsList) {
        Referenceable entity = atlasClientV1.getEntity(guid);
        assertEquals(entity.getId().getState(), Id.EntityState.DELETED);
    }
}