Compare commits

...

4 Commits

14 changed files with 59 additions and 24 deletions

View File

@@ -872,25 +872,38 @@ public abstract class AbstractEMFRepositoryFactory extends AbstractRepositoryFac
@Override
public IRepositoryViewObject getLastVersion(Project project, String id, String relativeFolder, ERepositoryObjectType type)
throws PersistenceException {
List<IRepositoryViewObject> serializableAllVersion = null;
Object fullFolder = getFullFolder(project, type, relativeFolder);
serializableAllVersion = getSerializableFromFolder(project, fullFolder, id, type, false, false, true, true);
List<IRepositoryViewObject> serializableAllVersion = new ArrayList<>();
if (lastFolderForItemMap.containsKey(id)) {
ERepositoryObjectType itemType = lastRepositoryTypeForItemMap.get(id);
String currentPath = lastFolderForItemMap.get(id);
Object fullFolder = getFullFolder(project, itemType, currentPath);
try {
if (fullFolder != null && (fullFolder instanceof FolderItem || ((IFolder) fullFolder).exists())) {
serializableAllVersion.addAll(getSerializableFromFolder(project, fullFolder, id, itemType, false, false, true, true));
}
} catch (PersistenceException e) {
// do nothing.
// if any exception happen or can't find the item, just try to look for it everywhere.
}
}
if (serializableAllVersion.isEmpty()) {
// look in all folders for this item type
serializableAllVersion = getSerializableFromFolder(project, fullFolder, id, type, false, true, true, true, true);
Object fullFolder = getFullFolder(project, type, relativeFolder);
serializableAllVersion = getSerializableFromFolder(project, fullFolder, id, type, false, false, true, true);
if (serializableAllVersion.isEmpty()) {
// look in all folders for this item type
serializableAllVersion = getSerializableFromFolder(project, fullFolder, id, type, false, true, true, true, true);
}
}
int size = serializableAllVersion.size();
if (size > 1) {
String message = getItemsMessages(serializableAllVersion, size);
throw new PersistenceException(Messages.getString(
"AbstractEMFRepositoryFactory.presistenceException.OnlyOneOccurenceMustbeFound", message)); //$NON-NLS-1$
} else if (size == 1) {
return serializableAllVersion.get(0);
} else {
return null;
}
if (size == 1) {
return serializableAllVersion.get(0);
}
return null;
}
protected void computePropertyMaxInformationLevel(Property property) {

View File

@@ -88,8 +88,8 @@ public enum EDatabaseVersion4Drivers {
"Microsoft", "MSSQL_PROP", //$NON-NLS-1$ //$NON-NLS-2$
new String[] { "mssql-jdbc.jar", "slf4j-api-1.7.25.jar", "slf4j-log4j12-1.7.25.jar", "adal4j-1.6.7.jar", //$NON-NLS-1$
"commons-lang3-3.10.jar", "commons-codec-1.14.jar", "gson-2.8.9.jar", "oauth2-oidc-sdk-9.7.jar",
"json-smart-2.4.9.jar", "nimbus-jose-jwt-9.22.jar", "javax.mail-1.6.2.jar", "reload4j-1.2.19.jar",
"accessors-smart-2.4.9.jar", "asm-9.5.jar", "content-type-2.1.jar" })),
"json-smart-2.4.11.jar", "nimbus-jose-jwt-9.22.jar", "javax.mail-1.6.2.jar", "reload4j-1.2.19.jar",
"accessors-smart-2.4.11.jar", "asm-9.5.jar", "content-type-2.1.jar" })),
VERTICA_9(new DbVersion4Drivers(EDatabaseTypeName.VERTICA, "VERTICA 9.X", "VERTICA_9_0", "vertica-jdbc-9.3.1-0.jar")), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
VERTICA_7_1_X(new DbVersion4Drivers(EDatabaseTypeName.VERTICA, "VERTICA 7.1.X (Deprecated)", "VERTICA_7_1_X", "vertica-jdbc-7.1.2-0.jar")), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$

