@Override
 protected void performTemplateData(
     String language, Ticket resource, SilverpeasTemplate template) {
   Ticket ticket = getResource();
   String userId = getUserId();
   getNotificationMetaData()
       .addLanguage(
           language, getBundle(language).getString(getBundleSubjectKey(), getTitle()), "");
   template.setAttribute(
       "senderUser",
       OrganisationControllerFactory.getOrganisationController().getUserDetail(userId));
   template.setAttribute("attachmentUrl", fileSharingParam.getAttachmentUrl());
   if (StringUtil.isDefined(fileSharingParam.getAdditionalMessage())) {
     template.setAttribute("additionalMessage", fileSharingParam.getAdditionalMessage());
   }
   template.setAttribute("ticket", resource);
   if (ticket.getNbAccessMax() != 0) {
     template.setAttribute("limitedAccess", "true");
   }
 }
 /**
  * Builds and sends a file sharing notification. A warning message is logged when an exception is
  * catched.
  *
  * @param resource the ticket file sharing resource
  */
 public static void notify(final Ticket resource, final SharingNotificationVO fileSharingParam) {
   try {
     UserNotificationHelper.buildAndSend(
         new FileSharingUserNotification(resource, fileSharingParam));
   } catch (final Exception e) {
     SilverTrace.warn(
         "webPages",
         "FileSharingUserNotification.notify()",
         "fileSharing.EX_ALERT_USERS_ERROR",
         "tocken = " + resource.getToken(),
         e);
   }
 }
 @Override
 public boolean isReadable(ShareableResource resource) {
   Ticket ticket = SharingServiceFactory.getSharingTicketService().getTicket(resource.getToken());
   try {
     if (ticket != null && ticket instanceof NodeTicket) {
       NodePK nodePk =
           new NodePK(String.valueOf(ticket.getSharedObjectId()), ticket.getComponentId());
       Collection<NodePK> autorizedNodes = getNodeDescendants(nodePk);
       autorizedNodes.add(nodePk);
       if (resource.getAccessedObject() instanceof AttachmentDetail) {
         AttachmentDetail attachment = (AttachmentDetail) resource.getAccessedObject();
         return isPublicationReadable(
             attachment.getForeignKey(), nodePk.getInstanceId(), autorizedNodes);
       }
       if (resource.getAccessedObject() instanceof SimpleDocument) {
         SimpleDocument attachment = (SimpleDocument) resource.getAccessedObject();
         return isPublicationReadable(
             new ForeignPK(attachment.getForeignId(), attachment.getInstanceId()),
             nodePk.getInstanceId(),
             autorizedNodes);
       }
       if (resource.getAccessedObject() instanceof Document) {
         Document document = (Document) resource.getAccessedObject();
         return isPublicationReadable(
             document.getForeignKey(), nodePk.getInstanceId(), autorizedNodes);
       }
       if (resource.getAccessedObject() instanceof NodeDetail) {
         NodeDetail node = (NodeDetail) resource.getAccessedObject();
         return autorizedNodes.contains(node.getNodePK());
       }
     }
   } catch (Exception ex) {
     return false;
   }
   return false;
 }