Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AC-1099: Migrate FormResourceDAO to Kotlin #1018

Merged
merged 2 commits into from
Aug 27, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -11,38 +11,35 @@
*
* Copyright (C) OpenMRS, LLC. All Rights Reserved.
*/
package com.openmrs.android_sdk.library.dao

package com.openmrs.android_sdk.library.dao;

import java.util.List;

import androidx.room.Dao;
import androidx.room.Insert;
import androidx.room.Query;

import com.openmrs.android_sdk.library.databases.entities.FormResourceEntity;
import androidx.room.Dao
import androidx.room.Insert
import androidx.room.Query
import com.openmrs.android_sdk.library.databases.entities.FormResourceEntity

/**
* The interface Form resource dao.
*/
@Dao
public interface FormResourceDAO {
interface FormResourceDAO {

/**
* Gets form resource by name.
*
* @param name the name
* @return the form resource by name
*/
@Query("SELECT * FROM forms WHERE name = :name")
FormResourceEntity getFormResourceByName(String name);
fun getFormResourceByName(name: String): FormResourceEntity

/**
* Gets form resource list.
*
* @return the form resource list
*/
@Query("SELECT * FROM forms")
List<FormResourceEntity> getFormResourceList();
fun getFormResourceList(): List<FormResourceEntity>

/**
* Gets form by uuid.
Expand All @@ -51,19 +48,19 @@ public interface FormResourceDAO {
* @return the form by uuid
*/
@Query("SELECT * FROM forms WHERE uuid = :uuid")
FormResourceEntity getFormByUuid(String uuid);
fun getFormByUuid(uuid: String): FormResourceEntity

/**
* Delete all forms.
*/
@Query("DELETE FROM forms")
void deleteAllForms();
fun deleteAllForms()

/**
* Add form resource.
*
* @param formResourceEntity the form resource entity
*/
@Insert
void addFormResource(FormResourceEntity formResourceEntity);
}
fun addFormResource(formResourceEntity: FormResourceEntity)
}