AddProjectModelGenerator.cs :  » Build-Systems » CruiseControl.NET » ThoughtWorks » CruiseControl » WebDashboard » Plugins » AddProject » C# / CSharp Open Source

Home
C# / CSharp Open Source
1.2.6.4 mono .net core
2.2.6.4 mono core
3.Aspect Oriented Frameworks
4.Bloggers
5.Build Systems
6.Business Application
7.Charting Reporting Tools
8.Chat Servers
9.Code Coverage Tools
10.Content Management Systems CMS
11.CRM ERP
12.Database
13.Development
14.Email
15.Forum
16.Game
17.GIS
18.GUI
19.IDEs
20.Installers Generators
21.Inversion of Control Dependency Injection
22.Issue Tracking
23.Logging Tools
24.Message
25.Mobile
26.Network Clients
27.Network Servers
28.Office
29.PDF
30.Persistence Frameworks
31.Portals
32.Profilers
33.Project Management
34.RSS RDF
35.Rule Engines
36.Script
37.Search Engines
38.Sound Audio
39.Source Control
40.SQL Clients
41.Template Engines
42.Testing
43.UML
44.Web Frameworks
45.Web Service
46.Web Testing
47.Wiki Engines
48.Windows Presentation Foundation
49.Workflows
50.XML Parsers
C# / C Sharp
C# / C Sharp by API
C# / CSharp Tutorial
C# / CSharp Open Source » Build Systems » CruiseControl.NET 
CruiseControl.NET » ThoughtWorks » CruiseControl » WebDashboard » Plugins » AddProject » AddProjectModelGenerator.cs
using System;
using ThoughtWorks.CruiseControl.Core;
using ThoughtWorks.CruiseControl.Core.Publishers;
using ThoughtWorks.CruiseControl.Core.Sourcecontrol;
using ThoughtWorks.CruiseControl.Core.Sourcecontrol.Perforce;
using ThoughtWorks.CruiseControl.Core.Tasks;
using ThoughtWorks.CruiseControl.WebDashboard.MVC;

