Search in sources :

Example 1 with LockedObjectDialog

use of org.talend.mdm.repository.ui.dialogs.lock.LockedObjectDialog in project tmdm-studio-se by Talend.

the class ImportServerObjectWizard method showLockedObjDialog.

private boolean showLockedObjDialog(Object[] objs) {
    if (objs == null) {
        return true;
    }
    List<IRepositoryViewObject> viewObjs = new LinkedList<IRepositoryViewObject>();
    boolean forceContinueResetOperation = false;
    Map<IRepositoryViewObject, TreeObject> objMap = new HashMap<IRepositoryViewObject, TreeObject>();
    for (Object obj : objs) {
        TreeObject treeObj = (TreeObject) obj;
        if (treeObj != null && treeObj instanceof TreeParent) {
            continue;
        }
        String treeObjName = treeObj.getName();
        ERepositoryObjectType type = RepositoryQueryService.getRepositoryObjectType(treeObj.getType());
        if (type != null && treeObjName != null) {
            String uniqueName = getUniqueName(treeObj, treeObjName);
            IRepositoryViewObject viewObject = RepositoryResourceUtil.findViewObjectByName(type, uniqueName);
            if (viewObject != null) {
                viewObjs.add(viewObject);
                objMap.put(viewObject, treeObj);
            } else {
                // not exist in local
                forceContinueResetOperation = true;
            }
        }
    }
    LockedObjectDialog lockDialog = new LockedObjectDialog(getShell(), Messages.ImportServerObjectWizard_lockedObjectMessage, Messages.ImportServerObjectWizard_cancelImportingObjectMessage, viewObjs, forceContinueResetOperation);
    if (lockDialog.needShowDialog()) {
        int open = lockDialog.open();
        if (open == IDialogConstants.OK_ID) {
            if (lockDialog.canContinueRestOperation()) {
                selectedObjects = lockDialog.getUnlockedTreeObject(selectedObjects, objMap);
                return true;
            }
        }
        return false;
    }
    return true;
}
Also used : LockedObjectDialog(org.talend.mdm.repository.ui.dialogs.lock.LockedObjectDialog) HashMap(java.util.HashMap) TreeParent(com.amalto.workbench.models.TreeParent) LinkedList(java.util.LinkedList) IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) TreeObject(com.amalto.workbench.models.TreeObject) MDMServerObject(org.talend.mdm.repository.model.mdmserverobject.MDMServerObject) IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) TreeObject(com.amalto.workbench.models.TreeObject) ERepositoryObjectType(org.talend.core.model.repository.ERepositoryObjectType)

Aggregations

TreeObject (com.amalto.workbench.models.TreeObject)1 TreeParent (com.amalto.workbench.models.TreeParent)1 HashMap (java.util.HashMap)1 LinkedList (java.util.LinkedList)1 ERepositoryObjectType (org.talend.core.model.repository.ERepositoryObjectType)1 IRepositoryViewObject (org.talend.core.model.repository.IRepositoryViewObject)1 MDMServerObject (org.talend.mdm.repository.model.mdmserverobject.MDMServerObject)1 LockedObjectDialog (org.talend.mdm.repository.ui.dialogs.lock.LockedObjectDialog)1