def execute(self, parameters, messages):
        AddMessage('{}; {}; {};'.format(
            parameters[reproject_from_db].valueAsText,
            parameters[reproject_to_db].valueAsText,
            parameters[reproject_projection].valueAsText))
        from_db = parameters[reproject_from_db].valueAsText
        to_db = parameters[reproject_to_db].valueAsText
        projection = parameters[reproject_projection].valueAsText

        #run the functions
        Geodatabase.clean(to_db)
        if not Exists(projection):
            AddMessage('Projection file {} does not exist'.format(projection))
            return

        def foreach_layer(from_dataset_path, to_dataset_path, feature_class):
            from_feature_path = '{}/{}'.format(from_dataset_path, feature_class)
            to_feature_path = '{}/{}'.format(to_dataset_path, feature_class)
            AddMessage('Reprojecting Featureclass: {}'.format(from_feature_path))

            if Exists(to_feature_path):
                AddMessage('Skipping feature class {} because it already exists'.format(to_feature_path))
                return
            FeatureClassToFeatureClass_conversion(from_feature_path, to_dataset_path, feature_class)

        #call the create datasets function passing the foreach layer function to it
        Geodatabase.process_datasets(from_db,
            to_db,
            projection,
            foreach_layer = foreach_layer)
    def execute(self, parameters, messages):

        from_db = parameters[reproject_from_db].valueAsText
        to_db = parameters[reproject_to_db].valueAsText
        projection = parameters[reproject_projection].valueAsText
        skip_empty = parameters[reproject_skip_empty].valueAsText

        AddMessage('Tool received parameters: {}'.format(', '.join(
            [p.valueAsText for p in parameters])))

        from arcpy import env, Exists

        if skip_empty == 'true':
            env.skipEmpty = True
        else:
            env.skipEmpty = False

        #run the functions
        if not Exists(projection):
            AddMessage('Projection file {} does not exist'.format(projection))
            return

        # just set the output coordinate system and outputs
        # will be projected :)
        env.skipAttach = True
        env.outputCoordinateSystem = projection

        #call the create datasets function passing the foreach layer function to it
        Geodatabase.process_datasets(from_db, to_db, None, None, None)
    def reproject(self, from_db, to_db, projection):

        # just set the output coordinate system and outputs
        # will be projected :)
        from arcpy import env
        env.outputCoordinateSystem = projection

        #run the functions
        if not Exists(projection):
            AddMessage('Projection file {} does not exist'.format(projection))
            return

        #call the create datasets function passing the foreach layer function to it
        Geodatabase.process_datasets(from_db, to_db)
    def clip(self, from_db, to_db, projection, clip_layer):

        if not Exists(projection):
            AddMessage('Projection file {} does not exist'.format(projection))
            return
        def foreach_layer(from_dataset_path, to_dataset_path, feature_class):
            from_feature_path = '{}/{}'.format(from_dataset_path, feature_class)
            to_feature_path = '{}/{}'.format(to_dataset_path, feature_class.split('.')[-1:][0])

            Clip_analysis('{}/{}'.format(from_dataset_path, feature_class), clip_layer, to_feature_path)

        Geodatabase.process_datasets(from_db,
            to_db,
            projection,
            foreach_layer=foreach_layer)
    def execute(self, parameters, messages):
        AddMessage('{}; {}; {};'.format(
            parameters[clip_from_db].valueAsText,
            parameters[clip_to_db].valueAsText,
            parameters[clip_projection].valueAsText))
        from_db = parameters[clip_from_db].valueAsText
        to_db = parameters[clip_to_db].valueAsText
        projection = parameters[clip_projection].valueAsText
        clip_layer = parameters[clip_clip_layer].valueAsText

        #run the functions
        Geodatabase.clean(to_db)

        if not Exists(projection):
            AddMessage('Projection file {} does not exist'.format(projection))
            return
        def foreach_layer(from_dataset_path, to_dataset_path, feature_class):
            from_feature_path = '{}/{}'.format(from_dataset_path, feature_class)
            to_feature_path = '{}/{}'.format(to_dataset_path, feature_class)
            AddMessage('Copying Featureclass: {}'.format(from_feature_path))

            if Exists(to_feature_path):
                AddMessage('Skipping feature class {} because it already exists'.format(to_feature_path))
                return

            AddMessage('Clipping Featureclass: {}'.format(from_feature_path))
            Clip_analysis('{}/{}'.format(from_dataset_path, feature_class),
                clip_layer, 'in_memory/{}'.format(feature_class))
            FeatureClassToFeatureClass_conversion(
                'in_memory/{}'.format(feature_class), to_dataset_path, feature_class)
            Delete_management('in_memory/{}'.format(feature_class))

        Geodatabase.process_datasets(from_db,
            to_db,
            projection,
            foreach_layer=foreach_layer)