@Test(expected = IllegalArgumentException.class) public void getFromIllegalExceptionTest() { VitamCodeHelper.getFrom(ServiceName.VITAM, DomainName.TEST, "ZZ"); }
public static VitamCode getFrom(String code) { ParametersChecker.checkParameter("Code cannot be null or empty", code); if (code.length() != VITAM_CODE_SIZE || !VitamCodeHelper.isAlphanumericCode(code)) { throw new IllegalArgumentException("Code must have six characters alphanumerics"); } final ServiceName service = ServiceName.getFromCode(code.substring(START_SERVICE_INDEX, END_SERVICE_START_DOMAIN_INDEX)); final DomainName domain = DomainName.getFromCode(code.substring(END_SERVICE_START_DOMAIN_INDEX, END_DOMAIN_START_ITEM_INDEX)); final String item = code.substring(END_DOMAIN_START_ITEM_INDEX, END_ITEM_INDEX); return getFrom(service, domain, item); }
VitamCodeHelper { public static VitamCode getFrom(String code) { ParametersChecker.checkParameter("Code cannot be null or empty", code); if (code.length() != VITAM_CODE_SIZE || !VitamCodeHelper.isAlphanumericCode(code)) { throw new IllegalArgumentException("Code must have six characters alphanumerics"); } final ServiceName service = ServiceName.getFromCode(code.substring(START_SERVICE_INDEX, END_SERVICE_START_DOMAIN_INDEX)); final DomainName domain = DomainName.getFromCode(code.substring(END_SERVICE_START_DOMAIN_INDEX, END_DOMAIN_START_ITEM_INDEX)); final String item = code.substring(END_DOMAIN_START_ITEM_INDEX, END_ITEM_INDEX); return getFrom(service, domain, item); } }
VitamCodeHelper { public static VitamCode getFrom(String code) { ParametersChecker.checkParameter("Code cannot be null or empty", code); if (code.length() != VITAM_CODE_SIZE || !VitamCodeHelper.isAlphanumericCode(code)) { throw new IllegalArgumentException("Code must have six characters alphanumerics"); } final ServiceName service = ServiceName.getFromCode(code.substring(START_SERVICE_INDEX, END_SERVICE_START_DOMAIN_INDEX)); final DomainName domain = DomainName.getFromCode(code.substring(END_SERVICE_START_DOMAIN_INDEX, END_DOMAIN_START_ITEM_INDEX)); final String item = code.substring(END_DOMAIN_START_ITEM_INDEX, END_ITEM_INDEX); return getFrom(service, domain, item); } private  VitamCodeHelper(); }
VitamCodeHelper { public static VitamCode getFrom(String code) { ParametersChecker.checkParameter("Code cannot be null or empty", code); if (code.length() != VITAM_CODE_SIZE || !VitamCodeHelper.isAlphanumericCode(code)) { throw new IllegalArgumentException("Code must have six characters alphanumerics"); } final ServiceName service = ServiceName.getFromCode(code.substring(START_SERVICE_INDEX, END_SERVICE_START_DOMAIN_INDEX)); final DomainName domain = DomainName.getFromCode(code.substring(END_SERVICE_START_DOMAIN_INDEX, END_DOMAIN_START_ITEM_INDEX)); final String item = code.substring(END_DOMAIN_START_ITEM_INDEX, END_ITEM_INDEX); return getFrom(service, domain, item); } private  VitamCodeHelper(); static boolean isAlphanumericCode(String code); static VitamCode getFrom(String code); static VitamCode getFrom(ServiceName service, DomainName domain, String item); static String getMessage(ServiceName service, DomainName domain, String item); static String getMessageFromVitamCode(VitamCode vitamCode); static String getMessage(String vitamCode); static String getParametrizedMessageFromVitamCode(VitamCode vitamCode, Object... params); static String getParametrizedMessageFromCode(String vitamCode, Object... params); static String getParametrizedMessage(ServiceName service, DomainName domain, String item, Object... params); static List<VitamCode> getFromDomain(DomainName domain); static List<VitamCode> getFromService(ServiceName service); static String getCode(VitamCode vitamCode); static String getLogMessage(VitamCode vitamCode, Object... params); static VitamError toVitamError(VitamCode vitamCode, String description); }
VitamCodeHelper { public static VitamCode getFrom(String code) { ParametersChecker.checkParameter("Code cannot be null or empty", code); if (code.length() != VITAM_CODE_SIZE || !VitamCodeHelper.isAlphanumericCode(code)) { throw new IllegalArgumentException("Code must have six characters alphanumerics"); } final ServiceName service = ServiceName.getFromCode(code.substring(START_SERVICE_INDEX, END_SERVICE_START_DOMAIN_INDEX)); final DomainName domain = DomainName.getFromCode(code.substring(END_SERVICE_START_DOMAIN_INDEX, END_DOMAIN_START_ITEM_INDEX)); final String item = code.substring(END_DOMAIN_START_ITEM_INDEX, END_ITEM_INDEX); return getFrom(service, domain, item); } private  VitamCodeHelper(); static boolean isAlphanumericCode(String code); static VitamCode getFrom(String code); static VitamCode getFrom(ServiceName service, DomainName domain, String item); static String getMessage(ServiceName service, DomainName domain, String item); static String getMessageFromVitamCode(VitamCode vitamCode); static String getMessage(String vitamCode); static String getParametrizedMessageFromVitamCode(VitamCode vitamCode, Object... params); static String getParametrizedMessageFromCode(String vitamCode, Object... params); static String getParametrizedMessage(ServiceName service, DomainName domain, String item, Object... params); static List<VitamCode> getFromDomain(DomainName domain); static List<VitamCode> getFromService(ServiceName service); static String getCode(VitamCode vitamCode); static String getLogMessage(VitamCode vitamCode, Object... params); static VitamError toVitamError(VitamCode vitamCode, String description);  }