本文整理汇总了Java中org.alfresco.repo.security.sync.NodeDescription类的典型用法代码示例。如果您正苦于以下问题:Java NodeDescription类的具体用法?Java NodeDescription怎么用?Java NodeDescription使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
NodeDescription类属于org.alfresco.repo.security.sync包,在下文中一共展示了NodeDescription类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getPersons
import org.alfresco.repo.security.sync.NodeDescription; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public Collection<NodeDescription> getPersons(final Date modifiedSince)
{
final Collection<NodeDescription> results;
// we always expect the synchronization process to be in a single tenant's context
final UserRegistry userRegistry = this.getUserRegistryForCurrentDomain();
if (userRegistry != null)
{
results = userRegistry.getPersons(modifiedSince);
}
else
{
results = Collections.emptyList();
}
return results;
}
示例2: getGroups
import org.alfresco.repo.security.sync.NodeDescription; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public Collection<NodeDescription> getGroups(final Date modifiedSince)
{
final Collection<NodeDescription> results;
// we always expect the synchronization process to be in a single tenant's context
final UserRegistry userRegistry = this.getUserRegistryForCurrentDomain();
if (userRegistry != null)
{
results = userRegistry.getGroups(modifiedSince);
}
else
{
results = Collections.emptyList();
}
return results;
}
示例3: next
import org.alfresco.repo.security.sync.NodeDescription; //导入依赖的package包/类
/**
*
* {@inheritDoc}
*/
@Override
public NodeDescription next()
{
if (this.next == null)
{
throw new IllegalStateException();
}
final NodeDescription current = this.next;
try
{
this.next = this.fetchNext();
}
catch (final NamingException e)
{
throw new AlfrescoRuntimeException("Failed to import groups.", e);
}
return current;
}
示例4: getNextWork
import org.alfresco.repo.security.sync.NodeDescription; //导入依赖的package包/类
@Override
public Collection<NodeDescription> getNextWork()
{
final Collection<NodeDescription> nextWork = new ArrayList<>();
while (this.nodeIterator.hasNext())
{
final NodeDescription next = this.nodeIterator.next();
nextWork.add(next);
//
if (nextWork.size() >= (2 * TenantAwareChainingUserRegistrySynchronizer.USER_REGISTRY_ENTITY_BATCH_SIZE))
{
break;
}
}
return nextWork;
}
示例5: getPersons
import org.alfresco.repo.security.sync.NodeDescription; //导入依赖的package包/类
@Override
public Collection<NodeDescription> getPersons(final Date modifiedSince)
{
final String query;
if (modifiedSince == null)
{
query = this.personQuery;
}
else
{
final MessageFormat mf = new MessageFormat(this.personDifferentialQuery, Locale.ENGLISH);
query = mf.format(new Object[] { this.timestampFormat.format(modifiedSince) });
}
final Supplier<InitialDirContext> contextSupplier = this.buildContextSupplier();
final Function<InitialDirContext, Boolean> nextPageChecker = this.buildNextPageChecker();
final Function<InitialDirContext, NamingEnumeration<SearchResult>> userSearcher = this.buildUserSearcher(query);
final AtomicInteger totalEstimatedSize = new AtomicInteger(-1);
if (this.enableProgressEstimation)
{
this.processQuery((result) -> {
totalEstimatedSize.getAndIncrement();
}, this.userSearchBase, query, new String[0]);
}
final NodeMapper userMapper = this.buildUserMapper();
return new PersonCollection(contextSupplier, nextPageChecker, userSearcher, userMapper, this.queryBatchSize,
totalEstimatedSize.get());
}
示例6: getPersons
import org.alfresco.repo.security.sync.NodeDescription; //导入依赖的package包/类
public Collection<NodeDescription> getPersons(Date modifiedSince)
{
return new PersonCollection(modifiedSince);
}
示例7: mapToNode
import org.alfresco.repo.security.sync.NodeDescription; //导入依赖的package包/类
private NodeDescription mapToNode(Map<String, String> attributeMapping, Map<String, String> attributeDefaults,
SearchResult result) throws NamingException
{
NodeDescription nodeDescription = new NodeDescription(result.getNameInNamespace());
Attributes ldapAttributes = result.getAttributes();
// Parse the timestamp
Attribute modifyTimestamp = ldapAttributes.get(this.modifyTimestampAttributeName);
if (modifyTimestamp != null)
{
try
{
nodeDescription.setLastModified(this.timestampFormat.parse(modifyTimestamp.get().toString()));
}
catch (ParseException e)
{
throw new AlfrescoRuntimeException("Failed to parse timestamp.", e);
}
}
// Apply the mapped attributes
PropertyMap properties = nodeDescription.getProperties();
for (String key : attributeMapping.keySet())
{
QName keyQName = QName.createQName(key, this.namespaceService);
// cater for null
String attributeName = attributeMapping.get(key);
if (attributeName != null)
{
Attribute attribute = ldapAttributes.get(attributeName);
String defaultAttribute = attributeDefaults.get(key);
if (attribute != null)
{
String value = (String) attribute.get(0);
if (value != null)
{
properties.put(keyQName, value);
}
}
else if (defaultAttribute != null)
{
properties.put(keyQName, defaultAttribute);
}
else
{
// Make sure that a 2nd sync, updates deleted ldap attributes(MNT-14026)
properties.put(keyQName, null);
}
}
else
{
String defaultValue = attributeDefaults.get(key);
if (defaultValue != null)
{
properties.put(keyQName, defaultValue);
}
}
}
return nodeDescription;
}
示例8: iterator
import org.alfresco.repo.security.sync.NodeDescription; //导入依赖的package包/类
@Override
public Iterator<NodeDescription> iterator()
{
return new PersonIterator();
}
示例9: getGroups
import org.alfresco.repo.security.sync.NodeDescription; //导入依赖的package包/类
/**
*
* {@inheritDoc}
*/
@Override
public Collection<NodeDescription> getGroups(final Date modifiedSince)
{
// Work out whether the user and group trees are disjoint. This may allow us to optimize reverse DN
// resolution.
final LdapName groupDistinguishedNamePrefix = this.resolveDistinguishedNamePrefix(this.groupSearchBase);
final LdapName userDistinguishedNamePrefix = this.resolveDistinguishedNamePrefix(this.userSearchBase);
final boolean disjoint = !groupDistinguishedNamePrefix.startsWith(userDistinguishedNamePrefix)
&& !userDistinguishedNamePrefix.startsWith(groupDistinguishedNamePrefix);
final String query;
if (modifiedSince == null)
{
query = this.groupQuery;
}
else
{
final MessageFormat mf = new MessageFormat(this.groupDifferentialQuery, Locale.ENGLISH);
query = mf.format(new Object[] { this.timestampFormat.format(modifiedSince) });
}
// find duplicate gid in advance
final Set<String> groupNames = new HashSet<>();
final Map<String, AtomicInteger> groupNameCounts = new HashMap<>();
this.processQuery((result) -> {
final Attribute nameAttribute = result.getAttributes().get(this.groupIdAttributeName);
if (nameAttribute == null)
{
if (this.errorOnMissingUID)
{
final Object[] params = { result.getNameInNamespace(), this.groupIdAttributeName };
throw new AlfrescoRuntimeException("synchronization.err.ldap.get.group.id.missing", params);
}
else
{
LOGGER.warn("Missing GID on {}", result.getNameInNamespace());
}
}
else
{
final Collection<String> attributeValues = this.mapAttribute(nameAttribute, String.class);
final String groupName = attributeValues.iterator().next();
LOGGER.debug("Group DN recognized: {}", groupName);
if (groupNames.contains(groupName))
{
if (this.errorOnDuplicateGID)
{
throw new AlfrescoRuntimeException("Duplicate group id found: " + groupName);
}
LOGGER.warn("Duplicate gid found for {} -> merging definitions", groupName);
groupNameCounts.computeIfAbsent(groupName, (x) -> {
return new AtomicInteger(1);
}).getAndIncrement();
}
else
{
groupNames.add(groupName);
}
}
}, this.groupSearchBase, this.groupQuery, new String[] { this.groupIdAttributeName });
final Supplier<InitialDirContext> contextSupplier = this.buildContextSupplier();
final Function<InitialDirContext, Boolean> nextPageChecker = this.buildNextPageChecker();
final Function<InitialDirContext, NamingEnumeration<SearchResult>> groupSearcher = this.buildGroupSearcher(query);
final NodeMapper groupMapper = this.buildGroupMapper(disjoint, groupDistinguishedNamePrefix, userDistinguishedNamePrefix);
return new PersonCollection(contextSupplier, nextPageChecker, groupSearcher, groupMapper, this.queryBatchSize, groupNames.size());
}
示例10: iterator
import org.alfresco.repo.security.sync.NodeDescription; //导入依赖的package包/类
/**
*
* {@inheritDoc}
*/
@Override
public Iterator<NodeDescription> iterator()
{
return new GroupIterator(this.ctxSupplier, this.nextPageChecker, this.searcher, this.nodeMapper, this.batchSize);
}
示例11: iterator
import org.alfresco.repo.security.sync.NodeDescription; //导入依赖的package包/类
/**
*
* {@inheritDoc}
*/
@Override
public Iterator<NodeDescription> iterator()
{
return new PersonIterator(this.ctxSupplier, this.nextPageChecker, this.searcher, this.nodeMapper, this.batchSize);
}
示例12: UserRegistryNodeCollectionWorkProvider
import org.alfresco.repo.security.sync.NodeDescription; //导入依赖的package包/类
public UserRegistryNodeCollectionWorkProvider(final Collection<NodeDescription> nodeCollection)
{
this.nodeCollection = nodeCollection;
this.nodeIterator = nodeCollection.iterator();
}
示例13: getIdentifier
import org.alfresco.repo.security.sync.NodeDescription; //导入依赖的package包/类
/**
*
* {@inheritDoc}
*/
@Override
public String getIdentifier(final NodeDescription entry)
{
return entry.getSourceId();
}
示例14: process
import org.alfresco.repo.security.sync.NodeDescription; //导入依赖的package包/类
/**
*
* {@inheritDoc}
*/
@Override
public void process(final NodeDescription group) throws Throwable
{
final PropertyMap groupProperties = group.getProperties();
final String groupName = (String) groupProperties.get(ContentModel.PROP_AUTHORITY_NAME);
final String groupShortName = this.authorityService.getShortName(groupName);
final Set<String> groupZones = this.authorityService.getAuthorityZones(groupName);
// TODO Alfresco included update/creation in Analyzer, but we should aim to externalize this
if (groupZones == null)
{
this.updateGroup(group, false);
}
else
{
// Check whether the group is in any of the authentication chain zones
final Set<String> intersection = new TreeSet<>();
for (final String groupZone : groupZones)
{
if (groupZone.startsWith(AuthorityService.ZONE_AUTH_EXT_PREFIX))
{
final String baseId = groupZone.substring(AuthorityService.ZONE_AUTH_EXT_PREFIX.length());
intersection.add(baseId);
}
}
intersection.retainAll(this.allIds);
// Check whether the group is in any of the higher priority authentication chain zones
final Set<String> visited = new TreeSet<>(intersection);
visited.retainAll(this.visitedIds);
if (groupZones.contains(this.zoneId))
{
// The group already existed in this zone: update the group
this.updateGroup(group, true);
}
else if (visited.isEmpty())
{
if (!this.allowDeletions || intersection.isEmpty())
{
// Deletions are disallowed or the group exists, but not in a zone that's in the authentication
// chain. May be due to upgrade or zone changes. Let's re-zone them
LOGGER.warn("Updating group {} - this group will in future be assumed to originate from user registry {}",
groupShortName, this.id);
this.updateAuthorityZones(groupName, groupZones, this.targetZoneIds);
// The group now exists in this zone: update the group
this.updateGroup(group, true);
}
else
{
// The group existed, but in a zone with lower precedence
LOGGER.warn(
"Recreating occluded group {} - this group was previously created through synchronization with a lower priority user registry",
groupShortName);
this.authorityService.deleteAuthority(groupName);
// create the group
this.updateGroup(group, false);
}
}
}
final Date lastModified = group.getLastModified();
if (lastModified != null)
{
this.latestModified.updateAndGet(oldLastModified -> {
long newValue = lastModified.getTime();
if (oldLastModified > newValue)
{
newValue = oldLastModified;
}
return newValue;
});
}
}