Example usage for java.util LinkedHashMap values

List of usage examples for java.util LinkedHashMap values

Introduction

In this page you can find the example usage for java.util LinkedHashMap values.

Prototype

public Collection<V> values() 

Source Link

Document

Returns a Collection view of the values contained in this map.

Usage

From source file:com.alibaba.wasp.master.handler.TruncateTableHandler.java

private void handleTruncateTable(String tableName) throws IOException, ServiceException, KeeperException {
    FMetaServices fmetaServices = FMetaReader.getService(server.getConfiguration());
    FTable ftable = FMetaReader.getTable(server.getConfiguration(), tableNameStr);
    // 1. delete storage table in HBase
    String htablename = StorageTableNameBuilder.buildEntityTableName(ftable.getTableName());
    fmetaServices.deleteStorageTable(htablename);

    // 2. create storage table in HBase
    HTableDescriptor desc = fmetaServices.getStorageTableDesc(ftable);
    fmetaServices.createStorageTable(desc);

    // 3. delete Transaction table in HBase
    List<EntityGroupInfo> eginfos = FMetaReader.getTableEntityGroups(server.getConfiguration(), table);
    for (EntityGroupInfo eginfo : eginfos) {
        String tTableName = StorageTableNameBuilder.buildTransactionTableName(eginfo.getEncodedName());
        if (fmetaServices.storageTableExists(tTableName)) {
            fmetaServices.deleteStorageTable(tTableName);
        }/*from w w  w.j  a v  a2s . c  o m*/
    }

    // 4. clean Index table in HBase
    LinkedHashMap<String, Index> indexs = ftable.getIndex();
    Iterator<Index> iter = indexs.values().iterator();
    while (iter.hasNext()) {
        Index index = iter.next();
        String htable = StorageTableNameBuilder.buildIndexTableName(index);
        HTableDescriptor htableDesc = fmetaServices.getStorageTableDesc(htable);
        fmetaServices.deleteStorageTable(htable);
        fmetaServices.createStorageTable(htableDesc);
    }

    // unlock table
    tableLockManager.unlockTable(tableNameStr);
}

From source file:de.upb.wdqa.wdvd.datamodel.oldjson.jackson.OldAliasListDeserializer.java

@Override
public List<String> deserialize(JsonParser p, DeserializationContext ctxt)
        throws IOException, JsonProcessingException {
    List<String> result;

    ObjectCodec codec = p.getCodec();//from   w  ww .  j a  v a 2  s .co  m

    if (p.getCurrentToken().equals(JsonToken.START_ARRAY)) {
        result = codec.readValue(p, new TypeReference<List<String>>() {
        });
    } else {
        LinkedHashMap<Integer, String> map = codec.readValue(p,
                new TypeReference<LinkedHashMap<Integer, String>>() {
                });

        result = new ArrayList<String>(map.values());
    }
    return result;
}

From source file:io.syndesis.jsondb.dao.JsonDbDao.java

@Override
public ListResult<T> fetchAll() {
    try {/*ww w .j a  va2  s  .  c om*/
        // get the data out..
        byte[] json = jsondb.getAsByteArray(getCollectionPath());
        if (json != null && json.length > 0) {

            // Lets use jackson to parse the map of keys to our model instances
            ObjectMapper mapper = Json.mapper();
            TypeFactory typeFactory = mapper.getTypeFactory();
            MapType mapType = typeFactory.constructMapType(LinkedHashMap.class, String.class, getType());
            LinkedHashMap<String, T> map = mapper.readValue(json, mapType);

            return ListResult.of(map.values());
        }

        return ListResult.of(Collections.<T>emptyList());
    } catch (@SuppressWarnings("PMD.AvoidCatchingGenericException") RuntimeException | IOException e) {
        throw SyndesisServerException.launderThrowable(e);
    }
}

From source file:org.kuali.rice.kew.docsearch.DocumentSearchCustomizationMediatorImpl.java

protected List<AttributeFields> flattenOrderedFieldMap(LinkedHashMap<String, AttributeFields> orderedFieldMap) {
    return new ArrayList<AttributeFields>(orderedFieldMap.values());
}

From source file:org.apache.jmeter.gui.action.template.TemplateManager.java

