33
33
* Created by k3b on 30.11.2019.
34
34
*/
35
35
public class MediaRepositoryApiWrapper implements IMediaRepositoryApi {
36
- protected final IMediaRepositoryApi readChild ;
37
- protected final IMediaRepositoryApi writeChild ;
38
- protected final IMediaRepositoryApi transactionChild ;
36
+ private final IMediaRepositoryApi readChild ;
37
+ private final IMediaRepositoryApi writeChild ;
38
+ private final IMediaRepositoryApi transactionChild ;
39
39
40
40
/**
41
41
* count the non path write calls
@@ -54,27 +54,27 @@ public MediaRepositoryApiWrapper(IMediaRepositoryApi readChild, IMediaRepository
54
54
55
55
@ Override
56
56
public Cursor createCursorForQuery (StringBuilder out_debugMessage , String dbgContext , QueryParameter parameters , VISIBILITY visibility , CancellationSignal cancellationSignal ) {
57
- return readChild .createCursorForQuery (out_debugMessage , dbgContext , parameters , visibility , cancellationSignal );
57
+ return getReadChild () .createCursorForQuery (out_debugMessage , dbgContext , parameters , visibility , cancellationSignal );
58
58
}
59
59
60
60
@ Override
61
61
public Cursor createCursorForQuery (StringBuilder out_debugMessage , String dbgContext , String from , String sqlWhereStatement , String [] sqlWhereParameters , String sqlSortOrder , CancellationSignal cancellationSignal , String ... sqlSelectColums ) {
62
- return readChild .createCursorForQuery (out_debugMessage , dbgContext , from , sqlWhereStatement , sqlWhereParameters , sqlSortOrder , cancellationSignal , sqlSelectColums );
62
+ return getReadChild () .createCursorForQuery (out_debugMessage , dbgContext , from , sqlWhereStatement , sqlWhereParameters , sqlSortOrder , cancellationSignal , sqlSelectColums );
63
63
}
64
64
65
65
@ Override
66
66
public int execUpdate (String dbgContext , long id , ContentValues values ) {
67
- return writeChild .execUpdate (dbgContext , id , values );
67
+ return getWriteChild () .execUpdate (dbgContext , id , values );
68
68
}
69
69
70
70
@ Override
71
71
public int execUpdate (String dbgContext , String path , ContentValues values , VISIBILITY visibility ) {
72
- return writeChild .execUpdate (dbgContext , path , values , visibility );
72
+ return getWriteChild () .execUpdate (dbgContext , path , values , visibility );
73
73
}
74
74
75
75
@ Override
76
76
public int exexUpdateImpl (String dbgContext , ContentValues values , String sqlWhere , String [] selectionArgs ) {
77
- return writeChild .exexUpdateImpl (dbgContext , values , sqlWhere , selectionArgs );
77
+ return getWriteChild () .exexUpdateImpl (dbgContext , values , sqlWhere , selectionArgs );
78
78
}
79
79
80
80
/**
@@ -88,7 +88,7 @@ public int exexUpdateImpl(String dbgContext, ContentValues values, String sqlWhe
88
88
*/
89
89
@ Override
90
90
public Long insertOrUpdateMediaDatabase (String dbgContext , String dbUpdateFilterJpgFullPathName , ContentValues values , VISIBILITY visibility , Long updateSuccessValue ) {
91
- return writeChild .insertOrUpdateMediaDatabase (dbgContext , dbUpdateFilterJpgFullPathName , values , visibility , updateSuccessValue );
91
+ return getWriteChild () .insertOrUpdateMediaDatabase (dbgContext , dbUpdateFilterJpgFullPathName , values , visibility , updateSuccessValue );
92
92
}
93
93
94
94
/**
@@ -99,44 +99,56 @@ public Long insertOrUpdateMediaDatabase(String dbgContext, String dbUpdateFilter
99
99
*/
100
100
@ Override
101
101
public Uri execInsert (String dbgContext , ContentValues values ) {
102
- return writeChild .execInsert (dbgContext , values );
102
+ return getWriteChild () .execInsert (dbgContext , values );
103
103
}
104
104
105
105
/**
106
106
* Deletes media items specified by where with the option to prevent cascade delete of the image.
107
107
*/
108
108
@ Override
109
109
public int deleteMedia (String dbgContext , String where , String [] selectionArgs , boolean preventDeleteImageFile ) {
110
- return writeChild .deleteMedia (dbgContext , where , selectionArgs , preventDeleteImageFile );
110
+ return getWriteChild () .deleteMedia (dbgContext , where , selectionArgs , preventDeleteImageFile );
111
111
}
112
112
113
113
@ Override
114
114
public ContentValues getDbContent (long id ) {
115
- return readChild .getDbContent (id );
115
+ return getReadChild () .getDbContent (id );
116
116
}
117
117
118
118
@ Override
119
119
public long getCurrentUpdateId () {
120
- return transactionChild .getCurrentUpdateId ();
120
+ return getTransactionChild () .getCurrentUpdateId ();
121
121
}
122
122
123
123
@ Override
124
124
public boolean mustRequery (long updateId ) {
125
- return transactionChild .mustRequery (updateId );
125
+ return getTransactionChild () .mustRequery (updateId );
126
126
}
127
127
128
128
@ Override
129
129
public void beginTransaction () {
130
- transactionChild .beginTransaction ();
130
+ getTransactionChild () .beginTransaction ();
131
131
}
132
132
133
133
@ Override
134
134
public void setTransactionSuccessful () {
135
- transactionChild .setTransactionSuccessful ();
135
+ getTransactionChild () .setTransactionSuccessful ();
136
136
}
137
137
138
138
@ Override
139
139
public void endTransaction () {
140
- transactionChild .endTransaction ();
140
+ getTransactionChild ().endTransaction ();
141
+ }
142
+
143
+ protected IMediaRepositoryApi getReadChild () {
144
+ return readChild ;
145
+ }
146
+
147
+ protected IMediaRepositoryApi getWriteChild () {
148
+ return writeChild ;
149
+ }
150
+
151
+ protected IMediaRepositoryApi getTransactionChild () {
152
+ return transactionChild ;
141
153
}
142
154
}
0 commit comments