Package org.opencustomer.framework.db.util.engine.configuration

Examples of org.opencustomer.framework.db.util.engine.configuration.Configuration


                log.debug("add entities for "+listConfiguration.getType());
            }
           
            LinkedHashMap<String, Entity> entities = new LinkedHashMap<String, Entity>();

            Configuration configuration = TableFactory.getInstance().getConfiguration(listConfiguration.getType().getName());
            entities.put(configuration.getEntity().getMessageKey(), new Entity(configuration.getEntity().getMessageKey()));
           
            HashSet<Property> addedProperties = new HashSet<Property>();
           
            for(Property property : configuration.getProperties()) {
                if(property.getName().startsWith(configuration.getEntity().getAlias()+".")) {
                    entities.get(configuration.getEntity().getMessageKey()).getProperties().add(property);
                    addedProperties.add(property);
                } else if(configuration.getEntity().getMessageKey().equals(property.getEntityMessageKey())) {
                    entities.get(property.getEntityMessageKey()).getProperties().add(property);
                    addedProperties.add(property);
                }
            }
           
            for(Property property : configuration.getProperties()) {
                for(Join join : configuration.getJoins()) {
                    if(!addedProperties.contains(property)) {
                        if(property.getName().startsWith(join.getAlias()+".")) {
                            if(log.isDebugEnabled())
                                log.debug("add property by entity: "+property);
                           
View Full Code Here


           
            DocumentBuilder builder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
            Document document = builder.parse(in);
            Node root = document.getDocumentElement();
            if("configuration".equals(root.getNodeName())) {
                Configuration conf = new Configuration(file.getName().substring(0, file.getName().indexOf(".")));
               
                NodeList nodes = root.getChildNodes();
                for(int i=0; i<nodes.getLength(); i++) {
                    if(nodes.item(i).getNodeType() == Node.ELEMENT_NODE) {
                        if("entity".equals(nodes.item(i).getNodeName())) {
                            conf.setEntity(parseEntity(nodes.item(i)));
                        } else if("join".equals(nodes.item(i).getNodeName())) {
                            conf.getJoins().add(parseJoin(nodes.item(i)));                           
                        } else if("restriction".equals(nodes.item(i).getNodeName())) {
                            conf.getRestrictions().add(parseRestriction(nodes.item(i)));                           
                        } else if("property".equals(nodes.item(i).getNodeName())) {
                            Property property = parseProperty(conf, nodes.item(i));
                            if(property.isId()) {
                                if(conf.getId() == null) {
                                    conf.setId(property);
                                } else {
                                    throw new TableEngineException("found duplicate id property");
                                }
                            }
                            property.setAlias("alias_"+conf.getProperties().size());
                            property.setPosition(conf.getProperties().size());
                            conf.getProperties().add(property);                           
                        }
                    }
                }
               
                if(log.isDebugEnabled())
                    log.debug("add list renderer: "+conf.getName());
               
                engines.put(conf.getName(), new TableEngine(conf));
            } else {
                throw new TableEngineException("invalid attribute found: '"+root.getNodeName()+"' (need: 'configuration')");
            }
        } catch(Exception e) {
            if(in != null) {
View Full Code Here

TOP

Related Classes of org.opencustomer.framework.db.util.engine.configuration.Configuration

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.