com.backendless.persistence.BackendlessDataQuery Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of android Show documentation
Show all versions of android Show documentation
Android SDK used by developers to provide Backendless API in apps.
/*
* ********************************************************************************************************************
*
* BACKENDLESS.COM CONFIDENTIAL
*
* ********************************************************************************************************************
*
* Copyright 2012 BACKENDLESS.COM. All Rights Reserved.
*
* NOTICE: All information contained herein is, and remains the property of Backendless.com and its suppliers,
* if any. The intellectual and technical concepts contained herein are proprietary to Backendless.com and its
* suppliers and may be covered by U.S. and Foreign Patents, patents in process, and are protected by trade secret
* or copyright law. Dissemination of this information or reproduction of this material is strictly forbidden
* unless prior written permission is obtained from Backendless.com.
*
* ********************************************************************************************************************
*/
package com.backendless.persistence;
import com.backendless.IBackendlessQuery;
import java.util.ArrayList;
import java.util.List;
public class BackendlessDataQuery implements IBackendlessQuery
{
private List properties;
private String whereClause;
private QueryOptions queryOptions;
public BackendlessDataQuery()
{
}
public BackendlessDataQuery( List properties )
{
this.properties = properties;
}
public BackendlessDataQuery( String whereClause )
{
this.whereClause = whereClause;
}
public BackendlessDataQuery( QueryOptions queryOptions )
{
this.queryOptions = queryOptions;
}
public BackendlessDataQuery( List properties, String whereClause, QueryOptions queryOptions )
{
this.properties = properties;
this.whereClause = whereClause;
this.queryOptions = queryOptions;
}
public List getProperties()
{
if( properties == null )
return properties = new ArrayList();
return new ArrayList( properties );
}
public void setProperties( List properties )
{
this.properties = properties;
}
public void addProperty( String property )
{
if( property == null || property.equals( "" ) )
return;
if( properties == null )
properties = new ArrayList();
properties.add( property );
}
public String getWhereClause()
{
return whereClause;
}
public void setWhereClause( String whereClause )
{
this.whereClause = whereClause;
}
public QueryOptions getQueryOptions()
{
if(queryOptions == null)
return null;
return queryOptions.newInstance();
}
public void setQueryOptions( QueryOptions queryOptions )
{
this.queryOptions = queryOptions;
}
//PageSize properties added, because DataQuery and GeoQuery has different architecture
public int getPageSize()
{
return queryOptions == null ? 10 : queryOptions.getPageSize();
}
public void setPageSize( int pageSize )
{
if( queryOptions == null )
queryOptions = new QueryOptions();
queryOptions.setPageSize( pageSize );
}
public int getOffset()
{
return queryOptions == null ? 0 : queryOptions.getOffset();
}
public void setOffset( int offset )
{
if( queryOptions == null )
queryOptions = new QueryOptions();
queryOptions.setOffset( offset );
}
@Override
public BackendlessDataQuery newInstance()
{
BackendlessDataQuery result = new BackendlessDataQuery();
result.setProperties( getProperties() );
result.setWhereClause( whereClause );
result.setQueryOptions( getQueryOptions() );
return result;
}
}