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-634 Migrated POJO classes to Kotlin #675

Merged
merged 1 commit into from
Apr 4, 2020
Merged
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions openmrs-client/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,7 @@ dependencies {
implementation 'com.github.AppIntro:AppIntro:5.1.0'
testImplementation(
'org.mockito:mockito-core:2.8.9',
'org.mockito:mockito-inline:2.13.0',
'junit:junit:4.12',
'org.powermock:powermock-api-mockito2:2.0.2',
'org.powermock:powermock-module-junit4:2.0.2'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,6 @@ private List<ViewGroup> generateChildLayouts() {
layouts.add(convertView);
break;
case EncounterType.DISCHARGE:
convertView = openMRSInflater.addSingleStringView(contentLayout, mContext.getString(R.string.list_item_encounter_no_notes));
layouts.add(convertView);
break;
case EncounterType.ADMISSION:
convertView = openMRSInflater.addSingleStringView(contentLayout, mContext.getString(R.string.list_item_encounter_no_notes));
layouts.add(convertView);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ public void startVisit(final Patient patient, @Nullable final StartVisitResponse
visit.setPatient(patient);
visit.setLocation(locationDAO.findLocationByName(OpenMRS.getInstance().getLocation()));

visit.setVisitType(new VisitType(null, OpenMRS.getInstance().getVisitTypeUUID()));
visit.setVisitType(new VisitType("", OpenMRS.getInstance().getVisitTypeUUID()));

Call<Visit> call = restApi.startVisit(visit);
call.enqueue(new Callback<Visit>() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
package org.openmrs.mobile.databases.entities;

import org.openmrs.mobile.models.Resource;

import androidx.annotation.NonNull;
import androidx.room.ColumnInfo;
import androidx.room.Entity;
import org.openmrs.mobile.models.Resource;

@Entity(tableName = "encounters")
public class EncounterEntity extends Resource {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
package org.openmrs.mobile.databases.entities;

import org.openmrs.mobile.models.Resource;

import androidx.annotation.NonNull;
import androidx.room.ColumnInfo;
import androidx.room.Entity;
import org.openmrs.mobile.models.Resource;

@Entity(tableName = "locations")
public class LocationEntity extends Resource {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
package org.openmrs.mobile.databases.entities;

import org.openmrs.mobile.models.Resource;

import androidx.annotation.NonNull;
import androidx.room.ColumnInfo;
import androidx.room.Entity;
import org.openmrs.mobile.models.Resource;

@Entity(tableName = "observations")
public class ObservationEntity extends Resource {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
package org.openmrs.mobile.databases.entities;

import org.openmrs.mobile.models.Resource;

import androidx.annotation.NonNull;
import androidx.room.ColumnInfo;
import androidx.room.Embedded;
import androidx.room.Entity;
import androidx.room.RoomWarnings;
import org.openmrs.mobile.models.Resource;

@Entity(tableName = "patients")
public class PatientEntity extends Resource {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
package org.openmrs.mobile.databases.entities;

import org.openmrs.mobile.models.Resource;

import androidx.annotation.NonNull;
import androidx.room.ColumnInfo;
import androidx.room.Entity;
import org.openmrs.mobile.models.Resource;

@Entity(tableName = "visits")
public class VisitEntity extends Resource {
Expand Down
82 changes: 0 additions & 82 deletions openmrs-client/src/main/java/org/openmrs/mobile/models/Answer.java

This file was deleted.

65 changes: 65 additions & 0 deletions openmrs-client/src/main/java/org/openmrs/mobile/models/Answer.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
/*
* The contents of this file are subject to the OpenMRS Public License
* Version 1.0 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://license.openmrs.org
*
* Software distributed under the License is distributed on an "AS IS"
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
* License for the specific language governing rights and limitations
* under the License.
*
* Copyright (C) OpenMRS, LLC. All Rights Reserved.
*/

package org.openmrs.mobile.models

import android.annotation.SuppressLint
import android.os.Parcel
import android.os.Parcelable

import com.google.gson.annotations.Expose
import com.google.gson.annotations.SerializedName

import java.io.Serializable

class Answer : Serializable, Parcelable {

@SerializedName("concept")
@Expose
var concept: String? = null

@SerializedName("label")
@Expose
var label: String? = null

override fun describeContents(): Int {
return 0
}

override fun writeToParcel(dest: Parcel, flags: Int) {
dest.writeString(this.concept)
dest.writeString(this.label)
}

constructor() {}

constructor(`in`: Parcel) {
this.concept = `in`.readString()
this.label = `in`.readString()
}

companion object {

@SuppressLint("ParcelCreator")
val CREATOR: Parcelable.Creator<Answer> = object : Parcelable.Creator<Answer> {
override fun createFromParcel(source: Parcel): Answer {
return Answer(source)
}

override fun newArray(size: Int): Array<Answer?> {
return arrayOfNulls(size)
}
}
}
}

This file was deleted.

32 changes: 32 additions & 0 deletions openmrs-client/src/main/java/org/openmrs/mobile/models/Concept.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/*
* This Source Code Form is subject to the terms of the Mozilla Public License,
* v. 2.0. If a copy of the MPL was not distributed with this file, You can
* obtain one at http://mozilla.org/MPL/2.0/. OpenMRS is also distributed under
* the terms of the Healthcare Disclaimer located at http://openmrs.org/license.
*
* Copyright (C) OpenMRS Inc. OpenMRS is a registered trademark and the OpenMRS
* graphic logo is a trademark of OpenMRS Inc.
*/

package org.openmrs.mobile.models

import com.google.gson.annotations.Expose
import com.google.gson.annotations.SerializedName

class Concept : Resource() {

override var id: Long? = null

@SerializedName("datatype")
@Expose
var datatype: Datatype? = null

@SerializedName("name")
@Expose
var name: String? = null

@SerializedName("conceptClass")
@Expose
var conceptClass: ConceptClass? = null

}
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@
* Copyright (C) OpenMRS, LLC. All Rights Reserved.
*/

package org.openmrs.mobile.models;
package org.openmrs.mobile.models

public class Datatype extends Resource {

}
class ConceptClass : Resource()
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@
* Copyright (C) OpenMRS, LLC. All Rights Reserved.
*/

package org.openmrs.mobile.models;
package org.openmrs.mobile.models

public class ConceptClass extends Resource {

}
class Datatype : Resource()
Loading