public static boolean isLdapAttributeDelete(TreeComponent tree, Node node) {
return isLdapAttribute(tree, node) && (node.m_CROM.getType() & CROM.CROM_t_LdapAttributeRemove) != 0;
}
public static void setLdapAttributeReplaceAll(TreeComponent tree, Node node) {
TreeMapper tm = tree.getTreeMapper();
if (tm == null) {
return;
}
boolean bAttributeRemove = isLdapAttributeDelete(tree, node);
boolean bAttributeReplaceAll = !bAttributeRemove && isLdapAttributeReplaceAll(tree, node);
if (bAttributeReplaceAll) {
return;
}
String name = KongaStringUtils.unwrap(node.m_deName);
String cmd_path = name + LdapStringConstants.attribute_command_de_name;
String old_value_path = name + LdapStringConstants.old_value_de_name;
String cmd = "Replace all";
Node cmd_node = tree.findNode(cmd_path);
Node old_value_node = tree.findNode(old_value_path);
node.m_CROM.clearType(CROM.CROM_t_LdapAttributeReplaceAll | CROM.CROM_t_LdapAttributeRemove);
if (cmd_node == null) {
cmd_node = insertAttributeCommand(tree, node);
}
if (cmd_node == null) {
return;
}
node.m_CROM.addType(CROM.CROM_t_LdapAttributeReplaceAll);
NodeMapping mapping = tm.getNodeMappingFactory().newMapping(new NodePath(cmd_path), cmd);
tm.getMappingManager().addMapping(mapping);
if (old_value_node != null) {
tree.getTreeMapper().deleteMapping(new NodePath(old_value_path));
}
tm.updateMappingFlag();
tm.updateMapAreaTables(cmd_path, cmd);
tm.getMappingManager().changeHighLighted(mapping);
tm.setDirty(true);
}