@Override public void importFile(File inFile, IRI documentIRI, Authorizations authorizations) throws Exception { if (!inFile.exists()) { throw new LumifyException("File " + inFile + " does not exist"); } File inDir = inFile.getParentFile(); FileInputStream inFileIn = new FileInputStream(inFile); try { importFile(inFileIn, documentIRI, inDir, authorizations); } finally { inFileIn.close(); } }
private void setIconProperty( Concept concept, File inDir, String glyphIconFileName, String propertyKey, Authorizations authorizations) throws IOException { if (glyphIconFileName != null) { File iconFile = new File(inDir, glyphIconFileName); if (!iconFile.exists()) { throw new RuntimeException("Could not find icon file: " + iconFile.toString()); } InputStream iconFileIn = new FileInputStream(iconFile); try { StreamingPropertyValue value = new StreamingPropertyValue(iconFileIn, byte[].class); value.searchIndex(false); value.store(true); concept.setProperty( propertyKey, value, OntologyRepository.VISIBILITY.getVisibility(), authorizations); } finally { iconFileIn.close(); } } }