use of org.eclipse.sw360.datahandler.thrift.changelogs.ReferenceDocData in project sw360 by eclipse.
the class DatabaseHandlerUtil method referenceDocChanges.
/**
* Register Reference Doc changes ad part of Parent Doc update
*/
private static <T extends TBase> void referenceDocChanges(T oldDocVersion, T newDocVersion, String userEdited, List<ChangeLogs> referenceDocLogList, AttachmentConnector attachmentConnector, ChangeLogs changeLogParent) {
if (newDocVersion instanceof Project || newDocVersion instanceof Component || newDocVersion instanceof Release) {
getChangeLogsForAttachments(oldDocVersion, newDocVersion, userEdited, referenceDocLogList, attachmentConnector);
}
Set<ReferenceDocData> referenceDocDataSet = new HashSet<ReferenceDocData>();
referenceDocLogList.stream().forEach(refLog -> {
ReferenceDocData refDocData = new ReferenceDocData();
refDocData.setDbName(refLog.getDbName());
refDocData.setRefDocId(refLog.getDocumentId());
refDocData.setRefDocOperation(refLog.getOperation());
refDocData.setRefDocType(refLog.getDocumentType());
referenceDocDataSet.add(refDocData);
});
changeLogParent.setReferenceDoc(referenceDocDataSet);
}
use of org.eclipse.sw360.datahandler.thrift.changelogs.ReferenceDocData in project sw360 by eclipse.
the class ChangeLogSpecTest method before.
@Before
public void before() throws TException, IOException {
ChangeLogs changeLog = new ChangeLogs();
changeLog.setId("1234");
changeLog.setDocumentId("4567");
changeLog.setUserEdited("admin@sw360.org");
changeLog.setChangeTimestamp("2021-01-08");
changeLog.setOperation(Operation.UPDATE);
changeLog.setDocumentType("project");
HashSet<ChangedFields> changes = new HashSet<ChangedFields>();
ChangedFields changedFields = new ChangedFields();
changedFields.setFieldName("version");
changedFields.setFieldValueOld("\"2\"");
changedFields.setFieldValueNew("\"25\"");
ChangedFields changedFields1 = new ChangedFields();
changedFields1.setFieldName("name");
changedFields1.setFieldValueOld("\"TestProj\"");
changedFields1.setFieldValueNew("\"TestProject\"");
changes.add(changedFields);
changes.add(changedFields1);
HashSet<ReferenceDocData> referenceDoc = new HashSet<ReferenceDocData>();
ReferenceDocData referenceDocData = new ReferenceDocData();
referenceDocData.setRefDocId("98765");
referenceDocData.setRefDocOperation(Operation.CREATE);
referenceDocData.setRefDocType("attachment");
referenceDoc.add(referenceDocData);
changeLog.setReferenceDoc(referenceDoc);
changeLog.setChanges(changes);
ChangeLogs changeLog2 = new ChangeLogs();
changeLog2.setId("2345");
changeLog2.setDocumentId("56789");
changeLog2.setUserEdited("admin@sw360.org");
changeLog2.setChangeTimestamp("2021-01-08");
changeLog2.setOperation(Operation.CREATE);
changeLog2.setDocumentType("attachment");
changeLog2.setParentDocId("4567");
HashMap<String, String> info = new HashMap<String, String>();
info.put("FILENAME", "abc.xml");
info.put("CONTENT_TYPE", "application/rdf+xml");
info.put("PARENT_OPERATION", "PROJECT_UPDATE");
changeLog2.setInfo(info);
List<ChangeLogs> changeLogs = new ArrayList<ChangeLogs>();
changeLogs.add(changeLog);
changeLogs.add(changeLog2);
given(this.changeLogServiceMock.getChangeLogsByDocumentId(anyObject(), anyObject())).willReturn(changeLogs);
}
Aggregations