Refs #1803 Deprecate LazyCollectionDatasource

This commit is contained in:
Konstantin Krivopustov 2013-01-17 12:17:09 +00:00
parent ccea9f915b
commit 315614e012
9 changed files with 24 additions and 32 deletions

View File

@ -354,7 +354,6 @@ public class Param extends AbstractParam<JComponent> {
CollectionDatasource ds = new DsBuilder(datasource.getDsContext())
.setMetaClass(metaClass)
.setViewName(entityView)
.setFetchMode(CollectionDatasource.FetchMode.AUTO)
.buildCollectionDatasource();
ds.setRefreshOnComponentValueChange(true);

View File

@ -1,17 +1,18 @@
/*
* Copyright (c) 2011 Haulmont Technology Ltd. All Rights Reserved.
* Copyright (c) 2013 Haulmont Technology Ltd. All Rights Reserved.
* Haulmont Technology proprietary and confidential.
* Use is subject to license terms.
* Author: Konstantin Krivopustov
* Created: 21.02.11 14:52
*
* $Id$
*/
package com.haulmont.cuba.gui.components;
import com.haulmont.cuba.gui.data.CollectionDatasource;
/**
* Component that makes a {@link CollectionDatasource} to load data by pages. Usually used inside {@link Table}.
*
* @author krivopustov
* @version $Id$
*/
public interface RowsCount extends Component.BelongToFrame, Component.HasXmlDescriptor {
enum State {

View File

@ -209,7 +209,6 @@ public class RuntimePropertiesFrame extends AbstractWindow {
CollectionDatasource optionsDs = new DsBuilder(datasource.getDsContext())
.setMetaClass(property.getRange().asClass())
.setViewName(View.MINIMAL)
.setFetchMode(CollectionDatasource.FetchMode.AUTO)
.buildCollectionDatasource();
optionsDs.refresh();
Action action = pickerField.getAction(PickerField.LookupAction.NAME);

View File

@ -27,16 +27,6 @@ import java.util.Map;
*/
public interface CollectionDatasource<T extends Entity<K>, K> extends Datasource<T> {
/** Mode of fetching data from database: {@link #ALL}, {@link #LAZY} */
enum FetchMode {
/** Datasource will load all data at once */
ALL,
/** Datasource will try to load data by chunks per UI component request */
LAZY,
/** ALL or LAZY will be choosen on the basis of <code>PersistenceManager<code/> statistics */
AUTO
}
/** Mode of load data from database: {@link #ALWAYS}, {@link #NEVER} */
enum RefreshMode{
/** Datasource will load data for each refresh */
@ -347,4 +337,15 @@ public interface CollectionDatasource<T extends Entity<K>, K> extends Datasource
void pinQuery();
void unpinLastQuery();
}
/** Mode of fetching data from database: {@link #ALL}, {@link #LAZY} */
@Deprecated
enum FetchMode {
/** Datasource will load all data at once */
ALL,
/** Datasource will try to load data by chunks per UI component request */
LAZY,
/** ALL or LAZY will be choosen on the basis of <code>PersistenceManager<code/> statistics */
AUTO
}
}

View File

@ -29,9 +29,6 @@ import org.apache.commons.lang.ObjectUtils;
* If you set <code>master</code> and <code>property</code> properties you will get a <code>PropertyDatasource</code>
* implementation.
*
* If you don't set <code>fetchMode</code> explicitly, lazy implementation may be chosen based on <code>PersistenceManager</code>
* statistics.
*
* @author krivopustov
* @version $Id$
*/
@ -185,10 +182,12 @@ public class DsBuilder {
return this;
}
@Deprecated
public CollectionDatasource.FetchMode getFetchMode() {
return fetchMode;
}
@Deprecated
public DsBuilder setFetchMode(CollectionDatasource.FetchMode fetchMode) {
this.fetchMode = fetchMode;
return this;

View File

@ -24,9 +24,13 @@ import org.perf4j.log4j.Log4JStopWatch;
import java.util.*;
/**
* DEPRECATED. To restrict data loading use {@link com.haulmont.cuba.gui.components.SearchPickerField} and
* {@link com.haulmont.cuba.gui.components.RowsCount} components with usual {@link CollectionDatasourceImpl}.
*
* @author abramov
* @version $Id$
*/
@Deprecated
public class LazyCollectionDatasource<T extends Entity<K>, K>
extends
AbstractCollectionDatasource<T, K>

View File

@ -168,7 +168,6 @@ public class RuntimePropsDatasourceImpl
final CollectionDatasource datasource;
datasource = builder
.setFetchMode(CollectionDatasource.FetchMode.ALL)
.setRefreshMode(CollectionDatasource.RefreshMode.NEVER)
.buildCollectionDatasource();
List<SetValueEntity> options = getOptions(attribute, attributeValue);

View File

@ -128,14 +128,6 @@
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="fetchMode">
<xs:restriction base="xs:string">
<xs:enumeration value="ALL"/>
<xs:enumeration value="LAZY"/>
<xs:enumeration value="AUTO"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="refreshMode">
<xs:restriction base="xs:string">
<xs:enumeration value="ALWAYS"/>
@ -1144,7 +1136,6 @@
<xs:attributeGroup ref="isCollectionDatasource"/>
<xs:attribute name="query" type="xs:string" use="optional"/>
<xs:attribute name="fetchMode" type="fetchMode" use="optional"/>
<xs:attribute name="refreshMode" type="refreshMode" use="optional"/>
<xs:attribute name="softDeletion" type="xs:boolean" use="optional"/>
</xs:complexType>

View File

@ -358,7 +358,6 @@ public class Param extends AbstractParam<Component> {
CollectionDatasource ds = new DsBuilder(datasource.getDsContext())
.setMetaClass(metaClass)
.setViewName(entityView)
.setFetchMode(CollectionDatasource.FetchMode.AUTO)
.buildCollectionDatasource();
ds.setRefreshOnComponentValueChange(true);