Example usage for java.util LinkedHashMap put

List of usage examples for java.util LinkedHashMap put

Introduction

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

Prototype

V put(K key, V value);

Source Link

Document

Associates the specified value with the specified key in this map (optional operation).

Usage

From source file:com.intel.iotkitlib.LibModules.AlertManagement.AlertManagement.java

public boolean getInfoOnAlert(String alertId) {
    if (alertId == null) {
        Log.d(TAG, "alert id cannot be null");
        return false;
    }/*from w  w w  .j  a v  a  2 s.com*/
    //initiating get for alert info
    HttpGetTask infoOnAlert = new HttpGetTask(new HttpTaskHandler() {
        @Override
        public void taskResponse(int responseCode, String response) {
            Log.d(TAG, String.valueOf(responseCode));
            Log.d(TAG, response);
            statusHandler.readResponse(responseCode, response);
        }
    });
    infoOnAlert.setHeaders(basicHeaderList);
    LinkedHashMap<String, String> linkedHashMap = new LinkedHashMap<String, String>();
    linkedHashMap.put("alert_id", alertId);
    String url = objIotKit.prepareUrl(objIotKit.getAlertInformation, linkedHashMap);
    return super.invokeHttpExecuteOnURL(url, infoOnAlert, "info on one rule");
}

From source file:com.intel.iotkitlib.LibModules.AlertManagement.AlertManagement.java

public boolean resetAlert(String alertId) {
    if (alertId == null) {
        Log.d(TAG, "alert id cannot be null");
        return false;
    }/*ww w . java  2 s.c  om*/
    //initiating put for resetting alert
    HttpPutTask alertReset = new HttpPutTask(new HttpTaskHandler() {
        @Override
        public void taskResponse(int responseCode, String response) {
            Log.d(TAG, String.valueOf(responseCode));
            Log.d(TAG, response);
            statusHandler.readResponse(responseCode, response);
        }
    });
    alertReset.setHeaders(basicHeaderList);
    LinkedHashMap<String, String> linkedHashMap = new LinkedHashMap<String, String>();
    linkedHashMap.put("alert_id", alertId);
    String url = objIotKit.prepareUrl(objIotKit.resetAlert, linkedHashMap);
    return super.invokeHttpExecuteOnURL(url, alertReset, "alert reset");
}

From source file:com.intel.iotkitlib.LibModules.AlertManagement.AlertManagement.java

public boolean updateAlertStatus(String alertId, String status) {
    if (alertId == null || status == null) {
        Log.d(TAG, "alert id or status cannot be null");
        return false;
    }/*from   w  w  w .  j a  v  a  2  s .  c om*/
    //initiating put for updating alert status
    HttpPutTask updateAlertStatus = new HttpPutTask(new HttpTaskHandler() {
        @Override
        public void taskResponse(int responseCode, String response) {
            Log.d(TAG, String.valueOf(responseCode));
            Log.d(TAG, response);
            statusHandler.readResponse(responseCode, response);
        }
    });
    updateAlertStatus.setHeaders(basicHeaderList);
    LinkedHashMap<String, String> linkedHashMap = new LinkedHashMap<String, String>();
    linkedHashMap.put("alert_id", alertId);
    linkedHashMap.put("status_name", status);
    String url = objIotKit.prepareUrl(objIotKit.resetAlert, linkedHashMap);
    return super.invokeHttpExecuteOnURL(url, updateAlertStatus, "alert status update");
}

From source file:com.intel.iotkitlib.LibModules.AlertManagement.AlertManagement.java

public boolean addCommentsToTheAlert(String alertId, String user, Long timeStamp, String comment)
        throws JSONException {
    if (alertId == null || user == null || comment == null) {
        Log.d(TAG, "alert id or user or comment cannot be null");
        return false;
    }//from w ww .jav  a 2 s .c  o  m
    String body;
    if ((body = createBodyForAddingCommentToAlert(user, timeStamp, comment)) == null) {
        return false;
    }
    //initiating post for adding comment to alert
    HttpPostTask addCommentsTOAlert = new HttpPostTask(new HttpTaskHandler() {
        @Override
        public void taskResponse(int responseCode, String response) {
            Log.d(TAG, String.valueOf(responseCode));
            Log.d(TAG, response);
            statusHandler.readResponse(responseCode, response);
        }
    });
    addCommentsTOAlert.setHeaders(basicHeaderList);
    addCommentsTOAlert.setRequestBody(body);
    LinkedHashMap<String, String> linkedHashMap = new LinkedHashMap<String, String>();
    linkedHashMap.put("alert_id", alertId);
    String url = objIotKit.prepareUrl(objIotKit.addCommentToAlert, linkedHashMap);
    return super.invokeHttpExecuteOnURL(url, addCommentsTOAlert, "add comments to alert");
}

From source file:com.streamsets.pipeline.stage.lib.hive.HiveMetastoreUtil.java

@SuppressWarnings("unchecked")
private static <T> void extractInnerMapFromTheList(Record metadataRecord, String listFieldName,
        String innerPairFirstFieldName, String innerPairSecondFieldName, boolean isSecondFieldHiveType,
        LinkedHashMap<String, T> returnVal, StageException exception) throws StageException {
    boolean throwException = false;
    if (metadataRecord.has(SEP + listFieldName)) {
        Field columnField = metadataRecord.get(SEP + listFieldName);
        List<Field> columnList = columnField.getValueAsList();
        if (columnList != null) {
            for (Field listElementField : columnList) {
                if (listElementField.getType() != Field.Type.MAP
                        && listElementField.getType() != Field.Type.LIST_MAP) {
                    throwException = true;
                    break;
                }//from  w  w  w .j av  a 2s. co m
                LinkedHashMap<String, Field> innerPair = listElementField.getValueAsListMap();
                String innerPairFirstField = innerPair.get(innerPairFirstFieldName).getValueAsString();
                String innerPairSecondField = innerPair.get(innerPairSecondFieldName).getValueAsString();
                returnVal.put(innerPairFirstField,
                        isSecondFieldHiveType ? (T) HiveType.getHiveTypeFromString(innerPairSecondField)
                                : (T) innerPairSecondField);
            }
        }
    } else {
        throwException = true;
    }
    if (throwException) {
        throw exception;
    }
}

