Skip to content

Commit 1111262

Browse files
authored
CTM-173: EntityComponent cleanup (#3530)
* remove EntityComponentSpec and methods only it used * remove legacy ConstantTestData
1 parent 5d3c7ea commit 1111262

File tree

3 files changed

+5
-809
lines changed

3 files changed

+5
-809
lines changed

core/src/main/scala/org/broadinstitute/dsde/rawls/dataaccess/slick/EntityComponent.scala

Lines changed: 0 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -226,13 +226,6 @@ trait EntityComponent {
226226

227227
// Active actions: only return entities and attributes with their deleted flag set to false
228228

229-
@VisibleForTesting
230-
def activeActionForWorkspace(workspaceContext: Workspace): ReadAction[Seq[EntityAndAttributesResult]] =
231-
sql"""#${baseEntityAndAttributeSql(
232-
workspaceContext
233-
)} where e.deleted = false and e.workspace_id = ${workspaceContext.workspaceIdAsUUID}"""
234-
.as[EntityAndAttributesResult]
235-
236229
// actions which may include "deleted" hidden entities
237230

238231
@VisibleForTesting
@@ -281,22 +274,6 @@ trait EntityComponent {
281274

282275
// Raw query for performing actual deletion (not hiding) of everything that depends on an entity
283276

284-
// noinspection SqlDialectInspection
285-
private object EntityDependenciesDeletionQuery extends RawSqlQuery {
286-
val driver: JdbcProfile = EntityComponent.this.driver
287-
288-
@VisibleForTesting
289-
def deleteAction(workspaceContext: Workspace): WriteAction[Int] = {
290-
val shardId = determineShard(workspaceContext.workspaceIdAsUUID)
291-
292-
sqlu"""delete ea from ENTITY_ATTRIBUTE_#$shardId ea
293-
inner join ENTITY e
294-
on ea.owner_id = e.id
295-
where e.workspace_id=${workspaceContext.workspaceIdAsUUID}
296-
"""
297-
}
298-
}
299-
300277
/*
301278
These methods are only used by unit tests.
302279
They return full, materialized result sets without streaming, and these result sets can be
@@ -371,11 +348,6 @@ trait EntityComponent {
371348
.map(_.flatten)
372349
}
373350

374-
// list all entities or those in a category
375-
@VisibleForTesting
376-
def listActiveEntities(workspaceContext: Workspace): ReadAction[IterableOnce[Entity]] =
377-
EntityAndAttributesRawSqlQuery.activeActionForWorkspace(workspaceContext) map (query => unmarshalEntities(query))
378-
379351
// create or replace entities
380352

381353
// TODO: can this be optimized? It nicely reuses the save(..., entities) method, but that method
@@ -524,11 +496,6 @@ trait EntityComponent {
524496
def deleteFromDb(workspaceContext: Workspace): WriteAction[Int] =
525497
filter(_.workspaceId === workspaceContext.workspaceIdAsUUID).delete
526498

527-
@VisibleForTesting
528-
def deleteEntitiesAndAttributesFromDb(workspaceContext: Workspace): WriteAction[Int] =
529-
EntityDependenciesDeletionQuery.deleteAction(workspaceContext) andThen
530-
filter(_.workspaceId === workspaceContext.workspaceIdAsUUID).delete
531-
532499
// Unmarshal methods
533500

534501
private def unmarshalEntity(entityRecord: EntityRecord, attributes: AttributeMap): Entity =

0 commit comments

Comments
 (0)