Você está na página 1de 16

Integration in HMC

Technical Guide

By:
Himanshu Durgapal

Table of Contents
Introduction................................................................................................................ 3
hmc.xml.................................................................................................................. 4
Customizing Toolbar................................................................................................ 4
Customizing Explorer Tree....................................................................................... 5
HMC Section-Related Tags..................................................................................... 11
<attribute> Tag..................................................................................................... 14

Introduction
The Hybris Management Console (HMC) is a highly configurable and adaptable. It
can be set up to match the business object types needed. Most of the configuration
is done via an XML file.
The intention behind creation of this document is to make the developers
understand how to configure the HMC according to your business and project
requirements.

Overview of the Hybris Management Console


The HMC is a graphical administration interface. It allows maintaining and
configuring the hybris Multichannel Suite via a web browser

hmc.xml
This file is the core of hmc and it contains the entire configuration for the hmc
layouts this file is added by the ant extgen script automatically for some templates
(for example the default yempty template) .Most of the hmc customization is done
by this file.

Customizing Toolbar
Toolbar contains hmc actions; an action allows running custom business logic in the
hybris Management Console (hmc).
Types of Actions
There are three basic types of actions:

ToolbarAction:
Generic business logic that can run without any parameters or items
involved.

SearchResultAction:
Runs the implemented business logic on a number of items selected from a
search result.

ItemAction:
Business logic related to a certain item.

Basics on Implementing an Action


To implement an action, implement the
de.hybris.platform.hmc.util.action.HMCAction interface (or one of the derived
abstract classes ToolbarAction, SearchResultAction, ItemAction,
CreateAction, SaveAction, RemoveAction) in your Java class file,
The Java files for an Action must be located in an extension's hmc folder. Keeping
Action Java files in the src folder of the extension will cause the Action Java files not
to be found.
By using the <action> tag in your extension's hmc.xml file, you can reference an
Action.
The basic syntax:
<action

align="left"
autosave="true" classname="de.hybris.hmcaction.myAct
ion" disabledicon="" hidebutton="true" icon="" name="" showtoolbarlabel="true"
toolbaricon="" tooltip="" type="toolbar"/>

Only specific types of action is allowed in hmc.xml based on the parent tags:
Subtag of <configuration>
RemoveAction

ToolbarAction, CreateAction, SaveAction,

Subtag of <search>

SearchResultAction

Subtag of <tab>

ItemAction

Although the name attribute is not marked mandatory in the hmc.xsd file, you still
need to specify this attribute (even with a blank value) - refer JIRA issue on this
subject.
SampleToolbarAction.java:
public class SampleToolbarAction extends ToolbarAction {
public ActionResult perform(ActionEvent e) throws JaloBusinessException {
return new ActionResult(ActionResult.OK, "Hello"

+ JaloSession.getCurrentSession().getUser().getUID, true);

}
}

Customizing Explorer Tree


A customized node can be added in hmc using <explorertree> tag,
<explorertree>
<group name="cuppy">
<typeref type="Competition"/>
<typeref type="Match"/>
<typeref type="MatchBet"/>
<typeref type="Group"/>
<typeref type="Team"/>
<typeref type="Player"/>
<typeref type="News"/>
</group>
</explorertree>

Subtags

<group> (GroupType)

<typeref> (TypeReferenceType)

< group> tag : Adds a group node (i.e. a container or folder like 'Catalog' or
'System') to the explorer tree which in turn can contain other nodes.
< typeref> tag : Adds a node which references a type's Organizer to the explorer
tree. In other words, this points to the HMC configuration for a type Organizer.

The <type> Tag


Description of a single type (appearance in the editor, in lists, etc.).

Attribute
name="string"
(mandatory)
icon="string"
useselector="boolea
n"
mode="modeType"

Description / Comment
The code of the type which is described here.
Pathname of an icon which should be used for this type.
select box to choose an item of this type (see for example the
'unit' attribute in a 'product' item).
Mode can be one of append, replace. Default is replace.

Subtags

<organizer> (OrganizerType)

The organizer tag is the parent tag of search, result and editor tags:
The <search> TagContains configurations of the organizer search section.

Attribute

Description / Comment

mode="modeType
Mode can be one of append, replace. Default is append.
"
Specifies whether the search is triggered automatically on
opening the organizer in the hMC. If set to true, the search is
autoperform="bool triggered automatically; if set to false (default), then the user
ean"
needs to click on the Search button to trigger the search.
Subtags

<condition> (ConditionType)

Describes a default condition which will be added to the search section.

Attribute

