package pt.utl.ist.scripts.runOnce.candidacy; import net.sourceforge.fenixedu.domain.Degree; import net.sourceforge.fenixedu.domain.candidacyProcess.IndividualCandidacyProcess; import net.sourceforge.fenixedu.domain.candidacyProcess.secondCycle.SecondCycleIndividualCandidacyProcess; import pt.utl.ist.scripts.commons.AtomicScript; public class ChangeDegreeInApplications extends AtomicScript { private static final String IMASTER_DEGREE_ENVIRONMENT = "MEAmbi"; private static final String[] PROCESS_CODES = { "091074647", "091074618", "091074012", "091073033", "091072239", "091071813", "091069241", "091068222" }; @Override protected void run() throws Exception { Degree imasterDegreeEnvironment = Degree.readBySigla(IMASTER_DEGREE_ENVIRONMENT); for (String code : PROCESS_CODES) { SecondCycleIndividualCandidacyProcess process = IndividualCandidacyProcess.findIndividualCandidacyProcessByCode(SecondCycleIndividualCandidacyProcess.class, code); System.out.println(String.format("Process code %s, current chosen degree %s", code, process.getCandidacy() .getSelectedDegree().getSigla())); // process.getCandidacy().setSelectedDegree(imasterDegreeEnvironment); } } /** * @param args */ public static void main(String[] args) { process(new ChangeDegreeInApplications()); } }