
START TRANSACTION;

INSERT INTO CONTENT (EXECUTION_PATH,VISIBLE,KEY_EXECUTION_PATH_VALUE,CONTENT_ID,CREATION_DATE,NAME,TITLE,BODY,DESCRIPTION,NORMALIZED_NAME,KEY_PORTAL,KEY_AVAILABILITY_POLICY,KEY_ROOT_DOMAIN_OBJECT,KEY_CREATOR,OJB_CONCRETE_CLASS) VALUES ('/search.do?method=prepare',null,1,'fca501f0-9091-4629-be38-d8da2f5c2ebe','2008-08-01 12:57:57','en10:Validationpt9:Validação','en17:Theses Validationpt25:Validação de Dissertações',null,null,'en10:validationpt9:validacao',null,null,1,null,'net.sourceforge.fenixedu.domain.functionalities.Functionality')  ;

INSERT INTO NODE (NODE_ORDER,ASCENDING,VISIBLE,CONTENT_ID,KEY_CHILD,KEY_PARENT,KEY_ROOT_DOMAIN_OBJECT,OJB_CONCRETE_CLASS) VALUES (5,1,1,'9dc80775-4df0-4876-b991-cff3bcbd59cb:fca501f0-9091-4629-be38-d8da2f5c2ebe',2,3,1,'net.sourceforge.fenixedu.domain.contents.ExplicitOrderNode')  ;

INSERT INTO EXECUTION_PATH (EXECUTION_PATH,CONTENT_ID,KEY_FUNCTIONALITY,KEY_ROOT_DOMAIN_OBJECT) VALUES ('/search.do?method=prepare','59f4438a-15d3-4406-86cd-d319e422498b',4,1)  ;

CREATE TEMPORARY TABLE UUID_TEMP_TABLE(COUNTER integer, UUID varchar(255), FROM_UUID varchar(255));

INSERT INTO UUID_TEMP_TABLE(COUNTER,UUID,FROM_UUID) VALUES(1,'TOKEN(EXECUTION_PATH,1340)','fca501f0-9091-4629-be38-d8da2f5c2ebe') ;
INSERT INTO UUID_TEMP_TABLE(COUNTER,UUID,FROM_UUID) VALUES(2,'fca501f0-9091-4629-be38-d8da2f5c2ebe','9dc80775-4df0-4876-b991-cff3bcbd59cb:fca501f0-9091-4629-be38-d8da2f5c2ebe') ;
INSERT INTO UUID_TEMP_TABLE(COUNTER,UUID,FROM_UUID) VALUES(3,'9dc80775-4df0-4876-b991-cff3bcbd59cb','9dc80775-4df0-4876-b991-cff3bcbd59cb:fca501f0-9091-4629-be38-d8da2f5c2ebe') ;
INSERT INTO UUID_TEMP_TABLE(COUNTER,UUID,FROM_UUID) VALUES(4,'fca501f0-9091-4629-be38-d8da2f5c2ebe','59f4438a-15d3-4406-86cd-d319e422498b') ;
ALTER TABLE UUID_TEMP_TABLE ADD INDEX (COUNTER), ADD INDEX (UUID), ADD INDEX (FROM_UUID); 


UPDATE NODE T, UUID_TEMP_TABLE UIT, CONTENT CT set T.KEY_PARENT=CT.ID_INTERNAL WHERE T.KEY_PARENT=UIT.COUNTER AND T.CONTENT_ID = UIT.FROM_UUID AND CT.CONTENT_ID=UIT.UUID;
UPDATE NODE T, UUID_TEMP_TABLE UIT, CONTENT CT set T.KEY_CHILD=CT.ID_INTERNAL WHERE T.KEY_CHILD=UIT.COUNTER AND T.CONTENT_ID = UIT.FROM_UUID AND CT.CONTENT_ID=UIT.UUID;
UPDATE CONTENT T, UUID_TEMP_TABLE UIT, CONTENT CT set T.KEY_FUNCTIONALITY=CT.ID_INTERNAL WHERE T.KEY_FUNCTIONALITY=UIT.COUNTER AND T.CONTENT_ID = UIT.FROM_UUID AND CT.CONTENT_ID=UIT.UUID;
UPDATE CONTENT T, UUID_TEMP_TABLE UIT, EXECUTION_PATH CT set T.KEY_EXECUTION_PATH_VALUE=CT.ID_INTERNAL WHERE T.KEY_EXECUTION_PATH_VALUE=UIT.COUNTER AND T.CONTENT_ID = UIT.FROM_UUID AND CT.CONTENT_ID=UIT.UUID;
UPDATE CONTENT T, UUID_TEMP_TABLE UIT, CONTENT CT set T.KEY_INITIAL_CONTENT=CT.ID_INTERNAL WHERE T.KEY_INITIAL_CONTENT=UIT.COUNTER AND T.CONTENT_ID = UIT.FROM_UUID AND CT.CONTENT_ID=UIT.UUID;
UPDATE CONTENT T, UUID_TEMP_TABLE UIT, CONTENT CT set T.KEY_PORTAL=CT.ID_INTERNAL WHERE T.KEY_PORTAL=UIT.COUNTER AND T.CONTENT_ID = UIT.FROM_UUID AND CT.CONTENT_ID=UIT.UUID;
UPDATE CONTENT T, UUID_TEMP_TABLE UIT, AVAILABILITY_POLICY CT set T.KEY_AVAILABILITY_POLICY=CT.ID_INTERNAL WHERE T.KEY_AVAILABILITY_POLICY=UIT.COUNTER AND T.CONTENT_ID = UIT.FROM_UUID AND CT.CONTENT_ID=UIT.UUID;
UPDATE AVAILABILITY_POLICY T, UUID_TEMP_TABLE UIT, CONTENT CT set T.KEY_CONTENT=CT.ID_INTERNAL WHERE T.KEY_CONTENT=UIT.COUNTER AND T.CONTENT_ID = UIT.FROM_UUID AND CT.CONTENT_ID=UIT.UUID;
UPDATE EXECUTION_PATH T, UUID_TEMP_TABLE UIT, CONTENT CT set T.KEY_FUNCTIONALITY=CT.ID_INTERNAL WHERE T.KEY_FUNCTIONALITY=UIT.COUNTER AND T.CONTENT_ID = UIT.FROM_UUID AND CT.CONTENT_ID=UIT.UUID;
DROP TABLE UUID_TEMP_TABLE;

UPDATE NODE SET NODE_ORDER=1,ASCENDING=1,VISIBLE=1,CONTENT_ID='e3c3fb6f3aafda51fe0ff71197109c19:2faa16c6-6696-44a9-9d0c-d6c9d51b42b9',KEY_CHILD=5,KEY_PARENT=6,KEY_ROOT_DOMAIN_OBJECT=1,OJB_CONCRETE_CLASS='net.sourceforge.fenixedu.domain.contents.ExplicitOrderNode' WHERE CONTENT_ID = 'e3c3fb6f3aafda51fe0ff71197109c19:2faa16c6-6696-44a9-9d0c-d6c9d51b42b9'  ;

UPDATE NODE SET NODE_ORDER=0,ASCENDING=1,VISIBLE=0,CONTENT_ID='e3c3fb6f3aafda51fe0ff71197109c19:11ab0ab3-56a2-4bb8-9256-2bde9d159697',KEY_CHILD=7,KEY_PARENT=8,KEY_ROOT_DOMAIN_OBJECT=1,OJB_CONCRETE_CLASS='net.sourceforge.fenixedu.domain.contents.ExplicitOrderNode' WHERE CONTENT_ID = 'e3c3fb6f3aafda51fe0ff71197109c19:11ab0ab3-56a2-4bb8-9256-2bde9d159697'  ;

UPDATE NODE SET NODE_ORDER=2,ASCENDING=1,VISIBLE=1,CONTENT_ID='e3c3fb6f3aafda51fe0ff71197109c19:384a11b9-351d-46a1-9bce-0235e0fe31a7',KEY_CHILD=9,KEY_PARENT=10,KEY_ROOT_DOMAIN_OBJECT=1,OJB_CONCRETE_CLASS='net.sourceforge.fenixedu.domain.contents.ExplicitOrderNode' WHERE CONTENT_ID = 'e3c3fb6f3aafda51fe0ff71197109c19:384a11b9-351d-46a1-9bce-0235e0fe31a7'  ;

UPDATE NODE SET NODE_ORDER=2,ASCENDING=1,VISIBLE=1,CONTENT_ID='9dc80775-4df0-4876-b991-cff3bcbd59cb:384a11b9-351d-46a1-9bce-0235e0fe31a7',KEY_CHILD=11,KEY_PARENT=12,KEY_ROOT_DOMAIN_OBJECT=1,OJB_CONCRETE_CLASS='net.sourceforge.fenixedu.domain.contents.ExplicitOrderNode' WHERE CONTENT_ID = '9dc80775-4df0-4876-b991-cff3bcbd59cb:384a11b9-351d-46a1-9bce-0235e0fe31a7'  ;

