[Uml-devel] branches/KDE/3.5/kdesdk/umbrello/umbrello
Oliver Kellogg
okellogg at users.sourceforge.net
Thu Sep 1 21:36:04 UTC 2005
SVN commit 456068 by okellogg:
findCodeClassFieldFromParentID(): Fix regression introduced by commit 344219.
More stuff needs fixing; now we get this:
ERROR: FindMethodByType() cant create role for method type:0
ERROR: FindMethodByType() cant create role for method type:1
ERROR: Cant load code accessor method for type:0 which doesnt exist in
this codeclassfield. Is XMI out-dated or corrupt?
M +5 -5 classifiercodedocument.cpp
M +5 -1 classifiercodedocument.h
--- branches/KDE/3.5/kdesdk/umbrello/umbrello/classifiercodedocument.cpp #456067:456068
@@ -576,17 +576,18 @@
// by parent object ID and Role ID (needed for self-association CF's)
CodeClassField *
ClassifierCodeDocument::findCodeClassFieldFromParentID (Uml::IDType id,
- Uml::Role_Type role_id)
+ int role_id)
{
for (CodeClassFieldListIt ccflit(m_classfieldVector); ccflit.current(); ++ccflit)
{
CodeClassField * cf = ccflit.current();
- if((int)role_id == -1) { // attribute-based
+ if(role_id == -1) { // attribute-based
if (STR2ID(cf->getID()) == id)
return cf;
} else { // association(role)-based
+ const Uml::Role_Type r = (Uml::Role_Type)role_id;
UMLRole * role = dynamic_cast<UMLRole *>(cf->getParentObject());
- if(role && STR2ID(cf->getID()) == id && role->getRole() == role_id)
+ if(role && STR2ID(cf->getID()) == id && role->getRole() == r)
return cf;
}
}
@@ -610,8 +611,7 @@
{
QString id = childElem.attribute("parent_id","-1");
int role_id = childElem.attribute("role_id","-1").toInt();
- Uml::Role_Type r = (role_id == 1 ? Uml::A : Uml::B);
- CodeClassField * cf = findCodeClassFieldFromParentID(STR2ID(id), r);
+ CodeClassField * cf = findCodeClassFieldFromParentID(STR2ID(id), role_id);
if(cf)
{
// Because we just may change the parent object here,
--- branches/KDE/3.5/kdesdk/umbrello/umbrello/classifiercodedocument.h #456067:456068
@@ -133,8 +133,12 @@
/** Using the parent object's UML ID, find the corresponding
* codeclassfield object in this classifiercodedocument. Returns
* NULL if no such codeclassfield object exists in this document.
+ *
+ * @param role_id 0 for role A of the asssociation
+ * 1 for role B of the asssociation
+ * -1 if this is an attribute.
*/
- CodeClassField * findCodeClassFieldFromParentID (Uml::IDType id, Uml::Role_Type role_id);
+ CodeClassField * findCodeClassFieldFromParentID (Uml::IDType id, int role_id = -1);
/**
* Get the value of m_parentclassifier
More information about the umbrello-devel
mailing list