From source file:hydrograph.ui.propertywindow.widgets.customwidgets.metastore.ELTExtractMetaStoreDataWidget.java

/**
 * //from  w  ww .j  a v  a  2s.c  o m
 */
@Override
public LinkedHashMap<String, Object> getProperties() {

    LinkedHashMap<String, Object> property = new LinkedHashMap<>();
    property.put(propertyName, "");
    return property;
}

From source file:me.neatmonster.spacertk.actions.PluginActions.java

/**
 * Gets information about a plugin/*from w w w  .j  a v  a  2 s  .  com*/
 * @param pluginName Plugin to get information about
 * @return Information about a plugin
 */
@Action(aliases = { "informations", "pluginInformations" })
public LinkedHashMap<String, Object> informations(final String pluginName) {
    final SBPlugin plugin = pluginsManager.getPlugin(pluginName);
    if (plugin != null) {
        final LinkedHashMap<String, Object> pluginInformations = new LinkedHashMap<String, Object>();
        pluginInformations.put("Name", plugin.name);
        pluginInformations.put("Status", plugin.status);
        pluginInformations.put("Link", plugin.link);
        pluginInformations.put("Authors", plugin.authors);
        pluginInformations.put("Categories", plugin.categories);
        pluginInformations.put("LatestVersionDate", plugin.getLatestVersion().date);
        pluginInformations.put("LatestVersionName", plugin.getLatestVersion().name);
        pluginInformations.put("LatestVersionFilename", plugin.getLatestVersion().filename);
        pluginInformations.put("LatestVersionMD5", plugin.getLatestVersion().md5);
        pluginInformations.put("LatestVersionLink", plugin.getLatestVersion().link);
        pluginInformations.put("LatestVersionBuilds", plugin.getLatestVersion().builds);
        pluginInformations.put("LatestVersionSoftDependencies", plugin.getLatestVersion().softDependencies);
        pluginInformations.put("LatestVersionHardDependencies", plugin.getLatestVersion().hardDependencies);
        return pluginInformations;
    }
    return new LinkedHashMap<String, Object>();
}

From source file:com.github.nethad.clustermeister.provisioning.jppf.DriverLoadBalancing.java

public Map<String, String> getLoadBalancingConfigValues() {
    if (configuration == null) {
        return Collections.EMPTY_MAP;
    }/*ww w .j a  v  a 2s.c o  m*/

    LinkedHashMap<String, String> values = new LinkedHashMap<String, String>();
    algorithm = configuration.getString(ALGORITHM);
    strategy = configuration.getString(STRATEGY);
    strategies = getStrategies();
    if (isBrokenConfiguration()) {
        return Collections.EMPTY_MAP;
    }
    values.put(JPPFConstants.LOAD_BALANCING_ALGORITHM, algorithm);
    values.put(JPPFConstants.LOAD_BALANCING_STRATEGY, "cmprofile");
    Map<String, String> strategyValues = strategies.get(strategy);
    for (Map.Entry<String, String> entry : strategyValues.entrySet()) {
        values.put("strategy.cmprofile." + entry.getKey(), entry.getValue());
    }
    return values;
}

From source file:com.intel.iotkitlib.LibModules.UserManagement.java

private LinkedHashMap<String, String> createHashMapWithUserID(String userId) {
    LinkedHashMap<String, String> linkedHashMap = new LinkedHashMap<String, String>();
    linkedHashMap.put("user_id", userId);
    return linkedHashMap;
}

From source file:net.hillsdon.reviki.vc.impl.TestSVNPageStore.java

@SuppressWarnings("unchecked")
public void testGetPageWithAttributes() throws PageStoreException {
    final String content = "Content";
    PageReferenceImpl ref = new PageReferenceImpl("Page");
    expect(_operations.checkPath(ref.getPath(), -1L)).andReturn(SVNNodeKind.FILE);
    _operations.getFile(eq(ref.getPath()), eq(-1L), (Map<String, String>) anyObject(),
            (OutputStream) anyObject());
    expectLastCall().andAnswer(new IAnswer<Object>() {
        public Object answer() throws Throwable {
            Map<String, String> properties = (Map<String, String>) getCurrentArguments()[2];
            properties.put("reviki:someKey", "someValue1");
            properties.put("svn:someKey", "someValue2");
            properties.put("someOtherKey", "someValue3");
            OutputStream out = (OutputStream) getCurrentArguments()[3];
            out.write(content.getBytes());
            return null;
        }//from  w  ww.  ja  va 2  s.com
    });
    expect(_operations.getLock(ref.getPath())).andReturn(null);
    replay();
    VersionedPageInfo pageInfo = _store.get(ref, -1);
    assertEquals(ref.getName(), pageInfo.getName());
    assertEquals(content, pageInfo.getContent());
    LinkedHashMap<String, String> expectedProperties = new LinkedHashMap<String, String>();
    expectedProperties.put("someKey", "someValue1");
    assertEquals(expectedProperties, pageInfo.getAttributes());
    verify();
}