use of org.talend.core.model.relationship.Relation in project tbd-studio-se by Talend.
the class HadoopClusterConnectionRelationshipHandler method collect.
@Override
protected Set<Relation> collect(Item baseItem) {
if (baseItem instanceof HadoopClusterConnectionItem) {
HadoopClusterConnectionItem hcItem = (HadoopClusterConnectionItem) baseItem;
HadoopClusterConnection connection = (HadoopClusterConnection) hcItem.getConnection();
if (connection != null) {
String version = connection.getDfVersion();
if (StringUtils.isNotEmpty(version)) {
if (DynamicDistributionManager.getInstance().isUsersDynamicDistribution(version)) {
Set<Relation> relationSet = new HashSet<Relation>();
Relation addedRelation = new Relation();
addedRelation.setId(version);
addedRelation.setType(RelationshipItemBuilder.DYNAMIC_DISTRIBUTION_RELATION);
addedRelation.setVersion(RelationshipItemBuilder.LATEST_VERSION);
relationSet.add(addedRelation);
return relationSet;
}
}
}
}
if (baseItem instanceof DatabaseConnectionItem) {
Connection connection = ((DatabaseConnectionItem) baseItem).getConnection();
if (connection != null) {
Object value = RepositoryToComponentProperty.getValue(connection, EParameterName.DB_VERSION.getName(), null);
if (value instanceof String) {
String version = (String) value;
if (DynamicDistributionManager.getInstance().isUsersDynamicDistribution(version)) {
Set<Relation> relationSet = new HashSet<Relation>();
Relation addedRelation = new Relation();
addedRelation.setId(version);
addedRelation.setType(RelationshipItemBuilder.DYNAMIC_DISTRIBUTION_RELATION);
addedRelation.setVersion(RelationshipItemBuilder.LATEST_VERSION);
relationSet.add(addedRelation);
return relationSet;
}
}
}
}
return Collections.emptySet();
}
use of org.talend.core.model.relationship.Relation in project tbd-studio-se by Talend.
the class NoSQLUpdateManager method updateNoSQLConnection.
/**
* DOC ycbai Comment method "updateHadoopClusterConnection".
*
* @param connectionItem
* @param show
* @param onlySimpleShow
* @return
*/
public static boolean updateNoSQLConnection(ConnectionItem connectionItem, boolean show, final boolean onlySimpleShow) {
List<Relation> relations = RelationshipItemBuilder.getInstance().getItemsRelatedTo(connectionItem.getProperty().getId(), RelationshipItemBuilder.LATEST_VERSION, RelationshipItemBuilder.PROPERTY_RELATION);
RepositoryUpdateManager repositoryUpdateManager = new RepositoryUpdateManager(connectionItem, relations) {
@Override
public Set<EUpdateItemType> getTypes() {
Set<EUpdateItemType> types = new HashSet<EUpdateItemType>();
types.add(EUpdateItemType.NODE_PROPERTY);
return types;
}
};
return repositoryUpdateManager.doWork(true, false);
}
use of org.talend.core.model.relationship.Relation in project tdi-studio-se by Talend.
the class MapperSchemaTypeItemRelationshipHandler method collect.
/*
* (non-Javadoc)
*
* @see
* org.talend.core.model.relationship.AbstractItemRelationshipHandler#collect(org.talend.core.model.properties.Item)
*/
@Override
protected Set<Relation> collect(Item baseItem) {
ProcessType processType = getProcessType(baseItem);
if (processType == null) {
return Collections.emptySet();
}
Set<Relation> relationSet = new HashSet<Relation>();
// handle tMap schema relations...
if (GlobalServiceRegister.getDefault().isServiceRegistered(IDesignerMapperService.class)) {
IDesignerMapperService service = (IDesignerMapperService) GlobalServiceRegister.getDefault().getService(IDesignerMapperService.class);
for (Object o : processType.getNode()) {
if (o instanceof NodeType) {
NodeType currentNode = (NodeType) o;
AbstractExternalData nodeData = currentNode.getNodeData();
if (nodeData != null) {
List<String> schemaIds = service.getRepositorySchemaIds(nodeData);
if (schemaIds != null && schemaIds.size() > 0) {
for (String schemaId : schemaIds) {
Relation addedRelation = new Relation();
addedRelation.setId(schemaId);
addedRelation.setType(RelationshipItemBuilder.SCHEMA_RELATION);
addedRelation.setVersion(RelationshipItemBuilder.LATEST_VERSION);
relationSet.add(addedRelation);
}
}
}
}
}
}
return relationSet;
}
use of org.talend.core.model.relationship.Relation in project tdi-studio-se by Talend.
the class SqlTemplateParameterRelationshipHandler method collect.
/*
* (non-Javadoc)
*
* @see org.talend.core.model.relationship.AbstractParameterRelationshipHandler#collect(java.util.Map,
* java.util.Map)
*/
@Override
protected Set<Relation> collect(Map<String, ElementParameterType> parametersMap, Map<?, ?> options) {
Set<Relation> relationSet = new HashSet<Relation>();
//$NON-NLS-1$
ElementParameterType sqlpatternParamType = parametersMap.get("SQLPATTERN_VALUE");
// only for SQL Patterns
if (sqlpatternParamType != null) {
for (Object o3 : sqlpatternParamType.getElementValue()) {
if (o3 instanceof ElementValueType && "SQLPATTERNLIST".equals(((ElementValueType) o3).getElementRef())) {
//$NON-NLS-1$
Relation addedRelation = new Relation();
addedRelation.setId(((ElementValueType) o3).getValue());
addedRelation.setType(RelationshipItemBuilder.SQLPATTERN_RELATION);
addedRelation.setVersion(RelationshipItemBuilder.LATEST_VERSION);
relationSet.add(addedRelation);
}
}
}
return relationSet;
}
use of org.talend.core.model.relationship.Relation in project tbd-studio-se by Talend.
the class HDFSUpdateManager method updateHDFSConnection.
/**
* DOC ycbai Comment method "updateHDFSConnection".
*
* @param connectionItem
* @param show
* @param onlySimpleShow
* @return
*/
public static boolean updateHDFSConnection(ConnectionItem connectionItem, boolean show, final boolean onlySimpleShow) {
List<Relation> relations = RelationshipItemBuilder.getInstance().getItemsRelatedTo(connectionItem.getProperty().getId(), RelationshipItemBuilder.LATEST_VERSION, RelationshipItemBuilder.PROPERTY_RELATION);
RepositoryUpdateManager repositoryUpdateManager = new RepositoryUpdateManager(connectionItem, relations) {
@Override
public Set<EUpdateItemType> getTypes() {
Set<EUpdateItemType> types = new HashSet<EUpdateItemType>();
types.add(EUpdateItemType.NODE_PROPERTY);
types.add(EUpdateItemType.JOB_PROPERTY_STORM);
types.add(EUpdateItemType.JOB_PROPERTY_MAPREDUCE);
return types;
}
};
return repositoryUpdateManager.doWork(true, false);
}
Aggregations