Ejemplo n.º 1
0
    def addCapability(self, capability):
        '''
		@param capability: either Activity object, or URI string 
		'''
        from SmartAPI.model.Activity import Activity

        if isinstance(capability, Activity):
            self.capabilities.append(capability)
        elif isinstance(capability, str):
            activity = Activity(capability)
            activity.clearTypes()
            self.capabilities.append(activity)
Ejemplo n.º 2
0
	def create(cls, generatedBy):
		request = Request()
		if (generatedBy is None or  generatedBy == ""):
			raise InsufficientDataException("Invalid smartapi:generatedBy URI.")

		g = Activity(generatedBy)
		g.clearTypes()
		request.setGeneratedBy(g)
		
		request.setGeneratedAt(datetime.datetime.now())

		return request;
Ejemplo n.º 3
0
    def create(self, generatedBy):
        notification = Notification()
        if (generatedBy is None
                or (generatedBy is not None and generatedBy == "")):
            raise InsufficientDataException("Invalid seas:generatedBy URI.")

        g = Activity(generatedBy)
        g.clearTypes()
        notification.setGeneratedBy(g)

        # timestamp of when this message is being generated (now)
        notification.setGeneratedAt(datetime.datetime.now())

        return notification
Ejemplo n.º 4
0
    def create(self, generatedBy):
        resp = Response()
        if (generatedBy is None
                or (generatedBy is not None and generatedBy == "")):
            raise InsufficientDataException("Invalid seas:generatedBy URI.")

        g = Activity(generatedBy)
        g.clearTypes()
        resp.setGeneratedBy(g)

        # timestamp of when this message is being generated (now)
        resp.setGeneratedAt(datetime.datetime.now())

        resp.addType(RESOURCE.RESPONSE)

        return resp
Ejemplo n.º 5
0
    def create(self, generatedBy):
        evaluation = Evaluation()
        if (generatedBy is None
                or (generatedBy is not None and generatedBy == "")):
            raise InsufficientDataException(
                "Invalid command generator id (seas:generatedBy) URI.")

        g = Activity(generatedBy)
        g.clearTypes()
        evaluation.setGeneratedBy(g)

        # timestamp of when this message is being generated (now)
        evaluation.setGeneratedAt(datetime.datetime.now())

        evaluation.addType(RESOURCE.COMMAND)

        return evaluation