/** * This is a factory method for this belief system configuration. * The factory method is a best practice for the case where the * actual object construction is changed in the future. * * @param beliefSystemType the identifier for the belie system * * @return the actual type safe default clock type configuration. */ public static BeliefSystemTypeOption get( String beliefSystemType ) { return new BeliefSystemTypeOption( beliefSystemType ); }
@Test public void testBeliefSystemType() { config.setOption( BeliefSystemTypeOption.get( BeliefSystemType.JTMS.toString() ) ); assertEquals( BeliefSystemTypeOption.get( BeliefSystemType.JTMS.toString() ), config.getOption( BeliefSystemTypeOption.class ) ); // checking the string based getProperty() method assertEquals( BeliefSystemType.JTMS.getId(), config.getProperty( BeliefSystemTypeOption.PROPERTY_NAME ) ); // setting the options using the string based setProperty() method config.setProperty( BeliefSystemTypeOption.PROPERTY_NAME, BeliefSystemType.DEFEASIBLE.getId() ); // checking the type safe getOption() method assertEquals( BeliefSystemTypeOption.get( BeliefSystemType.DEFEASIBLE.getId() ), config.getOption( BeliefSystemTypeOption.class ) ); // checking the string based getProperty() method assertEquals( BeliefSystemType.DEFEASIBLE.getId(), config.getProperty( BeliefSystemTypeOption.PROPERTY_NAME ) ); }
public static SingleValueKnowledgeSessionOption adaptOption(SingleValueKieSessionOption option) { if (option instanceof BeliefSystemTypeOption) { BeliefSystemTypeOption kieOption = (BeliefSystemTypeOption)option; return org.drools.runtime.conf.BeliefSystemTypeOption.get(kieOption.getBeliefSystemType());
public static KieSessionOption adaptOption(KnowledgeSessionOption option) { if (option instanceof org.drools.runtime.conf.BeliefSystemTypeOption) { org.drools.runtime.conf.BeliefSystemTypeOption legacyOption = (org.drools.runtime.conf.BeliefSystemTypeOption)option; return BeliefSystemTypeOption.get(legacyOption.getBeliefSystemType());
.setType(KieSessionType.STATEFUL) .setClockType(ClockTypeOption.get("realtime")) .setBeliefSystem(BeliefSystemTypeOption.get("jtms")) .setFileLogger("drools.log", 10, true) .addCalendar("monday", "org.domain.Monday") assertEquals(KieSessionType.STATEFUL, kieSessionModelXML.getType()); assertEquals(ClockTypeOption.get("realtime"), kieSessionModelXML.getClockType()); assertEquals(BeliefSystemTypeOption.get("jtms"), kieSessionModelXML.getBeliefSystem()); assertEquals("org.domain.Monday", kieSessionModelXML.getCalendars().get("monday"));
/** * This is a factory method for this belief system configuration. * The factory method is a best practice for the case where the * actual object construction is changed in the future. * * @param beliefSystemType the identifier for the belie system * * @return the actual type safe default clock type configuration. */ public static BeliefSystemTypeOption get( String beliefSystemType ) { return new BeliefSystemTypeOption( beliefSystemType ); }