use of org.talend.core.model.properties.NotationHolder in project tdi-studio-se by Talend.
the class ImportItemUtil method resetItemReference.
/**
*
* cLi Comment method "resetItemReference".
*
* resolve the encode some special character(bug 6252), maybe, It's not better to resolve this by manually.
*
* such as, "[" is "%5B", "]" is "%5D", etc.
*/
@SuppressWarnings("unchecked")
private void resetItemReference(ItemRecord itemRecord, Resource resource) {
Item item = itemRecord.getItem();
EList<EObject> contents = resource.getContents();
/*
* ignore job. no need, because it can't be allowed input special char for name.
*/
if (item instanceof ProcessItem) {
// ((ProcessItem) item).setProcess((ProcessType) EcoreUtil.getObjectByType(contents,
// TalendFilePackage.eINSTANCE
// .getProcessType()));
} else /*
* ignore joblet. no need, because it can't be allowed input special char for name.
*/
if (item instanceof JobletProcessItem) {
// JobletProcessItem jobletProcessItem = (JobletProcessItem) item;
//
// jobletProcessItem.setJobletProcess((JobletProcess) EcoreUtil.getObjectByType(contents,
// JobletPackage.eINSTANCE
// .getJobletProcess()));
// jobletProcessItem
// .setIcon((ByteArray) EcoreUtil.getObjectByType(contents, PropertiesPackage.eINSTANCE.getByteArray()));
} else // connectionItem
if (item instanceof ConnectionItem) {
((ConnectionItem) item).setConnection((Connection) EcoreUtil.getObjectByType(contents, ConnectionPackage.eINSTANCE.getConnection()));
} else // context
if (item instanceof ContextItem) {
EList contexts = ((ContextItem) item).getContext();
contexts.clear();
contexts.addAll(EcoreUtil.getObjectsByType(contents, TalendFilePackage.eINSTANCE.getContextType()));
} else // file
if (item instanceof FileItem) {
/*
* ignore routine, no need, because it can't be allowed input special char for name.
*/
if (item instanceof RoutineItem) {
return;
}
FileItem fileItem = (FileItem) item;
fileItem.setContent((ByteArray) EcoreUtil.getObjectByType(contents, PropertiesPackage.eINSTANCE.getByteArray()));
} else // snippet
if (item instanceof SnippetItem) {
EList variables = ((SnippetItem) item).getVariables();
variables.clear();
variables.addAll(EcoreUtil.getObjectsByType(contents, PropertiesPackage.eINSTANCE.getSnippetVariable()));
} else // link doc
if (item instanceof LinkDocumentationItem) {
((LinkDocumentationItem) item).setLink((LinkType) EcoreUtil.getObjectByType(contents, PropertiesPackage.eINSTANCE.getLinkType()));
} else // business
if (item instanceof BusinessProcessItem) {
BusinessProcessItem businessProcessItem = (BusinessProcessItem) item;
businessProcessItem.setSemantic((BusinessProcess) EcoreUtil.getObjectByType(contents, BusinessPackage.eINSTANCE.getBusinessProcess()));
businessProcessItem.setNotationHolder((NotationHolder) EcoreUtil.getObjectByType(contents, PropertiesPackage.eINSTANCE.getNotationHolder()));
}
}
Aggregations