CreateOptions opt=new CreateOptions();
opt.setResourcePool(form.getResourcePool());
opt.setLocal(local);
opt.setName(form.getName());
opt.setAddResources(!local);
Project project = projectFactory.createProject(opt);
try {
//createProject above might make a new resource pool, so make sur it is used when copying properties
//projectDialog.getForm().setResourcePool(project.getResourcePool());
project.setManager(form.getManager());
project.setName(form.getName());
project.setNotes(form.getNotes());
project.setForward(form.isForward());
project.setGroup(form.getGroup());
project.setDivision(form.getDivision());
project.setProjectType(form.getProjectType());
project.setProjectStatus(form.getProjectStatus());
project.setExpenseType(form.getExpenseType());
if (!form.isLocal()){
project.setAccessControlPolicy(form.getAccessControlType());
project.resetRoles(form.getAccessControlType()==0);
}
if (form.isLocal())
project.setLocal(true);
else project.setTemporaryLocal(true);
if (form.isForward())
project.setStartDate(form.getStartDate());
else
project.setFinishDate(form.getStartDate());
// copy any extra fields to the project
project.getExtraFields().putAll(form.getExtra().getExtraFields());
// PropertyUtils.copyProperties(project, projectDialog.getForm());
} catch (Exception propertyException) {
propertyException.printStackTrace();
}