public static string GetInterfaces( Extension extension, DataModel model )
 {
     var dataObject = new {
                      _foreignTable = NameHelper.GetAbsoluteModelName( extension, model )
                    };
       return Interfaces.FormatSmart( dataObject );
 }
        /// <summary>
        /// Resolves an extension model from a parsed fragment.
        /// </summary>
        /// <param name="parsedFragment"></param>
        /// <returns></returns>
        public static Typo3ExtensionGenerator.Model.Extension Resolve( Fragment parsedFragment )
        {
            string extensionKey = parsedFragment.Header.Substring(
            Keywords.DeclareExtension.Length, parsedFragment.Header.Length - Keywords.DeclareExtension.Length ).Trim();

              Typo3ExtensionGenerator.Model.Extension extension = new Typo3ExtensionGenerator.Model.Extension {
                                                                                                        Key     = extensionKey,
                                                                                                        Author  = Person.Someone,
                                                                                                        State   = "alpha",
                                                                                                        Version = "0.0.1"
                                                                                                      };

              foreach( Fragment extensionFragment in parsedFragment.Fragments ) {
            if( extensionFragment.Keyword == Keywords.ExtensionDirectives.DefineAuthor ) {
              extension.Author.Name = extensionFragment.Parameters;

            } else if( extensionFragment.Keyword == Keywords.ExtensionDirectives.DefineAuthorCompany ) {
              extension.Author.Company = extensionFragment.Parameters;

            } else if( extensionFragment.Keyword == Keywords.ExtensionDirectives.DefineAuthorEmail ) {
              extension.Author.Email = extensionFragment.Parameters;

            } else if( extensionFragment.Keyword == Keywords.Category ) {
              extension.Category = extensionFragment.Parameters;

            } else if( extensionFragment.Keyword == Keywords.Description ) {
              extension.Description = extensionFragment.Parameters;

            } else if( extensionFragment.Keyword == Keywords.Title ) {
              extension.Title = extensionFragment.Parameters;

            } else if( extensionFragment.Keyword == Keywords.ExtensionDirectives.State ) {
              extension.State = extensionFragment.Parameters;

            } else if( extensionFragment.Keyword == Keywords.ExtensionDirectives.Version ) {
              extension.Version = extensionFragment.Parameters;

            } else if( extensionFragment.Keyword == Keywords.ConfigurationDirectives.LabelHook ) {
              extension.LabelHookImplementation = extensionFragment.Parameters;
            }
              }
              extension.Configurations = ConfigurationResolver.Resolve( parsedFragment );
              extension.Models         = ModelResolver.Resolve( parsedFragment );
              extension.Modules        = ModuleResolver.Resolve( parsedFragment );
              extension.Plugins        = PluginResolver.Resolve( parsedFragment );
              extension.Repositories   = RepositoryResolver.Resolve( parsedFragment );
              extension.Requirements   = RequirementResolver.Resolve( parsedFragment );
              extension.Services       = ServiceResolver.Resolve( parsedFragment );
              extension.Tasks          = TaskResolver.Resolve( parsedFragment );

              return extension;
        }
        public static string GeneratePropertyArray( Extension extension, IDisplayType displayType, SimpleContainer.Format format )
        {
            if( displayType is RecordGroupDisplayType ) {
            RecordGroupDisplayType recordGroupDisplayType = (RecordGroupDisplayType)displayType;
            if( null != displayType.ParentModel ) {
              string absoluteModelName = NameHelper.GetAbsoluteModelName( extension, displayType.ParentModel );
              recordGroupDisplayType.Set( string.Format( "wizards.suggest.{0}.searchWholePhrase", absoluteModelName ), 1 );
              recordGroupDisplayType.Set( string.Format( "wizards.suggest.{0}.maxItemsInResultList", absoluteModelName ), 10 );
              recordGroupDisplayType.Set( string.Format( "wizards.suggest.{0}.addWhere", absoluteModelName ), string.Format( "AND {0}.sys_language_uid=0", absoluteModelName ) );
            }
            recordGroupDisplayType.Set( "internal_type", "db" );
            recordGroupDisplayType.Set( "show_thumbs", recordGroupDisplayType.ShowThumbnails );
            recordGroupDisplayType.Set( "size", recordGroupDisplayType.Lines );
            recordGroupDisplayType.Set( "selectedListStyle", recordGroupDisplayType.SelectedListStyle );
            recordGroupDisplayType.Set( "multiple", recordGroupDisplayType.AllowDuplicates );
            recordGroupDisplayType.Set( "minitems", recordGroupDisplayType.MinItems );
            recordGroupDisplayType.Set( "maxitems", recordGroupDisplayType.MaxItems );
              }

              return displayType.GeneratePropertyArray( format );
        }
 /// <summary>
 /// Constructs a ClassProxyGenerator
 /// </summary>
 /// <param name="context">The generator context.</param>
 /// <param name="subject">The extension.</param>
 public ClassProxyGenerator( Context context, Extension subject )
     : base(context, subject)
 {
 }
 /// <summary>
 /// Generate the file name to be used for the implementation of given class template.
 /// </summary>
 /// <param name="extension">The extension this class template is defined in.</param>
 /// <param name="classTemplate">The class template itself.</param>
 /// <returns>The file name to be used for the implementation of given class template.</returns>
 public string GetExtbaseImplementationFileName( Extension extension, IClassTemplate classTemplate )
 {
     Debug.Assert( classTemplate is Task );
       return NameHelper.GetTaskImplementationFileName( extension, classTemplate as Task );
 }
 /// <summary>
 /// Generates the file name for a Fluid partial.
 /// </summary>
 /// <param name="subject"></param>
 /// <param name="dataModel"></param>
 /// <returns></returns>
 public static string GetFluidPartialFileName( Extension subject, DataModel dataModel )
 {
     return String.Format( "{0}.html", UpperCamelCase( dataModel.Name ) );
 }
 /// <summary>
 /// Default constructor
 /// </summary>
 /// <param name="context">The generator context.</param>
 /// <param name="extension">The extension that is being worked on.</param>
 public ModuleGenerator( Context context, Extension extension )
     : base(context, extension)
 {
 }
 /// <summary>
 /// Default constructor
 /// </summary>
 /// <param name="context">The generator context.</param>
 /// <param name="extension">The extension.</param>
 public PluginGenerator( Context context, Extension extension )
     : base(context, extension)
 {
 }
 /// <summary>
 /// Returns a module key. Like userdownloads_import or news_m1
 /// </summary>
 /// <param name="extension"></param>
 /// <param name="module"></param>
 /// <returns></returns>
 public static string GetModuleSignature( Extension extension, Module module )
 {
     return String.Format( "{0}_{1}", extension.Key.Replace( "_", string.Empty ), module.Name.ToLower() );
 }
 /// <summary>
 /// Generates the task class name for a given task.
 /// </summary>
 /// <param name="extension"></param>
 /// <param name="task"></param>
 /// <returns></returns>
 public static string GetTaskFileName( Extension extension, Task task )
 {
     return String.Format( "{0}Task.php", UpperCamelCase( task.Name ) );
 }
 /// <summary>
 /// Generates the task file name that must be used for the implementation of a task.
 /// </summary>
 /// <param name="extension"></param>
 /// <param name="task"></param>
 /// <returns></returns>
 public static string GetTaskImplementationFileName( Extension extension, Task task )
 {
     return String.Format( "{0}{1}TaskImplementation.php", UpperCamelCase( extension.Key ), UpperCamelCase( task.Name ) );
 }
 /// <summary>
 /// Retrieves a full model name for a data model.
 /// </summary>
 /// <example>
 /// tx_downloads_domain_model_download
 /// </example>
 /// <param name="extension">The extension this data model belongs to.</param>
 /// <param name="model">The data model.</param>
 /// <returns></returns>
 public static string GetAbsoluteModelName( Extension extension, DataModel model )
 {
     return String.Format( "tx_{0}_domain_model_{1}", extension.Key.Replace( "_", string.Empty ), model.Name.ToLower() );
 }
 /// <summary>
 /// Generates the task fields class name that must be used to implement a task.
 /// </summary>
 /// <param name="extension"></param>
 /// <param name="task"></param>
 /// <returns></returns>
 public static string GetTaskFieldsImplementationClassName( Extension extension, TaskFields taskFields )
 {
     return String.Format( "{0}{1}TaskFieldsImplementation", UpperCamelCase( extension.Key ), UpperCamelCase( taskFields.Name ) );
 }
 /// <summary>
 /// Generates the task fields class name for a given task.
 /// </summary>
 /// <param name="extension"></param>
 /// <param name="task"></param>
 /// <returns></returns>
 public static string GetTaskFieldsClassName( Extension extension, TaskFields taskFields )
 {
     return String.Format( "Tx_{0}_Tasks_{1}TaskFields", UpperCamelCase( extension.Key ), UpperCamelCase( taskFields.Name ) );
 }
 /// <summary>
 /// Returns the name of a property as it should appear in a SQL column name.
 /// </summary>
 /// <param name="extension"></param>
 /// <param name="column"></param>
 /// <returns></returns>
 public static string GetSqlColumnName( Extension extension, string column )
 {
     return LowerUnderscoredCase( column );
 }
 /// <summary>
 /// Returns a plugin key. Like userdownloads_stats or news_pi1
 /// </summary>
 /// <param name="extension"></param>
 /// <param name="plugin"></param>
 /// <returns></returns>
 public static string GetPluginSignature( Extension extension, Plugin plugin )
 {
     return String.Format( "{0}_{1}", extension.Key.Replace( "_", string.Empty ), plugin.Name.ToLower() );
 }
 /// <summary>
 /// Generate the file name to be used for the implementation of given class template.
 /// </summary>
 /// <param name="extension">The extension this class template is defined in.</param>
 /// <param name="classTemplate">The class template itself.</param>
 /// <returns>The file name to be used for the implementation of given class template.</returns>
 public string GetExtbaseImplementationFileName( Extension extension, IClassTemplate classTemplate )
 {
     Debug.Assert( classTemplate is IControllerTemplate  );
       return NameHelper.GetExtbaseControllerImplementationFileName( extension, classTemplate as IControllerTemplate );
 }
 /// <summary>
 /// Constructs an ExtensionCoreGenerator.
 /// </summary>
 /// <param name="context">The generator context.</param>
 /// <param name="extension">The extension.</param>
 public ExtensionCoreGenerator( Context context, Extension extension )
     : base(context, extension)
 {
 }
 /// <summary>
 /// Constructs a new RequirementGenerator.
 /// </summary>
 /// <param name="context">The generator context.</param>
 /// <param name="extension">The extension.</param>
 public RequirementGenerator( Context context, Extension extension )
     : base(context, extension)
 {
 }
 /// <summary>
 /// Constructs a TaskGenerator
 /// </summary>
 /// <param name="context">The generator context</param>
 /// <param name="extension">The extension.</param>
 public TaskGenerator( Context context, Extension extension )
     : base(context, extension)
 {
 }
 /// <summary>
 /// Generates the ExtBase controller class name for a given plugin.
 /// </summary>
 /// <param name="extension"></param>
 /// <param name="plugin"></param>
 /// <returns></returns>
 public static string GetExtbaseControllerClassName( Extension extension, IControllerTemplate plugin )
 {
     return String.Format( "Tx_{0}_Controller_{1}Controller", UpperCamelCase( extension.Key ), UpperCamelCase( plugin.Name ) );
 }
 /// <summary>
 /// Generates the file name that must be used to implement the label hooks for this extension.
 /// </summary>
 /// <param name="extension"></param>
 /// <returns></returns>
 public static string GetLabelHooksImplementationFileName( Extension extension )
 {
     return String.Format( "{0}HooksLabelsImplementation.php", UpperCamelCase( extension.Key ) );
 }
 /// <summary>
 /// Constructs a ServiceGenerator
 /// </summary>
 /// <param name="context">The generator context</param>
 /// <param name="extension">The extension.</param>
 public ServiceGenerator( Context context, Extension extension )
     : base(context, extension)
 {
 }
 /// <summary>
 /// Generates the Extbase controller class name for a given plugin.
 /// </summary>
 /// <param name="extension"></param>
 /// <param name="plugin"></param>
 /// <returns></returns>
 public static string GetExtbaseControllerFileName( Extension extension, IControllerTemplate plugin )
 {
     return String.Format( "{0}Controller.php", UpperCamelCase( plugin.Name ) );
 }
 /// <summary>
 /// Constructs a ConfigurationFileGenerator. 
 /// </summary>
 /// <param name="context">The generator context.</param>
 /// <param name="extension">The extension that should be generated.</param>
 /// <param name="configuration">The model for the configuration that should be generated.</param>
 public ConfigurationFileGenerator( Context context, Extension extension, Typo3ExtensionGenerator.Model.Configuration.Configuration configuration )
     : base(context, extension)
 {
     Configuration = configuration;
 }
 /// <summary>
 /// Generates the ExtBase controller file name that must be used for the implementation of a controller for a given plugin.
 /// </summary>
 /// <param name="extension"></param>
 /// <param name="plugin"></param>
 /// <returns></returns>
 public static string GetExtbaseControllerImplementationFileName( Extension extension, IControllerTemplate plugin )
 {
     return String.Format( "{0}{1}ControllerImplementation.php", UpperCamelCase( extension.Key ), UpperCamelCase( plugin.Name ) );
 }
 /// <summary>
 /// Generates the ExtBase domain model class name for a given data model.
 /// </summary>
 /// <param name="extension"></param>
 /// <param name="dataModel"></param>
 /// <returns></returns>
 public static string GetExtbaseDomainModelClassName( Extension extension, DataModel dataModel )
 {
     return String.Format( "Tx_{0}_Domain_Model_{1}", UpperCamelCase( extension.Key ), UpperCamelCase( dataModel.Name ) );
 }
 /// <summary>
 /// Generates the Extbase class name for a given data model.
 /// </summary>
 /// <param name="extension"></param>
 /// <param name="dataModel"></param>
 /// <returns></returns>
 public static string GetExtbaseDomainModelFileName( Extension extension, DataModel dataModel )
 {
     return String.Format( "{0}.php", UpperCamelCase( dataModel.Name ) );
 }
 /// <summary>
 /// Default Constructor
 /// </summary>
 /// <param name="context">The generator context.</param>
 /// <param name="subject">The extension object that should be generated.</param>
 public ExtensionGenerator( Context context, Extension subject )
     : base(context, subject)
 {
 }
 /// <summary>
 /// Generates the ExtBase service file name that must be used for the implementation of a service.
 /// </summary>
 /// <param name="extension"></param>
 /// <param name="service"></param>
 /// <returns></returns>
 public static string GetExtbaseServiceImplementationFileName( Extension extension, Service service )
 {
     return String.Format( "{0}{1}ServiceImplementation.php", UpperCamelCase( extension.Key ), UpperCamelCase( service.Name ) );
 }