/** * Remove domain authentication and settings properties file * * @param domainToRemove domain to remove * @throws DomainDeletionException */ private void removeDomainPropertiesFile(Domain domainToRemove) throws DomainDeletionException { SilverTrace.info( "admin", "SQLDomainService.removeDomainAuthenticationPropertiesFile()", "root.MSG_GEN_ENTER_METHOD"); String domainName = domainToRemove.getName(); String domainPropertiesPath = FileRepositoryManager.getDomainPropertiesPath(domainName); String authenticationPropertiesPath = FileRepositoryManager.getDomainAuthenticationPropertiesPath(domainName); File domainPropertiesFile = new File(domainPropertiesPath); File authenticationPropertiesFile = new File(authenticationPropertiesPath); boolean domainPropertiesFileDeleted = domainPropertiesFile.delete(); boolean authenticationPropertiesFileDeleted = authenticationPropertiesFile.delete(); if ((!domainPropertiesFileDeleted) || (!authenticationPropertiesFileDeleted)) { SilverTrace.warn( "admin", "SQLDomainService.removeDomainAuthenticationPropertiesFile()", "admin.EX_DELETE_DOMAIN_PROPERTIES", "domainPropertiesFileDeleted:" + domainPropertiesFileDeleted + ", authenticationPropertiesFileDeleted:" + authenticationPropertiesFileDeleted); } }
/** * Delete phisycally domain and authentication properties files * * @param domainName domain name concerned */ private void removePropertiesFiles(String domainName) { String authenticationPropertiesPath = FileRepositoryManager.getDomainAuthenticationPropertiesPath(domainName); String domainPropertiesPath = FileRepositoryManager.getDomainPropertiesPath(domainName); new File(authenticationPropertiesPath).delete(); new File(domainPropertiesPath).delete(); }
public String getDocumentIcon() { String icon = ""; if (getPhysicalName().lastIndexOf('.') >= 0) { String fileType = FileRepositoryManager.getFileExtension(getPhysicalName()); icon = FileRepositoryManager.getFileIcon(fileType); } else { icon = FileRepositoryManager.getFileIcon(""); } return icon; }
@Test @Transactional public void testCreateDomainStorage() throws Exception { Domain domain = new Domain(); domain.setName("TestCreation"); File tmpFile = null; try { tmpFile = File.createTempFile("domain", "TestCreation"); populateFile(tmpFile); // Mock FileRepositoryManager mockStatic(FileRepositoryManager.class); when(FileRepositoryManager.getDomainPropertiesPath("TestCreation")) .thenReturn(tmpFile.getAbsolutePath()); // Create domain storage dao.createDomainStorage(domain); // Looks for domain created tables testTablesExistence(true); } catch (Exception e) { tmpFile.delete(); throw e; } }
/** * Extract the mime-type from the file name. * * @param fileName the name of the file. * @return the mime-type as a String. */ public static String getMimeType(final String fileName) { String mimeType = null; final String fileExtension = FileRepositoryManager.getFileExtension(fileName).toLowerCase(); try { if (MIME_TYPES_EXTENSIONS != null) { mimeType = MIME_TYPES_EXTENSIONS.getString(fileExtension); } } catch (final MissingResourceException e) { SilverTrace.warn( "attachment", "AttachmentController", "attachment.MSG_MISSING_MIME_TYPES_PROPERTIES", null, e); } if (mimeType == null) { mimeType = MIME_TYPES.getContentType(fileName); } if (ARCHIVE_MIME_TYPE.equalsIgnoreCase(mimeType) || SHORT_ARCHIVE_MIME_TYPE.equalsIgnoreCase(mimeType)) { if (JAR_EXTENSION.equalsIgnoreCase(fileExtension) || WAR_EXTENSION.equalsIgnoreCase(fileExtension) || EAR_EXTENSION.equalsIgnoreCase(fileExtension)) { mimeType = JAVA_ARCHIVE_MIME_TYPE; } else if ("3D".equalsIgnoreCase(fileExtension)) { mimeType = SPINFIRE_MIME_TYPE; } } if (mimeType == null) { mimeType = DEFAULT_MIME_TYPE; } return mimeType; }
/** * Generates domain authentication properties file * * @param domainToCreate domain to create * @throws DomainCreationException */ private void generateDomainAuthenticationPropertiesFile(Domain domainToCreate) throws DomainCreationException { SilverTrace.info( "admin", "SQLDomainService.generateDomainAuthenticationPropertiesFile()", "root.MSG_GEN_ENTER_METHOD"); String domainName = domainToCreate.getName(); String domainPropertiesPath = FileRepositoryManager.getDomainPropertiesPath(domainName); String authenticationPropertiesPath = FileRepositoryManager.getDomainAuthenticationPropertiesPath(domainName); boolean allowPasswordChange = templateSettings.getBoolean("allowPasswordChange", true); String cryptMethod = templateSettings.getString("database.SQLPasswordEncryption", Authentication.ENC_TYPE_MD5); SilverpeasTemplate template = getNewTemplate(); template.setAttribute("SQLPasswordEncryption", cryptMethod); template.setAttribute("allowPasswordChange", allowPasswordChange); template.setAttribute("SQLDriverClass", adminSettings.getString("AdminDBDriver")); template.setAttribute("SQLJDBCUrl", adminSettings.getString("WaProductionDb")); template.setAttribute("SQLAccessLogin", adminSettings.getString("WaProductionUser")); template.setAttribute("SQLAccessPasswd", adminSettings.getString("WaProductionPswd")); template.setAttribute("SQLUserTableName", "Domain" + domainName + "_User"); File domainPropertiesFile = new File(domainPropertiesPath); File authenticationPropertiesFile = new File(authenticationPropertiesPath); PrintWriter out = null; try { out = new PrintWriter(new FileWriter(authenticationPropertiesFile)); out.print(template.applyFileTemplate("templateDomainAuthenticationSQL")); } catch (IOException e) { domainPropertiesFile.delete(); authenticationPropertiesFile.delete(); throw new DomainCreationException( "SQLDomainService.generateDomainAuthenticationPropertiesFile()", domainToCreate.toString(), e); } finally { out.close(); } }
/** * Return the path to the document file. * * @return the path to the document file. */ public String getDocumentPath() { if (isPhysicalPathAbsolute()) { return FilenameUtils.separatorsToSystem(physicalName); } String directory = FileRepositoryManager.getAbsolutePath(getInstanceId(), new String[] {CONTEXT}); directory = FilenameUtils.separatorsToSystem(directory); if (!directory.endsWith(File.separator)) { directory += File.separator; } return directory + getPhysicalName(); }
@Override protected void checkDomainName(String domainName) throws DomainConflictException, AdminException { // Commons checks super.checkDomainName(domainName); // Check properties files availability // com.stratelia.silverpeas.domains.domain<domainName>.properties // com.stratelia.silverpeas.authentication.autDomain<domainName>.properties String authenticationPropertiesPath = FileRepositoryManager.getDomainAuthenticationPropertiesPath(domainName); String domainPropertiesPath = FileRepositoryManager.getDomainPropertiesPath(domainName); if (new File(authenticationPropertiesPath).exists()) { throw new DomainAuthenticationPropertiesAlreadyExistsException(domainName); } if (new File(domainPropertiesPath).exists()) { throw new DomainPropertiesAlreadyExistsException(domainName); } }
private String generateUserTableCreateStatement(String domainName) throws IOException { Properties props = new Properties(); FileInputStream fis = null; try { fis = new FileInputStream(FileRepositoryManager.getDomainPropertiesPath(domainName)); props.load(fis); } finally { IOUtils.closeQuietly(fis); } int numberOfColumns = Integer.parseInt(props.getProperty("property.Number")); StringBuilder createStatement = new StringBuilder(); createStatement.append("CREATE TABLE Domain").append(domainName).append("_User "); createStatement.append("("); // Common columns createStatement.append("id int NOT NULL , firstName varchar(100) NULL , "); createStatement.append("lastName varchar(100) NULL ," + "email varchar(200) NULL , "); createStatement.append("login varchar(50) NOT NULL ," + "password varchar(123) NULL , "); createStatement.append("passwordValid char(1) NULL , "); // Domain specific columns String specificColumnName; String specificColumnType; int specificColumnMaxLength; for (int i = 1; i <= numberOfColumns; i++) { specificColumnType = props.getProperty("property_" + String.valueOf(i) + ".Type"); specificColumnName = props.getProperty("property_" + String.valueOf(i) + ".MapParameter"); String maxLengthPropertyValue = props.getProperty("property_" + String.valueOf(i) + ".MaxLength"); if (StringUtil.isInteger(maxLengthPropertyValue)) { specificColumnMaxLength = Integer.parseInt(maxLengthPropertyValue); } else { specificColumnMaxLength = DomainProperty.DEFAULT_MAX_LENGTH; } createStatement.append(specificColumnName); if ("BOOLEAN".equals(specificColumnType)) { createStatement.append(" int NOT NULL DEFAULT (0) "); } else { createStatement.append(" varchar(").append(specificColumnMaxLength).append(") NULL "); } if (i != numberOfColumns) { createStatement.append(", "); } } createStatement.append(")"); return createStatement.toString(); }
/** * Methode de recuperation des attachements et de copie des fichiers dans le dossier d'exportation * * @param pk - PrimaryKey de l'obijet dont on veut les attachments? * @param exportPath - Repertoire dans lequel copier les fichiers * @param relativeExportPath chemin relatif du fichier copie * @param extensionFilter * @return une liste des attachmentDetail trouves */ public List<AttachmentDetail> getAttachments( WAPrimaryKey pk, String exportPath, String relativeExportPath, String extensionFilter) { // Recuperation des attachments Collection<SimpleDocument> listAttachment = AttachmentServiceFactory.getAttachmentService().listDocumentsByForeignKey(pk, null); List<AttachmentDetail> listToReturn = new ArrayList<AttachmentDetail>(listAttachment.size()); if (!listAttachment.isEmpty()) { // Pour chaque attachment trouve, on copie le fichier dans le dossier // d'exportation for (SimpleDocument attachment : listAttachment) { if (attachment.getDocumentType() != DocumentType.attachment) { // ce n est pas un fichier joint mais un fichier appartenant surement // au wysiwyg si le context // est different de images et ce quelque soit le type du fichier continue; // on ne copie pas le fichier } if (!attachment.isDownloadAllowedForRolesFrom(user)) { // The user is not allowed to download this document. No error is thrown but the // document is not exported. continue; } if (extensionFilter == null || FileRepositoryManager.getFileExtension(attachment.getFilename()) .equalsIgnoreCase(extensionFilter)) { copyAttachment(attachment, exportPath); String physicalName = relativeExportPath + File.separator + FileServerUtils.replaceAccentChars(attachment.getFilename()); AttachmentDetail attachDetail = new AttachmentDetail( new AttachmentPK(attachment.getId(), attachment.getInstanceId()), physicalName, attachment.getFilename(), attachment.getDescription(), attachment.getContentType(), attachment.getSize(), attachment.getDocumentType().toString(), attachment.getCreated(), new ForeignPK(attachment.getForeignId(), attachment.getInstanceId())); listToReturn.add(attachDetail); } } } return listToReturn; }
/** * Méthode récursive purgeant le dossier Temporaire de silverpeas de tous les fichiers datés de * plus de nbJours. Tous les répertoires vides à l'issue de cette purge sont également effacés * * @param nbJour - nombre de jours limite pour la conservation d'un fichier */ public static void purgeTempDir(int nbJour) throws IOException { // Transformation de temps de conservation de fichier en millisecondes long age = System.currentTimeMillis() - (nbJour * 24 * 3600 * 1000); // Récupération du dossier Temp String pathTempDir = FileRepositoryManager.getTemporaryPath(); File dir = new File(pathTempDir); if (dir.exists()) { File[] files = dir.listFiles((FileFilter) new AgeFileFilter(age)); for (File file : files) { if (file.isFile()) { FileUtils.forceDelete(file); } } } }
/** * Uploads the file containing the video and that is identified by the specified field name. * * @param items the items of the form. One of them is containg the video file. * @param itemKey the key of the item containing the video. * @param pageContext the context of the page displaying the form. * @throws Exception if an error occurs while uploading the video file. * @return the identifier of the uploaded attached video file. */ private String uploadVideoFile( final List<FileItem> items, final String itemKey, final PagesContext pageContext) throws Exception { String attachmentId = ""; FileItem item = FileUploadUtil.getFile(items, itemKey); if (!item.isFormField()) { String componentId = pageContext.getComponentId(); String userId = pageContext.getUserId(); String objectId = pageContext.getObjectId(); String logicalName = item.getName(); long size = item.getSize(); if (StringUtil.isDefined(logicalName)) { if (!FileUtil.isWindows()) { logicalName = logicalName.replace('\\', File.separatorChar); SilverTrace.info( "form", "VideoFieldDisplayer.uploadVideoFile", "root.MSG_GEN_PARAM_VALUE", "fullFileName on Unix = " + logicalName); } logicalName = logicalName.substring( logicalName.lastIndexOf(File.separator) + 1, logicalName.length()); String type = FileRepositoryManager.getFileExtension(logicalName); String mimeType = item.getContentType(); String physicalName = Long.toString(System.currentTimeMillis()) + "." + type; File dir = getVideoPath(componentId, physicalName); item.write(dir); AttachmentDetail attachmentDetail = createAttachmentDetail( objectId, componentId, physicalName, logicalName, mimeType, size, VideoFieldDisplayer.CONTEXT_FORM_VIDEO, userId); attachmentDetail = AttachmentController.createAttachment(attachmentDetail, true); attachmentId = attachmentDetail.getPK().getId(); } } return attachmentId; }
/** * Retrieve Publication Templates * * @param onlyVisibles only visible templates boolean * @return only visible PublicationTemplates if onlyVisible is true, all the publication templates * else if * @throws PublicationTemplateException */ public List<PublicationTemplate> getPublicationTemplates(boolean onlyVisibles) throws PublicationTemplateException { List<PublicationTemplate> publicationTemplates = new ArrayList<PublicationTemplate>(); Collection<File> templateNames; try { templateNames = FileFolderManager.getAllFile(templateDir); } catch (UtilException e1) { throw new PublicationTemplateException( "PublicationTemplateManager.getPublicationTemplates", "form.EX_ERR_CASTOR_LOAD_PUBLICATION_TEMPLATES", e1); } for (File templateFile : templateNames) { String fileName = templateFile.getName(); try { String extension = FileRepositoryManager.getFileExtension(fileName); if ("xml".equalsIgnoreCase(extension)) { PublicationTemplate template = loadPublicationTemplate( fileName.substring(fileName.lastIndexOf(File.separator) + 1, fileName.length())); if (onlyVisibles) { if (template.isVisible()) { publicationTemplates.add(template); } } else { publicationTemplates.add(template); } } } catch (Exception e) { SilverTrace.error( "form", "PublicationTemplateManager.getPublicationTemplates", "form.EX_ERR_CASTOR_LOAD_PUBLICATION_TEMPLATE", "fileName = " + fileName); } } return publicationTemplates; }
public ExportReport export(ResourcesWrapper resource) throws QuestionReplyException, ParseException { StringBuilder sb = new StringBuilder("exportFAQ"); Date date = new Date(); SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd-HH'H'mm'm'ss's'"); String dateFormatee = dateFormat.format(date); sb.append("_").append(dateFormatee); sb.append("_").append(getUserDetail().getId()); ExportReport exportReport = new ExportReport(); // Stockage de la date de démarage de l'export dans l'objet rapport exportReport.setDateDebut(new Date()); String thisExportDir = sb.toString(); // Création du dossier d'export exportFAQ_aaaa-mm-jj-hhHmmmsss_userId.zip String tempDir = FileRepositoryManager.getTemporaryPath(); File fileExportDir = new File(tempDir + thisExportDir); if (!fileExportDir.exists()) { try { FileFolderManager.createFolder(fileExportDir); } catch (UtilException ex) { throw new QuestionReplyException( "QuestionReplySessionController.export()", SilverpeasRuntimeException.ERROR, "root.MSG_FOLDER_NOT_CREATE", ex); } } // création du dossier "files" String dir = tempDir + thisExportDir; String nameForFiles = "files"; File forFiles = new File(dir + File.separator + nameForFiles); try { FileFolderManager.createFolder(forFiles); } catch (UtilException ex) { throw new QuestionReplyException( "QuestionReplySessionController.export()", SilverpeasRuntimeException.ERROR, "root.MSG_FOLDER_NOT_CREATE", ex); } // intégrer la css du disque dans "files" ResourceLocator settings = new ResourceLocator("com.silverpeas.questionReply.settings.questionReplySettings", ""); try { String chemin = (settings.getString("mappingDir")); if (chemin.startsWith("file:")) { chemin = chemin.substring(8); } Collection<File> files = FileFolderManager.getAllFile(chemin); for (File file : files) { File newFile = new File(dir + File.separator + nameForFiles + File.separator + file.getName()); FileRepositoryManager.copyFile(file.getPath(), newFile.getPath()); } } catch (Exception ex) { throw new QuestionReplyException( "QuestionReplySessionController.export()", SilverpeasRuntimeException.ERROR, "QuestionReply.EX_CANT_COPY_FILE", ex); } // création du fichier html File fileHTML = new File(dir + File.separator + thisExportDir + ".html"); FileWriter fileWriter = null; try { fileHTML.createNewFile(); fileWriter = new FileWriter(fileHTML.getPath()); fileWriter.write(toHTML(fileHTML, resource)); } catch (IOException ex) { throw new QuestionReplyException( "QuestionReplySessioncontroller.export()", SilverpeasRuntimeException.ERROR, "QuestionReply.MSG_CAN_WRITE_FILE", ex); } finally { try { fileWriter.close(); } catch (Exception ex) { } } // Création du zip try { String zipFileName = fileExportDir.getName() + ".zip"; long zipFileSize = ZipManager.compressPathToZip(fileExportDir.getPath(), tempDir + zipFileName); exportReport.setZipFileName(zipFileName); exportReport.setZipFileSize(zipFileSize); exportReport.setZipFilePath(FileServerUtils.getUrlToTempDir(zipFileName)); } catch (Exception ex) { throw new QuestionReplyException( "QuestionReplySessioncontroller.export()", SilverpeasRuntimeException.ERROR, "QuestionReply.MSG_CAN_CREATE_ZIP", ex); } // Stockage de la date de fin de l'export dans l'objet rapport exportReport.setDateFin(new Date()); return exportReport; }
public FileFolder(String rootPath, String path, boolean isAdmin, String componentId) { files = new ArrayList(0); folders = new ArrayList(0); String childPath = null; try { SilverTrace.debug( "silverCrawler", "FileFolder.FileFolder()", "root.MSG_GEN_PARAM_VALUE", "Starting constructor for FileFolder. Path = " + path); File f = new File(path); File fChild; SilverTrace.debug( "silverCrawler", "FileFolder.FileFolder()", "root.MSG_GEN_PARAM_VALUE", "isExists " + f.exists() + " isFile=" + f.isFile()); if (f.exists()) { this.name = f.getName(); String[] children_name = f.list(); IndexReader reader = null; boolean isIndexed = false; if (isAdmin) { // ouverture de l'index String indexPath = FileRepositoryManager.getAbsoluteIndexPath("", componentId); if (IndexReader.indexExists(indexPath)) reader = IndexReader.open(indexPath); } for (int i = 0; children_name != null && i < children_name.length; i++) { SilverTrace.debug( "silverCrawler", "FileFolder.FileFolder()", "root.MSG_GEN_PARAM_VALUE", "Name = " + children_name[i]); fChild = new File(path + File.separator + children_name[i]); isIndexed = false; if (isAdmin) { // rechercher si le répertoire (ou le fichier) est indexé String pathIndex = componentId + "|"; if (fChild.isDirectory()) pathIndex = pathIndex + "LinkedDir" + "|"; else pathIndex = pathIndex + "LinkedFile" + "|"; pathIndex = pathIndex + fChild.getPath(); SilverTrace.debug( "silverCrawler", "FileFolder.FileFolder()", "root.MSG_GEN_PARAM_VALUE", "pathIndex = " + pathIndex); Term term = new Term("key", pathIndex); if (reader != null && reader.docFreq(term) == 1) isIndexed = true; } if (fChild.isDirectory()) { folders.add( new FileDetail( fChild.getName(), fChild.getPath(), fChild.length(), true, isIndexed)); } else { childPath = fChild.getPath().substring(rootPath.length() + 1); files.add( new FileDetail(fChild.getName(), childPath, fChild.length(), false, isIndexed)); } } // fermeture de l'index if (reader != null && isAdmin) reader.close(); } } catch (Exception e) { throw new SilverCrawlerRuntimeException( "FileFolder.FileFolder()", SilverpeasRuntimeException.ERROR, "silverCrawler.IMPOSSIBLE_DACCEDER_AU_REPERTOIRE", e); } }
public String getDisplaySize() { return FileRepositoryManager.formatFileSize(getSize()); }
/** * Method declaration * * @param req * @param res * @throws IOException * @throws ServletException * @see */ @Override public void doPost(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException { SilverTrace.info("peasUtil", "FileServer.doPost", "root.MSG_GEN_ENTER_METHOD"); String mimeType = req.getParameter(MIME_TYPE_PARAMETER); String sourceFile = req.getParameter(SOURCE_FILE_PARAMETER); String archiveIt = req.getParameter(ARCHIVE_IT_PARAMETER); String dirType = req.getParameter(DIR_TYPE_PARAMETER); String userId = req.getParameter(USER_ID_PARAMETER); String componentId = req.getParameter(COMPONENT_ID_PARAMETER); String typeUpload = req.getParameter(TYPE_UPLOAD_PARAMETER); String zip = req.getParameter(ZIP_PARAMETER); String fileName = req.getParameter(FILE_NAME_PARAMETER); String tempDirectory = FileRepositoryManager.getTemporaryPath("useless", componentId); File tempFile = null; String attachmentId = req.getParameter(ATTACHMENT_ID_PARAMETER); String language = req.getParameter(LANGUAGE_PARAMETER); if (!StringUtil.isDefined(attachmentId)) { attachmentId = req.getParameter(VERSION_ID_PARAMETER); } SimpleDocument attachment = null; if (StringUtil.isDefined(attachmentId)) { attachment = AttachmentServiceFactory.getAttachmentService() .searchDocumentById(new SimpleDocumentPK(attachmentId, componentId), language); if (attachment != null) { mimeType = attachment.getContentType(); sourceFile = attachment.getFilename(); } } HttpSession session = req.getSession(true); MainSessionController mainSessionCtrl = (MainSessionController) session.getAttribute(MainSessionController.MAIN_SESSION_CONTROLLER_ATT); if ((mainSessionCtrl == null) || (!isUserAllowed(mainSessionCtrl, componentId))) { SilverTrace.warn( "peasUtil", "FileServer.doPost", "root.MSG_GEN_SESSION_TIMEOUT", "NewSessionId=" + session.getId() + URLManager.getApplicationURL() + GeneralPropertiesManager.getString("sessionTimeout")); res.sendRedirect( URLManager.getApplicationURL() + GeneralPropertiesManager.getString("sessionTimeout")); return; } String filePath = null; if (typeUpload != null) { filePath = sourceFile; } else { if (dirType != null) { if (dirType.equals(GeneralPropertiesManager.getString("RepositoryTypeTemp"))) { filePath = FileRepositoryManager.getTemporaryPath("useless", componentId) + sourceFile; } } else if (attachment != null) { // the file to download is not in a temporary directory filePath = attachment.getAttachmentPath(); } else { String directory = req.getParameter(DIRECTORY_PARAMETER); filePath = FileRepositoryManager.getAbsolutePath(componentId) + directory + File.separator + sourceFile; } } res.setContentType(mimeType); SilverTrace.debug("peasUtil", "FileServer.doPost()", "root.MSG_GEN_PARAM_VALUE", " zip=" + zip); if (zip != null) { res.setContentType(MimeTypes.ARCHIVE_MIME_TYPE); tempFile = File.createTempFile("zipfile", ".zip", new File(tempDirectory)); SilverTrace.debug( "peasUtil", "FileServer.doPost()", "root.MSG_GEN_PARAM_VALUE", " filePath =" + filePath + " tempFile.getCanonicalPath()=" + tempFile.getCanonicalPath() + " fileName=" + fileName); ZipManager.compressFile(filePath, tempFile.getCanonicalPath()); filePath = tempFile.getCanonicalPath(); } // display the preview code generated by the production tools if (zip == null) { if (tempFile != null) { sendFile(res, tempFile.getCanonicalPath()); } else { sendFile(res, filePath); } } if (tempFile != null) { SilverTrace.info( "peasUtil", "FileServer.doPost()", "root.MSG_GEN_ENTER_METHOD", " tempFile != null " + tempFile); FileUtils.deleteQuietly(tempFile); } if (StringUtil.isDefined(archiveIt)) { String nodeId = req.getParameter(NODE_ID_PARAMETER); String pubId = req.getParameter(PUBLICATION_ID_PARAMETER); ForeignPK pubPK = new ForeignPK(pubId, componentId); try { StatisticBm statisticBm = EJBUtilitaire.getEJBObjectRef(JNDINames.STATISTICBM_EJBHOME, StatisticBm.class); statisticBm.addStat(userId, pubPK, 1, "Publication"); } catch (Exception ex) { SilverTrace.warn( "peasUtil", "FileServer.doPost", "peasUtil.CANNOT_WRITE_STATISTICS", "pubPK = " + pubPK + " and nodeId = " + nodeId, ex); } } }
public String getAttachmentsSizeToDisplay() { return FileRepositoryManager.formatFileSize(getAttachmentsSize()); }
public String getSpaceBasePath(String spaceId) { return FileRepositoryManager.getAbsolutePath("Space" + spaceId, new String[] {"look"}); }