Example usage for com.google.common.collect Multimap put

List of usage examples for com.google.common.collect Multimap put

Introduction

In this page you can find the example usage for com.google.common.collect Multimap put.

Prototype

boolean put(@Nullable K key, @Nullable V value);

Source Link

Document

Stores a key-value pair in this multimap.

Usage

From source file:fi.vm.kapa.identification.pagetest.utils.LogoutPropagate.java

public Multimap<String, SPSession> getSessionMap() {
    Multimap<String, SPSession> sessionMap = ArrayListMultimap.create();
    sessionMap.put("key", new SAML2SPSession("123", 10L, 10000L,
            new NameIDBuilder().buildObject("uri", "localname", "ns-prefix"), "assertedIndex"));
    return sessionMap;
}

From source file:com.dotweblabs.friendscube.app.client.local.widgets.connections.FriendsPageItem.java

@EventHandler("userFullName")
public void viewFriend(ClickEvent event) {
    event.preventDefault();/*from   w  ww  .  ja v  a  2 s.c  o  m*/
    Multimap<String, String> state = ArrayListMultimap.create();
    state.put("friend", String.valueOf(profile.getUserId()));
    friendFeedsPage.go(state);
}

From source file:com.shinoow.abyssalcraft.common.items.ItemDreadiumKatana.java

@Override
@SuppressWarnings({ "rawtypes", "unchecked", "deprecation" })
public Multimap getItemAttributeModifiers() {
    Multimap multimap = super.getItemAttributeModifiers();
    multimap.put(SharedMonsterAttributes.attackDamage.getAttributeUnlocalizedName(),
            new AttributeModifier(field_111210_e, "Weapon modifier", weaponDamage, 0));
    return multimap;
}

From source file:com.dotweblabs.friendscube.app.client.local.widgets.connections.ConnectionsThumbnailWidget.java

@EventHandler("connectionsThumbnail")
public void clickThumbNail(ClickEvent event) {
    event.preventDefault();/*from w  w w.j  a v  a 2 s.  c om*/
    Multimap<String, String> state = ArrayListMultimap.create();
    state.put("friend", profile.getUserId() + "");
    friendFeedsPage.go(state);
}

From source file:org.polarsys.reqcycle.uri.impl.ReachableListenerManager.java

public <X, Y> void put(Multimap<X, Y> map, Multimap<Y, X> map2, X reachable, Y listener) {
    map.put(reachable, listener);
    map2.put(listener, reachable);/*from   w w  w. j  av a2 s .c  o m*/
}

From source file:org.commoncrawl.service.listcrawler.ProxyPurgeUtils.java

static void listCandidates(Configuration conf, final long cutOffTimeMillisecond) throws IOException {
    FileSystem fs = FileSystem.get(conf);
    FileSystem localFS = FileSystem.getLocal(conf);

    final Multimap<Long, Range> rangeMap = TreeMultimap.create();
    FileStatus candidateDirs[] = fs.globStatus(new Path("crawl/proxy/cacheExport/processed/*"));

    for (FileStatus candidate : candidateDirs) {
        String fileName = candidate.getPath().getName();
        // get scaled timestamp start 
        long timestampStart = Long.parseLong(fileName) * 1000000000;
        // ok see if exceeds our cutoff time 
        if (timestampStart < cutOffTimeMillisecond) {
            FileStatus ranges[] = fs.globStatus(new Path(candidate.getPath(), "*"));
            for (FileStatus range : ranges) {
                String rangeName = range.getPath().getName();
                long rangeStart = Long.parseLong(rangeName.substring(0, rangeName.indexOf("-")));
                long rangeEnd = Long.parseLong(rangeName.substring(rangeName.indexOf("-") + 1));

                rangeMap.put(Long.parseLong(fileName), new Range(rangeStart, rangeEnd));
            }/* w  w w.  j a  v a2s  . c  om*/
        }
    }

    PathFilter cacheDataFilter = new PathFilter() {

        @Override
        public boolean accept(Path path) {
            if (path.getName().startsWith("cacheData-") || path.getName().startsWith("cacheIndex-")) {
                long timestamp = Long.parseLong(path.getName().substring(path.getName().indexOf("-") + 1));
                long timestampPrefix = timestamp / 1000000000L;
                //System.out.println("timestamp:" + timestamp + " prefix:" + timestampPrefix);
                for (Range range : rangeMap.get(timestampPrefix)) {
                    if (timestamp >= range.e0 && timestamp <= range.e1) {
                        return true;
                    }
                }
            }
            return false;
        }
    };

    PathFilter historyDataFilter = new PathFilter() {

        @Override
        public boolean accept(Path path) {
            if (path.getName().startsWith("historyData-") || path.getName().startsWith("historyBloomFilter-")) {
                int indexOfDot = path.getName().indexOf(".");
                long timestamp = -1L;
                if (indexOfDot != -1) {
                    timestamp = Long
                            .parseLong(path.getName().substring(path.getName().indexOf("-") + 1, indexOfDot));
                } else {
                    timestamp = Long.parseLong(path.getName().substring(path.getName().indexOf("-") + 1));
                }

                if (timestamp < cutOffTimeMillisecond) {
                    return true;
                }
            }
            return false;
        }
    };

    FileStatus purgeCandidates[] = fs.globStatus(new Path("crawl/proxy/cache/*"), cacheDataFilter);

    for (FileStatus candidate : purgeCandidates) {
        System.out.println("Purging Candidate:" + candidate.getPath());
        fs.delete(candidate.getPath(), false);
    }

    FileStatus localcacheDataPurgeCandidates[] = localFS
            .globStatus(new Path("/home/rana/ccprod/data/proxy_data/ccn01-Prod/*"), cacheDataFilter);

    for (FileStatus candidate : localcacheDataPurgeCandidates) {
        System.out.println("Purging Candidate:" + candidate.getPath());
        localFS.delete(candidate.getPath(), false);
    }

    // now delete bloom filter data
    FileStatus historyPurgeCandidates[] = fs.globStatus(new Path("crawl/proxy/history/*"), historyDataFilter);

    for (FileStatus candidate : historyPurgeCandidates) {
        System.out.println("Purging Candidate:" + candidate.getPath());
        fs.delete(candidate.getPath(), true);
    }

    // now delete bloom filter data
    FileStatus localHistoryPurgeCandidates[] = localFS.globStatus(
            new Path("/home/rana/ccprod/data/proxy_data/ccn01-Prod/historyData/*"), historyDataFilter);

    for (FileStatus candidate : historyPurgeCandidates) {
        System.out.println("Purging Candidate:" + candidate.getPath());
        fs.delete(candidate.getPath(), true);
    }

    for (FileStatus candidate : localHistoryPurgeCandidates) {
        System.out.println("Purging Candidate:" + candidate.getPath());
        localFS.delete(candidate.getPath(), true);
    }

}

