cancel
Showing results for 
Search instead for 
Did you mean: 

IWDProgmodelRepository error???

Former Member
0 Kudos

Hi all,

I encountered strange behavior when trying to list classes belonging to IWDProgmodelRepository model instance from WD repository. It seems that I'm unnable to distinguish between 2 components having the same name, but declared in different DCs

Namely, I do the following:

1. I have created 2 DC, says A and B both containing component with EXACTLY THE SAME full qualified name.

2. I get IWDRepository for DC B.

3. I get instance of IWDRepositoryModel from repository:


  model = (IWDRepositoryModel)repository.getRepositoryModel
  (
    IWDProgmodelRepository.class
  );

4. I try to iterated over IWDComponentInfo from this model, smth. like that:


  IWDRepositoryModelClassInfo modelObjectClassInfo 
    = (IWDRepositoryModelClassInfo)model
        .associatedModelInfo()
          .getModelClassInfo
          (
            IWDComponentInfo.class
          );
  Iterator i = model.iterateVersionableModelObjects
  (
    modelObjectClassInfo
  );
  while (i.hasNext())
  {
    String name = (String)i.next();
    result.add
    (
      model.getModelObject
     (
       name, 
       modelObjectClassInfo
     )
    );

  }

5. Result contains component from DC A!!! (I can check this while components has different structure: windows, interface, etc.)

When I delete / rename component in DC A, then I get component info from DC B, as expected. So, it seems that iteration above returns FIRST COMPONENT WITH GIVEN NAME REGARDLESS DC.

Is that behavior by design? Or this is an error?

Please, anyone from WD team, provide your comments.

Thanks in advance,

Valery

Accepted Solutions (1)

Accepted Solutions (1)

BeGanz
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hallo Valery,

this behavior is insofar correct as it is not allowed to put two identical components (same full qualified names) into different DCs. This is the same behavior like in Java, where different JAR-Files should not contain classes with the same full qualified names.

Greetings, Bertram

Former Member
0 Kudos

Thanks for your answer.

Now let me provide more details what I'm trying to do and please reply with your comments, whether or not it is a valid solution or hack that exploits some undocumented behavior

What I'm currently trying to implement is some kind of navigation framework (full disclosure: it is ongoing CAF UI pattern), where container component embeds arbitrary “item” components (well, frankly, arbitrary implementations of known ComponentInterface).

I know (and it is currently implemented) how to embed InterfaceView of known ComponentInterface. However, what I'd like to achieve is ability to embed ANY InterfaceView of user-selected component.

However, I faced the following challenge -- it is impossible to create / set related model class if target and source of relation belongs to progmodels created over DIFFERENT repositories (this check was added in SP4 or SP5, AFAIK).

So, armed with your previous answer, I made the following:

1. I get (transient) repository of embedder (container) component:

wdComponentAPI.getComponentInfo().getRepositoryModel()

2. I get ProgModel instance over this repository

3. I call getModelObject on this ProgModel supplying fully qualified name of embedding component and get IWDComponentInfo.

4. Now I can get all other parts via relations and everything works fine (for example, I can assign IWDInterfaceViewInfo of embedding component getting his way to IWDViewUsageInfo of embedder).

The only thing I'm wondering of is that I NEVER PROVIDE A DC NAME OF EMBEDDING COMPONENT!!!

Could you confirm that everything is ok with such solution?

VS

Answers (0)