class SDNCRequestIdUtil {

    public static String getSDNCOriginalRequestId(String newRequestId) {

        // Camunda scripts will add postfix, such as -1, -2, on the original requestID, to make sure requestID is unique
        // while sending request to SDNC
        // In order to use the unique requestID in logging, need to remove the postfix added by the Camunda scripts
        // Verify whether the requestId is a valid UUID with postfix (-1, -2). If yes, it should contain 5 times char
        // '-', since valid UUID contains 4 times '-'
        // If the requestId is not a valid UUID with postfix, we do nothing
        if (newRequestId.split("-").length == 6) {
            return newRequestId.substring(0, newRequestId.lastIndexOf('-'));
        }
        return newRequestId;
    }

    private  SDNCRequestIdUtil();

}