The Clone item view enables users to clone a structure as a way of creating a new one, and can be configured to support more than one use case if needed. One example is Configuring a Menu Option for Document Cloning. Having a proper configuration in place can prevent mistakes by users performing the clone operation. 


Note: This view requires configuration. It will not be available to users without it.


Prerequisites

  • Familiarity with SystemWeaver concepts such as Items, Parts and Attributes
  • Knowledge of XML
  • An installation of the SystemWeaver swExplorer client (swExplorer)
  • Assignment of the SW Architect role in the server

Configuring the View

  1. Go to File > Configure the explorer
  2. On the Item views tab, select Clone item.
  3. Click View example XML and copy the script (also shown below) as a starting point for your configuration. 
  4. Click Edit configuration and paste the script in the Edit XML window. (If there are existing <Config> sections there, just add this new config below them within the <Configs> tag.) 
  5. Modify the script to meet the needs of the use case. (See the explanation of available elements below.)
  6. When you are ready to test and make it available to users, checkmark the Active box. Users must log out and back in to see the new option.


Example Configuration

<Configs>
  <Config id="Id1">
    <ViewSettings>
       <Caption>Letter</Caption>
       <RibbonGroup>Templates</RibbonGroup>
       <Description>Hint shown in the ribbon</Description>
    </ViewSettings>
    <TopItemType>7PRA</TopItemType>
    <IsEditable>False</IsEditable>
    <TraceTopPartType>PPP</TraceTopPartType>
    <CloneParts>
        <Part sid="6PRR" action="clone" actionRefObj="clone" traceparttype="QQQ">
            <Include>@ABAN="include"</Include>
        </Part>  
        <Part sid="6REQA" action="include">
            <Ignore>1=1</Ignore>
        </Part>  
        <Part sid="ITLD" action="include"/>
        <Part sid="ADES" action="clone"/> 
        <Part sid="7ICU" action="clone"/>
    </CloneParts>
    <Transformations>
      <Part old="ADCF">DFRE</Part>
      <Part old="UGFS">SSRE</Part>
      <Item old="ADC">DFRE</Item>
      <NamePattern old="Template_%">Copy_%</NamePattern>
      <IgnoreAttribute>GDS</IgnoreAttribute>
      <IgnoreDescription>GDSS</IgnoreDescription>
      <IgnoreNonDefaultAttributes/>
    </Transformations>
  </Config>
</Configs>


Explanation of the Configuration Elements

<Configs> is required, and is the top tag which can include one or more <Config>.


<Config> is required, and is the top tag of each configuration and must have an id attribute. The id attribute identifies the specific configuration, and should be a unique string value when multiple configurations exist. 


<ViewSettings> enables you to set a custom view label, hover tip, image icon, etc. See How to Configure Item View Menu Label Settings. 


<TopItemType> is required, and defines the SID for the item type for which the view will apply, i.e., be available. 


<IsEditable> is optional, and defines if the configured settings can be edited or not. Applies to the Part selections.


<TraceTopPartType> is optional, and indicates the SID of the part type to be used to link the new item (clone) to the original item. This part will be created when the new item is created. As always, this is limited by the meta model. This can be seen as a "copy of" functionality where it is possible to keep the original as a reference to the copy.


<CloneParts> is required, and specifies how parts in the part structure should be treated:


Each <Part> element specifies how part types of the parts should be treated, with optional conditions.

  • The sid attribute is required, and specifies the part type of the part to be treated.
  • The action attribute is required, and specifies the default action according to the part type.
    • 'include' means that the original item included as parts of the specified type will be included (as-is) in the cloned structure without being cloned. Note that naturally no part of an included item can be cloned since the entire part structure of the included item will be retained.
    • 'clone' means that the original item will in fact be cloned.
  • The traceparttype attribute is optional, and is similar to <TraceTopPartType> but is for parts in the clone structure. It results in the original being added to the clone with the part type specified in traceparttype=“COPYOF”. In other words, it references the item which has been cloned. As always, this is limited by the meta model. This can be seen as a "copy of" functionality where it is possible to keep the original as a reference to the copy. Example: 

<Config id="Id1">
    <ViewSettings>
      <Caption>Letter</Caption>
      <RibbonGroup/>
      <Description/>
    </ViewSettings> 
    <TopItemType>spr</TopItemType>
    <TraceTopPartType>IDI</TraceTopPartType>
    <CloneParts>
      <Part sid="IDI" action="clone" traceparttype="COPYOF"/> 
      <Part sid="IXRQ" action="clone"/>
    </CloneParts>
    <Transformations/>
  </Config>
  • The actionRefObj atttribute is optional, and specifies the action for RefObj according to the part type. Supported values are include, clone and ignore.
    • 'include' for RefObj means that the original object (Item or Part) included (as-is) in the cloned structure, without being cloned.
    • 'clone' for RefObj means that the original item or part will in fact be cloned.
    • 'ignore' for RefObj means that the original object (Item or Part) will be ignored.
  • Note: If actionRefObj is not specified, the RefObj will be ignored by default.
  • The optional sub-elements <Include> and <Ignore> define alternative actions, with conditions specified as an included path expression that must evaluate to either false or true. <Ignore> can be an alternative action to both 'include' and 'clone' actions, while <Include> is only a meaningful alternative to 'clone' actions.


Part types that are not covered by any <Part> tag will be ignored by the clone operation, i.e., neither cloned or included.


The optional <Transformations> tag specifies additional transformations to cloned items:

  • Optional <Part> elements change the part type of a cloned part, from the original type as specified by the old attribute, to the one specified by the included string.
  • Optional <Item> elements change the part type of a cloned item in the same way.
  • Optional <Attribute> elements change the item attribute type of a cloned item in the same way.
  • The optional <NamePattern> element can modify the cloned item name.
    • The old attribute specifies the pattern of the name of the cloned item. The "%" wildcard character specifies a part of the original name, which can be used as part of the new name. Any additional characters specified before or after the % must be found in the original name.  If no match can be found, the cloned item will retain the original name.
  • Optional <IgnoreAttribute> elements define that cloned items will get no value for the attribute types included in the SID string.
  • Optional <IgnoreDescription> elements define that cloned items will get an empty Description for the entered item type SID. If multiple item types should get an empty description, you must include one tag for each item type:


    <IgnoreDescription>GDSS</IgnoreDescription>
    <IgnoreDescription>FHRJ</IgnoreDescription>
    Note: Inheritance is supported for the element, which means, if needed, one can include the SID of the parent item type which will result in ignoring the description for all sub-types. It is also possible to ignore the description of all cloned item types by adding <IgnoreDescription>I</IgnoreDescription>.

  • The optional <IgnoreNonDefaultAttributes> defines that any non-default attribute in the original item structure will not be included in cloned items.


Things to Consider

  • The Clone item view functionality does not support deprecated item and part types. Deprecated item and/or part types cannot be included or cloned. They are ignored by design.

What's Next? 

To see an example of using TraceTopPartType to create a link between a clone and its origin, see Configuring a Trace to Origin in Clone Item View.