Error when trying to update Enterprise Architect StateMachine Connector in Jscript - enterprise-architect

When Updating a Enterprise Architect connector i get the following Error Message:
StateFlow is not legal for State --> State, Line:47
The reason I want to update is that I want to add a Stereotype to one of my connectors.
I have sorted out a Specific EA.Element via SQL Quierie searching for 1 GUID.
"SELECT * FROM t_object WHERE ea_guid='<Some specific GUID>'"
From this Element I have selected the only connector that is a selftransition.
If i understand correctly i have to set the selftransition tag, and then update the connector. But when i update, the Error message above is shown.
My code:
if(element.Elements.Count!=0)//element is Propably a comp state or Statemachine
{
connectors = element.Connectors;
for(var j = 0; j<connectors.Count; j++)
{
connector = connectors.GetAt(j);
if(connector.ClientID == connector.SupplierID)
{
tempElement = element;
connector.Stereotype="New Stereotype";
connector.Update();
}
}
}
The Red Transition in the picture is the Transition that throws the error.
What does the Error mean and why cant i update the connector?
If you have other suggestions how to add a stereotype to a connector i would gladly apreciate them.

That seems to be a bug, since StateFlow seems like a legitimate connector type between two States.
You can try unchecking the strict connector syntax setting in the options
If you still have this issue in the latest version then you can report it as a bug
If nothing helps you can always try to go around the API and to the database directly.
Try something like
Repository.Execute("update t_connector set stereotype = 'MyStereo' where connector_ID = 1234");
Replacing 1234 by the actual connector_ID of course.

Related

Moodle - update_moduleinfo - invalid course module id

I'm currently building a new moodle plugin. I'm using add_moduleinfo and update_moduleinfo. To add a new attandance atictivity in a course and update it later on.
Sadly I'm facing the issue that update_moduleinfo always throws an "invalid course module id" error. I already checked the cm entry in my database to ensure im using the right module instance.
I dont really know what to do.
$cm = get_coursemodule_from_instance($moduleName, $activityID, $course->id);
$moduleinfo = update_moduleinfo($cm, $moduleinfo, $course); <-- Error
Thats how I try to update the entry.
I also found that post. Didn't help anything.
Moodle - Invalid course module ID
I found the issue myself:
$moduleinfo->introeditor['format'] = FORMAT_HTML;
$moduleinfo->introeditor['text'] = "INTRO TEXT";
$moduleinfo->coursemodule = $cm->id;
list($cm, $moduleinfo) = update_moduleinfo($cm, $moduleinfo, $course, null);
In order to use this function the above mentioned properties need to exist in order to perform a update.

CRM D365 update polymorphic/multitable lookup via Plugin

I'm trying to update a polymorphic lookup column on a table via plugin code and it doesn't seem happening. Wondering what additional I’m missing.
var entity1Id = "af435c64-a264-4f2a-9cee-22069ce36b3c";
var destinationEntity = new Entity("bookableresourcebooking", new Guid(myBookingGuid));
destinationEntity["my_ploymorphiclookupid"] = new EntityReference("my_entity1", new Guid(entity1Id));
organizationService.Update(destinationEntity);
my_ploymorphiclookupid is a polymorphic lookup (N:1) to my_entity1
Code looks fine. If you didn’t see any runtime errors in plug-in trace log, then few diagnosis steps needed.
Check audit history of that record
Chances of any other plugin steps replacing the value back or rolling back
Try to profile/debug the plugin for clues

breezejs navigation property with include not working

I have server side code written which is including navigational property for many to many relation ship as shown below.
var result = _contextProvider.Context.ResourceProperty.Include("AssociatedStandardResourceProperty.AssociatedLists").Where(t => t.ResourceId == resId);
//Return matching resource properties
return result;
However, when i am trying to retrieve data from breeze datacontext i am getting query execution error as shown below.
var getResourceProperties = function (resourceId, resourcePropertyObservable) {
var query = EntityQuery.from('GetResourceProperties')
.withParameters({ resourceId: resourceId })
.expand("AssociatedStandardResourceProperty.AssociatedLists");
return manager.executeQuery(query)
.then(querySucceeded)
.fail(queryFailed);
function querySucceeded(data) {
if (resourcePropertyObservable) {
resourcePropertyObservable(data.results);
}
log('Retrieved listObservable from remote data source',
data, true);
}
};
Query is failing and all data is retreived in log message i have written in queryFailed function.
I have also checked by removing expand at client side and also removing include at server side and then including expand at client side.
Please let me know how i can make it work.
Thanks
I have observed that problem was due to many to many mapping between two entities . After removing the relationship we are able to retrieve associatedEntities data
Just a guess here, but if you are performing the include on the server, then you don't need the expand on the client and vice versa. Your example seems to be doing both. What is the error message that you are getting?

