UPDATE FUNCTIONALITY SET KEY_AVAILABILITY_POLICY = NULL;

INSERT INTO AVAILABILITY_POLICY (ID_INTERNAL, OJB_CONCRETE_CLASS, KEY_ROOT_DOMAIN_OBJECT, KEY_FUNCTIONALITY, EXPRESSION) VALUES (1,"net.sourceforge.fenixedu.domain.functionalities.GroupAvailability",1,1,"role(PERSON)");
INSERT INTO AVAILABILITY_POLICY (ID_INTERNAL, OJB_CONCRETE_CLASS, KEY_ROOT_DOMAIN_OBJECT, KEY_FUNCTIONALITY, EXPRESSION) VALUES (2,"net.sourceforge.fenixedu.domain.functionalities.GroupAvailability",1,2,"role(STUDENT)");
INSERT INTO AVAILABILITY_POLICY (ID_INTERNAL, OJB_CONCRETE_CLASS, KEY_ROOT_DOMAIN_OBJECT, KEY_FUNCTIONALITY, EXPRESSION) VALUES (3,"net.sourceforge.fenixedu.domain.functionalities.GroupAvailability",1,3,"role(TEACHER)");
INSERT INTO AVAILABILITY_POLICY (ID_INTERNAL, OJB_CONCRETE_CLASS, KEY_ROOT_DOMAIN_OBJECT, KEY_FUNCTIONALITY, EXPRESSION) VALUES (4,"net.sourceforge.fenixedu.domain.functionalities.GroupAvailability",1,4,"role(DEPARTMENT_MEMBER)");
INSERT INTO AVAILABILITY_POLICY (ID_INTERNAL, OJB_CONCRETE_CLASS, KEY_ROOT_DOMAIN_OBJECT, KEY_FUNCTIONALITY, EXPRESSION) VALUES (5,"net.sourceforge.fenixedu.domain.functionalities.GroupAvailability",1,5,"role(TIME_TABLE_MANAGER)");
INSERT INTO AVAILABILITY_POLICY (ID_INTERNAL, OJB_CONCRETE_CLASS, KEY_ROOT_DOMAIN_OBJECT, KEY_FUNCTIONALITY, EXPRESSION) VALUES (6,"net.sourceforge.fenixedu.domain.functionalities.GroupAvailability",1,6,"role(MASTER_DEGREE_CANDIDATE)");
INSERT INTO AVAILABILITY_POLICY (ID_INTERNAL, OJB_CONCRETE_CLASS, KEY_ROOT_DOMAIN_OBJECT, KEY_FUNCTIONALITY, EXPRESSION) VALUES (7,"net.sourceforge.fenixedu.domain.functionalities.GroupAvailability",1,7,"role(MASTER_DEGREE_ADMINISTRATIVE_OFFICE)");
INSERT INTO AVAILABILITY_POLICY (ID_INTERNAL, OJB_CONCRETE_CLASS, KEY_ROOT_DOMAIN_OBJECT, KEY_FUNCTIONALITY, EXPRESSION) VALUES (8,"net.sourceforge.fenixedu.domain.functionalities.GroupAvailability",1,8,"role(TREASURY)");
INSERT INTO AVAILABILITY_POLICY (ID_INTERNAL, OJB_CONCRETE_CLASS, KEY_ROOT_DOMAIN_OBJECT, KEY_FUNCTIONALITY, EXPRESSION) VALUES (9,"net.sourceforge.fenixedu.domain.functionalities.GroupAvailability",1,9,"role(COORDINATOR)");
INSERT INTO AVAILABILITY_POLICY (ID_INTERNAL, OJB_CONCRETE_CLASS, KEY_ROOT_DOMAIN_OBJECT, KEY_FUNCTIONALITY, EXPRESSION) VALUES (10,"net.sourceforge.fenixedu.domain.functionalities.GroupAvailability",1,10,"role(EMPLOYEE)");
INSERT INTO AVAILABILITY_POLICY (ID_INTERNAL, OJB_CONCRETE_CLASS, KEY_ROOT_DOMAIN_OBJECT, KEY_FUNCTIONALITY, EXPRESSION) VALUES (11,"net.sourceforge.fenixedu.domain.functionalities.GroupAvailability",1,11,"role(MANAGEMENT_ASSIDUOUSNESS)");
INSERT INTO AVAILABILITY_POLICY (ID_INTERNAL, OJB_CONCRETE_CLASS, KEY_ROOT_DOMAIN_OBJECT, KEY_FUNCTIONALITY, EXPRESSION) VALUES (12,"net.sourceforge.fenixedu.domain.functionalities.GroupAvailability",1,12,"role(MANAGER)");
INSERT INTO AVAILABILITY_POLICY (ID_INTERNAL, OJB_CONCRETE_CLASS, KEY_ROOT_DOMAIN_OBJECT, KEY_FUNCTIONALITY, EXPRESSION) VALUES (13,"net.sourceforge.fenixedu.domain.functionalities.GroupAvailability",1,216,"role(DEGREE_ADMINISTRATIVE_OFFICE)");
INSERT INTO AVAILABILITY_POLICY (ID_INTERNAL, OJB_CONCRETE_CLASS, KEY_ROOT_DOMAIN_OBJECT, KEY_FUNCTIONALITY, EXPRESSION) VALUES (14,"net.sourceforge.fenixedu.domain.functionalities.GroupAvailability",1,217,"role(CREDITS_MANAGER)");
INSERT INTO AVAILABILITY_POLICY (ID_INTERNAL, OJB_CONCRETE_CLASS, KEY_ROOT_DOMAIN_OBJECT, KEY_FUNCTIONALITY, EXPRESSION) VALUES (15,"net.sourceforge.fenixedu.domain.functionalities.GroupAvailability",1,218,"role(DEPARTMENT_CREDITS_MANAGER)");
INSERT INTO AVAILABILITY_POLICY (ID_INTERNAL, OJB_CONCRETE_CLASS, KEY_ROOT_DOMAIN_OBJECT, KEY_FUNCTIONALITY, EXPRESSION) VALUES (16,"net.sourceforge.fenixedu.domain.functionalities.GroupAvailability",1,219,"role(DEGREE_ADMINISTRATIVE_OFFICE_SUPER_USER)");
INSERT INTO AVAILABILITY_POLICY (ID_INTERNAL, OJB_CONCRETE_CLASS, KEY_ROOT_DOMAIN_OBJECT, KEY_FUNCTIONALITY, EXPRESSION) VALUES (17,"net.sourceforge.fenixedu.domain.functionalities.GroupAvailability",1,220,"role(SCIENTIFIC_COUNCIL)");
INSERT INTO AVAILABILITY_POLICY (ID_INTERNAL, OJB_CONCRETE_CLASS, KEY_ROOT_DOMAIN_OBJECT, KEY_FUNCTIONALITY, EXPRESSION) VALUES (18,"net.sourceforge.fenixedu.domain.functionalities.GroupAvailability",1,221,"role(OPERATOR)");
INSERT INTO AVAILABILITY_POLICY (ID_INTERNAL, OJB_CONCRETE_CLASS, KEY_ROOT_DOMAIN_OBJECT, KEY_FUNCTIONALITY, EXPRESSION) VALUES (19,"net.sourceforge.fenixedu.domain.functionalities.GroupAvailability",1,222,"role(SEMINARIES_COORDINATOR)");
INSERT INTO AVAILABILITY_POLICY (ID_INTERNAL, OJB_CONCRETE_CLASS, KEY_ROOT_DOMAIN_OBJECT, KEY_FUNCTIONALITY, EXPRESSION) VALUES (20,"net.sourceforge.fenixedu.domain.functionalities.GroupAvailability",1,223,"role(GRANT_OWNER)");
INSERT INTO AVAILABILITY_POLICY (ID_INTERNAL, OJB_CONCRETE_CLASS, KEY_ROOT_DOMAIN_OBJECT, KEY_FUNCTIONALITY, EXPRESSION) VALUES (21,"net.sourceforge.fenixedu.domain.functionalities.GroupAvailability",1,224,"role(GRANT_OWNER_MANAGER)");
INSERT INTO AVAILABILITY_POLICY (ID_INTERNAL, OJB_CONCRETE_CLASS, KEY_ROOT_DOMAIN_OBJECT, KEY_FUNCTIONALITY, EXPRESSION) VALUES (22,"net.sourceforge.fenixedu.domain.functionalities.GroupAvailability",1,225,"role(DEPARTMENT_ADMINISTRATIVE_OFFICE)");
INSERT INTO AVAILABILITY_POLICY (ID_INTERNAL, OJB_CONCRETE_CLASS, KEY_ROOT_DOMAIN_OBJECT, KEY_FUNCTIONALITY, EXPRESSION) VALUES (23,"net.sourceforge.fenixedu.domain.functionalities.GroupAvailability",1,226,"role(GEP)");
INSERT INTO AVAILABILITY_POLICY (ID_INTERNAL, OJB_CONCRETE_CLASS, KEY_ROOT_DOMAIN_OBJECT, KEY_FUNCTIONALITY, EXPRESSION) VALUES (24,"net.sourceforge.fenixedu.domain.functionalities.GroupAvailability",1,227,"role(DIRECTIVE_COUNCIL)");
INSERT INTO AVAILABILITY_POLICY (ID_INTERNAL, OJB_CONCRETE_CLASS, KEY_ROOT_DOMAIN_OBJECT, KEY_FUNCTIONALITY, EXPRESSION) VALUES (25,"net.sourceforge.fenixedu.domain.functionalities.GroupAvailability",1,228,"role(DELEGATE)");
INSERT INTO AVAILABILITY_POLICY (ID_INTERNAL, OJB_CONCRETE_CLASS, KEY_ROOT_DOMAIN_OBJECT, KEY_FUNCTIONALITY, EXPRESSION) VALUES (26,"net.sourceforge.fenixedu.domain.functionalities.GroupAvailability",1,229,"role(PROJECTS_MANAGER)");
INSERT INTO AVAILABILITY_POLICY (ID_INTERNAL, OJB_CONCRETE_CLASS, KEY_ROOT_DOMAIN_OBJECT, KEY_FUNCTIONALITY, EXPRESSION) VALUES (27,"net.sourceforge.fenixedu.domain.functionalities.GroupAvailability",1,230,"role(INSTITUCIONAL_PROJECTS_MANAGER)");
INSERT INTO AVAILABILITY_POLICY (ID_INTERNAL, OJB_CONCRETE_CLASS, KEY_ROOT_DOMAIN_OBJECT, KEY_FUNCTIONALITY, EXPRESSION) VALUES (28,"net.sourceforge.fenixedu.domain.functionalities.GroupAvailability",1,231,"role(BOLONHA_MANAGER)");
INSERT INTO AVAILABILITY_POLICY (ID_INTERNAL, OJB_CONCRETE_CLASS, KEY_ROOT_DOMAIN_OBJECT, KEY_FUNCTIONALITY, EXPRESSION) VALUES (29,"net.sourceforge.fenixedu.domain.functionalities.GroupAvailability",1,232,"role(SPACE_MANAGER)");
INSERT INTO AVAILABILITY_POLICY (ID_INTERNAL, OJB_CONCRETE_CLASS, KEY_ROOT_DOMAIN_OBJECT, KEY_FUNCTIONALITY, EXPRESSION) VALUES (30,"net.sourceforge.fenixedu.domain.functionalities.GroupAvailability",1,233,"role(RESEARCHER)");
INSERT INTO AVAILABILITY_POLICY (ID_INTERNAL, OJB_CONCRETE_CLASS, KEY_ROOT_DOMAIN_OBJECT, KEY_FUNCTIONALITY, EXPRESSION) VALUES (31,"net.sourceforge.fenixedu.domain.functionalities.GroupAvailability",1,234,"role(ALUMNI)");
INSERT INTO AVAILABILITY_POLICY (ID_INTERNAL, OJB_CONCRETE_CLASS, KEY_ROOT_DOMAIN_OBJECT, KEY_FUNCTIONALITY, EXPRESSION) VALUES (32,"net.sourceforge.fenixedu.domain.functionalities.GroupAvailability",1,235,"role(PEDAGOGICAL_COUNCIL)");
INSERT INTO AVAILABILITY_POLICY (ID_INTERNAL, OJB_CONCRETE_CLASS, KEY_ROOT_DOMAIN_OBJECT, KEY_FUNCTIONALITY, EXPRESSION) VALUES (33,"net.sourceforge.fenixedu.domain.functionalities.GroupAvailability",1,236,"role(CANDIDATE)");

UPDATE FUNCTIONALITY SET KEY_AVAILABILITY_POLICY = 1 WHERE ID_INTERNAL = 1;
UPDATE FUNCTIONALITY SET KEY_AVAILABILITY_POLICY = 2 WHERE ID_INTERNAL = 2;
UPDATE FUNCTIONALITY SET KEY_AVAILABILITY_POLICY = 3 WHERE ID_INTERNAL = 3;
UPDATE FUNCTIONALITY SET KEY_AVAILABILITY_POLICY = 4 WHERE ID_INTERNAL = 4;
UPDATE FUNCTIONALITY SET KEY_AVAILABILITY_POLICY = 5 WHERE ID_INTERNAL = 5;
UPDATE FUNCTIONALITY SET KEY_AVAILABILITY_POLICY = 6 WHERE ID_INTERNAL = 6;
UPDATE FUNCTIONALITY SET KEY_AVAILABILITY_POLICY = 7 WHERE ID_INTERNAL = 7;
UPDATE FUNCTIONALITY SET KEY_AVAILABILITY_POLICY = 8 WHERE ID_INTERNAL = 8;
UPDATE FUNCTIONALITY SET KEY_AVAILABILITY_POLICY = 9 WHERE ID_INTERNAL = 9;
UPDATE FUNCTIONALITY SET KEY_AVAILABILITY_POLICY = 10 WHERE ID_INTERNAL = 10;
UPDATE FUNCTIONALITY SET KEY_AVAILABILITY_POLICY = 11 WHERE ID_INTERNAL = 11;
UPDATE FUNCTIONALITY SET KEY_AVAILABILITY_POLICY = 12 WHERE ID_INTERNAL = 12;
UPDATE FUNCTIONALITY SET KEY_AVAILABILITY_POLICY = 13 WHERE ID_INTERNAL = 216;
UPDATE FUNCTIONALITY SET KEY_AVAILABILITY_POLICY = 14 WHERE ID_INTERNAL = 217;
UPDATE FUNCTIONALITY SET KEY_AVAILABILITY_POLICY = 15 WHERE ID_INTERNAL = 218;
UPDATE FUNCTIONALITY SET KEY_AVAILABILITY_POLICY = 16 WHERE ID_INTERNAL = 219;
UPDATE FUNCTIONALITY SET KEY_AVAILABILITY_POLICY = 17 WHERE ID_INTERNAL = 220;
UPDATE FUNCTIONALITY SET KEY_AVAILABILITY_POLICY = 18 WHERE ID_INTERNAL = 221;
UPDATE FUNCTIONALITY SET KEY_AVAILABILITY_POLICY = 19 WHERE ID_INTERNAL = 222;
UPDATE FUNCTIONALITY SET KEY_AVAILABILITY_POLICY = 20 WHERE ID_INTERNAL = 223;
UPDATE FUNCTIONALITY SET KEY_AVAILABILITY_POLICY = 21 WHERE ID_INTERNAL = 224;
UPDATE FUNCTIONALITY SET KEY_AVAILABILITY_POLICY = 22 WHERE ID_INTERNAL = 225;
UPDATE FUNCTIONALITY SET KEY_AVAILABILITY_POLICY = 23 WHERE ID_INTERNAL = 226;
UPDATE FUNCTIONALITY SET KEY_AVAILABILITY_POLICY = 24 WHERE ID_INTERNAL = 227;
UPDATE FUNCTIONALITY SET KEY_AVAILABILITY_POLICY = 25 WHERE ID_INTERNAL = 228;
UPDATE FUNCTIONALITY SET KEY_AVAILABILITY_POLICY = 26 WHERE ID_INTERNAL = 229;
UPDATE FUNCTIONALITY SET KEY_AVAILABILITY_POLICY = 27 WHERE ID_INTERNAL = 230;
UPDATE FUNCTIONALITY SET KEY_AVAILABILITY_POLICY = 28 WHERE ID_INTERNAL = 231;
UPDATE FUNCTIONALITY SET KEY_AVAILABILITY_POLICY = 29 WHERE ID_INTERNAL = 232;
UPDATE FUNCTIONALITY SET KEY_AVAILABILITY_POLICY = 30 WHERE ID_INTERNAL = 233;
UPDATE FUNCTIONALITY SET KEY_AVAILABILITY_POLICY = 31 WHERE ID_INTERNAL = 234;
UPDATE FUNCTIONALITY SET KEY_AVAILABILITY_POLICY = 32 WHERE ID_INTERNAL = 235;
UPDATE FUNCTIONALITY SET KEY_AVAILABILITY_POLICY = 33 WHERE ID_INTERNAL = 236;