org.jboss.dna.connector.store.jpa.model.common
Class NamespaceEntity

java.lang.Object
  extended by org.jboss.dna.connector.store.jpa.model.common.NamespaceEntity

public class NamespaceEntity
extends Object

A NamespaceEntity represents a namespace that has been used in the store. NamespaceEntity records are immutable and shared by one or more enities.


Constructor Summary
NamespaceEntity()
           
NamespaceEntity(String uri)
           
 
Method Summary
 boolean equals(Object obj)
          
static NamespaceEntity findByUri(javax.persistence.EntityManager manager, String uri)
          Find an existing namespace by its URI, or create and return one if it does not already exist.
static NamespaceEntity findByUri(javax.persistence.EntityManager manager, String uri, boolean createIfRequired)
          Find an existing namespace by its URI.
 Long getId()
           
 String getUri()
           
 int hashCode()
          
 void setId(Long id)
           
 void setUri(String uri)
           
 String toString()
          
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

NamespaceEntity

public NamespaceEntity()

NamespaceEntity

public NamespaceEntity(String uri)
Parameters:
uri - the namespace URI
Method Detail

getId

public Long getId()
Returns:
id

setId

public void setId(Long id)
Parameters:
id - Sets id to the specified value.

getUri

public String getUri()
Returns:
uri

setUri

public void setUri(String uri)
Parameters:
uri - Sets uri to the specified value.

hashCode

public int hashCode()

Overrides:
hashCode in class Object
See Also:
Object.hashCode()

equals

public boolean equals(Object obj)

Overrides:
equals in class Object
See Also:
Object.equals(java.lang.Object)

toString

public String toString()

Overrides:
toString in class Object
See Also:
Object.toString()

findByUri

public static NamespaceEntity findByUri(javax.persistence.EntityManager manager,
                                        String uri)
Find an existing namespace by its URI, or create and return one if it does not already exist.

Parameters:
manager - the entity manager
uri - the URI
Returns:
the existing namespace, or null if one does not exist
Throws:
IllegalArgumentException - if the manager or URI are null

findByUri

public static NamespaceEntity findByUri(javax.persistence.EntityManager manager,
                                        String uri,
                                        boolean createIfRequired)
Find an existing namespace by its URI.

Parameters:
manager - the entity manager
uri - the URI
createIfRequired - if the namespace should be persisted if it does not yet exist
Returns:
the existing namespace, or null if one does not exist
Throws:
IllegalArgumentException - if the manager or URI are null


Copyright © 2008-2009 JBoss, a division of Red Hat. All Rights Reserved.