Search in sources :

Example 1 with AttributeRoleDOM

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);
    }
}
Also used : AttributeRoleDOM(com.agiletec.aps.system.common.entity.parse.AttributeRoleDOM)

Example 2 with AttributeRoleDOM

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);
    }
}
Also used : IManager(com.agiletec.aps.system.common.IManager) ArrayList(java.util.ArrayList) AttributeRoleDOM(com.agiletec.aps.system.common.entity.parse.AttributeRoleDOM) AttributeRole(com.agiletec.aps.system.common.entity.model.attribute.AttributeRole)

Aggregations

AttributeRoleDOM (com.agiletec.aps.system.common.entity.parse.AttributeRoleDOM)2 IManager (com.agiletec.aps.system.common.IManager)1 AttributeRole (com.agiletec.aps.system.common.entity.model.attribute.AttributeRole)1 ArrayList (java.util.ArrayList)1