C#: Added License
authorjani <jani@asema.com>
Sat, 12 Jan 2019 23:49:54 +0000 (01:49 +0200)
committerjani <jani@asema.com>
Sat, 12 Jan 2019 23:49:54 +0000 (01:49 +0200)
Common/C#/SmartAPI/SmartAPI.csproj
Common/C#/SmartAPI/model/License.cs [new file with mode: 0644]

index 62ede555aee1405efb1b7b3ed11b70a7b5d9be57..c4eed9185c8affdb7894c6499749094c99acc67d 100644 (file)
     <Compile Include="model\Account.cs" />
     <Compile Include="model\AccountAction.cs" />
     <Compile Include="model\AccountTransaction.cs" />
+    <Compile Include="model\License.cs" />
     <Compile Include="model\Restriction.cs" />
     <Compile Include="model\SubscriptionPriceSpecification.cs" />
     <Compile Include="model\TypeAndQuantityNode.cs" />
diff --git a/Common/C#/SmartAPI/model/License.cs b/Common/C#/SmartAPI/model/License.cs
new file mode 100644 (file)
index 0000000..b266294
--- /dev/null
@@ -0,0 +1,108 @@
+´╗┐using System;
+using SmartAPI.Common;
+using SmartAPI.Rdf;
+using System.Collections.Generic;
+
+namespace SmartAPI.Model
+{
+    public class License : Obj
+    {
+        private Account account = null;
+        private Variant licenseKey = null;
+        private List<PriceSpecification> priceSpecifications = null;
+
+        private void init()
+        {
+            this.initProperty<Account>(PROPERTY.ACCOUNT, this.hasAccount, this.getAccount);
+            this.initProperty<Variant>(PROPERTY.LICENSEKEY, this.hasLicenseKey, this.getLicenseKeyVar);
+            this.initPropertyList<List<PriceSpecification>, PriceSpecification>(PROPERTY.HASPRICESPECIFICATION, this.hasPriceSpecification, this.getPriceSpecifications);
+        }
+
+        public License()
+        {
+            init();
+            setType(RESOURCE.LICENSE);
+        }
+
+        public License(String uri)
+        {
+            init();
+            setType(RESOURCE.LICENSE);
+            this.setIdentifierUri(uri);
+        }
+
+        public override RDFNode serialize(Rdf.Model model)
+        {
+            return base.serialize(model);
+        }
+
+        public override void parse(Statement statement)
+        {
+            if (this.parseProperty<Account>(statement, PROPERTY.ACCOUNT, this.setAccount)) return;
+            if (this.parseProperty<Variant>(statement, PROPERTY.LICENSEKEY, this.setLicenseKey)) return;
+            if (this.parseProperty<PriceSpecification>(statement, PROPERTY.HASPRICESPECIFICATION, this.addPriceSpecification)) return;
+            base.parse(statement);
+        }
+
+        public bool hasAccount()
+        {
+            return this.account != null;
+        }
+
+        public void setAccount(Account v)
+        {
+            this.account = v;
+        }
+
+        public Account getAccount()
+        {
+            return this.account;
+        }
+
+        public bool hasLicenseKey()
+        {
+            return this.licenseKey != null;
+        }
+
+        public void setLicenseKey(Variant v)
+        {
+            this.licenseKey = v;
+        }
+
+        public void setLicenseKey(String s)
+        {
+            this.setLicenseKey(new Variant(s));
+        }
+
+        public String getLicenseKey()
+        {
+            if (this.licenseKey != null) return this.licenseKey.asString();
+            return null;
+        }
+
+        public Variant getLicenseKeyVar()
+        {
+            return this.licenseKey;
+        }
+
+        public void setPriceSpecifications(List<PriceSpecification> v)
+        {
+            this.priceSpecifications = v;
+        }
+
+        public bool hasPriceSpecification()
+        {
+            return this.priceSpecifications.Count > 0;
+        }
+
+        public List<PriceSpecification> getPriceSpecifications()
+        {
+            return this.priceSpecifications;
+        }
+
+        public void addPriceSpecification(PriceSpecification v)
+        {
+            this.priceSpecifications.Add(v);
+        }
+    }
+}
\ No newline at end of file