Parcourir la source

article stack

tags/v1.0
Robin Thoni il y a 7 ans
Parent
révision
0eb7cc253a
46 fichiers modifiés avec 1557 ajouts et 703 suppressions
  1. 3
    1
      backend/WebSem/.idea/.idea.WebSem/.idea/dataSources.local.xml
  2. 706
    308
      backend/WebSem/.idea/.idea.WebSem/.idea/workspace.xml
  3. 3
    0
      backend/WebSem/.idea/.idea.WebSem/riderModule.iml
  4. 133
    0
      backend/WebSem/Test/DataAccess/ArticlesDataAccessTest.cs
  5. 26
    0
      backend/WebSem/Test/Properties/AssemblyInfo.cs
  6. 22
    0
      backend/WebSem/Test/Test.xproj
  7. 47
    0
      backend/WebSem/Test/Tests.cs
  8. 27
    0
      backend/WebSem/Test/project.json
  9. 15
    0
      backend/WebSem/WebApiWebSem/Business/ArticlesBusiness.cs
  10. 15
    0
      backend/WebSem/WebApiWebSem/Controllers/ArticlesController.cs
  11. 0
    44
      backend/WebSem/WebApiWebSem/Controllers/ValuesController.cs
  12. 67
    0
      backend/WebSem/WebApiWebSem/DataAccess/ArticlesDataAccess.cs
  13. 27
    0
      backend/WebSem/WebApiWebSem/DataAccess/DbPediaDataAccess.cs
  14. 15
    1
      backend/WebSem/WebApiWebSem/DataAccess/Models/articles.cs
  15. 24
    0
      backend/WebSem/WebApiWebSem/DataAccess/Models/articles_fields.cs
  16. 36
    0
      backend/WebSem/WebApiWebSem/DataAccess/ModelsDbo.cs
  17. 15
    2
      backend/WebSem/WebApiWebSem/DataAccess/WsDbContext.cs
  18. 51
    4
      backend/WebSem/WebApiWebSem/DataAccess/code-from-ds/code-from-ds.json
  19. 18
    0
      backend/WebSem/WebApiWebSem/Dbo/Articles/ArticlesAddDbo.cs
  20. 18
    0
      backend/WebSem/WebApiWebSem/Dbo/Articles/ArticlesBasicDbo.cs
  21. 12
    0
      backend/WebSem/WebApiWebSem/Dbo/Articles/ArticlesDbo.cs
  22. 8
    0
      backend/WebSem/WebApiWebSem/Dbo/Articles/ArticlesEditDbo.cs
  23. 6
    0
      backend/WebSem/WebApiWebSem/Dbo/ArticlesFields/ArticlesFieldsAddDbo.cs
  24. 7
    0
      backend/WebSem/WebApiWebSem/Dbo/ArticlesFields/ArticlesFieldsDbo.cs
  25. 16
    0
      backend/WebSem/WebApiWebSem/Dbo/ArticlesFields/ArticlesFieldsEditDbo.cs
  26. 4
    0
      backend/WebSem/WebApiWebSem/Startup.cs
  27. 3
    2
      backend/WebSem/WebApiWebSem/appsettings.Development.json
  28. 2
    1
      backend/WebSem/WebApiWebSem/project.json
  29. 28
    22
      backend/WebSem/WebSem.sln
  30. 4
    4
      frontend/WebSem/README.md
  31. 25
    50
      frontend/WebSem/app/app.js
  32. 18
    0
      frontend/WebSem/app/controllers/articles.controller.js
  33. 13
    0
      frontend/WebSem/app/controllers/articlesedit.controller.js
  34. 0
    100
      frontend/WebSem/app/controllers/pkguids.controller.js
  35. 0
    87
      frontend/WebSem/app/controllers/pkguidsedit.controller.js
  36. 4
    4
      frontend/WebSem/app/index.html
  37. 26
    20
      frontend/WebSem/app/translations/en.json
  38. 4
    6
      frontend/WebSem/app/views/articles.html
  39. 13
    5
      frontend/WebSem/app/views/articlesedit.html
  40. BIN
      frontend/WebSem/favicon.ico
  41. 2
    0
      frontend/WebSem/sdk/Business/apputils.business.js
  42. 15
    0
      frontend/WebSem/sdk/Business/articles.business.js
  43. 0
    15
      frontend/WebSem/sdk/Business/pkguids.business.js
  44. 0
    0
      frontend/WebSem/sdk/DataAccess/.gitkeep
  45. 79
    0
      frontend/WebSem/sdk/DataAccess/articles.dataaccess.js
  46. 0
    27
      frontend/WebSem/sdk/DataAccess/pkguids.dataaccess.js

+ 3
- 1
backend/WebSem/.idea/.idea.WebSem/.idea/dataSources.local.xml Voir le fichier

@@ -8,7 +8,9 @@
8 8
       <case-sensitivity plain-identifiers="lower" quoted-identifiers="exact" />
9 9
       <secret-storage>master_key</secret-storage>
10 10
       <user-name>dev</user-name>
11
-      <resolve-scope>websem-project:public,dev</resolve-scope>
11
+      <introspection-schemas>websem-project:public</introspection-schemas>
12
+      <resolve-scope>websem-project:dev,public</resolve-scope>
13
+      <unqualified-resolve-schemas>websem-project:dev,public</unqualified-resolve-schemas>
12 14
     </data-source>
13 15
   </component>
14 16
 </project>

+ 706
- 308
backend/WebSem/.idea/.idea.WebSem/.idea/workspace.xml
Fichier diff supprimé car celui-ci est trop grand
Voir le fichier


+ 3
- 0
backend/WebSem/.idea/.idea.WebSem/riderModule.iml Voir le fichier

@@ -2,7 +2,10 @@
2 2
 <module type="RIDER_MODULE" version="4">
3 3
   <component name="NewModuleRootManager">
4 4
     <content url="file://$MODULE_DIR$/../..">
5
+      <sourceFolder url="file://$MODULE_DIR$/../../Test" isTestSource="false" />
5 6
       <sourceFolder url="file://$MODULE_DIR$/../../WebApiWebSem" isTestSource="false" />
7
+      <excludeFolder url="file://$MODULE_DIR$/../../Test/bin" />
8
+      <excludeFolder url="file://$MODULE_DIR$/../../Test/obj" />
6 9
       <excludeFolder url="file://$MODULE_DIR$/../../WebApiWebSem/bin" />
7 10
       <excludeFolder url="file://$MODULE_DIR$/../../WebApiWebSem/obj" />
8 11
       <excludeFolder url="file://$MODULE_DIR$/../../packages" />

+ 133
- 0
backend/WebSem/Test/DataAccess/ArticlesDataAccessTest.cs Voir le fichier

@@ -0,0 +1,133 @@
1
+using System.Collections.Generic;
2
+using Luticate2.Utils.Dbo.Result;
3
+using Luticate2.Utils.Utils;
4
+using WebApiWebSem.DataAccess;
5
+using WebApiWebSem.Dbo.Articles;
6
+using WebApiWebSem.Dbo.ArticlesFields;
7
+using Xunit;
8
+
9
+namespace Test.DataAccess
10
+{
11
+    public class ArticlesDataAccessTest
12
+    {
13
+        [Fact]
14
+        public void Test1()
15
+        {
16
+            Tests.TestRealDb<ArticlesDataAccess>(access =>
17
+            {
18
+                var res = access.AddDbo(new ArticlesAddDbo
19
+                {
20
+                    Fields = new List<ArticlesFieldsAddDbo>
21
+                    {
22
+                        new ArticlesFieldsAddDbo
23
+                        {
24
+                            Property = "deathDate",
25
+                            Type = "date/date",
26
+                            Value = "1965-01-24"
27
+                        }
28
+                    },
29
+                    Id = "Winston_Churchill",
30
+                    PictureCaption = "Winston Churchill en 1942.",
31
+                    PictureUrl = "http://commons.wikimedia.org/wiki/Special:FilePath/Sir_Winston_S_Churchill.jpg?width=300",
32
+                    Text = "Winston Churchill, né le 30 novembre 1874 au palais de Blenheim",
33
+                    Type = "person"
34
+                });
35
+                Assert.Equal(LuStatus.Success, res.Status);
36
+                Assert.Equal("Winston_Churchill", res.Data.Id);
37
+            });
38
+        }
39
+
40
+        [Fact]
41
+        public void Test2()
42
+        {
43
+            Tests.TestRealDb<ArticlesDataAccess>(access =>
44
+            {
45
+                var res = access.AddDbo(new ArticlesAddDbo
46
+                {
47
+                    Fields = new List<ArticlesFieldsAddDbo>
48
+                    {
49
+                        new ArticlesFieldsAddDbo
50
+                        {
51
+                            Property = "deathDate",
52
+                            Type = "date/date",
53
+                            Value = "1965-01-24"
54
+                        }
55
+                    },
56
+                    Id = "Winston_Churchill",
57
+                    PictureCaption = "Winston Churchill en 1942.",
58
+                    PictureUrl = "http://commons.wikimedia.org/wiki/Special:FilePath/Sir_Winston_S_Churchill.jpg?width=300",
59
+                    Text = "Winston Churchill, né le 30 novembre 1874 au palais de Blenheim",
60
+                    Type = "person"
61
+                });
62
+                Assert.Equal(LuStatus.Success, res.Status);
63
+                Assert.Equal("Winston_Churchill", res.Data.Id);
64
+
65
+                var resGet = access.GetSingleById("Winston_Churchill");
66
+                Assert.Equal(LuStatus.Success, resGet.Status);
67
+                Assert.Equal("Winston_Churchill", resGet.Data.Id);
68
+                Assert.Equal(1, resGet.Data.Fields.Count);
69
+                Assert.Equal("deathDate", resGet.Data.Fields[0].Property);
70
+            });
71
+        }
72
+
73
+        [Fact]
74
+        public void Test3()
75
+        {
76
+            Tests.TestRealDb<ArticlesDataAccess>(access =>
77
+            {
78
+                var res = access.AddDbo(new ArticlesAddDbo
79
+                {
80
+                    Fields = new List<ArticlesFieldsAddDbo>
81
+                    {
82
+                        new ArticlesFieldsAddDbo
83
+                        {
84
+                            Property = "deathDate",
85
+                            Type = "date/date",
86
+                            Value = "1965-01-24"
87
+                        }
88
+                    },
89
+                    Id = "Winston_Churchill",
90
+                    PictureCaption = "Winston Churchill en 1942.",
91
+                    PictureUrl = "http://commons.wikimedia.org/wiki/Special:FilePath/Sir_Winston_S_Churchill.jpg?width=300",
92
+                    Text = "Winston Churchill, né le 30 novembre 1874 au palais de Blenheim",
93
+                    Type = "person"
94
+                });
95
+                Assert.Equal(LuStatus.Success, res.Status);
96
+                Assert.Equal("Winston_Churchill", res.Data.Id);
97
+
98
+
99
+                var resEdit = access.EditSingleByIdDbo("Winston_Churchill", new ArticlesEditDbo
100
+                {
101
+                    Fields = new List<ArticlesFieldsEditDbo>
102
+                    {
103
+                        new ArticlesFieldsAddDbo
104
+                        {
105
+                            Property = "deathDate",
106
+                            Type = "date/date",
107
+                            Value = "1965-01-25"
108
+                        }
109
+                    },
110
+                    PictureCaption = "Test.",
111
+                    PictureUrl = "http://commons.wikimedia.org/wiki/Special:FilePath/Sir_Winston_S_Churchill.jpg?width=300",
112
+                    Text = "Winston Churchill, né le 30 novembre 1874 au palais de Blenheim"
113
+                });
114
+                Assert.Equal(null, resEdit.Exception);
115
+                Assert.Equal(LuStatus.Success, resEdit.Status);
116
+                Assert.Equal("Winston_Churchill", resEdit.Data.Id);
117
+                Assert.Equal("Test.", resEdit.Data.PictureCaption);
118
+                Assert.Equal(1, resEdit.Data.Fields.Count);
119
+                Assert.Equal("deathDate", resEdit.Data.Fields[0].Property);
120
+                Assert.Equal("1965-01-25", resEdit.Data.Fields[0].Value);
121
+
122
+
123
+
124
+                var resGet = access.GetSingleById("Winston_Churchill");
125
+                Assert.Equal(LuStatus.Success, resGet.Status);
126
+                Assert.Equal("Winston_Churchill", resGet.Data.Id);
127
+                Assert.Equal(1, resGet.Data.Fields.Count);
128
+                Assert.Equal("deathDate", resGet.Data.Fields[0].Property);
129
+                Assert.Equal("1965-01-25", resGet.Data.Fields[0].Value);
130
+            });
131
+        }
132
+    }
133
+}

+ 26
- 0
backend/WebSem/Test/Properties/AssemblyInfo.cs Voir le fichier

@@ -0,0 +1,26 @@
1
+using System.Reflection;
2
+using System.Runtime.CompilerServices;
3
+using System.Runtime.InteropServices;
4
+
5
+// General Information about an assembly is controlled through the following
6
+// set of attributes. Change these attribute values to modify the information
7
+// associated with an assembly.
8
+
9
+[assembly: AssemblyTitle("Test")]
10
+[assembly: AssemblyDescription("")]
11
+[assembly: AssemblyConfiguration("")]
12
+[assembly: AssemblyCompany("")]
13
+[assembly: AssemblyProduct("Test")]
14
+[assembly: AssemblyCopyright("Copyright ©  2017")]
15
+[assembly: AssemblyTrademark("")]
16
+[assembly: AssemblyCulture("")]
17
+
18
+// Setting ComVisible to false makes the types in this assembly not visible
19
+// to COM components.  If you need to access a type in this assembly from
20
+// COM, set the ComVisible attribute to true on that type.
21
+
22
+[assembly: ComVisible(false)]
23
+
24
+// The following GUID is for the ID of the typelib if this project is exposed to COM
25
+
26
+[assembly: Guid("E50B4EB1-252E-41AC-ADC1-E42805810777")]

+ 22
- 0
backend/WebSem/Test/Test.xproj Voir le fichier

@@ -0,0 +1,22 @@
1
+<?xml version="1.0" encoding="utf-8"?>
2
+<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3
+  <PropertyGroup>
4
+    <VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">14.0</VisualStudioVersion>
5
+    <VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
6
+  </PropertyGroup>
7
+
8
+  <Import Project="$(VSToolsPath)\DotNet\Microsoft.DotNet.Props" Condition="'$(VSToolsPath)' != ''" />
9
+  <PropertyGroup Label="Globals">
10
+    <ProjectGuid>{E50B4EB1-252E-41AC-ADC1-E42805810777}</ProjectGuid>
11
+    <ProjectTypeGuids>{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}</ProjectTypeGuids>
12
+    <RootNamespace>Test</RootNamespace>
13
+    <BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)'=='' ">.\obj</BaseIntermediateOutputPath>
14
+    <OutputPath Condition="'$(OutputPath)'=='' ">.\bin\</OutputPath>
15
+    <TargetFrameworkVersion>v4.5.1</TargetFrameworkVersion>
16
+  </PropertyGroup>
17
+
18
+  <PropertyGroup>
19
+    <SchemaVersion>2.0</SchemaVersion>
20
+  </PropertyGroup>
21
+  <Import Project="$(VSToolsPath)\DotNet\Microsoft.DotNet.targets" Condition="'$(VSToolsPath)' != ''" />
22
+</Project>

+ 47
- 0
backend/WebSem/Test/Tests.cs Voir le fichier

@@ -0,0 +1,47 @@
1
+using System;
2
+using Luticate2.Utils.DataAccess;
3
+using Microsoft.EntityFrameworkCore;
4
+using Microsoft.Extensions.DependencyInjection;
5
+using WebApiWebSem.DataAccess;
6
+
7
+namespace Test
8
+{
9
+    public class Tests
10
+    {
11
+        public const string RealDbConnectionString =
12
+            "User ID=dev;Password=dev;Host=localhost;Port=5432;Database=websem_project;Pooling=true;";
13
+
14
+        public static IServiceProvider BuildRealDbServiceProvider()
15
+        {
16
+            IServiceCollection serviceCollection = new ServiceCollection();
17
+            serviceCollection.AddScoped<LuEfTransactionScope>();
18
+            serviceCollection.AddTransient<ArticlesDataAccess>();
19
+            serviceCollection.AddDbContext<WsDbContext>(builder => builder.UseNpgsql(RealDbConnectionString),
20
+                ServiceLifetime.Transient);
21
+            return serviceCollection.BuildServiceProvider();
22
+        }
23
+
24
+        protected static void _TestRealDb(Action<IServiceProvider> func)
25
+        {
26
+            var serviceProvider = BuildRealDbServiceProvider();
27
+            var transactionScope = serviceProvider.GetService<LuEfTransactionScope>();
28
+            transactionScope.BeginTransaction<WsDbContext>(null);
29
+            try
30
+            {
31
+                func(serviceProvider);
32
+            }
33
+            finally
34
+            {
35
+                transactionScope.RollbackTransaction<WsDbContext>();
36
+            }
37
+        }
38
+
39
+        public static void TestRealDb<TDataAccess>(Action<TDataAccess> func)
40
+        {
41
+            _TestRealDb(provider =>
42
+            {
43
+                func(provider.GetService<TDataAccess>());
44
+            });
45
+        }
46
+    }
47
+}

+ 27
- 0
backend/WebSem/Test/project.json Voir le fichier

