use of com.agiletec.aps.system.common.entity.parse.AttributeRoleDOM in project entando-core by entando.
the class AttributeRolesLoader method loadDefaultRoles.
private void loadDefaultRoles(String attributeRolesFileName, Map<String, AttributeRole> attributeRoles) {
try {
String xml = this.extractConfigFile(attributeRolesFileName);
if (null != xml) {
AttributeRoleDOM dom = new AttributeRoleDOM();
attributeRoles.putAll(dom.extractRoles(xml, attributeRolesFileName));
}
} catch (Throwable t) {
_logger.error("Error loading attribute Roles : file {}", attributeRolesFileName, t);
}
}
use of com.agiletec.aps.system.common.entity.parse.AttributeRoleDOM in project entando-core by entando.
the class ExtraAttributeRolesWrapper method executeLoading.
public void executeLoading(Map<String, AttributeRole> collectionToFill, IEntityManager entityManager) throws ApsSystemException {
String managerName = ((IManager) entityManager).getName();
if (!managerName.equals(super.getEntityManagerNameDest())) {
return;
}
AttributeRoleDOM dom = new AttributeRoleDOM();
try {
String xml = super.extractXml();
Map<String, AttributeRole> attributeRoles = dom.extractRoles(xml, this.getDefsFilePath());
List<AttributeRole> roles = new ArrayList<>(attributeRoles.values());
for (int i = 0; i < roles.size(); i++) {
AttributeRole role = roles.get(i);
if (collectionToFill.containsKey(role.getName())) {
_logger.warn("You can't override existing attribute role : {} - {}", role.getName(), role.getDescription());
} else {
collectionToFill.put(role.getName(), role);
_logger.info("Added new attribute role : {} - {}", role.getName(), role.getDescription());
}
}
} catch (Throwable t) {
// ApsSystemUtils.logThrowable(t, this, "executeLoading", "Error loading extra attribute Roles");
_logger.error("Error loading extra attribute Roles", t);
}
}
Aggregations