use of org.talend.repository.items.importexport.handlers.imports.ImportBasicHandler in project tdi-studio-se by Talend.
the class ResetItemLabelMigrationTask method execute.
@Override
public ExecutionResult execute(Item item) {
IProxyRepositoryFactory repositoryFactory = CoreRuntimePlugin.getInstance().getProxyRepositoryFactory();
ImportBasicHandler handler = new ImportBasicHandler();
Property property = item.getProperty();
if (property == null) {
return ExecutionResult.NOTHING_TO_DO;
}
String label = property.getLabel();
if (label == null) {
return ExecutionResult.NOTHING_TO_DO;
}
try {
boolean isAvailable = WorkspaceUtils.checkNameIsOK(label);
if (!isAvailable) {
property.setLabel(handler.getPropertyLabel(StringUtils.trimToNull(label)));
property.setDisplayName(StringUtils.trimToNull(label));
repositoryFactory.save(item, true);
}
} catch (PersistenceException e) {
return ExecutionResult.FAILURE;
}
return ExecutionResult.SUCCESS_WITH_ALERT;
}
Aggregations