How can I get RuleContex in drools? - drools

I get KieSession, and I want to use property cancelMatch definition by interface RuleContext.
How can I get ruleContext instance with kieSession?
Thanks for help!

Related

1:n Derived Settable Association

There is an example of n:1 derived settable association in MDriven Wiki: https://wiki.mdriven.net/index.php/Derived_settable_associations
I'm trying to implement for a multi link Collection(Person) - Person is the target class name. The context in DerivationOCLSet is Person. As far as I understand I access the other end instance over vInputParameter. So, I define it as so (simplifyed):
self.Mother := vInputParameter.Mother (Mother ist an 0..1-association end of Person, also Person).
The model Validation gives me error: "Association End DeriveSet: Person.Sisters: You can never use := to assign a collection - consider using ->first or ->last to get single value"
Another issue I have: If I let DerivationOCLSet empty and let C# generation no method is generated. It it as designed? What Name/Signature is expected then?
/Efim
As the message says you cannot assign collections - but you can add - so go like vinputparam->foreach(x| self.sisters.add(x))
Efim, can you provide more information? I don't fully understand what you are trying to do.
Removing is done with... no, I don't know how to answer without model section and metod signature

How to add fe_group in Controller

I want to set the "standard" TYPO3 field "fe_group" in the extbase controller. As far I see there no "standard" getters and setters? https://typo3.org/api/typo3cms/class_t_y_p_o3_1_1_c_m_s_1_1_extbase_1_1_domain_object_1_1_abstract_entity.html
I tried to implement them in the model, but it does not work - I do not get any error but it is never set.
What exactly I want to do:
I have an object of type \TYPO3\CMS\Extbase\Domain\Model\FrontendUserGroup and I have an object of my record type (I can set other fields without any problems).
Now I want to do something like:
$myobject->addFe_group($feusergroup);
Do I have to implement this by my own to my model? I tried to implement fe_group as ObjectStorage and also as string - does not work? :-(
Does anyone have a solution for this?
Thank you
Christian
First of all: In models please name functions and properties lowerCamelCase. So a field "fe_group" in TCA would become "feGroup" in the model and the function would be "addFeGroup".
FrontendUserGroup model has a function addSubgroup to add other groups as subobjects. Is this the right thing for your purpose or what you need those relation to another group for?
https://typo3.org/api/typo3cms/class_t_y_p_o3_1_1_c_m_s_1_1_extbase_1_1_domain_1_1_model_1_1_frontend_user_group.html

Add entity to the context without knowing the type

Is it possible to add a POCO entity to the object context without knowing the type?
For example, here I'm adding an employee...
context.Employ.Attach(employer);
Is it possible to do something like this...
context.Attach(employer);
This works...
context.Set(entity.GetType()).Attach(entity);
You may be able to use the Set property of your context. For example:
var entityType = employer.GetType();
context.Set(entityType).Attach(employer);

How to use dbName and collection prefix using quartz properties by implementing jobstore

Quick Question,
I know we can configure dbName and collection prefix in Quartz property file (like following), But How to access those properties by implementing JobStore (where I use mongo) interface in any class.
Mongo database name
org.quartz.jobStore.dataSource=quartzdatabase
collection prefix
org.quartz.jobStore.collectionPrefix=prefix_
How to use these property in java by implementing jobstore (where I use mongo) and overriding the methods in it, I know there is a method called initialise() in jobstore, Is it possible to get those properties in it.
Guys, Waiting for ur reply.
Thanks and Regards,
Harry
I found the answer by myself, We need to use the setter and getter for the corresponding field (i.e) dataSource and Collectionprefix in the class where you have implemented JobStore.
Thanks and Regards,
Harry

How to load data into Ext.tree.TreePanel (not through ajax)

in example here
http://docs.sencha.com/ext-js/3-4/#!/api/Ext.tree.TreePanel
i can see property dataUrl: 'get-nodes.php',
but how i can change data from inside my code? there is no store property or setSource method
EDIT:
as i found, one of the possibilities is to create my own Ext.tree.TreeLoader that would have setSource method and use it instead of default
maybe there is more variants?
EDIT:
seems there is already a solution for this
http://www.sencha.com/forum/showthread.php?4595-Creating-Ext.tree.TreePanel-from-static-JSON-data-in-one-shot
seems there is already a solution for this
http://www.sencha.com/forum/showthread.php?4595-Creating-Ext.tree.TreePanel-from-static-JSON-data-in-one-shot