@@ -0,0 +1,27 @@
1
+{
2
+    "version": "1.0.0-*",
3
+    "buildOptions": {
4
+        "debugType": "portable"
5
+    },
6
+    "dependencies": {
7
+        "WebApiWebSem": "*",
8
+        "System.Runtime.Serialization.Primitives": "4.1.1",
9
+        "xunit": "2.1.0",
10
+        "dotnet-test-xunit": "1.0.0-rc2-192208-24"
11
+    },
12
+    "testRunner": "xunit",
13
+    "frameworks": {
14
+        "netcoreapp1.0": {
15
+            "dependencies": {
16
+                "Microsoft.NETCore.App": {
17
+                    "type": "platform",
18
+                    "version": "1.0.1"
19
+                }
20
+            },
21
+            "imports": [
22
+                "dotnet5.4",
23
+                "portable-net451+win8"
24
+            ]
25
+        }
26
+    }
27
+}

+ 15
- 0
backend/WebSem/WebApiWebSem/Business/ArticlesBusiness.cs Voir le fichier

@@ -0,0 +1,15 @@
1
+using Luticate2.Utils.Business;
2
+using Luticate2.Utils.Interfaces;
3
+using WebApiWebSem.DataAccess;
4
+using WebApiWebSem.Dbo.Articles;
5
+
6
+namespace WebApiWebSem.Business
7
+{
8
+    public class ArticlesBusiness : LuCrudBusiness<ArticlesDataAccess, ArticlesAddDbo, ArticlesDbo, ArticlesEditDbo, string>
9
+    {
10
+        public ArticlesBusiness(ArticlesDataAccess dataAccess, ILuNotificationsBusiness notificationsBusiness) : base(dataAccess, notificationsBusiness)
11
+        {
12
+            EntityType = "articles";
13
+        }
14
+    }
15
+}

+ 15
- 0
backend/WebSem/WebApiWebSem/Controllers/ArticlesController.cs Voir le fichier

@@ -0,0 +1,15 @@
1
+using Luticate2.Utils.Controllers;
2
+using Luticate2.Utils.Dbo.Basic;
3
+using Microsoft.Extensions.Options;
4
+using WebApiWebSem.Business;
5
+using WebApiWebSem.Dbo.Articles;
6
+
7
+namespace WebApiWebSem.Controllers
8
+{
9
+    public class ArticlesController : LuCrudController<ArticlesBusiness, ArticlesAddDbo, ArticlesDbo, ArticlesEditDbo, string>
10
+    {
11
+        public ArticlesController(ArticlesBusiness busines, IOptions<LuUtilsOptionsDbo> luUtilsOptionsDbo) : base(busines, luUtilsOptionsDbo)
12
+        {
13
+        }
14
+    }
15
+}

+ 0
- 44
backend/WebSem/WebApiWebSem/Controllers/ValuesController.cs Voir le fichier

@@ -1,44 +0,0 @@
1
-using System;
2
-using System.Collections.Generic;
3
-using System.Linq;
4
-using System.Threading.Tasks;
5
-using Microsoft.AspNetCore.Mvc;
6
-
7
-namespace WebApiWebSem.Controllers
8
-{
9
-    [Route("api/[controller]")]
10
-    public class ValuesController : Controller
11
-    {
12
-        // GET api/values
13
-        [HttpGet]
14
-        public IEnumerable<string> Get()
15
-        {
16
-            return new string[] {"value1", "value2"};
17
-        }
18
-
19
-        // GET api/values/5
20
-        [HttpGet("{id}")]
21
-        public string Get(int id)
22
-        {
23
-            return "value";
24
-        }
25
-
26
-        // POST api/values
27
-        [HttpPost]
28
-        public void Post([FromBody] string value)
29
-        {
30
-        }
31
-
32
-        // PUT api/values/5
33
-        [HttpPut("{id}")]
34
-        public void Put(int id, [FromBody] string value)
35
-        {
36
-        }
37
-
38
-        // DELETE api/values/5
39
-        [HttpDelete("{id}")]
40
-        public void Delete(int id)
41
-        {
42
-        }
43
-    }
44
-}

+ 67
- 0
backend/WebSem/WebApiWebSem/DataAccess/ArticlesDataAccess.cs Voir le fichier

@@ -0,0 +1,67 @@
1
+using System;
2
+using System.Linq;
3
+using Luticate2.Utils.DataAccess;
4
+using Microsoft.EntityFrameworkCore;
5
+using WebApiWebSem.DataAccess.Models;
6
+using WebApiWebSem.Dbo.Articles;
7
+
8
+namespace WebApiWebSem.DataAccess
9
+{
10
+    public class ArticlesDataAccess : LuEfCrudDataAccess<articles, ArticlesAddDbo, ArticlesDbo, ArticlesEditDbo, WsDbContext, string>
11
+    {
12
+        public ArticlesDataAccess(IServiceProvider serviceProvider) : base(serviceProvider)
13
+        {
14
+        }
15
+
16
+        protected override object GetId(string id)
17
+        {
18
+            return id;
19
+        }
20
+
21
+        protected override IQueryable<articles> GetGetQueryable(WsDbContext db, IQueryable<articles> table)
22
+        {
23
+            return table.Include(articles => articles.articles_fields_fk);
24
+        }
25
+
26
+        protected override DbSet<articles> GetTable(WsDbContext db)
27
+        {
28
+            return db.articles;
29
+        }
30
+
31
+        protected override articles GetModelFromTCreate(ArticlesAddDbo obj)
32
+        {
33
+            return new articles
34
+            {
35
+                id = obj.Id,
36
+                picture_caption = obj.PictureCaption,
37
+                picture_url = obj.PictureUrl,
38
+                type = obj.Type,
39
+                articles_fields_fk = obj.Fields.Select(dbo => new articles_fields
40
+                {
41
+                    property = dbo.Property,
42
+                    type = dbo.Type,
43
+                    value = dbo.Value
44
+                }).ToList(),
45
+                text = obj.Text
46
+            };
47
+        }
48
+
49
+        protected override void EditModelFromTUpdate(ArticlesEditDbo obj, articles model)
50
+        {
51
+            model.picture_caption = obj.PictureCaption;
52
+            model.picture_url = obj.PictureUrl;
53
+            model.articles_fields_fk = obj.Fields.Select(dbo => new articles_fields
54
+                {
55
+                    value = dbo.Value,
56
+                    property = dbo.Property,
57
+                    type = dbo.Type
58
+                }).ToList();
59
+            model.text = obj.Text;
60
+        }
61
+
62
+        protected override ArticlesDbo GetDboFromModel(articles model)
63
+        {
64
+            return model.ToDbo();
65
+        }
66
+    }
67
+}

+ 27
- 0
backend/WebSem/WebApiWebSem/DataAccess/DbPediaDataAccess.cs Voir le fichier

@@ -0,0 +1,27 @@
1
+using System;
2
+using VDS.RDF.Query;
3
+
4
+namespace WebApiWebSem.DataAccess
5
+{
6
+    public class DbPediaDataAccess
7
+    {
8
+        public void Query(string query)
9
+        {
10
+            var endpoint = new SparqlRemoteEndpoint(new Uri("http://dbpedia.org/sparql"), "http://dbpedia.org");
11
+
12
+            //Make a SELECT query against the Endpoint
13
+            var results = endpoint.QueryWithResultSet("SELECT DISTINCT ?Concept WHERE {[] a ?Concept} LIMIT 10");
14
+            foreach (SparqlResult result in results)
15
+            {
16
+                Console.WriteLine(result.ToString());
17
+            }
18
+
19
+            //Make a DESCRIBE query against the Endpoint
20
+//            var g = endpoint.QueryWithResultGraph("DESCRIBE ");
21
+//            foreach (var t in g.Triples)
22
+//            {
23
+//                Console.WriteLine(t.ToString());
24
+//            }
25
+        }
26
+    }
27
+}

+ 15
- 1
backend/WebSem/WebApiWebSem/DataAccess/Models/articles.cs Voir le fichier

@@ -8,9 +8,23 @@ namespace WebApiWebSem.DataAccess.Models
8 8
     public partial class articles
9 9
     {
10 10
         
11
-        public Guid id { get; set; }
11
+        public string id { get; set; }
12 12
         
13
+        public string text { get; set; }
13 14
         
15
+        public string picture_url { get; set; }
16
+        
17
+        public string picture_caption { get; set; }
18
+        
19
+        public string type { get; set; }
20
+        
21
+        public DateTime created_at { get; set; }
22
+        
23
+        public DateTime? updated_at { get; set; }
24
+        
25
+        
26
+        
27
+        public virtual IList<articles_fields> articles_fields_fk { get; set; }
14 28
         
15 29
     }
16 30
 }

+ 24
- 0
backend/WebSem/WebApiWebSem/DataAccess/Models/articles_fields.cs Voir le fichier