UPDATE NODE SET NODE_ORDER=3,ASCENDING=1,VISIBLE=0,CONTENT_ID='9dc80775-4df0-4876-b991-cff3bcbd59cb:81237d1d-e3ef-4252-936f-e9da63667d39',KEY_CHILD=13,KEY_PARENT=14,KEY_ROOT_DOMAIN_OBJECT=1,OJB_CONCRETE_CLASS='net.sourceforge.fenixedu.domain.contents.ExplicitOrderNode' WHERE CONTENT_ID = '9dc80775-4df0-4876-b991-cff3bcbd59cb:81237d1d-e3ef-4252-936f-e9da63667d39'  ;

UPDATE NODE SET NODE_ORDER=0,ASCENDING=1,VISIBLE=0,CONTENT_ID='9dc80775-4df0-4876-b991-cff3bcbd59cb:11ab0ab3-56a2-4bb8-9256-2bde9d159697',KEY_CHILD=15,KEY_PARENT=16,KEY_ROOT_DOMAIN_OBJECT=1,OJB_CONCRETE_CLASS='net.sourceforge.fenixedu.domain.contents.ExplicitOrderNode' WHERE CONTENT_ID = '9dc80775-4df0-4876-b991-cff3bcbd59cb:11ab0ab3-56a2-4bb8-9256-2bde9d159697'  ;

UPDATE NODE SET NODE_ORDER=4,ASCENDING=1,VISIBLE=1,CONTENT_ID='9dc80775-4df0-4876-b991-cff3bcbd59cb:fca501f0-9091-4629-be38-d8da2f5c2ebe',KEY_CHILD=17,KEY_PARENT=18,KEY_ROOT_DOMAIN_OBJECT=1,OJB_CONCRETE_CLASS='net.sourceforge.fenixedu.domain.contents.ExplicitOrderNode' WHERE CONTENT_ID = '9dc80775-4df0-4876-b991-cff3bcbd59cb:fca501f0-9091-4629-be38-d8da2f5c2ebe'  ;

UPDATE NODE SET NODE_ORDER=1,ASCENDING=1,VISIBLE=1,CONTENT_ID='9dc80775-4df0-4876-b991-cff3bcbd59cb:2faa16c6-6696-44a9-9d0c-d6c9d51b42b9',KEY_CHILD=19,KEY_PARENT=20,KEY_ROOT_DOMAIN_OBJECT=1,OJB_CONCRETE_CLASS='net.sourceforge.fenixedu.domain.contents.ExplicitOrderNode' WHERE CONTENT_ID = '9dc80775-4df0-4876-b991-cff3bcbd59cb:2faa16c6-6696-44a9-9d0c-d6c9d51b42b9'  ;

UPDATE NODE SET NODE_ORDER=3,ASCENDING=1,VISIBLE=0,CONTENT_ID='e3c3fb6f3aafda51fe0ff71197109c19:81237d1d-e3ef-4252-936f-e9da63667d39',KEY_CHILD=21,KEY_PARENT=22,KEY_ROOT_DOMAIN_OBJECT=1,OJB_CONCRETE_CLASS='net.sourceforge.fenixedu.domain.contents.ExplicitOrderNode' WHERE CONTENT_ID = 'e3c3fb6f3aafda51fe0ff71197109c19:81237d1d-e3ef-4252-936f-e9da63667d39'  ;

DELETE FROM NODE WHERE CONTENT_ID = 'e3c3fb6f3aafda51fe0ff71197109c19:6a502dd9-0466-4e58-82e3-05a5b93a8c67' ;

DELETE FROM CONTENT WHERE CONTENT_ID = 'e3c3fb6f3aafda51fe0ff71197109c19:6a502dd9-0466-4e58-82e3-05a5b93a8c67' ;

DELETE FROM EXECUTION_PATH WHERE CONTENT_ID = '6a502dd9-0466-4e58-82e3-05a5b93a8c67' ;

DELETE FROM CONTENT WHERE CONTENT_ID = '6a502dd9-0466-4e58-82e3-05a5b93a8c67' ;

DELETE FROM NODE WHERE CONTENT_ID = '9dc80775-4df0-4876-b991-cff3bcbd59cb:6a502dd9-0466-4e58-82e3-05a5b93a8c67' ;

CREATE TEMPORARY TABLE UUID_TEMP_TABLE(COUNTER integer, UUID varchar(255), FROM_UUID varchar(255));

INSERT INTO UUID_TEMP_TABLE(COUNTER,UUID,FROM_UUID) VALUES(5,'e3c3fb6f3aafda51fe0ff71197109c19:2faa16c6-6696-44a9-9d0c-d6c9d51b42b9','e3c3fb6f3aafda51fe0ff71197109c19:2faa16c6-6696-44a9-9d0c-d6c9d51b42b9') ;
INSERT INTO UUID_TEMP_TABLE(COUNTER,UUID,FROM_UUID) VALUES(6,'e3c3fb6f3aafda51fe0ff71197109c19','e3c3fb6f3aafda51fe0ff71197109c19:2faa16c6-6696-44a9-9d0c-d6c9d51b42b9') ;
INSERT INTO UUID_TEMP_TABLE(COUNTER,UUID,FROM_UUID) VALUES(7,'e3c3fb6f3aafda51fe0ff71197109c19:11ab0ab3-56a2-4bb8-9256-2bde9d159697','e3c3fb6f3aafda51fe0ff71197109c19:11ab0ab3-56a2-4bb8-9256-2bde9d159697') ;
INSERT INTO UUID_TEMP_TABLE(COUNTER,UUID,FROM_UUID) VALUES(8,'e3c3fb6f3aafda51fe0ff71197109c19','e3c3fb6f3aafda51fe0ff71197109c19:11ab0ab3-56a2-4bb8-9256-2bde9d159697') ;
INSERT INTO UUID_TEMP_TABLE(COUNTER,UUID,FROM_UUID) VALUES(9,'e3c3fb6f3aafda51fe0ff71197109c19:384a11b9-351d-46a1-9bce-0235e0fe31a7','e3c3fb6f3aafda51fe0ff71197109c19:384a11b9-351d-46a1-9bce-0235e0fe31a7') ;
INSERT INTO UUID_TEMP_TABLE(COUNTER,UUID,FROM_UUID) VALUES(10,'e3c3fb6f3aafda51fe0ff71197109c19','e3c3fb6f3aafda51fe0ff71197109c19:384a11b9-351d-46a1-9bce-0235e0fe31a7') ;
INSERT INTO UUID_TEMP_TABLE(COUNTER,UUID,FROM_UUID) VALUES(11,'384a11b9-351d-46a1-9bce-0235e0fe31a7','9dc80775-4df0-4876-b991-cff3bcbd59cb:384a11b9-351d-46a1-9bce-0235e0fe31a7') ;
INSERT INTO UUID_TEMP_TABLE(COUNTER,UUID,FROM_UUID) VALUES(12,'9dc80775-4df0-4876-b991-cff3bcbd59cb','9dc80775-4df0-4876-b991-cff3bcbd59cb:384a11b9-351d-46a1-9bce-0235e0fe31a7') ;
INSERT INTO UUID_TEMP_TABLE(COUNTER,UUID,FROM_UUID) VALUES(13,'81237d1d-e3ef-4252-936f-e9da63667d39','9dc80775-4df0-4876-b991-cff3bcbd59cb:81237d1d-e3ef-4252-936f-e9da63667d39') ;
INSERT INTO UUID_TEMP_TABLE(COUNTER,UUID,FROM_UUID) VALUES(14,'9dc80775-4df0-4876-b991-cff3bcbd59cb','9dc80775-4df0-4876-b991-cff3bcbd59cb:81237d1d-e3ef-4252-936f-e9da63667d39') ;
INSERT INTO UUID_TEMP_TABLE(COUNTER,UUID,FROM_UUID) VALUES(15,'11ab0ab3-56a2-4bb8-9256-2bde9d159697','9dc80775-4df0-4876-b991-cff3bcbd59cb:11ab0ab3-56a2-4bb8-9256-2bde9d159697') ;
INSERT INTO UUID_TEMP_TABLE(COUNTER,UUID,FROM_UUID) VALUES(16,'9dc80775-4df0-4876-b991-cff3bcbd59cb','9dc80775-4df0-4876-b991-cff3bcbd59cb:11ab0ab3-56a2-4bb8-9256-2bde9d159697') ;
INSERT INTO UUID_TEMP_TABLE(COUNTER,UUID,FROM_UUID) VALUES(17,'fca501f0-9091-4629-be38-d8da2f5c2ebe','9dc80775-4df0-4876-b991-cff3bcbd59cb:fca501f0-9091-4629-be38-d8da2f5c2ebe') ;
INSERT INTO UUID_TEMP_TABLE(COUNTER,UUID,FROM_UUID) VALUES(18,'9dc80775-4df0-4876-b991-cff3bcbd59cb','9dc80775-4df0-4876-b991-cff3bcbd59cb:fca501f0-9091-4629-be38-d8da2f5c2ebe') ;
INSERT INTO UUID_TEMP_TABLE(COUNTER,UUID,FROM_UUID) VALUES(19,'2faa16c6-6696-44a9-9d0c-d6c9d51b42b9','9dc80775-4df0-4876-b991-cff3bcbd59cb:2faa16c6-6696-44a9-9d0c-d6c9d51b42b9') ;
INSERT INTO UUID_TEMP_TABLE(COUNTER,UUID,FROM_UUID) VALUES(20,'9dc80775-4df0-4876-b991-cff3bcbd59cb','9dc80775-4df0-4876-b991-cff3bcbd59cb:2faa16c6-6696-44a9-9d0c-d6c9d51b42b9') ;
INSERT INTO UUID_TEMP_TABLE(COUNTER,UUID,FROM_UUID) VALUES(21,'e3c3fb6f3aafda51fe0ff71197109c19:81237d1d-e3ef-4252-936f-e9da63667d39','e3c3fb6f3aafda51fe0ff71197109c19:81237d1d-e3ef-4252-936f-e9da63667d39') ;
INSERT INTO UUID_TEMP_TABLE(COUNTER,UUID,FROM_UUID) VALUES(22,'e3c3fb6f3aafda51fe0ff71197109c19','e3c3fb6f3aafda51fe0ff71197109c19:81237d1d-e3ef-4252-936f-e9da63667d39') ;
ALTER TABLE UUID_TEMP_TABLE ADD INDEX (COUNTER), ADD INDEX (UUID), ADD INDEX (FROM_UUID); 


