public String generateURL(PieDataset dataset, Comparable key, int index) { value.dataset = dataset; value.key = ((ComparableWrapper) key).getObject(); value.index = index; return format.format(value); }
public static String format(String expression, Object root) { return create(expression).format(root); }
public static String format(String expression, Object root) { return create(expression).format(root); }
protected Response objectCreated() throws URISyntaxException { form.readFromObject(object); //Re-read so that the full object is returned OgnlTextFormat textFormat = getReadURLFormat(); return Response.status(Response.Status.CREATED). entity(form). location(new URI(textFormat.format(object))). build(); }
protected Response objectCreated() throws URISyntaxException { form.readFromObject(object); //Re-read so that the full object is returned OgnlTextFormat textFormat = getReadURLFormat(); return Response.status(Response.Status.CREATED). entity(form). location(new URI(textFormat.format(object))). build(); }
public String getCreateTitle() { String title = crudConfiguration.getCreateTitle(); if(StringUtils.isBlank(title)) { title = getPage().getTitle(); } OgnlTextFormat textFormat = OgnlTextFormat.create(StringUtils.defaultString(title)); return textFormat.format(this); }
public String getSearchTitle() { String title = crudConfiguration.getSearchTitle(); if(StringUtils.isBlank(title)) { title = getPage().getTitle(); } OgnlTextFormat textFormat = OgnlTextFormat.create(StringUtils.defaultString(title)); return textFormat.format(this); }
public String getEditTitle() { String title = crudConfiguration.getEditTitle(); if(StringUtils.isEmpty(title)) { return ShortNameUtils.getName(getClassAccessor(), object); } else { OgnlTextFormat textFormat = OgnlTextFormat.create(StringUtils.defaultString(title)); return textFormat.format(this); } }
public String getReadTitle() { String title = crudConfiguration.getReadTitle(); if(StringUtils.isEmpty(title)) { return ShortNameUtils.getName(getClassAccessor(), object); } else { OgnlTextFormat textFormat = OgnlTextFormat.create(title); return textFormat.format(this); } }
public static String getName(ClassAccessor classAccessor, Object object) { ShortName annotation = classAccessor.getAnnotation(ShortName.class); String formatString; if (annotation == null) { StringBuilder sb = new StringBuilder(); boolean first = true; // sintetizziamo una stringa a partire dalla chiave primaria for (PropertyAccessor propertyAccessor : classAccessor.getKeyProperties()) { if (first) { first = false; } else { sb.append(PK_ELEMENT_SEPARATOR); } sb.append(String.format("%%{%s}", propertyAccessor.getName())); } formatString = sb.toString(); } else { formatString = annotation.value(); } OgnlTextFormat ognlTextFormat = OgnlTextFormat.create(formatString); return ognlTextFormat.format(object); } }
public static String getName(ClassAccessor classAccessor, Object object) { ShortName annotation = classAccessor.getAnnotation(ShortName.class); String formatString; if (annotation == null) { StringBuilder sb = new StringBuilder(); boolean first = true; // sintetizziamo una stringa a partire dalla chiave primaria for (PropertyAccessor propertyAccessor : classAccessor.getKeyProperties()) { if (first) { first = false; } else { sb.append(PK_ELEMENT_SEPARATOR); } sb.append(String.format("%%{%s}", propertyAccessor.getName())); } formatString = sb.toString(); } else { formatString = annotation.value(); } OgnlTextFormat ognlTextFormat = OgnlTextFormat.create(formatString); return ognlTextFormat.format(object); } }
protected void refreshTableBlobDownloadHref() { Iterator<?> objIterator = objects.iterator(); for (TableForm.Row row : tableForm.getRows()) { Iterator<Field> fieldIterator = row.iterator(); Object obj = objIterator.next(); String baseUrl = null; while (fieldIterator.hasNext()) { Field field = fieldIterator.next(); if (field instanceof AbstractBlobField) { if(baseUrl == null) { OgnlTextFormat hrefFormat = getReadURLFormat(); baseUrl = hrefFormat.format(obj); } Blob blob = ((AbstractBlobField) field).getValue(); if(blob != null) { field.setHref(getBlobDownloadUrl(field, baseUrl)); } } } } }
@Override public void init(DatabasePlatformsRegistry databasePlatformsRegistry) { keyPrefix = "portofino.database." + getDatabase().getDatabaseName() + "."; configuration = databasePlatformsRegistry.getPortofinoConfiguration(); if(url == null || url.equals(keyPrefix + "url")) { actualUrl = configuration.getString(keyPrefix + "url"); if(actualUrl == null) { status = STATUS_ERROR; throw new RuntimeException("Invalid connection provider for database " + getDatabase().getDatabaseName() + " - no URL specified"); } } else { actualUrl = url; } actualUrl = OgnlTextFormat.format(actualUrl, null); if(username == null || username.equals(keyPrefix + "username")) { actualUsername = configuration.getString(keyPrefix + "username"); if(actualUsername == null) { status = STATUS_ERROR; throw new RuntimeException("Invalid connection provider for database " + getDatabase().getDatabaseName() + " - no username specified"); } } else { actualUsername = username; } if(password == null || password.equals(keyPrefix + "password")) { actualPassword = configuration.getString(keyPrefix + "password"); } else { actualPassword = password; } super.init(databasePlatformsRegistry); }
public String generateURL(CategoryDataset dataset, int series, int category) { ComparableWrapper c1 = (ComparableWrapper) dataset.getRowKey(series); ComparableWrapper c2 = (ComparableWrapper) dataset.getColumnKey(category); value.dataset = dataset; value.series = c1.getObject(); value.category = c2.getObject(); return format.format(value); }
@Override public void init(DatabasePlatformsRegistry databasePlatformsRegistry) { keyPrefix = "portofino.database." + getDatabase().getDatabaseName() + "."; configuration = databasePlatformsRegistry.getPortofinoConfiguration(); if(url == null || url.equals(keyPrefix + "url")) { actualUrl = configuration.getString(keyPrefix + "url"); if(actualUrl == null) { status = STATUS_ERROR; throw new RuntimeException("Invalid connection provider for database " + getDatabase().getDatabaseName() + " - no URL specified"); } } else { actualUrl = url; } actualUrl = OgnlTextFormat.format(actualUrl, null); if(username == null || username.equals(keyPrefix + "username")) { actualUsername = configuration.getString(keyPrefix + "username"); if(actualUsername == null) { status = STATUS_ERROR; throw new RuntimeException("Invalid connection provider for database " + getDatabase().getDatabaseName() + " - no username specified"); } } else { actualUsername = username; } if(password == null || password.equals(keyPrefix + "password")) { actualPassword = configuration.getString(keyPrefix + "password"); } else { actualPassword = password; } super.init(databasePlatformsRegistry); }
protected void refreshTableBlobDownloadHref() { Iterator<?> objIterator = objects.iterator(); for (TableForm.Row row : tableForm.getRows()) { Iterator<Field> fieldIterator = row.iterator(); Object obj = objIterator.next(); String baseUrl = null; while (fieldIterator.hasNext()) { Field field = fieldIterator.next(); if (field instanceof AbstractBlobField) { if(baseUrl == null) { OgnlTextFormat hrefFormat = getReadURLFormat(); baseUrl = hrefFormat.format(obj); } Blob blob = ((AbstractBlobField) field).getValue(); if(blob != null) { UrlBuilder urlBuilder = new UrlBuilder(Locale.getDefault(), baseUrl, false) .addParameter("downloadBlob", "") .addParameter("propertyName", field.getPropertyAccessor().getName()); field.setHref(urlBuilder.toString()); } } } } }
ognlContext.put("generatedClassName", className); ognlContext.put("actionClassName", actionClassName); String script = OgnlTextFormat.format(scriptTemplate, parent);
ognlContext.put("generatedClassName", className); ognlContext.put("pageClassName", pageClassName); String script = OgnlTextFormat.format(scriptTemplate, this);