Description / Comment

attribute="string" (mandatory)

Name of the attribute for


which this condition
applies.

operator="string" [possible values are: equal, empty, is


Operator to use in this
not null, is null, like, starts with, ends with, contains, >,
condition.
<, yes, no]
Default value for this
defaultvalue="string"
condition's operator.
Mode can be one of
mode="modeType "
append, replace. Default is
append.
The position of this
position="integer"
condition within the search.
The <result> Tag
Contains configurations of the organizer result section.
Attribute

Description / Comment

defaultview="string"
[possible values: list, edit,
tree]

Sets the default view mode (list, edit, tree) for the
organizer result section. If no default view is explicitly
set, the list view will be used.

mode="modeType "

Mode can be one of append, replace. Default is

append.

Subtags

<listview> (ListViewType)

<editview> (EditViewType)

<treeview> (TreeViewType)

<action> (ActionType)

The <listview> TagConfiguration of the organizer result section when in list view mode.
Attribute

Description / Comment

mode="modeType " Mode can be one of append, replace. Default is append.


scrollbar="boolean"

Can be true or false (false to hide the scrollbar). Default is


true.

The <itemlayout> TagDefines which attributes of the type are shown in the result list (one attribute per
column).
Attribute
mode="modeType "

Description / Comment
Mode can be one of append,
replace. Default is append.

Subtags

<attribute>

<item> (ItemType)

The <item> Tag


With this tag, you can show a reference
of the respective item within a reference
or search result list.
The <item> tags' attributes
Attribute

Description / Comment

width="string"

The width of this element in pixels.

title="string"

Alternative title of list columns (instead of


the attribute name, for example). Will be
used as a key to lookup a localized string.

The <editview> Tag


Configuration of the organizer result section when in EditView mode.
Attribute

Description / Comment

mode="modeType
"

Mode can be one of append, replace. Default is append.

scrollbar="boolea
'false' to disable the scrollbar in the search result list. Default
n"
is 'true'.
Subtags

<itemlayout>

The <treeview> Tag


Configuration of the organizer result section when in TreeView mode.(not done
practically )
Attribute

Description / Comment

mode="modeType
Mode can be one of append, replace. Default is append.
"
scrollbar="boolean 'false' to disable the scrollbar in the search result list. Default is
"
'true'.
The <attribute> </attribute> TagAttribute which should be explorable, i.e. which will be shown below an item node in
the tree view result list.

Attribute
name="string"
(mandatory)
mode="modeType"
suppressroot="boole
an" [0..1]

Description / Comment
The attribute's qualifier
Mode can be one of append, replace. Default is append.
If set to true, the appropriate attribute itself will not appear
as a node, but all its explorable subnodes will be shown

directly (i.e. one node level will be skipped).


The <editor> Tag
Contains configurations of the organizer editor section.
Attribute

Description / Comment

mode="modeType "

Mode can be one of append, replace. Default is append.

Subtags

<exclude> (ExcludeType)

<essentials> (EssentialsType)

<tab> (TabType)

<customtab> (CustomTabType)

<tabref> (TabRefType)

The <exclude> Tag


Contains the attributes which should be excluded (omitted) in the editor of this
type. Be sure you do not explicitly add these attributes in any of the other sections!
If there are attributes which have not been explicitly configured to appear on any
tab/section inside the editor and you do not 'exclude' them, then they will
appear inside the so-called 'defaultsection' (which is by default located on the
'administration' tab).
Attribute

Description / Comment

mode="modeType "

Mode can be one of append, replace. Default is append.

Subtags

<exclusion>

You have to mention the attribute which we want to exclude.


The <essentials> Tag
Contains the attributes which are "essential" for this type. These attributes will be
shown on top of every tab in the editor.

Attribute

Description / Comment

mode="modeType "

Mode can be one of append, replace. Default is append.

Subtags

<table>

<listlayout>

<columnlayout>

The <tab> Tag


Describes one tab of the editor, which in turn contains sections and attributes.

Attribute

Description / Comment

name="string"
(mandatory)

The name of this tab. The name will be used as a key to look
up a localized string.

mode="modeType "

Mode can be one of append, replace, or delete. Default is


append.

position="integer"

The position of this tab within the tabs.

Subtags

<section> </section>

The <section> Tag


Adds a section to the tab.

Attribute

Description / Comment

name="string"
(mandatory)

The name of this tab. The name will be used as a key to look
up a localized string.

mode="modeType "

Mode can be one of append, replace. Default is append.

position="integer"

The position of this section within the tab.

Subtags

<table>

<listlayout>

<columnlayout>

HMC Section-Related Tags


The <columnlayout> TagConfigure the layout of the type's attributes using a layout with two columns.
Attribute

Description / Comment

width="string"

The width of this element in pixels.

height="string"

The height of this element in pixels.

leftwidth="positiveInteger"

Explicitly set the width of the left column.

rightwidth="positiveInteger"

Explicitly set the width of the right column.

Subtags

<row>

The <row> Tag


Describes one row of a column layout (containing up to 2 elements for a 2-column
layout).
The contained elements (e.g. attribute editors) are rendered from left to right. If you
only provide one element in a row then it will be rendered as if you use the HTML
attribute 'colspan=2'.
If you want to explicitly have one element to fill up only the left or the right column
(without any spanning) then please use the <void> element for the respective
other column.

Attribute

Description / Comment

width="string"
height="string"

The width of this element in pixels.


The height of this element in pixels.

position="integer"

The position of this row within the columlayout.

Subtags (most are equivalent to, for example, the <td> subtags)

<attribute> (AttributeChipType)

<customattributechip> (CustomAttributeChipType)

<customchip> (CustomChipType)

<inlineshortcut> (InlineShortcutType)

<shortcut> (ShortcutType)

<action> (ActionType) - (item action)

<text> (TextChipType)

<void> (VoidType) - can be used to fill up one column to prevent spanning of


a single element inside a row

The <listlayout> Tag


Configure the layout of the type's attributes using a list layout (all containing
elements, e.g. attribute editors, are rendered top to bottom).

Attribute
width="string"
height="string"
mode="modeType "

Description / Comment
The width of this element in pixels.
The height of this element in pixels.
Mode can be one of append, replace. Default is append.

Subtags

<attribute> (AttributeChipType)

<customattributechip> (CustomAttributeChipType)

<customchip> (CustomChipType)

<table> (TableType)

<listlayout> (ListLayoutType)

<inlineshortcut> (InlineShortcutType)

<shortcut> (ShortcutType)

<action> (ActionType)

<text> (TextChipType)

The <table> Tag


Configure the layout of the type's attributes using a table layout. This layout mimics
the html table element, so you can use a few well known features of that element.
Attribute
width="string"
height="string"

Description / Comment
The width of this element in pixels.
The height of this element in pixels.

Subtags

<tr> (TRType)

The <tr> Tag


Describes one row of an editor table (works just like the HTML tr element).
Attribute
width="string"
height="string"

Description / Comment
The width of this element in pixels.
The height of this element in pixels.

Subtags

<td> (TDType)

The <td> Tag


Describes the content of one table cell of an editor table (works just like the HTML
td element).
Attribute
Description / Comment
width="string"
The width of this element in pixels.
height="string"
The height of this element in pixels.
colspan="positiveInte Just like in an html table this configures the column spanning
ger"
of a td element.
rowspan="positiveInt Just like in an html table this configures the row spanning of a
eger"
td element.

Subtags

<attribute>

<customattributechip>

<customchip>

<table>

<listlayout>

<inlineshortcut>

<shortcut>

<action>

<text>

<attribute> Tag
Attribute

Description / Comment

name="string"

Name (qualifier) of the type's attribute.

mode="modeType "

Mode can be one of append, replace or delete.


Default is append.

width="positiveInteger"

Width of the attribute editor.

labelwidth="nonNegativeI
Width of the attribute label.
nteger"
With maxlength you can restrict the entry length in
maxlength="positiveInteg
some text editors (e.g. in stringeditor and
er"
textareaeditor).
hidelabel="boolean"

If true the label of the attribute will not be shown.

descriptionattribute="strin
Name of description attribute.
g"
editable="boolean"

By setting this to 'false' the respective attribute will not


be editable (regardless of the current user's access
rights). Default is 'true'.

position="integer"

The position of this attribute within the editor.

Subtags

<defaulteditor>

<customeditor>

<stringeditor>

<stringselecteditor>

<textareaeditor>

<wysiwygeditor>

<integereditor>

<shorteditor>

<longeditor>

<doubleeditor>

<floateditor>

<booleaneditor>

<advancedbooleaneditor>

<datetimeeditor>

<longasdateeditor>

<longasdatetimeeditor>

<javaclasseditor>

<enumerationvalueselecteditor>

<referenceeditor>

<partofreferenceeditor>

<referencecollectioneditor>

<collectioneditor>

<subtypeselecteditor>

<specialeditor>

<mediaeditor>

<mapeditor>

<specialcreator>

Você também pode gostar