mirror of
https://gitee.com/jmix/cuba.git
synced 2024-12-05 04:38:10 +08:00
Get rid of views for non-persistent entities. #PL-4147
This commit is contained in:
parent
4ea86790d0
commit
34b7c071cf
@ -194,14 +194,6 @@
|
||||
<property name="whereClause"/>
|
||||
</view>
|
||||
|
||||
<view class="com.haulmont.cuba.security.entity.UserSessionEntity" name="session.browse">
|
||||
<property name="id"/>
|
||||
<property name="login"/>
|
||||
<property name="userName"/>
|
||||
<property name="since"/>
|
||||
<property name="lastUsedTs"/>
|
||||
</view>
|
||||
|
||||
<view class="com.haulmont.cuba.security.entity.LoggedEntity"
|
||||
name="loggedAttrs">
|
||||
<property name="attributes" view="_local"/>
|
||||
|
@ -11,7 +11,6 @@
|
||||
|
||||
<dsContext>
|
||||
<groupDatasource id="sessionsDs" class="com.haulmont.cuba.security.entity.UserSessionEntity"
|
||||
view="session.browse"
|
||||
datasourceClass="com.haulmont.cuba.gui.app.security.session.browse.UserSessionsDatasource">
|
||||
</groupDatasource>
|
||||
</dsContext>
|
||||
|
@ -10,6 +10,7 @@ import com.haulmont.chile.core.model.MetaProperty;
|
||||
import com.haulmont.chile.core.model.impl.AbstractInstance;
|
||||
import com.haulmont.chile.core.model.utils.InstanceUtils;
|
||||
import com.haulmont.cuba.core.entity.Entity;
|
||||
import com.haulmont.cuba.core.global.MetadataTools;
|
||||
import com.haulmont.cuba.core.global.View;
|
||||
import com.haulmont.cuba.core.global.ViewProperty;
|
||||
import com.haulmont.cuba.gui.data.*;
|
||||
@ -108,19 +109,24 @@ public class PropertyDatasourceImpl<T extends Entity>
|
||||
@Override
|
||||
public View getView() {
|
||||
if (view == null) {
|
||||
View masterView = masterDs.getView();
|
||||
if (masterView == null)
|
||||
throw new IllegalStateException("No view for datasource " + masterDs.getId());
|
||||
ViewProperty property = masterView.getProperty(metaProperty.getName());
|
||||
if (property == null)
|
||||
return null;
|
||||
if (property.getView() == null)
|
||||
throw new IllegalStateException("Invalid view definition: " + masterView
|
||||
+ ". Property '" + property + "' must have a view");
|
||||
view = metadata.getViewRepository().findView(getMetaClass(), property.getView().getName());
|
||||
//anonymous (nameless) view
|
||||
if (view == null)
|
||||
view = property.getView();
|
||||
MetaClass metaMetaClass = masterDs.getMetaClass();
|
||||
if (metadata.getTools().isPersistent(metaMetaClass)
|
||||
|| metadata.getTools().isEmbeddable(metaMetaClass)) {
|
||||
View masterView = masterDs.getView();
|
||||
if (masterView == null)
|
||||
throw new IllegalStateException("No view for datasource " + masterDs.getId());
|
||||
|
||||
ViewProperty property = masterView.getProperty(metaProperty.getName());
|
||||
if (property == null)
|
||||
return null;
|
||||
if (property.getView() == null)
|
||||
throw new IllegalStateException("Invalid view definition: " + masterView
|
||||
+ ". Property '" + property + "' must have a view");
|
||||
view = metadata.getViewRepository().findView(getMetaClass(), property.getView().getName());
|
||||
//anonymous (nameless) view
|
||||
if (view == null)
|
||||
view = property.getView();
|
||||
}
|
||||
}
|
||||
return view;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user