mirror of
https://github.com/strongswan/strongswan.git
synced 2025-10-03 00:00:24 -04:00
android: Add data source to VpnProfile
This commit is contained in:
parent
5f9f279a33
commit
a5167a69e0
@ -49,6 +49,7 @@ public class VpnProfile implements Cloneable
|
||||
private UUID mUUID;
|
||||
private long mId = -1;
|
||||
private boolean mReadOnly;
|
||||
private VpnProfileDataSource mDataSource;
|
||||
|
||||
public enum SelectedAppsHandling
|
||||
{
|
||||
@ -342,6 +343,16 @@ public class VpnProfile implements Cloneable
|
||||
this.mReadOnly = readOnly;
|
||||
}
|
||||
|
||||
public VpnProfileDataSource getDataSource()
|
||||
{
|
||||
return mDataSource;
|
||||
}
|
||||
|
||||
public void setDataSource(VpnProfileDataSource mDataSource)
|
||||
{
|
||||
this.mDataSource = mDataSource;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
|
@ -62,13 +62,13 @@ public class VpnProfileSource implements VpnProfileDataSource
|
||||
@Override
|
||||
public boolean updateVpnProfile(VpnProfile profile)
|
||||
{
|
||||
return vpnProfileSqlDataSource.updateVpnProfile(profile);
|
||||
return profile.getDataSource().updateVpnProfile(profile);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean deleteVpnProfile(VpnProfile profile)
|
||||
{
|
||||
return vpnProfileSqlDataSource.deleteVpnProfile(profile);
|
||||
return profile.getDataSource().deleteVpnProfile(profile);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -291,6 +291,7 @@ public class VpnProfileSqlDataSource implements VpnProfileDataSource
|
||||
{
|
||||
return null;
|
||||
}
|
||||
profile.setDataSource(this);
|
||||
profile.setId(insertId);
|
||||
return profile;
|
||||
}
|
||||
@ -319,6 +320,7 @@ public class VpnProfileSqlDataSource implements VpnProfileDataSource
|
||||
if (cursor.moveToFirst())
|
||||
{
|
||||
profile = VpnProfileFromCursor(cursor);
|
||||
profile.setDataSource(this);
|
||||
}
|
||||
cursor.close();
|
||||
return profile;
|
||||
@ -334,6 +336,7 @@ public class VpnProfileSqlDataSource implements VpnProfileDataSource
|
||||
while (!cursor.isAfterLast())
|
||||
{
|
||||
VpnProfile vpnProfile = VpnProfileFromCursor(cursor);
|
||||
vpnProfile.setDataSource(this);
|
||||
vpnProfiles.add(vpnProfile);
|
||||
cursor.moveToNext();
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user