/** * Get CMS item type. * * @param type document type name * @return CMS item type */ private DocumentType getType(String type) { // CMS customizer INuxeoCustomizer cmsCustomizer = this.nuxeoService.getCMSCustomizer(); // CMS item types Map<String, DocumentType> types = cmsCustomizer.getDocumentTypes(); return types.get(type); }
/** * Get forms service. * * @return forms service */ public static IFormsService getFormsService() { INuxeoService nuxeoService = getNuxeoService(); return nuxeoService.getFormsService(); }
/** * Get tag service. * * @return tag service */ public static INuxeoTagService getTagService() { INuxeoService nuxeoService = getNuxeoService(); return nuxeoService.getTagService(); }
/** * Start nuxeo command service. * * @param ctx the ctx * @throws Exception the exception */ public static void startNuxeoCommandService(PortletContext ctx) throws Exception { INuxeoService nuxeoService = (INuxeoService)ctx.getAttribute("NuxeoService"); INuxeoCommandService nuxeoCommandService = nuxeoService.startNuxeoCommandService(ctx); ctx.setAttribute("nuxeoCommandService", nuxeoCommandService); }
/** * Constructor. * * @param portletContext portlet context */ public PluginModule(PortletContext portletContext) { super(); this.classLoader = Thread.currentThread().getContextClassLoader(); this.portletContext = portletContext; // Nuxeo service this.nuxeoService = Locator.findMBean(INuxeoService.class, INuxeoService.MBEAN_NAME); // Nuxeo customizer this.nuxeoCustomizer = this.nuxeoService.getCMSCustomizer(); }
@Override public void sendIntegrityAlert(PortalControllerContext pcc) { NuxeoController nuxeoController = new NuxeoController(pcc.getPortletCtx()); IFormsService formsService = nuxeoController.getNuxeoCMSService().getFormsService(); Map<String, String> variables = new HashMap<>(); try { formsService.start(pcc, LDAP_INTEGRITY_MODEL_WEBID, variables); } catch (PortalException | FormFilterException e) { logger_integrity.error("Unable to send notification", e); } }
/** * Get the user avatar (acceded from portlets). * * @param username * @return a link to the avatar * @throws CMSException */ public Link getUserAvatar(String username) throws CMSException { return getNuxeoCMSService().getCMSCustomizer().getUserAvatar(username); }
/** * Get CMS item types. * * @return CMS item types */ public Map<String, DocumentType> getCMSItemTypes() { INuxeoService nuxeoService = this.getNuxeoCMSService(); return nuxeoService.getCMSCustomizer().getCMSItemTypes(); }
public Link getLinkFromNuxeoURL(String url, String displayContext) { // Nuxeo service INuxeoService nuxeoService = this.getNuxeoCMSService(); // Nuxeo customizer INuxeoCustomizer nuxeoCustomizer = nuxeoService.getCMSCustomizer(); // Customizer call return nuxeoCustomizer.getLinkFromNuxeoURL(this.getCMSCtx(), url, displayContext); }
/** * Gets the content web id path ( like /_id/domain-def-jss/publistatfaq.html) * * if no webId is defined, returns original path * * @return the content web id path */ public String getContentWebIdPath() { INuxeoService nuxeoService = this.getNuxeoCMSService(); String path = nuxeoService.getCMSCustomizer().getContentWebIdPath(this.getCMSCtx()); return path; }
/** * Get Nuxeo comments service instance. * * @return Nuxeo comments service instance */ public INuxeoCommentsService getNuxeoCommentsService() { try { INuxeoService nuxeoService = this.getNuxeoCMSService(); return nuxeoService.getCMSCustomizer().getNuxeoCommentsService(); } catch (Exception e) { throw this.wrapNuxeoException(e); } }
/** * Adds the search filter. * * @param queryCtx the query ctx * @param nuxeoRequest the nuxeo request * @return the string */ public static String addSearchFilter(NuxeoQueryFilterContext queryCtx,String nuxeoRequest) { // adapt thanks to CMSCustomizer INuxeoService nuxeoService = Locator.findMBean(INuxeoService.class, "osivia:service=NuxeoService"); CMSServiceCtx ctx = getCMSCtx(); try { return nuxeoService.getCMSCustomizer().addSearchFilter(ctx, nuxeoRequest, queryCtx.getPolicy()); } catch (Exception e) { throw new RuntimeException(e); } }
/** * Get Nuxeo document comments HTML formatted content. * * @return comments HTML formatted content * @throws CMSException the CMS exception * @deprecated unused ? */ @Deprecated public String getCommentsHTMLContent() throws CMSException { try { CMSServiceCtx cmsContext = this.getCMSCtx(); INuxeoService nuxeoService = this.getNuxeoCMSService(); return nuxeoService.getCMSCustomizer().getCommentsHTMLContent(cmsContext, this.currentDoc); } catch (Exception e) { throw this.wrapNuxeoException(e); } }
/** * Insert content menubar items. * * @throws Exception the exception */ public void insertContentMenuBarItems() { try { INuxeoService nuxeoService = this.getNuxeoCMSService(); nuxeoService.getCMSCustomizer().formatContentMenuBar(this.getCMSCtx()); } catch (Exception e) { throw this.wrapNuxeoException(e); } }
/** * Transform Nuxeo link URL * * @param link Nuxeo link URL * @return transformed Nuxeo link URL */ public String transformNuxeoLink(String link) { try { INuxeoService nuxeoService = this.getNuxeoCMSService(); return nuxeoService.getCMSCustomizer().transformLink(this.getCMSCtx(), link); } catch (Exception e) { throw this.wrapNuxeoException(e); } }
/** * Adds the publication filter. * * @param queryCtx the query ctx * @param nuxeoRequest the nuxeo request * @return the string */ public static String addPublicationFilter(NuxeoQueryFilterContext queryCtx,String nuxeoRequest) { // adapt thanks to CMSCustomizer INuxeoService nuxeoService = Locator.findMBean(INuxeoService.class, "osivia:service=NuxeoService"); CMSServiceCtx ctx = getCMSCtx(); String state = String.valueOf(queryCtx.getState()); ctx.setDisplayLiveVersion(state); try { return nuxeoService.getCMSCustomizer().addPublicationFilter(ctx, nuxeoRequest, queryCtx.getPolicy()); } catch (Exception e) { throw new RuntimeException(e); } }
INuxeoCustomizer cmsCustomizer = nuxeoService.getCMSCustomizer();
/** * Transform html content from nuxeo (note:note) * * @param htmlContent the html content * @return the string * @throws Exception the exception */ public String transformHTMLContent(String htmlContent) { try { INuxeoService nuxeoService = this.getNuxeoCMSService(); return nuxeoService.getCMSCustomizer().transformHTMLContent(this.getCMSCtx(), htmlContent); } catch (Exception e) { throw this.wrapNuxeoException(e); } }
/** * Get icon from mime type. * * @param mimeType mime type * @return icon, may be null */ public String getIcon(MimeType mimeType) { // CMS customizer INuxeoCustomizer cmsCustomizer = this.nuxeoService.getCMSCustomizer(); // Icon String icon; if (mimeType == null) { icon = null; } else { // File document types List<FileDocumentType> types = cmsCustomizer.getFileDocumentTypes(); icon = null; for (FileDocumentType type : types) { if (StringUtils.equals(mimeType.getPrimaryType(), type.getMimePrimaryType())) { if (type.getMimeSubTypes().isEmpty()) { icon = type.getIcon(); } else if (type.getMimeSubTypes().contains(mimeType.getSubType())) { icon = type.getIcon(); break; } } } } return icon; }
/** * Get avatar url for a person * * @param person the person */ @SuppressWarnings("deprecation") protected void appendAvatar(Person person) { // Append avatar INuxeoService nuxeoService = Locator.findMBean(INuxeoService.class, INuxeoService.MBEAN_NAME); INuxeoCustomizer cmsCustomizer = nuxeoService.getCMSCustomizer(); Link userAvatar = new Link("", false); try { userAvatar = cmsCustomizer.getUserAvatar(null, person.getUid()); } catch (CMSException e) { } person.setAvatar(userAvatar); }