Esempio n. 1
0
  /**
   * {@inheritDoc}
   *
   * @see
   *     org.komodo.relational.internal.RelationalObjectImpl#hasChild(org.komodo.spi.repository.Repository.UnitOfWork,
   *     java.lang.String, java.lang.String)
   */
  @Override
  public boolean hasChild(final UnitOfWork transaction, final String name, final String typeName)
      throws KException {
    ArgCheck.isNotNull(transaction, "transaction"); // $NON-NLS-1$
    ArgCheck.isTrue(
        (transaction.getState() == State.NOT_STARTED),
        "transaction state must be NOT_STARTED"); //$NON-NLS-1$
    ArgCheck.isNotEmpty(name, "name"); // $NON-NLS-1$
    ArgCheck.isNotEmpty(typeName, "typeName"); // $NON-NLS-1$

    if (VdbLexicon.DataRole.Permission.PERMISSION.equals(typeName)) {
      return (getPermissions(transaction, name).length != 0);
    }

    return false;
  }
Esempio n. 2
0
  /**
   * {@inheritDoc}
   *
   * @see
   *     org.komodo.relational.internal.RelationalObjectImpl#getChildrenOfType(org.komodo.spi.repository.Repository.UnitOfWork,
   *     java.lang.String, java.lang.String[])
   */
  @Override
  public KomodoObject[] getChildrenOfType(
      final UnitOfWork transaction, final String type, final String... namePatterns)
      throws KException {
    ArgCheck.isNotNull(transaction, "transaction"); // $NON-NLS-1$
    ArgCheck.isTrue(
        (transaction.getState() == State.NOT_STARTED),
        "transaction state is not NOT_STARTED"); //$NON-NLS-1$

    KomodoObject[] result = null;

    if (VdbLexicon.DataRole.Permission.PERMISSION.equals(type)) {
      result = getPermissions(transaction, namePatterns);
    } else {
      result = KomodoObject.EMPTY_ARRAY;
    }

    return result;
  }
Esempio n. 3
0
  /**
   * {@inheritDoc}
   *
   * @see
   *     org.komodo.relational.internal.RelationalObjectImpl#getChild(org.komodo.spi.repository.Repository.UnitOfWork,
   *     java.lang.String, java.lang.String)
   */
  @Override
  public KomodoObject getChild(
      final UnitOfWork transaction, final String name, final String typeName) throws KException {
    ArgCheck.isNotNull(transaction, "transaction"); // $NON-NLS-1$
    ArgCheck.isTrue(
        (transaction.getState() == State.NOT_STARTED),
        "transaction state must be NOT_STARTED"); //$NON-NLS-1$
    ArgCheck.isNotEmpty(name, "name"); // $NON-NLS-1$
    ArgCheck.isNotEmpty(typeName, "typeName"); // $NON-NLS-1$

    if (VdbLexicon.DataRole.Permission.PERMISSION.equals(typeName)) {
      final KomodoObject[] permissions = getPermissions(transaction, name);

      if (permissions.length != 0) {
        return permissions[0];
      }
    }

    // child does not exist
    throw new KException(
        Messages.getString(
            org.komodo.repository.Messages.Komodo.CHILD_NOT_FOUND, name, getAbsolutePath()));
  }