public boolean makeEntryAChildOfAParent(User user,Entry parent,Entry child,boolean justTheEntry,boolean isAdmin,Errors errors){
  if (user == null) {
    Errors.add(errors,errorMessages.errorUserIsNull());
    return false;
  }
  if (parent == null) {
    Errors.add(errors,errorMessages.errorParentIsNull());
    return false;
  }
  if (child == null) {
    Errors.add(errors,errorMessages.errorChildIsNull());
    return false;
  }
  if (!canUserModifyEntry(user,parent,isAdmin)) {
    Errors.add(errors,errorMessages.errorTheUserIsNotEntitledToModifyTheParentEntry());
    return false;
  }
  if (!canUserModifyEntry(user,child,isAdmin)) {
    Errors.add(errors,errorMessages.errorTheUserIsNotEntitledToModifyTheChildEntry());
    return false;
  }
  if (!justTheEntry) {
    if (isEntryADescendantOfAncestor(parent,child)) {
      Errors.add(errors,errorMessages.errorChildIsAnAncestorOfTheParent());
      return false;
    }
  }
 else {
    final ArrayList<Entry> childsChildrenInOrder=getChildrenInOrder(child);
    final Entry parentOfChild=getEntryById(child.getParentId());
    for (    final Entry childsChildTemp : childsChildrenInOrder) {
      if (!makeNotebookEntry(user,childsChildTemp,isAdmin,errors)) {
        return false;
      }
    }
    if (parentOfChild != null) {
      Entry previous=child;
      for (      final Entry childsChildTemp : childsChildrenInOrder) {
        if (!createParentChildRelationship(user,parentOfChild,childsChildTemp,previous,isAdmin,errors)) {
          return false;
        }
        previous=childsChildTemp;
      }
    }
  }
  if (!createParentChildRelationship(user,parent,child,null,isAdmin,errors)) {
    return false;
  }
  return true;
}

public boolean makeEntryAChildOfAParent ( User user , Entry parent , Entry child , boolean justTheEntry , boolean isAdmin , Errors errors ) { if ( user == null ) { Errors . add ( errors , errorMessages . errorUserIsNull ( ) ) ; return false ; } if ( parent == null ) { Errors . add ( errors , errorMessages . errorParentIsNull ( ) ) ; return false ; } if ( child == null ) { Errors . add ( errors , errorMessages . errorChildIsNull ( ) ) ; return false ; } if ( ! canUserModifyEntry ( user , parent , isAdmin ) ) { Errors . add ( errors , errorMessages . errorTheUserIsNotEntitledToModifyTheParentEntry ( ) ) ; return false ; } if ( ! canUserModifyEntry ( user , child , isAdmin ) ) { Errors . add ( errors , errorMessages . errorTheUserIsNotEntitledToModifyTheChildEntry ( ) ) ; return false ; } if ( ! justTheEntry ) { if ( isEntryADescendantOfAncestor ( parent , child ) ) { Errors . add ( errors , errorMessages . errorChildIsAnAncestorOfTheParent ( ) ) ; return false ; } } else { final ArrayList < Entry > childsChildrenInOrder = getChildrenInOrder ( child ) ; final Entry parentOfChild = getEntryById ( child . getParentId ( ) ) ; for ( final Entry childsChildTemp : childsChildrenInOrder ) { if ( ! makeNotebookEntry ( user , childsChildTemp , isAdmin , errors ) ) { return false ; } } if ( parentOfChild != null ) { Entry previous = child ; for ( final Entry childsChildTemp : childsChildrenInOrder ) { if ( ! createParentChildRelationship ( user , parentOfChild , childsChildTemp , previous , isAdmin , errors ) ) { return false ; } previous = childsChildTemp ; } } } if ( ! createParentChildRelationship ( user , parent , child , null , isAdmin , errors ) ) { return false ; } return true ; }
api method . makes an entry a child of another .
