use of org.talend.mdm.repository.core.IRepositoryNodeConfiguration in project tmdm-studio-se by Talend.
the class RepositoryViewFilterDialog method updateForEventManager.
private void updateForEventManager(Set<String> values) {
ERepositoryObjectType[] types = new ERepositoryObjectType[] { IServerObjectRepositoryType.TYPE_TRANSFORMERV2, IServerObjectRepositoryType.TYPE_ROUTINGRULE };
for (ERepositoryObjectType type : types) {
IRepositoryNodeConfiguration conf = RepositoryNodeConfigurationManager.getConfiguration(type);
IRepositoryViewObject viewObject = RepositoryResourceUtil.getCategoryViewObject(conf);
if (viewObject != null) {
ContainerItem item = (ContainerItem) viewObject.getProperty().getItem();
values.add(item.getLabel());
}
}
}
use of org.talend.mdm.repository.core.IRepositoryNodeConfiguration in project tmdm-studio-se by Talend.
the class RepositoryViewFilterDialog method getLabel.
private String getLabel(Object element) {
if (element instanceof IRepositoryViewObject) {
Item item = ((IRepositoryViewObject) element).getProperty().getItem();
IRepositoryNodeConfiguration conf = RepositoryNodeConfigurationManager.getConfiguration(item);
if (conf != null)
return conf.getLabelProvider().getText(element);
}
// $NON-NLS-1$
return "";
}
use of org.talend.mdm.repository.core.IRepositoryNodeConfiguration in project tmdm-studio-se by Talend.
the class RepositoryNodeConfigurationManager method initTemplateDefine.
private static void initTemplateDefine() {
if (!inited) {
IExtensionRegistry registry = Platform.getExtensionRegistry();
//
IExtensionPoint extensionPoint = registry.getExtensionPoint(RepositoryPlugin.PLUGIN_ID, EXTENSION_POINT_TEMPLATE);
if (extensionPoint != null && extensionPoint.isValid()) {
IExtension[] extensions = extensionPoint.getExtensions();
for (IExtension s : extensions) {
IConfigurationElement[] elements = s.getConfigurationElements();
for (IConfigurationElement element : elements) {
if (element.getAttribute(PROP_CLASS) != null) {
try {
IRepositoryNodeConfiguration configuration = (IRepositoryNodeConfiguration) element.createExecutableExtension(PROP_CLASS);
configurations.add(configuration);
} catch (CoreException e) {
log.error(e.getMessage(), e);
}
}
}
}
// Bean2EObjUtil.getInstance().dumpMap();
}
inited = true;
}
}
use of org.talend.mdm.repository.core.IRepositoryNodeConfiguration in project tmdm-studio-se by Talend.
the class RepositoryNodeConfigurationManager method getConfiguration.
public static IRepositoryNodeConfiguration getConfiguration(Item item) {
EClass eClass = item.eClass();
IRepositoryNodeConfiguration configuration = itemConfMap.get(eClass);
if (configuration != null) {
return configuration;
}
for (IRepositoryNodeConfiguration conf : getConfigurations()) {
IRepositoryNodeResourceProvider resourceProvider = conf.getResourceProvider();
if (resourceProvider != null) {
if (resourceProvider.canHandleItem(item)) {
if (!(item instanceof ContainerItem)) {
itemConfMap.put(eClass, conf);
}
return conf;
}
}
}
if (recycleBinNodeConfiguration.getResourceProvider().canHandleItem(item)) {
return recycleBinNodeConfiguration;
}
return null;
}
use of org.talend.mdm.repository.core.IRepositoryNodeConfiguration in project tmdm-studio-se by Talend.
the class RepositoryResourceUtil method createItem.
public static boolean createItem(Item item, String propLabel, String version, boolean pushCommandStack, boolean triggerEvent) {
String name = propLabel;
IProxyRepositoryFactory factory = CoreRuntimePlugin.getInstance().getProxyRepositoryFactory();
RepositoryContext context = factory.getRepositoryContext();
Property prop = PropertiesFactory.eINSTANCE.createProperty();
item.setProperty(prop);
try {
String nextId = factory.getNextId();
Property property = item.getProperty();
property.setId(nextId);
property.setVersion(version);
property.setAuthor(context.getUser());
property.setLabel(propLabel);
//
factory.create(item, new Path(item.getState().getPath()));
item = assertItem(item);
//
IRepositoryNodeConfiguration configuration = RepositoryNodeConfigurationManager.getConfiguration(item);
if (configuration != null) {
IRepositoryNodeResourceProvider resourceProvider = configuration.getResourceProvider();
if (resourceProvider.needSaveReferenceFile()) {
resourceProvider.handleReferenceFile(item);
}
factory.save(item, !triggerEvent);
try {
factory.unlock(item);
} catch (LoginException e) {
log.error(e.getMessage(), e);
}
}
if (pushCommandStack) {
CommandManager.getInstance().pushCommand(ICommand.CMD_ADD, nextId, name);
}
return true;
} catch (PersistenceException e) {
log.error(e.getMessage(), e);
}
return false;
}
Aggregations