org.talend.repository.localprovider.model
Class LocalRepositoryFactory

java.lang.Object
  extended by org.talend.repository.model.AbstractRepositoryFactory
      extended by org.talend.repository.model.AbstractEMFRepositoryFactory
          extended by org.talend.repository.localprovider.model.LocalRepositoryFactory
All Implemented Interfaces:
IRepositoryFactory

public class LocalRepositoryFactory
extends AbstractEMFRepositoryFactory
implements IRepositoryFactory

DOC smallet class global comment. Detailled comment
$Id: LocalRepositoryFactory.java 3008 2007-04-10 09:18:10 +0000 (mar., 10 avr. 2007) smallet $ $Id: RepositoryFactory.java,v 1.55 2006/08/23 14:30:39 tguiu Exp $


Constructor Summary
LocalRepositoryFactory()
           
 
Method Summary
protected
<K,T> void
addFolderMembers(ERepositoryObjectType type, Container<K,T> toReturn, java.lang.Object objectFolder, boolean onlyLastVersion)
          DOC smallet Comment method "addFolderMembers".
 Item copy(Item originalItem, org.eclipse.core.runtime.IPath path)
           
 void create(Item item, org.eclipse.core.runtime.IPath path)
           
 Folder createFolder(ERepositoryObjectType type, org.eclipse.core.runtime.IPath path, java.lang.String label)
           
 Project createProject(java.lang.String label, java.lang.String description, ECodeLanguage language, User author)
           
 void createUser()
           
 void deleteFolder(ERepositoryObjectType type, org.eclipse.core.runtime.IPath path)
           
 void deleteObjectLogical(IRepositoryObject objToDelete)
          Deletes logically the given object.
 void deleteObjectPhysical(IRepositoryObject objToDelete)
          Deletes physically the given object.
 boolean doesLoggedUserExist()
           
 java.util.List<IRepositoryObject> getAll(ERepositoryObjectType type, boolean withDeleted)
          Returns all object of a given type.
 java.util.List<Status> getDocumentationStatus()
           
protected  java.lang.Object getFolder(Project project, ERepositoryObjectType repositoryObjectType)
           
protected  FolderHelper getFolderHelper(Project emfProject)
           
static LocalRepositoryFactory getInstance()
           
 IRepositoryObject getLastVersion(java.lang.String id)
          Returns last version of an object given its id.
protected
<K,T> RootContainer<K,T>
getObjectFromFolder(ERepositoryObjectType type, boolean onlyLastVersion)
          DOC smallet Comment method "getObjectFromFolder".
 java.util.List<IRepositoryObject> getProcess2()
           
 java.util.List<Project> getReferencedProjects()
           
protected  java.util.List<IRepositoryObject> getSerializableFromFolder(java.lang.Object folder, java.lang.String id, ERepositoryObjectType type, boolean allVersion, boolean searchInChildren, boolean withDeleted)
          Get all object in a folder recursively.
 ERepositoryStatus getStatus(Item item)
           
 java.util.List<Status> getTechnicalStatus()
           
 void initialize()
           
 boolean isPathValid(ERepositoryObjectType type, org.eclipse.core.runtime.IPath path, java.lang.String label)
           
 java.lang.String isServerValid()
           
 void lock(Item item)
           
 void logOnProject(Project project)
           
 void moveFolder(ERepositoryObjectType type, org.eclipse.core.runtime.IPath sourcePath, org.eclipse.core.runtime.IPath targetPath)
           
 void moveObject(IRepositoryObject objToMove, org.eclipse.core.runtime.IPath newPath)
           
 Project[] readProject()
           
 Project[] readProject(boolean local)
           
 Property reload(Property property)
          DOC mhelleboid Comment method "cancel".
 void renameFolder(ERepositoryObjectType type, org.eclipse.core.runtime.IPath path, java.lang.String label)
           
 void restoreObject(IRepositoryObject objToRestore, org.eclipse.core.runtime.IPath path)
          Restore a logically deleted object.
 void save(Item item)
           
 void save(Property property)
           
 void setDocumentationStatus(java.util.List<Status> list)
           
 void setMigrationTasksDone(Project project, java.util.List<java.lang.String> list)
           
 void setTechnicalStatus(java.util.List<Status> list)
           
 void synchronizeRoutines(org.eclipse.core.resources.IProject prj)
          DOC smallet Comment method "synchronizeRoutines".
 void unlock(Item item)
           
 
