/** * Check that references does not point to self. * @param references from */ private void checkCircularReference(final BeanId... references) { for (BeanId beanId : references) { if (getId().equals(beanId)) { throw CFG310_CIRCULAR_REF(getId(), getId()); } } }
private static void checkDeleteSingleton(Bean bean) { if (bean == null) { return; } if (bean.getId().isSingleton()) { throw CFG307_SINGELTON_REMOVAL(bean.getId()); } }
@EventDoc(module = MODULE_NAME, code = JPA203, desc = JPA203_MSG) public static AbortRuntimeException JPA203_MISSING_THREAD_EMF() { Event event = new Event(MODULE_NAME, JPA203, JPA203_MSG); throw new AbortRuntimeException(event); }
private static void validateId(Bean bean) { if (bean.getId().getInstanceId() == null || "".equals(bean.getId().getInstanceId())) { throw Events.CFG107_MISSING_ID(); } }
private static void validatePropertyNames(Bean bean) { Schema schema = bean.getSchema(); Set<String> schemaPropertyNames = schema.getPropertyNames(); for (String name : bean.getPropertyNames()) { if (!schemaPropertyNames.contains(name)) { throw Events.CFG110_PROP_NOT_EXIST_IN_SCHEMA(name); } } }
private static void checkUniquness(Bean bean, Map<BeanId, Bean> storage) { Collection<Bean> beans = storage.values(); for (Bean existing : beans) { if (bean.getId().equals(existing.getId())) { throw CFG303_BEAN_ALREADY_EXIST(bean.getId()); } } }
private static void checkInstanceExist(Bean bean, Map<BeanId, Bean> storage) { Collection<Bean> beans = storage.values(); for (Bean existingBean : beans) { if (existingBean.getId().equals(bean.getId())) { return; } } throw CFG304_BEAN_DOESNT_EXIST(bean.getId()); }
private static void checkDeleteDefault(Bean bean) { if (bean == null) { return; } if (bean.isDefault()) { throw CFG311_DEFAULT_REMOVAL(bean.getId()); } }
@EventDoc(module = MODULE_NAME, code = CFG107, desc = CFG107_MSG) public static AbortRuntimeException CFG107_MISSING_ID() { Event event = new Event(MODULE_NAME, CFG106, CFG107_MSG); return new AbortRuntimeException(event); }
private static void validateId(Bean bean) { if (bean.getId().getInstanceId() == null || "".equals(bean.getId().getInstanceId())) { throw Events.CFG107_MISSING_ID(); } }
private static void validatePropertyNames(Bean bean) { Schema schema = bean.getSchema(); Set<String> schemaPropertyNames = schema.getPropertyNames(); for (String name : bean.getPropertyNames()) { if (!schemaPropertyNames.contains(name)) { throw Events.CFG110_PROP_NOT_EXIST_IN_SCHEMA(name); } } }
private static void checkUniquness(Bean bean) { Collection<Bean> beans = storage.all(); for (Bean existing : beans) { if (bean.getId().equals(existing.getId())) { throw CFG303_BEAN_ALREADY_EXIST(bean.getId()); } } }
private static void checkInstanceExist(Bean bean) { Collection<Bean> beans = storage.all(); for (Bean existingBean : beans) { if (existingBean.getId().equals(bean.getId())) { return; } } throw CFG304_BEAN_DOESNT_EXIST(bean.getId()); }
@EventDoc(module = MODULE_NAME, code = JPA202, desc = JPA202_MSG) public static AbortRuntimeException JPA202_MISSING_THREAD_EM() { Event event = new Event(MODULE_NAME, JPA202, JPA202_MSG); throw new AbortRuntimeException(event); }
public static AbortRuntimeException CFG301_MISSING_RUNTIME_REF() { Event event = new Event(MODULE_NAME, CFG301, CFG301_MSG_3); return new AbortRuntimeException(event); }
@EventDoc(module = MODULE_NAME, code = JPA201, desc = JPA201_MSG) public static AbortRuntimeException JPA201_PROP_FILEPATH_MISSING(String prop) { Event event = new Event(MODULE_NAME, JPA201, MessageFormat.format(JPA201_MSG, prop)); throw new AbortRuntimeException(event); }