Search in sources :

Example 1 with ICommandParameter

use of org.talend.mdm.repository.core.command.param.ICommandParameter in project tmdm-studio-se by Talend.

the class DataModelInteractiveHandler method callModelService.

private void callModelService(AbstractDeployCommand cmd) throws XtentisException {
    ICommandParameter parameter = cmd.getParameter();
    if (parameter != null) {
        ImpactOperation operation = (ImpactOperation) parameter.getParameter();
        Boolean force = null;
        if (operation == ImpactOperation.APPLY_LOW_CHANGE) {
            force = false;
        } else if (operation == ImpactOperation.RECREATE_TABLE) {
            force = true;
        }
        ModelImpactAnalyseService.updateModel(cmd.getServerDef(), cmd.getViewObject(), force);
    }
}
Also used : ImpactOperation(org.talend.mdm.repository.core.service.ModelImpactAnalyseService.ImpactOperation) ICommandParameter(org.talend.mdm.repository.core.command.param.ICommandParameter)

Example 2 with ICommandParameter

use of org.talend.mdm.repository.core.command.param.ICommandParameter in project tmdm-studio-se by Talend.

the class DataModelInteractiveHandler method deploy.

@Override
public boolean deploy(AbstractDeployCommand cmd) throws XtentisException {
    IRepositoryViewObject viewObj = cmd.getViewObject();
    Item item = viewObj.getProperty().getItem();
    MDMServerObject serverObject = ((MDMServerObjectItem) item).getMDMServerObject();
    Object wsObj = convert(item, serverObject);
    // 
    ICommandParameter parameter = cmd.getParameter();
    if (parameter != null) {
        callModelService(cmd);
        return true;
    } else {
        TMDMService service = getService(cmd.getServerDef());
        return doDeployWSObject(service, wsObj);
    }
}
Also used : WSDataModelItem(org.talend.mdm.repository.model.mdmproperties.WSDataModelItem) Item(org.talend.core.model.properties.Item) MDMServerObjectItem(org.talend.mdm.repository.model.mdmproperties.MDMServerObjectItem) TMDMService(com.amalto.workbench.webservices.TMDMService) MDMServerObjectItem(org.talend.mdm.repository.model.mdmproperties.MDMServerObjectItem) IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) ICommandParameter(org.talend.mdm.repository.core.command.param.ICommandParameter) MDMServerObject(org.talend.mdm.repository.model.mdmserverobject.MDMServerObject) IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) MDMServerObject(org.talend.mdm.repository.model.mdmserverobject.MDMServerObject)

Example 3 with ICommandParameter

use of org.talend.mdm.repository.core.command.param.ICommandParameter in project tmdm-studio-se by Talend.

the class DeployService method deployAnotherVersion.

public IStatus deployAnotherVersion(MDMServerDef serverDef, List<IRepositoryViewObject> viewObjs) {
    CommandManager manager = CommandManager.getInstance();
    List<AbstractDeployCommand> commands = manager.getDeployCommandsWithoutHistory(viewObjs);
    try {
        // insert impact dialog
        Map<IRepositoryViewObject, ImpactOperation> analyzeModelImpact = ModelImpactAnalyseService.analyzeCommandImpact(serverDef, commands);
        Map<IRepositoryViewObject, ICommandParameter> paramMap = null;
        if (analyzeModelImpact != null) {
            ModelImpactAnalyseService.shrinkDeployCommands(analyzeModelImpact, commands);
            paramMap = ModelImpactAnalyseService.convertToParameters(analyzeModelImpact);
            manager.attachParameterToCommand(commands, paramMap);
        }
    } catch (InterruptedException ex) {
        return Status.CANCEL_STATUS;
    }
    return runCommands(commands, serverDef);
}
Also used : CommandManager(org.talend.mdm.repository.core.command.CommandManager) ImpactOperation(org.talend.mdm.repository.core.service.ModelImpactAnalyseService.ImpactOperation) IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) ICommandParameter(org.talend.mdm.repository.core.command.param.ICommandParameter) AbstractDeployCommand(org.talend.mdm.repository.core.command.deploy.AbstractDeployCommand)

Example 4 with ICommandParameter

use of org.talend.mdm.repository.core.command.param.ICommandParameter in project tmdm-studio-se by Talend.

the class CommandManager method getDeployCommands.

/**
 * DOC hbhong Comment method "getDeployCommands".
 *
 * @param viewObjs
 * @param defaultCmdType if none then assign -1
 * @return
 */
