use of org.apache.atlas.model.profile.AtlasUserProfile in project atlas by apache.
the class AtlasUserProfileDTO method from.
public AtlasUserProfile from(AtlasEntity entity) {
AtlasUserProfile profile = new AtlasUserProfile();
profile.setGuid(entity.getGuid());
profile.setName((String) entity.getAttribute(PROPERTY_USER_NAME));
profile.setFullName((String) entity.getAttribute(PROPERTY_FULL_NAME));
return profile;
}
use of org.apache.atlas.model.profile.AtlasUserProfile in project atlas by apache.
the class AtlasUserProfileDTO method from.
public AtlasUserProfile from(AtlasEntity entity) {
AtlasUserProfile profile = new AtlasUserProfile();
profile.setGuid(entity.getGuid());
profile.setName((String) entity.getAttribute(PROPERTY_USER_NAME));
profile.setFullName((String) entity.getAttribute(PROPERTY_FULL_NAME));
return profile;
}
use of org.apache.atlas.model.profile.AtlasUserProfile in project atlas by apache.
the class AtlasUserProfileDTO method from.
public AtlasUserProfile from(AtlasEntityWithExtInfo entityWithExtInfo) {
AtlasUserProfile userProfile = from(entityWithExtInfo.getEntity());
Object savedSearches = entityWithExtInfo.getEntity().getAttribute(PROPERTY_SAVED_SEARCHES);
if (savedSearches instanceof Collection) {
for (Object o : (Collection) savedSearches) {
if (o instanceof AtlasObjectId) {
AtlasObjectId ssObjId = (AtlasObjectId) o;
AtlasEntity ssEntity = entityWithExtInfo.getReferredEntity(ssObjId.getGuid());
if (ssEntity != null && ssEntity.getStatus() == AtlasEntity.Status.ACTIVE) {
AtlasUserSavedSearch savedSearch = savedSearchDTO.from(ssEntity);
userProfile.getSavedSearches().add(savedSearch);
}
}
}
}
return userProfile;
}
use of org.apache.atlas.model.profile.AtlasUserProfile in project atlas by apache.
the class UserProfileService method deleteUserProfile.
public void deleteUserProfile(String userName) throws AtlasBaseException {
AtlasUserProfile profile = getUserProfile(userName);
dataAccess.delete(profile.getGuid());
}
use of org.apache.atlas.model.profile.AtlasUserProfile in project atlas by apache.
the class UserProfileServiceTest method createsNewProfile.
@Test(dependsOnMethods = "filterInternalType")
public void createsNewProfile() throws AtlasBaseException {
for (int i = 0; i < NUM_USERS; i++) {
AtlasUserProfile expected = getAtlasUserProfile(i);
AtlasUserProfile actual = userProfileService.saveUserProfile(expected);
assertNotNull(actual);
assertEquals(expected.getName(), actual.getName());
assertEquals(expected.getFullName(), actual.getFullName());
assertNotNull(actual.getGuid());
}
}
Aggregations