
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 ('/exportAssiduousness.do?method=chooseYearMonth&action=exportVacations&chooseYear=true',null,1,'a30bd63d-46f6-429e-a6f8-86e15f57cfa2','2008-05-12 10:59:24','pt15:Exportar Férias','pt15:Exportar Férias',null,null,'pt15:exportar-ferias',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,'11279eeb-6e02-4374-a255-fc140930f111:a30bd63d-46f6-429e-a6f8-86e15f57cfa2',2,3,1,'net.sourceforge.fenixedu.domain.contents.ExplicitOrderNode')  ;

INSERT INTO EXECUTION_PATH (EXECUTION_PATH,CONTENT_ID,KEY_FUNCTIONALITY,KEY_ROOT_DOMAIN_OBJECT) VALUES ('/exportAssiduousness.do?method=chooseYearMonth&action=exportVacations&chooseYear=true','aa25f0c9-be4b-4b4a-81d9-ab30b5296751',4,1)  ;

UPDATE CONTENT SET EXECUTION_PATH='/exportAssiduousness.do?method=chooseYearMonth&action=exportVacations&chooseYear=true',VISIBLE=null,KEY_EXECUTION_PATH_VALUE=5,CONTENT_ID='a30bd63d-46f6-429e-a6f8-86e15f57cfa2',CREATION_DATE='2008-05-12 10:59:24',NAME='pt15:Exportar Férias',TITLE='pt15:Exportar Férias',BODY=null,DESCRIPTION=null,NORMALIZED_NAME='pt15:exportar-ferias',KEY_PORTAL=null,KEY_AVAILABILITY_POLICY=null,KEY_ROOT_DOMAIN_OBJECT=1,KEY_CREATOR=null,OJB_CONCRETE_CLASS='net.sourceforge.fenixedu.domain.functionalities.Functionality' WHERE CONTENT_ID = 'a30bd63d-46f6-429e-a6f8-86e15f57cfa2'  ;

UPDATE NODE SET NODE_ORDER=5,ASCENDING=1,VISIBLE=1,CONTENT_ID='11279eeb-6e02-4374-a255-fc140930f111:a30bd63d-46f6-429e-a6f8-86e15f57cfa2',KEY_CHILD=6,KEY_PARENT=7,KEY_ROOT_DOMAIN_OBJECT=1,OJB_CONCRETE_CLASS='net.sourceforge.fenixedu.domain.contents.ExplicitOrderNode' WHERE CONTENT_ID = '11279eeb-6e02-4374-a255-fc140930f111:a30bd63d-46f6-429e-a6f8-86e15f57cfa2'  ;

UPDATE EXECUTION_PATH SET EXECUTION_PATH='/exportAssiduousness.do?method=chooseYearMonth&action=exportVacations&chooseYear=true',CONTENT_ID='aa25f0c9-be4b-4b4a-81d9-ab30b5296751',KEY_FUNCTIONALITY=8,KEY_ROOT_DOMAIN_OBJECT=1 WHERE CONTENT_ID = 'aa25f0c9-be4b-4b4a-81d9-ab30b5296751'  ;

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)','a30bd63d-46f6-429e-a6f8-86e15f57cfa2') ;
INSERT INTO UUID_TEMP_TABLE(COUNTER,UUID,FROM_UUID) VALUES(2,'a30bd63d-46f6-429e-a6f8-86e15f57cfa2','11279eeb-6e02-4374-a255-fc140930f111:a30bd63d-46f6-429e-a6f8-86e15f57cfa2') ;
INSERT INTO UUID_TEMP_TABLE(COUNTER,UUID,FROM_UUID) VALUES(3,'11279eeb-6e02-4374-a255-fc140930f111','11279eeb-6e02-4374-a255-fc140930f111:a30bd63d-46f6-429e-a6f8-86e15f57cfa2') ;
INSERT INTO UUID_TEMP_TABLE(COUNTER,UUID,FROM_UUID) VALUES(4,'a30bd63d-46f6-429e-a6f8-86e15f57cfa2','aa25f0c9-be4b-4b4a-81d9-ab30b5296751') ;
INSERT INTO UUID_TEMP_TABLE(COUNTER,UUID,FROM_UUID) VALUES(5,'aa25f0c9-be4b-4b4a-81d9-ab30b5296751','a30bd63d-46f6-429e-a6f8-86e15f57cfa2') ;
INSERT INTO UUID_TEMP_TABLE(COUNTER,UUID,FROM_UUID) VALUES(6,'a30bd63d-46f6-429e-a6f8-86e15f57cfa2','11279eeb-6e02-4374-a255-fc140930f111:a30bd63d-46f6-429e-a6f8-86e15f57cfa2') ;
INSERT INTO UUID_TEMP_TABLE(COUNTER,UUID,FROM_UUID) VALUES(7,'11279eeb-6e02-4374-a255-fc140930f111','11279eeb-6e02-4374-a255-fc140930f111:a30bd63d-46f6-429e-a6f8-86e15f57cfa2') ;
INSERT INTO UUID_TEMP_TABLE(COUNTER,UUID,FROM_UUID) VALUES(8,'a30bd63d-46f6-429e-a6f8-86e15f57cfa2','aa25f0c9-be4b-4b4a-81d9-ab30b5296751') ;
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;

