org.modeshape.connector.store.jpa.model.common
Class WorkspaceEntity

java.lang.Object
  extended by org.modeshape.connector.store.jpa.model.common.WorkspaceEntity

public class WorkspaceEntity
extends Object

A WorkspaceEntity represents a workspace that has been create in the store. WorkspaceEntity records are immutable and shared by one or more enities.


Constructor Summary
WorkspaceEntity()
           
 
Method Summary
 boolean equals(Object obj)
          
static Set<String> findAllNames(javax.persistence.EntityManager manager)
          Find the set of names for the existing workspaces.
static WorkspaceEntity findByName(javax.persistence.EntityManager manager, String name)
          Find an existing workspace by its name, or create and return one if it does not already exist.
static WorkspaceEntity findByName(javax.persistence.EntityManager manager, String name, boolean createIfRequired)
          Find an existing workspace by its name.
 Long getId()
           
 String getName()
           
 int hashCode()
          
 void setId(Long id)
           
 void setName(String name)
           
 String toString()
          
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

WorkspaceEntity

public WorkspaceEntity()
Method Detail

getId

public Long getId()
Returns:
id

setId

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

getName

public String getName()
Returns:
name

setName

public void setName(String name)
Parameters:
name - Sets name 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()

findByName

public static WorkspaceEntity findByName(javax.persistence.EntityManager manager,
                                         String name)
Find an existing workspace by its name, or create and return one if it does not already exist.

Parameters:
manager - the entity manager
name - the name of the workspace
Returns:
the existing workspace
Throws:
IllegalArgumentException - if the manager or name are null

findByName

public static WorkspaceEntity findByName(javax.persistence.EntityManager manager,
                                         String name,
                                         boolean createIfRequired)
Find an existing workspace by its name.

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

findAllNames

public static Set<String> findAllNames(javax.persistence.EntityManager manager)
Find the set of names for the existing workspaces.

Parameters:
manager - the entity manager
Returns:
the names of the existing workspaces; never null
Throws:
IllegalArgumentException - if the manager or name are null


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