Motivation
This Projectdatastadiums.impex file assumes the presence during import, which is an update operation, which means it may throw an exception.
Cuppytrail/resources/impex/projectdatastadium.impex |
... UPDATE Match;id[unique=true];group (code), code) [Unique=true];stadium (code); 1;wc2010:a; competition; emirates;2;wc2010:a; Emirates;3;wc2010:b; Emirates;4;wc2010:b; Villapark ...
Solution Solutions
Create the Systemsetup class because it is completed by Cuppy and triggers the import wc2010 projectdata.
De.hybris.platform.cuppytrail.systemsetup.CuppyTr Ailsystemsetup.java |
/* * [y] hybris platform * * copyright (c) 2000-2012 hybris ag * all rights reserved. * * this software is the confidential and proprietary information of hybris * ("Confidential information ") . you shall not disclose such confidential * information and shall use it only in accordance with the terms of the * license agreement you entered into with hybris. * * */package de.hybris.platform.cuppytrail.systemsetup; import de.hybris.platform.core.initialization.systemsetup;import de.hybris.platform.core.initialization.systemsetup.process;import de.hybris.platform.core.initialization.systemsetup.type;import De.hybris.platform.core.initialization.SystemSetupContext;import de.hybris.platform.core.initialization.systemsetupparameter;import de.hybris.platform.core.initialization.systemsetupparametermethod;import de.hybris.platform.cuppy.constants.cuppyconstants;import de.hybris.platform.cuppy.systemsetup.cuppysystemsetup; import java.util.collections;import java.util.hashmap;import java.util.list;import java.util.map; /** * class to load the pre-requisite wc2010 data for projectdatastadium.impex imports */@SystemSetup (extension = "Cuppytrail", process = process.all, Type = type.project) public class cuppytrailsystemsetup extends cuppysystemsetup{ @SystemSetup public void importprereqsfromcuppy () { //set up the items to impOrt final map<string, string[]> params = new HashMap<String, String[]> (); final string[] p_basics = { Cuppyconstants.param_basics_players }; params.put ( cuppyconstants.extensionname + "_" + cuppyconstants.param_basics, p_basics); final String[] p_wc2010 = { CuppyConstants.PARAM_WC2010_SETUP }; params.put (cuppyconstants.extensionname + "_" + cuppyconstants.param_ wc2010, p_wc2010); final systemsetupcontext ctx = new systemsetupcontext (paraMs, type.project, process.all, cuppyconstants.extensionname); //here we use the same context for both. since it is a fairly flat data object, this works just fine //super.importbasics (CTX); super.importwc2010 (CTX); } @Override @SystemSetupParameterMethod public list<systemsetupparameter > getsystemsetupparameters () { Return collections.emptylist (); }}
Finally, it needs to be injected in spring.
<bean id= "Cuppytrailsystemsetup" class= "De.hybris.platform.cuppytrail.systemsetup.CuppyTrailSystemSetup" scope = "Tenant" > <property name= "importservice" ref= "Importservice"/></bean>
This cuppytrail import, which is now selected by the Projectdata during the update process, will be triggered before the Convention in the configuration file.
7. Resolvingprojectdatadependenciesbetweencuppytra