AnsweredAssumed Answered

API course copy causing "Resource not found."

Question asked by schilens.jeremiah on Jun 7, 2017

Hello,

 

We are writing a building block that activates when an instructor enters a course with no content in it. One of the options we give the users is to copy from a previous course.

From a workflow perspective this works, but sometimes the actual copy gets messed up and when entering the course you get "Resource not found."

The only way to fix the course is to delete it and re-copy it.

 

In the code we're doing the following, does this look correct? Any ideas what to look for as to why we're getting Resource not found?

CloneConfig conf = new CloneConfig();

conf.includeArea(CloneConfig.Area.ALL);

conf.excludeArea(CloneConfig.Area.MEMBERSHIP);

conf.setReconcileFlag(false);

                try

                {

                    CourseSitePersister coursePersister1 = CourseSitePersister.Default.getInstance();

                    coursePersister1.clone(course_source1, course_destination, conf);

               

                }

                catch (PersistenceException ex) {Logger.getLogger(CourseClone.class.getName()).log(Level.SEVERE, null, ex); }

                catch (ValidationException ex) {Logger.getLogger(CourseClone.class.getName()).log(Level.SEVERE, null, ex);}

                catch (ConstraintViolationException ex)

                {

                    Logger.getLogger(CourseClone.class.getName()).log(Level.SEVERE, null, ex);

                }               

 

 

Thank you,

 

Jeremiah

CloneConfig conf = new CloneConfig();

conf.includeArea(CloneConfig.Area.ALL);

conf.excludeArea(CloneConfig.Area.MEMBERSHIP);

conf.setReconcileFlag(false);

                try

                {

                    CourseSitePersister coursePersister1 = CourseSitePersister.Default.getInstance();

                    coursePersister1.clone(course_source1, course_destination, conf);

               

                }

                catch (PersistenceException ex) {Logger.getLogger(CourseClone.class.getName()).log(Level.SEVERE, null, ex); }

                catch (ValidationException ex) {Logger.getLogger(CourseClone.class.getName()).log(Level.SEVERE, null, ex);}

                catch (ConstraintViolationException ex)

                {

                    Logger.getLogger(CourseClone.class.getName()).log(Level.SEVERE, null, ex);

                }               

 

 

Outcomes