@@ -609,41 +609,6 @@ func (s *sharedEntryAttributes) remainsToExist() bool {
609609// getRegularDeletes performs deletion calculation on elements that have a schema attached.
610610func (s * sharedEntryAttributes ) getRegularDeletes (deletes []types.DeleteEntry , aggregate bool ) ([]types.DeleteEntry , error ) {
611611 var err error
612- // if entry is a container type, check the keys, to be able to
613- // issue a delte for the whole branch at once via keys
614- // switch s.schema.GetSchema().(type) {
615- // case *sdcpb.SchemaElem_Container:
616- // // deletes for child elements (choice cases) that newly became inactive.
617- // for _, v := range s.choicesResolvers {
618- // // oldBestCaseName := v.getOldBestCaseName()
619- // // newBestCaseName := v.getBestCaseName()
620- // // // so if we have an old and a new best cases (not "") and the names are different,
621- // // // all the old to the deletion list
622- // // if oldBestCaseName != "" && newBestCaseName != "" && oldBestCaseName != newBestCaseName {
623- // // // try fetching the case from the childs
624- // // oldBestCaseEntry, exists := s.childs.GetEntry(oldBestCaseName)
625- // // if exists {
626- // // deletes = append(deletes, oldBestCaseEntry)
627- // // } else {
628- // // // it might be that the child is not loaded into the tree, but just considered from the treecontext cache for the choice/case resolution
629- // // // if so, we create and return the DeleteEntryImpl struct
630- // // path, err := s.SdcpbPath()
631- // // if err != nil {
632- // // return nil, err
633- // // }
634- // // deletes = append(deletes, types.NewDeleteEntryImpl(path, append(s.Path(), oldBestCaseName)))
635- // // }
636- // // }
637- // path, err := s.SdcpbPath()
638- // if err != nil {
639- // return nil, err
640- // }
641- // deleteElements := v.GetDeletes()
642- // for _, de := range deleteElements {
643- // deletes = append(deletes, types.NewDeleteEntryImpl(path, append(s.Path(), de)))
644- // }
645- // }
646- // }
647612
648613 if s .shouldDelete () && ! s .IsRoot () && len (s .GetSchemaKeys ()) == 0 {
649614 return append (deletes , s ), nil
@@ -654,7 +619,8 @@ func (s *sharedEntryAttributes) getRegularDeletes(deletes []types.DeleteEntry, a
654619 if err != nil {
655620 return nil , err
656621 }
657- deletes = append (deletes , types .NewDeleteEntryImpl (path , append (s .Path (), elem )))
622+ path .Elem = append (path .Elem , & sdcpb.PathElem {Name : elem })
623+ deletes = append (deletes , types .NewDeleteEntryImpl (path ))
658624 }
659625
660626 for _ , e := range s .childs .GetAll () {
0 commit comments