@Override public TemplateModel get(String key) throws TemplateModelException { if (("filename".equals(key)) || ("location".equals(key))) { return wrap(schemaInfo.getProperty(key)); } return super.get(key); } }
@Override public TemplateModel get(String property) throws TemplateModelException { if ("size".equals(property)) { long sizeInBytes = artifact.getSize(); String units = "bytes"; float unitSize = 1; if ((sizeInBytes / 1024) > 0) { units = "K"; unitSize = 1024; } if ((sizeInBytes / 1048576) > 0) { units = "M"; unitSize = 1048576; } if ((sizeInBytes / 1073741824) > 0) { units = "G"; unitSize = 1073741824; } return wrap(String.format("%.2f%s", ((float) sizeInBytes) / unitSize, units)); } return super.get(property); } }
@Override public TemplateModel get(String property) throws TemplateModelException { if ("size".equals(property)) { long sizeInBytes = artifact.getSize(); String units = "bytes"; float unitSize = 1; if ((sizeInBytes / 1024) > 0) { units = "K"; unitSize = 1024; } if ((sizeInBytes / 1048576) > 0) { units = "M"; unitSize = 1048576; } if ((sizeInBytes / 1073741824) > 0) { units = "G"; unitSize = 1073741824; } return wrap(String.format("%.2f%s", ((float) sizeInBytes) / unitSize, units)); } return super.get(property); } }
@Override public TemplateModel get(String key) throws TemplateModelException { if (("filename".equals(key)) || ("location".equals(key)) || ("inlineSchema".equals(key))) { return wrap(wsdlInfo.getProperty(key)); } else if ("importedNamespaces".equals(key)) { Set<String> importedNamespaces = wsdlInfo.getImportedNamespaces(); SchemaInfo associatedSchema = wsdlInfo.getAssociatedSchema(); Boolean inlineSchema = (Boolean) wsdlInfo.getProperty("inlineSchema"); if (associatedSchema != null && inlineSchema != null && inlineSchema) { importedNamespaces.addAll(associatedSchema.getReferencedNamespaces()); } return wrap(importedNamespaces); } else if ("importedSchemas".equals(key)) { TreeSet<SchemaInfo> schemas = new TreeSet<SchemaInfo>(new SchemaInfoComparator()); schemas.addAll(wsdlInfo.getImportedSchemas()); SchemaInfo associatedSchema = wsdlInfo.getAssociatedSchema(); Boolean inlineSchema = (Boolean) wsdlInfo.getProperty("inlineSchema"); if (associatedSchema != null && inlineSchema != null && inlineSchema) { schemas.addAll(associatedSchema.getImportedSchemas()); } return wrap(schemas); } return super.get(key); } }