12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667 |
- package com.persagy.proxy.adm.strategy.relationdata;
- import java.util.List;
- import com.fasterxml.jackson.databind.node.ObjectNode;
- import com.persagy.dmp.basic.dto.RequestData;
- import com.persagy.dmp.digital.client.DigitalObjectFacade;
- import com.persagy.dmp.digital.client.DigitalRelationFacade;
- import com.persagy.dmp.digital.entity.ObjectDigital;
- import com.persagy.dmp.digital.entity.ObjectRelation;
- import com.persagy.proxy.adm.constant.AdmCommonConstant;
- import com.persagy.proxy.adm.model.AdmRelationObject;
- import com.persagy.proxy.adm.service.IRelationReportService;
- import cn.hutool.core.collection.CollectionUtil;
- /**
- * 普通操作抽象类
- *
- * @version 1.0.0
- * @company persagy
- * @author zhangqiankun
- * @date 2021年9月2日 下午11:00:26
- */
- public abstract class AbstractRelationObject implements RelationObjectStrategy {
- protected IRelationReportService relationReportService;
-
- public AbstractRelationObject(IRelationReportService reportDownloadService) {
- this.relationReportService = reportDownloadService;
- }
-
- @Override
- public void queryPageObjectInfo(List<ObjectDigital> masterObjs, RequestData requestData, String groupCode, String projectId, Long page) {
- requestData.setPage(page);
- List<ObjectDigital> objectDigitals = DigitalObjectFacade.queryObjectListByGraphCodeAndRelCode(groupCode, projectId, AdmCommonConstant.APP_ID, AdmCommonConstant.USER_ID, requestData);
- if (CollectionUtil.isEmpty(objectDigitals)) {
- return;
- }
- masterObjs.addAll(objectDigitals);
- this.queryPageObjectInfo(masterObjs, requestData, groupCode, projectId, ++page);
- }
-
- @Override
- public boolean saveRelationObject(ObjectNode relationObject, String groupCode, String projectId) {
- ObjectRelation objectRelation = DigitalRelationFacade.createOne(groupCode, projectId, AdmCommonConstant.APP_ID, AdmCommonConstant.USER_ID, relationObject);
- return objectRelation != null;
- }
-
- @Override
- public boolean saveRelationObjects(List<ObjectNode> relationObjects, String groupCode, String projectId) {
- List<ObjectRelation> create = DigitalRelationFacade.create(groupCode, projectId, AdmCommonConstant.APP_ID, AdmCommonConstant.USER_ID, relationObjects);
- return CollectionUtil.isNotEmpty(create);
- }
-
- /**************************************************** 默认不实现的类 *******************************************************/
-
- @Override
- public List<AdmRelationObject> findRelationObject(String groupCode, String projectId) {
- throw new UnsupportedOperationException("未实现的策略类");
- }
- @Override
- public Object beforeSaveRelationObject(AdmRelationObject relationObject, String groupCode, String projectId, String code) {
- throw new UnsupportedOperationException("未实现的策略类");
- }
- }
|