UPDATE NODE T, UUID_TEMP_TABLE UIT, CONTENT CT set T.KEY_PARENT=CT.ID_INTERNAL WHERE T.KEY_PARENT=UIT.COUNTER AND T.CONTENT_ID = UIT.FROM_UUID AND CT.CONTENT_ID=UIT.UUID;
UPDATE NODE T, UUID_TEMP_TABLE UIT, CONTENT CT set T.KEY_CHILD=CT.ID_INTERNAL WHERE T.KEY_CHILD=UIT.COUNTER AND T.CONTENT_ID = UIT.FROM_UUID AND CT.CONTENT_ID=UIT.UUID;
UPDATE CONTENT T, UUID_TEMP_TABLE UIT, CONTENT CT set T.KEY_FUNCTIONALITY=CT.ID_INTERNAL WHERE T.KEY_FUNCTIONALITY=UIT.COUNTER AND T.CONTENT_ID = UIT.FROM_UUID AND CT.CONTENT_ID=UIT.UUID;
UPDATE CONTENT T, UUID_TEMP_TABLE UIT, EXECUTION_PATH CT set T.KEY_EXECUTION_PATH_VALUE=CT.ID_INTERNAL WHERE T.KEY_EXECUTION_PATH_VALUE=UIT.COUNTER AND T.CONTENT_ID = UIT.FROM_UUID AND CT.CONTENT_ID=UIT.UUID;
UPDATE CONTENT T, UUID_TEMP_TABLE UIT, CONTENT CT set T.KEY_INITIAL_CONTENT=CT.ID_INTERNAL WHERE T.KEY_INITIAL_CONTENT=UIT.COUNTER AND T.CONTENT_ID = UIT.FROM_UUID AND CT.CONTENT_ID=UIT.UUID;
UPDATE CONTENT T, UUID_TEMP_TABLE UIT, CONTENT CT set T.KEY_PORTAL=CT.ID_INTERNAL WHERE T.KEY_PORTAL=UIT.COUNTER AND T.CONTENT_ID = UIT.FROM_UUID AND CT.CONTENT_ID=UIT.UUID;
UPDATE CONTENT T, UUID_TEMP_TABLE UIT, AVAILABILITY_POLICY CT set T.KEY_AVAILABILITY_POLICY=CT.ID_INTERNAL WHERE T.KEY_AVAILABILITY_POLICY=UIT.COUNTER AND T.CONTENT_ID = UIT.FROM_UUID AND CT.CONTENT_ID=UIT.UUID;
UPDATE AVAILABILITY_POLICY T, UUID_TEMP_TABLE UIT, CONTENT CT set T.KEY_CONTENT=CT.ID_INTERNAL WHERE T.KEY_CONTENT=UIT.COUNTER AND T.CONTENT_ID = UIT.FROM_UUID AND CT.CONTENT_ID=UIT.UUID;
UPDATE EXECUTION_PATH T, UUID_TEMP_TABLE UIT, CONTENT CT set T.KEY_FUNCTIONALITY=CT.ID_INTERNAL WHERE T.KEY_FUNCTIONALITY=UIT.COUNTER AND T.CONTENT_ID = UIT.FROM_UUID AND CT.CONTENT_ID=UIT.UUID;
DROP TABLE UUID_TEMP_TABLE;

UPDATE NODE SET NODE_ORDER=0,ASCENDING=1,VISIBLE=1,CONTENT_ID='e3c3fb6f3aafda51fe0ff71197109c19:2faa16c6-6696-44a9-9d0c-d6c9d51b42b9',KEY_CHILD=23,KEY_PARENT=24,KEY_ROOT_DOMAIN_OBJECT=1,OJB_CONCRETE_CLASS='net.sourceforge.fenixedu.domain.contents.ExplicitOrderNode' WHERE CONTENT_ID = 'e3c3fb6f3aafda51fe0ff71197109c19:2faa16c6-6696-44a9-9d0c-d6c9d51b42b9'  ;

UPDATE NODE SET NODE_ORDER=1,ASCENDING=1,VISIBLE=1,CONTENT_ID='e3c3fb6f3aafda51fe0ff71197109c19:384a11b9-351d-46a1-9bce-0235e0fe31a7',KEY_CHILD=25,KEY_PARENT=26,KEY_ROOT_DOMAIN_OBJECT=1,OJB_CONCRETE_CLASS='net.sourceforge.fenixedu.domain.contents.ExplicitOrderNode' WHERE CONTENT_ID = 'e3c3fb6f3aafda51fe0ff71197109c19:384a11b9-351d-46a1-9bce-0235e0fe31a7'  ;

UPDATE NODE SET NODE_ORDER=1,ASCENDING=1,VISIBLE=1,CONTENT_ID='9dc80775-4df0-4876-b991-cff3bcbd59cb:384a11b9-351d-46a1-9bce-0235e0fe31a7',KEY_CHILD=27,KEY_PARENT=28,KEY_ROOT_DOMAIN_OBJECT=1,OJB_CONCRETE_CLASS='net.sourceforge.fenixedu.domain.contents.ExplicitOrderNode' WHERE CONTENT_ID = '9dc80775-4df0-4876-b991-cff3bcbd59cb:384a11b9-351d-46a1-9bce-0235e0fe31a7'  ;

UPDATE NODE SET NODE_ORDER=2,ASCENDING=1,VISIBLE=0,CONTENT_ID='9dc80775-4df0-4876-b991-cff3bcbd59cb:81237d1d-e3ef-4252-936f-e9da63667d39',KEY_CHILD=29,KEY_PARENT=30,KEY_ROOT_DOMAIN_OBJECT=1,OJB_CONCRETE_CLASS='net.sourceforge.fenixedu.domain.contents.ExplicitOrderNode' WHERE CONTENT_ID = '9dc80775-4df0-4876-b991-cff3bcbd59cb:81237d1d-e3ef-4252-936f-e9da63667d39'  ;

UPDATE NODE SET NODE_ORDER=3,ASCENDING=1,VISIBLE=1,CONTENT_ID='9dc80775-4df0-4876-b991-cff3bcbd59cb:fca501f0-9091-4629-be38-d8da2f5c2ebe',KEY_CHILD=31,KEY_PARENT=32,KEY_ROOT_DOMAIN_OBJECT=1,OJB_CONCRETE_CLASS='net.sourceforge.fenixedu.domain.contents.ExplicitOrderNode' WHERE CONTENT_ID = '9dc80775-4df0-4876-b991-cff3bcbd59cb:fca501f0-9091-4629-be38-d8da2f5c2ebe'  ;

UPDATE NODE SET NODE_ORDER=0,ASCENDING=1,VISIBLE=1,CONTENT_ID='9dc80775-4df0-4876-b991-cff3bcbd59cb:2faa16c6-6696-44a9-9d0c-d6c9d51b42b9',KEY_CHILD=33,KEY_PARENT=34,KEY_ROOT_DOMAIN_OBJECT=1,OJB_CONCRETE_CLASS='net.sourceforge.fenixedu.domain.contents.ExplicitOrderNode' WHERE CONTENT_ID = '9dc80775-4df0-4876-b991-cff3bcbd59cb:2faa16c6-6696-44a9-9d0c-d6c9d51b42b9'  ;

UPDATE NODE SET NODE_ORDER=2,ASCENDING=1,VISIBLE=0,CONTENT_ID='e3c3fb6f3aafda51fe0ff71197109c19:81237d1d-e3ef-4252-936f-e9da63667d39',KEY_CHILD=35,KEY_PARENT=36,KEY_ROOT_DOMAIN_OBJECT=1,OJB_CONCRETE_CLASS='net.sourceforge.fenixedu.domain.contents.ExplicitOrderNode' WHERE CONTENT_ID = 'e3c3fb6f3aafda51fe0ff71197109c19:81237d1d-e3ef-4252-936f-e9da63667d39'  ;

