Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -202,8 +202,14 @@ public static String getActor(String projectName, String path) {
ProjectManager projectManager = context.getProjectManager();
RuntimeProject project = projectManager.getProject(projectName).get();

ProjectResource projectResource = project.getResource(getResourcePath(path)).get();
return LastModification.of(projectResource).map(LastModification::getActor).orElse("unknown");
ResourcePath resourcePath = getResourcePath(path);
try {
ProjectResource projectResource = project.getResource(resourcePath).get();
return LastModification.of(projectResource).map(LastModification::getActor).orElse("unknown");
} catch (Exception e) {
logger.error(String.valueOf(e), e);
return "unknown";
}
}

public static List getAddedFiles(String projectName) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import com.inductiveautomation.ignition.common.tags.config.TagConfigurationModel;
import com.inductiveautomation.ignition.common.tags.model.TagPath;
import com.inductiveautomation.ignition.common.tags.model.TagProvider;
import com.inductiveautomation.ignition.common.tags.model.TagProviderInformation;
import com.inductiveautomation.ignition.common.tags.paths.BasicTagPath;
import com.inductiveautomation.ignition.common.tags.paths.parser.TagPathParser;
import com.inductiveautomation.ignition.common.util.LoggerEx;
Expand Down Expand Up @@ -63,20 +64,29 @@ public static void exportTag(Path projectFolderPath) {
Files.createDirectories(tagFolderPath);

for (TagProvider tagProvider : context.getTagManager().getTagProviders()) {
TagPath typesPath = TagPathParser.parse("");
List<TagPath> tagPaths = new ArrayList<>();
tagPaths.add(typesPath);

CompletableFuture<List<TagConfigurationModel>> cfTagModels =
tagProvider.getTagConfigsAsync(tagPaths, true, true);
List<TagConfigurationModel> tModels = cfTagModels.get();

JsonObject json = TagUtilities.toJsonObject(tModels.get(0));
JsonElement sortedJson = JsonUtilities.createDeterministicCopy(json);

Path newFile = tagFolderPath.resolve(tagProvider.getName() + ".json");
logger.info("Attempting to export tags for provider " + tagProvider.getName());
try {
CompletableFuture<TagProviderInformation> cfProviderInfo = tagProvider.getStatusInformation();
TagProviderInformation providerInfo = cfProviderInfo.get();
if (providerInfo == null || !providerInfo.isAvailable()) {
logger.info("Tag provider unavailable. Skipping export for provider " + tagProvider.getName());
continue;
}

Files.writeString(newFile, TAG_GSON.toJson(sortedJson));
TagPath typesPath = TagPathParser.parse("");
List<TagPath> tagPaths = new ArrayList<>();
tagPaths.add(typesPath);
CompletableFuture<List<TagConfigurationModel>> cfTagModels =
tagProvider.getTagConfigsAsync(tagPaths, true, true);
List<TagConfigurationModel> tModels = cfTagModels.get();
JsonObject json = TagUtilities.toJsonObject(tModels.get(0));
JsonElement sortedJson = JsonUtilities.createDeterministicCopy(json);
Path newFile = tagFolderPath.resolve(tagProvider.getName() + ".json");
Files.writeString(newFile, TAG_GSON.toJson(sortedJson));
logger.info("Successfully exported tags for provider " + tagProvider.getName());
} catch (Exception e) {
logger.error(e.toString(), e);
}
}
} catch (Exception e) {
logger.error(e.toString(), e);
Expand Down