Utils.java [src/edit] Revision: default  Date:
/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package edit;

import com.jayway.jsonpath.ReadContext;
import csip.SessionLogger;
import java.util.List;
import java.util.Map;

/**
 * EDIT Utils.
 *
 * @author od
 */
public class Utils {

  // check 'R053CY004SD'
  public static void checkEcoclassId(String ecId) {
    if (!isEcoclassId(ecId))
      throw new IllegalArgumentException("Invalid ecoclassid: " + ecId);
  }


  public static boolean isEcoclassId(String ecId) {
    return (ecId.length() == 11
        && (ecId.charAt(0) == 'R' || ecId.charAt(0) == 'F'));
  }


  // R053CY004SD -> 053C
  public static String getMLRA(String ecId) {
    checkEcoclassId(ecId);
    return ecId.substring(1, 5);
  }

}