Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
Toxantron committed Nov 27, 2022
2 parents 0cd5461 + 6e5e8b3 commit 78f7777
Show file tree
Hide file tree
Showing 12 changed files with 425 additions and 174 deletions.
32 changes: 16 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,22 +32,22 @@ The **MORYX AbstractionLayer** is the environment for the digital twins of resou

If you want to start developing with or for MORYX, the easiest way is our [template repository](https://github.com/PHOENIXCONTACT/MORYX-Template). It comes with two empty solutions, the necessary package feeds and preinstalled empty MORYX runtime. Add projects and packages to backend and frontend solutions depending on your specific requirements. Install stable releases via Nuget; development releases are available via MyGet.

| Package Name | Release (NuGet) | CI (MyGet) |
|--------------|-----------------|------------|
| `Moryx.AbstractionLayer` | [![NuGet](https://img.shields.io/nuget/v/Moryx.AbstractionLayer.svg)](https://www.nuget.org/packages/Moryx.AbstractionLayer/) | [![MyGet](https://img.shields.io/myget/moryx/vpre/Moryx.AbstractionLayer)](https://www.myget.org/feed/moryx/package/nuget/Moryx.AbstractionLayer) |
| `Moryx.AbstractionLayer.TestTools` | [![NuGet](https://img.shields.io/nuget/v/Moryx.AbstractionLayer.TestTools.svg)](https://www.nuget.org/packages/Moryx.AbstractionLayer.TestTools/) | [![MyGet](https://img.shields.io/myget/moryx/vpre/Moryx.AbstractionLayer.TestTools)](https://www.myget.org/feed/moryx/package/nuget/Moryx.AbstractionLayer.TestTools) |
| `Moryx.AbstractionLayer.Products.Endpoints` | [![NuGet](https://img.shields.io/nuget/v/Moryx.AbstractionLayer.Products.Endpoints.svg)](https://www.nuget.org/packages/Moryx.AbstractionLayer.Products.Endpoints/) | [![MyGet](https://img.shields.io/myget/moryx/vpre/Moryx.AbstractionLayer.Products.Endpoints)](https://www.myget.org/feed/moryx/package/nuget/Moryx.AbstractionLayer.Products.Endpoints) |
| `Moryx.AbstractionLayer.Resources.Endpoints` | [![NuGet](https://img.shields.io/nuget/v/Moryx.AbstractionLayer.Resources.Endpoints.svg)](https://www.nuget.org/packages/Moryx.AbstractionLayer.Resources.Endpoints/) | [![MyGet](https://img.shields.io/myget/moryx/vpre/Moryx.AbstractionLayer.Resources.Endpoints)](https://www.myget.org/feed/moryx/package/nuget/Moryx.AbstractionLayer.Resources.Endpoints) |
| `Moryx.Notifications` | [![NuGet](https://img.shields.io/nuget/v/Moryx.Notifications.svg)](https://www.nuget.org/packages/Moryx.Notifications/) | [![MyGet](https://img.shields.io/myget/moryx/vpre/Moryx.Notifications)](https://www.myget.org/feed/moryx/package/nuget/Moryx.Notifications) |
| `Moryx.Products.Management` | [![NuGet](https://img.shields.io/nuget/v/Moryx.Products.Management.svg)](https://www.nuget.org/packages/Moryx.Products.Management/) | [![MyGet](https://img.shields.io/myget/moryx/vpre/Moryx.Products.Management)](https://www.myget.org/feed/moryx/package/nuget/Moryx.Products.Management) |
| `Moryx.Products.Model` | [![NuGet](https://img.shields.io/nuget/v/Moryx.Products.Model.svg)](https://www.nuget.org/packages/Moryx.Products.Model/) | [![MyGet](https://img.shields.io/myget/moryx/vpre/Moryx.Products.Model)](https://www.myget.org/feed/moryx/package/nuget/Moryx.Products.Model) |
| `Moryx.Resources.Interaction` | [![NuGet](https://img.shields.io/nuget/v/Moryx.Resources.Interaction.svg)](https://www.nuget.org/packages/Moryx.Resources.Interaction/) | [![MyGet](https://img.shields.io/myget/moryx/vpre/Moryx.Resources.Interaction)](https://www.myget.org/feed/moryx/package/nuget/Moryx.Resources.Interaction) |
| `Moryx.Resources.Management` | [![NuGet](https://img.shields.io/nuget/v/Moryx.Resources.Management.svg)](https://www.nuget.org/packages/Moryx.Resources.Management/) | [![MyGet](https://img.shields.io/myget/moryx/vpre/Moryx.Resources.Management)](https://www.myget.org/feed/moryx/package/nuget/Moryx.Resources.Management) |
| `Moryx.AbstractionLayer.UI` | [![NuGet](https://img.shields.io/nuget/v/Moryx.AbstractionLayer.UI.svg)](https://www.nuget.org/packages/Moryx.AbstractionLayer.UI/) | [![MyGet](https://img.shields.io/myget/moryx/vpre/Moryx.AbstractionLayer.UI)](https://www.myget.org/feed/moryx/package/nuget/Moryx.AbstractionLayer.UI) |
| `Moryx.Products.UI` | [![NuGet](https://img.shields.io/nuget/v/Moryx.Products.UI.svg)](https://www.nuget.org/packages/Moryx.Products.UI/) | [![MyGet](https://img.shields.io/myget/moryx/vpre/Moryx.Products.UI)](https://www.myget.org/feed/moryx/package/nuget/Moryx.Products.UI) |
| `Moryx.Products.UI.Interaction` | [![NuGet](https://img.shields.io/nuget/v/Moryx.Products.UI.Interaction.svg)](https://www.nuget.org/packages/Moryx.Products.UI.Interaction/) | [![MyGet](https://img.shields.io/myget/moryx/vpre/Moryx.Products.UI.Interaction)](https://www.myget.org/feed/moryx/package/nuget/Moryx.Products.UI.Interaction) |
| `Moryx.Resources.UI` | [![NuGet](https://img.shields.io/nuget/v/Moryx.Resources.UI.svg)](https://www.nuget.org/packages/Moryx.Resources.UI/) | [![MyGet](https://img.shields.io/myget/moryx/vpre/Moryx.Resources.UI)](https://www.myget.org/feed/moryx/package/nuget/Moryx.Resources.UI) |
| `Moryx.Resources.UI.Interaction` | [![NuGet](https://img.shields.io/nuget/v/Moryx.Resources.UI.Interaction.svg)](https://www.nuget.org/packages/Moryx.Resources.UI.Interaction/) | [![MyGet](https://img.shields.io/myget/moryx/vpre/Moryx.Resources.UI.Interaction)](https://www.myget.org/feed/moryx/package/nuget/Moryx.Resources.UI.Interaction) |
| Package Name | Release (NuGet) | CI (MyGet) | Future (MyGet) |
|--------------|-----------------|------------|------------|
| `Moryx.AbstractionLayer` | [![NuGet](https://img.shields.io/nuget/v/Moryx.AbstractionLayer.svg)](https://www.nuget.org/packages/Moryx.AbstractionLayer/) | [![MyGet](https://img.shields.io/myget/moryx/vpre/Moryx.AbstractionLayer)](https://www.myget.org/feed/moryx/package/nuget/Moryx.AbstractionLayer) | [![MyGet](https://img.shields.io/myget/moryx-future/vpre/Moryx.AbstractionLayer)](https://www.myget.org/feed/moryx-future/package/nuget/Moryx.AbstractionLayer) |
| `Moryx.AbstractionLayer.TestTools` | [![NuGet](https://img.shields.io/nuget/v/Moryx.AbstractionLayer.TestTools.svg)](https://www.nuget.org/packages/Moryx.AbstractionLayer.TestTools/) | [![MyGet](https://img.shields.io/myget/moryx/vpre/Moryx.AbstractionLayer.TestTools)](https://www.myget.org/feed/moryx/package/nuget/Moryx.AbstractionLayer.TestTools) | [![MyGet](https://img.shields.io/myget/moryx-future/vpre/Moryx.AbstractionLayer.TestTools)](https://www.myget.org/feed/moryx-future/package/nuget/Moryx.AbstractionLayer.TestTools) |
| `Moryx.AbstractionLayer.Products.Endpoints` | [![NuGet](https://img.shields.io/nuget/v/Moryx.AbstractionLayer.Products.Endpoints.svg)](https://www.nuget.org/packages/Moryx.AbstractionLayer.Products.Endpoints/) | [![MyGet](https://img.shields.io/myget/moryx/vpre/Moryx.AbstractionLayer.Products.Endpoints)](https://www.myget.org/feed/moryx/package/nuget/Moryx.AbstractionLayer.Products.Endpoints) | [![MyGet](https://img.shields.io/myget/moryx-future/vpre/Moryx.AbstractionLayer.Products.Endpoints)](https://www.myget.org/feed/moryx-future/package/nuget/Moryx.AbstractionLayer.Products.Endpoints) |
| `Moryx.AbstractionLayer.Resources.Endpoints` | [![NuGet](https://img.shields.io/nuget/v/Moryx.AbstractionLayer.Resources.Endpoints.svg)](https://www.nuget.org/packages/Moryx.AbstractionLayer.Resources.Endpoints/) | [![MyGet](https://img.shields.io/myget/moryx/vpre/Moryx.AbstractionLayer.Resources.Endpoints)](https://www.myget.org/feed/moryx/package/nuget/Moryx.AbstractionLayer.Resources.Endpoints) | [![MyGet](https://img.shields.io/myget/moryx-future/vpre/Moryx.AbstractionLayer.Resources.Endpoints)](https://www.myget.org/feed/moryx-future/package/nuget/Moryx.AbstractionLayer.Resources.Endpoints) |
| `Moryx.Notifications` | [![NuGet](https://img.shields.io/nuget/v/Moryx.Notifications.svg)](https://www.nuget.org/packages/Moryx.Notifications/) | [![MyGet](https://img.shields.io/myget/moryx/vpre/Moryx.Notifications)](https://www.myget.org/feed/moryx/package/nuget/Moryx.Notifications) | [![MyGet](https://img.shields.io/myget/moryx-future/vpre/Moryx.Notifications)](https://www.myget.org/feed/moryx-future/package/nuget/Moryx.Notifications) |
| `Moryx.Products.Management` | [![NuGet](https://img.shields.io/nuget/v/Moryx.Products.Management.svg)](https://www.nuget.org/packages/Moryx.Products.Management/) | [![MyGet](https://img.shields.io/myget/moryx/vpre/Moryx.Products.Management)](https://www.myget.org/feed/moryx/package/nuget/Moryx.Products.Management) | [![MyGet](https://img.shields.io/myget/moryx-future/vpre/Moryx.Products.Management)](https://www.myget.org/feed/moryx-future/package/nuget/Moryx.Products.Management) |
| `Moryx.Products.Model` | [![NuGet](https://img.shields.io/nuget/v/Moryx.Products.Model.svg)](https://www.nuget.org/packages/Moryx.Products.Model/) | [![MyGet](https://img.shields.io/myget/moryx/vpre/Moryx.Products.Model)](https://www.myget.org/feed/moryx/package/nuget/Moryx.Products.Model) | [![MyGet](https://img.shields.io/myget/moryx-future/vpre/Moryx.Products.Model)](https://www.myget.org/feed/moryx-future/package/nuget/Moryx.Products.Model) |
| `Moryx.Resources.Interaction` | [![NuGet](https://img.shields.io/nuget/v/Moryx.Resources.Interaction.svg)](https://www.nuget.org/packages/Moryx.Resources.Interaction/) | [![MyGet](https://img.shields.io/myget/moryx/vpre/Moryx.Resources.Interaction)](https://www.myget.org/feed/moryx/package/nuget/Moryx.Resources.Interaction) | |
| `Moryx.Resources.Management` | [![NuGet](https://img.shields.io/nuget/v/Moryx.Resources.Management.svg)](https://www.nuget.org/packages/Moryx.Resources.Management/) | [![MyGet](https://img.shields.io/myget/moryx/vpre/Moryx.Resources.Management)](https://www.myget.org/feed/moryx/package/nuget/Moryx.Resources.Management) | [![MyGet](https://img.shields.io/myget/moryx-future/vpre/Moryx.Resources.Management)](https://www.myget.org/feed/moryx-future/package/nuget/Moryx.Resources.Management) |
| `Moryx.AbstractionLayer.UI` | [![NuGet](https://img.shields.io/nuget/v/Moryx.AbstractionLayer.UI.svg)](https://www.nuget.org/packages/Moryx.AbstractionLayer.UI/) | [![MyGet](https://img.shields.io/myget/moryx/vpre/Moryx.AbstractionLayer.UI)](https://www.myget.org/feed/moryx/package/nuget/Moryx.AbstractionLayer.UI) | |
| `Moryx.Products.UI` | [![NuGet](https://img.shields.io/nuget/v/Moryx.Products.UI.svg)](https://www.nuget.org/packages/Moryx.Products.UI/) | [![MyGet](https://img.shields.io/myget/moryx/vpre/Moryx.Products.UI)](https://www.myget.org/feed/moryx/package/nuget/Moryx.Products.UI) | |
| `Moryx.Products.UI.Interaction` | [![NuGet](https://img.shields.io/nuget/v/Moryx.Products.UI.Interaction.svg)](https://www.nuget.org/packages/Moryx.Products.UI.Interaction/) | [![MyGet](https://img.shields.io/myget/moryx/vpre/Moryx.Products.UI.Interaction)](https://www.myget.org/feed/moryx/package/nuget/Moryx.Products.UI.Interaction) |
| `Moryx.Resources.UI` | [![NuGet](https://img.shields.io/nuget/v/Moryx.Resources.UI.svg)](https://www.nuget.org/packages/Moryx.Resources.UI/) | [![MyGet](https://img.shields.io/myget/moryx/vpre/Moryx.Resources.UI)](https://www.myget.org/feed/moryx/package/nuget/Moryx.Resources.UI) | |
| `Moryx.Resources.UI.Interaction` | [![NuGet](https://img.shields.io/nuget/v/Moryx.Resources.UI.Interaction.svg)](https://www.nuget.org/packages/Moryx.Resources.UI.Interaction/) | [![MyGet](https://img.shields.io/myget/moryx/vpre/Moryx.Resources.UI.Interaction)](https://www.myget.org/feed/moryx/package/nuget/Moryx.Resources.UI.Interaction) | |

Whether you want to debug and experiment with this repository or build an application based on the Abstraction Layers packages you need to follow a few simple steps to setup each of the modules. For both modules this requires the package *Moryx.Runtime.Maintenance.Web* and its [database configuration](http://localhost/maintenanceweb/#/databases).

Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
5.13.1
5.13.2
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
using Moryx.AbstractionLayer.Products.Endpoints.Model;
using Moryx.Serialization;
using System.Net;
using Moryx.AbstractionLayer.Properties;
using Moryx.Configuration;

namespace Moryx.AbstractionLayer.Products.Endpoints
{
Expand Down Expand Up @@ -43,7 +45,7 @@ public ActionResult<ProductCustomization> GetProductCustomization()
Importers = _productManagement.Importers.Select(i => new ProductImporter
{
Name = i.Key,
Parameters = EntryConvert.EncodeObject(i.Value)
Parameters = EntryConvert.EncodeObject(i.Value, new PossibleValuesSerialization(null, new ValueProviderExecutor(new ValueProviderExecutorSettings().AddDefaultValueProvider())))
}).ToArray()
};
}
Expand Down Expand Up @@ -108,7 +110,7 @@ public ActionResult<long> SaveType(ProductModel newTypeModel)
var type = ReflectionTool.GetPublicClasses<ProductType>(t => t.Name == newTypeModel.Type)
.FirstOrDefault();
if (type == null)
return NotFound();
return NotFound(Strings.TYPE_NOT_FOUND);
var productType = (ProductType)Activator.CreateInstance(type);
var newType = _productConverter.ConvertProductBack(newTypeModel, productType);
return _productManagement.SaveType(newType);
Expand Down Expand Up @@ -137,7 +139,7 @@ public ActionResult<ProductModel[]> GetTypeByIdentity(string identity = null)
var productIdentity = new ProductIdentity(identityArray[0],Convert.ToInt16(identityArray[1]));
var productType = _productManagement.LoadType(productIdentity);
if (productType == null)
return NotFound();
return NotFound(Strings.TYPE_NOT_FOUND);
return new ProductModel[] { _productConverter.ConvertProduct(productType, false) };
}

Expand All @@ -163,9 +165,16 @@ public ActionResult<ProductModel> GetTypeById(long id)
{
if (id == 0)
return BadRequest($"Id was 0");
var productType = _productManagement.LoadType(id);
IProductType productType=null;
try
{
productType = _productManagement.LoadType(id);
}
catch (ProductNotFoundException)
{
}
if (productType == null)
return NotFound();
return NotFound(Strings.TYPE_NOT_FOUND);
return _productConverter.ConvertProduct(productType, false);
}

Expand All @@ -177,7 +186,7 @@ public ActionResult<bool> DeleteType(long id)
{
var result = _productManagement.DeleteProduct(id);
if (!result)
return NotFound();
return NotFound(Strings.TYPE_NOT_FOUND);
return result;
}

Expand Down Expand Up @@ -245,7 +254,7 @@ public ActionResult<ProductInstanceModel> GetInstance(long id)
return BadRequest($"Id was 0");
var productInstance = _productManagement.GetInstance(id);
if (productInstance == null)
return NotFound();
return NotFound(string.Format(Strings.ProductNotFoundException_Message,id));
return _productConverter.ConvertProductInstance(productInstance);
}

Expand Down Expand Up @@ -285,7 +294,7 @@ public ActionResult SaveInstance(ProductInstanceModel instanceModel)
var type = ReflectionTool.GetPublicClasses<IProductType>(t => t.Name == instanceModel.Type)
.FirstOrDefault();
if (type == null)
return NotFound();
return NotFound(string.Format(Strings.ProductNotFoundException_Message,"null"));
var productType = (IProductType)Activator.CreateInstance(type);
var productInstance = _productConverter.ConvertProductInstanceBack(instanceModel, productType);
_productManagement.SaveInstance(productInstance);
Expand All @@ -305,7 +314,7 @@ public ActionResult<RecipeModel> GetRecipe(long id)
return BadRequest($"Id was 0");
var recipe = _productManagement.LoadRecipe(id);
if (recipe == null)
return NotFound();
return NotFound(string.Format(Strings.RecipeNotFoundException_Message,id));
return ProductConverter.ConvertRecipe(recipe);
}

Expand All @@ -321,7 +330,7 @@ public ActionResult<long> SaveRecipe(RecipeModel recipe)
var type = ReflectionTool.GetPublicClasses<IProductRecipe>(t => t.Name == recipe.Type)
.FirstOrDefault();
if (type == null)
return NotFound();
return NotFound(string.Format(Strings.RecipeNotFoundException_Message, "null"));
var productRecipe = (IProductRecipe)Activator.CreateInstance(type);
return _productManagement.SaveRecipe(_productConverter.ConvertRecipeBack(recipe, productRecipe, null));
}
Expand Down Expand Up @@ -353,7 +362,7 @@ public ActionResult<RecipeModel> CreateRecipe(string recipeType)
// TODO: Use type wrapper
var type = ReflectionTool.GetPublicClasses<IProductRecipe>(t => t.Name == recipeType).FirstOrDefault();
if (type == null)
return NotFound($"Recipe type {recipeType} not found!");
return NotFound(string.Format(Strings.RECIPE_TYPE_NOT_FOUND, recipeType));
var recipe = (IProductRecipe)Activator.CreateInstance(type);
return ProductConverter.ConvertRecipe(recipe);

Expand Down
Loading

0 comments on commit 78f7777

Please sign in to comment.