/**
   * Checks if an XDI entity is a valid XDI public link contract.
   *
   * @param xdiEntity The XDI entity to check.
   * @return True if the XDI entity is a valid XDI public link contract.
   */
  public static boolean isValid(XdiEntity xdiEntity) {

    if (!RelationshipLinkContract.isValid(xdiEntity)) return false;

    if (xdiEntity instanceof XdiEntitySingleton) {

      if (RelationshipLinkContract.getAuthorizingAuthority(xdiEntity.getXDIAddress()) == null)
        return false;
      if (RelationshipLinkContract.getRequestingAuthority(xdiEntity.getXDIAddress()) == null)
        return false;
      if (RelationshipLinkContract.getTemplateAuthorityAndId(xdiEntity.getXDIAddress()) != null)
        return false;

      if (!XDILinkContractConstants.XDI_ADD_PUBLIC.equals(
          RelationshipLinkContract.getRequestingAuthority(xdiEntity.getXDIAddress()))) return false;

      return true;
    } else if (xdiEntity instanceof XdiEntityInstance) {

      return false;
    } else {

      return false;
    }
  }
Example #2
0
  /**
   * Checks if an XDI entity is a valid XDI public link contract.
   *
   * @param xdiEntity The XDI entity to check.
   * @return True if the XDI entity is a valid XDI public link contract.
   */
  public static boolean isValid(XdiEntity xdiEntity) {

    if (!GenericLinkContract.isValid(xdiEntity)) return false;

    if (xdiEntity instanceof XdiEntitySingleton) {

      if (GenericLinkContract.getAuthorizingAuthority(xdiEntity.getXri()) == null) return false;
      if (GenericLinkContract.getRequestingAuthority(xdiEntity.getXri()) == null) return false;
      if (GenericLinkContract.getTemplateAuthorityAndId(xdiEntity.getXri()) == null) return false;

      if (!XDILinkContractConstants.XRI_S_ANON.equals(
          GenericLinkContract.getRequestingAuthority(xdiEntity.getXri()))) return false;
      if (!XDILinkContractConstants.XRI_S_PUBLIC.equals(
          GenericLinkContract.getTemplateAuthorityAndId(xdiEntity.getXri()))) return false;

      return true;
    } else if (xdiEntity instanceof XdiEntityMember) {

      return false;
    } else {

      return false;
    }
  }