@Override public String toString() { return "TEntityType{" + "description='" + getDescription() + '\'' + ", version=" + getVersion() + ", derivedFrom=" + getDerivedFrom() + ", properties=" + getProperties() + ", attributes=" + getAttributes() + ", metadata=" + getMetadata() + '}'; }
public TEntityType build() { return new TEntityType(this); } }
public <R extends AbstractResult<R>, P extends AbstractParameter<P>> R accept(IVisitor<R, P> visitor, P parameter) { return super.accept(visitor, parameter); }
@Override public R visit(TEntityType node, P parameter) { return reduce(Stream.of( visitElement(node.getVersion(), parameter, "version"), visitElement(node.getProperties(), parameter, "properties"), visitElement(node.getAttributes(), parameter, "attributes"), visitElement(node.getMetadata(), parameter, "metadata") )); }
@Override public Result visit(TEntityType node, Parameter parameter) { if (node.getDerivedFrom() != null) { return serviceTemplate.accept(this, new Parameter(node.getDerivedFrom(), parameter.entityClass)).copy(node, node.getDerivedFrom()); } return new Result(node); }
@Override public Result visit(TEntityType node, Parameter parameter) { if (node instanceof TDataType || node.getProperties().isEmpty()) { return null; } // BuildPlan for assignments Map<String, QName> plan = new LinkedHashMap<>(); String name = parameter.getKey() + "_Properties"; SchemaBuilder builder = new SchemaBuilder(parameter.getNamespace()); Map<String, String> imports = new LinkedHashMap<>(); for (Map.Entry<String, TPropertyDefinition> entry : node.getProperties().entrySet()) { builder.addElements(entry.getKey(), entry.getValue()); QName type = entry.getValue().getType(); if (type.getNamespaceURI() != null && !type.getNamespaceURI().equals(Namespaces.YAML_NS)) { imports.put(type.getNamespaceURI(), type.getLocalPart()); } plan.put(entry.getKey(), entry.getValue().getType()); } imports.forEach((key, value) -> builder.addImports(key, getRelativeFileName(key))); Document document = builder.buildComplexType(name, true).build(); WriterUtils.saveType(document, parameter.getPath(), parameter.getNamespace(), name); WriterUtils.storeTypes(parameter.getPath(), name, parameter.getNamespace(), name); this.propertyDefinition.put(new QName(parameter.getNamespace(), name), plan); return null; }
@Override public boolean equals(Object o) { if (this == o) return true; if (!(o instanceof TCapabilityType)) return false; if (!super.equals(o)) return false; TCapabilityType that = (TCapabilityType) o; return Objects.equals(getValidSourceTypes(), that.getValidSourceTypes()); }
private void validateEntityType(TEntityType node, Parameter parameter, Map<String, List<String>> types) { if (Objects.nonNull(node.getDerivedFrom())) { validateTypeIsDefined(node.getDerivedFrom(), types, parameter.copy().addContext("derived_from")); } }
@Override public boolean equals(Object o) { if (this == o) return true; if (!(o instanceof TDataType)) return false; if (!super.equals(o)) return false; TDataType dataType = (TDataType) o; return Objects.equals(getConstraints(), dataType.getConstraints()); }
public Builder(TEntityType entityType) { this.description = entityType.getDescription(); this.version = entityType.getVersion(); this.derivedFrom = entityType.getDerivedFrom(); this.properties = entityType.getProperties(); this.attributes = entityType.getAttributes(); this.metadata = entityType.getMetadata(); }
public <R extends AbstractResult<R>, P extends AbstractParameter<P>> R accept(IVisitor<R, P> visitor, P parameter) { R ir1 = super.accept(visitor, parameter); R ir2 = visitor.visit(this, parameter); if (ir1 == null) { return ir2; } else { return ir1.add(ir2); } }
@Override public boolean equals(Object o) { if (this == o) return true; if (!(o instanceof TRelationshipType)) return false; if (!super.equals(o)) return false; TRelationshipType that = (TRelationshipType) o; return Objects.equals(getValidTargetTypes(), that.getValidTargetTypes()) && Objects.equals(getInterfaces(), that.getInterfaces()); }
@Override public int hashCode() { return Objects.hash(getDescription(), getVersion(), getDerivedFrom(), getProperties(), getAttributes(), getMetadata()); }
public <R extends AbstractResult<R>, P extends AbstractParameter<P>> R accept(IVisitor<R, P> visitor, P parameter) { R ir1 = super.accept(visitor, parameter); R ir2 = visitor.visit(this, parameter); if (ir1 == null) { return ir2; } else { return ir1.add(ir2); } }
@Override public boolean equals(Object o) { if (this == o) return true; if (!(o instanceof TInterfaceType)) return false; if (!super.equals(o)) return false; TInterfaceType that = (TInterfaceType) o; return Objects.equals(getOperations(), that.getOperations()) && Objects.equals(getInputs(), that.getInputs()); }
@Override public boolean equals(Object o) { if (this == o) return true; if (!(o instanceof TEntityType)) return false; TEntityType that = (TEntityType) o; return Objects.equals(getDescription(), that.getDescription()) && Objects.equals(getVersion(), that.getVersion()) && Objects.equals(getDerivedFrom(), that.getDerivedFrom()) && Objects.equals(getProperties(), that.getProperties()) && Objects.equals(getAttributes(), that.getAttributes()) && Objects.equals(getMetadata(), that.getMetadata()); }
public <R extends AbstractResult<R>, P extends AbstractParameter<P>> R accept(IVisitor<R, P> visitor, P parameter) { R ir1 = super.accept(visitor, parameter); R ir2 = visitor.visit(this, parameter); if (ir1 == null) { return ir2; } else { return ir1.add(ir2); } }
@Override public boolean equals(Object o) { if (this == o) return true; if (!(o instanceof TArtifactType)) return false; if (!super.equals(o)) return false; TArtifactType that = (TArtifactType) o; return Objects.equals(getMimeType(), that.getMimeType()) && Objects.equals(getFileExt(), that.getFileExt()); }
public Printer visit(TEntityType node, Parameter parameter) { return new Printer(parameter.getIndent()) .printKeyValue("description", node.getDescription()) .printKeyValue("version", node.getVersion()) .printKeyValue("derived_from", node.getDerivedFrom()) .print(printMap("properties", node.getProperties(), parameter)) .print(printMap("attributes", node.getAttributes(), parameter)) .print(node.getMetadata().accept(this, parameter)); }
public <R extends AbstractResult<R>, P extends AbstractParameter<P>> R accept(IVisitor<R, P> visitor, P parameter) { R ir1 = super.accept(visitor, parameter); R ir2 = visitor.visit(this, parameter); if (ir1 == null) { return ir2; } else { return ir1.add(ir2); } }