Esempio n. 1
0
        void TestR4() //support editing of value including the addition and/or deletion of relationships,
                      //editing text metadata and replacing an existing value's instance with a new instance

        {
            "Demonstrating Requirement #4".title();

            DBElement <int, string>  temp = new DBElement <int, string>();
            ItemEditor <int, string> editItem;

            if (db.containsKey(2))
            {
                db.getValue(2, out temp);
                Write("\n\n --- value before modified---\n");
                temp.showElement();
                editItem = new ItemEditor <int, string>(temp);
                editItem.nameEdit("newName!!");          //edit the name of the value with key 2
                editItem.descrEdit("new description!!"); //edit description
                editItem.dateTimeEdit();                 //update timeStamp
                editItem.addRelationship(18);            //add relationship
                editItem.deleteRelationship(6);          //delete relationship
                editItem.payloadEdit("new payload!!");   //modify payload

                DBElement <int, string> elemNew = new DBElement <int, string>();
                editItem.replaceWithInstance(out elemNew);        // replace an existing value's instance with a new instance
                temp = null;
                Write("\n\n --- value after modified---\n");
                elemNew.showElement();
                editItem = null;
            }

            else
            {
                Write("Value not found!");
            }

            //Write("\n\n Show key/value pairs in data base:\n");
            //db.showDB();
            WriteLine();
            WriteLine();
        }