Search in sources :

Example 1 with AttributeDisablingCodesDOM

use of com.agiletec.aps.system.common.entity.parse.AttributeDisablingCodesDOM in project entando-core by entando.

the class AttributeDisablingCodesLoader method loadDefaultDisablingCodes.

private void loadDefaultDisablingCodes(String disablingCodesFileName, Map<String, String> disablingCodes) {
    try {
        String xml = this.extractConfigFile(disablingCodesFileName);
        if (null != xml) {
            AttributeDisablingCodesDOM dom = new AttributeDisablingCodesDOM();
            disablingCodes.putAll(dom.extractDisablingCodes(xml, disablingCodesFileName));
        }
    } catch (Throwable t) {
        _logger.error("Error loading disabling codes from file {}", disablingCodesFileName, t);
    }
}
Also used : AttributeDisablingCodesDOM(com.agiletec.aps.system.common.entity.parse.AttributeDisablingCodesDOM)

Example 2 with AttributeDisablingCodesDOM

use of com.agiletec.aps.system.common.entity.parse.AttributeDisablingCodesDOM in project entando-core by entando.

the class ExtraAttributeDisablingCodesWrapper method executeLoading.

public void executeLoading(Map<String, String> collectionToFill, IEntityManager entityManager) throws ApsSystemException {
    String managerName = ((IManager) entityManager).getName();
    if (!managerName.equals(super.getEntityManagerNameDest())) {
        return;
    }
    try {
        String xml = super.extractXml();
        AttributeDisablingCodesDOM dom = new AttributeDisablingCodesDOM();
        Map<String, String> codeMap = dom.extractDisablingCodes(xml, this.getDefsFilePath());
        List<String> codes = new ArrayList<>(codeMap.keySet());
        for (int i = 0; i < codes.size(); i++) {
            String code = codes.get(i);
            if (collectionToFill.containsKey(code)) {
                _logger.warn("You can't override existing disabling code : {} - {}", code, collectionToFill.get(code));
            } else {
                collectionToFill.put(code, codeMap.get(code));
                _logger.info("Added new disabling code : {} - {}", code, collectionToFill.get(code));
            }
        }
    } catch (Throwable t) {
        // ApsSystemUtils.logThrowable(t, this, "executeLoading", "Error loading extra attribute disabling codes");
        _logger.error("Error loading extra attribute disabling codes", t);
    }
}
Also used : AttributeDisablingCodesDOM(com.agiletec.aps.system.common.entity.parse.AttributeDisablingCodesDOM) IManager(com.agiletec.aps.system.common.IManager) ArrayList(java.util.ArrayList)

Aggregations

AttributeDisablingCodesDOM (com.agiletec.aps.system.common.entity.parse.AttributeDisablingCodesDOM)2 IManager (com.agiletec.aps.system.common.IManager)1 ArrayList (java.util.ArrayList)1