/** * Copy Phases from Type * * @param type Project Type * @return count */ public int copyPhasesFrom(MProjectType type) { // create phases int count = 0; int taskCount = 0; MProjectTypePhase[] typePhases = type.getPhases(); for (int i = 0; i < typePhases.length; i++) { MProjectPhase toPhase = new MProjectPhase(this, typePhases[i]); if (toPhase.save()) { count++; taskCount += toPhase.copyTasksFrom(typePhases[i]); } } log.fine("#" + count + "/" + taskCount + " - " + type); if (typePhases.length != count) log.log(Level.SEVERE, "Count difference - Type=" + typePhases.length + " <> Saved=" + count); return count; } // copyPhasesFrom
/** * Set Project Type and Category. If Service Project copy Projet Type Phase/Tasks * * @param type project type */ public void setProjectType(MProjectType type) { if (type == null) return; setC_ProjectType_ID(type.getC_ProjectType_ID()); setProjectCategory(type.getProjectCategory()); if (PROJECTCATEGORY_ServiceChargeProject.equals(getProjectCategory())) copyPhasesFrom(type); } // setProjectType