Пример #1
0
  private void initDefaultWorkspace() {
    final String defaultState = getProperties().getWorkspaceDefaultState();
    final String wn = getProperties().getJcrDefaultWorkspace();
    final SitePlugin sp = SitePlugin.get(brix);

    if (!sp.siteExists(wn, defaultState)) {
      Workspace w = sp.createSite(wn, defaultState);
      JcrSession session = brix.getCurrentSession(w.getId());

      session.importXML(
          "/", getWorkspaceXml(), ImportUUIDBehavior.IMPORT_UUID_COLLISION_REPLACE_EXISTING);

      brix.initWorkspace(w, session);
      session.save();
    }
  }
Пример #2
0
  public void setTemplatePath(String path) {
    if (path == null) {
      setTemplate(null);
    } else {
      BrixNode node = (BrixNode) SitePlugin.get().nodeForPath(this, path);

      if (node == null) {
        throw new NodeNotFoundException("No node found on path '" + path + "'.");
      }

      setTemplate((BrixNode) node);
    }
  }
Пример #3
0
  public Collection<String> getTileIDs() {
    Set<String> keys = new HashSet<String>();
    PageMarkupSource source = new PageMarkupSource(this);
    Item i = source.nextMarkupItem();
    while (i != null) {
      if (i instanceof TileTag) {
        keys.add(((TileTag) i).getTileName());
      }
      i = source.nextMarkupItem();
    }

    keys.addAll(SitePlugin.get().getGlobalTileIDs(getSession()));

    return keys;
  }
Пример #4
0
 public BrixNode getTileNode(String id) {
   BrixNode node = null;
   AbstractContainer container = this;
   while (node == null && container != null) {
     node = container.tiles().getTile(id);
     container = container.getTemplate();
   }
   if (node == null) {
     container = SitePlugin.get().getGlobalContainer(getSession());
     if (container != null) {
       node = container.tiles().getTile(id);
     }
   }
   return node;
 }
Пример #5
0
 public String getVariableValue(String key, boolean followTemplate) {
   if (hasNode(VARIABLES_NODE_NAME)) {
     JcrNode node = getNode(VARIABLES_NODE_NAME);
     if (node.hasProperty(key)) {
       return node.getProperty(key).getString();
     }
   }
   if (followTemplate) {
     TemplateNode template = getTemplate();
     if (template != null) {
       return template.getVariableValue(key);
     } else {
       return SitePlugin.get().getGlobalVariableValue(getSession(), key);
     }
   }
   return null;
 }
Пример #6
0
  /** Returns collection of possible variable keys for this node. */
  public Collection<String> getVariableKeys() {
    Set<String> keys = new HashSet<String>();
    PageMarkupSource source = new PageMarkupSource(this);
    VariableTransformer transfomer = new VariableTransformer(source, this);
    Item i = transfomer.nextMarkupItem();
    while (i != null) {
      if (i instanceof VariableKeyProvider) {
        Collection<String> k = ((VariableKeyProvider) i).getVariableKeys();
        if (k != null) {
          keys.addAll(k);
        }
      }
      i = transfomer.nextMarkupItem();
    }

    keys.addAll(SitePlugin.get().getGlobalVariableKeys(getSession()));

    return keys;
  }
Пример #7
0
 public String getTemplatePath() {
   BrixNode template = getTemplate();
   return template != null ? SitePlugin.get().pathForNode(template) : null;
 }
Пример #8
0
 public AbstractSitePagePlugin getNodePlugin() {
   return (AbstractSitePagePlugin) SitePlugin.get().getNodePluginForNode(this);
 }