/** * Shortcut for reading data */ @XmlTransient public String getData() { return store == null ? null : store.getData(); }
/** * Shortcut for setting data */ public void setData(String data) { this.store = data == null ? null : new RESTStoredData(data); }
@Override public String toString() { StringBuilder builder = new StringBuilder(); builder.append(getClass().getSimpleName()).append('['); builder.append("id=").append(id); if (name != null) builder.append(", name=").append(name); if (description != null) builder.append(", descr=").append(description); if (creation != null) builder.append(", created=").append(creation); if (lastUpdate != null) builder.append(", updated=").append(lastUpdate); if (metadata != null) builder.append(", meta=").append(metadata); if (attribute != null) builder.append(", attr=").append(attribute); if (store != null) builder.append(", store=").append(store.toString()); if (category != null) builder.append(", cat=").append(category.toString()); builder.append(']'); return builder.toString(); }
public static Resource convertResource(RESTResource resource) { Category category = new Category(); if (resource.getCategory().getName() != null) category.setName(resource.getCategory().getName()); if (resource.getCategory().getId() != null) category.setId(resource.getCategory().getId()); Resource r = new Resource(); r.setDescription(resource.getDescription()); r.setMetadata(resource.getMetadata()); r.setName(resource.getName()); r.setCategory(category); // Parsing Attributes list if (CollectionUtils.isNotEmpty(resource.getAttribute())) { List<Attribute> attributes = Convert.convertAttributeList(resource.getAttribute()); r.setAttribute(attributes); } RESTStoredData dataDto = resource.getStore(); if (dataDto != null) { StoredData data = new StoredData(); data.setData(dataDto.getData()); r.setData(data); } return r; }