NGWVectorLayer

public class NGWVectorLayer extends VectorLayer implements INGWLayer

Fields

DIRECTION_BOTH

protected static final int DIRECTION_BOTH

DIRECTION_FROM

protected static final int DIRECTION_FROM

DIRECTION_TO

protected static final int DIRECTION_TO

JSON_ACCOUNT_KEY

protected static final String JSON_ACCOUNT_KEY

JSON_NGWLAYER_TYPE_KEY

protected static final String JSON_NGWLAYER_TYPE_KEY

JSON_NGW_VERSION_MAJOR_KEY

protected static final String JSON_NGW_VERSION_MAJOR_KEY

JSON_NGW_VERSION_MINOR_KEY

protected static final String JSON_NGW_VERSION_MINOR_KEY

JSON_SERVERWHERE_KEY

protected static final String JSON_SERVERWHERE_KEY

JSON_SYNC_DIRECTION_KEY

protected static final String JSON_SYNC_DIRECTION_KEY

JSON_SYNC_TYPE_KEY

protected static final String JSON_SYNC_TYPE_KEY

JSON_TRACKED_KEY

protected static final String JSON_TRACKED_KEY

TYPE_CHANGES_ATTACH

protected static final int TYPE_CHANGES_ATTACH

TYPE_CHANGES_ATTACH_ID

protected static final int TYPE_CHANGES_ATTACH_ID

TYPE_CHANGES_FEATURE

protected static final int TYPE_CHANGES_FEATURE

TYPE_CHANGES_TABLE

protected static final int TYPE_CHANGES_TABLE

mAccountName

protected String mAccountName

mCRS

protected int mCRS

mIsAddedToUriMatcher

protected static boolean mIsAddedToUriMatcher

mNGWLayerType

protected int mNGWLayerType

mNet

protected NetworkUtil mNet

mNgwVersionMajor

protected int mNgwVersionMajor

mNgwVersionMinor

protected int mNgwVersionMinor

mRemoteId

protected long mRemoteId

mServerWhere

protected String mServerWhere

mSyncDirection

protected int mSyncDirection

mSyncType

protected int mSyncType

mTracked

protected boolean mTracked

Constructors

NGWVectorLayer

public NGWVectorLayer(Context context, File path)

Methods

addChange

public void addChange(long featureId, int operation)

addChange

public void addChange(long featureId, long attachId, int attachOperation)

addFeatureOnServer

protected boolean addFeatureOnServer(long featureId, SyncResult syncResult)

addFeatureOnServer

protected HttpResponse addFeatureOnServer(String payload)

applySync

protected synchronized void applySync(int syncType)

changeAttachOnServer

protected HttpResponse changeAttachOnServer(long featureId, long attachId, String putData)

changeFeatureId

protected void changeFeatureId(long oldFeatureId, long newFeatureId)

changeFeatureOnServer

protected boolean changeFeatureOnServer(long featureId, SyncResult syncResult)

changeFeatureOnServer

protected HttpResponse changeFeatureOnServer(long featureId, String payload)

checkGeometryType

protected boolean checkGeometryType(Feature feature)

compareFeature

protected void compareFeature(Cursor cursor, String authority, Feature remoteFeature, String changeTableName)

create

public void create(int geometryType, List<Field> fields)

createFromNGW

public void createFromNGW(IProgressor progressor)

download and create new NGW layer from GeoJSON data

createNewFeature

protected void createNewFeature(Feature remoteFeature, String authority)

cursorToJson

protected String cursorToJson(Cursor cursor)

delete

public boolean delete()

deleteAllTempAttachesFlags

public int deleteAllTempAttachesFlags()

deleteAllTempFeaturesFlags

public int deleteAllTempFeaturesFlags()

deleteAttachOnServer

protected HttpResponse deleteAttachOnServer(long featureId, long attachId)

deleteFeatureOnServer

protected boolean deleteFeatureOnServer(long featureId, SyncResult syncResult)

deleteFeatureOnServer

protected HttpResponse deleteFeatureOnServer(long featureId)

deleteFeatures

protected void deleteFeatures(List<Long> deleteItems)

deleteInternal

protected int deleteInternal(Uri uri, int uriType, String selection, String[] selectionArgs)

fromJSON

public void fromJSON(JSONObject jsonObject)

getAccountName

public String getAccountName()

getChangeTableName

public String getChangeTableName()

getChangesFromServer

public boolean getChangesFromServer(String authority, SyncResult syncResult)