View File

@@ -495,11 +495,16 @@ public class ContextUtils {
}
return itemMap;
}
private static Set<String> missingContexts = new HashSet<>();
public static void clearMissingContextCache() {
missingContexts.clear();
}
/**
*
* get the repository context item,now contextId can be either joblet node or context node.
*/
* get the repository context item, now contextId can be either joblet node or context node.
*/
public static Item getRepositoryContextItemById(String contextId) {
if (IContextParameter.BUILT_IN.equals(contextId)) {
return null;
@@ -507,6 +512,9 @@ public class ContextUtils {
if (checkObject(contextId)) {
return null;
}
if (missingContexts.contains(contextId)) {
return null;
}
List<ERepositoryObjectType> possibleTypes = new ArrayList<ERepositoryObjectType>();
possibleTypes.add(ERepositoryObjectType.CONTEXT);
@@ -521,6 +529,8 @@ public class ContextUtils {
return item;
}
}
missingContexts.add(contextId);
ExceptionHandler.log("Can't find Context item[id=" + contextId + "].");
} catch (PersistenceException e) {
ExceptionHandler.process(e);
}
@@ -831,6 +841,7 @@ public class ContextUtils {
ItemContextLink itemContextLink) {
Map<String, String> renamedMap = new HashMap<String, String>();
Map<String, Item> tempItemMap = new HashMap<String, Item>();
clearMissingContextCache();
for (ContextType contextType : contextTypeList) {
for (Object obj : contextType.getContextParameter()) {
if (obj instanceof ContextParameterType) {
@@ -893,6 +904,7 @@ public class ContextUtils {
*/
public static Map<String, String> calculateRenamedMapFromLinkFile(String projectLabel, String itemId,
List<IContext> contextList) {
clearMissingContextCache();
Map<String, String> renamedMap = new HashMap<String, String>();
Map<String, Item> idToItemMap = new HashMap<String, Item>();
try {

View File

@@ -299,6 +299,7 @@ public class JobContextManager implements IContextManager {
}
List<ContextItem> contextItemList = ContextUtils.getAllContextItem();
boolean setDefault = false;
ContextUtils.clearMissingContextCache();
for (int i = 0; i < contextTypeList.size(); i++) {
contextType = (ContextType) contextTypeList.get(i);
String name = contextType.getName();
@@ -526,6 +527,7 @@ public class JobContextManager implements IContextManager {
EList newcontextTypeList = new BasicEList();
Map<String, Item> idToItemMap = new HashMap<String, Item>();
ContextUtils.clearMissingContextCache();
for (int i = 0; i < listContext.size(); i++) {
IContext context = listContext.get(i);
String contextGroupName = renameGroupContext.get(context);

View File

@@ -51,6 +51,7 @@ public abstract class AbstractItemContextLinkService implements IItemContextLink
itemContextLink.setItemId(itemId);
Map<String, Item> tempCache = new HashMap<String, Item>();
if (contextTypeList != null && contextTypeList.size() > 0) {
ContextUtils.clearMissingContextCache();
for (Object object : contextTypeList) {
if (object instanceof ContextType) {
ContextType jobContextType = (ContextType) object;

View File

@@ -206,6 +206,7 @@ public class ContextLinkService {
Map<String, Map<String, String>> changedContextParameterId) throws PersistenceException {
List<Relation> relationList = RelationshipItemBuilder.getInstance()
.getItemsHaveRelationWith(sourceId, RelationshipItemBuilder.LATEST_VERSION, false);
ContextUtils.clearMissingContextCache();
for (Relation relation : relationList) {
String id = relation.getId();
IFile linkFile = calContextLinkFile(ProjectManager.getInstance().getCurrentProject().getTechnicalLabel(), id);

View File

@@ -648,6 +648,7 @@ public class ContextNebulaGridComposite extends AbstractContextTabEditComposite
helper.initHelper(contextManager);
Map<String, Item> items = new HashMap<String, Item>();
boolean needRefresh = false;
ContextUtils.clearMissingContextCache();
for (IContextParameter param : contextManager.getDefaultContext().getContextParameterList()) {
if (!param.isBuiltIn()) {
String source = param.getSource();

View File

@@ -522,6 +522,7 @@ public class SelectRepositoryContextDialog extends SelectionDialog {
// remove the params which is unchecked
Set<String> jobletIds = new HashSet<String>();
Set<String> chekedIds = new HashSet<String>();
ContextUtils.clearMissingContextCache();
for (IContextParameter param : existParas) {
if (param.isBuiltIn()) {
continue;

View File

@@ -185,6 +185,7 @@ public class AddRepositoryContextGroupCommand extends Command {
// remove the params which is unchecked
Set<String> jobletIds = new HashSet<String>();
Set<String> chekedIds = new HashSet<String>();
ContextUtils.clearMissingContextCache();
for (IContextParameter param : existParas) {
if (param.isBuiltIn()) {
continue;

View File

@@ -92,6 +92,7 @@ public class ContextNatTableUtils {
List<ContextTableTabParentModel> output = new ArrayList<ContextTableTabParentModel>();
if (!contextDatas.isEmpty()) {
int i = 0;
ContextUtils.clearMissingContextCache();
for (IContextParameter para : contextDatas) {
String sourceId = para.getSource();
if (IContextParameter.BUILT_IN.equals(sourceId)) {

View File

@@ -21,6 +21,7 @@ import org.eclipse.ui.IViewPart;
import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.IWorkbenchPart;
import org.eclipse.ui.PlatformUI;
import org.talend.core.model.context.ContextUtils;
import org.talend.core.ui.branding.IBrandingConfiguration;
/**
@@ -51,6 +52,7 @@ public class Contexts {
public void run() {
if (cxtView != null) {
updateTitle(cxtView);
ContextUtils.clearMissingContextCache();
cxtView.refresh(part);
}
}

View File

@@ -126,7 +126,7 @@
<dependency>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.20</version>
<version>2.22.1</version>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>

View File

@@ -10,7 +10,7 @@
<artifactId>studio-tacokit-dependencies</artifactId>
<packaging>pom</packaging>
<properties>
<tacokit.components.version>1.27.23</tacokit.components.version>
<tacokit.components.version>1.27.24</tacokit.components.version>
</properties>
<repositories>
<repository>

View File

@@ -152,19 +152,19 @@
context="plugin:org.talend.metadata.managment"
language="java"
message="Needed for create Microsoft SQL Server db connection"
mvn_uri="mvn:net.minidev/json-smart/2.4.9"
name="json-smart-2.4.9.jar"
mvn_uri="mvn:net.minidev/json-smart/2.4.11"
name="json-smart-2.4.11.jar"
required="true"
uripath="platform:/plugin/org.talend.libraries.tis.custom/lib/json-smart-2.4.9.jar">
uripath="platform:/plugin/org.talend.libraries.tis.custom/lib/json-smart-2.4.11.jar">
</libraryNeeded>
<libraryNeeded
context="plugin:org.talend.metadata.managment"
language="java"
message="Needed for create Microsoft SQL Server db connection"
mvn_uri="mvn:net.minidev/accessors-smart/2.4.9"
name="accessors-smart-2.4.9.jar"
mvn_uri="mvn:net.minidev/accessors-smart/2.4.11"
name="accessors-smart-2.4.11.jar"
required="true"
uripath="platform:/plugin/org.talend.libraries.tis.custom/lib/accessors-smart-2.4.9.jar">
uripath="platform:/plugin/org.talend.libraries.tis.custom/lib/accessors-smart-2.4.11.jar">
</libraryNeeded>
<libraryNeeded
context="plugin:org.talend.metadata.managment"