Make Metadata implement Session. #PL-1964

This commit is contained in:
Konstantin Krivopustov 2013-03-20 12:05:27 +00:00
parent 232191a7f6
commit e4050463f5
2 changed files with 41 additions and 1 deletions

View File

@ -15,7 +15,7 @@ import com.haulmont.chile.core.model.Session;
* @author krivopustov
* @version $Id$
*/
public interface Metadata {
public interface Metadata extends Session {
String NAME = "cuba_Metadata";

View File

@ -10,6 +10,7 @@ import com.haulmont.bali.util.ReflectionHelper;
import com.haulmont.chile.core.annotations.NamePattern;
import com.haulmont.chile.core.loader.MetadataLoader;
import com.haulmont.chile.core.model.MetaClass;
import com.haulmont.chile.core.model.MetaModel;
import com.haulmont.chile.core.model.Session;
import com.haulmont.chile.core.model.impl.SessionImpl;
import com.haulmont.cuba.core.entity.Entity;
@ -19,7 +20,9 @@ import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import javax.annotation.ManagedBean;
import javax.annotation.Nullable;
import javax.inject.Inject;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.util.regex.Pattern;
@ -258,6 +261,43 @@ public class MetadataImpl implements Metadata {
return val;
}
@Override
public MetaModel getModel(String name) {
return getSession().getModel(name);
}
@Override
public Collection<MetaModel> getModels() {
return getSession().getModels();
}
@Nullable
@Override
public MetaClass getClass(String name) {
return getSession().getClass(name);
}
@Override
public MetaClass getClassNN(String name) {
return getSession().getClass(name);
}
@Nullable
@Override
public MetaClass getClass(Class<?> clazz) {
return getSession().getClass(clazz);
}
@Override
public MetaClass getClassNN(Class<?> clazz) {
return getSession().getClassNN(clazz);
}
@Override
public Collection<MetaClass> getClasses() {
return getSession().getClasses();
}
/**
* Annotation value extractor.
* <p/> Implementations are supposed to be passed to {@link #addMetaAnnotation(MetaClass, String, AnnotationValue)}