private Map<String, Template> readTemplates() {
    final Map<String, Template> temps = new LinkedHashMap<>();

    final String[] templateFiles = TEMPLATE_FILES.split(",");
    for (String templateFile : templateFiles) {
        if (!StringUtils.isEmpty(templateFile)) {
            final File f = new File(JMeterUtils.getJMeterHome(), templateFile);
            try {
                if (f.exists() && f.canRead()) {
                    log.info("Reading templates from:" + f.getAbsolutePath());
                    final File parent = f.getParentFile();
                    final LinkedHashMap<String, Template> templates = ((Templates) xstream
                            .fromXML(f)).templates;
                    for (Template t : templates.values()) {
                        if (!t.getFileName().startsWith("/")) {
                            t.setParent(parent);
                        }//w ww  .ja v  a  2  s  . c om
                    }
                    temps.putAll(templates);
                } else {
                    log.warn("Ignoring template file:'" + f.getAbsolutePath()
                            + "' as it does not exist or is not readable");
                }
            } catch (Exception ex) {
                log.warn("Ignoring template file:'" + f.getAbsolutePath()
                        + "', an error occured parsing the file", ex);
            }
        }
    }
    return temps;
}

From source file:adalid.core.XS1.java

private static Collection<Field> getRidOfDupFields(Collection<Field> fields) {
    LinkedHashMap<String, Field> map = new LinkedHashMap<>();
    String key;//from  w  w w  . ja v  a  2  s  .c  om
    for (Field field : fields) {
        key = field.getName();
        if (map.containsKey(key)) {
            TLC.getProject().getParser().error("Field " + key + " hides another field");
            logger.error(TAB + "hiding field: " + field);
            logger.error(TAB + "hidden field: " + map.get(key));
        }
        map.put(key, field);
    }
    return map.values();
}

From source file:org.onehippo.forge.webservices.jaxrs.SystemIntegrationTest.java

@Test
public void testGetProperties() {
    final LinkedHashMap response = client.path("_system/properties").accept(MediaType.APPLICATION_JSON)
            .type(MediaType.APPLICATION_JSON).get(LinkedHashMap.class);
    assertTrue(client.get().getStatus() == Response.Status.OK.getStatusCode());
    assertTrue(response.values().size() > 0);
}

From source file:ren.hankai.cordwood.web.breadcrumb.BreadCrumbInterceptor.java

/**
 * ??//from  w w w . jav  a 2s.c o  m
 *
 * @param familyMap ?
 * @author hankai
 * @since Nov 22, 2018 3:47:13 PM
 */
private void resetBreadCrumbs(LinkedHashMap<String, BreadCrumbLink> familyMap) {
    for (final BreadCrumbLink breadCrumbLink : familyMap.values()) {
        breadCrumbLink.setCurrentPage(false);
    }
}

From source file:com.plnyyanks.frcnotebook.datafeed.EventListFetcher.java

@Override
protected String doInBackground(Activity... args) {

    listActivity = args[0];//from   w  w w  .  j a  v  a2s .c o  m
    year = PreferenceHandler.getYear();
    LinkedHashMap<String, ListItem> data;
    data = TBADatafeed.fetchEvents_TBAv1(year);

    keys = new ArrayList<String>();
    keys.addAll(data.keySet());

    events = new ArrayList<ListItem>();
    events.addAll(data.values());

    return "";
}

From source file:ca.sfu.federation.model.Behavior.java

/**
 * On changes to the Context, take some action based on the user provided rules.
 * @param o Observable object.// ww w .j a  v  a  2s  .co  m
 * @param arg Update message.
 */
public void update(Observable o, Object arg) {
    logger.log(Level.INFO, "Behavior update: on object {0}", o.toString());
    // filter the list using the user provided rules
    LinkedHashMap outputset = (LinkedHashMap) this.selection.update();
    if (outputset.size() > 0) {
        logger.log(Level.INFO, "Behavior {0} found targets: ", this.toString());
    }
    Iterator iter = outputset.values().iterator();
    StringBuilder sb = new StringBuilder();
    while (iter.hasNext()) {
        INamed named = (INamed) iter.next();
        sb.append(" ");
        sb.append(named.getName());
    }
    logger.log(Level.INFO, sb.toString());
    /*
    if (this.updateCondition != null && this.updateAction != null) {
    // determine the type of the update
    System out println("INFO: Behavior update: "+o.toString()+", "+arg.toString());
    // get the set of elements in the environment; remove bound assembly self from list
    LinkedHashMap inputset = (LinkedHashMap) this.context.getElementMap();
    // filter the list using the user provided rules
    LinkedHashMap outputset = (LinkedHashMap) this.selection.update();
    // take action based on the user rules
    if (outputset.size()>0) {
        // do something
    }
    }
     */
}