namespace ThoughtWorks.CruiseControl.WebDashboard.Plugins.AddProject{
  //    Commented by Mike Roberts - this is in development - please contact me if you change it
//  public class AddProjectModelGenerator
//  {
//    public AddProjectModelGenerator()
//    {
//    }
//
//    public AddEditProjectModel GenerateNewProjectModel()
//    {
//      Project project = new Project();
//      // ToDo - these defaults should be set in the Project itself.
//      project.Name = "[new project]";
//      project.SourceControl = new P4();
//      project.Builder = new NAntBuilder();
//      return new AddEditProjectModel(project);
//    }
//
//    public AddEditProjectModel GenerateModelFromRequestWithNewSourceControl(IRequest request)
//    {
//      AddEditProjectModel model = GenerateModelFromRequest(request);
//
//      string type = request.GetText("Project.SourceControl");
//      if (type == null || type == "P4")
//      {
//        model.Project.SourceControl = new P4();
//      }
//      else if (type == "Cvs")
//      {
//        model.Project.SourceControl = new Cvs();
//      }
//      else
//      {
//        model.Project.SourceControl = new FileSourceControl();
//      }
//      
//      return model;
//    }
//  
//    public AddEditProjectModel GenerateModelFromRequestWithNewBuilder(IRequest request)
//    {
//      AddEditProjectModel model = GenerateModelFromRequest(request);
//
//      string type = request.GetText("Project.Builder");
//      if (type == null || type == "NAntBuilder")
//      {
//        model.Project.Builder = new NAntBuilder();
//      }
//      else 
//      {
//        model.Project.Builder = new CommandLineBuilder();
//      }
//      
//      return model;
//    }
//  
//    public AddEditProjectModel GenerateModelFromRequest(IRequest request)
//    {
//      Project project = new Project();
//
//      project.Name = request.GetText("Project.Name");
//      project.WebURL = request.GetText("Project.WebURL");
//      project.SourceControl = GenerateSourceControl(request);
//      project.Builder = GenerateBuilder(request);
//      project.ConfiguredWorkingDirectory = request.GetText("Project.ConfiguredWorkingDirectory");
//
//      MergeFilesTask mergeFilesTask = new MergeFilesTask();
//      mergeFilesTask.MergeFilesForPresentation = request.GetText("Project.Tasks.0.MergeFilesForPresentation");
//      project.Tasks = new ITask[] {mergeFilesTask};
//      project.Publishers = new IIntegrationCompletedEventHandler[] { new XmlLogPublisher() };
//
//      return new AddEditProjectModel(project);
//    }
//
//    private IBuilder GenerateBuilder(IRequest request)
//    {
//      string type = request.GetText("Project.Builder");
//      if (type == null || type == "NAntBuilder")
//      {
//        return GenerateNAntBuilder(request);
//      }
//      else
//      {
//        return GenerateCommandLineBuilder(request);
//      }
//    }
//
//    private ISourceControl GenerateSourceControl(IRequest request)
//    {
//      string type = request.GetText("Project.SourceControl");
//      if (type == null || type == "P4")
//      {
//        return GenerateP4(request);
//      }
//      else if (type == "Cvs")
//      {
//        return GenerateCvs(request);
//      }
//      else
//      {
//        return GenerateFileSourceControl(request);
//      }
//    }
//
//    private NAntBuilder GenerateNAntBuilder(IRequest request)
//    {
//      NAntBuilder builder = new NAntBuilder();
//      builder.Executable = request.GetText("Project.Builder.Executable");
//      builder.ConfiguredBaseDirectory = request.GetText("Project.Builder.BaseDirectory");
//      builder.BuildFile = request.GetText("Project.Builder.BuildFile");
//      builder.BuildArgs = request.GetText("Project.Builder.BuildArgs");
//      builder.TargetsForPresentation = request.GetText("Project.Builder.TargetsForPresentation");
//      builder.BuildTimeoutSeconds = request.GetInt("Project.Builder.BuildTimeoutSeconds", builder.BuildTimeoutSeconds);
//      return builder;
//    }
//
//    private CommandLineBuilder GenerateCommandLineBuilder(IRequest request)
//    {
//      CommandLineBuilder builder = new CommandLineBuilder();
//      builder.Executable = request.GetText("Project.Builder.Executable");
//      builder.ConfiguredBaseDirectory = request.GetText("Project.Builder.BaseDirectory");
//      builder.BuildArgs = request.GetText("Project.Builder.BuildArgs");
//      builder.BuildTimeoutSeconds = request.GetInt("Project.Builder.BuildTimeoutSeconds", builder.BuildTimeoutSeconds);
//      return builder;
//    }
//
//    private P4 GenerateP4(IRequest request)
//    {
//      P4 p4 = new P4();
//      p4.View = request.GetText("Project.SourceControl.View") == null ? "" : request.GetText("Project.SourceControl.View").Replace(Environment.NewLine, ",");
//      p4.Executable = request.GetText("Project.SourceControl.Executable");
//      p4.Client = request.GetText("Project.SourceControl.Client");
//      p4.User = request.GetText("Project.SourceControl.User");
//      p4.Port = request.GetText("Project.SourceControl.Port");
//      p4.ApplyLabel = request.GetChecked("Project.SourceControl.ApplyLabel");
//      p4.AutoGetSource = request.GetChecked("Project.SourceControl.AutoGetSource");
//      return p4;
//    }
//
//    private Cvs GenerateCvs(IRequest request)
//    {
//      Cvs cvs = new Cvs();
//      cvs.Executable = request.GetText("Project.SourceControl.Executable");
//      cvs.Timeout = request.GetInt("Project.SourceControl.Timeout", cvs.Timeout);
//      cvs.CvsRoot = request.GetText("Project.SourceControl.CvsRoot");
//      cvs.WorkingDirectory = request.GetText("Project.SourceControl.WorkingDirectory");
//      cvs.LabelOnSuccess = request.GetChecked("Project.SourceControl.LabelOnSuccess");
//      cvs.RestrictLogins = request.GetText("Project.SourceControl.RestrictLogins");
//      cvs.Branch = request.GetText("Project.SourceControl.Branch");
//      cvs.AutoGetSource = request.GetChecked("Project.SourceControl.AutoGetSource");
//      return cvs;
//    }
//
//    private FileSourceControl GenerateFileSourceControl(IRequest request)
//    {
//      FileSourceControl fileSourceControl = new FileSourceControl();
//      fileSourceControl.RepositoryRoot = request.GetText("Project.SourceControl.RepositoryRoot");
//      fileSourceControl.IgnoreMissingRoot = request.GetChecked("Project.SourceControl.IgnoreMissingRoot");
//      return fileSourceControl;
//    }
//  }
}
www.java2v.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.