private PublicationBm findPublicationBm() { if (publicationBm == null) { publicationBm = EJBUtilitaire.getEJBObjectRef(JNDINames.PUBLICATIONBM_EJBHOME, PublicationBm.class); } return publicationBm; }
@Override public ShareableResource<NodeDetail> getResource() { NodeBm nodeBm = EJBUtilitaire.getEJBObjectRef(JNDINames.NODEBM_EJBHOME, NodeBm.class); NodeDetail node = nodeBm.getDetail(new NodePK(String.valueOf(getSharedObjectId()), getComponentId())); if (node != null) { return new ShareableNode(getToken(), node); } return null; }
private ForumsBM getForumsBM() { try { return EJBUtilitaire.getEJBObjectRef(JNDINames.FORUMSBM_EJBHOME, ForumsBM.class); } catch (Exception e) { throw new ForumsRuntimeException( "RssServlet.getForumsBM()", SilverpeasRuntimeException.ERROR, "root.EX_CANT_GET_REMOTE_OBJECT", e); } }
private FormTemplateBm getFormTemplateBm() { try { return EJBUtilitaire.getEJBObjectRef(JNDINames.FORMTEMPLATEBM_EJBHOME, FormTemplateBm.class); } catch (Exception e) { throw new PublicationRuntimeException( "PublicationDetail.getFormTemplateBm()", SilverpeasRuntimeException.ERROR, "publication.EX_IMPOSSIBLE_DE_FABRIQUER_FORMTEMPLATEBM_HOME", e); } }
/** Method initEJB initializes EJB */ private void initEJB() { if (icEjb == null) { try { icEjb = EJBUtilitaire.getEJBObjectRef( JNDINames.INTEREST_CENTER_EJBHOME, InterestCenterBm.class); } catch (Exception e) { throw new InterestCenterRuntimeException( "InterestCenterSessionController.initEJB()", "", "root.EX_CANT_GET_REMOTE_OBJECT", e); } } }
private QuestionContainerBm getQuestionContainerBm() { QuestionContainerBm currentQuestionContainerBm = null; try { QuestionContainerBmHome questionContainerBmHome = (QuestionContainerBmHome) EJBUtilitaire.getEJBObjectRef( JNDINames.QUESTIONCONTAINERBM_EJBHOME, QuestionContainerBmHome.class); currentQuestionContainerBm = questionContainerBmHome.create(); } catch (Exception e) { displayError(null); } return currentQuestionContainerBm; }
public static ResourcesManagerBm getResourcesManagerBm() { try { ResourcesManagerBmHome resourceManagerBmHome = EJBUtilitaire.getEJBObjectRef("ejb/ResourcesManagerBm", ResourcesManagerBmHome.class); return resourceManagerBmHome.create(); } catch (Exception e) { throw new ResourcesManagerRuntimeException( "ResourcesManagerSessionController.getResourceManagerBm()", SilverpeasRuntimeException.ERROR, "root.EX_CANT_GET_REMOTE_OBJECT", e); } }
public VersioningBm getVersioningBm() throws WorkflowException { VersioningBm versioningBm = null; try { VersioningBmHome versioningBmHome = (VersioningBmHome) EJBUtilitaire.getEJBObjectRef(JNDINames.VERSIONING_EJBHOME, VersioningBmHome.class); versioningBm = versioningBmHome.create(); } catch (Exception e) { throw new WorkflowException( "ProcessInstanceManagerImpl.getVersioningBm()", "root.EX_CANT_GET_REMOTE_OBJECT", e); } return versioningBm; }
private void initEJB() { try { calendarBm = ((CalendarBmHome) EJBUtilitaire.getEJBObjectRef(JNDINames.CALENDARBM_EJBHOME, CalendarBmHome.class)) .create(); } catch (Exception e) { new TodoException( "ToDoSessionControl.ToDoSessionControl()", SilverpeasException.ERROR, "root.EX_CANT_GET_REMOTE_OBJECT", e); } }
/** * Method declaration * * @see */ private void setCalendarBm() { if (calendarBm == null) { try { calendarBm = EJBUtilitaire.getEJBObjectRef(JNDINames.CALENDARBM_EJBHOME, SilverpeasCalendar.class); } catch (Exception e) { throw new AgendaRuntimeException( "ImportIcalManager.setCalendarBm()", SilverpeasException.ERROR, "root.EX_CANT_GET_REMOTE_OBJECT", e); } } }
private QuestionContainerBm getQuestionBm() { if (questionContainerBm == null) { try { QuestionContainerBmHome questionContainerBmHome = (QuestionContainerBmHome) EJBUtilitaire.getEJBObjectRef( JNDINames.QUESTIONCONTAINERBM_EJBHOME, QuestionContainerBmHome.class); this.questionContainerBm = questionContainerBmHome.create(); } catch (Exception e) { throw new EJBException(e.getMessage()); } } return questionContainerBm; }
public PublicationBm getPublicationBm() { if (publicationBm == null) { try { publicationBm = EJBUtilitaire.getEJBObjectRef(JNDINames.PUBLICATIONBM_EJBHOME, PublicationBm.class); } catch (Exception e) { throw new PublicationRuntimeException( "PublicationDetail.getPublicationBm()", SilverpeasRuntimeException.ERROR, "publication.EX_IMPOSSIBLE_DE_FABRIQUER_PUBLICATIONBM_HOME", e); } } return publicationBm; }
private NodeBm getNodeBm() throws QuestionReplyException { NodeBm nodeBm = null; try { NodeBmHome nodeBmHome = (NodeBmHome) EJBUtilitaire.getEJBObjectRef(JNDINames.NODEBM_EJBHOME, NodeBmHome.class); nodeBm = nodeBmHome.create(); } catch (Exception e) { throw new QuestionReplyException( "QuestionReplySessioncontroller.getNodeBm()", SilverpeasRuntimeException.ERROR, "QuestionReply.MSG_NODEBM_NOT_EXIST", e); } return nodeBm; }
private GalleryBm getGalleryBm() { if (currentGalleryBm == null) { try { GalleryBmHome GalleryBmHome = EJBUtilitaire.getEJBObjectRef(JNDINames.GALLERYBM_EJBHOME, GalleryBmHome.class); currentGalleryBm = GalleryBmHome.create(); } catch (Exception e) { throw new GalleryRuntimeException( "GalleryContentManager.getGalleryBm()", SilverpeasRuntimeException.ERROR, "gallery.EX_IMPOSSIBLE_DE_FABRIQUER_GALLERYBM_HOME", e); } } return currentGalleryBm; }
private PublicationBm getPublicationBm() { if (currentPublicationBm == null) { try { PublicationBmHome publicationBmHome = EJBUtilitaire.getEJBObjectRef(JNDINames.PUBLICATIONBM_EJBHOME, PublicationBmHome.class); currentPublicationBm = publicationBmHome.create(); } catch (Exception e) { throw new KmeliaRuntimeException( "KmeliaContentManager.getPublicationBm()", SilverpeasRuntimeException.ERROR, "kmelia.EX_IMPOSSIBLE_DE_FABRIQUER_PUBLICATIONBM_HOME", e); } } return currentPublicationBm; }
private synchronized CalendarBm getCalendarBm() { if (calendarBm == null) { try { calendarBm = EJBUtilitaire.getEJBObjectRef(JNDINames.CALENDARBM_EJBHOME, CalendarBmHome.class) .create(); } catch (Exception e) { throw new CalendarRuntimeException( "TodoBackboneAcessB.getCalendarBm()", SilverpeasException.ERROR, "root.EX_CANT_GET_REMOTE_OBJECT", e); } } return calendarBm; }
private ForumsBM getForumsBM() { ForumsBM forumsBM = null; try { ForumsBMHome forumsBMHome = (ForumsBMHome) EJBUtilitaire.getEJBObjectRef(JNDINames.FORUMSBM_EJBHOME, ForumsBMHome.class); forumsBM = forumsBMHome.create(); } catch (Exception e) { throw new ForumsRuntimeException( "RssServlet.getForumsBM()", SilverpeasRuntimeException.ERROR, "root.EX_CANT_GET_REMOTE_OBJECT", e); } return forumsBM; }
private PublicationBm getPublicationBm() { if (publicationBm == null) { try { publicationBm = EJBUtilitaire.getEJBObjectRef(JNDINames.PUBLICATIONBM_EJBHOME, PublicationBm.class); } catch (Exception e) { SilverTrace.error( "quickinfo", "QuickInfoTransversalSC.getPublicationBm()", "root.MSG_EJB_CREATE_FAILED", JNDINames.PUBLICATIONBM_EJBHOME, e); throw new EJBException(e); } } return publicationBm; }
/** * Method declaration * * @return * @see */ private PublicationBm getPublicationBm() { if (publicationBm == null) { try { publicationBm = ((PublicationBmHome) EJBUtilitaire.getEJBObjectRef( JNDINames.PUBLICATIONBM_EJBHOME, PublicationBmHome.class)) .create(); } catch (Exception e) { SilverTrace.error( "kmax", "KmaxStatistics.getPublicationBm", "root.MSG_EJB_CREATE_FAILED", JNDINames.PUBLICATIONBM_EJBHOME, e); throw new EJBException(e); } } return publicationBm; }
private NodeBm findNodeBm() { if (nodeBm == null) { nodeBm = EJBUtilitaire.getEJBObjectRef(JNDINames.NODEBM_EJBHOME, NodeBm.class); } return nodeBm; }
/** Returns the access path of the object. */ private String getPath(String componentId, String nodeId, String language) { String path = ""; // Space > SubSpace if (componentId != null && !"useless".equals(componentId)) { List<SpaceInst> listSpaces = organizationController.getSpacePathToComponent(componentId); for (SpaceInst space : listSpaces) { path += space.getName(language) + " > "; } // Service path += organizationController.getComponentInstLight(componentId).getLabel(language); // Theme > SubTheme String pathString = ""; if (nodeId != null) { NodeBm nodeBm = null; try { NodeBmHome nodeBmHome = EJBUtilitaire.getEJBObjectRef(JNDINames.NODEBM_EJBHOME, NodeBmHome.class); nodeBm = nodeBmHome.create(); } catch (Exception e) { SilverTrace.error( "form", "ExplorerFieldDisplayer.display", "form.EX_CANT_CREATE_NODEBM_HOME", e); } if (nodeBm != null) { NodePK nodePk = new NodePK(nodeId, componentId); Collection<NodeDetail> listPath = null; try { listPath = nodeBm.getPath(nodePk); } catch (RemoteException e) { SilverTrace.error( "form", "ExplorerFieldDisplayer.display", "form.EX_CANT_GET_PATH_NODE", nodeId); } if (listPath != null) { Collections.reverse((List<NodeDetail>) listPath); String nodeName; for (NodeDetail nodeInPath : listPath) { if (!nodeInPath.getNodePK().getId().equals("0")) { if (language != null) { nodeName = nodeInPath.getName(language); } else { nodeName = nodeInPath.getName(); } pathString += nodeName + " > "; } } if (StringUtil.isDefined(pathString)) { pathString = pathString.substring(0, pathString.length() - 3); // remove last '>' } } } } if (pathString.length() > 0) { path += " > " + pathString; } } return path; }
/** * 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); } } }