本文整理汇总了Java中org.alfresco.repo.security.sync.NodeDescription.getProperties方法的典型用法代码示例。如果您正苦于以下问题:Java NodeDescription.getProperties方法的具体用法?Java NodeDescription.getProperties怎么用?Java NodeDescription.getProperties使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.alfresco.repo.security.sync.NodeDescription
的用法示例。
在下文中一共展示了NodeDescription.getProperties方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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;
}
示例2: 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;
});
}
}