portfolio
Portfolio container: one per farmer. Holds the farmer's crop plan line items.
Table factsheetagri_db
- Written by
- Legacy setup (
PortfolioDTO) - Data down-sync (
DataSetupViewModel,UnitDataSetupViewModel,SetupForUser,SetupForUnitInChargeLogin) OptionViewModelrefresh- Create portfolio (
Repo.createIEPortfolio) IePortfolioRepositoryImpl
- Legacy setup (
- Read by
- Portfolio screens
- IEPortfolioMapper (copies into legacy
ie_portfolio)
- Filled from
POST api/setupdata/v2 (PortfolioDTO)GET /gateway/portfolio-service/api/v1/portfolios/ownerEntities- 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_PORTFOLIO.
- Source
- data/src/main/java/org/mindtree/app/agricultor/data/entity/Portfolio.kt
Columns
| Column | Type | Null | Key | Meaning |
|---|---|---|---|---|
owningEntityId | TEXT | Yes | FK → ie_flat_entity.iEOLTPId | Farmer server id (= ie_flat_entity.iEOLTPId), stored as text. Link by convention only, no FK constraint. |
id | INTEGER | Yes | Server id. Null or 0 until the row is synced. | |
uuid | TEXT | Yes | Index | Stable business UUID, also sent to the server. Index: unique. |
appId | TEXT | No | PK | Client-side UUID. Defaults to a random UUID when the object is built, including when server JSON is parsed. |
opId | TEXT | Yes | Id of the last queued operation in the library queue (SYNC_QUEUE_DB). | |
syncStatus | TEXT | No | SYNC_NOT_INITIALIZED | IN_SYNC_QUEUE | SYNC_DONE (default). | |
ownerentitytype_code | TEXT | Yes | Reference data code. | |
ownerentitytype_refclass_code | TEXT | Yes | Reference class of the code (flattened embedded DTO). | |
appmill_metadata_ie_appId | TEXT | Yes | FK → ie.appId | Local 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
- getIEPortfolioByIEAliasId finds portfolios of unsynced farmers by appmill_metadata_ie_appId.
- Possible bug · unverified several queries use appId LIKE :appId (case-insensitive, skips the PK index). Use =.
- Missing index on owningEntityId.