@@ -0,0 +1,24 @@
1
+using System;
2
+using System.Collections.Generic;
3
+using System.ComponentModel.DataAnnotations;
4
+using System.ComponentModel.DataAnnotations.Schema;
5
+
6
+namespace WebApiWebSem.DataAccess.Models
7
+{
8
+    public partial class articles_fields
9
+    {
10
+        
11
+        public string article_id { get; set; }
12
+        
13
+        public string property { get; set; }
14
+        
15
+        public string value { get; set; }
16
+        
17
+        public string type { get; set; }
18
+        
19
+        
20
+        public virtual articles fk_articles { get; set; }
21
+        
22
+        
23
+    }
24
+}

+ 36
- 0
backend/WebSem/WebApiWebSem/DataAccess/ModelsDbo.cs Voir le fichier

@@ -0,0 +1,36 @@
1
+using System.Linq;
2
+using Luticate2.Utils.Utils;
3
+using WebApiWebSem.DataAccess.Models;
4
+using WebApiWebSem.Dbo.Articles;
5
+using WebApiWebSem.Dbo.ArticlesFields;
6
+
7
+namespace WebApiWebSem.DataAccess
8
+{
9
+    public static class ModelsDbo
10
+    {
11
+        public static ArticlesFieldsDbo ToDbo(this articles_fields model)
12
+        {
13
+            return new ArticlesFieldsDbo
14
+            {
15
+                Property = model.property,
16
+                Type = model.type,
17
+                Value = model.value
18
+            };
19
+        }
20
+
21
+        public static ArticlesDbo ToDbo(this articles model)
22
+        {
23
+            return new ArticlesDbo
24
+            {
25
+                CreatedAt = model.created_at.ToDbo(),
26
+                Fields = model.articles_fields_fk.Select(fields => fields.ToDbo()).ToList(),
27
+                Id = model.id,
28
+                PictureCaption = model.picture_caption,
29
+                PictureUrl = model.picture_url,
30
+                Text = model.text,
31
+                Type = model.type,
32
+                UpdatedAt = model.updated_at.ToDbo()
33
+            };
34
+        }
35
+    }
36
+}

+ 15
- 2
backend/WebSem/WebApiWebSem/DataAccess/WsDbContext.cs Voir le fichier

@@ -16,14 +16,27 @@ namespace WebApiWebSem.DataAccess
16 16
                 .HasKey(c => new { c.id });
17 17
             
18 18
             modelBuilder.Entity<articles>()
19
-                .Property(e => e.id)
20
-                .HasDefaultValueSql("get_uuid()");
19
+                .Property(e => e.created_at)
20
+                .HasDefaultValueSql("now_utc()");
21 21
             
22 22
             
23 23
             
24
+            modelBuilder.Entity<articles_fields>()
25
+                .HasKey(c => new { c.article_id, c.property });
26
+            
27
+            
28
+            modelBuilder.Entity<articles_fields>()
29
+                .HasOne(e => e.fk_articles)
30
+                .WithMany(e => e.articles_fields_fk)
31
+                .HasForeignKey("article_id")
32
+                .HasConstraintName("articles_fields_article_id_fkey");
33
+            
34
+            
24 35
         }
25 36
         
26 37
         public virtual DbSet<articles> articles { get; set; }
27 38
         
39
+        public virtual DbSet<articles_fields> articles_fields { get; set; }
40
+        
28 41
     }
29 42
 }

+ 51
- 4
backend/WebSem/WebApiWebSem/DataAccess/code-from-ds/code-from-ds.json Voir le fichier

