check(RolePredicates.SCIENTIFIC_COUNCIL_PREDICATE);
if (externalId == null || name == null || nameEn == null || acronym == null || degreeType == null || ectsCredits == null) {
throw new InvalidArgumentsServiceException();
}
final Degree degreeToEdit = FenixFramework.getDomainObject(externalId);
if (degreeToEdit == null) {
throw new NonExistingServiceException();
} else if (!degreeToEdit.getSigla().equalsIgnoreCase(acronym)
|| !degreeToEdit.getNameFor(executionYear).getContent(MultiLanguageString.pt).equalsIgnoreCase(name)
|| !degreeToEdit.getDegreeType().equals(degreeType)) {
final List<Degree> degrees = Degree.readNotEmptyDegrees();
// assert unique degree code and unique pair name/type
for (Degree degree : degrees) {
if (degree != degreeToEdit) {
if (degree.getSigla().equalsIgnoreCase(acronym)) {
throw new FenixServiceException("error.existing.degree.acronym");
}
if ((degree.getNameFor(executionYear).getContent(MultiLanguageString.pt).equalsIgnoreCase(name) || degree
.getNameFor(executionYear).getContent(MultiLanguageString.en).equalsIgnoreCase(nameEn))
&& degree.getDegreeType().equals(degreeType)) {
throw new FenixServiceException("error.existing.degree.name.and.type");
}
}
}
}
degreeToEdit.edit(name, nameEn, acronym, degreeType, ectsCredits, gradeScale, prevailingScientificArea, executionYear);
}