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();
 }
 private void addTemplate(TemplateConfig tempObject, Session session, String warViewPath)
     throws Exception {
   String type = tempObject.getTemplateType();
   String alias = "";
   if (type.equals(ECM_EXPLORER_TEMPLATE)) {
     alias = BasePath.ECM_EXPLORER_TEMPLATES;
   }
   String templateHomePath = nodeHierarchyCreator_.getJcrPath(alias);
   Node templateHomeNode = (Node) session.getItem(templateHomePath);
   String templateName = tempObject.getName();
   if (templateHomeNode.hasNode(templateName)
       || Utils.getAllEditedConfiguredData(
               this.getClass().getSimpleName(), EDITED_CONFIGURED_VIEWS_TEMPLATES, true)
           .contains(templateName)) return;
   String warPath = warViewPath + tempObject.getWarPath();
   InputStream in = cservice_.getInputStream(warPath);
   templateService.createTemplate(
       templateHomeNode, templateName, templateName, in, new String[] {"*"});
   configuredTemplate_.add(templateName);
   Utils.addEditedConfiguredData(
       templateName, this.getClass().getSimpleName(), EDITED_CONFIGURED_VIEWS_TEMPLATES, true);
 }
Example #3
0
 public static List<String> getMemberships() throws Exception {
   return org.exoplatform.services.cms.impl.Utils.getMemberships();
 }
Example #4
0
 public static String getNodeTypeIcon(Node node, String appended) throws RepositoryException {
   return org.exoplatform.services.cms.impl.Utils.getNodeTypeIcon(node, appended);
 }