DELETE FROM NODE WHERE CONTENT_ID = 'null' ;

DELETE FROM NODE WHERE CONTENT_ID = 'null' ;

DELETE FROM NODE WHERE CONTENT_ID = 'null' ;

DELETE FROM NODE WHERE CONTENT_ID = 'null' ;

DELETE FROM NODE WHERE CONTENT_ID = 'null' ;

DELETE FROM NODE WHERE CONTENT_ID = 'null' ;

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

ALTER TABLE UUID_TEMP_TABLE ADD INDEX (COUNTER), ADD INDEX (UUID), ADD INDEX (FROM_UUID); 


DROP TABLE UUID_TEMP_TABLE;

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 (9,'930e90da-198a-474d-b57c-f5e55c018042','2008-05-12 10:59:40',null,null,null,null,null,null,null,1,null,'net.sourceforge.fenixedu.domain.contents.FunctionalityCall')  ;

INSERT INTO NODE (NODE_ORDER,ASCENDING,VISIBLE,CONTENT_ID,KEY_CHILD,KEY_PARENT,KEY_ROOT_DOMAIN_OBJECT,OJB_CONCRETE_CLASS) VALUES (6,1,1,'004b472cf566a3fac5c49bf07809d810:930e90da-198a-474d-b57c-f5e55c018042',10,11,1,'net.sourceforge.fenixedu.domain.contents.ExplicitOrderNode')  ;

UPDATE CONTENT SET KEY_FUNCTIONALITY=12,CONTENT_ID='930e90da-198a-474d-b57c-f5e55c018042',CREATION_DATE='2008-05-12 10:59:40',NAME=null,TITLE=null,BODY=null,DESCRIPTION=null,NORMALIZED_NAME=null,KEY_PORTAL=null,KEY_AVAILABILITY_POLICY=null,KEY_ROOT_DOMAIN_OBJECT=1,KEY_CREATOR=null,OJB_CONCRETE_CLASS='net.sourceforge.fenixedu.domain.contents.FunctionalityCall' WHERE CONTENT_ID = '930e90da-198a-474d-b57c-f5e55c018042'  ;

UPDATE NODE SET NODE_ORDER=6,ASCENDING=1,VISIBLE=1,CONTENT_ID='004b472cf566a3fac5c49bf07809d810:930e90da-198a-474d-b57c-f5e55c018042',KEY_CHILD=13,KEY_PARENT=14,KEY_ROOT_DOMAIN_OBJECT=1,OJB_CONCRETE_CLASS='net.sourceforge.fenixedu.domain.contents.ExplicitOrderNode' WHERE CONTENT_ID = '004b472cf566a3fac5c49bf07809d810:930e90da-198a-474d-b57c-f5e55c018042'  ;

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(9,'a30bd63d-46f6-429e-a6f8-86e15f57cfa2','930e90da-198a-474d-b57c-f5e55c018042') ;
INSERT INTO UUID_TEMP_TABLE(COUNTER,UUID,FROM_UUID) VALUES(10,'930e90da-198a-474d-b57c-f5e55c018042','004b472cf566a3fac5c49bf07809d810:930e90da-198a-474d-b57c-f5e55c018042') ;
INSERT INTO UUID_TEMP_TABLE(COUNTER,UUID,FROM_UUID) VALUES(11,'004b472cf566a3fac5c49bf07809d810','004b472cf566a3fac5c49bf07809d810:930e90da-198a-474d-b57c-f5e55c018042') ;
INSERT INTO UUID_TEMP_TABLE(COUNTER,UUID,FROM_UUID) VALUES(12,'a30bd63d-46f6-429e-a6f8-86e15f57cfa2','930e90da-198a-474d-b57c-f5e55c018042') ;
INSERT INTO UUID_TEMP_TABLE(COUNTER,UUID,FROM_UUID) VALUES(13,'930e90da-198a-474d-b57c-f5e55c018042','004b472cf566a3fac5c49bf07809d810:930e90da-198a-474d-b57c-f5e55c018042') ;
INSERT INTO UUID_TEMP_TABLE(COUNTER,UUID,FROM_UUID) VALUES(14,'004b472cf566a3fac5c49bf07809d810','004b472cf566a3fac5c49bf07809d810:930e90da-198a-474d-b57c-f5e55c018042') ;
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;