DELETE FROM NODE WHERE CONTENT_ID = 'e3c3fb6f3aafda51fe0ff71197109c19:11ab0ab3-56a2-4bb8-9256-2bde9d159697' ;

DELETE FROM CONTENT WHERE CONTENT_ID = 'e3c3fb6f3aafda51fe0ff71197109c19:11ab0ab3-56a2-4bb8-9256-2bde9d159697' ;

DELETE FROM CONTENT WHERE CONTENT_ID = '11ab0ab3-56a2-4bb8-9256-2bde9d159697' ;

DELETE FROM NODE WHERE CONTENT_ID = '9dc80775-4df0-4876-b991-cff3bcbd59cb:11ab0ab3-56a2-4bb8-9256-2bde9d159697' ;

DELETE FROM EXECUTION_PATH WHERE CONTENT_ID = '11ab0ab3-56a2-4bb8-9256-2bde9d159697' ;

CREATE TEMPORARY TABLE UUID_TEMP_TABLE(COUNTER integer, UUID varchar(255), FROM_UUID varchar(255));

INSERT INTO UUID_TEMP_TABLE(COUNTER,UUID,FROM_UUID) VALUES(23,'e3c3fb6f3aafda51fe0ff71197109c19:2faa16c6-6696-44a9-9d0c-d6c9d51b42b9','e3c3fb6f3aafda51fe0ff71197109c19:2faa16c6-6696-44a9-9d0c-d6c9d51b42b9') ;
INSERT INTO UUID_TEMP_TABLE(COUNTER,UUID,FROM_UUID) VALUES(24,'e3c3fb6f3aafda51fe0ff71197109c19','e3c3fb6f3aafda51fe0ff71197109c19:2faa16c6-6696-44a9-9d0c-d6c9d51b42b9') ;
INSERT INTO UUID_TEMP_TABLE(COUNTER,UUID,FROM_UUID) VALUES(25,'e3c3fb6f3aafda51fe0ff71197109c19:384a11b9-351d-46a1-9bce-0235e0fe31a7','e3c3fb6f3aafda51fe0ff71197109c19:384a11b9-351d-46a1-9bce-0235e0fe31a7') ;
INSERT INTO UUID_TEMP_TABLE(COUNTER,UUID,FROM_UUID) VALUES(26,'e3c3fb6f3aafda51fe0ff71197109c19','e3c3fb6f3aafda51fe0ff71197109c19:384a11b9-351d-46a1-9bce-0235e0fe31a7') ;
INSERT INTO UUID_TEMP_TABLE(COUNTER,UUID,FROM_UUID) VALUES(27,'384a11b9-351d-46a1-9bce-0235e0fe31a7','9dc80775-4df0-4876-b991-cff3bcbd59cb:384a11b9-351d-46a1-9bce-0235e0fe31a7') ;
INSERT INTO UUID_TEMP_TABLE(COUNTER,UUID,FROM_UUID) VALUES(28,'9dc80775-4df0-4876-b991-cff3bcbd59cb','9dc80775-4df0-4876-b991-cff3bcbd59cb:384a11b9-351d-46a1-9bce-0235e0fe31a7') ;
INSERT INTO UUID_TEMP_TABLE(COUNTER,UUID,FROM_UUID) VALUES(29,'81237d1d-e3ef-4252-936f-e9da63667d39','9dc80775-4df0-4876-b991-cff3bcbd59cb:81237d1d-e3ef-4252-936f-e9da63667d39') ;
INSERT INTO UUID_TEMP_TABLE(COUNTER,UUID,FROM_UUID) VALUES(30,'9dc80775-4df0-4876-b991-cff3bcbd59cb','9dc80775-4df0-4876-b991-cff3bcbd59cb:81237d1d-e3ef-4252-936f-e9da63667d39') ;
INSERT INTO UUID_TEMP_TABLE(COUNTER,UUID,FROM_UUID) VALUES(31,'fca501f0-9091-4629-be38-d8da2f5c2ebe','9dc80775-4df0-4876-b991-cff3bcbd59cb:fca501f0-9091-4629-be38-d8da2f5c2ebe') ;
INSERT INTO UUID_TEMP_TABLE(COUNTER,UUID,FROM_UUID) VALUES(32,'9dc80775-4df0-4876-b991-cff3bcbd59cb','9dc80775-4df0-4876-b991-cff3bcbd59cb:fca501f0-9091-4629-be38-d8da2f5c2ebe') ;
INSERT INTO UUID_TEMP_TABLE(COUNTER,UUID,FROM_UUID) VALUES(33,'2faa16c6-6696-44a9-9d0c-d6c9d51b42b9','9dc80775-4df0-4876-b991-cff3bcbd59cb:2faa16c6-6696-44a9-9d0c-d6c9d51b42b9') ;
INSERT INTO UUID_TEMP_TABLE(COUNTER,UUID,FROM_UUID) VALUES(34,'9dc80775-4df0-4876-b991-cff3bcbd59cb','9dc80775-4df0-4876-b991-cff3bcbd59cb:2faa16c6-6696-44a9-9d0c-d6c9d51b42b9') ;
INSERT INTO UUID_TEMP_TABLE(COUNTER,UUID,FROM_UUID) VALUES(35,'e3c3fb6f3aafda51fe0ff71197109c19:81237d1d-e3ef-4252-936f-e9da63667d39','e3c3fb6f3aafda51fe0ff71197109c19:81237d1d-e3ef-4252-936f-e9da63667d39') ;
INSERT INTO UUID_TEMP_TABLE(COUNTER,UUID,FROM_UUID) VALUES(36,'e3c3fb6f3aafda51fe0ff71197109c19','e3c3fb6f3aafda51fe0ff71197109c19:81237d1d-e3ef-4252-936f-e9da63667d39') ;
ALTER TABLE UUID_TEMP_TABLE ADD INDEX (COUNTER), ADD INDEX (UUID), ADD INDEX (FROM_UUID); 


UPDATE NODE T, UUID_TEMP_TABLE UIT, CONTENT CT set T.KEY_PARENT=CT.ID_INTERNAL WHERE T.KEY_PARENT=UIT.COUNTER AND T.CONTENT_ID = UIT.FROM_UUID AND CT.CONTENT_ID=UIT.UUID;
UPDATE NODE T, UUID_TEMP_TABLE UIT, CONTENT CT set T.KEY_CHILD=CT.ID_INTERNAL WHERE T.KEY_CHILD=UIT.COUNTER AND T.CONTENT_ID = UIT.FROM_UUID AND CT.CONTENT_ID=UIT.UUID;
UPDATE CONTENT T, UUID_TEMP_TABLE UIT, CONTENT CT set T.KEY_FUNCTIONALITY=CT.ID_INTERNAL WHERE T.KEY_FUNCTIONALITY=UIT.COUNTER AND T.CONTENT_ID = UIT.FROM_UUID AND CT.CONTENT_ID=UIT.UUID;
UPDATE CONTENT T, UUID_TEMP_TABLE UIT, EXECUTION_PATH CT set T.KEY_EXECUTION_PATH_VALUE=CT.ID_INTERNAL WHERE T.KEY_EXECUTION_PATH_VALUE=UIT.COUNTER AND T.CONTENT_ID = UIT.FROM_UUID AND CT.CONTENT_ID=UIT.UUID;
UPDATE CONTENT T, UUID_TEMP_TABLE UIT, CONTENT CT set T.KEY_INITIAL_CONTENT=CT.ID_INTERNAL WHERE T.KEY_INITIAL_CONTENT=UIT.COUNTER AND T.CONTENT_ID = UIT.FROM_UUID AND CT.CONTENT_ID=UIT.UUID;
UPDATE CONTENT T, UUID_TEMP_TABLE UIT, CONTENT CT set T.KEY_PORTAL=CT.ID_INTERNAL WHERE T.KEY_PORTAL=UIT.COUNTER AND T.CONTENT_ID = UIT.FROM_UUID AND CT.CONTENT_ID=UIT.UUID;
UPDATE CONTENT T, UUID_TEMP_TABLE UIT, AVAILABILITY_POLICY CT set T.KEY_AVAILABILITY_POLICY=CT.ID_INTERNAL WHERE T.KEY_AVAILABILITY_POLICY=UIT.COUNTER AND T.CONTENT_ID = UIT.FROM_UUID AND CT.CONTENT_ID=UIT.UUID;
UPDATE AVAILABILITY_POLICY T, UUID_TEMP_TABLE UIT, CONTENT CT set T.KEY_CONTENT=CT.ID_INTERNAL WHERE T.KEY_CONTENT=UIT.COUNTER AND T.CONTENT_ID = UIT.FROM_UUID AND CT.CONTENT_ID=UIT.UUID;
UPDATE EXECUTION_PATH T, UUID_TEMP_TABLE UIT, CONTENT CT set T.KEY_FUNCTIONALITY=CT.ID_INTERNAL WHERE T.KEY_FUNCTIONALITY=UIT.COUNTER AND T.CONTENT_ID = UIT.FROM_UUID AND CT.CONTENT_ID=UIT.UUID;
DROP TABLE UUID_TEMP_TABLE;

