public int getOrder() { if (isSimpleProperty()) { if (!isReference()) { return 1; } else { return 2; } } else if (size() == 1) { return 3; } else { return 4; } }
/** * Replace the references of the given entity with persisted ones * * @param entity */ private void replaceReferences(Configuration configuration, Object entity) { BeanMap beanMap = new BeanMap(entity); MappedClass mappedClass = configuration.getMappedClass(entity.getClass()); for (MappedPath mappedPath : mappedClass.getProperties()) { if (mappedPath.isReference() && mappedPath.isSimpleProperty()) { Object value = mappedPath.getMappedProperty().getValue(beanMap); if (value != null && persisted.containsKey(value)) { value = persisted.get(value); mappedPath.getMappedProperty().setValue(beanMap, value); } } } }
private void loadReferences(MappedClass mappedClass, Map<ID, Multimap<UID, STMT>> directProps, Set<ID> handled) { Map<UID, Class<?>> directToType = new HashMap<UID, Class<?>>(); for (MappedPath mappedPath : mappedClass.getProperties()) { if (mappedPath.isReference() && !mappedPath.getPredicatePath().isEmpty()) { MappedProperty<?> property = mappedPath.getMappedProperty(); if (!property.isList()) {
if (mappedPath.isReference()) { if (!(property instanceof ObjectProperty)) { throw new IllegalArgumentException("Expected ObjectProperty for: " + mappedPath); if (mappedProperty.isAnyResource()) { property = new RDFProperty(puid); } else if (mappedPath.isReference() || mappedProperty.isCollection()) { property = new ObjectProperty(puid); } else { } else if (mappedPath.isReference()) { if (property.getRange().isEmpty()) { RDFSClass<?> range = processClass(session,