Methods inherited from class org.talend.repository.model.AbstractEMFRepositoryFactory
convert, copyFromResource, createSystemRoutines, getAllVersion, getBusinessProcess, getContext, getDocumentation, getMetadataConnection, getMetadataFileDelimited, getMetadataFileLdif, getMetadataFilePositional, getMetadataFileRegexp, getMetadataFileXml, getNextId, getProcess, getRoutine, getSerializable, isNameAvailable
 
Methods inherited from class org.talend.repository.model.AbstractRepositoryFactory
getContextItem, getFields, getId, getMetadataConnectionsItem, getName, getRepositoryContext, isAuthenticationNeeded, setAuthenticationNeeded, setFields, setId, setName, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.talend.repository.model.IRepositoryFactory
getAllVersion, getBusinessProcess, getContext, getContextItem, getDocumentation, getFields, getId, getMetadataConnection, getMetadataConnectionsItem, getMetadataFileDelimited, getMetadataFileLdif, getMetadataFilePositional, getMetadataFileRegexp, getMetadataFileXml, getName, getNextId, getProcess, getRoutine, isAuthenticationNeeded, isNameAvailable, setAuthenticationNeeded, setFields, setId, setName
 

Constructor Detail

LocalRepositoryFactory

public LocalRepositoryFactory()
Method Detail

getInstance

public static LocalRepositoryFactory getInstance()

getObjectFromFolder

protected <K,T> RootContainer<K,T> getObjectFromFolder(ERepositoryObjectType type,
                                                       boolean onlyLastVersion)
                                          throws PersistenceException
DOC smallet Comment method "getObjectFromFolder".

Specified by:
getObjectFromFolder in class AbstractEMFRepositoryFactory
Type Parameters:
T - - DOC smallet
Parameters:
type - - the type of object to search
onlyLastVersion - specify true if only the last version of an object must be returned, false for all version
project - - the project to searched in
Returns:
a structure of all object of type in the project
Throws:
PersistenceException - if project, folder or resource cannot be found

addFolderMembers

protected <K,T> void addFolderMembers(ERepositoryObjectType type,
                                      Container<K,T> toReturn,
                                      java.lang.Object objectFolder,
                                      boolean onlyLastVersion)
                         throws PersistenceException
DOC smallet Comment method "addFolderMembers".

Specified by:
addFolderMembers in class AbstractEMFRepositoryFactory
Type Parameters:
T - - DOC smallet
Parameters:
type - - DOC smallet
toReturn - - DOC smallet
objectFolder - - DOC smallet
onlyLastVersion - specify true if only the last version of an object must be returned, false for all version
Throws:
PersistenceException - - DOC smallet

getAll

public java.util.List<IRepositoryObject> getAll(ERepositoryObjectType type,
                                                boolean withDeleted)
                                         throws PersistenceException
Description copied from interface: IRepositoryFactory
Returns all object of a given type.
Only the most recent version of each object is returned.

Specified by:
getAll in interface IRepositoryFactory
Parameters:
type - - the type
Returns:
a list of all objects of type type in the repository in the project
Throws:
PersistenceException

getLastVersion

public IRepositoryObject getLastVersion(java.lang.String id)
                                 throws PersistenceException
Description copied from interface: IRepositoryFactory
Returns last version of an object given its id.

Specified by:
getLastVersion in interface IRepositoryFactory
Parameters:
id - - the id to look for
Returns:
the most recent version of object with this id or null if no object with this id has been found
Throws:
PersistenceException

getSerializableFromFolder

