当前位置: 首页>>代码示例>>Java>>正文


Java SchemaEntry类代码示例

本文整理汇总了Java中org.xdi.model.SchemaEntry的典型用法代码示例。如果您正苦于以下问题:Java SchemaEntry类的具体用法?Java SchemaEntry怎么用?Java SchemaEntry使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


SchemaEntry类属于org.xdi.model包,在下文中一共展示了SchemaEntry类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getSAML2URI

import org.xdi.model.SchemaEntry; //导入依赖的package包/类
public String getSAML2URI(GluuAttribute attribute) {
	if (StringHelper.isNotEmpty(attribute.getSaml2Uri())) {
		return "SAML1 URI: " + attribute.getSaml2Uri();
	}
	List<String> attributeNames = new ArrayList<String>();
	attributeNames.add(attribute.getName());
	SchemaService shemaService = SchemaService.instance();
	SchemaEntry schemaEntry = shemaService.getSchema();
	List<AttributeTypeDefinition> attributeTypes = shemaService.getAttributeTypeDefinitions(schemaEntry, attributeNames);
	String attributeName = attribute.getName();

	AttributeTypeDefinition attributeTypeDefinition = shemaService.getAttributeTypeDefinition(attributeTypes, attributeName);
	if (attributeTypeDefinition == null) {
		log.error("Failed to get OID for attribute name {0}", attributeName);
		return null;
	}

	return "SAML2 URI: urn:oid:" + attributeTypeDefinition.getOID();
}
 
开发者ID:AgarwalNeha1,项目名称:gluu,代码行数:20,代码来源:UpdateTrustRelationshipAction.java

示例2: determineOrigin

import org.xdi.model.SchemaEntry; //导入依赖的package包/类
private String determineOrigin(String attributeName) {
	String[] objectClasses = ArrayHelper.arrayMerge(new String[] { "gluuPerson" }, appConfiguration.getPersonObjectClassTypes());

	SchemaEntry schemaEntry = schemaService.getSchema();

	for (String objectClass : objectClasses) {
		Set<String> attributeNames = schemaService.getObjectClassesAttributes(schemaEntry, new String[] { objectClass });
		String atributeNameToSearch = StringHelper.toLowerCase(attributeName);
		boolean contains = attributeNames.contains(atributeNameToSearch);
		if (contains) {
			return objectClass;
		}
	}

	log.error("Failed to determine object class by attribute name '{}'", attributeName);
	return null;
}
 
开发者ID:GluuFederation,项目名称:oxTrust,代码行数:18,代码来源:UpdateAttributeAction.java

示例3: getSAML2URI

import org.xdi.model.SchemaEntry; //导入依赖的package包/类
public String getSAML2URI(GluuAttribute attribute) {
	if (StringHelper.isNotEmpty(attribute.getSaml2Uri())) {
		return "SAML1 URI: " + attribute.getSaml2Uri();
	}
	List<String> attributeNames = new ArrayList<String>();
	attributeNames.add(attribute.getName());
	SchemaEntry schemaEntry = shemaService.getSchema();
	List<AttributeTypeDefinition> attributeTypes = shemaService.getAttributeTypeDefinitions(schemaEntry, attributeNames);
	String attributeName = attribute.getName();

	AttributeTypeDefinition attributeTypeDefinition = shemaService.getAttributeTypeDefinition(attributeTypes, attributeName);
	if (attributeTypeDefinition == null) {
		log.error("Failed to get OID for attribute name {}", attributeName);
		return null;
	}

	return "SAML2 URI: urn:oid:" + attributeTypeDefinition.getOID();
}
 
开发者ID:GluuFederation,项目名称:oxTrust,代码行数:19,代码来源:UpdateTrustRelationshipAction.java

示例4: addObjectClass

import org.xdi.model.SchemaEntry; //导入依赖的package包/类
/**
 * Add new object class with specified attributes
 * 
 * @param objectClass
 *            Object class name
 * @param attributeTypes
 *            Attribute types
 */
public void addObjectClass(String objectClass, String attributeTypes, String schemaAddObjectClassWithoutAttributeTypesDefinition, String schemaAddObjectClassWithAttributeTypesDefinition) {
	SchemaEntry schemaEntry = new SchemaEntry();
	schemaEntry.setDn(getDnForSchema());

	String objectClassDefinition;
	if (StringHelper.isEmpty(attributeTypes)) {
		objectClassDefinition = String.format(schemaAddObjectClassWithoutAttributeTypesDefinition,
				objectClass, objectClass);
	} else {
		objectClassDefinition = String.format(schemaAddObjectClassWithAttributeTypesDefinition,
				objectClass, objectClass, attributeTypes);
	}
	schemaEntry.addObjectClass(objectClassDefinition);

	log.debug("Adding new objectClass: {}", schemaEntry);
	ldapEntryManager.merge(schemaEntry);
}
 
开发者ID:GluuFederation,项目名称:oxCore,代码行数:26,代码来源:SchemaService.java

示例5: getAttributeTypeDefinitions

import org.xdi.model.SchemaEntry; //导入依赖的package包/类
public List<AttributeTypeDefinition> getAttributeTypeDefinitions(SchemaEntry schemaEntry, List<String> attributeNames) {
	if (schemaEntry == null) {
		return null;
	}

	String[] attrs = attributeNames.toArray(new String[attributeNames.size()]);
	for (int i = 0; i < attrs.length; i++) {
		attrs[i] = "'" + attrs[i].toLowerCase() + "'";
	}

	List<AttributeTypeDefinition> result = new ArrayList<AttributeTypeDefinition>();
	for (String attributeTypeDefinition : schemaEntry.getAttributeTypes()) {
		for (String name : attrs) {
			if (attributeTypeDefinition.toLowerCase().contains(name)) {
				try {
					result.add(new AttributeTypeDefinition(attributeTypeDefinition));
				} catch (Exception ex) {
					log.error("Failed to get attribute type definition by string {}", ex, attributeTypeDefinition);
				}
			}
		}
	}

	return result;
}
 
开发者ID:GluuFederation,项目名称:oxCore,代码行数:26,代码来源:SchemaService.java

示例6: getObjectClassDefinition

import org.xdi.model.SchemaEntry; //导入依赖的package包/类
/**
 * Get object class schema definition string
 * 
 * @param schemaEntry
 *            Schema
 * @param objectClass
 *            Object class name
 * @return Object class schema definition string
 */
public String getObjectClassDefinition(SchemaEntry schemaEntry, String objectClass) {
	if ((schemaEntry == null) || (objectClass == null)) {
		return null;
	}

	for (String objectClassDefinition : schemaEntry.getObjectClasses()) {
		ObjectClassDefinition definition;
		try {
			definition = new ObjectClassDefinition(objectClassDefinition);

			for (String name : definition.getNames()) {
				if (name.equalsIgnoreCase(objectClass)) {
					return objectClassDefinition;
				}
			}
		} catch (Exception ex) {
		}
	}

	return null;
}
 
开发者ID:GluuFederation,项目名称:oxCore,代码行数:31,代码来源:SchemaService.java

示例7: getObjectClassesAttributes

import org.xdi.model.SchemaEntry; //导入依赖的package包/类
/**
 * Get all attribute names by specified object classes
 * 
 * @param schemaEntry
 *            Schema
 * @param objectClass
 *            Object class name
 * @return Object class schema definition string
 */
public Set<String> getObjectClassesAttributes(SchemaEntry schemaEntry, String[] objectClasses) {
	if ((schemaEntry == null) || (objectClasses == null)) {
		return null;
	}

	Map<String, ObjectClassDefinition> objectClassDefinitions = new HashMap<String, ObjectClassDefinition>();
	for (String objectClassDefinition : schemaEntry.getObjectClasses()) {
		ObjectClassDefinition definition;
		try {
			definition = new ObjectClassDefinition(objectClassDefinition);

			for (String name : definition.getNames()) {
				objectClassDefinitions.put(StringHelper.toLowerCase(name), definition);
			}
		} catch (Exception ex) {
			log.error("Failed to parse LDAP object class definition: '{}'", ex, objectClassDefinition);
		}
	}

	Set<ObjectClassDefinition> resultObjectClassDefinitions = getSuperiorClasses(objectClassDefinitions, objectClasses, true);
	Set<String> resultAttributes = getAttributes(resultObjectClassDefinitions, true, true);

	return resultAttributes;
}
 
开发者ID:GluuFederation,项目名称:oxCore,代码行数:34,代码来源:SchemaService.java

示例8: containsAttributeInGluuObjectClasses

import org.xdi.model.SchemaEntry; //导入依赖的package包/类
private boolean containsAttributeInGluuObjectClasses(String attributeName) {
	String[] objectClasses = { "gluuPerson", attributeService.getCustomOrigin() };

	SchemaEntry schemaEntry = schemaService.getSchema();
	Set<String> attributeNames = schemaService.getObjectClassesAttributes(schemaEntry, objectClasses);

	String atributeNameToSearch = StringHelper.toLowerCase(attributeName);
	boolean result = attributeNames.contains(atributeNameToSearch);

	return result;
}
 
开发者ID:AgarwalNeha1,项目名称:gluu,代码行数:12,代码来源:UpdateAttributeAction.java

示例9: containsAttributeInGluuObjectClasses

import org.xdi.model.SchemaEntry; //导入依赖的package包/类
private boolean containsAttributeInGluuObjectClasses(String attributeName) {
	String[] objectClasses = ArrayHelper.arrayMerge(new String[] { "gluuPerson" }, appConfiguration.getPersonObjectClassTypes());

	SchemaEntry schemaEntry = schemaService.getSchema();
	Set<String> attributeNames = schemaService.getObjectClassesAttributes(schemaEntry, objectClasses);

	String atributeNameToSearch = StringHelper.toLowerCase(attributeName);
	boolean result = attributeNames.contains(atributeNameToSearch);

	return result;
}
 
开发者ID:GluuFederation,项目名称:oxTrust,代码行数:12,代码来源:UpdateAttributeAction.java

示例10: removeObjectClass

import org.xdi.model.SchemaEntry; //导入依赖的package包/类
/**
 * Remove object class
 * 
 * @param objectClass
 *            Object class name
 */
public void removeObjectClass(String objectClass) {
	SchemaEntry schema = getSchema();

	String objectClassDefinition = getObjectClassDefinition(schema, objectClass);
	if (objectClassDefinition != null) {
		removeObjectClassWithDefinition(objectClassDefinition);
	}
}
 
开发者ID:GluuFederation,项目名称:oxCore,代码行数:15,代码来源:SchemaService.java

示例11: removeObjectClassWithDefinition

import org.xdi.model.SchemaEntry; //导入依赖的package包/类
private void removeObjectClassWithDefinition(String objectClassDefinition) {
	SchemaEntry schemaEntry = new SchemaEntry();
	schemaEntry.setDn(getDnForSchema());
	schemaEntry.addObjectClass(objectClassDefinition);

	log.debug("Removing objectClass: {}", schemaEntry);
	ldapEntryManager.remove(schemaEntry);
}
 
开发者ID:GluuFederation,项目名称:oxCore,代码行数:9,代码来源:SchemaService.java

示例12: removeAttributeTypeFromObjectClass

import org.xdi.model.SchemaEntry; //导入依赖的package包/类
/**
 * Remove attribute type from object class
 * 
 * @param objectClass
 *            Object class name
 * @param attributeType
 *            Attribute type name
 * @throws Exception
 */
