This page demonstrate How To Customize Sterling Application ..
Customization of Sterling Commerce Application is difficult task. This
steps help you on customize the application.
Before Starting Customization, Please go-through the following product
documentations
IBM Supply Chain Community (
https://community.ibm.com/community/user/supplychain/communities/community-home/
)
Following customizations can be done on Sterling Commerce Application.
1.0 Queue Creation:
1.0.1 Create Integration Server:
- Open configurator / application Manager : https://localhost:9443/smcfs/console/login.jsp
- Go to Order Fulfillment ProcessType > Service Tab > Click
On '+' icon > Select Asynchronous Radio Button > Add JMS queue
Trans Port Type component + API Component > Connect Them. There should
be a green bold Line.
- Select bold line AND add all parameters.
- Set following runtime parameters:
- Sub Service Name = any name (e.g. CreateOrdInt_0) Name = Queue
name (e.g. CREATE_ORDER_IN); Initial Context Factory = File ;
Connection Factory = AGENT_QCF; Provider url =
file:///oms/devtoolkit_docker/jndi ( You will get this value whcn you
create the queue using above commmand)
- Create a new Server MY_CREATE_ORDER_SRV
- Select api component and set createOrder api. Save it
- Start integration server with the following command:
- startIntegrationServer.cmd
1.0.2 Create A service (Service Name: PostToQ)to post message
to CREATE_ORDER_IN queue: :
- Open configurator / application Manager : https://localhost:9443/smcfs/console/login.jsp
- Go to Order Fulfillment ProcessType > Service Tab >
Click On "+" icon > Select Synchronous Radio Button > Add JMS
Queue Trans Port Type component > Connect Them. There should be a
green bold Line.
- Set the following values. Sub Service Name = any name (e.g.
CreateOrdInt_0) Name = Queue name (e.g. CREATE_ORDER_IN); Initial
Context Factory = File ; Connection Factory = AGENT_QCF; Provider url
= file:///oms/devtoolkit_docker/jndi ( You will get this value whcn
you create the queue using above commmand)
Note: If you are getting any of the
following error white starting the integration server.
JMSCMQ0001: IBM MQ call failed with compcode '2' ('MQCC_FAILED') reason
'2538' ('MQRC_HOST_NOT_AVAILABLE'). [system]: com.ibm.mq.MQException:
JMSCMQ0001: IBM MQ call failed with compcode '2' ('MQCC_FAILED') reason
'2538' ('MQRC_HOST_NOT_AVAILABLE').
Failed to connect to queue manager 'OM_QMGR' with connection mode
'Client' and host name 'mqserver(1414)'."
com.ibm.msg.client.jms.DetailedIllegalStateException: JMSWMQ0018: Failed
to connect to queue manager 'OM_QMGR' with connection mode 'Client' and
host name 'mqserver(1414)'. Check the queue manager is started and if
running in client mode, check there is a listener running.
Or
Caused by: com.ibm.mq.jmqi.JmqiException: CC=2;RC=2538;AMQ9204:
Connection to host 'mqserver(1414)' rejected.
[1=com.ibm.mq.jmqi.JmqiException[CC=2;RC=2538;AMQ9205: The host name
supplied is not valid.
[3=mqserver,4=TCP]],3=mqserver(1414),5=RemoteTCPConnection.resolveHostname]
Or
Caused by: com.ibm.mq.jmqi.JmqiException: CC=2;RC=2538;AMQ9205: The host
name supplied is not valid. [3=mqserver,4=TCP]
Solution:
Make an entry like 127.0.0.1 mqserver in /etc/hosts file
Example:
127.0.0.1 localhost localhost.localdomain localhost4
localhost4.localdomain4
mqserver
1.0.3 Create Agent Server:
Agent is a time trigger transaction. So to create an agent we need to
create custom transaction.
- Open configurator / application Manager : https://localhost:9443/smcfs/console/login.jsp
- Go to Order Fulfillment ProcessType > Transaction Tab >
Click On '+' icon > "Do not derived from abstract transaction"
Radio Button> Go to Time Trigger tab. > Check the check box
'It's a trime trigger tansaction' > Add a Java class name > Save
It > Add JMS queue Trans Port Type component + API Component >
Connect Them. There should be a green bold Line.
- Add A agent Criteria .
- Add Criteria Parameters.
- Provide JMS queue details as shown during integration server
creation
- Set following runtime parameters:
- Queue name (e.g. CUSTOM_AGENENT_Q); Initial Context Factory =
File ; Connection Factory = AGENT_QCF; Provider url =
file:///oms/devtoolkit_docker/jndi ( You will get this value whcn you
create the queue using above commmand)
- Create an new Agent server (e.g. CUSTOM_TABLE_PURGE_SRV ) or
select any existing DefaultAgent server.
- . Save it
- Start Agent Server with the following command:
- Go to /runtime/bin folder and invoke agentServer.cmd
<Server> Name (e.g. CUSTOM_TABLE_PURGE_SRV
- Trigger Agent Server with the following command:
- Go to /runtime/bin folder and invoke triggeragent.cmd
<Server> Name (e.g. CUSTOM_TABLE_PURGE_SRV)
1.1 Log Setup
How to enable logging for your custom java classes:
Create a log4jconfig.xml file and put in deltalog4jconfig folder under
resources directory under global (global > resources > deltalog4j
).
This log4jconfig.xml should contain information about your custom java
packages.
<?xml version="1.0" encoding="UTF-8"?>
<log4jconfigdelta>
<category additivity="false" class="
Full class name(including package name) of yfc log category
" name="com.easy">
<level class="
Full class name(including package name) class name of yfc log
level
" value="DEBUG"/>
<appender-ref ref="CONSOLE"/>
<appender-ref ref="ALL"/>
</category>
</log4jconfigdelta> -
View
Product Documentation For Log4J Configuration
2. Database Customization:
- Add Column to product table
- Create custom hang-off table with order header table
- Create independent table
2.1 |
Add "EXTN_PREFERENCE" column in ITEM table
- Make and entry for the new column "EXTN_PREFERENCE" for the
ITEM table in the ....../extensions/global/entities/Extensions.xml.
If this file is not there create a new file taking a copy from
...../runtime/repository/entity/extensions/Extensions.xml.Sample
- Start Database instance if it's not running.
cd /oms/devtoolkit_docker/compose
./om-compose.sh start <databse server> (e.g; oracleserver, db2server)
- Build extension jar. Execute following command :
cd /oms/devtoolkit_docker/runtime/bin
./sci_ant.sh -f ../devtoolkit/devtoolkit_extensions.xml importfromproject -Dprojectdir=/oms/project
- Deploy Extension Jar
cd /oms/devtoolkit_docker/compose
./om-compose.sh update-extn /oms/devtoolkit_docker/extensions.jar
- Stop the database server instance and Start entire applic
ation instan ce
- Check the ITEM table. You should see the new column.
Open
https://localhost:9443/smcfs/yfshttpdbi/sterlingdbqueryclient.jsp
to check the new column.
|
2.2 |
Create a custom table
"EXTN_PARTERNER_DETAILS" table and have relationship with
ORDER_HEADER table
|
2.3 |
Create a custom table
"EXTN_PARTERNER_DETAILS" table with will not have relationship with
any product table
|
3. Foundation / Backend Customization:
- Building custom service, condition, action, agent, integration
server
- Event, User Exit Customization
- Custom Transaction, Status, Pipeline Changes
3.0 |
Building and Deploying Custom Code
- Write a Java Class It may extends YIF Custom Api have a
public method which returns document and it accept YFS environment
object and document object
- Create a folder/directory named 'project'.
cd /oms
md project
chmod 777 project
- Create src and lib folder inside project directory.
cd /oms/project
md lib
md src
chmod 777 lib
chmod 777 src
- put/upload your java file in /oms/project/src folder.
Example: If your package name is com.easy. You need put the file in
/oms/project/src/com/easy folder
- If you are using any 3rd party jar files, upload them in
/oms/project/lib folder. Example:- My java code uses 3rd party
class StrUtil.class and its in easycommon.jar. I should upload the
easycommon.jar file in /oms/project/lib folder
- Stop the server if its running. Execute following command :
cd /oms/devtoolkit_docker/compose
./om-compose.sh stop
- Start only Database server as it's required during entity
build.
cd /oms/devtoolkit_docker/compose
./om-compose.sh start db2server ( or oracleserver for oracle)
- Build extension jar. Execute following command :
cd /oms/devtoolkit_docker/runtime/bin
./sci_ant.sh -f ../devtoolkit/devtoolkit_extensions.xml importfromproject -Dprojectdir=/oms/project
- Update extension jar. Execute following command from :
cd /oms/devtoolkit_docker/compose
./om-compose.sh update-extn /oms/devtoolkit_docker/extensions.jar
Sample Custom Java Code:
package com.easy;
import java.util.Properties;
import org.w3c.dom.Document;
public class TestService implements YIF CustomApi {
public Document testMethod(Environment env, Document doc) {
doc.getDocumentElement().setAttribute("Training", "EasyCodeForAll");
return doc;
}
@Override
public void setProperties(Properties arg0) throws Exception {
}
}
|
3.1 |
Developing Custom Service:
- Write a Java Class which extends YIF Custom Api
- It should have a public method which returns document and
it accept YFS environment object and document object
- Open Application Manager. Go to any process type and
service tab. Create a new service of type extended api.
- Provide the Java class name with package name and method
name. Api name can be given same as method name..
- Add your java class in your project folder and do a build
and deployment.
- Test the service with API tester - Invoke the service from
API tester with a sample XML
- You should get an XML as output of the service
. Example Code:
package com.easy;
import java.util.Properties;
import org.w3c.dom.Document;
import com.easy.StrUtil;
public class TestServiceEasyK implements YIF Custom Api {
Properties prop;
public Document testMethod(Environment env, Document doc) {
doc.getDocumentElement().setAttribute("Training", "EASY_CODE");
System.out.println("TESTING_CUSTOM CODE DEPLOYMENT WITH 3RD PARTY DEPENDANT JAR");
return doc;
}
@Override
public void setProperties(Properties arg0) throws Exception {
prop = arg0;
}
}
|
3.2 |
UE Implementation:
- Write a Java Class which implements UE interface (e.g.
beforeCreateOrderUE)/li>
- Implement the interface methods (unimplemented)
- In the method body. put your custom logic. Process the
input XML and after processing return the input XML as output.
check the API java doc to find out what kind of value UE method
takes and what kind of value UE returns
- If you add any new attribute which is not there in the UE
input XML structure, it will not be passed to the UE.
- If you add any new attribute which is not there in the UE
output XML structure, it will not be available to transaction.
- Configure the UE implementation in Application Manager
(Configurator)
- Invoke API/Transaction with API tester to test the UE
. Example Code:
package com;
import org.w3c.dom.Document;
public class UEImpl implements BeforeCreateOrderUE {
@Override
public String beforeCreateOrder(Environment arg0, String arg1) throws UserExitException {
return arg1;
}
@Override
public Document beforeCreateOrder(Environment env, Document doc) throws UserExitException {
doc.getDocumentElement().setAttribute("OrderName", "EASY_ORDER");
System.out.println("UE INVOKED");
return doc;
}
}
|
3.3 |
Dynamic Condition:
- Write a Java Class which implements DynamicConditionEx
(e.g. beforeCreateOrderUE)
- Implement the evalueCaondtion methods (unimplemented
methods). It should return boolean value.
- In the evalueCaondtion method body. put your custom logic.
Process the input XML and after processing and finally return a
boolean value
- If your code raise any exception, wrap it with try/catch
block. Do not throw any exception. .
- Configure the condition in Application Manager
(Configurator)
. Example Code:
package com;
import java.util.Map;
import org.w3c.dom.Document;
public class TestDynamicCondition implements DynamicConditionEx {
Map prop = null;
@Override
public boolean evaluateCondition(Environment arg0, String arg1, Map arg2, Document arg3) {
boolean conditionValue = true;
try {
String attrValue = arg3.getDocumentElement().getAttribute("CarrierServiceCode");
if (attrValue == null)
conditionValue = false;
} catch (Exception ex) {
conditionValue = false;
}
System.out.println("conditionValue=" + conditionValue);
return conditionValue;
}
@Override
public void setProperties(Map arg0) {
prop = arg0;
}
}
|
4. Store UI Customization
Detail steps are given in
this page(web-store-ui-customization.html)
5. Call Center Customization:
6. Web Console Customization :
7. SBC Customization: