use of org.talend.commons.exception.PersistenceException in project tdi-studio-se by Talend.
the class JavaJobScriptsExportWSWizardPage method restoreWidgetValuesForESB.
protected void restoreWidgetValuesForESB() {
IDialogSettings settings = getDialogSettings();
if (settings != null) {
String[] directoryNames = settings.getArray(STORE_DESTINATION_NAMES_ID);
if (directoryNames != null && directoryNames.length > 0) {
String fileName = getDefaultFileNameWithType();
// destination
for (int i = 0; i < directoryNames.length; i++) {
if (directoryNames[i].toLowerCase().endsWith(FileConstants.ESB_FILE_SUFFIX)) {
//$NON-NLS-1$
directoryNames[i] = (directoryNames[i].charAt(0) + "").toUpperCase() + directoryNames[i].substring(1);
addDestinationItem(directoryNames[i]);
}
}
File dest = new File(new File(directoryNames[0]).getParentFile(), fileName);
setDestinationValue(dest.getAbsolutePath());
} else {
setDefaultDestination();
}
IDialogSettings section = getDialogSettings().getSection(DESTINATION_FILE);
if (section == null) {
section = getDialogSettings().addNewSection(DESTINATION_FILE);
}
if (jobScriptButton != null && !jobScriptButton.isDisposed()) {
jobScriptButton.setSelection(settings.getBoolean(STORE_SOURCE_ID));
}
if (contextButton != null && !contextButton.isDisposed()) {
contextButton.setSelection(settings.getBoolean(STORE_CONTEXT_ID));
}
if (applyToChildrenButton != null && !applyToChildrenButton.isDisposed()) {
applyToChildrenButton.setSelection(settings.getBoolean(APPLY_TO_CHILDREN_ID));
}
if (jobItemButton != null && !jobItemButton.isDisposed()) {
jobItemButton.setSelection(settings.getBoolean(STORE_JOB_ID));
}
if (section.get(ESB_EXPORT_TYPE) != null) {
esbTypeCombo.setText(section.get(ESB_EXPORT_TYPE));
if (section.get(ESB_SERVICE_NAME) != null) {
esbServiceName.setText(section.get(ESB_SERVICE_NAME));
}
if (section.get(ESB_CATEGORY) != null) {
esbCategory.setText(section.get(ESB_CATEGORY));
}
if (section.get(QUERY_MESSAGE_NAME) != null) {
esbQueueMessageName.setText(section.get(QUERY_MESSAGE_NAME));
}
}
}
if (getProcessItem() != null && contextCombo != null) {
try {
setProcessItem((ProcessItem) ProxyRepositoryFactory.getInstance().getUptodateProperty(getProcessItem().getProperty()).getItem());
} catch (PersistenceException e) {
e.printStackTrace();
}
List<String> contextNames = ExportJobUtil.getJobContexts(getProcessItem());
contextCombo.setItems(contextNames.toArray(new String[contextNames.size()]));
if (contextNames.size() > 0) {
contextCombo.select(0);
}
}
}
use of org.talend.commons.exception.PersistenceException in project tdi-studio-se by Talend.
the class PurposeStatusSection method setInput.
@Override
public void setInput(IWorkbenchPart part, ISelection selection) {
super.setInput(part, selection);
try {
Property property = getObject().getProperty();
List<Status> status = property == null ? new ArrayList<Status>() : statusHelper.getStatusList(property);
statusText.setItems(toArray(status));
} catch (PersistenceException e) {
// e.printStackTrace();
ExceptionHandler.process(e);
}
}
use of org.talend.commons.exception.PersistenceException in project tdi-studio-se by Talend.
the class Log4jPrefsSettingManager method isLog4jPrefsExist.
public boolean isLog4jPrefsExist() {
try {
IProject project = ResourceUtils.getProject(ProjectManager.getInstance().getCurrentProject());
IFolder prefSettingFolder = ResourceUtils.getFolder(project, RepositoryConstants.SETTING_DIRECTORY, false);
IFile presLog4jFile = prefSettingFolder.getFile(Log4jPrefsConstants.LOG4J_RESOURCES + Log4jPrefsConstants.LOG4j_PREFS_SUFFIX);
if (presLog4jFile.exists()) {
return true;
}
} catch (PersistenceException e) {
e.printStackTrace();
}
return false;
}
use of org.talend.commons.exception.PersistenceException in project tdi-studio-se by Talend.
the class SpagicDeployWizardPage method finish.
/**
* The Finish button was pressed. Try to do the required work now and answer a boolean indicating success. If false
* is returned then the wizard will not close.
*
* @returns boolean
*/
@Override
public boolean finish() {
Map<ExportChoice, Object> exportChoiceMap = getExportChoiceMap();
boolean canExport = false;
for (ExportChoice choice : ExportChoice.values()) {
if (exportChoiceMap.get(choice) != null && exportChoiceMap.get(choice) instanceof Boolean && (Boolean) exportChoiceMap.get(choice)) {
canExport = true;
break;
}
}
if (!canExport) {
MessageDialog.openInformation(getContainer().getShell(), //$NON-NLS-1$
Messages.getString("SpagicDeployWizardPage.exportResourceError"), //$NON-NLS-1$
Messages.getString("SpagicDeployWizardPage.chooseResource"));
return false;
}
if (!ensureTargetIsValid()) {
return false;
}
manager = new //$NON-NLS-1$
SpagicJavaDeployManager(//$NON-NLS-1$
exportChoiceMap, //$NON-NLS-1$
contextCombo.getText(), //$NON-NLS-1$
"all", //$NON-NLS-1$
IProcessor.NO_STATISTICS, IProcessor.NO_TRACES);
String topFolder = getRootFolderName();
List<ExportFileResource> resourcesToExport = null;
try {
resourcesToExport = getExportResources();
} catch (ProcessorException e) {
MessageBoxExceptionHandler.process(e);
return false;
}
setTopFolder(resourcesToExport, topFolder);
// Save dirty editors if possible but do not stop if not all are saved
saveDirtyEditors();
// about to invoke the operation so save our state
saveWidgetValues();
// boolean ok =executeExportOperation(new ArchiveFileExportOperationFullPath(process));
// File file = createSapgicProperty();
ArchiveFileExportOperationFullPath exporterOperation = getExporterOperation(resourcesToExport);
// exportResource(topFolder, "", "", 1);
boolean ok = executeExportOperation(exporterOperation);
// path can like name/name
manager.deleteTempFiles();
ProcessorUtilities.resetExportConfig();
String projectName = ((RepositoryContext) CorePlugin.getContext().getProperty(Context.REPOSITORY_CONTEXT_KEY)).getProject().getLabel();
List<JobResource> jobResources = new ArrayList<JobResource>();
for (ExportFileResource proces : process) {
try {
proces.setProcess((ProcessItem) ProxyRepositoryFactory.getInstance().getUptodateProperty(proces.getItem().getProperty()).getItem());
} catch (PersistenceException e) {
e.printStackTrace();
}
ProcessItem processItem = (ProcessItem) proces.getItem();
JobInfo jobInfo = new JobInfo(processItem, processItem.getProcess().getDefaultContext());
jobResources.add(new JobResource(projectName, jobInfo));
Set<JobInfo> jobInfos = ProcessorUtilities.getChildrenJobInfo(processItem);
for (JobInfo subjobInfo : jobInfos) {
jobResources.add(new JobResource(projectName, subjobInfo));
}
}
JobResourceManager reManager = JobResourceManager.getInstance();
for (JobResource r : jobResources) {
if (reManager.isProtected(r)) {
try {
ProcessorUtilities.generateCode(r.getJobInfo().getJobId(), r.getJobInfo().getContextName(), r.getJobInfo().getJobVersion(), false, false);
} catch (ProcessorException e) {
ExceptionHandler.process(e);
}
} else {
reManager.deleteResource(r);
}
}
return ok;
}
use of org.talend.commons.exception.PersistenceException in project tdi-studio-se by Talend.
the class JavaPublishOnSpagoExportWizardPage method restoreWidgetValues.
/**
* Hook method for restoring widget values to the values that they held last time this wizard was used to
* completion.
*/
protected void restoreWidgetValues() {
IDialogSettings settings = getDialogSettings();
if (settings != null) {
// String[] directoryNames = settings.getArray(STORE_DESTINATION_NAMES_ID);
// if (directoryNames != null) {
// // destination
// setDestinationValue(directoryNames[0]);
// for (int i = 0; i < directoryNames.length; i++) {
// addDestinationItem(directoryNames[i]);
// }
// }
// shellLauncherButton.setSelection(settings.getBoolean(STORE_SHELL_LAUNCHER_ID));
// systemRoutineButton.setSelection(settings.getBoolean(STORE_SYSTEM_ROUTINE_ID));
// userRoutineButton.setSelection(settings.getBoolean(STORE_USER_ROUTINE_ID));
// modelButton.setSelection(settings.getBoolean(STORE_MODEL_ID));
// jobButton.setSelection(settings.getBoolean(STORE_JOB_ID));
// sourceButton.setSelection(settings.getBoolean(STORE_SOURCE_ID));
contextButton.setSelection(settings.getBoolean(STORE_CONTEXT_ID));
// genCodeButton.setSelection(settings.getBoolean(STORE_GENERATECODE_ID));
}
// }
if (process.length > 0) {
try {
process[0].setProcess((ProcessItem) ProxyRepositoryFactory.getInstance().getUptodateProperty(process[0].getItem().getProperty()).getItem());
} catch (PersistenceException e) {
e.printStackTrace();
}
if (manager == null) {
manager = new JobJavaScriptsManager(getExportChoiceMap(), contextCombo.getText(), //$NON-NLS-1$
"all", //$NON-NLS-1$
IProcessor.NO_STATISTICS, IProcessor.NO_TRACES);
}
List<String> contextNames = manager.getJobContextsComboValue((ProcessItem) process[0].getItem());
contextCombo.setItems(contextNames.toArray(new String[contextNames.size()]));
if (contextNames.size() > 0) {
contextCombo.select(0);
}
}
}
Aggregations