service composition WIP
diff --git a/planetstack/servcomp/__init__.py b/planetstack/servcomp/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/planetstack/servcomp/__init__.py
diff --git a/planetstack/servcomp/admin.py b/planetstack/servcomp/admin.py
new file mode 100644
index 0000000..65a646b
--- /dev/null
+++ b/planetstack/servcomp/admin.py
@@ -0,0 +1,51 @@
+from django.contrib import admin
+
+from servcomp.models import *
+from django import forms
+from django.utils.safestring import mark_safe
+from django.contrib.auth.admin import UserAdmin
+from django.contrib.admin.widgets import FilteredSelectMultiple
+from django.contrib.auth.forms import ReadOnlyPasswordHashField
+from django.contrib.auth.signals import user_logged_in
+from django.utils import timezone
+from django.contrib.contenttypes import generic
+from suit.widgets import LinkedSelect
+from core.admin import SingletonAdmin,SliceInline,ServiceAttrAsTabInline, ReadOnlyAwareAdmin, PlStackTabularInline
+
+class CompositionServiceAdmin(SingletonAdmin):
+ model = CompositionService
+ verbose_name = "Composition Service"
+ verbose_name_plural = "Composition Service"
+ list_display = ("backend_status_icon", "name","enabled")
+ list_display_links = ('backend_status_icon', 'name', )
+ fieldsets = [(None, {'fields': ['backend_status_text', 'name','enabled','versionNumber', 'description'], 'classes':['suit-tab suit-tab-general']})]
+ readonly_fields = ('backend_status_text', )
+ inlines = [SliceInline,ServiceAttrAsTabInline]
+
+ user_readonly_fields = ["name", "enabled", "versionNumber", "description"]
+
+ suit_form_tabs =(('general', 'Composition Service Details'),
+ ('slices','Slices'),
+ ('serviceattrs','Additional Attributes'),
+ )
+
+class CompositionAdmin(ReadOnlyAwareAdmin):
+ list_display = ('backend_status_icon', 'name' )
+ list_display_links = ('backend_status_icon', 'name' )
+
+ fields = ('backend_status_text', 'name')
+ readonly_fields = ('backend_status_text', )
+ user_readonly_fields = ('name',)
+
+class EndUserAdmin(ReadOnlyAwareAdmin):
+ list_display = ('backend_status_icon', 'email', 'macAddress', 'composition' )
+ list_display_links = ('backend_status_icon', 'email' )
+
+ fields = ('backend_status_text', 'email', 'firstName', 'lastName', 'macAddress', 'composition')
+ readonly_fields = ('backend_status_text', )
+ user_readonly_fields = ('email', 'firstName', 'lastName', 'macAddress')
+
+admin.site.register(CompositionService, CompositionServiceAdmin)
+admin.site.register(Composition, CompositionAdmin)
+admin.site.register(EndUser, EndUserAdmin)
+
diff --git a/planetstack/servcomp/models.py b/planetstack/servcomp/models.py
new file mode 100644
index 0000000..a215409
--- /dev/null
+++ b/planetstack/servcomp/models.py
@@ -0,0 +1,36 @@
+from django.db import models
+from core.models import User, Service, SingletonModel, PlCoreBase, DiffModelMixIn
+import os
+from django.db import models
+from django.forms.models import model_to_dict
+
+class CompositionService(SingletonModel,Service):
+ class Meta:
+ app_label = "servcomp"
+ verbose_name = "Service Composition Service"
+
+class Composition(PlCoreBase):
+ class Meta:
+ app_label = "servcomp"
+
+ name = models.CharField(max_length=255);
+ services = models.ManyToManyField(Service, through='CompositionServiceThrough', blank=True);
+
+class CompositionServiceThrough(PlCoreBase):
+ class Meta:
+ app_label = "servcomp"
+
+ Composition = models.ForeignKey(Composition)
+ Service = models.ForeignKey(Service, related_name="compositions")
+ order = models.IntegerField(default=0)
+
+class EndUser(PlCoreBase):
+ class Meta:
+ app_label = "servcomp"
+
+ email = models.CharField(max_length=255)
+ firstName = models.CharField(max_length=80)
+ lastName = models.CharField(max_length=80)
+ macAddress = models.CharField(max_length=80)
+ composition = models.ForeignKey(Composition, related_name="endUsers", blank=True, null=True)
+