Follow these steps to use this method to delete a file shortcut:
Get a reference to
@Reference private DLAppService _dlAppService;
For more information on this, see the section on getting a service reference in the getting started tutorial.
Get the file shortcut’s ID. Since it’s common to delete a file shortcut specified by the end user, you can extract its ID from the request. This example does so via
ParamUtil, but you can do this any way you wish:
long fileShortcutId = ParamUtil.getLong(actionRequest, "fileShortcutId");
Use the service reference to call the
deleteFileShortcutmethod with the file shortcut ID from the previous step:
You can find the full code for this example in the
of Liferay DXP’s
class. This class uses the Documents and Media API to implement almost all the
FileShortcut actions that the Documents and Media app supports. Also note that
deleteFileShortcut method, as well as the rest of
EditFileShortcutMVCActionCommand, contains additional logic to suit the
specific needs of the Documents and Media app.