),
    BackReferenceField('registered_service',
                       relationship='original_request',
                       multiValued=True,
                       widget=BackReferenceWidget(label='Registered service',
                                                  visible={
                                                      'edit': 'invisible'},
                                                  ),
                       ),
)) + RequestFields.copy() + atapi.Schema((
    ateapi.CommentField('resource_comment',
                        comment="If applicable and already known how much resources shall be provisioned "
                        "through this service then this should be specified here. Otherwise this "
                        "can be left empty (or added later).",
                        ),
)) + ResourceFields.copy() + CommonFields.copy()


schemata.finalizeATCTSchema(ServiceRequestSchema, moveDiscussion=False)


class ServiceRequest(folder.ATFolder, CommonUtilities, RequestUtilities):
    """A project requests a service"""
    implements(IServiceRequest)

    meta_type = "ServiceRequest"
    schema = ServiceRequestSchema


atapi.registerType(ServiceRequest, PROJECTNAME)
Esempio n. 2
0
from Products.ATContentTypes.content import schemata

# -*- Message Factory Imported Here -*-

from pcp.contenttypes.interfaces import IResourceOffer
from pcp.contenttypes.config import PROJECTNAME
from pcp.contenttypes.content.common import ResourceFields
from pcp.contenttypes.content.common import ConditionsFields
from pcp.contenttypes.content.common import CommonFields
from pcp.contenttypes.content.common import OfferUtilities
from pcp.contenttypes.content.common import CommonUtilities

ResourceOfferSchema = schemata.ATContentTypeSchema.copy() \
    + ResourceFields.copy() \
    + ConditionsFields.copy() \
    + CommonFields.copy()


schemata.finalizeATCTSchema(ResourceOfferSchema, moveDiscussion=False)


class ResourceOffer(base.ATCTContent, CommonUtilities, OfferUtilities):
    """Provider offers compute or storage resources"""
    implements(IResourceOffer)

    meta_type = "ResourceOffer"
    schema = ResourceOfferSchema


atapi.registerType(ResourceOffer, PROJECTNAME)
                                                       description='Potential Service Level Agreements under '\
                                                       'which the service is being offered.',
                                                       allow_browse=1,
                                                       startup_directory='/services/hours',
                                                       ),

                         ),
    atapi.ReferenceField('contact',
                         relationship='contact_for',
                         allowed_types=('Person',),
                         widget=ReferenceBrowserWidget(label='Contact',
                                                       description='Contact responsible for this service offer.',
                                                       allow_browse=1,
                                                       startup_directory='/people',
                                                       ),
                         ),
)) + ConditionsFields.copy() + CommonFields.copy()

schemata.finalizeATCTSchema(ServiceOfferSchema, moveDiscussion=False)


class ServiceOffer(base.ATCTContent, CommonUtilities, OfferUtilities):
    """Providers signal their service offerings"""
    implements(IServiceOffer)

    meta_type = "ServiceOffer"
    schema = ServiceOfferSchema


atapi.registerType(ServiceOffer, PROJECTNAME)
                        expression='here.getStorageClass()',
                        widget=atapi.ComputedWidget(label='Storage class'),
                    ),
    atapi.IntegerField('max_objects',
                       widget=atapi.IntegerWidget(label='Max. Objects',
                                                  description='Allocated (maximum) number of objects',
                                                  ),
                       ),
    atapi.FloatField('cost_factor'),
    atapi.DateTimeField('preserve_until',
                        widget=atapi.CalendarWidget(label='Preserve until',
                                                    description='Until when does this resource need '
                                                    'to be allocated?',
                                                    show_hm=False),
                        ),
)) + ResourceContextFields.copy() + CommonFields.copy()


schemata.finalizeATCTSchema(
    RegisteredStorageResourceSchema, moveDiscussion=False)


class RegisteredStorageResource(base.ATCTContent, CommonUtilities, Accountable):
    """A provisioned storage space of a certain type"""
    implements(IRegisteredStorageResource)

    meta_type = "RegisteredStorageResource"
    schema = RegisteredStorageResourceSchema

    def getStorageClass(self):
        size = self.schema['size'].get(self)
Esempio n. 5
0
                         relationship='service_hours',
                         allowed_types=('Document',),
                         widget=ReferenceBrowserWidget(label='Service hours',
                                                       allow_search=1,
                                                       base_query={
                                                           'Subject': ["Support hours"]},
                                                       show_results_without_query=1,
                                                       ),
                         ),
)) + RequestFields.copy() + atapi.Schema((
    ateapi.CommentField('resource_comment',
                        comment="If applicable and already known how much resources shall be provisioned "
                        "through this service then this should be specified here. Otherwise this "
                        "can be left empty (or added later).",
                        ),
)) + ResourceFields.copy() + CommonFields.copy()


schemata.finalizeATCTSchema(
    ServiceComponentRequestSchema, moveDiscussion=False)


class ServiceComponentRequest(folder.ATFolder, CommonUtilities, RequestUtilities):
    """A project requests a specific service component"""
    implements(IServiceComponentRequest)

    meta_type = "ServiceComponentRequest"
    schema = ServiceComponentRequestSchema

atapi.registerType(ServiceComponentRequest, PROJECTNAME)
Esempio n. 6
0
        'max_objects',
        widget=atapi.IntegerWidget(
            label='Max. Objects',
            description='Allocated (maximum) number of objects',
        ),
    ),
    atapi.FloatField('cost_factor'),
    atapi.DateTimeField(
        'preserve_until',
        widget=atapi.CalendarWidget(
            label='Preserve until',
            description='Until when does this resource need '
            'to be allocated?',
            show_hm=False),
    ),
)) + ResourceContextFields.copy() + CommonFields.copy()

schemata.finalizeATCTSchema(RegisteredStorageResourceSchema,
                            moveDiscussion=False)


class RegisteredStorageResource(base.ATCTContent, CommonUtilities,
                                Accountable):
    """A provisioned storage space of a certain type"""
    implements(IRegisteredStorageResource)

    meta_type = "RegisteredStorageResource"
    schema = RegisteredStorageResourceSchema

    def getStorageClass(self):
        size = self.schema['size'].get(self)
                                                       'which the service is being offered.',
                                                       allow_browse=1,
                                                       startup_directory='/services/hours',
                                                       ),

                         ),
    atapi.ReferenceField('contact',
                         relationship='contact_for',
                         allowed_types=('Person',),
                         widget=ReferenceBrowserWidget(label='Contact',
                                                       description='Contact responsible for this service offer.',
                                                       allow_browse=1,
                                                       startup_directory='/people',
                                                       ),
                         ),
)) + ConditionsFields.copy() + CommonFields.copy()


schemata.finalizeATCTSchema(ServiceOfferSchema, moveDiscussion=False)


class ServiceOffer(base.ATCTContent, CommonUtilities, OfferUtilities):
    """Providers signal their service offerings"""
    implements(IServiceOffer)

    meta_type = "ServiceOffer"
    schema = ServiceOfferSchema


atapi.registerType(ServiceOffer, PROJECTNAME)