use of org.talend.mdm.repository.core.service.IInteractiveHandler in project tmdm-studio-se by Talend.
the class DefaultDeployCommand method doExecute.
private IStatus doExecute(Object params, IProgressMonitor monitor) {
ERepositoryObjectType type = getViewObjectType();
String objectName = getLabel();
IInteractiveHandler handler = InteractiveService.findHandler(type);
if (handler != null) {
String typeLabel = handler.getLabel();
monitor.subTask(Messages.bind(Messages.Deploy_text, typeLabel));
try {
boolean isOK = handler.deploy(this);
if (getDeployStatus() != null) {
return getDeployStatus();
}
if (isOK) {
if (getCommandType() == CMD_MODIFY) {
return DeployStatus.getOKStatus(this, Messages.bind(Messages.Deploy_successfully_text, typeLabel, objectName));
}
return DeployStatus.getOKStatus(this, Messages.bind(Messages.Create_successfully_text, typeLabel, objectName));
} else {
return DeployStatus.getErrorStatus(this, Messages.bind(Messages.Deploy_fail_text, typeLabel, objectName));
}
} catch (OperationIgnoredException e) {
return null;
} catch (OperationCanceledException e) {
return DeployStatus.getInfoStatus(this, Messages.bind(Messages.Deploy_cancel_text, typeLabel, objectName));
} catch (WebServiceException e) {
return getDetailErrorMsg(Messages.Deploy_fail_cause_text, typeLabel, objectName, e);
} catch (XtentisException e) {
return getDetailErrorMsg(Messages.Deploy_fail_cause_text, typeLabel, objectName, e);
} catch (RuntimeException e) {
return getDetailErrorMsg(Messages.Deploy_fail_cause_text, typeLabel, objectName, e);
}
} else {
return DeployStatus.getErrorStatus(this, Messages.bind(Messages.Deploy_notSupport_text, objectName));
}
}
use of org.talend.mdm.repository.core.service.IInteractiveHandler in project tmdm-studio-se by Talend.
the class DeployStatusDialog method initMultiStatus.
@Override
protected IStatus initMultiStatus(IStatus multiStatus) {
IStatus[] children = multiStatus.getChildren();
Map<ERepositoryObjectType, List<IStatus>> map = new HashMap<ERepositoryObjectType, List<IStatus>>();
for (IStatus status : children) {
collectTypeStatus(map, status);
}
// $NON-NLS-1$
MultiStatus retStatus = new MultiStatus(RepositoryPlugin.PLUGIN_ID, Status.OK, "", null);
for (Entry<ERepositoryObjectType, List<IStatus>> entry : map.entrySet()) {
ERepositoryObjectType key = entry.getKey();
IInteractiveHandler handler = InteractiveService.findHandler(key);
if (handler != null) {
MultiStatus submultiStatus = new DeployCategoryStatus(RepositoryPlugin.PLUGIN_ID, Status.OK, Messages.bind(Messages.MultiStatusDialog_MultiStatus_Messages, key.getLabel()), null);
for (IStatus status : entry.getValue()) {
if (isShown(handler, status)) {
submultiStatus.add(status);
}
}
if (submultiStatus.getChildren().length > 0) {
retStatus.add(submultiStatus);
}
}
}
isShowWarningMsg = map.containsKey(IServerObjectRepositoryType.TYPE_VIEW) && (!map.containsKey(IServerObjectRepositoryType.TYPE_DATAMODEL));
map.clear();
return retStatus;
}
use of org.talend.mdm.repository.core.service.IInteractiveHandler in project tmdm-studio-se by Talend.
the class UndeployAction method getSelectedRepositoryViewObject.
protected List<IRepositoryViewObject> getSelectedRepositoryViewObject() {
List<IRepositoryViewObject> viewObjs = new LinkedList<IRepositoryViewObject>();
for (Object obj : getSelectedObject()) {
if (obj instanceof IRepositoryViewObject) {
IRepositoryViewObject viewObject = (IRepositoryViewObject) obj;
ERepositoryObjectType type = viewObject.getRepositoryObjectType();
if (type != null) {
IInteractiveHandler handler = InteractiveService.findHandler(type);
if (handler != null) {
List<IRepositoryViewObject> associatedObjects = handler.getAssociatedObjects(viewObject);
if (associatedObjects != null) {
for (IRepositoryViewObject associatedObj : associatedObjects) {
viewObjs.add(associatedObj);
}
}
}
}
viewObjs.add(viewObject);
}
}
return viewObjs;
}
use of org.talend.mdm.repository.core.service.IInteractiveHandler in project tmdm-studio-se by Talend.
the class RepositoryResourceUtil method findAllViewObjects.
public static List<IRepositoryViewObject> findAllViewObjects(ERepositoryObjectType type, boolean useRepositoryViewObject, boolean withDeleted) {
IProxyRepositoryFactory factory = CoreRuntimePlugin.getInstance().getProxyRepositoryFactory();
try {
List<IRepositoryViewObject> allObjs = factory.getAll(type, withDeleted);
List<IRepositoryViewObject> viewObjects = new LinkedList<IRepositoryViewObject>();
for (IRepositoryViewObject viewObj : allObjs) {
viewObj = assertViewObject(viewObj);
Item item = viewObj.getProperty().getItem();
ItemState state = item.getState();
if (!state.isDeleted() || withDeleted) {
try {
IInteractiveHandler handler = InteractiveService.findHandler(viewObj.getRepositoryObjectType());
if (handler != null) {
handler.assertPropertyIsInited(item);
}
if (useRepositoryViewObject) {
IRepositoryViewObject cacheViewObj = getCacheViewObject(viewObj.getProperty(), viewObj);
viewObjects.add(cacheViewObj);
} else {
viewObjects.add(viewObj);
}
} catch (Exception e) {
log.error(e.getMessage(), e);
}
}
}
return viewObjects;
} catch (PersistenceException e) {
log.error(e.getMessage(), e);
}
return null;
}
use of org.talend.mdm.repository.core.service.IInteractiveHandler in project tmdm-studio-se by Talend.
the class BatchDeployJobCommand method execute.
@Override
public IStatus execute(Object params, IProgressMonitor monitor) {
IStatus status = super.execute(params, monitor);
//
MultiStatus ms = new MultiStatus(RepositoryPlugin.PLUGIN_ID, status.getSeverity(), Messages.BatchDeployJobCommand_deployJob, null);
IInteractiveHandler handler = InteractiveService.findHandler(getViewObjectType());
String typeLabel = handler.getLabel();
if (status.isOK()) {
runDeleteCmds(params, monitor, ms);
}
collectDeployStatus(status, ms, typeLabel);
return ms;
}
Aggregations