Пример #1
0
 protected RepositoryFile getTopFolder() {
   RepositoryFile topFolder = parent;
   if (topFolder == null) {
     return this;
   }
   while (!topFolder.isRoot()) {
     topFolder = (RepositoryFile) topFolder.retrieveParent();
   }
   return topFolder;
 }
Пример #2
0
 /**
  * Chains up to find the access controls that are in force on this object. Could end up chaining
  * all the way to the root.
  *
  * <p>Note that (1) defining no access control entries of your own and (2) removing all of your
  * access control entries is indistiguishable in the current design. In #1, we chain up because we
  * inherit. But in #2, it might be expected that by explicitly removing all access control
  * entries, the chaining up ends. That is not the case in the current design.
  */
 public List<IPentahoAclEntry> getEffectiveAccessControls() {
   List acls = this.getAccessControls();
   if (acls.size() == 0) {
     RepositoryFile chain = this;
     while (!chain.isRoot() && (acls.size() == 0)) {
       chain = (RepositoryFile) chain.retrieveParent();
       acls = chain.getAccessControls();
     }
   }
   return acls;
 }
Пример #3
0
 @Override
 public boolean equals(final Object other) {
   if (this == other) {
     return true;
   }
   if (!(other instanceof RepositoryFile)) {
     return false;
   }
   final RepositoryFile that = (RepositoryFile) other;
   return getFileId().equals(that.getFileId());
 }
Пример #4
0
 public boolean containsActions() {
   boolean hasActions = false;
   if (this.isDirectory()) {
     Set children = getChildrenFiles();
     Iterator iter = children.iterator();
     while (iter.hasNext() && !hasActions) {
       RepositoryFile file = (RepositoryFile) iter.next();
       hasActions = file.getFileName().toLowerCase().endsWith(".xaction"); // $NON-NLS-1$
     }
   }
   return hasActions;
 }
Пример #5
0
 public int compareTo(final Object o) {
   if (o == null) {
     return 1;
   } else if (o instanceof RepositoryFile) {
     RepositoryFile that = (RepositoryFile) o;
     if ((this.getFullPath() == null) && (that.getFullPath() == null)) {
       return 0;
     } else if ((this.getFullPath() == null) && (that.getFullPath() != null)) {
       return -1;
     } else if ((this.getFullPath() != null) && (that.getFullPath() == null)) {
       return 1;
     } else {
       return this.getFullPath().compareTo(((RepositoryFile) o).getFullPath());
     }
   } else {
     return this.getFullPath().compareTo(o.toString());
   }
 }
Пример #6
0
  protected void resolvePath() {
    StringBuffer buffer = new StringBuffer(RepositoryFile.EMPTY_STRING);

    if (parent != null) {
      buffer.append(parent.getFullPath());
    }
    buffer.append(org.pentaho.platform.api.repository2.unified.RepositoryFile.SEPARATOR);
    buffer.append(fileName);

    setFullPath(buffer.toString());
  }
Пример #7
0
  public RepositoryFile(
      final String fileName,
      final RepositoryFile parent,
      final byte[] data,
      final long lastModified) {
    this();
    this.fileId = UUIDUtil.getUUIDAsString();

    this.fileName = fileName;
    if (parent != null) {
      parent.addChildFile(this);
    }
    setParent(parent);
    setData(data);
    setLastModified(lastModified);
    directory = data == null;
  }
Пример #8
0
 public void removeChildFile(final RepositoryFile file) {
   getChildrenFiles().remove(file);
   file.setParent(null); // as of now this file has no parent.
 }