Changeset 643 for trunk/src/model


Ignore:
Timestamp:
07/19/11 08:01:12 (14 years ago)
Author:
lgiessmann
Message:

trunk: changed the behavior of deleting topics => all constructs that are typed or scoped by a topic that is getting to be marked-as-deleted are marked-as-deleted as well. If a typed or scoped role is getting deleted, the entire parental association is marked-as-deleted; fixed a bug when deleting scoped and typed constructs.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • TabularUnified trunk/src/model/datamodel.lisp

    r642 r643  
    15781578    (mapc (lambda(psi)(mark-as-deleted psi :revision revision
    15791579                                       :source-locator source-locator))
    1580           (psis top :revision 0))
     1580          (psis top :revision revision))
    15811581    (mapc (lambda(sl)(mark-as-deleted sl :revision revision
    15821582                                      :source-locator source-locator))
    1583           (locators top :revision 0))
     1583          (locators top :revision revision))
     1584    (mapc (lambda(ii)(mark-as-deleted ii :revision revision
     1585                                      :source-locator source-locator))
     1586          (item-identifiers top :revision revision))
    15841587    (mapc (lambda (name) (mark-as-deleted name :revision revision
    15851588                                          :source-locator source-locator))
    1586           (names top :revision 0))
     1589          (names top :revision revision))
    15871590    (mapc (lambda (occ) (mark-as-deleted occ :revision revision
    15881591                                         :source-locator source-locator))
    1589           (occurrences top :revision 0))
     1592          (occurrences top :revision revision))
    15901593    (mapc (lambda (ass) (mark-as-deleted ass :revision revision
    15911594                                         :source-locator source-locator))
    15921595          (find-all-associations top :revision 0))
     1596    (let ((ref (reified-construct top :revision revision)))
     1597      (when ref
     1598        (private-delete-reified-construct top ref :revision revision)))
     1599    (dolist (typable (used-as-type top :revision revision))
     1600      (private-delete-typable typable :source-locator source-locator
     1601                              :revision revision))
     1602    (dolist (scopable (used-as-theme top :revision revision))
     1603      (private-delete-scopable scopable :source-locator source-locator
     1604                               :revision revision))
    15931605    (call-next-method)))
     1606
     1607
     1608(defgeneric private-delete-scopable (construct &key source-locator revision)
     1609  (:documentation "This method should be called when a topic that is used
     1610                   as a theme for the passed construct is getting
     1611                   marked-as-deleted, i.e. all scopable constructs, scoped
     1612                   by the deleted topic are marked-as-deleted as well.
     1613                   If the passed construct is a role the entire parent
     1614                   association is deleted, otherwise only the construct itself.")
     1615  (:method ((construct ScopableC) &key source-locator revision)
     1616    (if (typep construct 'RoleC)
     1617        (let ((assoc (parent construct :revision revision)))
     1618          (if assoc
     1619              (mark-as-deleted assoc :source-locator source-locator
     1620                               :revision revision)
     1621              (mark-as-deleted construct :source-locator source-locator
     1622                               :revision revision)))
     1623        (mark-as-deleted construct :source-locator source-locator
     1624                         :revision revision))))
     1625
     1626
     1627(defgeneric private-delete-typable (construct &key source-locator revision)
     1628  (:documentation "This method should be called when a topic that is used
     1629                   as a type for the passed construct is getting
     1630                   marked-as-deleted, i.e. all typable constructs, typed
     1631                   by the deleted topic are marked-as-deleted as well.
     1632                   If the passed construct is a role the entire parent
     1633                   association is deleted, otherwise only the construct itself.")
     1634  (:method ((construct TypableC) &key source-locator revision)
     1635    (if (typep construct 'RoleC)
     1636        (let ((assoc (parent construct :revision revision)))
     1637          (if assoc
     1638              (mark-as-deleted assoc :source-locator source-locator
     1639                               :revision revision)
     1640              (mark-as-deleted construct :source-locator source-locator
     1641                               :revision revision)))
     1642        (mark-as-deleted construct :source-locator source-locator
     1643                         :revision revision))))
    15941644
    15951645
     
    23512401   as deleted."
    23522402  (declare (ignorable source-locator))
    2353   (let ((owner (parent construct :revision 0)))
     2403  (let ((owner (parent construct :revision revision))
     2404        (type-top (instance-of construct :revision revision)))
    23542405    (when owner
    2355       (private-delete-characteristic owner construct :revision revision))))
     2406      (private-delete-characteristic owner construct :revision revision))
     2407    (when type-top
     2408      (private-delete-type construct type-top :revision revision))
     2409    (dolist (theme (themes construct :revision revision))
     2410      (private-delete-theme construct theme :revision revision))))
    23562411
    23572412
     
    26392694  (when (VariantC-p characteristic-symbol)
    26402695    (map 'list #'characteristic (slot-p parent-construct 'variants))))
     2696
     2697
     2698(defmethod mark-as-deleted ((construct NameC) &key source-locator revision)
     2699  "Marks the last active relation between a characteristic and its parent topic
     2700   as deleted."
     2701  (declare (ignorable source-locator))
     2702  (dolist (variant (variants construct :revision revision))
     2703    (private-delete-variant construct variant :revision revision))
     2704  (call-next-method))
    26412705
    26422706
Note: See TracChangeset for help on using the changeset viewer.