/**
  * Gets the based application templates home.
  *
  * @param sessionProvider SessionProvider
  * @param repository String The name of repository
  * @return the based application templates home
  * @see SessionProvider
  * @throws Exception the exception
  */
 private Node getBasedApplicationTemplatesHome(SessionProvider sessionProvider) throws Exception {
   DMSRepositoryConfiguration dmsRepoConfig = dmsConfiguration_.getConfig();
   ManageableRepository manageableRepository = repositoryService.getCurrentRepository();
   Session session =
       sessionProvider.getSession(dmsRepoConfig.getSystemWorkspace(), manageableRepository);
   Node basedTemplateHome = (Node) session.getItem(basedApplicationTemplatesPath);
   return basedTemplateHome;
 }
Ejemplo n.º 2
0
 private void importPredefineViews() throws Exception {
   configuredTemplate_ = new HashSet<String>();
   configuredViews_ = new HashSet<String>();
   Iterator<ObjectParameter> it = params_.getObjectParamIterator();
   String viewsPath = nodeHierarchyCreator_.getJcrPath(BasePath.CMS_VIEWS_PATH);
   String templatesPath = nodeHierarchyCreator_.getJcrPath(BasePath.CMS_VIEWTEMPLATES_PATH);
   String warViewPath =
       predefinedViewsLocation_
           + templatesPath.substring(templatesPath.lastIndexOf("exo:ecm") + 7);
   ManageableRepository manageableRepository = repositoryService_.getCurrentRepository();
   DMSRepositoryConfiguration dmsRepoConfig = dmsConfiguration_.getConfig();
   Session session = manageableRepository.getSystemSession(dmsRepoConfig.getSystemWorkspace());
   ViewConfig viewObject = null;
   TemplateConfig templateObject = null;
   Node viewHomeNode = (Node) session.getItem(viewsPath);
   while (it.hasNext()) {
     Object object = it.next().getObject();
     if (object instanceof ViewConfig) {
       viewObject = (ViewConfig) object;
       String viewNodeName = viewObject.getName();
       configuredViews_.add(viewNodeName);
       if (viewHomeNode.hasNode(viewNodeName)
           || Utils.getAllEditedConfiguredData(
                   this.getClass().getSimpleName(), EDITED_CONFIGURED_VIEWS, true)
               .contains(viewNodeName)) continue;
       Node viewNode =
           addView(
               viewHomeNode,
               viewNodeName,
               viewObject.getPermissions(),
               viewObject.isHideExplorerPanel(),
               viewObject.getTemplate());
       Utils.addEditedConfiguredData(
           viewNodeName, this.getClass().getSimpleName(), EDITED_CONFIGURED_VIEWS, true);
       for (Tab tab : viewObject.getTabList()) {
         addTab(viewNode, tab.getTabName(), tab.getButtons());
       }
     } else if (object instanceof TemplateConfig) {
       templateObject = (TemplateConfig) object;
       addTemplate(templateObject, session, warViewPath);
     }
   }
   session.save();
   session.logout();
 }