@Override public String transform(final SchemaTO input) { return input.getKey(); } }, new ArrayList<String>()));
@Override public boolean equals(final Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final DerSchemaTO other = (DerSchemaTO) obj; return new EqualsBuilder(). appendSuper(super.equals(obj)). append(expression, other.expression). build(); } }
@Override protected Serializable onApplyInternal(final SchemaTO modelObject) { modelObject.getLabels().clear(); modelObject.getLabels().putAll(translations.getObject().stream(). filter(Objects::nonNull). filter(translation -> translation.getKey() != null). filter(translation -> translation.getValue() != null). collect(Collectors.toMap(MutablePair::getKey, MutablePair::getValue))); if (getOriginalItem() == null || StringUtils.isBlank(getOriginalItem().getKey())) { restClient.create(schemaType, modelObject); } else { restClient.update(schemaType, modelObject); } return null; }
@Override public int hashCode() { return new HashCodeBuilder(). appendSuper(super.hashCode()). append(readonly). append(resource). append(anyType). append(extAttrName). build(); }
private <S extends Schema, T extends SchemaTO> void labels(final S src, final T dst) { dst.getLabels().putAll(src.getLabels().stream(). collect(Collectors.toMap(SchemaLabel::getLocale, SchemaLabel::getDisplay))); }
@Override public int hashCode() { return new HashCodeBuilder(). appendSuper(super.hashCode()). append(readonly). append(resource). append(anyType). append(extAttrName). build(); }
private <S extends Schema, T extends SchemaTO> void labels(final T src, final S dst) { src.getLabels().forEach((locale, display) -> { SchemaLabel label = dst.getLabel(locale).orElse(null); if (label == null) { label = entityFactory.newEntity(SchemaLabel.class); label.setLocale(locale); label.setSchema(dst); dst.add(label); } label.setDisplay(display); }); dst.getLabels().removeIf(label -> !src.getLabels().containsKey(label.getLocale())); }
@Override public Response create(final SchemaType schemaType, final SchemaTO schemaTO) { SchemaTO created = logic.create(schemaType, schemaTO); URI location = uriInfo.getAbsolutePathBuilder().path(created.getKey()).build(); return Response.created(location). header(RESTHeaders.RESOURCE_KEY, created.getKey()). build(); }
@Override public int hashCode() { return new HashCodeBuilder(). appendSuper(super.hashCode()). append(expression). build(); }
@Override public boolean equals(final Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final VirSchemaTO other = (VirSchemaTO) obj; return new EqualsBuilder(). appendSuper(super.equals(obj)). append(readonly, other.readonly). append(resource, other.resource). append(anyType, other.anyType). append(extAttrName, other.extAttrName). build(); } }
modelObject.getLabels().forEach((locale, display) -> { translations.getObject().add(MutablePair.of(locale, display)); });
private List<SchemaTO> getSchemas() { List<SchemaTO> schemas = restClient.getSchemas(this.schemaType, keyword); if (SchemaType.PLAIN == this.schemaType) { List<String> configurations = confRestClient.list().stream(). map(Attr::getSchema).collect(Collectors.toList()); schemas.removeIf(schema -> configurations.contains(schema.getKey())); } return schemas; }
@Override public int hashCode() { return new HashCodeBuilder(). appendSuper(super.hashCode()). append(expression). build(); }
@Override public boolean equals(final Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final VirSchemaTO other = (VirSchemaTO) obj; return new EqualsBuilder(). appendSuper(super.equals(obj)). append(readonly, other.readonly). append(resource, other.resource). append(anyType, other.anyType). append(extAttrName, other.extAttrName). build(); } }
private List<SchemaTO> customizeSchemas( final List<SchemaTO> schemaTOs, final String groupParam, final Map<String, CustomAttribute> customFormAttributes) { if (customFormAttributes.isEmpty()) { return schemaTOs; } final boolean isGroupBlank = StringUtils.isBlank(groupParam); schemaTOs.removeAll(schemaTOs.stream(). filter(schema -> !customFormAttributes.containsKey(isGroupBlank ? schema.getKey() : compositeSchemaKey(groupParam, schema.getKey()))). collect(Collectors.toSet())); Collections.sort(schemaTOs, (schemaTO1, schemaTO2) -> { List<String> order = new ArrayList<>(customFormAttributes.keySet()); return order.indexOf(isGroupBlank ? schemaTO1.getKey() : compositeSchemaKey(groupParam, schemaTO1.getKey())) - order.indexOf(isGroupBlank ? schemaTO2.getKey() : compositeSchemaKey(groupParam, schemaTO2.getKey())); }); return schemaTOs; }
@Override public int hashCode() { return new HashCodeBuilder(). appendSuper(super.hashCode()). append(type). append(mandatoryCondition). append(multivalue). append(uniqueConstraint). append(readonly). append(conversionPattern). append(validator). append(enumerationKeys). append(enumerationValues). append(secretKey). append(cipherAlgorithm). append(mimeType). build(); }
@Override public boolean equals(final Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final DerSchemaTO other = (DerSchemaTO) obj; return new EqualsBuilder(). appendSuper(super.equals(obj)). append(expression, other.expression). build(); } }
private List<SchemaTO> customizeSchemas( final List<SchemaTO> schemaTOs, final String groupParam, final Map<String, CustomAttribute> customFormAttributes) { if (customFormAttributes.isEmpty()) { return schemaTOs; } final boolean isGroupBlank = StringUtils.isBlank(groupParam); schemaTOs.removeAll(schemaTOs.stream(). filter(schema -> !customFormAttributes.containsKey(isGroupBlank ? schema.getKey() : compositeSchemaKey(groupParam, schema.getKey()))). collect(Collectors.toSet())); Collections.sort(schemaTOs, (schemaTO1, schemaTO2) -> { List<String> order = new ArrayList<>(customFormAttributes.keySet()); return order.indexOf(isGroupBlank ? schemaTO1.getKey() : compositeSchemaKey(groupParam, schemaTO1.getKey())) - order.indexOf(isGroupBlank ? schemaTO2.getKey() : compositeSchemaKey(groupParam, schemaTO2.getKey())); }); return schemaTOs; }