All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.queue_it.connector.CancelMultipleWaitingRoomHelper Maven / Gradle / Ivy

The newest version!
package com.queue_it.connector;

import java.util.List;
import java.util.Map;

public class CancelMultipleWaitingRoomHelper {
    public static final char WAITING_ROOM_WITH_QUEUE_ID_SEPARATOR = '~';
    public static final char WAITING_ROOM_QUEUE_ID_PAIR_SEPARATOR = '_';

    private CancelMultipleWaitingRoomHelper() {
    }

    public static String getCancelUriPath(List> waitingRoomIdWithQueueIdList) {

        if (waitingRoomIdWithQueueIdList == null) {
            throw new IllegalArgumentException();
        }

        if (waitingRoomIdWithQueueIdList.isEmpty()) {
            throw new IllegalStateException();
        }

        StringBuilder waitingRoomWithQueueIdList = new StringBuilder();
        for (Map.Entry waitingRoomIdWithQueueId : waitingRoomIdWithQueueIdList) {
            waitingRoomWithQueueIdList.append(waitingRoomIdWithQueueId.getKey());
            if (!Utils.isNullOrWhiteSpace(waitingRoomIdWithQueueId.getValue())) {
                waitingRoomWithQueueIdList.append(CancelMultipleWaitingRoomHelper.WAITING_ROOM_WITH_QUEUE_ID_SEPARATOR);
                waitingRoomWithQueueIdList.append(waitingRoomIdWithQueueId.getValue());
            }
            waitingRoomWithQueueIdList.append(CancelMultipleWaitingRoomHelper.WAITING_ROOM_QUEUE_ID_PAIR_SEPARATOR);
        }

        waitingRoomWithQueueIdList.deleteCharAt(waitingRoomWithQueueIdList.length() - 1);
        return waitingRoomWithQueueIdList.toString();
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy