private void checkCustomModelNamespace(M2Model model, String tenantDomain) { if(tenantDomain != null && !tenantDomain.equals("") && enforceTenantInNamespace) { // check only for "real" tenants for(M2Namespace namespace : model.getNamespaces()) { String namespaceURI = namespace.getUri(); if(namespaceURI.indexOf(tenantDomain) == -1) { throw new DictionaryException("Namespace " + namespaceURI + " does not contain the tenant " + tenantDomain); } } } }
private void checkCustomModelNamespace(M2Model model, String tenantDomain) { if(tenantDomain != null && !tenantDomain.equals("") && enforceTenantInNamespace) { // check only for "real" tenants for(M2Namespace namespace : model.getNamespaces()) { String namespaceURI = namespace.getUri(); if(namespaceURI.indexOf(tenantDomain) == -1) { throw new DictionaryException("Namespace " + namespaceURI + " does not contain the tenant " + tenantDomain); } } } }
private Pair<String, String> getModelNamespaceUriPrefix(M2Model model) { ParameterCheck.mandatory("model", model); List<M2Namespace> namespaces = model.getNamespaces(); if (namespaces.isEmpty()) { throw new CustomModelException.InvalidNamespaceException(MSG_NAMESPACE_NOT_EXISTS, new Object[] { model.getName() }); } if (namespaces.size() > 1) { throw new CustomModelException.InvalidNamespaceException(MSG_NAMESPACE_MANY_EXIST, new Object[] { model.getName() }); } M2Namespace ns = namespaces.iterator().next(); return new Pair<>(ns.getUri(), ns.getPrefix()); }
private Pair<String, String> getModelNamespaceUriPrefix(M2Model model) { ParameterCheck.mandatory("model", model); List<M2Namespace> namespaces = model.getNamespaces(); if (namespaces.isEmpty()) { throw new CustomModelException.InvalidNamespaceException(MSG_NAMESPACE_NOT_EXISTS, new Object[] { model.getName() }); } if (namespaces.size() > 1) { throw new CustomModelException.InvalidNamespaceException(MSG_NAMESPACE_MANY_EXIST, new Object[] { model.getName() }); } M2Namespace ns = namespaces.iterator().next(); return new Pair<>(ns.getUri(), ns.getPrefix()); }
for (M2Namespace namespace : model.getNamespaces())
for (M2Namespace namespace : model.getNamespaces())
if(importedModel != null && !model.getNamespaces().isEmpty())
if(importedModel != null && !model.getNamespaces().isEmpty())