Skip to content

chore: [ANDROSDK-2326] migrate Note, CustomIcon and FileResource to kotlin#2641

Merged
taridepaco merged 10 commits into
developfrom
ANDROSDK-2326
Jun 25, 2026
Merged

chore: [ANDROSDK-2326] migrate Note, CustomIcon and FileResource to kotlin#2641
taridepaco merged 10 commits into
developfrom
ANDROSDK-2326

Conversation

@taridepaco

@taridepaco taridepaco commented Jun 17, 2026

Copy link
Copy Markdown
Collaborator

Migrates the Note, NoteCreateProjection, CustomIcon and FileResource domain models from Java AutoValue to Kotlin data classes using the @ModelBuilder annotation, continuing the ongoing model-to-Kotlin migration (batch 11). No user-visible behavior change.

For FileResource, uid is kept non-null (it is the database primary key), while the remaining fields stay nullable to preserve the previous AutoValue contract. FileResourceStorageStatus was made public because a public Kotlin data class cannot expose an internal type through its generated constructor/copy(); the public API dump was regenerated accordingly.

Related task: ANDROSDK-2326

try {
val generatedUid = UidGeneratorImpl().generate()
val dstFile = saveFile(o, generatedUid, context)
val fileResource = transformer.transform(dstFile).toBuilder().uid(generatedUid).name(o.name).build()

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The generatedUid could be removed because it is assigned in the transformer, isn't it?

private suspend fun deleteFileResources(fileResources: List<FileResource>) {
fileResources.forEach { fileResource ->
fileResource.uid()?.let { uid ->
fileResource.uid.let { uid ->

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

uid can't no longer be null, right?. If so, wouldn't be better remove the let for clarity?, something like:
fileResourceStore.deleteIfExists(fileResource.uid) fileResource.path()?.let { path -> deleteFile(path) }

@sonarqubecloud

Copy link
Copy Markdown

@taridepaco taridepaco merged commit de0f58e into develop Jun 25, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants