2017-02-26 54 views
1

下面有一個註釋爲@SystemSetup的方法,但如何觸發此方法?如何在Hybris中觸發註釋@SystemSetup?

@SystemSetup(extension = IwacockpitsConstants.EXTENSIONNAME) 
public class IwaCockpitsSystemSetup{ 
    @SystemSetup(type = SystemSetup.Type.ALL, process = SystemSetup.Process.ALL) 
    public void createCsCockpitUsers(){} 
} 

此外,還有一個官方評論:

/** 
* This class is called during IwaCockpits system setup, either selecting essential or project data. 
* 
* The main method of this class ({@link #createCsCockpitUsers()} is responsible for creating all the IWA CSCockpit 
* custom groups and their restrictions. 
*/ 

回答

1

事實上款Hybris將觸發方法你都updateinit過程(因爲process = Process.ALL)護理,同時創造essentialproject數據(因爲type = Type.ALL)這可以從HAC完成或使用Ant

對於EXA mple嘗試更新過程與創建基本數據從HAC檢查調用的方法:

enter image description here

這裏有不同的情況下,當要根據@SystemSetup輸入來執行的方法。

@SystemSetup(extension = IwacockpitsConstants.EXTENSIONNAME) 
public class IwaCockpitsSystemSetup{ 

    @SystemSetup(process = SystemSetup.Process.INIT, type = SystemSetup.Type.ESSENTIAL) 
    public void method_1(){ 

     //will be executed during the initialization process when the essential data for extension iwacockpits is created. 

    } 

    @SystemSetup(process = SystemSetup.Process.INIT, type = SystemSetup.Type.PROJECT) 
    public void method_2(){ 

     //will be executed during the initialization process while creation of project data for extension iwacockpits. 

    } 

    @SystemSetup(process = SystemSetup.Process.UPDATE, type = SystemSetup.Type.ESSENTIAL) 
    public void method_3(){ 

     //will be executed during the update process when the essential data for extension iwacockpits is created. 

    } 

    @SystemSetup(process = SystemSetup.Process.UPDATE, type = SystemSetup.Type.PROJECT) 
    public void method_4){ 

     //will be executed during the initialization process when the project data for extension iwacockpits is created. 

    } 

    @SystemSetup(process = SystemSetup.Process.ALL, type = SystemSetup.Type.ALL) 
    public void method_5){ 

     //will be executed during creation of project data or essential data in the same extension, in both init and update. 

    } 

} 
+0

您的回答非常詳細,我接受了,謝謝!你能幫我解決另一個問題嗎? [啓動服務器時發生Hybris錯誤](http://stackoverflow.com/questions/42470529/hybris-error-occurred-while-starting-server) – licaomeng