import org.onap.usecaseui.intentanalysis.bean.enums.FulfillmentStatus;
import org.onap.usecaseui.intentanalysis.bean.enums.NotFulfilledState;
+import java.util.List;
+
@Data
public class FulfillmentInfo {
private String achieveValue;
+ private List<String> objectInstances;
}
--- /dev/null
+/*
+ * Copyright (C) 2023 CMCC, Inc. and others. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onap.usecaseui.intentanalysis.bean.models;
+
+import lombok.Data;
+
+@Data
+public class FulfillmentOperation extends FulfillmentInfo {
+ //Assurance or modifyBW
+ private String operation;
+}
private String intentReportId;
private String intentReference;
private List<FulfillmentInfo> fulfillmentInfos;
- private List<String> objectInstance;
- private Date reportTime;
+ private String reportTime;
}
--- /dev/null
+/*
+ * Copyright (C) 2023 CMCC, Inc. and others. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onap.usecaseui.intentanalysis.bean.models;
+
+import lombok.Data;
+
+@Data
+public class IntentReportFulfillmentInfo extends FulfillmentInfo{
+ // This id is the intentReportId of the associated intentReport
+ private String intentReportId;
+}
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
+import java.text.SimpleDateFormat;
import java.time.LocalDateTime;
import java.time.ZoneId;
import java.util.ArrayList;
IntentReport report = new IntentReport();
report.setIntentReportId("12345");
report.setIntentReference("intentReort");
- report.setObjectInstance(Arrays.asList("instance1", "instance2", "instance3"));
//report.setFulfillmentInfos();
- LocalDateTime now = LocalDateTime.now();
- report.setReportTime(Date.from( now.atZone( ZoneId.systemDefault()).toInstant()));
+ Date date = new Date();
+ SimpleDateFormat dateFormat = new SimpleDateFormat("yyy-MM-dd HH:mm:ss");
+ report.setReportTime(dateFormat.format(date));
FulfillmentInfo fu1= new FulfillmentInfo();
fu1.setFulfillmentId("fulfillmentInfo1");
fu1.setFulfillmentStatus(FulfillmentStatus.FULFILLED);
+ fu1.setObjectInstances(Arrays.asList("instance1", "instance2", "instance3"));
FulfillmentInfo fu2= new FulfillmentInfo();
fu2.setFulfillmentId("fulfillmentInfo2");
fu2.setFulfillmentStatus(FulfillmentStatus.NOT_FULFILLED);
fu2.setNotFulfilledState(NotFulfilledState.DEGRADED);
fu2.setNotFulfilledReason("not fulfilled Reason");
+ fu2.setObjectInstances(Arrays.asList("instance1", "instance2"));
List<FulfillmentInfo> list = new ArrayList<>();
list.add(fu1);
list.add(fu2);
*/
package org.onap.usecaseui.intentanalysis.service;
-import org.onap.usecaseui.intentanalysis.adapters.dmaap.NotificationEventModel;
+import org.onap.usecaseui.intentanalysis.bean.models.FulfillmentOperation;
public interface ComponentNotificationService {
- void callBack(NotificationEventModel eventModel);
+ void callBack(FulfillmentOperation eventModel);
}
package org.onap.usecaseui.intentanalysis.service.impl;
import lombok.extern.slf4j.Slf4j;
-import org.onap.usecaseui.intentanalysis.adapters.dmaap.NotificationEventModel;
+import org.onap.usecaseui.intentanalysis.bean.models.FulfillmentOperation;
import org.onap.usecaseui.intentanalysis.service.ComponentNotificationService;
import org.springframework.stereotype.Service;
+
@Slf4j
@Service
-public class ComponentNotificationServiceImpl implements ComponentNotificationService {
+public class ComponentNotificationServiceImpl implements ComponentNotificationService {
+
/**
- * transform NoticationEventModel to fulfillment
+ * Generate a new FulfillmentInfo based on third-party FulfillmentOperation
+ * and save it in the database
+ *
* @param eventModel
*/
@Override
- public void callBack(NotificationEventModel eventModel) {
+ public void callBack(FulfillmentOperation eventModel) {
log.info("callBack begin");
}
}
fulfillment_info_id varchar(255) primary key,
fulfillment_info_status varchar(255),
not_fulfilled_state varchar(255),
- not_fulfilled_reason varchar(255)
+ not_fulfilled_reason varchar(255),
+ achieve_value varchar(255)
);
create table if not exists state(
operate_type varchar (225),
parent_id varchar(255)
);
+
+create table if not exists intent_report(
+ intent_report_id varchar(255) primary key,
+ intent_reference varchar(255),
+ report_time timestamptz
+ );
+
+create table if not exists intent_report_fulfillment_info(
+ parent_id varchar(255),
+ fulfillment_info_id varchar(255),
+ fulfillment_info_status varchar(255),
+ not_fulfilled_state varchar(255),
+ not_fulfilled_reason varchar(255),
+ achieve_value varchar(255)
+ );
+
+create table if not exists object_instance(
+ parent_id varchar(255),
+ object_instance varchar(255)
+ );