public List<AbstractDeployCommand> getDeployCommands(List<IRepositoryViewObject> viewObjs, int defaultCmdType, Map<IRepositoryViewObject, ICommandParameter> paramMap) {
    List<AbstractDeployCommand> cmds = new LinkedList<AbstractDeployCommand>();
    for (IRepositoryViewObject viewObj : viewObjs) {
        CommandStack stack = findCommandStack(viewObj.getId());
        if (stack == null) {
            stack = new CommandStack();
            ICommand cmd = getNewCommand(viewObj, defaultCmdType);
            cmd.init(viewObj);
            stack.pushCommand(cmd);
        }
        ICommand validCommand = stack.getValidDeployCommand();
        if (validCommand != null) {
            if (validCommand instanceof AbstractDeployCommand) {
                fillViewObjectToCommand(validCommand);
                AbstractDeployCommand deployCommand = (AbstractDeployCommand) validCommand;
                if (paramMap != null) {
                    ICommandParameter param = paramMap.get(viewObj);
                    deployCommand.setParameter(param);
                }
                cmds.add(deployCommand);
            } else if (validCommand instanceof NOPCommand && defaultCmdType > 0) {
                ICommand cmd = getNewCommand(defaultCmdType);
                if (cmd instanceof AbstractDeployCommand) {
                    cmd.init(viewObj);
                    cmds.add((AbstractDeployCommand) cmd);
                }
            }
        }
    }
    return cmds;
}
Also used : NOPCommand(org.talend.mdm.repository.core.command.impl.NOPCommand) IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) ICommandParameter(org.talend.mdm.repository.core.command.param.ICommandParameter) AbstractDeployCommand(org.talend.mdm.repository.core.command.deploy.AbstractDeployCommand) LinkedList(java.util.LinkedList)

Example 5 with ICommandParameter

use of org.talend.mdm.repository.core.command.param.ICommandParameter in project tmdm-studio-se by Talend.

the class ModelImpactAnalyseService method convertToParameters.

public static Map<IRepositoryViewObject, ICommandParameter> convertToParameters(Map<IRepositoryViewObject, ImpactOperation> impactResult) {
    Map<IRepositoryViewObject, ICommandParameter> paramMap = new HashMap<IRepositoryViewObject, ICommandParameter>();
    for (IRepositoryViewObject viewObj : impactResult.keySet()) {
        ImpactOperation impactOperation = impactResult.get(viewObj);
        ICommandParameter param = new DataModelCmdParam(impactOperation);
        paramMap.put(viewObj, param);
    }
    return paramMap;
}
Also used : HashMap(java.util.HashMap) DataModelCmdParam(org.talend.mdm.repository.core.command.param.DataModelCmdParam) IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) ICommandParameter(org.talend.mdm.repository.core.command.param.ICommandParameter)

Aggregations

ICommandParameter (org.talend.mdm.repository.core.command.param.ICommandParameter)8 IRepositoryViewObject (org.talend.core.model.repository.IRepositoryViewObject)7 AbstractDeployCommand (org.talend.mdm.repository.core.command.deploy.AbstractDeployCommand)5 ImpactOperation (org.talend.mdm.repository.core.service.ModelImpactAnalyseService.ImpactOperation)4 LinkedList (java.util.LinkedList)3 XtentisException (com.amalto.workbench.utils.XtentisException)2 WebServiceException (javax.xml.ws.WebServiceException)2 IStatus (org.eclipse.core.runtime.IStatus)2 CommandManager (org.talend.mdm.repository.core.command.CommandManager)2 ConsistencyCheckResult (org.talend.mdm.repository.core.service.ConsistencyService.ConsistencyCheckResult)2 IModelValidateResult (org.talend.mdm.repository.core.service.IModelValidationService.IModelValidateResult)2 TMDMService (com.amalto.workbench.webservices.TMDMService)1 InvocationTargetException (java.lang.reflect.InvocationTargetException)1 HashMap (java.util.HashMap)1 NullProgressMonitor (org.eclipse.core.runtime.NullProgressMonitor)1 Item (org.talend.core.model.properties.Item)1 NOPCommand (org.talend.mdm.repository.core.command.impl.NOPCommand)1 DataModelCmdParam (org.talend.mdm.repository.core.command.param.DataModelCmdParam)1 DeployService (org.talend.mdm.repository.core.service.DeployService)1 MDMServerDef (org.talend.mdm.repository.model.mdmmetadata.MDMServerDef)1