use of org.talend.repository.model.IProxyRepositoryFactory in project tdi-studio-se by Talend.
the class SimpleBusinessCreationWizard method performFinish.
public boolean performFinish() {
IProxyRepositoryFactory repositoryFactory = ProxyRepositoryFactory.getInstance();
String nextId = repositoryFactory.getNextId();
property.setId(nextId);
//changed by hqzhang for TDI-19527, label=displayName
property.setLabel(property.getDisplayName());
DiagramResourceManager diagramResourceManager = new DiagramResourceManager(getWorkbench().getActiveWorkbenchWindow().getActivePage(), new NullProgressMonitor());
IFile file = diagramResourceManager.createDiagramFile();
diagramResourceManager.updateFromResource(businessProcessItem, file);
try {
repositoryFactory.create(businessProcessItem, mainPage.getDestinationPath());
} catch (PersistenceException e1) {
throw new IllegalStateException(e1);
}
diagramResourceManager.openEditor(businessProcessItem, file, false);
return true;
}
use of org.talend.repository.model.IProxyRepositoryFactory in project tdi-studio-se by Talend.
the class BusinessDiagramEditor method dispose.
@Override
public void dispose() {
getSite().setSelectionProvider(null);
getSite().getWorkbenchWindow().getSelectionService().removeSelectionListener(this);
super.dispose();
if (isKeepPropertyLocked()) {
return;
}
// Unlock the process :
IProxyRepositoryFactory repFactory = ProxyRepositoryFactory.getInstance();
try {
// Property property = repFactory.reload(repositoryEditorInput.getItem().getProperty());
Property property = repFactory.getUptodateProperty(repositoryEditorInput.getItem().getProperty());
repositoryEditorInput.setItem(property.getItem());
repFactory.unlock(repositoryEditorInput.getItem());
} catch (PersistenceException e) {
ExceptionHandler.process(e);
} catch (LoginException e) {
ExceptionHandler.process(e);
}
RepositoryNode repositoryNode = repositoryEditorInput.getRepositoryNode();
if (repositoryNode == null) {
// retrieve the node.
repositoryEditorInput.setRepositoryNode(null);
repositoryNode = repositoryEditorInput.getRepositoryNode();
}
// if (repositoryNode != null) {
// if (repFactory.getStatus(repositoryEditorInput.getItem()) == ERepositoryStatus.DELETED) {
// RepositoryManager.refreshDeletedNode(null);
// } else {
// RepositoryManager.refreshSavedNode(repositoryNode);
// }
// }
}
use of org.talend.repository.model.IProxyRepositoryFactory in project tdi-studio-se by Talend.
the class BusinessDiagramEditor method doSave.
@Override
public void doSave(IProgressMonitor progressMonitor) {
if (repositoryEditorInput != null) {
final BusinessProcessItem businessProcessItem = (BusinessProcessItem) repositoryEditorInput.getItem();
IRepositoryService service = CorePlugin.getDefault().getRepositoryService();
IProxyRepositoryFactory repFactory = service.getProxyRepositoryFactory();
try {
repFactory.updateLockStatus();
// For TDI-23825, if not lock by user try to lock again.
boolean locked = repFactory.getStatus(businessProcessItem) == ERepositoryStatus.LOCK_BY_USER;
if (!locked) {
repFactory.lock(businessProcessItem);
}
} catch (Exception e) {
ExceptionHandler.process(e);
}
ERepositoryStatus status = repFactory.getStatus(businessProcessItem);
if (!status.equals(ERepositoryStatus.LOCK_BY_USER) && !repFactory.getRepositoryContext().isEditableAsReadOnly()) {
MessageDialog.openWarning(getEditorSite().getShell(), //$NON-NLS-1$
Messages.getString("BusinessDiagramEditor.canNotSaveTitle"), //$NON-NLS-1$
Messages.getString("BusinessDiagramEditor.canNotSaveMessage"));
return;
}
super.doSave(progressMonitor);
DiagramResourceManager diagramResourceManager = new DiagramResourceManager();
diagramResourceManager.updateFromResource(businessProcessItem, repositoryEditorInput.getFile());
final IProxyRepositoryFactory factory = service.getProxyRepositoryFactory();
RepositoryWorkUnit rwu = new RepositoryWorkUnit("save Business") {
@Override
protected void run() throws LoginException, PersistenceException {
ProxyRepositoryFactory.getInstance().save(businessProcessItem);
}
};
rwu.setAvoidUnloadResources(true);
rwu.setAvoidSvnUpdate(true);
factory.executeRepositoryWorkUnit(rwu);
propertyIsDirty = false;
firePropertyChange(IEditorPart.PROP_DIRTY);
}
}
use of org.talend.repository.model.IProxyRepositoryFactory in project tmdm-studio-se by Talend.
the class DeployOnMDMExportWizardPage method getExportResources.
/**
* Returns resources to be exported. This returns file - for just the files use getSelectedResources.
*
* @return a collection of resources currently selected for export (element type: <code>IResource</code>)
* @throws ProcessorException
*/
protected List<ExportFileResource> getExportResources(ExportFileResource p) throws ProcessorException {
Item item = p.getItem();
Resource eResource = item.eResource();
Property property = item.getProperty();
if (eResource == null && property != null) {
IProxyRepositoryFactory factory = CoreRuntimePlugin.getInstance().getProxyRepositoryFactory();
try {
IRepositoryViewObject newViewObj = factory.getLastVersion(property.getId());
Item newItem = newViewObj.getProperty().getItem();
p.setProcess((ProcessItem) newItem);
} catch (PersistenceException e) {
log.error(e.getMessage(), e);
}
}
return manager.getExportResources(new ExportFileResource[] { p });
}
use of org.talend.repository.model.IProxyRepositoryFactory in project tmdm-studio-se by Talend.
the class DeployOnMDMAction method doRun.
@Override
protected void doRun() {
List<IRepositoryViewObject> viewObjs = getSelectedViewObject();
DeployOnMDMExportWizard publishWizard = new DeployOnMDMExportWizard();
publishWizard.setWindowTitle(EXPORTJOBSCRIPTS);
publishWizard.init(getWorkbench(), (IStructuredSelection) this.getSelection());
Shell activeShell = Display.getCurrent().getActiveShell();
WizardDialog dialog = new WizardDialog(activeShell, publishWizard);
dialog.open();
boolean deploySucceed = publishWizard.isDeploySucceed();
if (deploySucceed) {
IRemoveCommandService service = (IRemoveCommandService) GlobalServiceRegister.getDefault().getService(IRemoveCommandService.class);
SpagoBiServer spagoBiServer = publishWizard.getMdmServer();
MDMServerDef mdmServer = getMdmServer(spagoBiServer);
IProxyRepositoryFactory factory = CoreRuntimePlugin.getInstance().getProxyRepositoryFactory();
try {
for (IRepositoryViewObject viewObj : viewObjs) {
Item item = viewObj.getProperty().getItem();
Property property = item.getProperty();
if (property != null) {
boolean eDeliver = property.eDeliver();
property.eSetDeliver(false);
property.getAdditionalProperties().put(PROP_LAST_SERVER_DEF, mdmServer.getName());
factory.save(item);
property.eSetDeliver(eDeliver);
}
refreshMdmRepositoryViewTree();
service.removeDeployPhaseCommandOf(ERepositoryObjectType.PROCESS, item);
}
} catch (PersistenceException e) {
log.error(e.getMessage(), e);
}
}
}
Aggregations