public class XMLValidationLayer extends Object implements ValidationLayer
An XML ValidationLayer based on two xml files, elements.xml
,
and product-type-element-map.xml
.
Constructor and Description |
---|
XMLValidationLayer(List<String> uris) |
Modifier and Type | Method and Description |
---|---|
void |
addElement(Element element)
Adds the
Element to the ValidationLayer. |
void |
addElementToProductType(ProductType type,
Element element)
|
void |
addParentForProductType(ProductType type,
String parentId)
Sets a parentId for an existing
ProductType |
Element |
getElementById(String elementId)
Gets an element by its String identifier.
|
Element |
getElementByName(String elementName)
Gets an element by its String name.
|
List<Element> |
getElements() |
List<Element> |
getElements(ProductType type)
|
List<Element> |
getElements(ProductType type,
boolean direct)
Returns the declared elements for a
ProductType |
ConcurrentHashMap<String,String> |
getSubToSuperMap()
Gets the parent-child relationship between product types
|
void |
modifyElement(Element element)
Modifies an existing
Element in the ValidationLayer. |
void |
removeElement(Element element)
Removes a metadata
Element from the ValidationLayer. |
void |
removeElementFromProductType(ProductType type,
Element element)
Removes a metadata
Element from the specified
productTypeId . |
void |
removeParentForProductType(ProductType type)
Removes the parent for a
ProductType |
public void addElement(Element element) throws ValidationLayerException
ValidationLayer
Adds the Element
to the ValidationLayer.
addElement
in interface ValidationLayer
element
- The element to add.ValidationLayerException
- If any error occurs during the add.public void modifyElement(Element element) throws ValidationLayerException
ValidationLayer
Modifies an existing Element
in the ValidationLayer.
modifyElement
in interface ValidationLayer
element
- The new Element
data to update.ValidationLayerException
- If any error occurs.public void removeElement(Element element) throws ValidationLayerException
ValidationLayer
Removes a metadata Element
from the ValidationLayer.
removeElement
in interface ValidationLayer
element
- The element to remove.ValidationLayerException
- If any error occurs.public void addElementToProductType(ProductType type, Element element) throws ValidationLayerException
ValidationLayer
Adds the specified element
to the ProductType
specified by its productTypeId
.
addElementToProductType
in interface ValidationLayer
type
- The ProductType
to associate the metadata Element
with.element
- The Element
to associate with the ProductType.ValidationLayerException
- If any error occurs.public void removeElementFromProductType(ProductType type, Element element) throws ValidationLayerException
ValidationLayer
Removes a metadata Element
from the specified
productTypeId
.
removeElementFromProductType
in interface ValidationLayer
type
- The ProductType
to remove the association of the
specified element
with.element
- The element whose association will be removed from the
specified ProductType.ValidationLayerException
- If any error occurs.public List<Element> getElements(ProductType type) throws ValidationLayerException
ValidationLayer
getElements
in interface ValidationLayer
type
- The product type to retrieve the metadata Element
s
for.List
of Element
s corresponding to the given
ProductType.ValidationLayerException
- If any error occurs.public List<Element> getElements() throws ValidationLayerException
getElements
in interface ValidationLayer
List
of all the metadata Element
s in the
ValidationLayer.ValidationLayerException
- If any error occurs.public Element getElementById(String elementId) throws ValidationLayerException
ValidationLayer
getElementById
in interface ValidationLayer
elementId
- The String identifier of the Element
to get.Element
by its String identifier.ValidationLayerException
- If any error occurs.public Element getElementByName(String elementName) throws ValidationLayerException
ValidationLayer
getElementByName
in interface ValidationLayer
elementName
- The String name of the Element
to get.Element
by its String name.ValidationLayerException
- If any error occurs.public List<Element> getElements(ProductType type, boolean direct)
ProductType
type
- The ProductType
to get the elements fordirect
- If false, return elements of the parent product types as wellElement
of the Product typeValidationLayerException
- If any error occurspublic ConcurrentHashMap<String,String> getSubToSuperMap()
ProductType
ids mapped to their parent idpublic void addParentForProductType(ProductType type, String parentId)
ProductType
type
- The ProductType
to add a parent forparentId
- The id of the parent ProductType
ValidationLayerException
- If any error occurspublic void removeParentForProductType(ProductType type)
ProductType
type
- The ProductType
to remove the parent fromValidationLayerException
- If any error occursCopyright © 1999–2017 Apache OODT. All rights reserved.