File: /var/www/html/unitime/Documentation/Scripts/Create Same Days-Room-Start Constraint.xml
<?xml version="1.0" encoding="UTF-8"?>
<script name="Distribution Types: Create Same Days-Room-Start Constraint" permission="Distribution Types" engine="ECMAScript" created="June 6, 2022">
<description><![CDATA[Same Days-Room-Start: Given classes must start at the same time of day, on the same days and in the same room.<br>
It is the combination of Same Days, Same Start and Same Room distribution preferences.<br>
When prohibited or (strongly) discouraged: Any pair of classes classes cannot be taught on the same days during the same time in the same room.]]></description>
<body><![CDATA[var reqId = hibSession.createQuery('select max(requirementId) from DistributionType').uniqueResult();
var type = hibSession.createQuery('from DistributionType where reference = :reference').setParameter('reference', 'SAME_DATES').uniqueResult();
if (type == null) {
log.info('Creating Same Dates constraint...');
type = new org.unitime.timetable.model.DistributionType();
type.setReference('SAME_DAY_ROOM_START');
} else {
log.warn('Constraint Same Days-Room-Start already exists.');
}
type.setLabel('Same Days-Room-Start');
type.setSequencingRequired(false);
type.setRequirementId(++reqId);
type.setAllowedPref('P43210R');
type.setDescr('Given classes must start at the same time of day, on the same days and in the same room.<br>It is the combination of Same Days, Same Start and Same Room distribution preferences.<br>When prohibited or (strongly) discouraged: Any pair of classes classes cannot be taught on the same days during the same time in the same room.');
type.setAbbreviation('Same Days-Room-Start');
type.setInstructorPref(false);
type.setExamPref(false);
type.setVisible(true);
hibSession.saveOrUpdate(type);]]></body>
</script>