public File getArduinoFile(String name) { String path = System.getProperty("user.dir"); if (osType.equals(OsType.MAC)) { String javaroot = System.getProperty("javaroot"); if (javaroot != null) { path = javaroot; } } File workingDir = new File(path); return new File(workingDir, name); }
/** * Return the appropriate JSP, depending on the type of the relation end. Basically checks if the * target type is a Woko-managed class, and defaults to <code>renderPropertyValue</code> if the * relation cannot be modified. Also handles enumerated types (Java enums). * * @return the path to the JSP fragment to be used */ public String getPath() { // check if the property is an enum Class<?> propertyType = getPropertyType(); if (propertyType != null) { if (propertyType.isEnum()) { return ENUM_FRAGMENT_PATH; } // not an enum : we check if the target object is persistent or not. // if persistent, then forward to another JSP OsType os = getFacetContext().getWoko().getObjectStore(); List<Class<?>> mappedClasses = os.getMappedClasses(); if (mappedClasses.contains(propertyType)) { return FRAGMENT_PATH; } } getRequest() .setAttribute( RenderPropertyValue.FACET_NAME, this); // NEEDED because the JSP expects the facet to be found. return super.getPath(); }
/** * Return a list of elements to choose from for assigning the relation end. * * @return a list of choices for the relation end */ public List<?> getChoices() { OsType store = getFacetContext().getWoko().getObjectStore(); ResultIterator<?> choices = store.list(store.getClassMapping(getPropertyType()), 0, Integer.MAX_VALUE); return choices.toList(); }