db4o creating event not fire on db4o 8

i am using db4o 8 with c# 3.5, The TA and TP is enabled on all of my domain model classes.
the problem is i have my own ID Generator attached to creating event with following code:
IEventRegistry eventRegistry = EventRegistryFactory.ForObjectContainer(Container);
eventRegistry.Creating += new EventHandler(eventRegistry_Creating);
i have a USER class containing a list of ORDER.
problem is if i update the USER class, creating event does not fire for new added ORDER objects in USER.ORDERS.
before version 8 i used v7.4 and it worked fine, but today i upgraded it to v8 to gain some performance benefits but this problem occurred.
would you please help me to fix this problem ?
I tried to reproduce the issue and it worked for me fine. Are you sure that the added order is actually stored? What kind of collection are you using? The db4o activatable collections or the regular CLR collections? And which version did you use?
Here my little test-case which worked:
var eventRegistry = EventRegistryFactory.ForObjectContainer(container);
var expectFireCreated = false;
eventRegistry.Created += (sender, args) =>
{
expectFireCreated = true;
};
var costumer = (from Constumer c in container
select c).First();
costumer.Orders.Add(new Order("55"));
container.Commit();
Assert.IsTrue(expectFireCreated);

EF 4 Self Tracking Entities does not work as expected

I am using EF4 Self Tracking Entities (VS2010 Beta 2 CTP 2 plus new T4 generator). But when I try to update entity information it does not update to database as expected.
I setup 2 service calls. one for GetResource(int id) which return a resource object. the second call is SaveResource(Resource res); here is the code.
public Resource GetResource(int id)
{
using (var dc = new MyEntities())
{
return dc.Resources.Where(d => d.ResourceId == id).SingleOrDefault();
}
}
public void SaveResource(Resource res)
{
using (var dc = new MyEntities())
{
dc.Resources.ApplyChanges(res);
dc.SaveChanges();
// Nothing save to database.
}
}
//Windows Console Client Calls
var res = service.GetResource(1);
res.Description = "New Change"; // Not updating...
service.SaveResource(res);
// does not change anything.
It seems to me that ChangeTracker.State is always show as "Unchanged".
anything wrong in this code?
This is probably a long shot... but:
I assume your Service is actually in another Tier? If you are testing in the same tier you will have problems.
Self Tracking Entities (STEs) don't record changes until when they are connected to an ObjectContext, the idea is that if they are connected to a ObjectContext it can record changes for them and there is no point doing the same work twice.
STEs start tracking once they are deserialized on the client using WCF, i.e. once they are materialized to a tier without an ObjectContext.
If you look through the generated code you should be able to see how to turn tracking on manually too.
Hope this helps
Alex
You have to share assembly with STEs between client and service - that is the main point. Then when adding service reference make sure that "Reuse types in referenced assemblies" is checked.
The reason for this is that STEs contain logic which cannot be transfered by "Add service reference", so you have to share these types to have tracing logic on client as well.
After reading the following tip from Daniel Simmons, the STE starts tracking. Here is the link for the full article. http://msdn.microsoft.com/en-us/magazine/ee335715.aspx
Make certain to reuse the Self-Tracking Entity template’s generated entity code on your client. If you use proxy code generated by Add Service Reference in Visual Studio or some other tool, things look right for the most part, but you will discover that the entities don’t actually keep track of their changes on the client.
so in the client make sure you don't use add service reference to get the proxy instead access service through following code.
var svc = new ChannelFactory<IMyService>("BasicHttpBinding_IMyService").CreateChannel();
var res = svc.GetResource(1);
If you are using STEs without WCF you may have to call StartTracking() manually.
I had the same exact problem and found the solution.
It appears that for the self-tracking entities to automatically start tracking, you need to reference your STE project before adding the service reference.
This way Visual Studio generates some .datasource files which does the final trick.
I found the solution here:
http://blogs.u2u.be/diederik/post/2010/05/18/Self-Tracking-Entities-with-Validation-and-Tracking-State-Change-Notification.aspx
As for starting the tracking manually, it seems that you do not have these methods on the client-side.
Hope it helps...