Map<DomainObject, Boolean> m = new HashMap<DomainObject, Boolean>(); DomainObject do = new DomainObject(); do.name = "ABC"; m.put(do, true); // do goes in the map with hashCode of ABC do.name = "DEF"; m.get(do);
@Test public void testQueryWithEval() throws IOException, ClassNotFoundException { // [Regression in 5.2.0.M2]: NPE during rule evaluation on MVELPredicateExpression.evaluate(MVELPredicateExpression.java:82) String str = "package org.drools.compiler.integrationtests\n" + "import " + DomainObject.class.getCanonicalName() + " \n" + "query queryWithEval \n" + " $do: DomainObject()\n" + " not DomainObject( id == $do.id, eval(interval.isAfter($do.getInterval())))\n" + "end"; KieBase kbase = SerializationHelper.serializeObject(loadKnowledgeBaseFromString(str)); KieSession ksession = createKieSession( kbase ); DomainObject do1 = new DomainObject(); do1.setId( 1 ); do1.setInterval( new Interval( 10, 5 ) ); DomainObject do2 = new DomainObject(); do2.setId( 1 ); do2.setInterval( new Interval( 20, 5 ) ); ksession.insert( do1 ); ksession.insert( do2 ); org.kie.api.runtime.rule.QueryResults results = ksession.getQueryResults( "queryWithEval" ); assertEquals( 1, results.size() ); assertEquals( do2, results.iterator().next().get( "$do" ) ); ksession.dispose(); }
DynamoDBQueryExpression<DomainObject> query = new DynamoDBQueryExpression<DomainObject>(); DomainObject hashKeyValues = new DomainObject(); hashKeyValues.setHashKey(hashKeyValue); query.setHashKeyValues(hashKeyValues); // getMapper() returns a DynamoDBMapper object with the appropriate // AmazonDynamoDBClient object. List<DomainObject> results = getMapper().query(query);
data[0] = new DomainObject(); data[0].name = "Hans"; data[1] = new DomainObject(); data[1].name = "Franz"; showEditor(new DomainObject(), true);
StatefulKnowledgeSession ksession = createKnowledgeSession( kbase ); DomainObject do1 = new DomainObject(); do1.setId( 1 ); do1.setInterval( new Interval( 10, 5 ) ); DomainObject do2 = new DomainObject(); do2.setId( 1 ); do2.setInterval( new Interval( 20,