Search in sources :

Example 1 with SmallEntityType

use of com.agiletec.aps.system.common.entity.model.SmallEntityType in project entando-core by entando.

the class EntityTypeDOM method extractSmallEntityTypes.

@Override
public List<SmallEntityType> extractSmallEntityTypes(String xml) throws ApsSystemException {
    List<SmallEntityType> list = new ArrayList<>();
    Document document = this.decodeDOM(xml);
    List<Element> entityElements = document.getRootElement().getChildren();
    for (int i = 0; i < entityElements.size(); i++) {
        Element entityElem = entityElements.get(i);
        String typeCode = this.extractXmlAttribute(entityElem, "typecode", true);
        String typeDescr = this.extractXmlAttribute(entityElem, "typedescr", true);
        list.add(new SmallEntityType(typeCode, typeDescr));
    }
    return list;
}
Also used : SmallEntityType(com.agiletec.aps.system.common.entity.model.SmallEntityType) Element(org.jdom.Element) ArrayList(java.util.ArrayList) Document(org.jdom.Document)

Example 2 with SmallEntityType

use of com.agiletec.aps.system.common.entity.model.SmallEntityType in project entando-core by entando.

the class ApsEntityManager method getSmallEntityTypes.

@Override
public List<SmallEntityType> getSmallEntityTypes() {
    List<SmallEntityType> smallTypes = null;
    try {
        smallTypes = this.getEntityTypeFactory().extractSmallEntityTypes(this.getConfigItemName(), this.getEntityTypeDom());
        BeanComparator comparator = new BeanComparator("description");
        Collections.sort(smallTypes, comparator);
    } catch (Exception e) {
        logger.error("Error while extracting small entity types", e);
        throw new RuntimeException("Error while extracting small entity types", e);
    }
    return smallTypes;
}
Also used : SmallEntityType(com.agiletec.aps.system.common.entity.model.SmallEntityType) BeanComparator(org.apache.commons.beanutils.BeanComparator) ApsSystemException(com.agiletec.aps.system.exception.ApsSystemException) IOException(java.io.IOException) ParserConfigurationException(javax.xml.parsers.ParserConfigurationException) SAXException(org.xml.sax.SAXException)

Example 3 with SmallEntityType

use of com.agiletec.aps.system.common.entity.model.SmallEntityType in project entando-core by entando.

the class DataObjectManager method getSmallDataTypesMap.

/**
 * Return the map of the prototypes of the dataobjects types. Return a map,
 * index by the code of the type, of the prototypes of the available
 * dataobject types.
 *
 * @return The map of the prototypes of the dataobject types in a
 * 'SmallDataObjectType' objects.
 */
@Override
public Map<String, SmallDataType> getSmallDataTypesMap() {
    Map<String, SmallDataType> smallDataTypes = new HashMap<>();
    List<SmallEntityType> entityTypes = super.getSmallEntityTypes();
    for (SmallEntityType entityType : entityTypes) {
        SmallDataType sdt = new SmallDataType();
        sdt.setCode(entityType.getCode());
        sdt.setDescription(entityType.getDescription());
        smallDataTypes.put(entityType.getCode(), sdt);
    }
    return smallDataTypes;
}
Also used : SmallDataType(org.entando.entando.aps.system.services.dataobject.model.SmallDataType) HashMap(java.util.HashMap) SmallEntityType(com.agiletec.aps.system.common.entity.model.SmallEntityType)

Example 4 with SmallEntityType

use of com.agiletec.aps.system.common.entity.model.SmallEntityType in project entando-core by entando.

the class ContentManager method getSmallContentTypesMap.

/**
 * Return the map of the prototypes of the contents types. Return a map,
 * index by the code of the type, of the prototypes of the available content
 * types.
 *
 * @return The map of the prototypes of the content types in a
 * 'SmallContentType' objects.
 */
@Override
public Map<String, SmallContentType> getSmallContentTypesMap() {
    Map<String, SmallContentType> smallContentTypes = new HashMap<>();
    List<SmallEntityType> entityTypes = super.getSmallEntityTypes();
    for (SmallEntityType entityType : entityTypes) {
        SmallContentType sct = new SmallContentType();
        sct.setCode(entityType.getCode());
        sct.setDescription(entityType.getDescription());
        smallContentTypes.put(entityType.getCode(), sct);
    }
    return smallContentTypes;
}
Also used : HashMap(java.util.HashMap) SmallEntityType(com.agiletec.aps.system.common.entity.model.SmallEntityType) SmallContentType(com.agiletec.plugins.jacms.aps.system.services.content.model.SmallContentType)

Example 5 with SmallEntityType

use of com.agiletec.aps.system.common.entity.model.SmallEntityType in project entando-core by entando.

the class ApsEntityManager method getEntityTypeCodes.

protected List<String> getEntityTypeCodes() {
    List<String> codes = new ArrayList<>();
    List<SmallEntityType> smallTypes = this.getSmallEntityTypes();
    for (SmallEntityType smallType : smallTypes) {
        codes.add(smallType.getCode());
    }
    return codes;
}
Also used : SmallEntityType(com.agiletec.aps.system.common.entity.model.SmallEntityType) ArrayList(java.util.ArrayList)

Aggregations

SmallEntityType (com.agiletec.aps.system.common.entity.model.SmallEntityType)5 ArrayList (java.util.ArrayList)2 HashMap (java.util.HashMap)2 ApsSystemException (com.agiletec.aps.system.exception.ApsSystemException)1 SmallContentType (com.agiletec.plugins.jacms.aps.system.services.content.model.SmallContentType)1 IOException (java.io.IOException)1 ParserConfigurationException (javax.xml.parsers.ParserConfigurationException)1 BeanComparator (org.apache.commons.beanutils.BeanComparator)1 SmallDataType (org.entando.entando.aps.system.services.dataobject.model.SmallDataType)1 Document (org.jdom.Document)1 Element (org.jdom.Element)1 SAXException (org.xml.sax.SAXException)1