AnsweredAssumed Answered

Building Blocks API how to merge courses

Question asked by jo0054467 on May 17, 2017
Latest reply on Jul 12, 2017 by jo0054467

Hello all,


I'm getting this output from my code whenever I attempt to merge courses.


bad|PersistenceException The specified object was not found.


The child and parent parameters are working because doesCourseIdExist returns failure as expected with invalid course id's.


Here's the code:


public String AddChild(HttpServletRequest request) {

    String child = request.getParameter("child");

    String parent = request.getParameter("parent");

    if (child == null || parent == null)

        return "bad|need child and parent parameters";


    CourseManager cManager = new CourseManagerFactory().getInstance();

    CourseCourseManager ccManager = new CourseCourseManagerFactory().getInstance();


    try {

        if (!cManager.doesCourseIdExist(child))

            return "bad|child course does not exist";


        if (!cManager.doesCourseIdExist(parent))

            return "bad|parent course does not exist";




        return "good|added";


    catch (PersistenceException pE) {

        return "bad|PersistenceException " + pE.getMessage();


    catch (ValidationException vE) {

        return "bad|ValidationException " + vE.getMessage();




Any assistance would be greatly appreciated. Manually merging courses is not fun.


Also, CourseCourse has setChildCourseId / setParentCourseId methods but I'm not sure how/if I should use them.