public TransformInfoObjectConfigInterface getInstance( TransformInfoInterface transformInfoInterface, Document document) throws Exception { try { StringValidationUtil stringValidationUtil = StringValidationUtil.getInstance(); // Maybe not the best way to create the correct object if (transformInfoInterface != null && !stringValidationUtil.isEmpty(transformInfoInterface.getStoreName())) { return (TransformInfoObjectConfigInterface) new GenericStoreTransformInfoObjectConfig(transformInfoInterface, document); } else { return (TransformInfoObjectConfigInterface) new TransformInfoObjectConfig(transformInfoInterface, document); } } catch (Exception e) { String error = "Failed To Get Instance: "; if (transformInfoInterface != null) { error = error + transformInfoInterface.getName(); } if (abcs.logic.communication.log.config.type.LogConfigTypes.LOGGING.contains( abcs.logic.communication.log.config.type.LogConfigType.TAGHELPERFACTORYERROR)) { LogUtil.put(LogFactory.getInstance(error, getInstance(), "getInstance(document)", e)); } throw e; } }
// 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; }