protected java.util.List<IRepositoryObject> getSerializableFromFolder(java.lang.Object folder,
                                                                      java.lang.String id,
                                                                      ERepositoryObjectType type,
                                                                      boolean allVersion,
                                                                      boolean searchInChildren,
                                                                      boolean withDeleted)
                                                               throws PersistenceException
Get all object in a folder recursively.

Specified by:
getSerializableFromFolder in class AbstractEMFRepositoryFactory
Parameters:
folder - - the folder to search in
id - - the id of the object searched. Specify null to get all objects.
type - - the type searched
allVersion - - true if all version of each object must be return or false if on ly the most recent version
Returns:
a list (may be empty) of objects found
Throws:
PersistenceException

createProject

public Project createProject(java.lang.String label,
                             java.lang.String description,
                             ECodeLanguage language,
                             User author)
                      throws PersistenceException
Specified by:
createProject in interface IRepositoryFactory
Throws:
PersistenceException

synchronizeRoutines

public void synchronizeRoutines(org.eclipse.core.resources.IProject prj)
                         throws PersistenceException
DOC smallet Comment method "synchronizeRoutines".

Throws:
PersistenceException

getFolderHelper

protected FolderHelper getFolderHelper(Project emfProject)
Specified by:
getFolderHelper in class AbstractEMFRepositoryFactory

readProject

public Project[] readProject(boolean local)
                      throws PersistenceException
Throws:
PersistenceException

readProject

public Project[] readProject()
                      throws PersistenceException
Specified by:
readProject in interface IRepositoryFactory
Throws:
PersistenceException
See Also:
org.talend.core.model.repository.factories.IRepositoryFactory#readProject(java.lang.String, java.lang.String, java.lang.String)

createFolder

public Folder createFolder(ERepositoryObjectType type,
                           org.eclipse.core.runtime.IPath path,
                           java.lang.String label)
                    throws PersistenceException
Specified by:
createFolder in interface IRepositoryFactory
Throws:
PersistenceException

isPathValid

public boolean isPathValid(ERepositoryObjectType type,
                           org.eclipse.core.runtime.IPath path,
                           java.lang.String label)
                    throws PersistenceException
Specified by:
isPathValid in interface IRepositoryFactory
Throws:
PersistenceException

deleteFolder

public void deleteFolder(ERepositoryObjectType type,
                         org.eclipse.core.runtime.IPath path)
                  throws PersistenceException
Specified by:
deleteFolder in interface IRepositoryFactory
Throws:
PersistenceException

moveFolder

public void moveFolder(ERepositoryObjectType type,
                       org.eclipse.core.runtime.IPath sourcePath,
                       org.eclipse.core.runtime.IPath targetPath)
                throws PersistenceException
Specified by:
moveFolder in interface IRepositoryFactory
Throws:
PersistenceException

renameFolder

public void renameFolder(ERepositoryObjectType type,
                         org.eclipse.core.runtime.IPath path,
                         java.lang.String label)
                  throws PersistenceException
Specified by:
renameFolder in interface IRepositoryFactory
Throws:
PersistenceException

getProcess2

public java.util.List<IRepositoryObject> getProcess2()
                                              throws PersistenceException
Throws:
PersistenceException

deleteObjectLogical

public void deleteObjectLogical(IRepositoryObject objToDelete)
                         throws PersistenceException
Description copied from interface: IRepositoryFactory
Deletes logically the given object. isDeleted on this object will now returned true.

Specified by:
deleteObjectLogical in interface IRepositoryFactory
Parameters:
objToDelete - - the objet to delete
Throws:
PersistenceException

deleteObjectPhysical

public void deleteObjectPhysical(IRepositoryObject objToDelete)
                          throws PersistenceException
Description copied from interface: IRepositoryFactory
Deletes physically the given object. Object cannot be retrieved.

Specified by:
deleteObjectPhysical in interface IRepositoryFactory
Parameters:
objToDelete - - the objet to delete
Throws:
PersistenceException

restoreObject

