当前位置: 首页>>代码示例>>Java>>正文


Java EDocLiteDefinition类代码示例

本文整理汇总了Java中org.kuali.rice.edl.impl.bo.EDocLiteDefinition的典型用法代码示例。如果您正苦于以下问题:Java EDocLiteDefinition类的具体用法?Java EDocLiteDefinition怎么用?Java EDocLiteDefinition使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


EDocLiteDefinition类属于org.kuali.rice.edl.impl.bo包,在下文中一共展示了EDocLiteDefinition类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testLoadXML

import org.kuali.rice.edl.impl.bo.EDocLiteDefinition; //导入依赖的package包/类
@Test public void testLoadXML() throws FileNotFoundException {
    loadXmlFile("EDocLiteContent.xml");
    loadXmlFile("edlstyle.xml");

    EDocLiteService edls = EdlServiceLocator.getEDocLiteService();
    StyleService styleService = CoreServiceApiServiceLocator.getStyleService();
    //edls.loadXml(new FileInputStream("conf/examples/xml/EDocLiteContent.xml"));
    assertTrue("Definition not found", edls.getEDocLiteDefinition("profile") != null);
    Style defaultStyle = styleService.getStyle("Default");
    assertNotNull("Style not found", defaultStyle);
    assertEquals(1, edls.getEDocLiteAssociations().size());
    EDocLiteDefinition def = edls.getEDocLiteDefinition("profile");
    assertNotNull("'profile' definition not found", def);
    assertEquals("profile", def.getName());
    assertNotNull(def.getActiveInd());
    assertTrue(def.getActiveInd().booleanValue());
    Style style = styleService.getStyle("Default");
    assertNotNull("'Default' style not found", style);
    assertEquals("Default", style.getName());
    assertTrue(style.isActive());
    assertNotNull(style.getXmlContent());
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:23,代码来源:EDocLiteServiceImplTest.java

示例2: getEDocLiteDefinitions

import org.kuali.rice.edl.impl.bo.EDocLiteDefinition; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
public List<String> getEDocLiteDefinitions() {
    QueryByCriteria.Builder criteria = QueryByCriteria.Builder.create();
    criteria.setPredicates(equal(ACTIVE_IND_CRITERIA, Boolean.TRUE));
    List<EDocLiteDefinition> defs = this.dataObjectService.findMatching(EDocLiteDefinition.class,
            criteria.build()).getResults();
    ArrayList<String> names = new ArrayList<String>(defs.size());
    if (!defs.isEmpty()) {
        for (EDocLiteDefinition def : defs) {
            names.add(def.getName());
        }
    }

    return names;
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:19,代码来源:EDocLiteDAOJpaImpl.java

示例3: exportEdlDefinitions

import org.kuali.rice.edl.impl.bo.EDocLiteDefinition; //导入依赖的package包/类
private void exportEdlDefinitions(Element parentEl, EDocLiteAssociation edl) {

		try {
			EDocLiteService edlService = EdlServiceLocator.getEDocLiteService();
			if (edl.getDefinition() != null) {  //this probably shouldn't be supported on the entry side...
				EDocLiteDefinition def = edlService.getEDocLiteDefinition(edl.getDefinition());
				if (def == null) {
					LOG.error("Attempted to export definition " + edl.getDefinition() + " which was not found");
					return;
				}
				Element defEl = XmlHelper.buildJDocument(new StringReader(def.getXmlContent())).getRootElement();
				setNamespace(defEl, EDL_NAMESPACE);
				parentEl.addContent(defEl.detach());
			}
		} catch (Exception e) {
			throw new RuntimeException(e);
		}
	}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:19,代码来源:EDocLiteXmlExporter.java

示例4: testLoadXML

import org.kuali.rice.edl.impl.bo.EDocLiteDefinition; //导入依赖的package包/类
@Test public void testLoadXML() throws FileNotFoundException {
    loadXmlFile("EDocLiteContent.xml");
    loadXmlFile("edlstyle.xml");

    EDocLiteService edls = EdlServiceLocator.getEDocLiteService();
    StyleService styleService = CoreServiceApiServiceLocator.getStyleService();
    //edls.loadXml(new FileInputStream("conf/examples/xml/EDocLiteContent.xml"));
    assertTrue("Definition not found", edls.getEDocLiteDefinitions().contains("profile"));
    Style defaultStyle = styleService.getStyle("Default");
    assertNotNull("Style not found", defaultStyle);
    assertEquals(1, edls.getEDocLiteAssociations().size());
    EDocLiteDefinition def = edls.getEDocLiteDefinition("profile");
    assertNotNull("'profile' definition not found", def);
    assertEquals("profile", def.getName());
    assertNotNull(def.getActiveInd());
    assertTrue(def.getActiveInd().booleanValue());
    Style style = styleService.getStyle("Default");
    assertNotNull("'Default' style not found", style);
    assertEquals("Default", style.getName());
    assertTrue(style.isActive());
    assertNotNull(style.getXmlContent());
}
 
开发者ID:kuali,项目名称:rice,代码行数:23,代码来源:EDocLiteServiceImplTest.java

示例5: testStoreDefinition

import org.kuali.rice.edl.impl.bo.EDocLiteDefinition; //导入依赖的package包/类
@Test public void testStoreDefinition() {
    EDocLiteService edls = EdlServiceLocator.getEDocLiteService();
    String defXml = "<edl></edl>";
    try {
        edls.saveEDocLiteDefinition(new ByteArrayInputStream(defXml.getBytes()));
        fail("Storing edl with no name succeeded");
    } catch (XmlIngestionException wsee) {
        // expected due to lack of name
    }
    defXml = "<edl name=\"test\"></edl>";
    edls.saveEDocLiteDefinition(new ByteArrayInputStream(defXml.getBytes()));
    EDocLiteDefinition def = edls.getEDocLiteDefinition("test");
    assertNotNull(def);
    assertEquals("test", def.getName());
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:16,代码来源:EDocLiteServiceImplTest.java

示例6: getEDocLiteDefinition

import org.kuali.rice.edl.impl.bo.EDocLiteDefinition; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
public EDocLiteDefinition getEDocLiteDefinition(final String defName) {
    QueryByCriteria.Builder criteria = QueryByCriteria.Builder.create();
    criteria.setPredicates(equal(NAME_CRITERIA, defName), equal(ACTIVE_IND_CRITERIA, Boolean.TRUE));
    List<EDocLiteDefinition> edls = this.dataObjectService.findMatching(EDocLiteDefinition.class,
            criteria.build()).getResults();
    if (null != edls && !edls.isEmpty()) {
        return edls.get(0);
    } else {
        return null;
    }
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:16,代码来源:EDocLiteDAOJpaImpl.java

示例7: saveEDocLiteDefinition

import org.kuali.rice.edl.impl.bo.EDocLiteDefinition; //导入依赖的package包/类
public void saveEDocLiteDefinition(EDocLiteDefinition data) {
    EDocLiteDefinition existingData = getEDocLiteDefinition(data.getName());
    if (existingData != null) {
        existingData.setActiveInd(Boolean.FALSE);
        dao.saveEDocLiteDefinition(existingData);
    }
    // if not specified (from xml), mark it as active
    if (data.getActiveInd() == null) {
        data.setActiveInd(Boolean.TRUE);
    }
    dao.saveEDocLiteDefinition(data);
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:13,代码来源:EDocLiteServiceImpl.java

示例8: getEDocLiteDefinitions

import org.kuali.rice.edl.impl.bo.EDocLiteDefinition; //导入依赖的package包/类
public List getEDocLiteDefinitions() {
    Criteria criteria = new Criteria();
    criteria.addEqualTo("activeInd", Boolean.TRUE);
    Iterator it = this.getPersistenceBrokerTemplate().getIteratorByQuery(new QueryByCriteria(EDocLiteDefinition.class, criteria));
    List defs = new ArrayList();
    while (it.hasNext()) {
        defs.add(((EDocLiteDefinition) it.next()).getName());
    }
    return defs;
}
 
开发者ID:aapotts,项目名称:kuali_rice,代码行数:11,代码来源:EDocLiteDAOOjbImpl.java

示例9: saveEDocLiteDefinition

import org.kuali.rice.edl.impl.bo.EDocLiteDefinition; //导入依赖的package包/类
/**
 * Save a EDocLiteDefinition
 *
 * @see org.kuali.rice.edl.impl.dao.EDocLiteDAO#saveEDocLiteDefinition(org.kuali.rice.edl.impl.bo.EDocLiteDefinition)
 */
public void saveEDocLiteDefinition(final EDocLiteDefinition edocLiteData) {
    if (edocLiteData.getEDocLiteDefId() == null) {
        entityManager.persist(edocLiteData);
    } else {
        OrmUtils.merge(entityManager, edocLiteData);
    }
}
 
开发者ID:aapotts,项目名称:kuali_rice,代码行数:13,代码来源:EDocLiteDAOJpaImpl.java

示例10: getEDocLiteDefinition

import org.kuali.rice.edl.impl.bo.EDocLiteDefinition; //导入依赖的package包/类
/**
 * Get a EDocLiteDefinition
 *
 * @see org.kuali.rice.edl.impl.dao.EDocLiteDAO#getEDocLiteDefinition(java.lang.String)
 */
public EDocLiteDefinition getEDocLiteDefinition(final String defName) {
    final Criteria crit = new Criteria(EDocLiteDefinition.class.getName());
    crit.eq(NAME_CRITERIA, defName);
    crit.eq(ACTIVE_IND_CRITERIA, Boolean.TRUE);
    return (EDocLiteDefinition) new QueryByCriteria(entityManager, crit).toQuery().getSingleResult();
}
 
开发者ID:aapotts,项目名称:kuali_rice,代码行数:12,代码来源:EDocLiteDAOJpaImpl.java

示例11: getEDocLiteDefinitions

import org.kuali.rice.edl.impl.bo.EDocLiteDefinition; //导入依赖的package包/类
/**
 * Returns the names of all active Definitions
 *
 * @see org.kuali.rice.edl.impl.dao.EDocLiteDAO#getEDocLiteDefinitions()
 */
@SuppressWarnings("unchecked")
public List<String> getEDocLiteDefinitions() {
    final Criteria crit = new Criteria(EDocLiteDefinition.class.getName());
    crit.eq(ACTIVE_IND_CRITERIA, Boolean.TRUE);

    final List<EDocLiteDefinition> defs = (List<EDocLiteDefinition>) new QueryByCriteria(entityManager, crit).toQuery().getResultList();
    final ArrayList<String> names = new ArrayList<String>(defs.size());
    for (EDocLiteDefinition def : defs) {
        names.add(def.getName());
    }
    return names;
}
 
开发者ID:aapotts,项目名称:kuali_rice,代码行数:18,代码来源:EDocLiteDAOJpaImpl.java

示例12: saveEDocLiteDefinition

import org.kuali.rice.edl.impl.bo.EDocLiteDefinition; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
public EDocLiteDefinition saveEDocLiteDefinition(final EDocLiteDefinition edocLiteData) {
    return this.dataObjectService.save(edocLiteData, PersistenceOption.FLUSH);
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:8,代码来源:EDocLiteDAOJpaImpl.java

示例13: parseEDocLiteDefinition

import org.kuali.rice.edl.impl.bo.EDocLiteDefinition; //导入依赖的package包/类
/**
 * Parses an EDocLiteDefinition
 *
 * @param e
 *            element to parse
 * @return an EDocLiteDefinition
 */
private static EDocLiteDefinition parseEDocLiteDefinition(Element e) {
    EDocLiteDefinition def = new EDocLiteDefinition();
    String name = e.getAttribute("name");
    if (name == null || name.length() == 0) {
        throw generateMissingAttribException(EDLXmlUtils.EDL_E, "name");
    }
    def.setName(name);

    // do some validation to ensure that any attributes referenced actually exist
    // blow up if there is a problem

    XPath xpath = XPathFactory.newInstance().newXPath();
    NodeList fields;
    try {
        fields = (NodeList) xpath.evaluate("fieldDef", e, XPathConstants.NODESET);
    } catch (XPathExpressionException xpee) {
        throw new RuntimeException("Invalid EDocLiteDefinition", xpee);
    }

    if (fields != null) {
        Collection invalidAttributes = new ArrayList(5);
        for (int i = 0; i < fields.getLength(); i++) {
            Node node = (Node) fields.item(i);
            // they should all be Element...
            if (node instanceof Element) {
                Element field = (Element) node;
                // rely on XML validation to ensure this is present
                String fieldName = field.getAttribute("name");
                String attribute = field.getAttribute("attributeName");
                if (attribute != null && attribute.length() > 0) {
                    RuleAttribute ruleAttrib = KEWServiceLocator.getRuleAttributeService().findByName(attribute);
                    if (ruleAttrib == null) {
                        LOG.error("Invalid attribute referenced in EDocLite definition: " + attribute);
                        invalidAttributes.add("Attribute '" + attribute + "' referenced in field '" + fieldName + "' not found");
                    }
                }
            }
        }
        if (invalidAttributes.size() > 0) {
            LOG.error("Invalid attributes referenced in EDocLite definition");
            StringBuffer message = new StringBuffer("EDocLite definition contains references to non-existent attributes;\n");
            Iterator it = invalidAttributes.iterator();
            while (it.hasNext()) {
                message.append(it.next());
                message.append("\n");
            }
            throw new RuntimeException(message.toString());
        }
    }

    try {
        def.setXmlContent(XmlJotter.jotNode(e, true));
    } catch (XmlException te) {
        throw generateSerializationException(EDLXmlUtils.EDL_E, te);
    }
    return def;
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:65,代码来源:EDocLiteServiceImpl.java

示例14: getEDocLiteDefinition

import org.kuali.rice.edl.impl.bo.EDocLiteDefinition; //导入依赖的package包/类
public EDocLiteDefinition getEDocLiteDefinition(String definitionName) {
    return dao.getEDocLiteDefinition(definitionName);
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:4,代码来源:EDocLiteServiceImpl.java

示例15: parseEDocLiteDefinition

import org.kuali.rice.edl.impl.bo.EDocLiteDefinition; //导入依赖的package包/类
/**
 * Parses an EDocLiteDefinition
 *
 * @param e
 *            element to parse
 * @return an EDocLiteDefinition
 */
private static EDocLiteDefinition parseEDocLiteDefinition(Element e) {
    EDocLiteDefinition def = new EDocLiteDefinition();
    String name = e.getAttribute("name");
    if (name == null || name.length() == 0) {
        throw generateMissingAttribException(EDLXmlUtils.EDL_E, "name");
    }
    def.setName(name);

    // do some validation to ensure that any attributes referenced actually exist
    // blow up if there is a problem

    XPath xpath = XPathFactory.newInstance().newXPath();
    NodeList fields;
    try {
        fields = (NodeList) xpath.evaluate("fieldDef", e, XPathConstants.NODESET);
    } catch (XPathExpressionException xpee) {
        throw new XmlIngestionException("Invalid EDocLiteDefinition", xpee);
    }

    if (fields != null) {
        Collection invalidAttributes = new ArrayList(5);
        for (int i = 0; i < fields.getLength(); i++) {
            Node node = (Node) fields.item(i);
            // they should all be Element...
            if (node instanceof Element) {
                Element field = (Element) node;
                // rely on XML validation to ensure this is present
                String fieldName = field.getAttribute("name");
                String attribute = field.getAttribute("attributeName");
                if (attribute != null && attribute.length() > 0) {
                    RuleAttribute ruleAttrib = KEWServiceLocator.getRuleAttributeService().findByName(attribute);
                    if (ruleAttrib == null) {
                        LOG.error("Invalid attribute referenced in EDocLite definition: " + attribute);
                        invalidAttributes.add("Attribute '" + attribute + "' referenced in field '" + fieldName + "' not found");
                    }
                }
            }
        }
        if (invalidAttributes.size() > 0) {
            LOG.error("Invalid attributes referenced in EDocLite definition");
            StringBuffer message = new StringBuffer("EDocLite definition contains references to non-existent attributes;\n");
            Iterator it = invalidAttributes.iterator();
            while (it.hasNext()) {
                message.append(it.next());
                message.append("\n");
            }
            throw new XmlIngestionException(message.toString());
        }
    }

    try {
        def.setXmlContent(XmlJotter.jotNode(e, true));
    } catch (XmlException te) {
        throw generateSerializationException(EDLXmlUtils.EDL_E, te);
    }
    return def;
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:65,代码来源:EDocLiteXmlParser.java


注:本文中的org.kuali.rice.edl.impl.bo.EDocLiteDefinition类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。