Skip to content

Commit

Permalink
AC-1100: Migrate LocationRoomDAO to Kotlin (#1019)
Browse files Browse the repository at this point in the history
* Rename .java to .kt

* AC-1100: Migrate LocationRoomDAO to Kotlin
  • Loading branch information
shubhamsgit authored Aug 27, 2023
1 parent 3ef66f4 commit c97e767
Showing 1 changed file with 13 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,46 +11,41 @@
*
* Copyright (C) OpenMRS, LLC. All Rights Reserved.
*/
package com.openmrs.android_sdk.library.dao

package com.openmrs.android_sdk.library.dao;

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

import com.openmrs.android_sdk.library.databases.entities.LocationEntity;

import java.util.List;

import io.reactivex.Single;
import androidx.room.Dao
import androidx.room.Insert
import androidx.room.Query
import com.openmrs.android_sdk.library.databases.entities.LocationEntity
import io.reactivex.Single

/**
* The interface Location room dao.
*/
@Dao
public interface LocationRoomDAO {
interface LocationRoomDAO {
/**
* Add location long.
*
* @param entity the entity
* @return the long
*/
@Insert
long addLocation(LocationEntity entity);
fun addLocation(entity: LocationEntity): Long

/**
* Delete all locations.
*/
@Query("DELETE FROM locations")
void deleteAllLocations();
fun deleteAllLocations()

/**
* Gets locations.
*
* @return the locations
*/
@Query("SELECT * FROM locations")
Single<List<LocationEntity>> getLocations();
fun getLocations(): Single<List<LocationEntity>>

/**
* Find location by name single.
Expand All @@ -59,7 +54,7 @@ public interface LocationRoomDAO {
* @return the single
*/
@Query("SELECT * FROM locations WHERE display = :mName")
Single<LocationEntity> findLocationByName(String mName);
fun findLocationByName(mName: String): Single<LocationEntity>

/**
* Find location by uuid single.
Expand All @@ -68,5 +63,5 @@ public interface LocationRoomDAO {
* @return the single
*/
@Query("SELECT * FROM locations WHERE uuid = :uuid")
Single<LocationEntity> findLocationByUUID(String uuid);
}
fun findLocationByUUID(uuid: String): Single<LocationEntity>
}

0 comments on commit c97e767

Please sign in to comment.