Java 类org.dom4j.tree.BaseElement 实例源码

项目:directory-ldap-api    文件:ApiDsmlParserOsgiTest.java   
@Override
protected void useBundleClasses() throws Exception
{
    new Dsmlv2Grammar();

    new AddRequestDsml( null );
    new SearchRequestDsml( null );

    ParserUtils.base64Encode( "abc" );
    new Dn( "cn=foo" );
    new LdapUrl( "ldap://example.com/" );
    ResultCodeEnum.TOO_LATE.getMessage();
    ParserUtils.needsBase64Encoding( null );
    ParserUtils.parseAndVerifyRequestID( "5", null );
    new BaseElement( "foo" );
    context.getService( context.getServiceReference( LdapApiService.class.getName() ) );
    new AddRequestImpl();
    new ReferralImpl();
    new LdapResultImpl();

    new SearchResponse();
    new LdapResultDsml( null, null, null );
    new SearchResultEntryDsml( null );
    new SearchResultDoneDsml( null );
}
项目:bdf2    文件:JoinConverter.java   
public JpdlInfo toJpdl(Element element) {
    BaseElement targetElement=new BaseElement("join");
    String name=this.buildCommonJpdlElement(element, targetElement);
    String lockmode=element.attributeValue("lockmode");
    String multiplicity=element.attributeValue("multiplicity");
    if(StringUtils.isNotEmpty(lockmode)){
        targetElement.addAttribute("lockmode", lockmode);
    }
    if(StringUtils.isNotEmpty(multiplicity)){
        targetElement.addAttribute("multiplicity", multiplicity);
    }
    JpdlInfo info=new JpdlInfo();
    info.setName(name);
    info.setElement(targetElement);
    return info;
}
项目:bdf2    文件:DecisionConverter.java   
public JpdlInfo toJpdl(Element element) {
    BaseElement targetElement=new BaseElement("decision");
    String name=this.buildCommonJpdlElement(element, targetElement);
    String decisionType=element.attributeValue("decisionType");
    String decisionValue=element.attributeValue("decisionValue");
    if(decisionType.equals("handler")){
        BaseElement handlerElement=new BaseElement("handler");
        handlerElement.addAttribute("class", decisionValue);
        targetElement.add(handlerElement);
    }else{
        targetElement.addAttribute("expr",decisionValue);
    }
    JpdlInfo info=new JpdlInfo();
    info.setName(name);
    info.setElement(targetElement);
    return info;
}
项目:bdf2    文件:AbstractConverter.java   
protected String buildCommonJpdlElement(Element element,Element targetElement){
    String name=element.attributeValue("name");
    String desc=element.attributeValue("desc");
    targetElement.addAttribute("name",name);
    Element descElement=new BaseElement("description");
    if(StringUtils.isNotEmpty(desc)){
        descElement.setText(desc);          
    }
    int width=Integer.parseInt(element.attributeValue("width"));
    int height=Integer.parseInt(element.attributeValue("height"));
    int x=Integer.parseInt(element.attributeValue("x"));
    int y=Integer.parseInt(element.attributeValue("y"));
    x=x-(width/2);
    y=y-(height/2);
    String g=x+","+y+","+width+","+height;
    if(this instanceof TransitionConverter){
        g=x+","+y;          
    }
    targetElement.addAttribute("g", g);
    /*for(Object obj:element.attributes()){
        Attribute attr=(Attribute)obj;
        targetElement.addAttribute(attr.getName(),attr.getValue());
    }*/
    return name;
}
项目:bdf2    文件:TaskConverter.java   
public JpdlInfo toJpdl(Element element) {
    BaseElement targetElement=new BaseElement("task");
    String name=this.buildCommonJpdlElement(element, targetElement);
    String assignmentType=element.attributeValue("assignmentType");
    String assignmentValue=element.attributeValue("assignmentValue");
    if(assignmentType.equals("assignment-handler")){
        BaseElement handlerElement=new BaseElement("assignment-handler");
        handlerElement.addAttribute("class", assignmentValue);
        targetElement.add(handlerElement);
    }else{
        targetElement.addAttribute(assignmentType, assignmentValue);
    }
    JpdlInfo info=new JpdlInfo();
    info.setName(name);
    info.setElement(targetElement);
    return info;
}
项目:bdf2    文件:AbstractConverter.java   
protected void fillDataSetAndDataPathProperty(Element element,ComponentInfo component,boolean isCollection){
    String[] dataSetDataPath=this.retriveDataSetAndDataPath(component);
    if(dataSetDataPath!=null){
        if(StringHelper.isNotEmpty(dataSetDataPath[0])){
            BaseElement dataSetElement=new BaseElement("Property"); 
            dataSetElement.addAttribute("name", "dataSet");
            dataSetElement.setText(dataSetDataPath[0]);
            element.add(dataSetElement);
        }
        if(StringHelper.isNotEmpty(dataSetDataPath[1]) && !hasDataPath(component)){
            BaseElement dataPathElement=new BaseElement("Property");
            dataPathElement.addAttribute("name", "dataPath");
            String dataPath=dataSetDataPath[1];
            if(!isCollection){
                int pos=dataPath.lastIndexOf(".");
                if(pos>0){
                    dataPath=dataPath.substring(0,pos)+".#"+dataPath.substring(pos+1,dataPath.length());
                }                   
            }

            dataPathElement.setText(dataPath);
            element.add(dataPathElement);
        }
    }
}
项目:bdf2    文件:MenuItemConverter.java   
public Element convert(ComponentInfo component, RuleSet ruleSet,
        Element rootElement) throws Exception {
    String name=MenuItem.class.getSimpleName();
    XmlNode node=MenuItem.class.getAnnotation(XmlNode.class);
    if(node!=null && StringHelper.isNotEmpty(node.nodeName())){
        name=node.nodeName();
    }
    Rule rule=ruleSet.getRule(name);
    BaseElement element = fillElement(component,ruleSet,rule,rootElement);
    if(component.getChildren()!=null){
        for(ComponentInfo c:component.getChildren()){
            this.buildChildren(element,c,ruleSet,rootElement);                          
        }
    }
    return element;
}
项目:bdf2    文件:DialogConverter.java   
public Element convert(ComponentInfo component, RuleSet ruleSet,
        Element rootElement) throws Exception {
    String name=Dialog.class.getSimpleName();
    XmlNode node=Dialog.class.getAnnotation(XmlNode.class);
    if(node!=null && StringHelper.isNotEmpty(node.nodeName())){
        name=node.nodeName();
    }
    Rule rule=ruleSet.getRule(name);
    BaseElement element = fillElement(component,ruleSet,rule,rootElement);
    if(component.getChildren()!=null){
        for(ComponentInfo c:component.getChildren()){
            this.buildChildren(element,c,ruleSet,rootElement);                          
        }
    }
    return element;
}
项目:bdf2    文件:ToolBarConverter.java   
public Element convert(ComponentInfo component, RuleSet ruleSet,
        Element rootElement) throws Exception {
    String name=ToolBar.class.getSimpleName();
    XmlNode node=ToolBar.class.getAnnotation(XmlNode.class);
    if(node!=null && StringHelper.isNotEmpty(node.nodeName())){
        name=node.nodeName();
    }
    Rule rule=ruleSet.getRule(name);
    BaseElement element = fillElement(component,ruleSet,rule,rootElement);
    if(component.getChildren()!=null){
        for(ComponentInfo c:component.getChildren()){
            this.buildChildren(element,c,ruleSet,rootElement);                          
        }
    }
    return element;
}
项目:bdf2    文件:DataColumnConverter.java   
public Element convert(ComponentInfo component, RuleSet ruleSet,Element rootElement)
        throws Exception {
    String name=DataColumn.class.getSimpleName();
    XmlNode node=DataColumn.class.getAnnotation(XmlNode.class);
    if(node!=null && StringHelper.isNotEmpty(node.nodeName())){
        name=node.nodeName();
    }
    Rule rule=ruleSet.getRule(name);
    BaseElement element = fillElement(component,ruleSet,rule,rootElement);

    boolean addProperty=true;
    for(ComponentProperty cp:component.getComponentProperties()){
        if(cp.getName().equals("property")){
            addProperty=false;
            break;
        }
    }
    if(addProperty){
        BaseElement propertyElement=new BaseElement("Property");
        propertyElement.addAttribute("name","property");
        propertyElement.setText(component.getName());
        element.add(propertyElement);
    }

    return element;
}
项目:bdf2    文件:AccordionConverter.java   
public Element convert(ComponentInfo component, RuleSet ruleSet,
        Element rootElement) throws Exception {
    String name=Accordion.class.getSimpleName();
    XmlNode node=Accordion.class.getAnnotation(XmlNode.class);
    if(node!=null && StringHelper.isNotEmpty(node.nodeName())){
        name=node.nodeName();
    }
    Rule rule=ruleSet.getRule(name);
    BaseElement element = fillElement(component,ruleSet,rule,rootElement);
    if(component.getChildren()!=null){
        for(ComponentInfo c:component.getChildren()){
            this.buildChildren(element,c,ruleSet,rootElement);                          
        }
    }
    return element;
}
项目:bdf2    文件:CustomDropDownConverter.java   
public Element convert(ComponentInfo component, RuleSet ruleSet,
        Element rootElement) throws Exception {
    String name=CustomDropDown.class.getSimpleName();
    XmlNode node=CustomDropDown.class.getAnnotation(XmlNode.class);
    if(node!=null && StringHelper.isNotEmpty(node.nodeName())){
        name=node.nodeName();
    }
    Rule rule=ruleSet.getRule(name);
    BaseElement element = fillElement(component,ruleSet,rule,rootElement);
    if(component.getChildren()!=null){
        for(ComponentInfo c:component.getChildren()){
            this.buildChildren(element,c,ruleSet,rootElement);                          
        }
    }
    return element;
}
项目:bdf2    文件:DataTreeConverter.java   
public Element convert(ComponentInfo component, RuleSet ruleSet,
        Element rootElement) throws Exception {
    String name=DataTree.class.getSimpleName();
    XmlNode node=DataTree.class.getAnnotation(XmlNode.class);
    if(node!=null && StringHelper.isNotEmpty(node.nodeName())){
        name=node.nodeName();
    }
    Rule rule=ruleSet.getRule(name);
    BaseElement element = fillElement(component,ruleSet,rule,rootElement);
    this.fillDataSetAndDataPathProperty(element, component,true);
    if(component.getChildren()!=null){
        for(ComponentInfo c:component.getChildren()){
            this.buildChildren(element,c,ruleSet,rootElement);                          
        }
    }
    return element;
}
项目:bdf2    文件:SplitPanelConverter.java   
public Element convert(ComponentInfo component, RuleSet ruleSet,
        Element rootElement) throws Exception {
    String name=SplitPanel.class.getSimpleName();
    XmlNode node=SplitPanel.class.getAnnotation(XmlNode.class);
    if(node!=null && StringHelper.isNotEmpty(node.nodeName())){
        name=node.nodeName();
    }
    Rule rule=ruleSet.getRule(name);
    BaseElement element = fillElement(component,ruleSet,rule,rootElement);
    if(component.getChildren()!=null){
        for(ComponentInfo c:component.getChildren()){
            this.buildChildren(element,c,ruleSet,rootElement);                          
        }
    }
    return element;
}
项目:bdf2    文件:SectionConverter.java   
public Element convert(ComponentInfo component, RuleSet ruleSet,
        Element rootElement) throws Exception {
    String name=Section.class.getSimpleName();
    XmlNode node=Section.class.getAnnotation(XmlNode.class);
    if(node!=null && StringHelper.isNotEmpty(node.nodeName())){
        name=node.nodeName();
    }
    Rule rule=ruleSet.getRule(name);
    BaseElement element = fillElement(component,ruleSet,rule,rootElement);
    if(component.getChildren()!=null){
        for(ComponentInfo c:component.getChildren()){
            this.buildChildren(element,c,ruleSet,rootElement);                          
        }
    }
    return element;
}
项目:bdf2    文件:ControlTabConverter.java   
public Element convert(ComponentInfo component, RuleSet ruleSet,
        Element rootElement) throws Exception {
    String name=ControlTab.class.getSimpleName();
    XmlNode node=ControlTab.class.getAnnotation(XmlNode.class);
    if(node!=null && StringHelper.isNotEmpty(node.nodeName())){
        name=node.nodeName();
    }
    Rule rule=ruleSet.getRule(name);
    BaseElement element = fillElement(component,ruleSet,rule,rootElement);
    if(component.getChildren()!=null){
        for(ComponentInfo c:component.getChildren()){
            this.buildChildren(element,c,ruleSet,rootElement);                          
        }
    }
    return element;
}
项目:bdf2    文件:DataGridConverter.java   
public Element convert(ComponentInfo component, RuleSet ruleSet,Element rootElement)
        throws Exception {
    String name=DataGrid.class.getSimpleName();
    XmlNode node=DataGrid.class.getAnnotation(XmlNode.class);
    if(node!=null && StringHelper.isNotEmpty(node.nodeName())){
        name=node.nodeName();
    }
    Rule rule=ruleSet.getRule(name);
    BaseElement element = fillElement(component,ruleSet,rule,rootElement);
    this.fillDataSetAndDataPathProperty(element, component,true);
    if(component.getChildren()!=null){
        for(ComponentInfo c:component.getChildren()){
            this.buildChildren(element,c,ruleSet,rootElement);                          
        }
    }
    return element;
}
项目:bdf2    文件:AutoFormConverter.java   
public Element convert(ComponentInfo component, RuleSet ruleSet,Element rootElement)
        throws Exception {
    String name=AutoForm.class.getSimpleName();
    XmlNode node=AutoForm.class.getAnnotation(XmlNode.class);
    if(node!=null && StringHelper.isNotEmpty(node.nodeName())){
        name=node.nodeName();
    }
    Rule rule=ruleSet.getRule(name);
    BaseElement element = fillElement(component,ruleSet,rule,rootElement);
    this.fillDataSetAndDataPathProperty(element, component,false);
    if(component.getChildren()!=null){
        for(ComponentInfo c:component.getChildren()){
            this.buildChildren(element,c,ruleSet,rootElement);                          
        }
    }

    return element;
}
项目:bdf2    文件:ContainerConverter.java   
public Element convert(ComponentInfo component, RuleSet ruleSet,
        Element rootElement) throws Exception {
    String name=Container.class.getSimpleName();
    XmlNode node=Container.class.getAnnotation(XmlNode.class);
    if(node!=null && StringHelper.isNotEmpty(node.nodeName())){
        name=node.nodeName();
    }
    Rule rule=ruleSet.getRule(name);
    BaseElement element = fillElement(component,ruleSet,rule,rootElement);
    if(component.getChildren()!=null){
        for(ComponentInfo c:component.getChildren()){
            this.buildChildren(element,c,ruleSet,rootElement);                          
        }
    }
    return element;
}
项目:bdf2    文件:MenuConverter.java   
public Element convert(ComponentInfo component, RuleSet ruleSet,
        Element rootElement) throws Exception {
    String name=Menu.class.getSimpleName();
    XmlNode node=Menu.class.getAnnotation(XmlNode.class);
    if(node!=null && StringHelper.isNotEmpty(node.nodeName())){
        name=node.nodeName();
    }
    Rule rule=ruleSet.getRule(name);
    BaseElement element = fillElement(component,ruleSet,rule,rootElement);
    if(component.getChildren()!=null){
        for(ComponentInfo c:component.getChildren()){
            this.buildChildren(element,c,ruleSet,rootElement);                          
        }
    }
    return element;
}
项目:bdf2    文件:PanelConverter.java   
public Element convert(ComponentInfo component, RuleSet ruleSet,
        Element rootElement) throws Exception {
    String name=Panel.class.getSimpleName();
    XmlNode node=Panel.class.getAnnotation(XmlNode.class);
    if(node!=null && StringUtils.isNotEmpty(node.nodeName())){
        name=node.nodeName();
    }
    Rule rule=ruleSet.getRule(name);
    BaseElement element = fillElement(component,ruleSet,rule,rootElement);
    if(component.getChildren()!=null){
        for(ComponentInfo c:component.getChildren()){
            this.buildChildren(element,c,ruleSet,rootElement);                          
        }
    }
    return element;
}
项目:bdf2    文件:RadioGroupConverter.java   
public Element convert(ComponentInfo component, RuleSet ruleSet,
        Element rootElement) throws Exception {
    String name=RadioGroup.class.getSimpleName();
    XmlNode node=RadioGroup.class.getAnnotation(XmlNode.class);
    if(node!=null && StringHelper.isNotEmpty(node.nodeName())){
        name=node.nodeName();
    }
    Rule rule=ruleSet.getRule(name);
    BaseElement element = fillElement(component,ruleSet,rule,rootElement);
    this.fillDataSetAndDataPathProperty(element, component,false);
    if(component.getChildren()!=null){
        for(ComponentInfo c:component.getChildren()){
            this.buildChildren(element,c,ruleSet,rootElement);                          
        }
    }
    return element;
}
项目:bdf2    文件:ColumnGroupConverter.java   
public Element convert(ComponentInfo component, RuleSet ruleSet,
        Element rootElement) throws Exception {
    String name=ColumnGroup.class.getSimpleName();
    XmlNode node=ColumnGroup.class.getAnnotation(XmlNode.class);
    if(node!=null && StringHelper.isNotEmpty(node.nodeName())){
        name=node.nodeName();
    }
    Rule rule=ruleSet.getRule(name);
    BaseElement element = fillElement(component,ruleSet,rule,rootElement);
    if(component.getChildren()!=null){
        for(ComponentInfo c:component.getChildren()){
            this.buildChildren(element,c,ruleSet,rootElement);                          
        }
    }
    return element;
}
项目:bdf2    文件:TabControlConverter.java   
public Element convert(ComponentInfo component, RuleSet ruleSet,
        Element rootElement) throws Exception {
    String name=TabControl.class.getSimpleName();
    XmlNode node=TabControl.class.getAnnotation(XmlNode.class);
    if(node!=null && StringHelper.isNotEmpty(node.nodeName())){
        name=node.nodeName();
    }
    Rule rule=ruleSet.getRule(name);
    BaseElement element = fillElement(component,ruleSet,rule,rootElement);
    if(component.getChildren()!=null){
        for(ComponentInfo c:component.getChildren()){
            this.buildChildren(element,c,ruleSet,rootElement);                          
        }
    }
    return element;
}
项目:bdf2    文件:AbstractBuilder.java   
protected Element createEntityFieldsCollectionElement(Entity fieldEntity){
    Collection<EntityField> entityFields=fieldEntity.getEntityFields();
    String entityTableName=fieldEntity.getTableName();
    Element collection=new BaseElement("Collection");
    for(EntityField ef:entityFields){
        if(!entityTableName.equals(ef.getTableName())){
            continue;
        }
        Element entity = new BaseElement("Entity");
        entity.add(this.createPropertyElement("name", ef.getName()));
        entity.add(this.createPropertyElement("keyGenerator", ef.getKeyGenerator()));
        entity.add(this.createPropertyElement("keyGenerateType", ef.getKeyGenerateType().toString()));
        entity.add(this.createPropertyElement("submittable", String.valueOf(ef.isSubmittable())));
        collection.add(entity);
    }
    return collection;
}
项目:bdf2    文件:ViewBuilder.java   
private void fillViewProperties(Element element,Rule rule,PageInfo page){
    Map<String,Property> properties=rule.getProperties();
    for(String key:properties.keySet()){
        Property p=properties.get(key);
        if(p!=null){
            String propertyName=p.getName();
            String propertyValue=getPropertyValue(page.getProperties(),propertyName);
            if(StringUtils.hasText(propertyValue)){
                BaseElement propertyElement=new BaseElement("Property");
                propertyElement.addAttribute("name", propertyName);
                propertyElement.setText(propertyValue);
                element.add(propertyElement);
            }
        }
    }
}
项目:bdf2    文件:ViewBuilder.java   
private Element createDataSetElement(Entity entity,RuleSet ruleSet) throws Exception{
    if(StringHelper.isEmpty(entity.getParentId())){
        BaseElement element = generateDataSetElement(ruleSet);
        element.addAttribute("id", "dataSet"+entity.getName());
        String entityName=entity.getName();
        Element dataTypeElement=createPropertyElement("dataType","["+entityName+"]");
        element.add(dataTypeElement);
        Element dataProviderElement=createPropertyElement("dataProvider","dataProvider"+entityName.substring(0,1).toUpperCase()+entityName.substring(1,entityName.length()));
        element.add(dataProviderElement);
        element.add(createDataSetParameterElement(entity));
        if(entity.getPageSize()>0){
            Element pageSizeElement=createPropertyElement("pageSize",String.valueOf(entity.getPageSize()));
            element.add(pageSizeElement);
        }
        return element;         
    }else{
        return null;
    }
}
项目:bdf2    文件:ArgumentsBuilder.java   
public Element build(PageInfo page, RuleSet ruleSet) throws Exception {
    BaseElement element=new BaseElement("Arguments");
    Map<String,Mapping> map=new HashMap<String,Mapping>();
    for(ComponentInfo component:page.getComponents()){
        this.retriveMapping(component, map);
    }
    for(Mapping mapping:map.values()){
        BaseElement attributeElement=new BaseElement("Argument");
        attributeElement.addAttribute("name","arg"+mapping.getId().replace("-", ""));
        BaseElement propertyElement=new BaseElement("Property");
        propertyElement.addAttribute("name","value");
        propertyElement.setText(mapping.getQuerySql());
        attributeElement.add(propertyElement);
        element.add(attributeElement);          
    }
    return element;
}
项目:bdf2    文件:ModelBuilder.java   
public Element build(PageInfo page,RuleSet ruleSet) throws Exception{
    Rule modelRule=ruleSet.getRule("Model");
    BaseElement rootElement=new BaseElement(modelRule.getNodeName());
    Collection<Entity> pageEntities=retriveAllPageEntity(page);
    Map<String,Element> elementMap=new HashMap<String,Element>();
    Map<String,String> map=new HashMap<String,String>();
    for(Entity entity:pageEntities){
        buildDataTypeElement(entity,ruleSet,elementMap);
        if(!map.containsKey(entity.getName())){
            rootElement.add(this.createDataProvider(entity));           
            map.put(entity.getName(), entity.getName());
        }
    }
    Map<String,ActionDef> actionMap=new HashMap<String,ActionDef>();
    for(ComponentInfo component:page.getComponents()){
        this.retriveAllActionDefs(component, actionMap);
    }
    for(ActionDef actionDef:actionMap.values()){
        rootElement.add(this.createDataResolver(actionDef));
    }
    for(Element element:elementMap.values()){
        rootElement.add(element);
    }

    return rootElement;
}
项目:bdf2    文件:ModelBuilder.java   
private Element createReferencePropertyDef(Entity entity,RuleSet ruleSet,boolean isSelf){
    String nodeName=Reference.class.getSimpleName();
    Rule rule=ruleSet.getRule(nodeName);
    Element referenceDefElement=new BaseElement(rule.getNodeName());
    referenceDefElement.addAttribute("name", entity.getName());
    //创建dataType与dataProvider属性
    Element dataTypeElement=createPropertyElement("dataType",null);
    if(isSelf){
        dataTypeElement.setText("[SELF]");          
    }else{
        dataTypeElement.setText("["+ entity.getName()+"]");                     
    }
    referenceDefElement.add(dataTypeElement);
    String entityName=entity.getName();
    Element dataProviderElement=createPropertyElement("dataProvider","dataProvider"+entityName.substring(0,1).toUpperCase()+entityName.substring(1,entityName.length()));
    if(entity.getPageSize()>0){
        Element pageSizeElement=createPropertyElement("pageSize",String.valueOf(entity.getPageSize()));
        referenceDefElement.add(pageSizeElement);
    }
    referenceDefElement.add(dataProviderElement);
    referenceDefElement.add(createReferenceParameterElement(entity));
    return referenceDefElement;
}
项目:bdf2    文件:ModelBuilder.java   
private Element createReferenceParameterElement(Entity entity){
    Element element = createPropertyElement("parameter",null);
    BaseElement entityElement = new BaseElement("Entity");
    element.add(entityElement);
    if(entity.getParameters()!=null){
        Element entityQueryParametersElement = createPropertyElement(Constants.ENTITY_QUERY_PARAMETERS,null);
        entityQueryParametersElement.add(this.createEntityQueryParametersElement(entity.getParameters()));
        entityElement.add(entityQueryParametersElement);
        for(Parameter p:entity.getParameters()){
            entityElement.add(createPropertyElement(p.getName(),p.getValue()));                     
        }
    }
    if(entity.getEntityFields()!=null){
        Element entityFieldsElement=this.createPropertyElement("entityFields", null);
        entityFieldsElement.add(this.createEntityFieldsCollectionElement(entity));
        entityElement.add(entityFieldsElement);
    }
    return element;

}
项目:bdf2    文件:ModelBuilder.java   
private BaseElement createDataType(Entity entity, RuleSet ruleSet)
        throws Exception {
    String nodeName=EntityDataType.class.getSimpleName();
    XmlNode xmlNode=EntityDataType.class.getAnnotation(XmlNode.class);
    if(xmlNode!=null && StringHelper.isNotEmpty(xmlNode.nodeName())){
        nodeName=xmlNode.nodeName();
    }
    Rule rule=ruleSet.getRule(nodeName);
    BaseElement dataTypeElement=new BaseElement(rule.getNodeName());
    dataTypeElement.addAttribute("name",entity.getName());
    if(entity.getEntityFields()!=null){
        for(EntityField field:entity.getEntityFields()){
            dataTypeElement.add(buildPropertyDefElement(field,ruleSet));
        }
    }
    return dataTypeElement;
}
项目:bdf2    文件:ModelBuilder.java   
private Element buildValidatorElement(Validator validator){
    BaseElement element=new BaseElement("Validator");
    int pos=validator.getName().lastIndexOf("Validator");
    String validatorType=validator.getName().substring(0,pos);
    validatorType=validatorType.substring(0,1).toLowerCase()+validatorType.substring(1,validatorType.length());
    element.addAttribute("type",validatorType);
    if(validator.getProperties()!=null){
        for(ValidatorProperty vp:validator.getProperties()){
            if(StringHelper.isNotEmpty(vp.getName()) && StringHelper.isNotEmpty(vp.getValue())){
                Element propertyElement=createPropertyElement(vp.getName(),vp.getValue());
                element.add(propertyElement);                   
            }
        }
    }
    return element;
}
项目:Jouve-Project    文件:UsersXmlFileUtils.java   
private static Element toXmlElement(ConstellioUser constellioUser){
       BaseElement user = new BaseElement(USER);
       user.addAttribute(FIRST_NAME, constellioUser.getFirstName());
       user.addAttribute(LAST_NAME, constellioUser.getLastName());
       user.addAttribute(LOGIN, constellioUser.getUsername());
       user.addAttribute(PASSWORD_HASH, constellioUser.getPasswordHash());

       if (constellioUser.getLocale() != null){
        user.addAttribute(LOCALE, constellioUser.getLocaleCode());
       }

       Set<String> constellioRoles = constellioUser.getRoles();
       if (! constellioRoles.isEmpty()){
        Element roles = user.addElement(ROLES);
        for(String constellioRole : constellioRoles){
            Element role = roles.addElement(ROLE);
            role.addAttribute(VALUE, constellioRole);
        }
       }

    return user;
}
项目:bdf2    文件:ForkConverter.java   
public JpdlInfo toJpdl(Element element) {
    BaseElement targetElement=new BaseElement("fork");
    String name=this.buildCommonJpdlElement(element, targetElement);
    JpdlInfo info=new JpdlInfo();
    info.setName(name);
    info.setElement(targetElement);
    return info;
}
项目:bdf2    文件:TransitionConverter.java   
public JpdlInfo toJpdl(Element element) {
    BaseElement targetElement=new BaseElement("transition");
    String name=this.buildCommonJpdlElement(element, targetElement);
    String fromShapeLabel=element.attributeValue("fromShapeLabel");
    String toShapeLabel=element.attributeValue("toShapeLabel");
    targetElement.addAttribute("to", toShapeLabel);
    targetElement.addAttribute("fromShapeLabel", fromShapeLabel);
    JpdlInfo info=new JpdlInfo();
    info.setName(name);
    info.setElement(targetElement);
    return info;
}
项目:bdf2    文件:CustomConverter.java   
public JpdlInfo toJpdl(Element element) {
    BaseElement targetElement=new BaseElement("custom");
    String name=this.buildCommonJpdlElement(element, targetElement);
    String customClass=element.attributeValue("customClass");
    targetElement.addAttribute("class", customClass);
    JpdlInfo info=new JpdlInfo();
    info.setName(name);
    info.setElement(targetElement);
    return info;
}
项目:bdf2    文件:ForeachConverter.java   
public JpdlInfo toJpdl(Element element) {
    BaseElement targetElement=new BaseElement("foreach");
    String name=this.buildCommonJpdlElement(element, targetElement);
    String collectionVarName=element.attributeValue("collectionVarName");
    String varElementName=element.attributeValue("varElementName");
    targetElement.addAttribute("in", collectionVarName);
    targetElement.addAttribute("var", varElementName);
    JpdlInfo info=new JpdlInfo();
    info.setName(name);
    info.setElement(targetElement);
    return info;
}
项目:bdf2    文件:StartConverter.java   
public JpdlInfo toJpdl(Element element) {
    BaseElement targetElement=new BaseElement("start");
    String name=this.buildCommonJpdlElement(element, targetElement);
    JpdlInfo info=new JpdlInfo();
    info.setName(name);
    info.setElement(targetElement);
    return info;
}
项目:bdf2    文件:PageOutputer.java   
private String generateView(PageInfo page, String path,String pageName) throws Exception,
        IOException {
    RuleSet ruleSet=ruleSetHelper.getRuleSet();
    Rule viewConfigRule=ruleSet.getRule("ViewConfig");
    BaseElement rootElement=new BaseElement(viewConfigRule.getNodeName());
    for(IBuilder builder:builders){
        rootElement.add(builder.build(page,ruleSet));
    }
    File f=new File(path);
    if(!f.exists()){
        f.mkdirs();
    }
    if(StringUtils.isEmpty(pageName)){
        pageName=page.getName();            
    }
    String targetFilePath=path+"/"+pageName+".view.xml";

    OutputStream out=new FileOutputStream(targetFilePath);
    Document document=DocumentHelper.createDocument(rootElement);
    OutputFormat format=OutputFormat.createPrettyPrint();
    format.setEncoding("UTF-8");
    XMLWriter xmlWriter=new XMLWriter(out, format);
    try{
        xmlWriter.write(document);          
    }finally{
        xmlWriter.close();      
        out.close();
    }
    return pageName;
}