use of org.apache.atlas.model.glossary.AtlasGlossaryTerm in project atlas by apache.
the class GlossaryTermUtils method getGlossaryTermDataWithRelations.
protected List<AtlasGlossaryTerm> getGlossaryTermDataWithRelations(List<String[]> fileData, BulkImportResponse bulkImportResponse) throws AtlasBaseException {
List<AtlasGlossaryTerm> glossaryTerms = new ArrayList<>();
int rowCount = 1;
for (String[] record : fileData) {
List<String> failedTermMsgs = new ArrayList<>();
if (ArrayUtils.isNotEmpty(record) && StringUtils.isNotBlank(record[INDEX_FOR_GLOSSARY_AT_RECORD])) {
AtlasGlossaryTerm glossaryTerm = new AtlasGlossaryTerm();
String glossaryName = record[INDEX_FOR_GLOSSARY_AT_RECORD];
String glossaryGuid = glossaryNameGuidCache.get().get(glossaryName);
if (StringUtils.isNotEmpty(glossaryGuid)) {
glossaryTerm = populateGlossaryTermObject(failedTermMsgs, record, glossaryGuid, true);
glossaryTerm.setQualifiedName(getGlossaryTermQualifiedName(glossaryTerm.getName(), glossaryName));
glossaryTerms.add(glossaryTerm);
}
if (failedTermMsgs.size() > 0) {
String failedTermMsg = StringUtils.join(failedTermMsgs, System.lineSeparator());
String glossaryTermName = glossaryTerm.getName();
bulkImportResponse.addToFailedImportInfoList(new ImportInfo(glossaryName, glossaryTermName, FAILED, failedTermMsg, rowCount));
}
}
rowCount++;
}
return glossaryTerms;
}
use of org.apache.atlas.model.glossary.AtlasGlossaryTerm in project atlas by apache.
the class GlossaryClientV2IT method testCreateTerm.
@Test(dependsOnMethods = "testCreateGlossary")
public void testCreateTerm() throws Exception {
AtlasGlossaryTerm term = new AtlasGlossaryTerm();
AtlasGlossaryHeader header = new AtlasGlossaryHeader();
header.setGlossaryGuid(educationGlossary.getGuid());
header.setDisplayText(educationGlossary.getName());
term.setAnchor(header);
term.setName("termForEducation");
educationTerm = atlasClientV2.createGlossaryTerm(term);
assertNotNull(educationTerm);
assertNotNull(educationTerm.getGuid());
}
use of org.apache.atlas.model.glossary.AtlasGlossaryTerm in project atlas by apache.
the class GlossaryClientV2IT method testDisassociateTermAssignmentFromEntities.
@Test(dependsOnMethods = "testAssignTermToEntities")
public void testDisassociateTermAssignmentFromEntities() throws Exception {
atlasClientV2.disassociateTermFromEntities(educationTerm.getGuid(), relatedObjectIds);
AtlasGlossaryTerm term = atlasClientV2.getGlossaryTerm(educationTerm.getGuid());
atlasClientV2.deleteEntityByGuid(entityHeader.getGuid());
assertNotNull(term);
assertNull(term.getAssignedEntities());
}
use of org.apache.atlas.model.glossary.AtlasGlossaryTerm in project atlas by apache.
the class GlossaryClientV2IT method testUpdateGlossaryTermByGuid.
@Test(dependsOnMethods = "testCreateGlossary")
public void testUpdateGlossaryTermByGuid() throws Exception {
AtlasGlossaryTerm term = new AtlasGlossaryTerm(educationTerm);
term.setAbbreviation("trm");
AtlasGlossaryTerm responseTerm = atlasClientV2.updateGlossaryTermByGuid(educationTerm.getGuid(), term);
assertNotNull(responseTerm);
assertEquals(responseTerm.getAbbreviation(), term.getAbbreviation());
}
use of org.apache.atlas.model.glossary.AtlasGlossaryTerm in project atlas by apache.
the class GlossaryClientV2IT method testPartialUpdateTermByGuid.
@Test(dependsOnMethods = "testCreateGlossary")
public void testPartialUpdateTermByGuid() throws Exception {
Map<String, String> partialUpdates = new HashMap<>();
partialUpdates.put("shortDescription", "shortDescriptionTerm");
partialUpdates.put("longDescription", "longDescriptionTerm");
AtlasGlossaryTerm term = atlasClientV2.partialUpdateTermByGuid(educationTerm.getGuid(), partialUpdates);
assertNotNull(term);
assertEquals(term.getShortDescription(), "shortDescriptionTerm");
assertEquals(term.getLongDescription(), "longDescriptionTerm");
}
Aggregations