Search in sources :

Example 1 with ContainerItem

use of org.talend.mdm.repository.model.mdmproperties.ContainerItem in project tmdm-studio-se by Talend.

the class NewProcessAction method getType.

private int getType() {
    int type = 0;
    IRepositoryViewObject repositoryViewObject = (IRepositoryViewObject) selectObj;
    ContainerItem containerItem = (ContainerItem) repositoryViewObject.getProperty().getItem();
    String path = containerItem.getState().getPath();
    if (path.isEmpty()) {
        type = TYPE_PROCESS;
    } else if (path.startsWith(IPath.SEPARATOR + ITransformerV2NodeConsDef.PATH_BEFORESAVE)) {
        type = TYPE_BEFORESAVE;
    } else if (path.startsWith(IPath.SEPARATOR + ITransformerV2NodeConsDef.PATH_BEFOREDEL)) {
        type = TYPE_BEFOREDEL;
    } else if (path.startsWith(IPath.SEPARATOR + ITransformerV2NodeConsDef.PATH_ENTITYACTION)) {
        type = TYPE_ENTITYACTION;
    } else if (path.startsWith(IPath.SEPARATOR + ITransformerV2NodeConsDef.PATH_WELCOMEACTION)) {
        type = TYPE_WELCOMEACTION;
    } else if (path.startsWith(IPath.SEPARATOR + ITransformerV2NodeConsDef.PATH_SMARTVIEW)) {
        type = TYPE_SMARTVIEW;
    } else if (path.startsWith(IPath.SEPARATOR + ITransformerV2NodeConsDef.PATH_OTHER)) {
        type = TYPE_OTHER;
    }
    return type;
}
Also used : ContainerItem(org.talend.mdm.repository.model.mdmproperties.ContainerItem) IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject)

Example 2 with ContainerItem

use of org.talend.mdm.repository.model.mdmproperties.ContainerItem in project tmdm-studio-se by Talend.

the class NewProcessAction method doRun.

@Override
protected void doRun() {
    parentItem = null;
    selectObj = getSelectedObject().get(0);
    int type = getType();
    if (selectObj instanceof IRepositoryViewObject) {
        Item pItem = ((IRepositoryViewObject) selectObj).getProperty().getItem();
        if (pItem instanceof ContainerItem) {
            parentItem = (ContainerItem) pItem;
        }
    }
    IWorkbenchPartSite site = commonViewer.getCommonNavigator().getSite();
    // wizard
    NewProcessWizard newProcessWizard = new NewProcessWizard(site, type);
    WizardDialog wizardDialog = new WizardDialog(getShell(), newProcessWizard);
    wizardDialog.setPageSize(500, 260);
    if (wizardDialog.open() == IDialogConstants.OK_ID) {
        WSTransformerV2E newProcess = newProcessWizard.getNewProcess();
        final Item item = createServerObject(newProcess);
        commonViewer.refresh(selectObj);
        commonViewer.expandToLevel(selectObj, 1);
        openEditor(item);
        if (newProcessWizard.isCreateJob()) {
            generateJobTemplate(newProcessWizard.getType(), newProcessWizard.getProcessName(), newProcessWizard.getReturnMessages(), newProcessWizard.isEnableRedirect(), newProcessWizard.getRedirectUrl(), newProcessWizard.getJobTemplates());
            refreshJobEditorTitle(item);
        }
    }
}
Also used : IWorkbenchPartSite(org.eclipse.ui.IWorkbenchPartSite) WSTransformerV2Item(org.talend.mdm.repository.model.mdmproperties.WSTransformerV2Item) ProcessItem(org.talend.core.model.properties.ProcessItem) Item(org.talend.core.model.properties.Item) ContainerItem(org.talend.mdm.repository.model.mdmproperties.ContainerItem) ContainerItem(org.talend.mdm.repository.model.mdmproperties.ContainerItem) WSTransformerV2E(org.talend.mdm.repository.model.mdmserverobject.WSTransformerV2E) IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) NewProcessWizard(org.talend.mdm.repository.ui.wizards.process.NewProcessWizard) WizardDialog(org.eclipse.jface.wizard.WizardDialog)

Example 3 with ContainerItem

use of org.talend.mdm.repository.model.mdmproperties.ContainerItem in project tmdm-studio-se by Talend.

the class RepositoryViewFilterDialog method updateForEventManager.

private void updateForEventManager(Set<String> values) {
    ERepositoryObjectType[] types = new ERepositoryObjectType[] { IServerObjectRepositoryType.TYPE_TRANSFORMERV2, IServerObjectRepositoryType.TYPE_ROUTINGRULE };
    for (ERepositoryObjectType type : types) {
        IRepositoryNodeConfiguration conf = RepositoryNodeConfigurationManager.getConfiguration(type);
        IRepositoryViewObject viewObject = RepositoryResourceUtil.getCategoryViewObject(conf);
        if (viewObject != null) {
            ContainerItem item = (ContainerItem) viewObject.getProperty().getItem();
            values.add(item.getLabel());
        }
    }
}
Also used : ContainerItem(org.talend.mdm.repository.model.mdmproperties.ContainerItem) IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) IRepositoryNodeConfiguration(org.talend.mdm.repository.core.IRepositoryNodeConfiguration) ERepositoryObjectType(org.talend.core.model.repository.ERepositoryObjectType)

Example 4 with ContainerItem

use of org.talend.mdm.repository.model.mdmproperties.ContainerItem in project tmdm-studio-se by Talend.

the class NewDataModelAction method createDataContainerObject.

