use of org.cpsolver.studentsct.model.AreaClassificationMajor in project cpsolver by UniTime.
the class StudentSectioningXMLSaver method saveStudent.
/**
* Save student
* @param studentEl student element to be populated
* @param student student to be saved
*/
protected void saveStudent(Element studentEl, Student student) {
studentEl.addAttribute("id", getId("student", student.getId()));
if (iShowNames) {
if (student.getExternalId() != null && !student.getExternalId().isEmpty())
studentEl.addAttribute("externalId", student.getExternalId());
if (student.getName() != null && !student.getName().isEmpty())
studentEl.addAttribute("name", student.getName());
if (student.getStatus() != null && !student.getStatus().isEmpty())
studentEl.addAttribute("status", student.getStatus());
}
if (student.isDummy())
studentEl.addAttribute("dummy", "true");
if (iSaveStudentInfo) {
for (AcademicAreaCode aac : student.getAcademicAreaClasiffications()) {
Element aacEl = studentEl.addElement("classification");
if (aac.getArea() != null)
aacEl.addAttribute("area", aac.getArea());
if (aac.getCode() != null)
aacEl.addAttribute("code", aac.getCode());
}
for (AcademicAreaCode aac : student.getMajors()) {
Element aacEl = studentEl.addElement("major");
if (aac.getArea() != null)
aacEl.addAttribute("area", aac.getArea());
if (aac.getCode() != null)
aacEl.addAttribute("code", aac.getCode());
}
for (AcademicAreaCode aac : student.getMinors()) {
Element aacEl = studentEl.addElement("minor");
if (aac.getArea() != null)
aacEl.addAttribute("area", aac.getArea());
if (aac.getCode() != null)
aacEl.addAttribute("code", aac.getCode());
}
for (AreaClassificationMajor acm : student.getAreaClassificationMajors()) {
Element acmEl = studentEl.addElement("acm");
if (acm.getArea() != null)
acmEl.addAttribute("area", acm.getArea());
if (acm.getArea() != null)
acmEl.addAttribute("classification", acm.getClassification());
if (acm.getArea() != null)
acmEl.addAttribute("major", acm.getMajor());
}
}
for (Unavailability unavailability : student.getUnavailabilities()) {
Element unavEl = studentEl.addElement("unavailability");
unavEl.addAttribute("offering", getId("offering", unavailability.getSection().getSubpart().getConfig().getOffering().getId()));
unavEl.addAttribute("section", getId("section", unavailability.getSection().getId()));
if (unavailability.isAllowOverlap())
unavEl.addAttribute("allowOverlap", "true");
}
}
use of org.cpsolver.studentsct.model.AreaClassificationMajor in project cpsolver by UniTime.
the class StudentSectioningXMLLoader method loadStudent.
/**
* Load student
* @param studentEl student element
* @param offeringTable offering table
* @return loaded student
*/
protected Student loadStudent(Element studentEl, Map<Long, Offering> offeringTable) {
Student student = new Student(Long.parseLong(studentEl.attributeValue("id")), "true".equals(studentEl.attributeValue("dummy")));
student.setExternalId(studentEl.attributeValue("externalId"));
student.setName(studentEl.attributeValue("name"));
student.setStatus(studentEl.attributeValue("status"));
for (Iterator<?> j = studentEl.elementIterator(); j.hasNext(); ) {
Element requestEl = (Element) j.next();
if ("classification".equals(requestEl.getName())) {
student.getAcademicAreaClasiffications().add(new AcademicAreaCode(requestEl.attributeValue("area"), requestEl.attributeValue("code")));
} else if ("major".equals(requestEl.getName())) {
student.getMajors().add(new AcademicAreaCode(requestEl.attributeValue("area"), requestEl.attributeValue("code")));
} else if ("minor".equals(requestEl.getName())) {
student.getMinors().add(new AcademicAreaCode(requestEl.attributeValue("area"), requestEl.attributeValue("code")));
} else if ("unavailability".equals(requestEl.getName())) {
Offering offering = offeringTable.get(Long.parseLong(requestEl.attributeValue("offering")));
Section section = (offering == null ? null : offering.getSection(Long.parseLong(requestEl.attributeValue("section"))));
if (section != null)
new Unavailability(student, section, "true".equals(requestEl.attributeValue("allowOverlap")));
} else if ("acm".equals(requestEl.getName())) {
student.getAreaClassificationMajors().add(new AreaClassificationMajor(requestEl.attributeValue("area"), requestEl.attributeValue("classification"), requestEl.attributeValue("major")));
}
}
return student;
}
Aggregations