http://git-wip-us.apache.org/repos/asf/atlas/blob/a1fd4068/omrs/src/main/java/org/apache/atlas/omrs/localrepository/repositoryconnector/LocalOMRSMetadataCollection.java
----------------------------------------------------------------------
diff --git 
a/omrs/src/main/java/org/apache/atlas/omrs/localrepository/repositoryconnector/LocalOMRSMetadataCollection.java
 
b/omrs/src/main/java/org/apache/atlas/omrs/localrepository/repositoryconnector/LocalOMRSMetadataCollection.java
index a46c28e..544085a 100644
--- 
a/omrs/src/main/java/org/apache/atlas/omrs/localrepository/repositoryconnector/LocalOMRSMetadataCollection.java
+++ 
b/omrs/src/main/java/org/apache/atlas/omrs/localrepository/repositoryconnector/LocalOMRSMetadataCollection.java
@@ -21,13 +21,15 @@ import 
org.apache.atlas.omrs.eventmanagement.OMRSRepositoryEventProcessor;
 import org.apache.atlas.omrs.ffdc.*;
 import org.apache.atlas.omrs.ffdc.exception.*;
 import 
org.apache.atlas.omrs.localrepository.repositorycontentmanager.OMRSRepositoryContentManager;
+import 
org.apache.atlas.omrs.localrepository.repositorycontentmanager.OMRSRepositoryHelper;
+import 
org.apache.atlas.omrs.localrepository.repositorycontentmanager.OMRSRepositoryValidator;
 import org.apache.atlas.omrs.metadatacollection.OMRSMetadataCollection;
 import org.apache.atlas.omrs.metadatacollection.properties.MatchCriteria;
 import org.apache.atlas.omrs.metadatacollection.properties.SequencingOrder;
 import org.apache.atlas.omrs.metadatacollection.properties.instances.*;
 import org.apache.atlas.omrs.metadatacollection.properties.typedefs.*;
 
