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

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

Introduction

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

Prototype

public boolean hasNext() 

Source Link

Document

Checks to see if there are more entries still to be iterated.

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   www  .j  ava  2  s  .  c om*/

        }

    } 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//  ww  w .ja v a 2 s  . 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);
        }
    }
}