Skip to content
This repository was archived by the owner on Jul 14, 2024. It is now read-only.
This repository was archived by the owner on Jul 14, 2024. It is now read-only.

NPE because of deleted model (and further handle obsolete resources) #56

@mdutoo

Description

@mdutoo

(when its model still exists, an obsolete Resource i.e. whose model has possibly incompatibly changed should be handled by A. as eager / friendly as possible ResourceEntityMapperService.entityToResource() and B. OPT LATER possibly direct Entity management through REST or embedded admin tool)

For now, a Resource whose model can't be found raises a NullPointerException at https://github.com/pole-numerique/oasis-datacore/blob/master/oasis-datacore-core/src/main/java/org/oasis/datacore/core/entity/EntityModelService.java#L98tresourc because https://github.com/pole-numerique/oasis-datacore/blob/master/oasis-datacore-core/src/main/java/org/oasis/datacore/core/entity/EntityModelService.java#L98

In dev, this happens right now with Resource http://data.oasis-eu.org/dc/type/geo:CountryTK_0/TK

Workaround: use start & limit to query "around" the problematic Resource.

Solution:

  1. DONE 20150331 replace NullPointerException by nice exception OR display it without props but flag it "obsolete" OR skip entity without model or flagged as "obsolete" OPT OR don't skip it only if using specific header switch
    1.1. replace entity.getCachedModel() by EntityModelService.getModel() on top request-bound cache
  2. never delete a model but flag it "deleted" (at least until there are no more resources in it) and its (linking) Resources and Models "obsolete/deleted"
  3. LATER move obsolete Resource to trash collection(s) and allow to manage those, OPT possibly in async else perfs
  4. write (mongo map/reduce, rules) script that detects resources without models
  5. and together: 4. run script in batch, 3. move those to trash, OPT raise alert / or in red in dashboard
  6. LATER OPT never delete a Resource but flag it "deleted" (at least until there are no more resources linking to it) an Resources linking to it "obsolete/deleted"
  7. LATER OPT support other (parts of) Resource lifecycles, unify them, make them flexible / extensible

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions