@Override public void init(final SapphireAction action, final ActionHandlerDef def) { super.init(action, def); setId(ID); setLabel(Resources.label); addImage(IMG_FILE); final Property property = property(); this.type = null; final String paramType = def.getParam(PARAM_TYPE); if (paramType != null) { if (paramType.equalsIgnoreCase("file")) { this.type = FileSystemResourceType.FILE; } else if (paramType.equalsIgnoreCase("folder")) { this.type = FileSystemResourceType.FOLDER; } } else { final ValidFileSystemResourceType validFileSystemResourceTypeAnnotation = property.definition().getAnnotation(ValidFileSystemResourceType.class); if (validFileSystemResourceTypeAnnotation != null) { this.type = validFileSystemResourceTypeAnnotation.value(); } } final String staticFileExtensions = def.getParam(PARAM_EXTENSIONS); if (staticFileExtensions == null) { this.fileExtensionService = property.service(FileExtensionsService.class); if (this.fileExtensionService == null) { this.staticFileExtensionsList = Collections.emptyList(); } } else { this.staticFileExtensionsList = new ArrayList<String>(); for (String extension : staticFileExtensions.split(",")) { extension = extension.trim(); if (extension.length() > 0) { this.staticFileExtensionsList.add(extension); } } } final String paramLeadingSlash = def.getParam(PARAM_LEADING_SLASH); if (paramLeadingSlash != null) { this.includeLeadingSlash = Boolean.parseBoolean(paramLeadingSlash); } else { this.includeLeadingSlash = false; } }
@Override public void init(final SapphireAction action, final ActionHandlerDef def) { super.init(action, def); setId(ID); this.paramKinds = def.getParam(PARAM_KINDS); }