private void doWriteGitViewVariable(File viewRepo, Variable variable) throws IOException { if (variable.hasAttribute("script")) { String script = variable.getAttributeStringValue("script"); File variableFile = new File(viewRepo, variable.getName() + ".js"); FileWriter fileWriter = new FileWriter(variableFile); try { fileWriter.append(script); fileWriter.flush(); } finally { StreamUtil.silentSafeClose(fileWriter); } } }
private void importIdentifiers( @NotNull IdentifiersMapping idMapping, ValueTable sourceTable, @Nullable String select) { Variable variable = identifiersTableService.ensureIdentifiersMapping(idMapping); String selectScript = select == null // ? variable.hasAttribute("select") ? variable.getAttributeStringValue("select") : null // : select; ValueTable sourceIdentifiersTable = identifierService.createPrivateView(sourceTable.getName(), sourceTable, selectScript); Variable identifierVariable = identifierService.createIdentifierVariable(sourceIdentifiersTable, idMapping); PrivateVariableEntityMap entityMap = new OpalPrivateVariableEntityMap( identifiersTableService.getIdentifiersTable(idMapping.getEntityType()), identifierVariable, participantIdentifier); try (ValueTableWriter identifiersTableWriter = identifiersTableService.createIdentifiersTableWriter(idMapping.getEntityType())) { for (VariableEntity privateEntity : sourceIdentifiersTable.getVariableEntities()) { if (entityMap.publicEntity(privateEntity) == null) { entityMap.createPublicEntity(privateEntity); } identifierService.copyParticipantIdentifiers( entityMap.publicEntity(privateEntity), sourceIdentifiersTable, entityMap, identifiersTableWriter); } } }