public void restoreObject(IRepositoryObject objToRestore,
                          org.eclipse.core.runtime.IPath path)
                   throws PersistenceException
Description copied from interface: IRepositoryFactory
Restore a logically deleted object. isDeleted on this object will now returned false.

Specified by:
restoreObject in interface IRepositoryFactory
Parameters:
objToRestore - - the object to restore
path - - the path to restore the object. Cannot be null. Path is relative to root type folder.
Throws:
PersistenceException

moveObject

public void moveObject(IRepositoryObject objToMove,
                       org.eclipse.core.runtime.IPath newPath)
                throws PersistenceException
Specified by:
moveObject in interface IRepositoryFactory
Throws:
PersistenceException

lock

public void lock(Item item)
          throws PersistenceException
Specified by:
lock in interface IRepositoryFactory
Throws:
PersistenceException

unlock

public void unlock(Item item)
            throws PersistenceException
Specified by:
unlock in interface IRepositoryFactory
Throws:
PersistenceException

getDocumentationStatus

public java.util.List<Status> getDocumentationStatus()
                                              throws PersistenceException
Specified by:
getDocumentationStatus in interface IRepositoryFactory
Throws:
PersistenceException

getTechnicalStatus

public java.util.List<Status> getTechnicalStatus()
                                          throws PersistenceException
Specified by:
getTechnicalStatus in interface IRepositoryFactory
Throws:
PersistenceException

setDocumentationStatus

public void setDocumentationStatus(java.util.List<Status> list)
                            throws PersistenceException
Specified by:
setDocumentationStatus in interface IRepositoryFactory
Throws:
PersistenceException

setTechnicalStatus

public void setTechnicalStatus(java.util.List<Status> list)
                        throws PersistenceException
Specified by:
setTechnicalStatus in interface IRepositoryFactory
Throws:
PersistenceException

setMigrationTasksDone

public void setMigrationTasksDone(Project project,
                                  java.util.List<java.lang.String> list)
                           throws PersistenceException
Specified by:
setMigrationTasksDone in interface IRepositoryFactory
Throws:
PersistenceException

isServerValid

public java.lang.String isServerValid()
Specified by:
isServerValid in interface IRepositoryFactory

save

public void save(Item item)
          throws PersistenceException
Specified by:
save in interface IRepositoryFactory
Throws:
PersistenceException

save

public void save(Property property)
          throws PersistenceException
Specified by:
save in interface IRepositoryFactory
Throws:
PersistenceException

copy

public Item copy(Item originalItem,
                 org.eclipse.core.runtime.IPath path)
          throws PersistenceException,
                 BusinessException
Specified by:
copy in interface IRepositoryFactory
Throws:
PersistenceException
BusinessException

create

public void create(Item item,
                   org.eclipse.core.runtime.IPath path)
            throws PersistenceException
Specified by:
create in interface IRepositoryFactory
Throws:
PersistenceException

reload

public Property reload(Property property)
Description copied from interface: IRepositoryFactory
DOC mhelleboid Comment method "cancel".

Specified by:
reload in interface IRepositoryFactory

doesLoggedUserExist

public boolean doesLoggedUserExist()
                            throws PersistenceException
Throws:
PersistenceException

createUser

public void createUser()
                throws PersistenceException
Throws:
PersistenceException

initialize

public void initialize()
Specified by:
initialize in interface IRepositoryFactory

logOnProject

public void logOnProject(Project project)
                  throws PersistenceException
Specified by:
logOnProject in interface IRepositoryFactory
Throws:
PersistenceException

getStatus

public ERepositoryStatus getStatus(Item item)
Specified by:
getStatus in interface IRepositoryFactory

getFolder

protected java.lang.Object getFolder(Project project,
                                     ERepositoryObjectType repositoryObjectType)
                              throws PersistenceException
Specified by:
getFolder in class AbstractEMFRepositoryFactory
Throws:
PersistenceException

getReferencedProjects

public java.util.List<Project> getReferencedProjects()
Specified by:
getReferencedProjects in interface IRepositoryFactory