-import java.util.ArrayList;
+import java.util.List;
 import java.util.Date;
 
 /**
@@ -36,14 +38,16 @@ import java.util.Date;
  */
 public class LocalOMRSMetadataCollection extends OMRSMetadataCollection
 {
-    private static final String  sourceName = "Local Repository";
+    private static final String repositoryName = "Local Repository";
 
-    private OMRSMetadataCollection       realMetadataCollection           = 
null;
-    private String                       localServerName                  = 
null;
-    private String                       localServerType                  = 
null;
-    private String                       localOrganizationName            = 
null;
-    private OMRSRepositoryEventProcessor outboundRepositoryEventProcessor = 
null;
-    private OMRSRepositoryContentManager localRepositoryContentManager    = 
null;
+    private OMRSMetadataCollection       realMetadataCollection;
+    private String                       localServerName;
+    private String                       localServerType;
+    private String                       localOrganizationName;
+    private OMRSRepositoryEventProcessor outboundRepositoryEventProcessor;
+    private OMRSRepositoryContentManager localRepositoryContentManager;
+    private OMRSRepositoryValidator      repositoryValidator;
+    private OMRSRepositoryHelper         repositoryHelper;
 
 
     /**
@@ -53,7 +57,7 @@ public class LocalOMRSMetadataCollection extends 
OMRSMetadataCollection
      * @param localServerName - name of the local server.
      * @param localServerType - type of the local server.
      * @param localOrganizationName - name of the organization that owns the 
local server.
-     * @param realMetadataCollection - metadata collection of the rela local 
connector.
+     * @param realMetadataCollection - metadata collection of the real local 
connector.
      * @param outboundRepositoryEventProcessor - outbound event processor
      *                                         (may be null if a repository 
event mapper is deployed).
      * @param repositoryContentManager - manager of in-memory cache of type 
definitions (TypeDefs).
@@ -72,13 +76,13 @@ public class LocalOMRSMetadataCollection extends 
OMRSMetadataCollection
         super(localMetadataConnectionId);
 
         /*
-         * Save the metadata collection object for the real repository.  This 
is the metadata that does all of the
-         * work.  LocalOMRSMetadataCollection is just a wrapper for managing 
repository events and debug and
-         * audit logging.
+         * Save the metadata collection object for the real repository.  This 
is the metadata collection that
+         * does all of the work.  LocalOMRSMetadataCollection is just a 
wrapper for managing repository events
+         * and debug and audit logging.
          */
         if (realMetadataCollection == null)
         {
-            String            actionDescription = "Local OMRS Metadata 
Collection Constructor";
+            final String      actionDescription = "Local OMRS Metadata 
Collection Constructor";
 
             OMRSErrorCode errorCode = 
OMRSErrorCode.NULL_LOCAL_METADATA_COLLECTION;
             String        errorMessage = errorCode.getErrorMessageId()
@@ -101,6 +105,8 @@ public class LocalOMRSMetadataCollection extends 
OMRSMetadataCollection
         this.localOrganizationName = localOrganizationName;
         this.outboundRepositoryEventProcessor = 
outboundRepositoryEventProcessor;
         this.localRepositoryContentManager = repositoryContentManager;
+        this.repositoryValidator = new 
OMRSRepositoryValidator(repositoryContentManager);
+        this.repositoryHelper = new 
OMRSRepositoryHelper(repositoryContentManager);
     }
 
 
@@ -121,8 +127,13 @@ public class LocalOMRSMetadataCollection extends 
OMRSMetadataCollection
      * @throws UserNotAuthorizedException - the userId is not permitted to 
perform this operation.
      */
     public TypeDefGallery getAllTypes(String userId) throws 
RepositoryErrorException,
-                                                                
UserNotAuthorizedException
+                                                            
UserNotAuthorizedException
     {
+        final String methodName = "getAllTypes";
+
+        validateRepository(methodName);
+        repositoryValidator.validateUserId(repositoryName, userId, methodName);
+
         return realMetadataCollection.getAllTypes(userId);
     }
 
@@ -144,6 +155,11 @@ public class LocalOMRSMetadataCollection extends 
OMRSMetadataCollection
                                                                    
RepositoryErrorException,
                                                                    
UserNotAuthorizedException
     {
+        final String methodName = "findTypesByName";
+
+        validateRepository(methodName);
+        repositoryValidator.validateUserId(repositoryName, userId, methodName);
+
         return realMetadataCollection.findTypesByName(userId, name);
     }
 
@@ -158,11 +174,16 @@ public class LocalOMRSMetadataCollection extends 
OMRSMetadataCollection
      * @throws RepositoryErrorException - there is a problem communicating 
with the metadata repository.
      * @throws UserNotAuthorizedException - the userId is not permitted to 
perform this operation.
      */
-    public ArrayList<TypeDef> findTypeDefsByCategory(String          userId,
-                                                     TypeDefCategory category) 
throws InvalidParameterException,
-                                                                               
       RepositoryErrorException,
-                                                                               
       UserNotAuthorizedException
+    public List<TypeDef> findTypeDefsByCategory(String          userId,
+                                                TypeDefCategory category) 
throws InvalidParameterException,
+                                                                               
  RepositoryErrorException,
+                                                                               
  UserNotAuthorizedException
     {
+        final String methodName = "findTypeDefsByCategory";
+
+        validateRepository(methodName);
+        repositoryValidator.validateUserId(repositoryName, userId, methodName);
+
         return realMetadataCollection.findTypeDefsByCategory(userId, category);
     }
 
@@ -177,11 +198,16 @@ public class LocalOMRSMetadataCollection extends 
OMRSMetadataCollection
      * @throws RepositoryErrorException - there is a problem communicating 
with the metadata repository.
      * @throws UserNotAuthorizedException - the userId is not permitted to 
perform this operation.
      */
-    public ArrayList<AttributeTypeDef> findAttributeTypeDefsByCategory(String  
                 userId,
-                                                                       
AttributeTypeDefCategory category) throws InvalidParameterException,
-                                                                               
                                  RepositoryErrorException,
-                                                                               
                                  UserNotAuthorizedException
+    public List<AttributeTypeDef> findAttributeTypeDefsByCategory(String       
            userId,
+                                                                  
AttributeTypeDefCategory category) throws InvalidParameterException,
+                                                                               
                             RepositoryErrorException,
+                                                                               
                             UserNotAuthorizedException
     {
+        final String methodName = "findAttributeTypeDefsByCategory";
+
+        validateRepository(methodName);
+        repositoryValidator.validateUserId(repositoryName, userId, methodName);
+
         return realMetadataCollection.findAttributeTypeDefsByCategory(userId, 
category);
     }
 
@@ -197,11 +223,16 @@ public class LocalOMRSMetadataCollection extends 
OMRSMetadataCollection
      * @throws RepositoryErrorException - there is a problem communicating 
with the metadata repository.
      * @throws UserNotAuthorizedException - the userId is not permitted to 
perform this operation.
      */
-    public ArrayList<TypeDef> findTypeDefsByProperty(String            userId,
-                                                     TypeDefProperties 
matchCriteria) throws InvalidParameterException,
-                                                                               
              RepositoryErrorException,
-                                                                               
              UserNotAuthorizedException
+    public List<TypeDef> findTypeDefsByProperty(String            userId,
+                                                TypeDefProperties 
matchCriteria) throws InvalidParameterException,
+                                                                               
         RepositoryErrorException,
+                                                                               
         UserNotAuthorizedException
     {
+        final String methodName = "findTypeDefsByProperty";
+
+        validateRepository(methodName);
+        repositoryValidator.validateUserId(repositoryName, userId, methodName);
+
         return realMetadataCollection.findTypeDefsByProperty(userId, 
matchCriteria);
     }
 
@@ -219,13 +250,18 @@ public class LocalOMRSMetadataCollection extends 
OMRSMetadataCollection
      * @throws RepositoryErrorException - there is a problem communicating 
with the metadata repository.
      * @throws UserNotAuthorizedException - the userId is not permitted to 
perform this operation.
      */
-    public TypeDefGallery findTypesByExternalID(String    userId,
-                                                String    standard,
-                                                String    organization,
-                                                String    identifier) throws 
InvalidParameterException,
-                                                                             
RepositoryErrorException,
-                                                                             
UserNotAuthorizedException
+    public List<TypeDef> findTypesByExternalID(String    userId,
+                                               String    standard,
+                                               String    organization,
+                                               String    identifier) throws 
InvalidParameterException,
+                                                                            
RepositoryErrorException,
+                                                                            
UserNotAuthorizedException
     {
+        final String methodName = "findTypesByExternalID";
+
+        validateRepository(methodName);
+        repositoryValidator.validateUserId(repositoryName, userId, methodName);
+
         return realMetadataCollection.findTypesByExternalID(userId, standard, 
organization, identifier);
     }
 
@@ -240,11 +276,16 @@ public class LocalOMRSMetadataCollection extends 
OMRSMetadataCollection
      * @throws RepositoryErrorException - there is a problem communicating 
with the metadata repository.
      * @throws UserNotAuthorizedException - the userId is not permitted to 
perform this operation.
      */
-    public ArrayList<TypeDef> searchForTypeDefs(String    userId,
-                                                String    searchCriteria) 
throws InvalidParameterException,
-                                                                               
  RepositoryErrorException,
-                                                                               
  UserNotAuthorizedException
+    public List<TypeDef> searchForTypeDefs(String    userId,
+                                           String    searchCriteria) throws 
InvalidParameterException,
+                                                                            
RepositoryErrorException,
+                                                                            
UserNotAuthorizedException
     {
+        final String methodName = "searchForTypeDefs";
+
+        validateRepository(methodName);
+        repositoryValidator.validateUserId(repositoryName, userId, methodName);
+
         return realMetadataCollection.searchForTypeDefs(userId, 
searchCriteria);
     }
 
@@ -267,6 +308,11 @@ public class LocalOMRSMetadataCollection extends 
OMRSMetadataCollection
                                                            
TypeDefNotKnownException,
                                                            
UserNotAuthorizedException
     {
+        final String methodName = "getTypeDefByGUID";
+
+        validateRepository(methodName);
+        repositoryValidator.validateUserId(repositoryName, userId, methodName);
+
         return realMetadataCollection.getTypeDefByGUID(userId, guid);
     }
 
@@ -289,6 +335,11 @@ public class LocalOMRSMetadataCollection extends 
OMRSMetadataCollection
                                                                               
TypeDefNotKnownException,
                                                                               
UserNotAuthorizedException
     {
+        final String methodName = "getAttributeTypeDefByGUID";
+
+        validateRepository(methodName);
+        repositoryValidator.validateUserId(repositoryName, userId, methodName);
+
         return realMetadataCollection.getAttributeTypeDefByGUID(userId, guid);
     }
 
@@ -311,6 +362,11 @@ public class LocalOMRSMetadataCollection extends 
OMRSMetadataCollection
                                                            
TypeDefNotKnownException,
                                                            
UserNotAuthorizedException
     {
+        final String methodName = "getTypeDefByName";
+
+        validateRepository(methodName);
+        repositoryValidator.validateUserId(repositoryName, userId, methodName);
+
         return realMetadataCollection.getTypeDefByName(userId, name);
     }
 
@@ -333,6 +389,11 @@ public class LocalOMRSMetadataCollection extends 
OMRSMetadataCollection
                                                                               
TypeDefNotKnownException,
                                                                               
UserNotAuthorizedException
     {
+        final String methodName = "getAttributeTypeDefByName";
+
+        validateRepository(methodName);
+        repositoryValidator.validateUserId(repositoryName, userId, methodName);
+
         return realMetadataCollection.getAttributeTypeDefByName(userId, name);
     }
 
@@ -341,7 +402,7 @@ public class LocalOMRSMetadataCollection extends 
OMRSMetadataCollection
      * Create a collection of related types.
      *
      * @param userId - unique identifier for requesting user.
-     * @param newTypes - TypeDefGallery structure describing the new 
AttributeTypeDefs and TypeDefs.
+     * @param newTypes - TypeDefGalleryResponse structure describing the new 
AttributeTypeDefs and TypeDefs.
      * @throws InvalidParameterException - the new TypeDef is null.
      * @throws RepositoryErrorException - there is a problem communicating 
with the metadata repository where
      *                                  the metadata collection is stored.
@@ -349,6 +410,7 @@ public class LocalOMRSMetadataCollection extends 
OMRSMetadataCollection
      * @throws TypeDefKnownException - the TypeDef is already stored in the 
repository.
      * @throws TypeDefConflictException - the new TypeDef conflicts with an 
existing TypeDef.
      * @throws InvalidTypeDefException - the new TypeDef has invalid contents.
+     * @throws FunctionNotSupportedException - the repository does not support 
this call.
      * @throws UserNotAuthorizedException - the userId is not permitted to 
perform this operation.
      */
     public  void addTypeDefGallery(String          userId,
@@ -358,9 +420,49 @@ public class LocalOMRSMetadataCollection extends 
OMRSMetadataCollection
                                                                     
TypeDefKnownException,
                                                                     
TypeDefConflictException,
                                                                     
InvalidTypeDefException,
+                                                                    
FunctionNotSupportedException,
                                                                     
UserNotAuthorizedException
     {
+        final String methodName = "addTypeDefGallery";
+
+        validateRepository(methodName);
+        repositoryValidator.validateUserId(repositoryName, userId, methodName);
+
+        if (newTypes != null)
+        {
+            List<AttributeTypeDef>   attributeTypeDefs = 
newTypes.getAttributeTypeDefs();
+
+            if (attributeTypeDefs != null)
+            {
+                for (AttributeTypeDef   attributeTypeDef : attributeTypeDefs)
+                {
+                    this.addAttributeTypeDef(userId, attributeTypeDef);
+                }
+            }
+
+            List<TypeDef>   typeDefs = newTypes.getTypeDefs();
+
+            if (typeDefs != null)
+            {
+                for (TypeDef   typeDef : typeDefs)
+                {
+                    this.addTypeDef(userId, typeDef);
+                }
+            }
+        }
+        else
+        {
+            OMRSErrorCode errorCode = OMRSErrorCode.NULL_TYPEDEF_GALLERY;
+            String        errorMessage = errorCode.getErrorMessageId()
+                                       + errorCode.getFormattedErrorMessage();
 
+            throw new InvalidParameterException(errorCode.getHTTPErrorCode(),
+                                                this.getClass().getName(),
+                                                methodName,
+                                                errorMessage,
+                                                errorCode.getSystemAction(),
+                                                errorCode.getUserAction());
+        }
     }
 
 
@@ -376,6 +478,7 @@ public class LocalOMRSMetadataCollection extends 
OMRSMetadataCollection
      * @throws TypeDefKnownException - the TypeDef is already stored in the 
repository.
      * @throws TypeDefConflictException - the new TypeDef conflicts with an 
existing TypeDef.
      * @throws InvalidTypeDefException - the new TypeDef has invalid contents.
+     * @throws FunctionNotSupportedException - the repository does not support 
this call.
      * @throws UserNotAuthorizedException - the userId is not permitted to 
perform this operation.
      */
     public void addTypeDef(String    userId,
@@ -385,18 +488,24 @@ public class LocalOMRSMetadataCollection extends 
OMRSMetadataCollection
                                                         TypeDefKnownException,
                                                         
TypeDefConflictException,
                                                         
InvalidTypeDefException,
+                                                        
FunctionNotSupportedException,
                                                         
UserNotAuthorizedException
     {
+        final String methodName = "addTypeDef";
+
+        validateRepository(methodName);
+        repositoryValidator.validateUserId(repositoryName, userId, methodName);
+
         realMetadataCollection.addTypeDef(userId, newTypeDef);
 
         if (localRepositoryContentManager != null)
         {
-            localRepositoryContentManager.addTypeDef(sourceName, newTypeDef);
+            localRepositoryContentManager.addTypeDef(repositoryName, 
newTypeDef);
         }
 
         if (outboundRepositoryEventProcessor != null)
         {
-            outboundRepositoryEventProcessor.processNewTypeDefEvent(sourceName,
+            
outboundRepositoryEventProcessor.processNewTypeDefEvent(repositoryName,
                                                                     
metadataCollectionId,
                                                                     
localServerName,
                                                                     
localServerType,
@@ -417,6 +526,7 @@ public class LocalOMRSMetadataCollection extends 
OMRSMetadataCollection
      * @throws TypeDefKnownException - the TypeDef is already stored in the 
repository.
      * @throws TypeDefConflictException - the new TypeDef conflicts with an 
existing TypeDef.
      * @throws InvalidTypeDefException - the new TypeDef has invalid contents.
+     * @throws FunctionNotSupportedException - the repository does not support 
this call.
      * @throws UserNotAuthorizedException - the userId is not permitted to 
perform this operation.
      */
     public  void addAttributeTypeDef(String             userId,
@@ -426,18 +536,24 @@ public class LocalOMRSMetadataCollection extends 
OMRSMetadataCollection
                                                                                
     TypeDefKnownException,
                                                                                
     TypeDefConflictException,
                                                                                
     InvalidTypeDefException,
+                                                                               
     FunctionNotSupportedException,
                                                                                
     UserNotAuthorizedException
     {
+        final String methodName = "addAttributeTypeDef";
+
+        validateRepository(methodName);
+        repositoryValidator.validateUserId(repositoryName, userId, methodName);
+
         realMetadataCollection.addAttributeTypeDef(userId, 
newAttributeTypeDef);
 
         if (localRepositoryContentManager != null)
         {
-            localRepositoryContentManager.addAttributeTypeDef(sourceName, 
newAttributeTypeDef);
+            localRepositoryContentManager.addAttributeTypeDef(repositoryName, 
newAttributeTypeDef);
         }
 
         if (outboundRepositoryEventProcessor != null)
         {
-            
outboundRepositoryEventProcessor.processNewAttributeTypeDefEvent(sourceName,
+            
outboundRepositoryEventProcessor.processNewAttributeTypeDefEvent(repositoryName,
                                                                              
metadataCollectionId,
                                                                              
localServerName,
                                                                              
localServerType,
@@ -469,6 +585,11 @@ public class LocalOMRSMetadataCollection extends 
OMRSMetadataCollection
                                                            
InvalidTypeDefException,
                                                            
UserNotAuthorizedException
     {
+        final String methodName = "verifyTypeDef";
+
+        validateRepository(methodName);
+        repositoryValidator.validateUserId(repositoryName, userId, methodName);
+
         return realMetadataCollection.verifyTypeDef(userId, typeDef);
     }
 
@@ -495,6 +616,11 @@ public class LocalOMRSMetadataCollection extends 
OMRSMetadataCollection
                                                                                
       InvalidTypeDefException,
                                                                                
       UserNotAuthorizedException
     {
+        final String methodName = "verifyAttributeTypeDef";
+
+        validateRepository(methodName);
+        repositoryValidator.validateUserId(repositoryName, userId, methodName);
+
         return realMetadataCollection.verifyAttributeTypeDef(userId, 
attributeTypeDef);
     }
 
@@ -512,6 +638,7 @@ public class LocalOMRSMetadataCollection extends 
OMRSMetadataCollection
      * @throws TypeDefNotKnownException - the requested TypeDef is not found 
in the metadata collection.
      * @throws PatchErrorException - the TypeDef can not be updated because 
the supplied patch is incompatible
      *                               with the stored TypeDef.
+     * @throws FunctionNotSupportedException - the repository does not support 
this call.
      * @throws UserNotAuthorizedException - the userId is not permitted to 
perform this operation.
      */
     public TypeDef updateTypeDef(String       userId,
@@ -519,18 +646,24 @@ public class LocalOMRSMetadataCollection extends 
OMRSMetadataCollection
                                                                    
RepositoryErrorException,
                                                                    
TypeDefNotKnownException,
                                                                    
PatchErrorException,
+                                                                   
FunctionNotSupportedException,
                                                                    
UserNotAuthorizedException
     {
+        final String methodName = "updateTypeDef";
+
+        validateRepository(methodName);
+        repositoryValidator.validateUserId(repositoryName, userId, methodName);
+
         TypeDef   updatedTypeDef = 
realMetadataCollection.updateTypeDef(userId, typeDefPatch);
 
         if (localRepositoryContentManager != null)
         {
-            localRepositoryContentManager.updateTypeDef(sourceName, 
updatedTypeDef);
+            localRepositoryContentManager.updateTypeDef(repositoryName, 
updatedTypeDef);
         }
 
         if (outboundRepositoryEventProcessor != null)
         {
-            
outboundRepositoryEventProcessor.processUpdatedTypeDefEvent(sourceName,
+            
outboundRepositoryEventProcessor.processUpdatedTypeDefEvent(repositoryName,
                                                                         
metadataCollectionId,
                                                                         
localServerName,
                                                                         
localServerType,
@@ -556,6 +689,7 @@ public class LocalOMRSMetadataCollection extends 
OMRSMetadataCollection
      * @throws TypeDefInUseException - the TypeDef can not be deleted because 
there are instances of this type in the
      *                                 the metadata collection.  These 
instances need to be purged before the
      *                                 TypeDef can be deleted.
+     * @throws FunctionNotSupportedException - the repository does not support 
this call.
      * @throws UserNotAuthorizedException - the userId is not permitted to 
perform this operation.
      */
     public void deleteTypeDef(String    userId,
@@ -564,11 +698,26 @@ public class LocalOMRSMetadataCollection extends 
OMRSMetadataCollection
                                                                     
RepositoryErrorException,
                                                                     
TypeDefNotKnownException,
                                                                     
TypeDefInUseException,
+                                                                    
FunctionNotSupportedException,
                                                                     
UserNotAuthorizedException
     {
+        final String methodName = "deleteTypeDef";
+
+        validateRepository(methodName);
+        repositoryValidator.validateUserId(repositoryName, userId, methodName);
+
         if ((obsoleteTypeDefGUID == null) || (obsoleteTypeDefName == null))
         {
-            // TODO Throw InvalidParameterException
+            OMRSErrorCode errorCode = OMRSErrorCode.NULL_TYPEDEF_IDENTIFIER;
+            String        errorMessage = errorCode.getErrorMessageId()
+                                       + errorCode.getFormattedErrorMessage();
+
+            throw new InvalidParameterException(errorCode.getHTTPErrorCode(),
+                                                this.getClass().getName(),
+                                                methodName,
+                                                errorMessage,
+                                                errorCode.getSystemAction(),
+                                                errorCode.getUserAction());
         }
 
         realMetadataCollection.deleteTypeDef(userId,
@@ -577,14 +726,14 @@ public class LocalOMRSMetadataCollection extends 
OMRSMetadataCollection
 
         if (localRepositoryContentManager != null)
         {
-            localRepositoryContentManager.deleteTypeDef(sourceName,
+            localRepositoryContentManager.deleteTypeDef(repositoryName,
                                                         obsoleteTypeDefGUID,
                                                         obsoleteTypeDefName);
         }
 
         if (outboundRepositoryEventProcessor != null)
         {
-            
outboundRepositoryEventProcessor.processDeletedTypeDefEvent(sourceName,
+            
outboundRepositoryEventProcessor.processDeletedTypeDefEvent(repositoryName,
                                                                         
metadataCollectionId,
                                                                         
localServerName,
                                                                         
localServerType,
@@ -609,6 +758,7 @@ public class LocalOMRSMetadataCollection extends 
OMRSMetadataCollection
      * @throws TypeDefInUseException - the AttributeTypeDef can not be deleted 
because there are instances of this type in the
      *                                 the metadata collection.  These 
instances need to be purged before the
      *                                 AttributeTypeDef can be deleted.
+     * @throws FunctionNotSupportedException - the repository does not support 
this call.
      * @throws UserNotAuthorizedException - the userId is not permitted to 
perform this operation.
      */
     public void deleteAttributeTypeDef(String    userId,
@@ -617,11 +767,27 @@ public class LocalOMRSMetadataCollection extends 
OMRSMetadataCollection
                                                                              
RepositoryErrorException,
                                                                              
TypeDefNotKnownException,
                                                                              
TypeDefInUseException,
+                                                                             
FunctionNotSupportedException,
                                                                              
UserNotAuthorizedException
     {
+        final String methodName = "deleteAttributeTypeDef";
+
+        validateRepository(methodName);
+        repositoryValidator.validateUserId(repositoryName, userId, methodName);
+
         if ((obsoleteTypeDefGUID == null) || (obsoleteTypeDefName == null))
         {
-            // TODO Throw InvalidParameterException
+            OMRSErrorCode errorCode = OMRSErrorCode.NULL_TYPEDEF_IDENTIFIER;
+            String        errorMessage = errorCode.getErrorMessageId()
+                                       + errorCode.getFormattedErrorMessage();
+
+            throw new InvalidParameterException(errorCode.getHTTPErrorCode(),
+                                                this.getClass().getName(),
+                                                methodName,
+                                                errorMessage,
+                                                errorCode.getSystemAction(),
+                                                errorCode.getUserAction());
+
         }
 
         realMetadataCollection.deleteAttributeTypeDef(userId,
@@ -630,14 +796,14 @@ public class LocalOMRSMetadataCollection extends 
OMRSMetadataCollection
 
         if (localRepositoryContentManager != null)
         {
-            localRepositoryContentManager.deleteAttributeTypeDef(sourceName,
+            
localRepositoryContentManager.deleteAttributeTypeDef(repositoryName,
                                                                  
obsoleteTypeDefGUID,
                                                                  
obsoleteTypeDefName);
         }
 
         if (outboundRepositoryEventProcessor != null)
         {
-            
outboundRepositoryEventProcessor.processDeletedAttributeTypeDefEvent(sourceName,
+            
outboundRepositoryEventProcessor.processDeletedAttributeTypeDefEvent(repositoryName,
                                                                                
  metadataCollectionId,
                                                                                
  localServerName,
                                                                                
  localServerType,
@@ -664,6 +830,7 @@ public class LocalOMRSMetadataCollection extends 
OMRSMetadataCollection
      *                                    the metadata collection is stored.
      * @throws TypeDefNotKnownException - the TypeDef identified by the 
original guid/name is not found
      *                                    in the metadata collection.
+     * @throws FunctionNotSupportedException - the repository does not support 
this call.
      * @throws UserNotAuthorizedException - the userId is not permitted to 
perform this operation.
      */
     public  TypeDef reIdentifyTypeDef(String     userId,
@@ -673,12 +840,27 @@ public class LocalOMRSMetadataCollection extends 
OMRSMetadataCollection
                                       String     newTypeDefName) throws 
InvalidParameterException,
                                                                         
RepositoryErrorException,
                                                                         
TypeDefNotKnownException,
+                                                                        
FunctionNotSupportedException,
                                                                         
UserNotAuthorizedException
     {
+        final String methodName = "reIdentifyTypeDef";
+
+        validateRepository(methodName);
+        repositoryValidator.validateUserId(repositoryName, userId, methodName);
+
         if ((originalTypeDefGUID == null) || (originalTypeDefName == null) ||
                  (newTypeDefGUID == null) || (newTypeDefName == null))
         {
-            // TODO Throw InvalidParameterException
+            OMRSErrorCode errorCode = OMRSErrorCode.NULL_TYPEDEF_IDENTIFIER;
+            String        errorMessage = errorCode.getErrorMessageId()
+                                       + errorCode.getFormattedErrorMessage();
+
+            throw new InvalidParameterException(errorCode.getHTTPErrorCode(),
+                                                this.getClass().getName(),
+                                                methodName,
+                                                errorMessage,
+                                                errorCode.getSystemAction(),
+                                                errorCode.getUserAction());
         }
 
         TypeDef   originalTypeDef = 
realMetadataCollection.getTypeDefByGUID(userId, originalTypeDefGUID);
@@ -691,7 +873,7 @@ public class LocalOMRSMetadataCollection extends 
OMRSMetadataCollection
 
         if (localRepositoryContentManager != null)
         {
-            localRepositoryContentManager.reIdentifyTypeDef(sourceName,
+            localRepositoryContentManager.reIdentifyTypeDef(repositoryName,
                                                             
originalTypeDefGUID,
                                                             
originalTypeDefName,
                                                             newTypeDef);
@@ -699,7 +881,7 @@ public class LocalOMRSMetadataCollection extends 
OMRSMetadataCollection
 
         if (outboundRepositoryEventProcessor != null)
         {
-            
outboundRepositoryEventProcessor.processReIdentifiedTypeDefEvent(sourceName,
+            
outboundRepositoryEventProcessor.processReIdentifiedTypeDefEvent(repositoryName,
                                                                              
metadataCollectionId,
                                                                              
localServerName,
                                                                              
localServerType,
@@ -728,6 +910,7 @@ public class LocalOMRSMetadataCollection extends 
OMRSMetadataCollection
      *                                    the metadata collection is stored.
      * @throws TypeDefNotKnownException - the AttributeTypeDef identified by 
the original guid/name is not
      *                                    found in the metadata collection.
+     * @throws FunctionNotSupportedException - the repository does not support 
this call.
      * @throws UserNotAuthorizedException - the userId is not permitted to 
perform this operation.
      */
     public  AttributeTypeDef reIdentifyAttributeTypeDef(String     userId,
@@ -737,12 +920,27 @@ public class LocalOMRSMetadataCollection extends 
OMRSMetadataCollection
                                                         String     
newAttributeTypeDefName) throws InvalidParameterException,
                                                                                
                    RepositoryErrorException,
                                                                                
                    TypeDefNotKnownException,
+                                                                               
                    FunctionNotSupportedException,
                                                                                
                    UserNotAuthorizedException
     {
+        final String methodName = "reIdentifyAttributeTypeDef";
+
+        validateRepository(methodName);
+        repositoryValidator.validateUserId(repositoryName, userId, methodName);
+
         if ((originalAttributeTypeDefGUID == null) || 
(originalAttributeTypeDefName == null) ||
                  (newAttributeTypeDefGUID == null) || (newAttributeTypeDefName 
== null))
         {
-            // TODO Throw InvalidParameterException
+            OMRSErrorCode errorCode = OMRSErrorCode.NULL_TYPEDEF_IDENTIFIER;
+            String        errorMessage = errorCode.getErrorMessageId()
+                                       + errorCode.getFormattedErrorMessage();
+
+            throw new InvalidParameterException(errorCode.getHTTPErrorCode(),
+                                                this.getClass().getName(),
+                                                methodName,
+                                                errorMessage,
+                                                errorCode.getSystemAction(),
+                                                errorCode.getUserAction());
         }
 
         AttributeTypeDef   originalAttributeTypeDef = 
realMetadataCollection.getAttributeTypeDefByGUID(userId, 
originalAttributeTypeDefGUID);
@@ -755,7 +953,7 @@ public class LocalOMRSMetadataCollection extends 
OMRSMetadataCollection
 
         if (localRepositoryContentManager != null)
         {
-            
localRepositoryContentManager.reIdentifyAttributeTypeDef(sourceName,
+            
localRepositoryContentManager.reIdentifyAttributeTypeDef(repositoryName,
                                                                      
originalAttributeTypeDefGUID,
                                                                      
originalAttributeTypeDefName,
                                                                      
newAttributeTypeDef);
@@ -763,7 +961,7 @@ public class LocalOMRSMetadataCollection extends 
OMRSMetadataCollection
 
         if (outboundRepositoryEventProcessor != null)
         {
-            
outboundRepositoryEventProcessor.processReIdentifiedAttributeTypeDefEvent(sourceName,
+            
outboundRepositoryEventProcessor.processReIdentifiedAttributeTypeDefEvent(repositoryName,
                                                                                
       metadataCollectionId,
                                                                                
       localServerName,
                                                                                
       localServerType,
@@ -798,6 +996,11 @@ public class LocalOMRSMetadataCollection extends 
OMRSMetadataCollection
                                                               
RepositoryErrorException,
                                                               
UserNotAuthorizedException
     {
+        final String methodName = "isEntityKnown";
+
+        validateRepository(methodName);
+        repositoryValidator.validateUserId(repositoryName, userId, methodName);
+
         EntityDetail   entity = realMetadataCollection.isEntityKnown(userId, 
guid);
 
         if (entity != null)
@@ -837,6 +1040,11 @@ public class LocalOMRSMetadataCollection extends 
OMRSMetadataCollection
                                                                  
EntityNotKnownException,
                                                                  
UserNotAuthorizedException
     {
+        final String methodName = "getEntitySummary";
+
+        validateRepository(methodName);
+        repositoryValidator.validateUserId(repositoryName, userId, methodName);
+
         EntitySummary  entity =  
realMetadataCollection.getEntitySummary(userId, guid);
 
         if (entity != null)
@@ -868,14 +1076,21 @@ public class LocalOMRSMetadataCollection extends 
OMRSMetadataCollection
      * @throws RepositoryErrorException - there is a problem communicating 
with the metadata repository where
      *                                 the metadata collection is stored.
      * @throws EntityNotKnownException - the requested entity instance is not 
known in the metadata collection.
+     * @throws EntityProxyOnlyException - the requested entity instance is 
only a proxy in the metadata collection.
      * @throws UserNotAuthorizedException - the userId is not permitted to 
perform this operation.
      */
     public EntityDetail getEntityDetail(String    userId,
                                         String    guid) throws 
InvalidParameterException,
                                                                
RepositoryErrorException,
                                                                
EntityNotKnownException,
+                                                               
EntityProxyOnlyException,
                                                                
UserNotAuthorizedException
     {
+        final String methodName = "getEntityDetail";
+
+        validateRepository(methodName);
+        repositoryValidator.validateUserId(repositoryName, userId, methodName);
+
         EntityDetail   entity = realMetadataCollection.getEntityDetail(userId, 
guid);
 
         if (entity != null)
@@ -904,12 +1119,13 @@ public class LocalOMRSMetadataCollection extends 
OMRSMetadataCollection
      * @param guid - String unique identifier for the entity.
      * @param asOfTime - the time used to determine which version of the 
entity that is desired.
      * @return EntityDetail structure.
-     * @throws InvalidParameterException - the guid or date is null.
+     * @throws InvalidParameterException - the guid or date is null or the 
date is for a future time.
      * @throws RepositoryErrorException - there is a problem communicating 
with the metadata repository where
      *                                 the metadata collection is stored.
      * @throws EntityNotKnownException - the requested entity instance is not 
known in the metadata collection
      *                                   at the time requested.
-     * @throws PropertyErrorException - the asOfTime property is for a future 
time
+     * @throws EntityProxyOnlyException - the requested entity instance is 
only a proxy in the metadata collection.
+     * @throws FunctionNotSupportedException - the repository does not support 
the asOfTime parameter.
      * @throws UserNotAuthorizedException - the userId is not permitted to 
perform this operation.
      */
     public  EntityDetail getEntityDetail(String    userId,
@@ -917,49 +1133,16 @@ public class LocalOMRSMetadataCollection extends 
OMRSMetadataCollection
                                          Date      asOfTime) throws 
InvalidParameterException,
                                                                     
RepositoryErrorException,
                                                                     
EntityNotKnownException,
-                                                                    
PropertyErrorException,
+                                                                    
EntityProxyOnlyException,
+                                                                    
FunctionNotSupportedException,
                                                                     
UserNotAuthorizedException
     {
-        EntityDetail   entity = realMetadataCollection.getEntityDetail(userId, 
guid, asOfTime);
-
-        if (entity != null)
-        {
-            /*
-             * Ensure the provenance of the entity is correctly set.  A 
repository may not support the storing of
-             * the metadata collection id in the repository (or uses null to 
mean "local").  When the entity
-             * detail is sent out, it must have its home metadata collection 
id set up.  So LocalOMRSMetadataCollection
-             * fixes up the provenance.
-             */
-            if (entity.getMetadataCollectionId() == null)
-            {
-                entity.setMetadataCollectionId(metadataCollectionId);
-                
entity.setInstanceProvenanceType(InstanceProvenanceType.LOCAL_COHORT);
-            }
-        }
-
-        return entity;
-    }
+        final String methodName = "getEntityDetail";
 
+        validateRepository(methodName);
+        repositoryValidator.validateUserId(repositoryName, userId, methodName);
 
-    /**
-     * Return the header, classifications, properties and relationships for a 
specific entity.
-     *
-     * @param userId - unique identifier for requesting user.
-     * @param guid - String unique identifier for the entity.
-     * @return EntityUniverse structure.
-     * @throws InvalidParameterException - the guid is null.
-     * @throws RepositoryErrorException - there is a problem communicating 
with the metadata repository where
-     *                                    the metadata collection is stored.
-     * @throws EntityNotKnownException - the requested entity instance is not 
known in the metadata collection.
-     * @throws UserNotAuthorizedException - the userId is not permitted to 
perform this operation.
-     */
-    public EntityUniverse getEntityUniverse(String    userId,
-                                            String    guid) throws 
InvalidParameterException,
-                                                                   
RepositoryErrorException,
-                                                                   
EntityNotKnownException,
-                                                                   
UserNotAuthorizedException
-    {
-        EntityUniverse entity = 
realMetadataCollection.getEntityUniverse(userId, guid);
+        EntityDetail   entity = realMetadataCollection.getEntityDetail(userId, 
guid, asOfTime);
 
         if (entity != null)
         {
@@ -985,6 +1168,7 @@ public class LocalOMRSMetadataCollection extends 
OMRSMetadataCollection
      *
      * @param userId - unique identifier for requesting user.
      * @param entityGUID - String unique identifier for the entity.
+     * @param relationshipTypeGUID - String GUID of the the type of 
relationship required (null for all).
      * @param fromRelationshipElement - the starting element number of the 
relationships to return.
      *                                This is used when retrieving elements
      *                                beyond the first page of results. Zero 
means start from the first element.
@@ -1005,24 +1189,33 @@ public class LocalOMRSMetadataCollection extends 
OMRSMetadataCollection
      * @throws EntityNotKnownException - the requested entity instance is not 
known in the metadata collection.
      * @throws PropertyErrorException - the sequencing property is not valid 
for the attached classifications.
      * @throws PagingErrorException - the paging/sequencing parameters are set 
up incorrectly.
-     * @throws UserNotAuthorizedException - the userId is not permitted to 
perform this operation.
-     */
-    public ArrayList<Relationship> getRelationshipsForEntity(String            
         userId,
-                                                             String            
         entityGUID,
-                                                             int               
         fromRelationshipElement,
-                                                             
ArrayList<InstanceStatus>  limitResultsByStatus,
-                                                             Date              
         asOfTime,
-                                                             String            
         sequencingProperty,
-                                                             SequencingOrder   
         sequencingOrder,
-                                                             int               
         pageSize) throws InvalidParameterException,
-                                                                               
                          RepositoryErrorException,
-                                                                               
                          EntityNotKnownException,
-                                                                               
                          PropertyErrorException,
-                                                                               
                          PagingErrorException,
-                                                                               
                          UserNotAuthorizedException
-    {
+     * @throws FunctionNotSupportedException - the repository does not support 
the asOfTime parameter.
+     * @throws UserNotAuthorizedException - the userId is not permitted to 
perform this operation.
+     */
+    public List<Relationship> getRelationshipsForEntity(String                 
    userId,
+                                                        String                 
    entityGUID,
+                                                        String                 
    relationshipTypeGUID,
+                                                        int                    
    fromRelationshipElement,
+                                                        List<InstanceStatus>   
    limitResultsByStatus,
+                                                        Date                   
    asOfTime,
+                                                        String                 
    sequencingProperty,
+                                                        SequencingOrder        
    sequencingOrder,
+                                                        int                    
    pageSize) throws InvalidParameterException,
+                                                                               
                     RepositoryErrorException,
+                                                                               
                     EntityNotKnownException,
+                                                                               
                     PropertyErrorException,
+                                                                               
                     PagingErrorException,
+                                                                               
                     FunctionNotSupportedException,
+                                                                               
                     UserNotAuthorizedException
+    {
+        final String methodName = "getRelationshipsForEntity";
+
+        validateRepository(methodName);
+        repositoryValidator.validateUserId(repositoryName, userId, methodName);
+
         return realMetadataCollection.getRelationshipsForEntity(userId,
                                                                 entityGUID,
+                                                                
relationshipTypeGUID,
                                                                 
fromRelationshipElement,
                                                                 
limitResultsByStatus,
                                                                 asOfTime,
@@ -1040,7 +1233,7 @@ public class LocalOMRSMetadataCollection extends 
OMRSMetadataCollection
      * @param entityTypeGUID - String unique identifier for the entity type of 
interest (null means any entity type).
      * @param matchProperties - List of entity properties to match to (null 
means match on entityTypeGUID only).
      * @param matchCriteria - Enum defining how the properties should be 
matched to the entities in the repository.
-     * @param fromEntityDetailElement - the starting element number of the 
entities to return.
+     * @param fromEntityElement - the starting element number of the entities 
to return.
      *                                This is used when retrieving elements
      *                                beyond the first page of results. Zero 
means start from the first element.
      * @param limitResultsByStatus - By default, entities in all statuses are 
returned.  However, it is possible
@@ -1063,30 +1256,37 @@ public class LocalOMRSMetadataCollection extends 
OMRSMetadataCollection
      * @throws PropertyErrorException - the properties specified are not valid 
for any of the requested types of
      *                                  entity.
      * @throws PagingErrorException - the paging/sequencing parameters are set 
up incorrectly.
-     * @throws UserNotAuthorizedException - the userId is not permitted to 
perform this operation.
-     */
-    public  ArrayList<EntityDetail> findEntitiesByProperty(String              
      userId,
-                                                           String              
      entityTypeGUID,
-                                                           InstanceProperties  
      matchProperties,
-                                                           MatchCriteria       
      matchCriteria,
-                                                           int                 
      fromEntityDetailElement,
-                                                           
ArrayList<InstanceStatus> limitResultsByStatus,
-                                                           ArrayList<String>   
      limitResultsByClassification,
-                                                           Date                
      asOfTime,
-                                                           String              
      sequencingProperty,
-                                                           SequencingOrder     
      sequencingOrder,
-                                                           int                 
      pageSize) throws InvalidParameterException,
-                                                                               
                       RepositoryErrorException,
-                                                                               
                       TypeErrorException,
-                                                                               
                       PropertyErrorException,
-                                                                               
                       PagingErrorException,
-                                                                               
                       UserNotAuthorizedException
-    {
+     * @throws FunctionNotSupportedException - the repository does not support 
the asOfTime parameter.
+     * @throws UserNotAuthorizedException - the userId is not permitted to 
perform this operation.
+     */
+    public  List<EntityDetail> findEntitiesByProperty(String                   
 userId,
+                                                      String                   
 entityTypeGUID,
+                                                      InstanceProperties       
 matchProperties,
+                                                      MatchCriteria            
 matchCriteria,
+                                                      int                      
 fromEntityElement,
+                                                      List<InstanceStatus>     
 limitResultsByStatus,
+                                                      List<String>             
 limitResultsByClassification,
+                                                      Date                     
 asOfTime,
+                                                      String                   
 sequencingProperty,
+                                                      SequencingOrder          
 sequencingOrder,
+                                                      int                      
 pageSize) throws InvalidParameterException,
+                                                                               
                  RepositoryErrorException,
+                                                                               
                  TypeErrorException,
+                                                                               
                  PropertyErrorException,
+                                                                               
                  PagingErrorException,
+                                                                               
                  FunctionNotSupportedException,
+                                                                               
                  UserNotAuthorizedException
+    {
+        final String methodName = "findEntitiesByProperty";
+
+        validateRepository(methodName);
+        repositoryValidator.validateUserId(repositoryName, userId, methodName);
+
         return realMetadataCollection.findEntitiesByProperty(userId,
                                                              entityTypeGUID,
                                                              matchProperties,
                                                              matchCriteria,
-                                                             
fromEntityDetailElement,
+                                                             fromEntityElement,
                                                              
limitResultsByStatus,
                                                              
limitResultsByClassification,
                                                              asOfTime,
@@ -1104,7 +1304,7 @@ public class LocalOMRSMetadataCollection extends 
OMRSMetadataCollection
      * @param classificationName - name of the classification - a null is not 
valid.
      * @param matchClassificationProperties - list of classification 
properties used to narrow the search.
      * @param matchCriteria - Enum defining how the properties should be 
matched to the classifications in the repository.
-     * @param fromEntityDetailElement - the starting element number of the 
entities to return.
+     * @param fromEntityElement - the starting element number of the entities 
to return.
      *                                This is used when retrieving elements
      *                                beyond the first page of results. Zero 
means start from the first element.
      * @param limitResultsByStatus - By default, entities in all statuses are 
returned.  However, it is possible
@@ -1127,36 +1327,43 @@ public class LocalOMRSMetadataCollection extends 
OMRSMetadataCollection
      * @throws PropertyErrorException - the properties specified are not valid 
for the requested type of
      *                                  classification.
      * @throws PagingErrorException - the paging/sequencing parameters are set 
up incorrectly.
-     * @throws UserNotAuthorizedException - the userId is not permitted to 
perform this operation.
-     */
-    public  ArrayList<EntityDetail> findEntitiesByClassification(String        
            userId,
-                                                                 String        
            entityTypeGUID,
-                                                                 String        
            classificationName,
-                                                                 
InstanceProperties        matchClassificationProperties,
-                                                                 MatchCriteria 
            matchCriteria,
-                                                                 
ArrayList<InstanceStatus> limitResultsByStatus,
-                                                                 Date          
            asOfTime,
-                                                                 String        
            sequencingProperty,
-                                                                 
SequencingOrder           sequencingOrder,
-                                                                 int           
            fromEntityDetailElement,
-                                                                 int           
            pageSize) throws InvalidParameterException,
-                                                                               
                             RepositoryErrorException,
-                                                                               
                             TypeErrorException,
-                                                                               
                             ClassificationErrorException,
-                                                                               
                             PropertyErrorException,
-                                                                               
                             PagingErrorException,
-                                                                               
                             UserNotAuthorizedException
+     * @throws FunctionNotSupportedException - the repository does not support 
the asOfTime parameter.
+     * @throws UserNotAuthorizedException - the userId is not permitted to 
perform this operation.
+     */
+    public  List<EntityDetail> findEntitiesByClassification(String             
       userId,
+                                                            String             
       entityTypeGUID,
+                                                            String             
       classificationName,
+                                                            InstanceProperties 
       matchClassificationProperties,
+                                                            MatchCriteria      
       matchCriteria,
+                                                            int                
       fromEntityElement,
+                                                            
List<InstanceStatus>      limitResultsByStatus,
+                                                            Date               
       asOfTime,
+                                                            String             
       sequencingProperty,
+                                                            SequencingOrder    
       sequencingOrder,
+                                                            int                
       pageSize) throws InvalidParameterException,
+                                                                               
                        RepositoryErrorException,
+                                                                               
                        TypeErrorException,
+                                                                               
                        ClassificationErrorException,
+                                                                               
                        PropertyErrorException,
+                                                                               
                        PagingErrorException,
+                                                                               
                        FunctionNotSupportedException,
+                                                                               
                        UserNotAuthorizedException
     {
+        final String methodName = "findEntitiesByClassification";
+
+        validateRepository(methodName);
+        repositoryValidator.validateUserId(repositoryName, userId, methodName);
+
         return realMetadataCollection.findEntitiesByClassification(userId,
                                                                    
entityTypeGUID,
                                                                    
classificationName,
                                                                    
matchClassificationProperties,
                                                                    
matchCriteria,
+                                                                   
fromEntityElement,
                                                                    
limitResultsByStatus,
                                                                    asOfTime,
                                                                    
sequencingProperty,
                                                                    
sequencingOrder,
-                                                                   
fromEntityDetailElement,
                                                                    pageSize);
     }
 
@@ -1166,7 +1373,7 @@ public class LocalOMRSMetadataCollection extends 
OMRSMetadataCollection
      *
      * @param userId - unique identifier for requesting user.
      * @param searchCriteria - String expression of the characteristics of the 
required relationships.
-     * @param fromEntityDetailElement - the starting element number of the 
entities to return.
+     * @param fromEntityElement - the starting element number of the entities 
to return.
      *                                This is used when retrieving elements
      *                                beyond the first page of results. Zero 
means start from the first element.
      * @param limitResultsByStatus - By default, entities in all statuses are 
returned.  However, it is possible
@@ -1187,25 +1394,32 @@ public class LocalOMRSMetadataCollection extends 
OMRSMetadataCollection
      * @throws PropertyErrorException - the sequencing property specified is 
not valid for any of the requested types of
      *                                  entity.
      * @throws PagingErrorException - the paging/sequencing parameters are set 
up incorrectly.
-     * @throws UserNotAuthorizedException - the userId is not permitted to 
perform this operation.
-     */
-    public  ArrayList<EntityDetail> searchForEntities(String                   
       userId,
-                                                      String                   
       searchCriteria,
-                                                      int                      
       fromEntityDetailElement,
-                                                      
ArrayList<InstanceStatus>       limitResultsByStatus,
-                                                      ArrayList<String>        
       limitResultsByClassification,
-                                                      Date                     
       asOfTime,
-                                                      String                   
       sequencingProperty,
-                                                      SequencingOrder          
       sequencingOrder,
-                                                      int                      
       pageSize) throws InvalidParameterException,
-                                                                               
                        RepositoryErrorException,
-                                                                               
                        PropertyErrorException,
-                                                                               
                        PagingErrorException,
-                                                                               
                        UserNotAuthorizedException
+     * @throws FunctionNotSupportedException - the repository does not support 
the asOfTime parameter.
+     * @throws UserNotAuthorizedException - the userId is not permitted to 
perform this operation.
+     */
+    public  List<EntityDetail> searchForEntities(String                     
userId,
+                                                 String                     
searchCriteria,
+                                                 int                        
fromEntityElement,
+                                                 List<InstanceStatus>       
limitResultsByStatus,
+                                                 List<String>               
limitResultsByClassification,
+                                                 Date                       
asOfTime,
+                                                 String                     
sequencingProperty,
+                                                 SequencingOrder            
sequencingOrder,
+                                                 int                        
pageSize) throws InvalidParameterException,
+                                                                               
              RepositoryErrorException,
+                                                                               
              PropertyErrorException,
+                                                                               
              PagingErrorException,
+                                                                               
              FunctionNotSupportedException,
+                                                                               
              UserNotAuthorizedException
     {
+        final String methodName = "searchForEntities";
+
+        validateRepository(methodName);
+        repositoryValidator.validateUserId(repositoryName, userId, methodName);
+
         return realMetadataCollection.searchForEntities(userId,
                                                         searchCriteria,
-                                                        
fromEntityDetailElement,
+                                                        fromEntityElement,
                                                         limitResultsByStatus,
                                                         
limitResultsByClassification,
                                                         asOfTime,
@@ -1231,6 +1445,11 @@ public class LocalOMRSMetadataCollection extends 
OMRSMetadataCollection
                                                                     
RepositoryErrorException,
                                                                     
UserNotAuthorizedException
     {
+        final String methodName = "isRelationshipKnown";
+
+        validateRepository(methodName);
+        repositoryValidator.validateUserId(repositoryName, userId, methodName);
+
         return realMetadataCollection.isRelationshipKnown(userId, guid);
     }
 
@@ -1254,6 +1473,11 @@ public class LocalOMRSMetadataCollection extends 
OMRSMetadataCollection
                                                                
RelationshipNotKnownException,
                                                                
UserNotAuthorizedException
     {
+        final String methodName = "getRelationship";
+
+        validateRepository(methodName);
+        repositoryValidator.validateUserId(repositoryName, userId, methodName);
+
         return realMetadataCollection.getRelationship(userId, guid);
     }
 
@@ -1264,13 +1488,13 @@ public class LocalOMRSMetadataCollection extends 
OMRSMetadataCollection
      * @param userId - unique identifier for requesting user.
      * @param guid - String unique identifier for the relationship.
      * @param asOfTime - the time used to determine which version of the 
entity that is desired.
-     * @return EntityDetail structure.
-     * @throws InvalidParameterException - the guid or date is null.
+     * @return Relationship structure.
+     * @throws InvalidParameterException - the guid or date is null or the 
date is for a future time.
      * @throws RepositoryErrorException - there is a problem communicating 
with the metadata repository where
      *                                 the metadata collection is stored.
      * @throws RelationshipNotKnownException - the requested entity instance 
is not known in the metadata collection
      *                                   at the time requested.
-     * @throws PropertyErrorException - the asOfTime property is for a future 
time.
+     * @throws FunctionNotSupportedException - the repository does not support 
the asOfTime parameter.
      * @throws UserNotAuthorizedException - the userId is not permitted to 
perform this operation.
      */
     public  Relationship getRelationship(String    userId,
@@ -1278,9 +1502,14 @@ public class LocalOMRSMetadataCollection extends 
OMRSMetadataCollection
                                          Date      asOfTime) throws 
InvalidParameterException,
                                                                     
RepositoryErrorException,
                                                                     
RelationshipNotKnownException,
-                                                                    
PropertyErrorException,
+                                                                    
FunctionNotSupportedException,
                                                                     
UserNotAuthorizedException
     {
+        final String methodName = "getRelationship";
+
+        validateRepository(methodName);
+        repositoryValidator.validateUserId(repositoryName, userId, methodName);
+
         return realMetadataCollection.getRelationship(userId, guid, asOfTime);
     }
 
@@ -1293,7 +1522,7 @@ public class LocalOMRSMetadataCollection extends 
OMRSMetadataCollection
      * @param relationshipTypeGUID - unique identifier (guid) for the new 
relationship's type.
      * @param matchProperties - list of  properties used to narrow the search.
      * @param matchCriteria - Enum defining how the properties should be 
matched to the relationships in the repository.
-     * @param fromEntityDetailElement - the starting element number of the 
entities to return.
+     * @param fromRelationshipElement - the starting element number of the 
entities to return.
      *                                This is used when retrieving elements
      *                                beyond the first page of results. Zero 
means start from the first element.
      * @param limitResultsByStatus - By default, relationships in all statuses 
are returned.  However, it is possible
@@ -1315,29 +1544,36 @@ public class LocalOMRSMetadataCollection extends 
OMRSMetadataCollection
      * @throws PropertyErrorException - the properties specified are not valid 
for any of the requested types of
      *                                  relationships.
      * @throws PagingErrorException - the paging/sequencing parameters are set 
up incorrectly.
+     * @throws FunctionNotSupportedException - the repository does not support 
the asOfTime parameter.
      * @throws UserNotAuthorizedException - the userId is not permitted to 
perform this operation.
      */
-    public  ArrayList<Relationship> findRelationshipsByProperty(String         
           userId,
-                                                                String         
           relationshipTypeGUID,
-                                                                
InstanceProperties        matchProperties,
-                                                                MatchCriteria  
           matchCriteria,
-                                                                int            
           fromEntityDetailElement,
-                                                                
ArrayList<InstanceStatus> limitResultsByStatus,
-                                                                Date           
           asOfTime,
-                                                                String         
           sequencingProperty,
-                                                                
SequencingOrder           sequencingOrder,
-                                                                int            
           pageSize) throws InvalidParameterException,
-                                                                               
                            RepositoryErrorException,
-                                                                               
                            TypeErrorException,
-                                                                               
                            PropertyErrorException,
-                                                                               
                            PagingErrorException,
-                                                                               
                            UserNotAuthorizedException
+    public  List<Relationship> findRelationshipsByProperty(String              
      userId,
+                                                           String              
      relationshipTypeGUID,
+                                                           InstanceProperties  
      matchProperties,
+                                                           MatchCriteria       
      matchCriteria,
+                                                           int                 
      fromRelationshipElement,
+                                                           
List<InstanceStatus>      limitResultsByStatus,
+                                                           Date                
      asOfTime,
+                                                           String              
      sequencingProperty,
+                                                           SequencingOrder     
      sequencingOrder,
+                                                           int                 
      pageSize) throws InvalidParameterException,
+                                                                               
                       RepositoryErrorException,
+                                                                               
                       TypeErrorException,
+                                                                               
                       PropertyErrorException,
+                                                                               
                       PagingErrorException,
+                                                                               
                       FunctionNotSupportedException,
+                                                                               
                       UserNotAuthorizedException
     {
+        final String methodName = "findRelationshipsByProperty";
+
+        validateRepository(methodName);
+        repositoryValidator.validateUserId(repositoryName, userId, methodName);
+
         return realMetadataCollection.findRelationshipsByProperty(userId,
                                                                   
relationshipTypeGUID,
                                                                   
matchProperties,
                                                                   
matchCriteria,
-                                                                  
fromEntityDetailElement,
+                                                                  
fromRelationshipElement,
                                                                   
limitResultsByStatus,
                                                                   asOfTime,
                                                                   
sequencingProperty,
@@ -1370,21 +1606,28 @@ public class LocalOMRSMetadataCollection extends 
OMRSMetadataCollection
      *                                  the metadata collection is stored.
      * @throws PropertyErrorException - there is a problem with one of the 
other parameters.
      * @throws PagingErrorException - the paging/sequencing parameters are set 
up incorrectly.
+     * @throws FunctionNotSupportedException - the repository does not support 
the asOfTime parameter.
      * @throws UserNotAuthorizedException - the userId is not permitted to 
perform this operation.
      */
-    public  ArrayList<Relationship> searchForRelationships(String              
      userId,
-                                                           String              
      searchCriteria,
-                                                           int                 
      fromRelationshipElement,
-                                                           
ArrayList<InstanceStatus> limitResultsByStatus,
-                                                           Date                
      asOfTime,
-                                                           String              
      sequencingProperty,
-                                                           SequencingOrder     
      sequencingOrder,
-                                                           int                 
      pageSize) throws InvalidParameterException,
-                                                                               
                       RepositoryErrorException,
-                                                                               
                       PropertyErrorException,
-                                                                               
                       PagingErrorException,
-                                                                               
                       UserNotAuthorizedException
+    public  List<Relationship> searchForRelationships(String                   
 userId,
+                                                      String                   
 searchCriteria,
+                                                      int                      
 fromRelationshipElement,
+                                                      List<InstanceStatus>     
 limitResultsByStatus,
+                                                      Date                     
 asOfTime,
+                                                      String                   
 sequencingProperty,
+                                                      SequencingOrder          
 sequencingOrder,
+                                                      int                      
 pageSize) throws InvalidParameterException,
+                                                                               
                  RepositoryErrorException,
+                                                                               
                  PropertyErrorException,
+                                                                               
                  PagingErrorException,
+                                                                               
                  FunctionNotSupportedException,
+                                                                               
                  UserNotAuthorizedException
     {
+        final String methodName = "searchForRelationships";
+
+        validateRepository(methodName);
+        repositoryValidator.validateUserId(repositoryName, userId, methodName);
+
         return realMetadataCollection.searchForRelationships(userId,
                                                              searchCriteria,
                                                              
fromRelationshipElement,
@@ -1414,18 +1657,25 @@ public class LocalOMRSMetadataCollection extends 
OMRSMetadataCollection
      * @throws EntityNotKnownException - the entity identified by either the 
startEntityGUID or the endEntityGUID
      *                                   is not found in the metadata 
collection.
      * @throws PropertyErrorException - there is a problem with one of the 
other parameters.
+     * @throws FunctionNotSupportedException - the repository does not support 
the asOfTime parameter.
      * @throws UserNotAuthorizedException - the userId is not permitted to 
perform this operation.
      */
     public  InstanceGraph getLinkingEntities(String                    userId,
                                              String                    
startEntityGUID,
                                              String                    
endEntityGUID,
-                                             ArrayList<InstanceStatus> 
limitResultsByStatus,
+                                             List<InstanceStatus>      
limitResultsByStatus,
                                              Date                      
asOfTime) throws InvalidParameterException,
                                                                                
         RepositoryErrorException,
                                                                                
         EntityNotKnownException,
                                                                                
         PropertyErrorException,
+                                                                               
         FunctionNotSupportedException,
                                                                                
         UserNotAuthorizedException
     {
+        final String methodName = "getLinkingEntities";
+
+        validateRepository(methodName);
+        repositoryValidator.validateUserId(repositoryName, userId, methodName);
+
         return realMetadataCollection.getLinkingEntities(userId,
                                                          startEntityGUID,
                                                          endEntityGUID,
@@ -1460,22 +1710,29 @@ public class LocalOMRSMetadataCollection extends 
OMRSMetadataCollection
      *                              metadata collection.
      * @throws EntityNotKnownException - the entity identified by the 
entityGUID is not found in the metadata collection.
      * @throws PropertyErrorException - there is a problem with one of the 
other parameters.
+     * @throws FunctionNotSupportedException - the repository does not support 
the asOfTime parameter.
      * @throws UserNotAuthorizedException - the userId is not permitted to 
perform this operation.
      */
-    public  InstanceGraph getEntityNeighborhood(String                    
userId,
-                                                String                    
entityGUID,
-                                                ArrayList<String>         
entityTypeGUIDs,
-                                                ArrayList<String>         
relationshipTypeGUIDs,
-                                                ArrayList<InstanceStatus> 
limitResultsByStatus,
-                                                ArrayList<String>         
limitResultsByClassification,
-                                                Date                      
asOfTime,
-                                                int                       
level) throws InvalidParameterException,
-                                                                               
         RepositoryErrorException,
-                                                                               
         TypeErrorException,
-                                                                               
         En

<TRUNCATED>

Reply via email to