UPDATE NODE SET NODE_ORDER=0,ASCENDING=1,VISIBLE=1,CONTENT_ID='e3c3fb6f3aafda51fe0ff71197109c19:384a11b9-351d-46a1-9bce-0235e0fe31a7',KEY_CHILD=37,KEY_PARENT=38,KEY_ROOT_DOMAIN_OBJECT=1,OJB_CONCRETE_CLASS='net.sourceforge.fenixedu.domain.contents.ExplicitOrderNode' WHERE CONTENT_ID = 'e3c3fb6f3aafda51fe0ff71197109c19:384a11b9-351d-46a1-9bce-0235e0fe31a7'  ;

UPDATE NODE SET NODE_ORDER=0,ASCENDING=1,VISIBLE=1,CONTENT_ID='9dc80775-4df0-4876-b991-cff3bcbd59cb:384a11b9-351d-46a1-9bce-0235e0fe31a7',KEY_CHILD=39,KEY_PARENT=40,KEY_ROOT_DOMAIN_OBJECT=1,OJB_CONCRETE_CLASS='net.sourceforge.fenixedu.domain.contents.ExplicitOrderNode' WHERE CONTENT_ID = '9dc80775-4df0-4876-b991-cff3bcbd59cb:384a11b9-351d-46a1-9bce-0235e0fe31a7'  ;

UPDATE NODE SET NODE_ORDER=1,ASCENDING=1,VISIBLE=0,CONTENT_ID='9dc80775-4df0-4876-b991-cff3bcbd59cb:81237d1d-e3ef-4252-936f-e9da63667d39',KEY_CHILD=41,KEY_PARENT=42,KEY_ROOT_DOMAIN_OBJECT=1,OJB_CONCRETE_CLASS='net.sourceforge.fenixedu.domain.contents.ExplicitOrderNode' WHERE CONTENT_ID = '9dc80775-4df0-4876-b991-cff3bcbd59cb:81237d1d-e3ef-4252-936f-e9da63667d39'  ;

UPDATE NODE SET NODE_ORDER=2,ASCENDING=1,VISIBLE=1,CONTENT_ID='9dc80775-4df0-4876-b991-cff3bcbd59cb:fca501f0-9091-4629-be38-d8da2f5c2ebe',KEY_CHILD=43,KEY_PARENT=44,KEY_ROOT_DOMAIN_OBJECT=1,OJB_CONCRETE_CLASS='net.sourceforge.fenixedu.domain.contents.ExplicitOrderNode' WHERE CONTENT_ID = '9dc80775-4df0-4876-b991-cff3bcbd59cb:fca501f0-9091-4629-be38-d8da2f5c2ebe'  ;

UPDATE NODE SET NODE_ORDER=1,ASCENDING=1,VISIBLE=0,CONTENT_ID='e3c3fb6f3aafda51fe0ff71197109c19:81237d1d-e3ef-4252-936f-e9da63667d39',KEY_CHILD=45,KEY_PARENT=46,KEY_ROOT_DOMAIN_OBJECT=1,OJB_CONCRETE_CLASS='net.sourceforge.fenixedu.domain.contents.ExplicitOrderNode' WHERE CONTENT_ID = 'e3c3fb6f3aafda51fe0ff71197109c19:81237d1d-e3ef-4252-936f-e9da63667d39'  ;

DELETE FROM NODE WHERE CONTENT_ID = 'e3c3fb6f3aafda51fe0ff71197109c19:2faa16c6-6696-44a9-9d0c-d6c9d51b42b9' ;

DELETE FROM EXECUTION_PATH WHERE CONTENT_ID = '2faa16c6-6696-44a9-9d0c-d6c9d51b42b9' ;

DELETE FROM CONTENT WHERE CONTENT_ID = '2faa16c6-6696-44a9-9d0c-d6c9d51b42b9' ;

DELETE FROM NODE WHERE CONTENT_ID = '9dc80775-4df0-4876-b991-cff3bcbd59cb:2faa16c6-6696-44a9-9d0c-d6c9d51b42b9' ;

DELETE FROM CONTENT WHERE CONTENT_ID = 'e3c3fb6f3aafda51fe0ff71197109c19:2faa16c6-6696-44a9-9d0c-d6c9d51b42b9' ;

CREATE TEMPORARY TABLE UUID_TEMP_TABLE(COUNTER integer, UUID varchar(255), FROM_UUID varchar(255));

INSERT INTO UUID_TEMP_TABLE(COUNTER,UUID,FROM_UUID) VALUES(37,'e3c3fb6f3aafda51fe0ff71197109c19:384a11b9-351d-46a1-9bce-0235e0fe31a7','e3c3fb6f3aafda51fe0ff71197109c19:384a11b9-351d-46a1-9bce-0235e0fe31a7') ;
INSERT INTO UUID_TEMP_TABLE(COUNTER,UUID,FROM_UUID) VALUES(38,'e3c3fb6f3aafda51fe0ff71197109c19','e3c3fb6f3aafda51fe0ff71197109c19:384a11b9-351d-46a1-9bce-0235e0fe31a7') ;
INSERT INTO UUID_TEMP_TABLE(COUNTER,UUID,FROM_UUID) VALUES(39,'384a11b9-351d-46a1-9bce-0235e0fe31a7','9dc80775-4df0-4876-b991-cff3bcbd59cb:384a11b9-351d-46a1-9bce-0235e0fe31a7') ;
INSERT INTO UUID_TEMP_TABLE(COUNTER,UUID,FROM_UUID) VALUES(40,'9dc80775-4df0-4876-b991-cff3bcbd59cb','9dc80775-4df0-4876-b991-cff3bcbd59cb:384a11b9-351d-46a1-9bce-0235e0fe31a7') ;
INSERT INTO UUID_TEMP_TABLE(COUNTER,UUID,FROM_UUID) VALUES(41,'81237d1d-e3ef-4252-936f-e9da63667d39','9dc80775-4df0-4876-b991-cff3bcbd59cb:81237d1d-e3ef-4252-936f-e9da63667d39') ;
INSERT INTO UUID_TEMP_TABLE(COUNTER,UUID,FROM_UUID) VALUES(42,'9dc80775-4df0-4876-b991-cff3bcbd59cb','9dc80775-4df0-4876-b991-cff3bcbd59cb:81237d1d-e3ef-4252-936f-e9da63667d39') ;
INSERT INTO UUID_TEMP_TABLE(COUNTER,UUID,FROM_UUID) VALUES(43,'fca501f0-9091-4629-be38-d8da2f5c2ebe','9dc80775-4df0-4876-b991-cff3bcbd59cb:fca501f0-9091-4629-be38-d8da2f5c2ebe') ;
INSERT INTO UUID_TEMP_TABLE(COUNTER,UUID,FROM_UUID) VALUES(44,'9dc80775-4df0-4876-b991-cff3bcbd59cb','9dc80775-4df0-4876-b991-cff3bcbd59cb:fca501f0-9091-4629-be38-d8da2f5c2ebe') ;
INSERT INTO UUID_TEMP_TABLE(COUNTER,UUID,FROM_UUID) VALUES(45,'e3c3fb6f3aafda51fe0ff71197109c19:81237d1d-e3ef-4252-936f-e9da63667d39','e3c3fb6f3aafda51fe0ff71197109c19:81237d1d-e3ef-4252-936f-e9da63667d39') ;
INSERT INTO UUID_TEMP_TABLE(COUNTER,UUID,FROM_UUID) VALUES(46,'e3c3fb6f3aafda51fe0ff71197109c19','e3c3fb6f3aafda51fe0ff71197109c19:81237d1d-e3ef-4252-936f-e9da63667d39') ;
ALTER TABLE UUID_TEMP_TABLE ADD INDEX (COUNTER), ADD INDEX (UUID), ADD INDEX (FROM_UUID); 