getFeatures

protected HashMap<Integer, List<Feature>> getFeatures(SyncResult syncResult, boolean tracked)

getFeaturesUrl

protected String getFeaturesUrl(AccountUtil.AccountData accountData)

getHttpConnection

protected HttpURLConnection getHttpConnection(AccountUtil.AccountData accountData)

getRemoteId

public long getRemoteId()

getRemoteUrl

public String getRemoteUrl()

getRequiredCls

protected String getRequiredCls()

getResourceMetaUrl

protected String getResourceMetaUrl(AccountUtil.AccountData accountData)

getServerWhere

public String getServerWhere()

getSyncDirection

public int getSyncDirection()

getSyncType

public int getSyncType()

get synchronization type

Результат:the synchronization type - the OR of this values: SYNC_NONE - no synchronization SYNC_DATA - synchronize only data SYNC_ATTACH - synchronize only attachments SYNC_ALL - synchronize everything

hasAttachChanges

protected boolean hasAttachChanges(long featureId, long attachId)

hasAttachNotSyncFlag

public boolean hasAttachNotSyncFlag(long featureId, long attachId)

hasAttachTempFlag

public boolean hasAttachTempFlag(long featureId, long attachId)

hasFeatureChanges

protected boolean hasFeatureChanges(long featureId)

hasFeatureNotSyncFlag

public boolean hasFeatureNotSyncFlag(long featureId)

hasFeatureTempFlag

public boolean hasFeatureTempFlag(long featureId)

haveFeaturesNotSyncFlag

protected boolean haveFeaturesNotSyncFlag()

insertInternal

protected long insertInternal(ContentValues contentValues)

isChanges

public boolean isChanges()

isRemoteReadOnly

public boolean isRemoteReadOnly()

Indicate if layer can send changes to remote server

Результат:true if layer can send changes to remote server or false

isSyncable

public boolean isSyncable()

Indicate if layer can sync data with remote server

Результат:true if layer can sync or false

log

protected void log(SyncResult syncResult, String code)

log

protected void log(Exception e, String tag)

proceedAddedFeatures

protected void proceedAddedFeatures(List<Feature> added, String authority, String changeTableName)

proceedAttach

protected boolean proceedAttach(JSONObject result, SyncResult syncResult)

proceedChangedFeatures

protected void proceedChangedFeatures(List<Feature> changed, String authority, String changeTableName)

proceedDeletedFeatures

protected void proceedDeletedFeatures(List<Feature> deleted, String changeTableName)

queryFirstTempAttachFlags

public Cursor queryFirstTempAttachFlags()

queryFirstTempFeatureFlags

public Cursor queryFirstTempFeatureFlags()

queryInternal

protected Cursor queryInternal(Uri uri, int uriType, String[] projection, String selection, String[] selectionArgs, String sortOrder, String limit)

readFeatures

protected void readFeatures(JsonReader reader, List<Feature> features)

sendAttachOnServer

protected boolean sendAttachOnServer(long featureId, long attachId, SyncResult syncResult)

sendAttachOnServer

protected HttpResponse sendAttachOnServer(long featureId, AttachItem attach)

sendFeatureAttachOnServer

protected HttpResponse sendFeatureAttachOnServer(JSONObject result, long featureId, AttachItem attach)

sendLocalChanges

public boolean sendLocalChanges(SyncResult syncResult)

setAccountCacheData

public void setAccountCacheData()

setAccountName

public void setAccountName(String accountName)

setAttachNotSyncFlag

public long setAttachNotSyncFlag(long featureId, long attachId, boolean flag)

setAttachTempFlag

public long setAttachTempFlag(long featureId, long attachId, boolean flag)

setFeatureNotSyncFlag

public long setFeatureNotSyncFlag(long featureId, boolean flag)

setFeatureTempFlag

public long setFeatureTempFlag(long featureId, boolean flag)

setRemoteId

public void setRemoteId(long remoteId)

setServerWhere

public void setServerWhere(String serverWhere)

setSyncDirection

public void setSyncDirection(int direction)

setSyncType

public void setSyncType(int syncType)

sync

public void sync(String authority, Pair<Integer, Integer> ver, SyncResult syncResult)

Synchronize changes with NGW. Should be run from non UI thread.

Параметры:
  • authority
    • a content resolver authority (i.e. com.nextgis.mobile.provider)
  • syncResult
    • report some errors via this parameter

toJSON

public JSONObject toJSON()