public String getName() throws Exception { Attr attrNode = (Attr) this.getTemplateAttributes() .getNamedItem(TransformInfoObjectConfigData.getInstance().NAME); return attrNode.getValue(); }
private NamedNodeMap getTemplateAttributes() throws Exception { Node componentNode = this.document .getElementsByTagName(TransformInfoObjectConfigData.getInstance().NAME) .item(0); return componentNode.getAttributes(); }
public void setName(String name) throws Exception { Attr attrNode = (Attr) this.getTemplateAttributes() .getNamedItem(TransformInfoObjectConfigData.getInstance().NAME); attrNode.setValue(name); }
private void createDocument() { this.document = DomDocumentHelper.create(); Node objectConfigNode = document.createElement(TransformInfoObjectConfigData.getInstance().NAME); this.document.appendChild(objectConfigNode); }
public TransformInfoObjectConfigInterface getInstance( TransformInfoInterface transformInfoInterface, AbPath objectConfigFileAbPath) throws Exception { try { String data = new CryptFileReader( TransformInfoObjectConfigData.getInstance().UNCRYPTED_EXTENSION, TransformInfoObjectConfigData.getInstance().ENCRYPTED_EXTENSION) .get(objectConfigFileAbPath); return this.getInstance(transformInfoInterface, DomDocumentHelper.create(data)); } catch (Exception e) { if (abcs.logic.communication.log.config.type.LogConfigTypes.LOGGING.contains( abcs.logic.communication.log.config.type.LogConfigType.VIEWERROR)) { LogUtil.put( LogFactory.getInstance( "Could Not Load Object Config", getInstance(), "getInstance()", e)); } throw e; } }
public TransformInfoObjectConfig( TransformInfoInterface transformInfoInterface, String name, String type) throws Exception { this.ownerTransformInfoInterface = transformInfoInterface; this.createDocument(); Attr configNameAttr = this.document.createAttribute(TransformInfoObjectConfigData.getInstance().NAME); configNameAttr.setValue(name); Node objectConfigNode = this.document .getElementsByTagName(TransformInfoObjectConfigData.getInstance().NAME) .item(0); objectConfigNode.appendChild(configNameAttr); if (abcs.logic.communication.log.config.type.LogConfigTypes.LOGGING.contains( abcs.logic.communication.log.config.type.LogConfigType.VIEW)) { StringBuffer stringBuffer = new StringBuffer(); stringBuffer.append("TransformInfo: "); if (this.ownerTransformInfoInterface != null) { stringBuffer.append(this.ownerTransformInfoInterface.getName()); } else { stringBuffer.append("No Owner!?#@"); } stringBuffer.append("\nConstructed with document: "); stringBuffer.append(this.toString()); LogUtil.put( LogFactory.getInstance( stringBuffer.toString(), this, "Constructor(TransformInfoInterface, name, type)")); } }
// Looks to see if view is in this TransformInfoObjectConfig // Usually used for updating a sites templates public boolean containsView(TransformInfoInterface transformInfoInterface) { Node objectConfigNode = this.document .getElementsByTagName(TransformInfoObjectConfigData.getInstance().NAME) .item(0); NodeList viewNodeList = objectConfigNode.getChildNodes(); int numberOfViews = viewNodeList.getLength(); for (int index = 0; index < numberOfViews; index++) { Node viewNode = viewNodeList.item(index); NamedNodeMap viewAttributes = viewNode.getAttributes(); Attr attrNode = (Attr) viewAttributes.getNamedItem(TransformInfoData.getInstance().NAME); if (transformInfoInterface.getName().compareTo(attrNode.getValue()) == 0) { return true; } } return false; }
private Node getRootNode() { return this.document .getElementsByTagName(TransformInfoObjectConfigData.getInstance().NAME) .item(0); }