public boolean isJPAEntity(Object value) { if (value != null) { // EntityMetaData will be added for all classes, even those who are // not // JPA-entities to prevent unneeded annotation scanning return getEntityMetaData(value.getClass()).isJPAEntity(); } return false; }
@Override public boolean isAbleToStore(Object value) { boolean canStore = false; if (value instanceof List<?>) { List<?> list = (List<?>) value; if (list.size() > 0) { // We can only store the list if we are sure it's actually a // list of JPA entities. In case the // list is empty, we don't store it. canStore = true; Class<?> entityClass = mappings.getEntityMetaData(list.get(0).getClass()).getEntityClass(); for (Object entity : list) { canStore = entity != null && mappings.isJPAEntity(entity) && mappings.getEntityMetaData(entity.getClass()).getEntityClass().equals(entityClass); if (!canStore) { // In case the object is not a JPA entity or the class // doesn't match, we can't store the list break; } } } } return canStore; }
public String getJPAClassString(Object value) { if (value == null) { throw new ActivitiIllegalArgumentException("null value cannot be saved"); } EntityMetaData metaData = getEntityMetaData(value.getClass()); if (!metaData.isJPAEntity()) { throw new ActivitiIllegalArgumentException("Object is not a JPA Entity: class='" + value.getClass() + "', " + value); } // Extract the class from the Entity instance return metaData.getEntityClass().getName(); }
public String getJPAIdString(Object value) { EntityMetaData metaData = getEntityMetaData(value.getClass()); if (!metaData.isJPAEntity()) { throw new ActivitiIllegalArgumentException("Object is not a JPA Entity: class='" + value.getClass() + "', " + value); } Object idValue = getIdValue(value, metaData); return getIdString(idValue); }
public Object getJPAEntity(String className, String idString) { Class<?> entityClass = null; entityClass = ReflectUtil.loadClass(className); EntityMetaData metaData = getEntityMetaData(entityClass); // Create primary key of right type Object primaryKey = createId(metaData, idString); return findEntity(entityClass, primaryKey); }
public boolean isJPAEntity(Object value) { if (value != null) { // EntityMetaData will be added for all classes, even those who are // not // JPA-entities to prevent unneeded annotation scanning return getEntityMetaData(value.getClass()).isJPAEntity(); } return false; }
public boolean isJPAEntity(Object value) { if (value != null) { // EntityMetaData will be added for all classes, even those who are not // JPA-entities to prevent unneeded annotation scanning return getEntityMetaData(value.getClass()).isJPAEntity(); } return false; }
public boolean isJPAEntity(Object value) { if (value != null) { // EntityMetaData will be added for all classes, even those who are not // JPA-entities to prevent unneeded annotation scanning return getEntityMetaData(value.getClass()).isJPAEntity(); } return false; }
@Override public boolean isAbleToStore(Object value) { boolean canStore = false; if (value instanceof List<?>) { List<?> list = (List<?>) value; if (list.size() > 0) { // We can only store the list if we are sure it's actually a // list of JPA entities. In case the // list is empty, we don't store it. canStore = true; Class<?> entityClass = mappings.getEntityMetaData(list.get(0).getClass()).getEntityClass(); for (Object entity : list) { canStore = entity != null && mappings.isJPAEntity(entity) && mappings.getEntityMetaData(entity.getClass()).getEntityClass().equals(entityClass); if (!canStore) { // In case the object is not a JPA entity or the class // doesn't match, we can't store the list break; } } } } return canStore; }
public String getJPAClassString(Object value) { if (value == null) { throw new ActivitiIllegalArgumentException("null value cannot be saved"); } EntityMetaData metaData = getEntityMetaData(value.getClass()); if (!metaData.isJPAEntity()) { throw new ActivitiIllegalArgumentException("Object is not a JPA Entity: class='" + value.getClass() + "', " + value); } // Extract the class from the Entity instance return metaData.getEntityClass().getName(); }
public String getJPAClassString(Object value) { if(value == null) { throw new ActivitiIllegalArgumentException("null value cannot be saved"); } EntityMetaData metaData = getEntityMetaData(value.getClass()); if(!metaData.isJPAEntity()) { throw new ActivitiIllegalArgumentException("Object is not a JPA Entity: class='" + value.getClass() + "', " + value); } // Extract the ID from the Entity instance using the metaData return metaData.getEntityClass().getName(); }
public String getJPAClassString(Object value) { if (value == null) { throw new ActivitiIllegalArgumentException("null value cannot be saved"); } EntityMetaData metaData = getEntityMetaData(value.getClass()); if (!metaData.isJPAEntity()) { throw new ActivitiIllegalArgumentException("Object is not a JPA Entity: class='" + value.getClass() + "', " + value); } // Extract the class from the Entity instance return metaData.getEntityClass().getName(); }
public String getJPAIdString(Object value) { EntityMetaData metaData = getEntityMetaData(value.getClass()); if (!metaData.isJPAEntity()) { throw new ActivitiIllegalArgumentException("Object is not a JPA Entity: class='" + value.getClass() + "', " + value); } Object idValue = getIdValue(value, metaData); return getIdString(idValue); }
public String getJPAIdString(Object value) { EntityMetaData metaData = getEntityMetaData(value.getClass()); if(!metaData.isJPAEntity()) { throw new ActivitiIllegalArgumentException("Object is not a JPA Entity: class='" + value.getClass() + "', " + value); } Object idValue = getIdValue(value, metaData); return getIdString(idValue); }
public String getJPAIdString(Object value) { EntityMetaData metaData = getEntityMetaData(value.getClass()); if (!metaData.isJPAEntity()) { throw new ActivitiIllegalArgumentException("Object is not a JPA Entity: class='" + value.getClass() + "', " + value); } Object idValue = getIdValue(value, metaData); return getIdString(idValue); }
public Object getJPAEntity(String className, String idString) { Class<?> entityClass = null; entityClass = ReflectUtil.loadClass(className); EntityMetaData metaData = getEntityMetaData(entityClass); // Create primary key of right type Object primaryKey = createId(metaData, idString); return findEntity(entityClass, primaryKey); }
public Object getJPAEntity(String className, String idString) { Class<?> entityClass = null; entityClass = ReflectUtil.loadClass(className); EntityMetaData metaData = getEntityMetaData(entityClass); if (metaData == null) { throw new ActivitiIllegalArgumentException("Class is not a JPA-entity: " + className); } // Create primary key of right type Object primaryKey = createId(metaData, idString); return findEntity(entityClass, primaryKey); }
public Object getJPAEntity(String className, String idString) { Class<?> entityClass = null; entityClass = ReflectUtil.loadClass(className); EntityMetaData metaData = getEntityMetaData(entityClass); if(metaData == null) { throw new ActivitiIllegalArgumentException("Class is not a JPA-entity: " + className); } // Create primary key of right type Object primaryKey = createId(metaData, idString); return findEntity(entityClass, primaryKey); }