diff options
Diffstat (limited to 'mdbc-server/src/main/java/org/onap/music/mdbc/MDBCUtils.java')
-rwxr-xr-x | mdbc-server/src/main/java/org/onap/music/mdbc/MDBCUtils.java | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/mdbc-server/src/main/java/org/onap/music/mdbc/MDBCUtils.java b/mdbc-server/src/main/java/org/onap/music/mdbc/MDBCUtils.java index ae2b869..a02e6d0 100755 --- a/mdbc-server/src/main/java/org/onap/music/mdbc/MDBCUtils.java +++ b/mdbc-server/src/main/java/org/onap/music/mdbc/MDBCUtils.java @@ -38,6 +38,7 @@ import org.onap.music.logging.format.ErrorTypes; import org.onap.music.mdbc.mixins.MusicMixin; import org.onap.music.mdbc.mixins.Utils; import org.onap.music.mdbc.query.SQLOperation; +import org.onap.music.mdbc.query.SQLOperationType; import org.onap.music.mdbc.tables.Operation; import org.onap.music.mdbc.tables.StagingTable; @@ -119,4 +120,21 @@ public class MDBCUtils { } return ranges; } + + /** + * determine the type of operation contained in the table to query map + * + * @param tableToQueryType + * @return write if any table has a write query. Read otherwise + */ + public static SQLOperationType getOperationType(Map<String, List<SQLOperation>> tableToQueryType) { + for (List<org.onap.music.mdbc.query.SQLOperation> tablesOps : tableToQueryType.values()) { + for (org.onap.music.mdbc.query.SQLOperation op : tablesOps) { + if (op.getOperationType() != SQLOperationType.READ) { + return SQLOperationType.WRITE; + } + } + } + return SQLOperationType.READ; + } }
\ No newline at end of file |