UPDATE NODE T, UUID_TEMP_TABLE UIT, CONTENT CT set T.KEY_PARENT=CT.ID_INTERNAL WHERE T.KEY_PARENT=UIT.COUNTER AND T.CONTENT_ID = UIT.FROM_UUID AND CT.CONTENT_ID=UIT.UUID;
UPDATE NODE T, UUID_TEMP_TABLE UIT, CONTENT CT set T.KEY_CHILD=CT.ID_INTERNAL WHERE T.KEY_CHILD=UIT.COUNTER AND T.CONTENT_ID = UIT.FROM_UUID AND CT.CONTENT_ID=UIT.UUID;
UPDATE CONTENT T, UUID_TEMP_TABLE UIT, CONTENT CT set T.KEY_FUNCTIONALITY=CT.ID_INTERNAL WHERE T.KEY_FUNCTIONALITY=UIT.COUNTER AND T.CONTENT_ID = UIT.FROM_UUID AND CT.CONTENT_ID=UIT.UUID;
UPDATE CONTENT T, UUID_TEMP_TABLE UIT, EXECUTION_PATH CT set T.KEY_EXECUTION_PATH_VALUE=CT.ID_INTERNAL WHERE T.KEY_EXECUTION_PATH_VALUE=UIT.COUNTER AND T.CONTENT_ID = UIT.FROM_UUID AND CT.CONTENT_ID=UIT.UUID;
UPDATE CONTENT T, UUID_TEMP_TABLE UIT, CONTENT CT set T.KEY_INITIAL_CONTENT=CT.ID_INTERNAL WHERE T.KEY_INITIAL_CONTENT=UIT.COUNTER AND T.CONTENT_ID = UIT.FROM_UUID AND CT.CONTENT_ID=UIT.UUID;
UPDATE CONTENT T, UUID_TEMP_TABLE UIT, CONTENT CT set T.KEY_PORTAL=CT.ID_INTERNAL WHERE T.KEY_PORTAL=UIT.COUNTER AND T.CONTENT_ID = UIT.FROM_UUID AND CT.CONTENT_ID=UIT.UUID;
UPDATE CONTENT T, UUID_TEMP_TABLE UIT, AVAILABILITY_POLICY CT set T.KEY_AVAILABILITY_POLICY=CT.ID_INTERNAL WHERE T.KEY_AVAILABILITY_POLICY=UIT.COUNTER AND T.CONTENT_ID = UIT.FROM_UUID AND CT.CONTENT_ID=UIT.UUID;
UPDATE AVAILABILITY_POLICY T, UUID_TEMP_TABLE UIT, CONTENT CT set T.KEY_CONTENT=CT.ID_INTERNAL WHERE T.KEY_CONTENT=UIT.COUNTER AND T.CONTENT_ID = UIT.FROM_UUID AND CT.CONTENT_ID=UIT.UUID;
UPDATE EXECUTION_PATH T, UUID_TEMP_TABLE UIT, CONTENT CT set T.KEY_FUNCTIONALITY=CT.ID_INTERNAL WHERE T.KEY_FUNCTIONALITY=UIT.COUNTER AND T.CONTENT_ID = UIT.FROM_UUID AND CT.CONTENT_ID=UIT.UUID;
DROP TABLE UUID_TEMP_TABLE;

UPDATE NODE SET NODE_ORDER=0,ASCENDING=1,VISIBLE=0,CONTENT_ID='9dc80775-4df0-4876-b991-cff3bcbd59cb:81237d1d-e3ef-4252-936f-e9da63667d39',KEY_CHILD=47,KEY_PARENT=48,KEY_ROOT_DOMAIN_OBJECT=1,OJB_CONCRETE_CLASS='net.sourceforge.fenixedu.domain.contents.ExplicitOrderNode' WHERE CONTENT_ID = '9dc80775-4df0-4876-b991-cff3bcbd59cb:81237d1d-e3ef-4252-936f-e9da63667d39'  ;

UPDATE NODE SET NODE_ORDER=1,ASCENDING=1,VISIBLE=1,CONTENT_ID='9dc80775-4df0-4876-b991-cff3bcbd59cb:fca501f0-9091-4629-be38-d8da2f5c2ebe',KEY_CHILD=49,KEY_PARENT=50,KEY_ROOT_DOMAIN_OBJECT=1,OJB_CONCRETE_CLASS='net.sourceforge.fenixedu.domain.contents.ExplicitOrderNode' WHERE CONTENT_ID = '9dc80775-4df0-4876-b991-cff3bcbd59cb:fca501f0-9091-4629-be38-d8da2f5c2ebe'  ;

UPDATE NODE SET NODE_ORDER=0,ASCENDING=1,VISIBLE=0,CONTENT_ID='e3c3fb6f3aafda51fe0ff71197109c19:81237d1d-e3ef-4252-936f-e9da63667d39',KEY_CHILD=51,KEY_PARENT=52,KEY_ROOT_DOMAIN_OBJECT=1,OJB_CONCRETE_CLASS='net.sourceforge.fenixedu.domain.contents.ExplicitOrderNode' WHERE CONTENT_ID = 'e3c3fb6f3aafda51fe0ff71197109c19:81237d1d-e3ef-4252-936f-e9da63667d39'  ;

DELETE FROM CONTENT WHERE CONTENT_ID = '384a11b9-351d-46a1-9bce-0235e0fe31a7' ;

DELETE FROM CONTENT WHERE CONTENT_ID = 'e3c3fb6f3aafda51fe0ff71197109c19:384a11b9-351d-46a1-9bce-0235e0fe31a7' ;

DELETE FROM NODE WHERE CONTENT_ID = 'e3c3fb6f3aafda51fe0ff71197109c19:384a11b9-351d-46a1-9bce-0235e0fe31a7' ;

DELETE FROM NODE WHERE CONTENT_ID = '9dc80775-4df0-4876-b991-cff3bcbd59cb:384a11b9-351d-46a1-9bce-0235e0fe31a7' ;

DELETE FROM EXECUTION_PATH WHERE CONTENT_ID = '384a11b9-351d-46a1-9bce-0235e0fe31a7' ;

CREATE TEMPORARY TABLE UUID_TEMP_TABLE(COUNTER integer, UUID varchar(255), FROM_UUID varchar(255));

INSERT INTO UUID_TEMP_TABLE(COUNTER,UUID,FROM_UUID) VALUES(47,'81237d1d-e3ef-4252-936f-e9da63667d39','9dc80775-4df0-4876-b991-cff3bcbd59cb:81237d1d-e3ef-4252-936f-e9da63667d39') ;
INSERT INTO UUID_TEMP_TABLE(COUNTER,UUID,FROM_UUID) VALUES(48,'9dc80775-4df0-4876-b991-cff3bcbd59cb','9dc80775-4df0-4876-b991-cff3bcbd59cb:81237d1d-e3ef-4252-936f-e9da63667d39') ;
INSERT INTO UUID_TEMP_TABLE(COUNTER,UUID,FROM_UUID) VALUES(49,'fca501f0-9091-4629-be38-d8da2f5c2ebe','9dc80775-4df0-4876-b991-cff3bcbd59cb:fca501f0-9091-4629-be38-d8da2f5c2ebe') ;
INSERT INTO UUID_TEMP_TABLE(COUNTER,UUID,FROM_UUID) VALUES(50,'9dc80775-4df0-4876-b991-cff3bcbd59cb','9dc80775-4df0-4876-b991-cff3bcbd59cb:fca501f0-9091-4629-be38-d8da2f5c2ebe') ;
INSERT INTO UUID_TEMP_TABLE(COUNTER,UUID,FROM_UUID) VALUES(51,'e3c3fb6f3aafda51fe0ff71197109c19:81237d1d-e3ef-4252-936f-e9da63667d39','e3c3fb6f3aafda51fe0ff71197109c19:81237d1d-e3ef-4252-936f-e9da63667d39') ;
INSERT INTO UUID_TEMP_TABLE(COUNTER,UUID,FROM_UUID) VALUES(52,'e3c3fb6f3aafda51fe0ff71197109c19','e3c3fb6f3aafda51fe0ff71197109c19:81237d1d-e3ef-4252-936f-e9da63667d39') ;
ALTER TABLE UUID_TEMP_TABLE ADD INDEX (COUNTER), ADD INDEX (UUID), ADD INDEX (FROM_UUID); 


UPDATE NODE T, UUID_TEMP_TABLE UIT, CONTENT CT set T.KEY_PARENT=CT.ID_INTERNAL WHERE T.KEY_PARENT=UIT.COUNTER AND T.CONTENT_ID = UIT.FROM_UUID AND CT.CONTENT_ID=UIT.UUID;
UPDATE NODE T, UUID_TEMP_TABLE UIT, CONTENT CT set T.KEY_CHILD=CT.ID_INTERNAL WHERE T.KEY_CHILD=UIT.COUNTER AND T.CONTENT_ID = UIT.FROM_UUID AND CT.CONTENT_ID=UIT.UUID;
UPDATE CONTENT T, UUID_TEMP_TABLE UIT, CONTENT CT set T.KEY_FUNCTIONALITY=CT.ID_INTERNAL WHERE T.KEY_FUNCTIONALITY=UIT.COUNTER AND T.CONTENT_ID = UIT.FROM_UUID AND CT.CONTENT_ID=UIT.UUID;
UPDATE CONTENT T, UUID_TEMP_TABLE UIT, EXECUTION_PATH CT set T.KEY_EXECUTION_PATH_VALUE=CT.ID_INTERNAL WHERE T.KEY_EXECUTION_PATH_VALUE=UIT.COUNTER AND T.CONTENT_ID = UIT.FROM_UUID AND CT.CONTENT_ID=UIT.UUID;
UPDATE CONTENT T, UUID_TEMP_TABLE UIT, CONTENT CT set T.KEY_INITIAL_CONTENT=CT.ID_INTERNAL WHERE T.KEY_INITIAL_CONTENT=UIT.COUNTER AND T.CONTENT_ID = UIT.FROM_UUID AND CT.CONTENT_ID=UIT.UUID;
UPDATE CONTENT T, UUID_TEMP_TABLE UIT, CONTENT CT set T.KEY_PORTAL=CT.ID_INTERNAL WHERE T.KEY_PORTAL=UIT.COUNTER AND T.CONTENT_ID = UIT.FROM_UUID AND CT.CONTENT_ID=UIT.UUID;
UPDATE CONTENT T, UUID_TEMP_TABLE UIT, AVAILABILITY_POLICY CT set T.KEY_AVAILABILITY_POLICY=CT.ID_INTERNAL WHERE T.KEY_AVAILABILITY_POLICY=UIT.COUNTER AND T.CONTENT_ID = UIT.FROM_UUID AND CT.CONTENT_ID=UIT.UUID;
UPDATE AVAILABILITY_POLICY T, UUID_TEMP_TABLE UIT, CONTENT CT set T.KEY_CONTENT=CT.ID_INTERNAL WHERE T.KEY_CONTENT=UIT.COUNTER AND T.CONTENT_ID = UIT.FROM_UUID AND CT.CONTENT_ID=UIT.UUID;
UPDATE EXECUTION_PATH T, UUID_TEMP_TABLE UIT, CONTENT CT set T.KEY_FUNCTIONALITY=CT.ID_INTERNAL WHERE T.KEY_FUNCTIONALITY=UIT.COUNTER AND T.CONTENT_ID = UIT.FROM_UUID AND CT.CONTENT_ID=UIT.UUID;
DROP TABLE UUID_TEMP_TABLE;

