use of org.talend.mdm.repository.model.mdmproperties.MDMServerObjectItem in project tmdm-studio-se by Talend.
the class AbstractNodeCheckTreeViewer method isExist.
private boolean isExist(TreeObject treeObj) {
if (treeObj instanceof TreeParent) {
return false;
}
int type = treeObj.getType();
ERepositoryObjectType rType = RepositoryQueryService.getRepositoryObjectType(type);
if (rType == null) {
return false;
}
List<IRepositoryViewObject> children = RepositoryResourceUtil.findAllViewObjectsWithDeleted(rType);
if (children == null) {
return false;
}
String treeObjName = treeObj.getName();
if (type == TreeObject.PICTURES_RESOURCE) {
// $NON-NLS-1$
int index = treeObjName.indexOf("-");
if (index > 0) {
treeObjName = treeObjName.substring(index + 1);
}
}
for (IRepositoryViewObject viewObject : children) {
Item item = viewObject.getProperty().getItem();
if (item instanceof MDMServerObjectItem) {
MDMServerObject serverObj = ((MDMServerObjectItem) item).getMDMServerObject();
String name = serverObj.getName();
if (type == TreeObject.WORKFLOW_PROCESS) {
// $NON-NLS-1$
name = name + "_" + viewObject.getVersion();
}
if (type == TreeObject.PICTURES_RESOURCE) {
// $NON-NLS-1$ //$NON-NLS-2$
name = name + "_" + viewObject.getVersion() + "." + ((WSResourceE) serverObj).getFileExtension();
}
if (serverObj != null && treeObjName.equals(name)) {
return true;
}
}
}
return false;
}
use of org.talend.mdm.repository.model.mdmproperties.MDMServerObjectItem in project tmdm-studio-se by Talend.
the class RepositoryQueryService method findAllWorkflowNames.
public static List<String> findAllWorkflowNames() {
List<IRepositoryViewObject> viewObjects = RepositoryResourceUtil.findAllViewObjects(IServerObjectRepositoryType.TYPE_WORKFLOW);
List<String> names = new LinkedList<String>();
if (viewObjects != null) {
for (IRepositoryViewObject viewObj : viewObjects) {
Item item = viewObj.getProperty().getItem();
if (item instanceof MDMServerObjectItem) {
MDMServerObjectItem serverItem = (MDMServerObjectItem) item;
// $NON-NLS-1$
names.add(serverItem.getMDMServerObject().getName() + "_" + item.getProperty().getVersion());
}
// names[i]=viewObj.getLabel();
}
}
return names;
}
use of org.talend.mdm.repository.model.mdmproperties.MDMServerObjectItem in project tmdm-studio-se by Talend.
the class RepositoryQueryService method findAllServerObjectNames.
private static List<String> findAllServerObjectNames(ERepositoryObjectType type) {
List<IRepositoryViewObject> viewObjects = RepositoryResourceUtil.findAllViewObjects(type);
List<String> names = new LinkedList<String>();
if (viewObjects != null) {
for (IRepositoryViewObject viewObj : viewObjects) {
Item item = viewObj.getProperty().getItem();
if (item instanceof MDMServerObjectItem) {
String name = ((MDMServerObjectItem) item).getMDMServerObject().getName();
if (name != null) {
names.add(name);
} else {
names.add(viewObj.getLabel());
}
}
// names[i]=viewObj.getLabel();
}
}
return names;
}
use of org.talend.mdm.repository.model.mdmproperties.MDMServerObjectItem in project tmdm-studio-se by Talend.
the class RepositoryQueryService method findAllCustomFormPks.
public static List<String> findAllCustomFormPks() {
List<IRepositoryViewObject> viewObjects = RepositoryResourceUtil.findAllViewObjects(IServerObjectRepositoryType.TYPE_CUSTOM_FORM);
List<String> names = new LinkedList<String>();
if (viewObjects != null) {
for (IRepositoryViewObject viewObj : viewObjects) {
Item item = viewObj.getProperty().getItem();
if (item instanceof MDMServerObjectItem) {
MDMServerObject sObject = ((MDMServerObjectItem) item).getMDMServerObject();
if (sObject instanceof WSCustomFormE) {
WSCustomFormE sForm = (WSCustomFormE) sObject;
String name = sForm.getDatamodel() + IConstants.ITEM_PK_SPLIT + sForm.getEntity() + IConstants.ITEM_PK_SPLIT + sForm.getName();
if (name != null) {
names.add(name);
} else {
names.add(viewObj.getLabel());
}
}
}
// names[i]=viewObj.getLabel();
}
}
return names;
}
use of org.talend.mdm.repository.model.mdmproperties.MDMServerObjectItem in project tmdm-studio-se by Talend.
the class OpenObjectAction method openItem.
private void openItem(IRepositoryViewObject viewObject) {
Item item = viewObject.getProperty().getItem();
item = RepositoryResourceUtil.assertItem(item);
IRepositoryNodeConfiguration configuration = RepositoryNodeConfigurationManager.getConfiguration(item);
if (configuration != null) {
IRepositoryNodeActionProvider actionProvider = configuration.getActionProvider();
if (actionProvider != null) {
IRepositoryViewEditorInput editorInput = actionProvider.getOpenEditorInput(viewObject);
if (editorInput != null) {
if (page == null) {
this.page = getCommonViewer().getCommonNavigator().getSite().getWorkbenchWindow().getActivePage();
}
// do extra action
MDMServerObject serverObject = ((MDMServerObjectItem) item).getMDMServerObject();
if (!checkMissingJar(serverObject)) {
return;
}
boolean selected = doSelectServer(item, editorInput);
if (!selected) {
return;
}
try {
// svn lock
ERepositoryStatus status = factory.getStatus(item);
boolean isEditable = factory.isEditableAndLockIfPossible(item);
if (isEditable) {
getCommonViewer().refresh(viewObject);
}
//
editorInput.setReadOnly(status == ERepositoryStatus.LOCK_BY_OTHER || status == ERepositoryStatus.READ_ONLY || !isEditable);
if (!editorInput.isReadOnly()) {
editorInput.setReadOnly(item.getState().isDeleted());
}
updateEditorInputVersionInfo(editorInput, viewObject);
activeEditor = this.page.openEditor(editorInput, editorInput.getEditorId());
if (marker != null) {
IDE.gotoMarker(activeEditor, marker);
}
} catch (PartInitException e) {
log.error(e.getMessage(), e);
}
} else {
AbstractRepositoryAction openAction = actionProvider.getOpenAction(viewObject);
if (openAction != null) {
openAction.selectionChanged(getStructuredSelection());
openAction.run();
}
}
}
}
}
Aggregations