v0.2.48..v0.2.49 changeset DbUtils.java
Garret Voltz edited this page Oct 2, 2019
·
1 revision
diff --git a/hoot-services/src/main/java/hoot/services/utils/DbUtils.java b/hoot-services/src/main/java/hoot/services/utils/DbUtils.java
index 6f64234..3dd0307 100644
--- a/hoot-services/src/main/java/hoot/services/utils/DbUtils.java
+++ b/hoot-services/src/main/java/hoot/services/utils/DbUtils.java
@@ -192,6 +192,28 @@ public class DbUtils {
}
/**
+ * Gets the job type for the specified jobId
+ * @param jobId
+ * @return
+ */
+ public static Integer getJobTypeByJobId(String jobId) {
+ return createQuery()
+ .select(jobStatus.jobType)
+ .from(jobStatus)
+ .where(jobStatus.jobId.eq(jobId)).fetchOne();
+ }
+
+ /**
+ * Deletes the specified mapId
+ * @param mapId
+ */
+ public static void deleteMap(Long mapId) {
+ createQuery().delete(maps)
+ .where(maps.id.eq(mapId))
+ .execute();
+ }
+
+ /**
* Creates a new folder under the parent directory
* if not already present and returns it's id
*
@@ -226,19 +248,16 @@ public class DbUtils {
return sql.fetchFirst();
}
- public static void setFolderMapping(Long mapId, Long folderId) {
- Long newId = createQuery()
- .select(Expressions.numberTemplate(Long.class, "nextval('folder_map_mappings_id_seq')"))
- .from()
- .fetchOne();
+ public static List<Long> getChildrenFolders(Long folderId) {
+ List<Long> childrenFolders = createQuery()
+ .select(folders.id)
+ .from(folders)
+ .where(folders.parentId.eq(folderId))
+ .fetch();
- createQuery()
- .insert(folderMapMappings)
- .columns(folderMapMappings.id, folderMapMappings.mapId, folderMapMappings.folderId)
- .values(newId, mapId, folderId).execute();
+ return childrenFolders;
}
-
/**
* Sets the parent directory for the specified folder
*