UPDATE NODE SET NODE_ORDER=0,ASCENDING=1,VISIBLE=1,CONTENT_ID='9dc80775-4df0-4876-b991-cff3bcbd59cb:fca501f0-9091-4629-be38-d8da2f5c2ebe',KEY_CHILD=53,KEY_PARENT=54,KEY_ROOT_DOMAIN_OBJECT=1,OJB_CONCRETE_CLASS='net.sourceforge.fenixedu.domain.contents.ExplicitOrderNode' WHERE CONTENT_ID = '9dc80775-4df0-4876-b991-cff3bcbd59cb:fca501f0-9091-4629-be38-d8da2f5c2ebe'  ;

DELETE FROM EXECUTION_PATH WHERE CONTENT_ID = '81237d1d-e3ef-4252-936f-e9da63667d39' ;

DELETE FROM NODE WHERE CONTENT_ID = '9dc80775-4df0-4876-b991-cff3bcbd59cb:81237d1d-e3ef-4252-936f-e9da63667d39' ;

DELETE FROM CONTENT WHERE CONTENT_ID = 'e3c3fb6f3aafda51fe0ff71197109c19:81237d1d-e3ef-4252-936f-e9da63667d39' ;

DELETE FROM CONTENT WHERE CONTENT_ID = '81237d1d-e3ef-4252-936f-e9da63667d39' ;

DELETE FROM NODE WHERE CONTENT_ID = 'e3c3fb6f3aafda51fe0ff71197109c19:81237d1d-e3ef-4252-936f-e9da63667d39' ;

CREATE TEMPORARY TABLE UUID_TEMP_TABLE(COUNTER integer, UUID varchar(255), FROM_UUID varchar(255));

INSERT INTO UUID_TEMP_TABLE(COUNTER,UUID,FROM_UUID) VALUES(53,'fca501f0-9091-4629-be38-d8da2f5c2ebe','9dc80775-4df0-4876-b991-cff3bcbd59cb:fca501f0-9091-4629-be38-d8da2f5c2ebe') ;
INSERT INTO UUID_TEMP_TABLE(COUNTER,UUID,FROM_UUID) VALUES(54,'9dc80775-4df0-4876-b991-cff3bcbd59cb','9dc80775-4df0-4876-b991-cff3bcbd59cb:fca501f0-9091-4629-be38-d8da2f5c2ebe') ;
ALTER TABLE UUID_TEMP_TABLE ADD INDEX (COUNTER), ADD INDEX (UUID), ADD INDEX (FROM_UUID); 


UPDATE NODE T, UUID_TEMP_TABLE UIT, CONTENT CT set T.KEY_PARENT=CT.ID_INTERNAL WHERE T.KEY_PARENT=UIT.COUNTER AND T.CONTENT_ID = UIT.FROM_UUID AND CT.CONTENT_ID=UIT.UUID;
UPDATE NODE T, UUID_TEMP_TABLE UIT, CONTENT CT set T.KEY_CHILD=CT.ID_INTERNAL WHERE T.KEY_CHILD=UIT.COUNTER AND T.CONTENT_ID = UIT.FROM_UUID AND CT.CONTENT_ID=UIT.UUID;
UPDATE CONTENT T, UUID_TEMP_TABLE UIT, CONTENT CT set T.KEY_FUNCTIONALITY=CT.ID_INTERNAL WHERE T.KEY_FUNCTIONALITY=UIT.COUNTER AND T.CONTENT_ID = UIT.FROM_UUID AND CT.CONTENT_ID=UIT.UUID;
UPDATE CONTENT T, UUID_TEMP_TABLE UIT, EXECUTION_PATH CT set T.KEY_EXECUTION_PATH_VALUE=CT.ID_INTERNAL WHERE T.KEY_EXECUTION_PATH_VALUE=UIT.COUNTER AND T.CONTENT_ID = UIT.FROM_UUID AND CT.CONTENT_ID=UIT.UUID;
UPDATE CONTENT T, UUID_TEMP_TABLE UIT, CONTENT CT set T.KEY_INITIAL_CONTENT=CT.ID_INTERNAL WHERE T.KEY_INITIAL_CONTENT=UIT.COUNTER AND T.CONTENT_ID = UIT.FROM_UUID AND CT.CONTENT_ID=UIT.UUID;
UPDATE CONTENT T, UUID_TEMP_TABLE UIT, CONTENT CT set T.KEY_PORTAL=CT.ID_INTERNAL WHERE T.KEY_PORTAL=UIT.COUNTER AND T.CONTENT_ID = UIT.FROM_UUID AND CT.CONTENT_ID=UIT.UUID;
UPDATE CONTENT T, UUID_TEMP_TABLE UIT, AVAILABILITY_POLICY CT set T.KEY_AVAILABILITY_POLICY=CT.ID_INTERNAL WHERE T.KEY_AVAILABILITY_POLICY=UIT.COUNTER AND T.CONTENT_ID = UIT.FROM_UUID AND CT.CONTENT_ID=UIT.UUID;
UPDATE AVAILABILITY_POLICY T, UUID_TEMP_TABLE UIT, CONTENT CT set T.KEY_CONTENT=CT.ID_INTERNAL WHERE T.KEY_CONTENT=UIT.COUNTER AND T.CONTENT_ID = UIT.FROM_UUID AND CT.CONTENT_ID=UIT.UUID;
UPDATE EXECUTION_PATH T, UUID_TEMP_TABLE UIT, CONTENT CT set T.KEY_FUNCTIONALITY=CT.ID_INTERNAL WHERE T.KEY_FUNCTIONALITY=UIT.COUNTER AND T.CONTENT_ID = UIT.FROM_UUID AND CT.CONTENT_ID=UIT.UUID;
DROP TABLE UUID_TEMP_TABLE;

INSERT INTO NODE (NODE_ORDER,ASCENDING,VISIBLE,CONTENT_ID,KEY_CHILD,KEY_PARENT,KEY_ROOT_DOMAIN_OBJECT,OJB_CONCRETE_CLASS) VALUES (0,1,1,'e3c3fb6f3aafda51fe0ff71197109c19:233afb25-e1aa-4056-a814-35db5d0c29e3',55,56,1,'net.sourceforge.fenixedu.domain.contents.ExplicitOrderNode')  ;

INSERT INTO CONTENT (KEY_FUNCTIONALITY,CONTENT_ID,CREATION_DATE,NAME,TITLE,BODY,DESCRIPTION,NORMALIZED_NAME,KEY_PORTAL,KEY_AVAILABILITY_POLICY,KEY_ROOT_DOMAIN_OBJECT,KEY_CREATOR,OJB_CONCRETE_CLASS) VALUES (57,'233afb25-e1aa-4056-a814-35db5d0c29e3','2008-08-01 13:01:03',null,null,null,null,null,null,null,1,null,'net.sourceforge.fenixedu.domain.contents.FunctionalityCall')  ;

CREATE TEMPORARY TABLE UUID_TEMP_TABLE(COUNTER integer, UUID varchar(255), FROM_UUID varchar(255));

INSERT INTO UUID_TEMP_TABLE(COUNTER,UUID,FROM_UUID) VALUES(55,'233afb25-e1aa-4056-a814-35db5d0c29e3','e3c3fb6f3aafda51fe0ff71197109c19:233afb25-e1aa-4056-a814-35db5d0c29e3') ;
INSERT INTO UUID_TEMP_TABLE(COUNTER,UUID,FROM_UUID) VALUES(56,'e3c3fb6f3aafda51fe0ff71197109c19','e3c3fb6f3aafda51fe0ff71197109c19:233afb25-e1aa-4056-a814-35db5d0c29e3') ;
INSERT INTO UUID_TEMP_TABLE(COUNTER,UUID,FROM_UUID) VALUES(57,'fca501f0-9091-4629-be38-d8da2f5c2ebe','233afb25-e1aa-4056-a814-35db5d0c29e3') ;
ALTER TABLE UUID_TEMP_TABLE ADD INDEX (COUNTER), ADD INDEX (UUID), ADD INDEX (FROM_UUID); 


