Skip to content

Commit

Permalink
move packages & add components controller
Browse files Browse the repository at this point in the history
  • Loading branch information
hknots committed Sep 13, 2024
1 parent df90df6 commit 1911406
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 9 deletions.
21 changes: 21 additions & 0 deletions src/main/kotlin/no/fintlabs/metamodel/ComponentController.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package no.fintlabs.metamodel

import no.fintlabs.metamodel.metadata.MetadataCache
import org.springframework.web.bind.annotation.GetMapping
import org.springframework.web.bind.annotation.RequestMapping
import org.springframework.web.bind.annotation.RestController

@RestController
@RequestMapping("/components")
class ComponentController(val metadataCache: MetadataCache) {

@GetMapping
fun getComponents(): Set<String> {
val uniqueDomainPackages = metadataCache.domainPackageCache.keys
.map { "${it.first}.${it.second}" }
.toSet()

return uniqueDomainPackages
}

}
5 changes: 3 additions & 2 deletions src/main/kotlin/no/fintlabs/metamodel/ReflectionService.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@ package no.fintlabs.metamodel

import jakarta.annotation.PostConstruct
import no.fint.model.FintModelObject
import no.fintlabs.metamodel.model.FintRelationMetadata
import no.fintlabs.metamodel.model.Metadata
import no.fintlabs.metamodel.metadata.MetadataCache
import no.fintlabs.metamodel.metadata.model.FintRelationMetadata
import no.fintlabs.metamodel.metadata.model.Metadata
import org.reflections.Reflections
import org.springframework.stereotype.Service
import java.util.stream.Collectors
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
package no.fintlabs.metamodel
package no.fintlabs.metamodel.metadata

import no.fintlabs.metamodel.model.Metadata
import no.fintlabs.metamodel.metadata.model.Metadata
import org.springframework.stereotype.Service

@Service
class MetadataCache {

private val domainCache: MutableMap<String, List<Metadata>> = mutableMapOf()
private val domainPackageCache: MutableMap<Pair<String, String>, List<Metadata>> = mutableMapOf()
val domainPackageCache: MutableMap<Pair<String, String>, List<Metadata>> = mutableMapOf()
private val resourceCache: MutableMap<Triple<String, String, String>, Metadata> = mutableMapOf()

val metamodels: MutableList<Metadata> = mutableListOf()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package no.fintlabs.metamodel
package no.fintlabs.metamodel.metadata

import no.fintlabs.metamodel.model.Metadata
import no.fintlabs.metamodel.metadata.model.Metadata
import org.springframework.http.HttpStatus
import org.springframework.web.bind.annotation.GetMapping
import org.springframework.web.bind.annotation.PathVariable
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package no.fintlabs.metamodel.model
package no.fintlabs.metamodel.metadata.model

import no.fint.model.FintMultiplicity

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package no.fintlabs.metamodel.model
package no.fintlabs.metamodel.metadata.model

import com.fasterxml.jackson.annotation.JsonInclude

Expand Down

0 comments on commit 1911406

Please sign in to comment.