
START TRANSACTION;

UPDATE NODE SET NODE_ORDER=8,ASCENDING=1,VISIBLE=1,CONTENT_ID='a9699c018922df82905bba7d5fc74523:3ec37b5df58c9b45dbf0391aebb4b259',KEY_CHILD=1,KEY_PARENT=2,KEY_ROOT_DOMAIN_OBJECT=1,OJB_CONCRETE_CLASS='net.sourceforge.fenixedu.domain.contents.ExplicitOrderNode' WHERE CONTENT_ID = 'a9699c018922df82905bba7d5fc74523:3ec37b5df58c9b45dbf0391aebb4b259'  ;

UPDATE NODE SET NODE_ORDER=1,ASCENDING=1,VISIBLE=1,CONTENT_ID='a9699c018922df82905bba7d5fc74523:e3c3fb6f3aafda51fe0ff71197109c19',KEY_CHILD=3,KEY_PARENT=4,KEY_ROOT_DOMAIN_OBJECT=1,OJB_CONCRETE_CLASS='net.sourceforge.fenixedu.domain.contents.ExplicitOrderNode' WHERE CONTENT_ID = 'a9699c018922df82905bba7d5fc74523:e3c3fb6f3aafda51fe0ff71197109c19'  ;

UPDATE CONTENT SET ENABLED=null,MODIFICATION_DATE=null,MAXIMIZABLE=0,PREFIX=null,KEY_INITIAL_CONTENT=null,CONTENT_ID='e3c3fb6f3aafda51fe0ff71197109c19',CREATION_DATE='2008-01-14 20:40:18',NAME='pt12:Dissertaçõesen6:Theses',TITLE=null,BODY=null,DESCRIPTION=null,NORMALIZED_NAME='pt12:dissertacoesen6:theses',KEY_PORTAL=null,KEY_AVAILABILITY_POLICY=5,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(1,'3ec37b5df58c9b45dbf0391aebb4b259','a9699c018922df82905bba7d5fc74523:3ec37b5df58c9b45dbf0391aebb4b259') ;
INSERT INTO UUID_TEMP_TABLE(COUNTER,UUID,FROM_UUID) VALUES(2,'a9699c018922df82905bba7d5fc74523','a9699c018922df82905bba7d5fc74523:3ec37b5df58c9b45dbf0391aebb4b259') ;
INSERT INTO UUID_TEMP_TABLE(COUNTER,UUID,FROM_UUID) VALUES(3,'e3c3fb6f3aafda51fe0ff71197109c19','a9699c018922df82905bba7d5fc74523:e3c3fb6f3aafda51fe0ff71197109c19') ;
INSERT INTO UUID_TEMP_TABLE(COUNTER,UUID,FROM_UUID) VALUES(4,'a9699c018922df82905bba7d5fc74523','a9699c018922df82905bba7d5fc74523:e3c3fb6f3aafda51fe0ff71197109c19') ;
INSERT INTO UUID_TEMP_TABLE(COUNTER,UUID,FROM_UUID) VALUES(5,'915e11a8-b172-4b11-aae5-35045e2a68d9','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;

INSERT INTO AVAILABILITY_POLICY (EXPRESSION,TARGET_GROUP,CONTENT_ID,KEY_CONTENT,KEY_ROOT_DOMAIN_OBJECT,OJB_CONCRETE_CLASS) VALUES ('role(LIBRARY) && (person(1718) || person(2929) || person(1197) || person(1549) || person(2926) || person(7067))','role(LIBRARY) && (person(1718) || person(2929) || person(1197) || person(1549) || person(2926) || person(7067))','7b969a10-3e3a-4ce3-9686-8bc285dd0cff',6,1,'net.sourceforge.fenixedu.domain.functionalities.ExpressionGroupAvailability')  ;

UPDATE AVAILABILITY_POLICY SET EXPRESSION='role(LIBRARY)',TARGET_GROUP='role(LIBRARY)',CONTENT_ID='915e11a8-b172-4b11-aae5-35045e2a68d9',KEY_CONTENT=null,KEY_ROOT_DOMAIN_OBJECT=1,OJB_CONCRETE_CLASS='net.sourceforge.fenixedu.domain.functionalities.ExpressionGroupAvailability' WHERE CONTENT_ID = '915e11a8-b172-4b11-aae5-35045e2a68d9'  ;

UPDATE CONTENT SET ENABLED=null,MODIFICATION_DATE=null,MAXIMIZABLE=0,PREFIX=null,KEY_INITIAL_CONTENT=null,CONTENT_ID='e3c3fb6f3aafda51fe0ff71197109c19',CREATION_DATE='2008-01-14 20:40:18',NAME='pt12:Dissertaçõesen6:Theses',TITLE=null,BODY=null,DESCRIPTION=null,NORMALIZED_NAME='pt12:dissertacoesen6:theses',KEY_PORTAL=null,KEY_AVAILABILITY_POLICY=7,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(6,'e3c3fb6f3aafda51fe0ff71197109c19','7b969a10-3e3a-4ce3-9686-8bc285dd0cff') ;
INSERT INTO UUID_TEMP_TABLE(COUNTER,UUID,FROM_UUID) VALUES(7,'7b969a10-3e3a-4ce3-9686-8bc285dd0cff','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;

INSERT INTO AVAILABILITY_POLICY (EXPRESSION,TARGET_GROUP,CONTENT_ID,KEY_CONTENT,KEY_ROOT_DOMAIN_OBJECT,OJB_CONCRETE_CLASS) VALUES ('role(LIBRARY) && (person(1728) || person(1852) || person(2926) || person(50087))','role(LIBRARY) && (person(1728) || person(1852) || person(2926) || person(50087))','2ca72783-5c38-49f3-9dd7-7aaf4322d5ed',8,1,'net.sourceforge.fenixedu.domain.functionalities.ExpressionGroupAvailability')  ;

UPDATE AVAILABILITY_POLICY SET EXPRESSION='role(LIBRARY)',TARGET_GROUP='role(LIBRARY)',CONTENT_ID='93792330-f2cb-4d47-836d-e843a3974901',KEY_CONTENT=null,KEY_ROOT_DOMAIN_OBJECT=1,OJB_CONCRETE_CLASS='net.sourceforge.fenixedu.domain.functionalities.ExpressionGroupAvailability' WHERE CONTENT_ID = '93792330-f2cb-4d47-836d-e843a3974901'  ;

UPDATE CONTENT SET ENABLED=null,MODIFICATION_DATE=null,MAXIMIZABLE=null,PREFIX=null,KEY_INITIAL_CONTENT=null,CONTENT_ID='3ec37b5df58c9b45dbf0391aebb4b259',CREATION_DATE='2008-01-14 20:40:18',NAME='pt7:Cartões',TITLE=null,BODY=null,DESCRIPTION=null,NORMALIZED_NAME=null,KEY_PORTAL=null,KEY_AVAILABILITY_POLICY=9,KEY_ROOT_DOMAIN_OBJECT=1,KEY_CREATOR=null,OJB_CONCRETE_CLASS='net.sourceforge.fenixedu.domain.Section' WHERE CONTENT_ID = '3ec37b5df58c9b45dbf0391aebb4b259'  ;

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(8,'3ec37b5df58c9b45dbf0391aebb4b259','2ca72783-5c38-49f3-9dd7-7aaf4322d5ed') ;
INSERT INTO UUID_TEMP_TABLE(COUNTER,UUID,FROM_UUID) VALUES(9,'2ca72783-5c38-49f3-9dd7-7aaf4322d5ed','3ec37b5df58c9b45dbf0391aebb4b259') ;
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;
