use of org.talend.repository.model.IProxyRepositoryFactory in project tmdm-studio-se by Talend.
the class RenameProcessAction method moveToOtherTypeNode.
public void moveToOtherTypeNode(IRepositoryViewObject parent, IRepositoryViewObject viewObj) {
MDMServerObjectItem item = (MDMServerObjectItem) viewObj.getProperty().getItem();
waitSomeTime(viewObj);
IProxyRepositoryFactory factory = getFactory();
try {
if (factory.isEditableAndLockIfPossible(item)) {
String path = item.getState().getPath();
IPath ipath = new Path(path);
factory.moveObject(viewObj, ipath);
IRepositoryViewObject iRepositoryViewObject = ContainerCacheService.get(viewObj.getRepositoryObjectType(), path);
commonViewer.refresh(parent);
commonViewer.refresh(iRepositoryViewObject);
}
} catch (PersistenceException e) {
log.error(e.getMessage(), e);
} catch (BusinessException e) {
log.error(e.getMessage(), e);
} finally {
try {
factory.unlock(item);
} catch (PersistenceException e) {
log.error(e.getMessage(), e);
} catch (LoginException e) {
log.error(e.getMessage(), e);
}
}
}
use of org.talend.repository.model.IProxyRepositoryFactory in project tmdm-studio-se by Talend.
the class MDMEditViewProcessPropertyAction method moveToOtherTypeNode.
private void moveToOtherTypeNode(IRepositoryViewObject viewObj, String oldPath, String newPath) {
MDMServerObjectItem item = (MDMServerObjectItem) viewObj.getProperty().getItem();
item.getState().setPath(newPath);
waitSomeTime(viewObj);
IProxyRepositoryFactory factory = getFactory();
try {
if (factory.isEditableAndLockIfPossible(item)) {
IPath ipath = new Path(newPath);
factory.moveObject(viewObj, ipath);
ERepositoryObjectType type = viewObj.getRepositoryObjectType();
refreshTree(type, oldPath);
refreshTree(type, newPath);
}
} catch (PersistenceException e) {
log.error(e.getMessage(), e);
} catch (BusinessException e) {
log.error(e.getMessage(), e);
} finally {
unlockItem(item);
}
}
use of org.talend.repository.model.IProxyRepositoryFactory 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();
}
}
use of org.talend.repository.model.IProxyRepositoryFactory in project tmdm-studio-se by Talend.
the class RepositoryResourceUtil method removeViewObjectPhysically.
public static void removeViewObjectPhysically(ERepositoryObjectType type, String name, String version, String path) {
if (type == null || name == null) {
throw new IllegalArgumentException();
}
if (version == null) {
version = VersionUtils.DEFAULT_VERSION;
}
if (path == null) {
// $NON-NLS-1$
path = "";
}
try {
IProxyRepositoryFactory factory = CoreRuntimePlugin.getInstance().getProxyRepositoryFactory();
for (IRepositoryViewObject viewObj : factory.getAll(type)) {
Property property = viewObj.getProperty();
String itemPath = property.getItem().getState().getPath();
if (itemPath.equals(path) && property.getLabel().equals(name) && property.getVersion().equals(version)) {
factory.deleteObjectPhysical(viewObj, version);
return;
}
}
} catch (PersistenceException e) {
log.error(e.getMessage(), e);
}
}
use of org.talend.repository.model.IProxyRepositoryFactory in project tmdm-studio-se by Talend.
the class RepositoryResourceUtil method isLockedAndEdited.
public static boolean isLockedAndEdited(IRepositoryViewObject viewObj) {
IProxyRepositoryFactory factory = CoreRuntimePlugin.getInstance().getProxyRepositoryFactory();
ERepositoryStatus status = factory.getStatus(viewObj);
if (status == ERepositoryStatus.LOCK_BY_OTHER) {
return true;
} else if (status == ERepositoryStatus.LOCK_BY_USER) {
IEditorReference openRef = RepositoryResourceUtil.isOpenedInEditor(viewObj);
return openRef != null;
}
return false;
}
Aggregations