protected void createDataContainerObject(final String key) {
    if (!RepositoryResourceUtil.isExistByName(IServerObjectRepositoryType.TYPE_DATACLUSTER, key)) {
        NewDataContainerAction newDataContainerAction = new NewDataContainerAction() {

            @Override
            protected String getInputName() {
                return key;
            }

            @Override
            protected void updateParentItem() {
                IRepositoryViewObject folderViewObj = ContainerCacheService.get(IServerObjectRepositoryType.TYPE_DATACLUSTER, // $NON-NLS-1$
                "");
                if (folderViewObj != null) {
                    Item pItem = folderViewObj.getProperty().getItem();
                    setParentItem((ContainerItem) pItem);
                }
            }
        };
        newDataContainerAction.run();
    }
}
Also used : WSDataModelItem(org.talend.mdm.repository.model.mdmproperties.WSDataModelItem) Item(org.talend.core.model.properties.Item) ContainerItem(org.talend.mdm.repository.model.mdmproperties.ContainerItem) NewDataContainerAction(org.talend.mdm.repository.ui.actions.datacontainer.NewDataContainerAction) IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject)

Example 5 with ContainerItem

use of org.talend.mdm.repository.model.mdmproperties.ContainerItem in project tmdm-studio-se by Talend.

the class NewDataModelAction method run.

public void run(IIntroSite site, Properties params) {
    IProxyRepositoryFactory factory = ProxyRepositoryFactory.getInstance();
    if (factory.isUserReadOnlyOnCurrentProject()) {
        MessageDialog.openWarning(null, Messages.NewDataModelAction_UserAuthority, Messages.NewDataModelAction_CanNotCreateModel);
    } else {
        PlatformUI.getWorkbench().getIntroManager().closeIntro(PlatformUI.getWorkbench().getIntroManager().getIntro());
        IWorkbenchWindow workbenchWindow = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
        if (null == workbenchWindow) {
            return;
        }
        IWorkbenchPage workbenchPage = workbenchWindow.getActivePage();
        if (null == workbenchPage) {
            return;
        }
        IPerspectiveDescriptor currentPerspective = workbenchPage.getPerspective();
        if (!IBrandingConfiguration.PERSPECTIVE_MDM_ID.equals(currentPerspective.getId())) {
            // show mdm perspective
            try {
                workbenchWindow.getWorkbench().showPerspective(IBrandingConfiguration.PERSPECTIVE_MDM_ID, workbenchWindow);
                workbenchPage = workbenchWindow.getActivePage();
            } catch (WorkbenchException e) {
                ExceptionHandler.process(e);
                return;
            }
        }
        // 
        // $NON-NLS-1$
        IRepositoryViewObject folderViewObj = ContainerCacheService.get(IServerObjectRepositoryType.TYPE_DATAMODEL, "");
        selectObj = folderViewObj;
        if (folderViewObj != null && folderViewObj instanceof FolderRepositoryObject) {
            Item pItem = folderViewObj.getProperty().getItem();
            if (pItem instanceof ContainerItem) {
                setParentItem((ContainerItem) pItem);
            }
        }
        run();
    }
}
Also used : IWorkbenchWindow(org.eclipse.ui.IWorkbenchWindow) WSDataModelItem(org.talend.mdm.repository.model.mdmproperties.WSDataModelItem) Item(org.talend.core.model.properties.Item) ContainerItem(org.talend.mdm.repository.model.mdmproperties.ContainerItem) ContainerItem(org.talend.mdm.repository.model.mdmproperties.ContainerItem) IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) IWorkbenchPage(org.eclipse.ui.IWorkbenchPage) IPerspectiveDescriptor(org.eclipse.ui.IPerspectiveDescriptor) WorkbenchException(org.eclipse.ui.WorkbenchException) IProxyRepositoryFactory(org.talend.repository.model.IProxyRepositoryFactory) FolderRepositoryObject(org.talend.mdm.repository.models.FolderRepositoryObject)

Aggregations

ContainerItem (org.talend.mdm.repository.model.mdmproperties.ContainerItem)46 Item (org.talend.core.model.properties.Item)28 IRepositoryViewObject (org.talend.core.model.repository.IRepositoryViewObject)24 ItemState (org.talend.core.model.properties.ItemState)18 ERepositoryObjectType (org.talend.core.model.repository.ERepositoryObjectType)16 Test (org.junit.Test)15 PrepareForTest (org.powermock.core.classloader.annotations.PrepareForTest)15 MDMServerObjectItem (org.talend.mdm.repository.model.mdmproperties.MDMServerObjectItem)11 FolderRepositoryObject (org.talend.mdm.repository.models.FolderRepositoryObject)11 Property (org.talend.core.model.properties.Property)10 ImageDescriptor (org.eclipse.jface.resource.ImageDescriptor)9 Resource (org.eclipse.emf.ecore.resource.Resource)8 ResourceSet (org.eclipse.emf.ecore.resource.ResourceSet)8 AbstractSimpleAddActionTest (org.talend.mdm.repository.ui.actions.AbstractSimpleAddActionTest)8 FolderType (org.talend.core.model.properties.FolderType)6 FolderItem (org.talend.core.model.properties.FolderItem)5 Path (org.eclipse.core.runtime.Path)4 PersistenceException (org.talend.commons.exception.PersistenceException)4 WSDataModelItem (org.talend.mdm.repository.model.mdmproperties.WSDataModelItem)4 MDMServerObject (org.talend.mdm.repository.model.mdmserverobject.MDMServerObject)4