public Name getName() { return delegate.getName(); }
private void setPathIndex(Attribute att, StepList sl) { Object index = att.getUserData().get(ComplexFeatureConstants.MAPPED_ATTRIBUTE_INDEX); if (index != null) { int mappedIndex = Integer.parseInt(String.valueOf(index)); // get prefixed attribute name Name attName = att.getName(); String nsPrefix = namespaces.getPrefix(attName.getNamespaceURI()); String xpath = nsPrefix + ":" + attName.getLocalPart(); // set the index of the attribute in the attribute mapping steps sl.setIndex(mappedIndex, xpath, XPATH_SEPARATOR); } }
if (a.getName().equals(ad.getName())) { occurences++; citr.remove();
private void setValues( Object value, Attribute setterTarget, Pair parentPair, AttributeMapping attMapping, Feature target, StepList xpath, Expression idExpression) throws IOException { if (LOGGER.isLoggable(Level.FINER)) { LOGGER.finer( "setting target=" + setterTarget.getName() + ", targetXpath=" + attMapping.getTargetXPath() + ", value=" + value); } String featureId = getId(idExpression, parentPair, attMapping, ""); // Attribute att = xpathAttributeBuilder.set(target, // xpath, value, featureId, attMapping.getTargetNodeInstance(), false, // attMapping // .getSourceExpression()); Attribute att = setAttributeValue(target, featureId, null, attMapping, value, xpath, null); setClientProperties(att, parentPair.getXpath(), attMapping.getClientProperties()); }
XSDParticle particle(Attribute att) { XSDFactory factory = XSDFactory.eINSTANCE; AttributeType attType = att.getType(); XSDTypeDefinition xsdType = schemaIndex.getTypeDefinition( new QName( attType.getName().getNamespaceURI(), attType.getName().getLocalPart())); XSDElementDeclaration element = factory.createXSDElementDeclaration(); element.setName(att.getName().getLocalPart()); element.setTargetNamespace(att.getName().getNamespaceURI()); element.setTypeDefinition(xsdType); XSDParticle particle = factory.createXSDParticle(); particle.setContent(element); return particle; } }
public Name getName() { return delegate.getName(); }
att.getIdentifier() == null ? null : att.getIdentifier().toString(), att.getValue(), att.getName()); } else if (property instanceof Association) { Association assoc = (Association) property;
private void setPathIndex(Attribute att, StepList sl) { Object index = att.getUserData().get(ComplexFeatureConstants.MAPPED_ATTRIBUTE_INDEX); if (index != null) { int mappedIndex = Integer.parseInt(String.valueOf(index)); // get prefixed attribute name Name attName = att.getName(); String nsPrefix = namespaces.getPrefix(attName.getNamespaceURI()); String xpath = nsPrefix + ":" + attName.getLocalPart(); // set the index of the attribute in the attribute mapping steps sl.setIndex(mappedIndex, xpath, XPATH_SEPARATOR); } }
/** * Encode a simple attribute, this means that this property will be encoded as a simple JSON * attribute. */ private void encodeSimpleAttribute(Attribute attribute, Map<NameImpl, String> attributes) { String name = attribute.getName().getLocalPart(); Object value = attribute.getValue(); encodeSimpleAttribute(name, value, attributes); }
private static void processAll(Collection/* <AttributeDescriptor> */all, Collection/* * <Attribute> */content) throws IllegalAttributeException { // TODO: JD: this can be definitley be optimzed, as written its O(n^2) // for each descriptor, count occurences of each matching attribute ArrayList remaining = new ArrayList(content); for (Iterator itr = all.iterator(); itr.hasNext();) { AttributeDescriptor ad = (AttributeDescriptor) itr.next(); int min = ad.getMinOccurs(); int max = ad.getMaxOccurs(); int occurences = 0; for (Iterator citr = remaining.iterator(); citr.hasNext();) { Attribute a = (Attribute) citr.next(); if (a.getName().equals(ad.getName())) { occurences++; citr.remove(); } } if (occurences < ad.getMinOccurs() || occurences > ad.getMaxOccurs()) { throw new IllegalAttributeException(ad, "Found " + occurences + " of " + ad.getName() + " when type" + "specifies between " + min + " and " + max); } } if (!remaining.isEmpty()) { throw new IllegalAttributeException((AttributeDescriptor) remaining.iterator().next(), "Extra content found beyond the specified in the schema: " + remaining); } }
private void setValues(Object value, Attribute setterTarget, Pair parentPair, AttributeMapping attMapping, Feature target, StepList xpath, Expression idExpression) throws IOException { if (LOGGER.isLoggable(Level.FINER)) { LOGGER.finer("setting target=" + setterTarget.getName() + ", targetXpath=" + attMapping.getTargetXPath() + ", value=" + value); } String featureId = getId(idExpression, parentPair, attMapping, ""); // Attribute att = xpathAttributeBuilder.set(target, // xpath, value, featureId, attMapping.getTargetNodeInstance(), false, attMapping // .getSourceExpression()); Attribute att = setAttributeValue(target, featureId, null, attMapping, value, xpath, null); setClientProperties(att, parentPair.getXpath(), attMapping.getClientProperties()); }
XSDParticle particle(Attribute att) { XSDFactory factory = XSDFactory.eINSTANCE; AttributeType attType = att.getType(); XSDTypeDefinition xsdType = schemaIndex.getTypeDefinition( new QName(attType.getName().getNamespaceURI(), attType.getName().getLocalPart())); XSDElementDeclaration element = factory.createXSDElementDeclaration(); element.setName(att.getName().getLocalPart()); element.setTargetNamespace(att.getName().getNamespaceURI()); element.setTypeDefinition(xsdType); XSDParticle particle = factory.createXSDParticle(); particle.setContent(element); return particle; }
for (TreeNode node : nodes) { Attribute att = buildNode(node); fb.append(substitutionMap.get(att.getName()), att);
Attribute att = (Attribute) property; add(att.getIdentifier() == null ? null : att.getIdentifier().toString(), att .getValue(), att.getName()); } else if (property instanceof Association) { Association assoc = (Association) property;