/**
   * Factory method that finds or creates an XDI public link contract for a graph.
   *
   * @return The XDI public link contract.
   */
  public static PublicLinkContract findPublicLinkContract(Graph graph, boolean create) {

    XDIAddress ownerXDIAddress = GraphUtil.getOwnerXDIAddress(graph);
    if (ownerXDIAddress == null) return null;

    RelationshipLinkContract relationshipLinkContract =
        RelationshipLinkContract.findRelationshipLinkContract(
            graph, ownerXDIAddress, XDILinkContractConstants.XDI_ADD_PUBLIC, null, null, create);
    if (relationshipLinkContract == null) return null;

    return fromXdiEntity(relationshipLinkContract.getXdiEntity());
  }
Example #2
0
  /**
   * Factory method that finds or creates an XDI public link contract for a graph.
   *
   * @return The XDI public link contract.
   */
  public static PublicLinkContract findPublicLinkContract(Graph graph, boolean create) {

    XDI3Segment ownerXri = GraphUtil.getOwnerXri(graph);
    if (ownerXri == null) return null;

    GenericLinkContract genericLinkContract =
        GenericLinkContract.findGenericLinkContract(
            graph,
            ownerXri,
            XDIAuthenticationConstants.XRI_S_ANONYMOUS,
            XDILinkContractConstants.XRI_S_PUBLIC,
            true);
    if (genericLinkContract == null) return null;

    return fromXdiEntity(genericLinkContract.getXdiEntity());
  }
Example #3
0
  public static XdiEntity fromXDIAddress(XDIAddress XDIaddress) {

    return fromContextNode(GraphUtil.contextNodeFromComponents(XDIaddress));
  }