public void removeAttributeTypeFromObjectClass(String objectClass, String attributeType) throws Exception {
	SchemaEntry schema = getSchema();

	String objectClassDefinition = getObjectClassDefinition(schema, objectClass);
	if (objectClassDefinition == null) {
		throw new InvalidSchemaUpdateException(String.format(
				"Can't add attributeType %s to objectClass %s because objectClass doesn't exist", attributeType, objectClass));
	}

	String attributeTypePattern = "$ " + attributeType + " ";
	int index = objectClassDefinition.indexOf(attributeTypePattern);
	if (index == -1) {
		attributeTypePattern = " " + attributeType + " $";
		index = objectClassDefinition.indexOf(attributeTypePattern);
		if (index == -1) {
			attributeTypePattern = " MAY ( " + attributeType + " )";
			index = objectClassDefinition.indexOf(attributeTypePattern);
			if (index == -1) {
				throw new InvalidSchemaUpdateException(String.format("Invalid objectClass definition format"));
			}
		}
	}

	String newObjectClassDefinition = objectClassDefinition.substring(0, index)
			+ objectClassDefinition.substring(index + attributeTypePattern.length());
	
	// Remove OC definition
	removeObjectClassWithDefinition(objectClassDefinition);

	// Add updated OC definition
	SchemaEntry schemaEntry = new SchemaEntry();
	schemaEntry.setDn(getDnForSchema());
	schemaEntry.addObjectClass(newObjectClassDefinition);

	log.debug("Removing attributeType from objectClass: {}", schemaEntry);
	ldapEntryManager.merge(schemaEntry);

}
 
开发者ID:GluuFederation,项目名称:oxCore,代码行数:48,代码来源:SchemaService.java

示例13: addStringAttribute

import org.xdi.model.SchemaEntry; //导入依赖的package包/类
/**
 * Add new attribute type
 */
public void addStringAttribute(String oid, String name, String schemaAddAttributeDefinition) throws Exception {
	log.info("getting a new instance SchemaEntry ");
	SchemaEntry schemaEntry = new SchemaEntry();
	log.info("setting the DN ");
	schemaEntry.setDn(getDnForSchema());
	log.info("adding attribute name ");
	log.info("applicationConfiguration.getSchemaAddAttributeDefinition() : ", schemaAddAttributeDefinition);
	log.info("oid : ", oid);
	log.info("name : ", name);
	schemaEntry.addAttributeType(String.format(schemaAddAttributeDefinition, oid, name));
	log.debug("Adding new attributeType: {}", schemaEntry);
	log.info("merging data");
	ldapEntryManager.merge(schemaEntry);
}
 
开发者ID:GluuFederation,项目名称:oxCore,代码行数:18,代码来源:SchemaService.java

示例14: removeStringAttribute

import org.xdi.model.SchemaEntry; //导入依赖的package包/类
/**
 * Remove string attribute
 * 
 * @param attributeType
 *            Attribute type name
 * @throws Exception
 */
public void removeStringAttribute(String attributeType) throws Exception {
	SchemaEntry schema = getSchema();

	String attributeTypeDefinition = getAttributeTypeDefinition(schema, attributeType);
	if (attributeTypeDefinition != null) {
		SchemaEntry schemaEntry = new SchemaEntry();
		schemaEntry.setDn(getDnForSchema());
		schemaEntry.addAttributeType(attributeTypeDefinition);

		log.debug("Removing attributeType: {}", schemaEntry);
		ldapEntryManager.remove(schemaEntry);

	}
}
 
开发者ID:GluuFederation,项目名称:oxCore,代码行数:22,代码来源:SchemaService.java

示例15: getAttributeTypeDefinition

import org.xdi.model.SchemaEntry; //导入依赖的package包/类
/**
 * Get attribute type schema definition string
 * 
 * @param schemaEntry
 *            Schema
 * @param attributeType
 *            Attribute type name
 * @return Attribute type schema definition string
 */
public String getAttributeTypeDefinition(SchemaEntry schemaEntry, String attributeType) {
	if ((schemaEntry == null) || (attributeType == null)) {
		return null;
	}

	String lowerCaseAttributeType = StringHelper.toLowerCase(attributeType);

	List<AttributeTypeDefinition> attributeTypes = getAttributeTypeDefinitions(schemaEntry,
			Arrays.asList(new String[] { lowerCaseAttributeType }));
	AttributeTypeDefinition attributeTypeDefinition = getAttributeTypeDefinition(attributeTypes, lowerCaseAttributeType);

	return (attributeTypeDefinition == null) ? null : attributeTypeDefinition.toString();
}
 
开发者ID:GluuFederation,项目名称:oxCore,代码行数:23,代码来源:SchemaService.java


注:本文中的org.xdi.model.SchemaEntry类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。