Database / Farmer

ierolemap

Role or designation of a farmer, such as lead farmer or CRP.

Table factsheetagri_db
Written by
  • Legacy setup (IERoleMapDTO)
  • Data down-sync (SetupService.fetchIERoles from DataSetupViewModel, SetupForUser)
  • Add farmer designation (BridgeSyncHelper.createIE)
  • Response handlers IERoleMapPost/Patch/DeleteRH
Read by
  • Activity tracker (getAllLeadFarmer)
  • IERoleMapMapper (builds legacy ie.designation)
Filled from
POST api/setupdata/v2 (IERoleMapDTO)
GET /ctld/api/ierolemap/v1?criteria=
Sync
appId is a client UUID primary key. syncStatus starts at SYNC_DONE for downloaded rows, becomes SYNC_NOT_INITIALIZED when the row is created or edited on the device, and goes back to SYNC_DONE when the response handler writes the server id. opId holds the id of the last queued library operation. Sync entity IE_ROLE_MAP (POST, PATCH, DELETE).
Source
data/src/main/java/org/mindtree/app/agricultor/data/entity/IERoleMap.kt

Columns

ColumnTypeNullKeyMeaning
isActiveINTEGERYesSoft-delete flag (1 = active).
idINTEGERYesServer id. Null or 0 until the row is synced.
appIdTEXTNoPKClient-side UUID. Defaults to a random UUID when the object is built, including when server JSON is parsed.
opIdTEXTYesId of the last queued operation in the library queue (SYNC_QUEUE_DB).
syncStatusTEXTNoSYNC_NOT_INITIALIZED | IN_SYNC_QUEUE | SYNC_DONE (default).
role_codeTEXTYesRole code, e.g. role.ap.gov.leadfarmer.
role_roleNameTEXTYesDisplay name of the role, e.g. "Lead Farmer". Shown in the designation list.
role_descriptionTEXTYesNo description in code.
role_roleTypeTEXTYesRole type. The app sends ROLE_TYPE.TENANT when it creates a mapping.
ie_idTEXTYesFK → ie_flat_entity.iEOLTPIdFarmer server id. Link by convention only, no FK constraint.
ie_isActiveINTEGERYesActive flag of the embedded object.
ie_person_idINTEGERYesServer id of the embedded object.
ie_person_personprofile_firstNameTEXTYesFarmer profile: first name.
ie_person_personprofile_idINTEGERYesServer id of the embedded object.
ie_caretakertenant_loginNameTEXTYesFarmer caretaker tenant: login name.
ie_caretakertenant_idINTEGERYesServer id of the embedded object.
appmill_metadata_ie_appIdTEXTYesFK → ie.appIdLocal appId of the owning farmer (ie.appId). Used to link rows before the farmer has a server id. Link by convention only, no FK constraint.

Notes

  • getAllLeadFarmer filters role_code = 'role.ap.gov.leadfarmer'.
  • Active roles are looked up by farmer server id or, for unsynced farmers, by local IE appId.