private FilterSource[] buildFilterSources() { final int size = manyToManyElement.getFilter().size(); if (size == 0) { return null; } FilterSource[] results = new FilterSource[size]; for (int i = 0; i < size; i++) { JaxbFilterElement element = manyToManyElement.getFilter().get(i); results[i] = new FilterSourceImpl(sourceMappingDocument(), element); } return results; }
@Override public FetchTiming getFetchTiming() { final String fetchSelection = manyToManyElement.getFetch() != null ? manyToManyElement.getFetch().value() : null; final String lazySelection = manyToManyElement.getLazy() != null ? manyToManyElement.getLazy().value() : null; final String outerJoinSelection = manyToManyElement.getOuterJoin() != null ? manyToManyElement.getOuterJoin().value() : null; if (lazySelection == null) { if ("join".equals(fetchSelection) || "true".equals(outerJoinSelection)) { return FetchTiming.IMMEDIATE; } else if ("false".equals(outerJoinSelection)) { return FetchTiming.DELAYED; } else { // default is FetchTiming.IMMEDIATE. return FetchTiming.IMMEDIATE; } } else if ("true".equals(lazySelection)) { return FetchTiming.DELAYED; } else if ("false".equals(lazySelection)) { return FetchTiming.IMMEDIATE; } // TODO: improve this method to say attribute name. throw new MappingException( String.format("Unexpected lazy selection [%s] on many-to-many element", lazySelection), origin()); }
@Override public String getOrder() { return manyToManyElement.getOrderBy(); }
@Override public String getWhere() { return manyToManyElement.getWhere(); }
@Override public boolean isUnique() { return manyToManyElement.isUnique(); }
@Override public JoinColumnResolutionDelegate getForeignKeyTargetColumnResolutionDelegate() { return manyToManyElement.getPropertyRef() == null ? null : new JoinColumnResolutionDelegateImpl(); }
@Override public String getExplicitForeignKeyName() { return manyToManyElement.getForeignKey(); }
@Override public boolean isNotFoundAnException() { return manyToManyElement.getNotFound() == null || !"ignore".equals(manyToManyElement.getNotFound().value()); }
@Override public String getReferencedEntityAttributeName() { return manyToManyElement.getPropertyRef(); }
@Override public String getReferencedEntityName() { return StringHelper.isNotEmpty(manyToManyElement.getEntityName()) ? manyToManyElement.getEntityName() : bindingContext().qualifyClassName(manyToManyElement.getClazz()); }