doctor
可以属于subjectCat
(尝试获取访问权限的用户)或resourceCat
(主题正在尝试访问的体检的推荐医生)。
在我看来,要支持这两种情况,我需要为每个类别单独定义doctor
:
namespace subject {
namespace doctor {
attribute id {
category = subjectCat
id = "id"
type = string
}
attribute lastname {
category = subjectCat
id = "lastname"
type = string
}
//and 20 more attributes...
}
}
namespace resource {
namespace doctor {
attribute id {
category = resourceCat //this line is the only difference
id = "id"
type = string
}
attribute lastname {
category = resourceCat //this line is the only difference
id = "lastname"
type = string
}
//and 20 more attributes...
}
}
这非常麻烦,并且有很多冗余。我能做些什么来避免这种情况吗?