UPDATE NODE T, UUID_TEMP_TABLE UIT, CONTENT CT set T.KEY_PARENT=CT.ID_INTERNAL WHERE T.KEY_PARENT=UIT.COUNTER AND T.CONTENT_ID = UIT.FROM_UUID AND CT.CONTENT_ID=UIT.UUID;
UPDATE NODE T, UUID_TEMP_TABLE UIT, CONTENT CT set T.KEY_CHILD=CT.ID_INTERNAL WHERE T.KEY_CHILD=UIT.COUNTER AND T.CONTENT_ID = UIT.FROM_UUID AND CT.CONTENT_ID=UIT.UUID;
UPDATE CONTENT T, UUID_TEMP_TABLE UIT, CONTENT CT set T.KEY_FUNCTIONALITY=CT.ID_INTERNAL WHERE T.KEY_FUNCTIONALITY=UIT.COUNTER AND T.CONTENT_ID = UIT.FROM_UUID AND CT.CONTENT_ID=UIT.UUID;
UPDATE CONTENT T, UUID_TEMP_TABLE UIT, EXECUTION_PATH CT set T.KEY_EXECUTION_PATH_VALUE=CT.ID_INTERNAL WHERE T.KEY_EXECUTION_PATH_VALUE=UIT.COUNTER AND T.CONTENT_ID = UIT.FROM_UUID AND CT.CONTENT_ID=UIT.UUID;
UPDATE CONTENT T, UUID_TEMP_TABLE UIT, CONTENT CT set T.KEY_INITIAL_CONTENT=CT.ID_INTERNAL WHERE T.KEY_INITIAL_CONTENT=UIT.COUNTER AND T.CONTENT_ID = UIT.FROM_UUID AND CT.CONTENT_ID=UIT.UUID;
UPDATE CONTENT T, UUID_TEMP_TABLE UIT, CONTENT CT set T.KEY_PORTAL=CT.ID_INTERNAL WHERE T.KEY_PORTAL=UIT.COUNTER AND T.CONTENT_ID = UIT.FROM_UUID AND CT.CONTENT_ID=UIT.UUID;
UPDATE CONTENT T, UUID_TEMP_TABLE UIT, AVAILABILITY_POLICY CT set T.KEY_AVAILABILITY_POLICY=CT.ID_INTERNAL WHERE T.KEY_AVAILABILITY_POLICY=UIT.COUNTER AND T.CONTENT_ID = UIT.FROM_UUID AND CT.CONTENT_ID=UIT.UUID;
UPDATE AVAILABILITY_POLICY T, UUID_TEMP_TABLE UIT, CONTENT CT set T.KEY_CONTENT=CT.ID_INTERNAL WHERE T.KEY_CONTENT=UIT.COUNTER AND T.CONTENT_ID = UIT.FROM_UUID AND CT.CONTENT_ID=UIT.UUID;
UPDATE EXECUTION_PATH T, UUID_TEMP_TABLE UIT, CONTENT CT set T.KEY_FUNCTIONALITY=CT.ID_INTERNAL WHERE T.KEY_FUNCTIONALITY=UIT.COUNTER AND T.CONTENT_ID = UIT.FROM_UUID AND CT.CONTENT_ID=UIT.UUID;
DROP TABLE UUID_TEMP_TABLE;

INSERT INTO AVAILABILITY_POLICY (EXPRESSION,TARGET_GROUP,CONTENT_ID,KEY_CONTENT,KEY_ROOT_DOMAIN_OBJECT,OJB_CONCRETE_CLASS) VALUES ('role(LIBRARY)','role(LIBRARY)','2235f9b2-274c-4454-b530-8c19c692828b',58,1,'net.sourceforge.fenixedu.domain.functionalities.ExpressionGroupAvailability')  ;

UPDATE CONTENT SET ENABLED=null,MODIFICATION_DATE=null,MAXIMIZABLE=null,PREFIX=null,KEY_INITIAL_CONTENT=null,CONTENT_ID='e3c3fb6f3aafda51fe0ff71197109c19',CREATION_DATE='2008-01-14 20:40:18',NAME='en6:Thesespt12:Dissertações',TITLE=null,BODY=null,DESCRIPTION=null,NORMALIZED_NAME=null,KEY_PORTAL=null,KEY_AVAILABILITY_POLICY=59,KEY_ROOT_DOMAIN_OBJECT=1,KEY_CREATOR=null,OJB_CONCRETE_CLASS='net.sourceforge.fenixedu.domain.Section' WHERE CONTENT_ID = 'e3c3fb6f3aafda51fe0ff71197109c19'  ;

CREATE TEMPORARY TABLE UUID_TEMP_TABLE(COUNTER integer, UUID varchar(255), FROM_UUID varchar(255));

INSERT INTO UUID_TEMP_TABLE(COUNTER,UUID,FROM_UUID) VALUES(58,'e3c3fb6f3aafda51fe0ff71197109c19','2235f9b2-274c-4454-b530-8c19c692828b') ;
INSERT INTO UUID_TEMP_TABLE(COUNTER,UUID,FROM_UUID) VALUES(59,'2235f9b2-274c-4454-b530-8c19c692828b','e3c3fb6f3aafda51fe0ff71197109c19') ;
ALTER TABLE UUID_TEMP_TABLE ADD INDEX (COUNTER), ADD INDEX (UUID), ADD INDEX (FROM_UUID); 


UPDATE NODE T, UUID_TEMP_TABLE UIT, CONTENT CT set T.KEY_PARENT=CT.ID_INTERNAL WHERE T.KEY_PARENT=UIT.COUNTER AND T.CONTENT_ID = UIT.FROM_UUID AND CT.CONTENT_ID=UIT.UUID;
UPDATE NODE T, UUID_TEMP_TABLE UIT, CONTENT CT set T.KEY_CHILD=CT.ID_INTERNAL WHERE T.KEY_CHILD=UIT.COUNTER AND T.CONTENT_ID = UIT.FROM_UUID AND CT.CONTENT_ID=UIT.UUID;
UPDATE CONTENT T, UUID_TEMP_TABLE UIT, CONTENT CT set T.KEY_FUNCTIONALITY=CT.ID_INTERNAL WHERE T.KEY_FUNCTIONALITY=UIT.COUNTER AND T.CONTENT_ID = UIT.FROM_UUID AND CT.CONTENT_ID=UIT.UUID;
UPDATE CONTENT T, UUID_TEMP_TABLE UIT, EXECUTION_PATH CT set T.KEY_EXECUTION_PATH_VALUE=CT.ID_INTERNAL WHERE T.KEY_EXECUTION_PATH_VALUE=UIT.COUNTER AND T.CONTENT_ID = UIT.FROM_UUID AND CT.CONTENT_ID=UIT.UUID;
UPDATE CONTENT T, UUID_TEMP_TABLE UIT, CONTENT CT set T.KEY_INITIAL_CONTENT=CT.ID_INTERNAL WHERE T.KEY_INITIAL_CONTENT=UIT.COUNTER AND T.CONTENT_ID = UIT.FROM_UUID AND CT.CONTENT_ID=UIT.UUID;
UPDATE CONTENT T, UUID_TEMP_TABLE UIT, CONTENT CT set T.KEY_PORTAL=CT.ID_INTERNAL WHERE T.KEY_PORTAL=UIT.COUNTER AND T.CONTENT_ID = UIT.FROM_UUID AND CT.CONTENT_ID=UIT.UUID;
UPDATE CONTENT T, UUID_TEMP_TABLE UIT, AVAILABILITY_POLICY CT set T.KEY_AVAILABILITY_POLICY=CT.ID_INTERNAL WHERE T.KEY_AVAILABILITY_POLICY=UIT.COUNTER AND T.CONTENT_ID = UIT.FROM_UUID AND CT.CONTENT_ID=UIT.UUID;
UPDATE AVAILABILITY_POLICY T, UUID_TEMP_TABLE UIT, CONTENT CT set T.KEY_CONTENT=CT.ID_INTERNAL WHERE T.KEY_CONTENT=UIT.COUNTER AND T.CONTENT_ID = UIT.FROM_UUID AND CT.CONTENT_ID=UIT.UUID;
UPDATE EXECUTION_PATH T, UUID_TEMP_TABLE UIT, CONTENT CT set T.KEY_FUNCTIONALITY=CT.ID_INTERNAL WHERE T.KEY_FUNCTIONALITY=UIT.COUNTER AND T.CONTENT_ID = UIT.FROM_UUID AND CT.CONTENT_ID=UIT.UUID;
DROP TABLE UUID_TEMP_TABLE;



COMMIT;
