Example usage for org.apache.commons.collections.iterators EntrySetMapIterator getValue

List of usage examples for org.apache.commons.collections.iterators EntrySetMapIterator getValue

Introduction

In this page you can find the example usage for org.apache.commons.collections.iterators EntrySetMapIterator getValue.

Prototype

public Object getValue() 

Source Link

Document

Gets the current value, which is the value associated with the last key returned by next().

Usage

From source file:com.emergya.persistenceGeo.dbutils.DatabaseUtilsImpl.java

public void changeColumnNames(String tableName, Map<String, String> columns) {
    Set<String> oldColumnNames = columns.keySet();
    Collection<String> newColumnNames = columns.values();
    if (checkClashingColumnNames(oldColumnNames, newColumnNames)) {
        EntrySetMapIterator it = new EntrySetMapIterator(columns);
        while (it.hasNext()) {
            String oldName = (String) it.next();
            String newName = (String) it.getValue();
            try {
                changeColumnName(tableName, oldName, newName);
            } catch (SQLException e) {
                throw new DbUtilsException("Error while change column name. [tableName=" + tableName
                        + ", oldColumn= " + oldName + ", newName=" + newName + "]", e);
            }//from  w  w  w. j  a v  a 2s .co  m

        }

    } else {
        throw new DbUtilsException("An old column name clash with a new name. [tableName=" + tableName + "]");
    }

}

From source file:fr.paris.lutece.plugins.workflow.web.WorkflowJspBean.java

/**
 * Copy the task whose key is specified in the Http request and update param
 * if exists//w w w  .  ja  v  a2s  .  c  om
 * 
 * @param taskToCopy
 *            the task to copy
 * @param mapParamToChange
 *            the map<String, String> of <Param, Value> to change
 * @throws NoSuchMethodException
 *             NoSuchMethodException the {@link NoSuchMethodException}
 * @throws IllegalAccessException
 *             IllegalAccessException the {@link IllegalAccessException}
 * @throws InvocationTargetException
 *             InvocationTargetException the
 *             {@link InvocationTargetException}
 */
public void doCopyTaskWithModifiedParam(ITask taskToCopy, Map<String, String> mapParamToChange)
        throws NoSuchMethodException, IllegalAccessException, InvocationTargetException {
    // Save nIdTaskToCopy
    Integer nIdTaskToCopy = taskToCopy.getId();

    // get the maximum order number in this workflow and set max+1
    int nMaximumOrder = _taskService.findMaximumOrderByActionId(taskToCopy.getAction().getId());
    taskToCopy.setOrder(nMaximumOrder + 1);

    // Create the new task (taskToCopy id will be update with the new
    // idTask)
    _taskService.create(taskToCopy);

    // get all taskConfigService
    List<ITaskConfigService> listTaskConfigService = SpringContextService
            .getBeansOfType(ITaskConfigService.class);

    // For each taskConfigService, update parameter if exists
    for (ITaskConfigService taskConfigService : listTaskConfigService) {
        ITaskConfig taskConfig = taskConfigService.findByPrimaryKey(nIdTaskToCopy);

        if (taskConfig != null) {
            taskConfig.setIdTask(taskToCopy.getId());

            if (mapParamToChange != null) {
                EntrySetMapIterator it = new EntrySetMapIterator(mapParamToChange);

                while (it.hasNext()) {
                    String key = (String) it.next();
                    String value = (String) it.getValue();
                    MethodUtil.set(taskConfig, key, value);
                }
            }

            taskConfigService.create(taskConfig);
        }
    }
}