@@ -5,12 +5,59 @@
5 5
     "selection": {
6 6
         "tables": [
7 7
             {
8
-                "columns": [{
9
-                    "column": "id",
10
-                    "selected": true
11
-                }],
8
+                "columns": [
9
+                    {
10
+                        "column": "id",
11
+                        "selected": true
12
+                    },
13
+                    {
14
+                        "column": "text",
15
+                        "selected": true
16
+                    },
17
+                    {
18
+                        "column": "picture_url",
19
+                        "selected": true
20
+                    },
21
+                    {
22
+                        "column": "picture_caption",
23
+                        "selected": true
24
+                    },
25
+                    {
26
+                        "column": "type",
27
+                        "selected": true
28
+                    },
29
+                    {
30
+                        "column": "created_at",
31
+                        "selected": true
32
+                    },
33
+                    {
34
+                        "column": "updated_at",
35
+                        "selected": true
36
+                    }
37
+                ],
12 38
                 "table": "articles"
13 39
             },
40
+            {
41
+                "columns": [
42
+                    {
43
+                        "column": "article_id",
44
+                        "selected": true
45
+                    },
46
+                    {
47
+                        "column": "property",
48
+                        "selected": true
49
+                    },
50
+                    {
51
+                        "column": "value",
52
+                        "selected": true
53
+                    },
54
+                    {
55
+                        "column": "type",
56
+                        "selected": true
57
+                    }
58
+                ],
59
+                "table": "articles_fields"
60
+            },
14 61
             {
15 62
                 "columns": [
16 63
                     {

+ 18
- 0
backend/WebSem/WebApiWebSem/Dbo/Articles/ArticlesAddDbo.cs Voir le fichier

@@ -0,0 +1,18 @@
1
+using System.ComponentModel.DataAnnotations;
2
+using WebApiWebSem.Dbo.ArticlesFields;
3
+
4
+namespace WebApiWebSem.Dbo.Articles
5
+{
6
+    public class ArticlesAddDbo<T> : ArticlesBasicDbo<T>
7
+    {
8
+        [Required]
9
+        public string Id { get; set; }
10
+
11
+        [Required]
12
+        public string Type { get; set; }
13
+    }
14
+
15
+    public class ArticlesAddDbo : ArticlesAddDbo<ArticlesFieldsAddDbo>
16
+    {
17
+    }
18
+}

+ 18
- 0
backend/WebSem/WebApiWebSem/Dbo/Articles/ArticlesBasicDbo.cs Voir le fichier

@@ -0,0 +1,18 @@
1
+using System.Collections.Generic;
2
+using System.ComponentModel.DataAnnotations;
3
+
4
+namespace WebApiWebSem.Dbo.Articles
5
+{
6
+    public class ArticlesBasicDbo<T>
7
+    {
8
+        [Required]
9
+        public IList<T> Fields { get; set; }
10
+
11
+        [Required]
12
+        public string Text { get; set; }
13
+
14
+        public string PictureUrl { get; set; }
15
+
16
+        public string PictureCaption { get; set; }
17
+    }
18
+}

+ 12
- 0
backend/WebSem/WebApiWebSem/Dbo/Articles/ArticlesDbo.cs Voir le fichier

@@ -0,0 +1,12 @@
1
+using System;
2
+using WebApiWebSem.Dbo.ArticlesFields;
3
+
4
+namespace WebApiWebSem.Dbo.Articles
5
+{
6
+    public class ArticlesDbo : ArticlesAddDbo<ArticlesFieldsDbo>
7
+    {
8
+        public DateTime CreatedAt { get; set; }
9
+
10
+        public DateTime? UpdatedAt { get; set; }
11
+    }
12
+}

+ 8
- 0
backend/WebSem/WebApiWebSem/Dbo/Articles/ArticlesEditDbo.cs Voir le fichier

@@ -0,0 +1,8 @@
1
+using WebApiWebSem.Dbo.ArticlesFields;
2
+
3
+namespace WebApiWebSem.Dbo.Articles
4
+{
5
+    public class ArticlesEditDbo : ArticlesBasicDbo<ArticlesFieldsEditDbo>
6
+    {
7
+    }
8
+}

+ 6
- 0
backend/WebSem/WebApiWebSem/Dbo/ArticlesFields/ArticlesFieldsAddDbo.cs Voir le fichier

@@ -0,0 +1,6 @@
1
+namespace WebApiWebSem.Dbo.ArticlesFields
2
+{
3
+    public class ArticlesFieldsAddDbo : ArticlesFieldsEditDbo
4
+    {
5
+    }
6
+}

+ 7
- 0
backend/WebSem/WebApiWebSem/Dbo/ArticlesFields/ArticlesFieldsDbo.cs Voir le fichier

@@ -0,0 +1,7 @@
1
+namespace WebApiWebSem.Dbo.ArticlesFields
2
+{
3
+    public class ArticlesFieldsDbo : ArticlesFieldsAddDbo
4
+    {
5
+
6
+    }
7
+}

+ 16
- 0
backend/WebSem/WebApiWebSem/Dbo/ArticlesFields/ArticlesFieldsEditDbo.cs Voir le fichier

@@ -0,0 +1,16 @@
1
+using System.ComponentModel.DataAnnotations;
2
+
3
+namespace WebApiWebSem.Dbo.ArticlesFields
4
+{
5
+    public class ArticlesFieldsEditDbo
6
+    {
7
+        [Required]
8
+        public string Value { get; set; }
9
+
10
+        [Required]
11
+        public string Property { get; set; }
12
+
13
+        [Required]
14
+        public string Type { get; set; }
15
+    }
16
+}

+ 4
- 0
backend/WebSem/WebApiWebSem/Startup.cs Voir le fichier

@@ -6,6 +6,7 @@ using Microsoft.EntityFrameworkCore;
6 6
 using Microsoft.Extensions.Configuration;
7 7
 using Microsoft.Extensions.DependencyInjection;
8 8
 using Microsoft.Extensions.Logging;
9
+using WebApiWebSem.Business;
9 10
 using WebApiWebSem.DataAccess;
10 11
 using WebApiWebSem.Dbo;
11 12
 using WebApiWebSem.Middleware;
@@ -42,6 +43,9 @@ namespace WebApiWebSem
42 43
             var version = typeof(Startup).GetTypeInfo().Assembly.GetName().Version;
43 44
             services.AddLuticateUtils(options => options.Version = version + "-dev");
44 45
 
46
+            services.AddTransient<ArticlesBusiness>();
47
+            services.AddTransient<ArticlesDataAccess>();
48
+
45 49
             services.Configure<AppConfigDbo>(dbo =>
46 50
             {
47 51
                 dbo.SleepTime = Env.IsProduction() ? 0 : int.Parse(Configuration["SleepTime"]);

+ 3
- 2
backend/WebSem/WebApiWebSem/appsettings.Development.json Voir le fichier

@@ -9,6 +9,7 @@
9 9
         }
10 10
     },
11 11
     "ConnectionStrings": {
12
-        "default": "User ID=dev;Password=dev;Host=localhost;Port=5432;Database=websem-project;Pooling=true;ApplicationName=WebSemApiDev"
13
-    }
12
+        "default": "User ID=dev;Password=dev;Host=localhost;Port=5432;Database=websem_project;Pooling=true;ApplicationName=WebSemApiDev"
13
+    },
14
+    "SleepTime": 0
14 15
 }

+ 2
- 1
backend/WebSem/WebApiWebSem/project.json Voir le fichier

@@ -14,7 +14,8 @@
14 14
       "Microsoft.Extensions.Configuration.Json": "1.0.0",
15 15
       "Microsoft.Extensions.Logging.Console": "1.0.0",
16 16
       "Microsoft.Extensions.Logging.Debug": "1.0.0",
17
-      "Microsoft.Extensions.Options.ConfigurationExtensions": "1.0.0"
17
+      "Microsoft.Extensions.Options.ConfigurationExtensions": "1.0.0",
18
+      "dotNetRDF": "1.0.13-pre6"
18 19
   },
19 20
 
20 21
   "tools": {

+ 28
- 22
backend/WebSem/WebSem.sln Voir le fichier

@@ -1,22 +1,28 @@
1
-
2
-Microsoft Visual Studio Solution File, Format Version 12.00
3
-# Visual Studio 2013
4
-VisualStudioVersion = 12.0.0.0
5
-MinimumVisualStudioVersion = 10.0.0.1
6
-Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "WebApiWebSem", "WebApiWebSem/WebApiWebSem.xproj", "{E3E68AD5-B498-4104-9056-4601B101BC79}"
7
-EndProject
8
-Global
9
-	GlobalSection(SolutionConfigurationPlatforms) = preSolution
10
-		Debug|Any CPU = Debug|Any CPU
11
-		Release|Any CPU = Release|Any CPU
12
-	EndGlobalSection
13
-	GlobalSection(ProjectConfigurationPlatforms) = postSolution
14
-		{E3E68AD5-B498-4104-9056-4601B101BC79}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15
-		{E3E68AD5-B498-4104-9056-4601B101BC79}.Debug|Any CPU.Build.0 = Debug|Any CPU
16
-		{E3E68AD5-B498-4104-9056-4601B101BC79}.Release|Any CPU.ActiveCfg = Release|Any CPU
17
-		{E3E68AD5-B498-4104-9056-4601B101BC79}.Release|Any CPU.Build.0 = Release|Any CPU
18
-	EndGlobalSection
19
-	GlobalSection(SolutionProperties) = preSolution
20
-		HideSolutionNode = FALSE
21
-	EndGlobalSection
22
-EndGlobal
1
+
2
+Microsoft Visual Studio Solution File, Format Version 12.00
3
+# Visual Studio 2013
4
+VisualStudioVersion = 12.0.0.0
5
+MinimumVisualStudioVersion = 10.0.0.1
6
+Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "WebApiWebSem", "WebApiWebSem/WebApiWebSem.xproj", "{E3E68AD5-B498-4104-9056-4601B101BC79}"
7
+EndProject
8
+Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Test", "Test\Test.xproj", "{E50B4EB1-252E-41AC-ADC1-E42805810777}"
9
+EndProject
10
+Global
11
+	GlobalSection(SolutionConfigurationPlatforms) = preSolution
12
+		Debug|Any CPU = Debug|Any CPU
13
+		Release|Any CPU = Release|Any CPU
14
+	EndGlobalSection
15
+	GlobalSection(ProjectConfigurationPlatforms) = postSolution
16
+		{E3E68AD5-B498-4104-9056-4601B101BC79}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
17
+		{E3E68AD5-B498-4104-9056-4601B101BC79}.Debug|Any CPU.Build.0 = Debug|Any CPU
18
+		{E3E68AD5-B498-4104-9056-4601B101BC79}.Release|Any CPU.ActiveCfg = Release|Any CPU
19
+		{E3E68AD5-B498-4104-9056-4601B101BC79}.Release|Any CPU.Build.0 = Release|Any CPU
20
+		{E50B4EB1-252E-41AC-ADC1-E42805810777}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
21
+		{E50B4EB1-252E-41AC-ADC1-E42805810777}.Debug|Any CPU.Build.0 = Debug|Any CPU
22
+		{E50B4EB1-252E-41AC-ADC1-E42805810777}.Release|Any CPU.ActiveCfg = Release|Any CPU
23
+		{E50B4EB1-252E-41AC-ADC1-E42805810777}.Release|Any CPU.Build.0 = Release|Any CPU
24
+	EndGlobalSection
25
+	GlobalSection(SolutionProperties) = preSolution
26
+		HideSolutionNode = FALSE
27
+	EndGlobalSection
28
+EndGlobal

+ 4
- 4
frontend/WebSem/README.md Voir le fichier

@@ -12,10 +12,10 @@ bower install
12 12
 ```
13 13
 
14 14
 A CRUD stack is provided as an example:
15
-`app/controllers/pkguids.controller.js`  
16
-`app/controllers/pkguidsedit.controller.js`  
17
-`app/sdk/Business/pkguids.business.js`  
18
-`app/sdk/DataAccess/pkguids.dataaccess.js`
15
+`app/controllers/articles.controller.js`  
16
+`app/controllers/articlesedit.controller.js`  
17
+`app/sdk/Business/articles.business.js`  
18
+`app/sdk/DataAccess/articles.dataaccess.js`
19 19
 
20 20
 See [Luticate2-api/WebApiUtils](https://git.rthoni.com/luticate2/luticate2-api/src/master/WebApiUtils) project for the backend.
21 21
 

+ 25
- 50
frontend/WebSem/app/app.js Voir le fichier

@@ -143,56 +143,31 @@ angular.module('app', [
143 143
                 name: 'home.name',
144 144
                 type: 'heading',
145 145
                 children: [{
146
+                    id: 'link_1',
146 147
                     name: 'home.name',
147
-                    type: 'toggle',
148
-                    pages: [{
149
-                        id: 'toogle_1_link_1',
150
-                        name: 'home.name',
151
-                        state: 'home'
152
-                    }, {
153
-                        id: 'toogle_1_link_2',
154
-                        name: 'Home 1 2',
155
-                        state: 'home.1.2',
156
-                        hidden: true
157
-                    }, {
158
-                        id: 'toogle_1_link_3',
159
-                        name: 'home.name',
160
-                        state: 'home.1.3'
161
-                    }]
148
+                    state: 'home.2',
149
+                    type: 'link'
150
+                }, {
151
+                    id: 'link_1',
152
+                    name: 'home.name',
153
+                    state: 'home.2',
154
+                    type: 'link'
162 155
                 }]
163
-            }, {
164
-                id: 'link_1',
165
-                name: 'home.name',
166
-                state: 'home.2',
167
-                type: 'link',
168
-                icon: 'fa fa-check'
169
-            }, {
170
-                id: 'link_2',
171
-                name: 'home.name',
172
-                state: 'home.3',
173
-                type: 'link'
174
-            }, {
175
-                id: 'link_3',
176
-                name: 'home.name',
177
-                state: 'common.link3',
178
-                type: 'link',
179
-                hidden: true
180
-            },  {
156
+            },
157
+            {
181 158
                 id: 'toogle_2',
182
-                name: 'pkguids.name',
159
+                name: 'articles.name',
183 160
                 type: 'heading',
184 161
                 children: [{
185
-                    name: 'pkguids.name',
186
-                    type: 'toggle',
187
-                    pages: [{
188
-                        id: 'toogle_2_link_1',
189
-                        name: 'common.all',
190
-                        state: 'pkguids'
191
-                    },{
192
-                        id: 'toogle_2_link_1',
193
-                        name: 'common.new',
194
-                        state: 'pkguids_add'
195
-                    }]
162
+                    id: 'toogle_2_link_1',
163
+                    name: 'common.all',
164
+                    state: 'articles',
165
+                    type: 'link'
166
+                },{
167
+                    id: 'toogle_2_link_1',
168
+                    name: 'common.new',
169
+                    state: 'articles_add',
170
+                    type: 'link'
196 171
                 }]
197 172
             }]);
198 173
 
@@ -214,14 +189,14 @@ angular.module('app', [
214 189
                 controller:'HomeController'
215 190
             });
216 191
 
217
-            addCrudStates($stateProvider, 'pkguids');
192
+            addCrudStates($stateProvider, 'articles');
218 193
 
219 194
             $urlRouterProvider.otherwise('/');
220 195
     }])
221 196
     .run(['$rootScope', '$transitions', 'AppUtilsBusiness', 'ssSideNav', '$translate', 'luRequest', '$mdDialog',
222
-        'luNotificationsBusiness', '$mdToast', '$state', 'pkguidsBusiness',
197
+        'luNotificationsBusiness', '$mdToast', '$state', 'articlesBusiness',
223 198
         function ($rootScope, $transitions, AppUtilsBusiness, ssSideNav, $translate, luRequest, $mdDialog,
224
-                  luNotificationsBusiness, $mdToast, $state, pkguidsBusiness) {
199
+                  luNotificationsBusiness, $mdToast, $state, articlesBusiness) {
225 200
 
226 201
         AppUtilsBusiness.addApiVersionChangedCallback(function(oldVersion, newVersion) {
227 202
             $mdDialog.show(
@@ -233,9 +208,9 @@ angular.module('app', [
233 208
         });
234 209
 
235 210
         luNotificationsBusiness.init({
236
-            'pkguids': pkguidsBusiness
211
+            'articles': articlesBusiness
237 212
         });
238
-        addCrudNotifications(luNotificationsBusiness, AppUtilsBusiness, $mdToast, $state, 'pkguids');
213
+        addCrudNotifications(luNotificationsBusiness, AppUtilsBusiness, $mdToast, $state, 'articles');
239 214
 
240 215
         $translate('common.appName').then(function() {
241 216
             for (var i = 0; i < ssSideNav.sections.length; ++i) {

+ 18
- 0
frontend/WebSem/app/controllers/articles.controller.js Voir le fichier

@@ -0,0 +1,18 @@
1
+angular.module('app')
2
+    .controller('articlesController', ['$scope', '$stateParams', 'articlesBusiness', 'listControllerBuilder',
3
+        function($scope, $stateParams, articlesBusiness, listControllerBuilder) {
4
+
5
+            $scope.business = articlesBusiness;
6
+            $scope.itemType = 'articles';
7
+            $scope.defaultOrder = 'id';
8
+            listControllerBuilder.create($scope, $stateParams);
9
+
10
+            $scope.getAddItem = function()
11
+            {
12
+                return {
13
+                    title: $scope.query.filter
14
+                };
15
+            };
16
+
17
+            $scope.init();
18
+    }]);

+ 13
- 0
frontend/WebSem/app/controllers/articlesedit.controller.js Voir le fichier

@@ -0,0 +1,13 @@
1
+angular.module('app')
2
+    .controller('articlesEditController', ['$scope', '$stateParams', 'articlesBusiness', 'editControllerBuilder',
3
+        function ($scope, $stateParams, articlesBusiness, editControllerBuilder) {
4
+
5
+            $scope.business = articlesBusiness;
6
+            $scope.itemType = 'articles';
7
+            editControllerBuilder.create($scope, $stateParams);
8
+
9
+            $scope.setupExitConfirm();
10
+
11
+            $scope.init($stateParams);
12
+
13
+        }]);

+ 0
- 100
frontend/WebSem/app/controllers/pkguids.controller.js Voir le fichier

@@ -1,100 +0,0 @@
1
-angular.module('app')
2
-    .controller('pkguidsController', ['$scope', '$stateParams', 'pkguidsBusiness', 'listControllerBuilder',
3
-        function($scope, $stateParams, pkguidsBusiness, listControllerBuilder) {
4
-
5
-            $scope.business = pkguidsBusiness;
6
-            $scope.itemType = 'pkguids';
7
-            $scope.defaultOrder = 'someText';
8
-            listControllerBuilder.create($scope, $stateParams);
9
-
10
-            $scope.getAddItem = function()
11
-            {
12
-                return {
13
-                    someText: $scope.query.filter
14
-                };
15
-            };
16
-
17
-            $scope.init();
18
-
19
-            // $scope.selected = [];
20
-            //
21
-            // $scope.query = {
22
-            //     order: 'someText',
23
-            //     filter: '',
24
-            //     limit: 5,
25
-            //     page: 1
26
-            // };
27
-            //
28
-            // $scope.busy = luBusyBusiness.reset();
29
-            // $scope.appUtils = AppUtilsBusiness;
30
-            //
31
-            // $scope.isFilterShown = false;
32
-            // $scope.pkGuids = null;
33
-            //
34
-            // $scope.showFilter = function(show) {
35
-            //     $scope.isFilterShown = show;
36
-            //     if (!$scope.isFilterShown) {
37
-            //         if ($scope.query.filter != '') {
38
-            //             $scope.query.filter = '';
39
-            //             $scope.getPkGuids();
40
-            //         }
41
-            //     }
42
-            // };
43
-            //
44
-            // $scope.askRemoveOne = function (pkguid) {
45
-            //     var confirm = $mdDialog.confirm()
46
-            //         .title(AppUtilsBusiness.tr('common.confirmDelete'))
47
-            //         .textContent(AppUtilsBusiness.tr('pkguid.deleteOne', {text: pkguid.someText}))
48
-            //         .ok(AppUtilsBusiness.tr('common.delete'))
49
-            //         .cancel(AppUtilsBusiness.tr('common.cancel'));
50
-            //     $mdDialog.show(confirm).then(function() {
51
-            //         pkGuidBusiness.deleteDbo(pkguid.id, 'pkguid.table').then(function(data)
52
-            //         {
53
-            //             $scope.getPkGuids();
54
-            //         }, function(error) {});
55
-            //     }, function () {});
56
-            // };
57
-            //
58
-            // $scope.askRemoveSelected = function () {
59
-            //     var confirm = $mdDialog.confirm()
60
-            //         .title(AppUtilsBusiness.tr('common.confirmDelete'))
61
-            //         .textContent(AppUtilsBusiness.tr('pkguid.deleteMultiple', {count: $scope.selected.length}))
62
-            //         .ok(AppUtilsBusiness.tr('common.delete'))
63
-            //         .cancel(AppUtilsBusiness.tr('common.cancel'));
64
-            //     $mdDialog.show(confirm).then(function() {
65
-            //         $scope.removeFirstSelected();
66
-            //
67
-            //     }, function () {});
68
-            // };
69
-            //
70
-            // $scope.removeFirstSelected = function() {
71
-            //     if ($scope.selected.length == 0) {
72
-            //         $scope.getPkGuids();
73
-            //     }
74
-            //     else {
75
-            //         pkGuidBusiness.deleteDbo($scope.selected[0].id, 'pkguid.table')
76
-            //             .then(function(data)
77
-            //         {
78
-            //             $scope.selected = $scope.selected.splice(1);
79
-            //             $scope.removeFirstSelected();
80
-            //         }, function(error) {});
81
-            //     }
82
-            // };
83
-            //
84
-            // $scope.getPkGuids = function()
85
-            // {
86
-            //     $scope.selected = [];
87
-            //     var orderBy = AppUtilsBusiness.convertOrderBy($scope.query.order);
88
-            //     pkGuidBusiness.getMultiple(orderBy, $scope.query.filter, $scope.query.page - 1, $scope.query.limit, 'pkguid.table').then(function(data)
89
-            //     {
90
-            //         $scope.pkGuids = data;
91
-            //     }, function(error)
92
-            //     {
93
-            //         $scope.pkGuids = null;
94
-            //     });
95
-            // };
96
-            //
97
-            //
98
-            //
99
-            // $scope.getPkGuids();
100
-    }]);

+ 0
- 87
frontend/WebSem/app/controllers/pkguidsedit.controller.js Voir le fichier

@@ -1,87 +0,0 @@
1
-angular.module('app')
2
-    .controller('pkguidsEditController', ['$scope', '$stateParams', 'pkguidsBusiness', 'editControllerBuilder',
3
-        function ($scope, $stateParams, pkguidsBusiness, editControllerBuilder) {
4
-
5
-            $scope.business = pkguidsBusiness;
6
-            $scope.itemType = 'pkguids';
7
-            editControllerBuilder.create($scope, $stateParams);
8
-
9
-
10
-            $scope.setupExitConfirm();
11
-
12
-            $scope.init($stateParams);
13
-
14
-            // $scope.pkguid = null;
15
-            // $scope.defaultPkguid = {
16
-            //     id: null,
17
-            //     someText: "Test.",
18
-            //     someInt: 42
19
-            // };
20
-            //
21
-            // $scope.busy = luBusyBusiness.reset();
22
-            // $scope.appUtils = AppUtilsBusiness;
23
-            //
24
-            // $scope.setTitle = function()
25
-            // {
26
-            //     if ($scope.pkguid.id != null) {
27
-            //         AppUtilsBusiness.setTitle(AppUtilsBusiness.tr('pkguid.edit.title', {text: $scope.pkguid.someText}));
28
-            //         AppUtilsBusiness.setToolbarTitle(AppUtilsBusiness.tr('pkguid.edit.toolbarTitle', {text: $scope.pkguid.someText}));
29
-            //     }
30
-            // };
31
-            //
32
-            // $scope.submit = function () {
33
-            //     if ($scope.pkguid.id == null) {
34
-            //         pkGuidBusiness.addDbo($scope.pkguid, 'pkguid.edit').then(function (data) {
35
-            //             $scope.pkguid = data;
36
-            //             $state.go('pkguid_edit', {pkguid: $scope.pkguid, id: $scope.pkguid.id});
37
-            //         }, function (error) {});
38
-            //     }
39
-            //     else {
40
-            //         pkGuidBusiness.editSingleByIdDbo($scope.pkguid.id, $scope.pkguid, 'pkguid.edit').then(function (data) {
41
-            //             $scope.pkguid = data;
42
-            //             $scope.setTitle();
43
-            //         }, function (error) {});
44
-            //     }
45
-            // };
46
-            //
47
-            // $scope.askRemoveOne = function (pkguid) {
48
-            //     var confirm = $mdDialog.confirm()
49
-            //         .title(AppUtilsBusiness.tr('common.confirmDelete'))
50
-            //         .textContent(AppUtilsBusiness.tr('pkguid.deleteOne', {text: pkguid.someText}))
51
-            //         .ok(AppUtilsBusiness.tr('common.delete'))
52
-            //         .cancel(AppUtilsBusiness.tr('common.cancel'));
53
-            //     $mdDialog.show(confirm).then(function() {
54
-            //         pkGuidBusiness.deleteDbo(pkguid.id, 'pkguid.edit').then(function(data)
55
-            //         {
56
-            //             $state.go('pkguid');
57
-            //         }, function(error) {});
58
-            //     }, function () {});
59
-            // };
60
-            //
61
-            //
62
-            // if ($state.params != null) {
63
-            //     if ($state.params.pkguid != null) {
64
-            //         $scope.pkguid = $state.params.pkguid;
65
-            //         $scope.setTitle();
66
-            //     }
67
-            //     else if ($state.params.id != null) {
68
-            //         pkGuidBusiness.getSingleById($state.params.id, 'pkguid.edit').then(function(data)
69
-            //         {
70
-            //             $scope.pkguid = data;
71
-            //             $scope.setTitle();
72
-            //         }, function (error) {
73
-            //             $scope.pkguid = null;
74
-            //             $scope.setTitle();
75
-            //         });
76
-            //     }
77
-            //     else {
78
-            //         $scope.pkguid = angular.copy($scope.defaultPkguid);
79
-            //         $scope.setTitle();
80
-            //     }
81
-            // }
82
-            // else {
83
-            //     $scope.pkguid = angular.copy($scope.defaultPkguid);
84
-            //     $scope.setTitle();
85
-            // }
86
-
87
-        }]);

+ 4
- 4
frontend/WebSem/app/index.html Voir le fichier

@@ -60,8 +60,8 @@
60 60
     <script src="controllers/sidebar.controller.js"></script>
61 61
     <script src="controllers/toolbar.controller.js"></script>
62 62
     <script src="controllers/home.controller.js"></script>
63
-    <script src="controllers/pkguids.controller.js"></script>
64
-    <script src="controllers/pkguidsedit.controller.js"></script>
63
+    <script src="controllers/articles.controller.js"></script>
64
+    <script src="controllers/articlesedit.controller.js"></script>
65 65
 
66 66
     <!-- Modal Controller -->
67 67
 
@@ -73,8 +73,8 @@
73 73
     <script src="../sdk/Business/listcontrollerbuilder.business.js"></script>
74 74
     <script src="../sdk/Business/itemTracker.business.js"></script>
75 75
     <script src="../sdk/Business/items.business.js"></script>
76
-    <script src="../sdk/DataAccess/pkguids.dataaccess.js"></script>
77
-    <script src="../sdk/Business/pkguids.business.js"></script>
76
+    <script src="../sdk/DataAccess/articles.dataaccess.js"></script>
77
+    <script src="../sdk/Business/articles.business.js"></script>
78 78
 
79 79
     <!-- Directives -->
80 80
 

+ 26
- 20
frontend/WebSem/app/translations/en.json Voir le fichier

@@ -1,6 +1,6 @@
1 1
 {
2 2
   "common": {
3
-    "appName": "MyApp",
3
+    "appName": "WWII",
4 4
     "filter": "Search",
5 5
     "all": "All",
6 6
     "new": "New",
@@ -19,12 +19,12 @@
19 19
     "view": "View",
20 20
     "save": "Save",
21 21
     "back": "Back",
22
-    "yes": "yes",
22
+    "yes": "Yes",
23 23
     "unsavedChanged": "Unsaved data",
24 24
     "confirmDelete": "Confirm deletion",
25 25
     "confirmExit": {
26 26
       "title": "Unsaved data",
27
-      "content": "Do you really ant to leave without saving?"
27
+      "content": "Do you really want to leave without saving?"
28 28
     },
29 29
     "pagination": {
30 30
       "of": "of",
@@ -44,28 +44,34 @@
44 44
     "name": "Home",
45 45
     "welcome": "Welcome Home!"
46 46
   },
47
-  "pkguids": {
48
-    "name": "PkGuids",
49
-    "selectedItems": "{count} {count, select, 1{PkGuid} other{PkGuids}} selected",
50
-    "id": "Id",
51
-    "someText": "Some Text",
52
-    "someInt": "Some Int",
53
-    "deleteOne": "Do you really want to delete PkGuid '{text}'?",
54
-    "deleteMultiple": "Do you really want to delete {count} {count, select, 1{PkGuid} other{PkGuids}}?",
47
+  "articles": {
48
+    "name": "Articles",
49
+    "selectedItems": "{count} {count, select, 1{article} other{articles}} selected",
50
+    "title": "Title",
51
+    "type": "Type",
52
+    "text": "Abstract",
53
+    "types": {
54
+      "home": "Home page",
55
+      "persons": "Person",
56
+      "locations": "Location",
57
+      "countries": "Country"
58
+    },
59
+    "deleteOne": "Do you really want to delete article '{text}'?",
60
+    "deleteMultiple": "Do you really want to delete {count} {count, select, 1{article} other{articles}}?",
55 61
     "edit": {
56
-      "defaultTitle": "Edit PkGuid",
57
-      "defaultToolbarTitle": "PkGuid ~ Edit",
58
-      "title": "Edit PkGuid '{text}'",
59
-      "toolbarTitle": "PkGuids ~ Edit ~ {text}"
62
+      "defaultTitle": "Edit article",
63
+      "defaultToolbarTitle": "Article ~ Edit",
64
+      "title": "Edit article '{text}'",
65
+      "toolbarTitle": "Articles ~ Edit ~ {text}"
60 66
     },
61 67
     "add": {
62
-      "defaultTitle": "New PkGuid",
63
-      "defaultToolbarTitle": "PkGuids ~ New"
68
+      "defaultTitle": "New article",
69
+      "defaultToolbarTitle": "Articles ~ New"
64 70
     },
65 71
     "notifications": {
66
-      "create": "PkGuid '{text}' was added",
67
-      "update": "PkGuid '{text}' was updated",
68
-      "delete": "PkGuid '{text}' was deleted"
72
+      "create": "Article '{text}' was added",
73
+      "update": "Article '{text}' was updated",
74
+      "delete": "Article '{text}' was deleted"
69 75
     }
70 76
   }
71 77
 }

frontend/WebSem/app/views/pkguids.html → frontend/WebSem/app/views/articles.html Voir le fichier

@@ -53,9 +53,8 @@
53 53
             <table md-table md-row-select multiple ng-model="selected" >
54 54
                 <thead md-head md-order="query.order" md-on-reorder="getItems">
55 55
                 <tr md-row>
56
-                    <th md-column md-order-by="id"><span>{{ itemType + '.id' | translate }}</span></th>
57
-                    <th md-column md-order-by="someText"><span>{{ itemType + '.someText' | translate }}</span></th>
58
-                    <th md-column md-order-by="someInt" md-numeric>{{ itemType + '.someInt' | translate }}</th>
56
+                    <th md-column md-order-by="id"><span>{{ itemType + '.title' | translate }}</span></th>
57
+                    <th md-column md-order-by="type"><span>{{ itemType + '.type' | translate }}</span></th>
59 58
                     <th md-column md-order-by="createdAt">{{ 'common.createdAt' | translate }}</th>
60 59
                     <th md-column md-order-by="updatedAt">{{ 'common.updatedAt' | translate }}</th>
61 60
                     <th class="col-icon-1" md-column>{{ 'common.actions' | translate }}</th>
@@ -63,9 +62,8 @@
63 62
                 </thead>
64 63
                 <tbody md-body>
65 64
                 <tr md-row md-select="item" md-select-id="id" ng-repeat="item in items.data">
66
-                    <td md-cell>{{item.id}}</td>
67
-                    <td md-cell>{{item.someText}}</td>
68
-                    <td md-cell>{{item.someInt}}</td>
65
+                    <td md-cell>{{item.title}}</td>
66
+                    <td md-cell>{{ itemType + '.types.' + item.type | translate }}</td>
69 67
                     <td md-cell>{{item.createdAt | formatDateTime}}</td>
70 68
                     <td md-cell>{{item.updatedAt == null ? ('common.never' | translate ) : (item.updatedAt | formatDateTime)}}</td>
71 69
                     <td class="col-icon-1" md-cell>

frontend/WebSem/app/views/pkguidsedit.html → frontend/WebSem/app/views/articlesedit.html Voir le fichier

@@ -17,14 +17,22 @@
17 17
     <md-content layout-padding>
18 18
         <form name="editForm">
19 19
             <div layout-gt-sm="row">
20
-                <md-input-container class="md-block" flex-gt-sm>
21
-                    <label>{{ itemType + '.someText' | translate }}</label>
22
-                    <input required ng-model="item.someText">
20
+                <md-input-container class="md-block" flex flex-gt-sm="15">
21
+                    <label>{{ itemType + '.type' | translate }}</label>
22
+                    <md-select ng-model="item.type" required ng-readonly="item.id != null">
23
+                        <md-option ng-repeat="type in appUtils.articleTypes" ng-value="type">{{ itemType + '.types.' + type | translate }}</md-option>
24
+                    </md-select>
23 25
                 </md-input-container>
24 26
 
25 27
                 <md-input-container class="md-block" flex-gt-sm>
26
-                    <label>{{ itemType + '.someInt' | translate }}</label>
27
-                    <input required type="number" ng-model="item.someInt">
28
+                    <label>{{ itemType + '.title' | translate }}</label>
29
+                    <input required ng-model="item.title" ng-readonly="item.id != null">
30
+                </md-input-container>
31
+            </div>
32
+            <div layout-gt-sm="row">
33
+                <md-input-container class="md-block" flex-gt-sm>
34
+                    <label>{{ itemType + '.text' | translate }}</label>
35
+                    <textarea ng-model="item.text" required></textarea>
28 36
                 </md-input-container>
29 37
             </div>
30 38
             <div flex>

BIN
frontend/WebSem/favicon.ico Voir le fichier


+ 2
- 0
frontend/WebSem/sdk/Business/apputils.business.js Voir le fichier

@@ -89,6 +89,8 @@
89 89
                 });
90 90
             };
91 91
 
92
+            AppUtilsBusiness.articleTypes = ['persons', 'locations', 'countries'];
93
+
92 94
             return AppUtilsBusiness;
93 95
         }]);
94 96
 })();

+ 15
- 0
frontend/WebSem/sdk/Business/articles.business.js Voir le fichier

@@ -0,0 +1,15 @@
1
+/**
2
+ * Created by robin on 12/12/16.
3
+ */
4
+
5
+(function () {
6
+    'use strict';
7
+
8
+    angular.module('appSdk')
9
+        .factory('articlesBusiness', ['luWebApiCrudBusiness', 'articlesDataAccess', function (luWebApiCrudBusiness, articlesDataAccess) {
10
+
11
+            var Business = luWebApiCrudBusiness.create(articlesDataAccess);
12
+
13
+            return Business;
14
+        }]);
15
+})();

+ 0
- 15
frontend/WebSem/sdk/Business/pkguids.business.js Voir le fichier

@@ -1,15 +0,0 @@
1
-/**
2
- * Created by robin on 12/12/16.
3
- */
4
-
5
-(function () {
6
-    'use strict';
7
-
8
-    angular.module('appSdk')
9
-        .factory('pkguidsBusiness', ['luWebApiCrudBusiness', 'pkguidsDataAccess', function (luWebApiCrudBusiness, pkguidsDataAccess) {
10
-
11
-            var Business = luWebApiCrudBusiness.create(pkguidsDataAccess);
12
-
13
-            return Business;
14
-        }]);
15
-})();

+ 0
- 0
frontend/WebSem/sdk/DataAccess/.gitkeep Voir le fichier


+ 79
- 0
frontend/WebSem/sdk/DataAccess/articles.dataaccess.js Voir le fichier

@@ -0,0 +1,79 @@
1
+/**
2
+ * Created by robin on 12/12/16.
3
+ */
4
+
5
+(function () {
6
+    'use strict';
7
+
8
+    angular.module('appSdk')
9
+        .factory('articlesDataAccess', ['luWebApiCrudDataAccess', 'luDataInitializer',
10
+            function (luWebApiCrudDataAccess, luDataInitializer) {
11
+
12
+            var DataAccess = luWebApiCrudDataAccess.create('/api/articles');
13
+
14
+            DataAccess.defaultDbo = {
15
+                id: null,
16
+                title: null,
17
+                type: null,
18
+                text: null,
19
+                pictureUrl: null,
20
+                pictureCaption: null,
21
+                fields: [],
22
+                createdAt: null,
23
+                updatedAt: null,
24
+                _itemType: 'articles',
25
+                toString: function () {
26
+                    return this.id;
27
+                }
28
+            };
29
+
30
+            DataAccess.defaultFieldDbo = {
31
+                value: null,
32
+                property: null,
33
+                type: 20.0
34
+            };
35
+
36
+            DataAccess.initFieldDbo = function (dbo, type) {
37
+                if (dbo == null) {
38
+                    return null;
39
+                }
40
+                var dboInit = DataAccess.extendDeep({}, DataAccess.defaultFieldDbo, dbo);
41
+                return dboInit;
42
+            };
43
+
44
+            DataAccess.initFieldModel = function (model, op) {
45
+                if (model == null) {
46
+                    return null;
47
+                }
48
+                var modelInit = angular.copy(model);
49
+                return modelInit;
50
+            };
51
+
52
+            DataAccess.articleFieldModelInitializer = luDataInitializer.create(DataAccess.initFieldModel);
53
+
54
+            DataAccess.articleFieldDboInitializer = luDataInitializer.create(DataAccess.initFieldDbo);
55
+
56
+            DataAccess.initDbo = function (dbo, type) {
57
+                if (dbo == null) {
58
+                    return null;
59
+                }
60
+                var dboInit = DataAccess._initDbo(dbo);
61
+                dboInit.fields = DataAccess.articleFieldDboInitializer.initListData(dboInit.fields, type);
62
+                dboInit.title = dboInit.id;
63
+                return dboInit;
64
+            };
65
+
66
+            DataAccess.initModel = function (model, op) {
67
+                if (model == null) {
68
+                    return null;
69
+                }
70
+                var modelInit = DataAccess._initModel(model, op);
71
+                modelInit.fields = DataAccess.articleFieldModelInitializer.initListData(modelInit.fields, op);
72
+                modelInit.id = modelInit.title;
73
+                delete modelInit.title;
74
+                return modelInit;
75
+            };
76
+
77
+            return DataAccess;
78
+        }]);
79
+})();

+ 0
- 27
frontend/WebSem/sdk/DataAccess/pkguids.dataaccess.js Voir le fichier

@@ -1,27 +0,0 @@
1
-/**
2
- * Created by robin on 12/12/16.
3
- */
4
-
5
-(function () {
6
-    'use strict';
7
-
8
-    angular.module('appSdk')
9
-        .factory('pkguidsDataAccess', ['luWebApiCrudDataAccess', function (luWebApiCrudDataAccess) {
10
-
11
-            var DataAccess = luWebApiCrudDataAccess.create('/api/pkguid');
12
-
13
-            DataAccess.defaultDbo = {
14
-                id: null,
15
-                someText: null,
16
-                someInt: null,
17
-                createdAt: null,
18
-                updatedAt: null,
19
-                _itemType: 'pkguids',
20
-                toString: function () {
21
-                    return (this.someText != '' && this.someText != null) ? this.someText : this.id;
22
-                }
23
-            };
24
-
25
-            return DataAccess;
26
-        }]);
27
-})();

Chargement…
Annuler
Enregistrer