Skip to content

Commit

Permalink
feat: Implement removeDraftById for service and storage layers - EXO-…
Browse files Browse the repository at this point in the history
  • Loading branch information
azayati authored Mar 27, 2024
1 parent ba08144 commit f1f0362
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -359,6 +359,12 @@ public void deleteDraftByName(String draftPageName, String username) throws Wiki
}
draftPageDAO.deleteDraftPagesByUserAndName(draftPageName, username);
}

@Override
public void deleteDraftById(String id) throws WikiException {
DraftPageEntity draftPageEntity = draftPageDAO.find(Long.parseLong(id));
draftPageDAO.delete(draftPageEntity);
}

@Override
@ExoTransactional
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,14 @@ public interface DataStorage {
public void deleteDraftOfPage(Page page, String username, String lang) throws WikiException;

public void deleteDraftByName(String newDraftPageName, String username) throws WikiException;

/**
* Deletes a draft note by its technical id.
*
* @param id Id of the draft note.
* @throws WikiException if an error occured
*/
public void deleteDraftById(String id) throws WikiException;

public void renamePage(String wikiType, String wikiOwner, String pageName, String newName, String newTitle) throws WikiException;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -266,14 +266,22 @@ List<BreadcrumbData> getBreadCrumb(String noteType,
void removeDraftOfNote(WikiPageParams param, String lang) throws WikiException;

void removeDraftOfNote(Page page, String username) throws WikiException;

/**
* Removes a draft page by its name.
*
* @param draftName Name of the draft page.
* @throws WikiException if an error occured
*/
void removeDraft(String draftName) throws WikiException;

/**
* Removes a draft page by its technical id.
*
* @param draftId Technical Id of the draft page.
* @throws WikiException if an error occured
*/
void removeDraftById(String draftId) throws WikiException;


/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -730,7 +730,12 @@ public void removeDraftOfNote(WikiPageParams param, String lang) throws WikiExce
public void removeDraft(String draftName) throws WikiException {
dataStorage.deleteDraftByName(draftName, Utils.getCurrentUser());
}


@Override
public void removeDraftById(String draftId) throws WikiException {
dataStorage.deleteDraftById(draftId);
}

@Override
public List<PageHistory> getVersionsHistoryOfNote(Page note, String userName) throws WikiException {
List<PageHistory> versionsHistory = dataStorage.getHistoryOfPage(note);
Expand Down

0 comments on commit f1f0362

Please sign in to comment.