From source file:com.dotweblabs.friendscube.app.client.local.widgets.SearchItemWidget.java

@EventHandler("itemHeader")
public void clickSearchItem(ClickEvent event) {
    event.preventDefault();//from   w  ww  .  j av  a2 s .c  om
    //temporary just to be able to see other user's profile
    Multimap<String, String> state = ArrayListMultimap.create();
    state.put("friend", item.generateUrl());
    userFeedsPage.go(state);
}

From source file:net.cortexmodders.lyoko.items.ItemLyokoSword.java

@SuppressWarnings({ "rawtypes", "unchecked" })
@Override/*from  w  w w  .  j  a v a 2 s.  c  om*/
public Multimap getItemAttributeModifiers() {
    Multimap multimap = super.getItemAttributeModifiers();
    multimap.put(SharedMonsterAttributes.attackDamage.getAttributeUnlocalizedName(),
            new AttributeModifier(field_111210_e, "Weapon modifier", this.weaponDamage, 0));
    return multimap;
}

From source file:org.overlord.rtgov.ui.client.local.pages.AbstractPage.java

/**
 * Creates an href to a page./*  w w  w.  j a  v a 2s  .  c  om*/
 *
 * @param pageName
 * @param stateKey
 * @param stateValue
 */
protected String createPageHref(String pageName, String stateKey, String stateValue) {
    Multimap<String, String> state = HashMultimap.create();
    state.put(stateKey, stateValue);
    return createPageHref(pageName, state);
}

From source file:org.wso2.carbon.mss.example.hook.AbstractBasicAuthInterceptor.java

@Override
public boolean preCall(HttpRequest request, HttpResponder responder, ServiceMethodInfo serviceMethodInfo) {
    HttpHeaders headers = request.headers();
    if (headers != null) {
        String authHeader = headers.get(HttpHeaders.Names.AUTHORIZATION);
        if (authHeader != null) {
            String authType = authHeader.substring(0, AUTH_TYPE_BASIC_LENGTH);
            String authEncoded = authHeader.substring(AUTH_TYPE_BASIC_LENGTH).trim();
            if (AUTH_TYPE_BASIC.equals(authType) && !authEncoded.isEmpty()) {
                byte[] decodedByte = authEncoded.getBytes(Charset.forName("UTF-8"));
                String authDecoded = new String(Base64.getDecoder().decode(decodedByte),
                        Charset.forName("UTF-8"));
                String[] authParts = authDecoded.split(":");
                String username = authParts[0];
                String password = authParts[1];
                if (authenticate(username, password)) {
                    return true;
                }/*www  .  j  a  va  2  s .  c  o  m*/
            }

        }
    }
    Multimap<String, String> map = ArrayListMultimap.create();
    map.put(HttpHeaders.Names.WWW_AUTHENTICATE, AUTH_TYPE_BASIC);
    responder.sendStatus(HttpResponseStatus.UNAUTHORIZED, map);
    return false;
}