本文整理汇总了Java中org.identityconnectors.framework.common.objects.Attribute类的典型用法代码示例。如果您正苦于以下问题:Java Attribute类的具体用法?Java Attribute怎么用?Java Attribute使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Attribute类属于org.identityconnectors.framework.common.objects包,在下文中一共展示了Attribute类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: createRandkeyTest
import org.identityconnectors.framework.common.objects.Attribute; //导入依赖的package包/类
@Test
public void createRandkeyTest() {
logger.info("Running Create Randkey Test");
final String principal = "host/[email protected]" + realm;
final String policy = "default_nohistory";
final ConnectorFacade facade = getFacade(KerberosConnector.class, null);
ConnectorObject co;
Set<Attribute> createAttributes = new HashSet<Attribute>();
createAttributes.add(new Name(principal));
createAttributes.add(AttributeBuilder.build("policy", policy));
createAttributes.add(AttributeBuilder.build("requiresPreauth", true));
Uid uid = facade.create(ObjectClass.ACCOUNT, createAttributes, null);
Assert.assertEquals(uid.getUidValue(), principal);
co = facade.getObject(ObjectClass.ACCOUNT, new Uid(principal), null);
Assert.assertNotNull(co);
Assert.assertTrue(AttributeUtil.getBooleanValue(co.getAttributeByName("requiresPreauth")));
Assert.assertEquals((int)AttributeUtil.getIntegerValue(co.getAttributeByName("attributes")), 128);
Assert.assertEquals(AttributeUtil.getStringValue(co.getAttributeByName("policy")), policy);
}
开发者ID:CESNET,项目名称:kerberos-connector,代码行数:23,代码来源:KerberosConnectorTests.java
示例2: renameTest
import org.identityconnectors.framework.common.objects.Attribute; //导入依赖的package包/类
@Test
public void renameTest() {
logger.info("Running Update Name Test");
final String principal = "[email protected]" + realm;
final String newPrincipal = "[email protected]" + realm;
final Uid testUid = new Uid(principal);
Uid uid;
final ConnectorFacade facade = getFacade(KerberosConnector.class, null);
final OperationOptionsBuilder builder = new OperationOptionsBuilder();
Set<Attribute> updateAttributes = new HashSet<Attribute>();
updateAttributes.add(new Name(newPrincipal));
uid = facade.update(ObjectClass.ACCOUNT, testUid, updateAttributes, builder.build());
Assert.assertEquals(uid.getUidValue(), newPrincipal);
ConnectorObject co = facade.getObject(ObjectClass.ACCOUNT, new Uid(newPrincipal), null);
Assert.assertNotNull(co);
Assert.assertEquals(co.getName().getNameValue(), newPrincipal);
}
开发者ID:CESNET,项目名称:kerberos-connector,代码行数:21,代码来源:KerberosConnectorTests.java
示例3: updatePolicyTest
import org.identityconnectors.framework.common.objects.Attribute; //导入依赖的package包/类
@Test
public void updatePolicyTest() {
logger.info("Running Update Policy Test");
final String principal = "[email protected]" + realm;
final Uid testUid = new Uid(principal);
Uid uid;
final ConnectorFacade facade = getFacade(KerberosConnector.class, null);
Set<Attribute> updateAttributes = new HashSet<Attribute>();
updateAttributes.add(AttributeBuilder.build("policy", "mypolicy"));
uid = facade.update(ObjectClass.ACCOUNT, testUid, updateAttributes, null);
Assert.assertEquals(uid.getUidValue(), principal);
ConnectorObject co = facade.getObject(ObjectClass.ACCOUNT, testUid, null);
Assert.assertNotNull(co);
Assert.assertEquals(co.getAttributeByName("policy").getValue().get(0), "mypolicy");
// clear policy
updateAttributes = new HashSet<Attribute>();
updateAttributes.add(AttributeBuilder.build("policy"));
uid = facade.update(ObjectClass.ACCOUNT, testUid, updateAttributes, null);
Assert.assertEquals(uid.getUidValue(), principal);
co = facade.getObject(ObjectClass.ACCOUNT, testUid, null);
Assert.assertNotNull(co);
Assert.assertNull(co.getAttributeByName("policy").getValue().get(0));
}
开发者ID:CESNET,项目名称:kerberos-connector,代码行数:27,代码来源:KerberosConnectorTests.java
示例4: updateLife
import org.identityconnectors.framework.common.objects.Attribute; //导入依赖的package包/类
@Test
public void updateLife() {
logger.info("Running Update Ticket/Renew Life Test");
final String principal = "[email protected]" + realm;
final long maxTicket = 1000 * 3600 * 4;
final long maxRenew = 1000 * 3600 * 24;
final Uid testUid = new Uid(principal);
Uid uid;
ConnectorObject co;
final ConnectorFacade facade = getFacade(KerberosConnector.class, null);
Set<Attribute> updateAttributes;
updateAttributes = new HashSet<Attribute>();
updateAttributes.add(AttributeBuilder.build("maxTicketLife", maxTicket));
updateAttributes.add(AttributeBuilder.build("maxRenewableLife", maxRenew));
uid = facade.update(ObjectClass.ACCOUNT, testUid, updateAttributes, null);
Assert.assertEquals(uid.getUidValue(), principal);
co = facade.getObject(ObjectClass.ACCOUNT, testUid, null);
Assert.assertNotNull(co);
Assert.assertEquals(co.getAttributeByName("maxTicketLife").getValue().get(0), maxTicket);
Assert.assertEquals(co.getAttributeByName("maxRenewableLife").getValue().get(0), maxRenew);
}
开发者ID:CESNET,项目名称:kerberos-connector,代码行数:24,代码来源:KerberosConnectorTests.java
示例5: changePasswordTest
import org.identityconnectors.framework.common.objects.Attribute; //导入依赖的package包/类
@Test
public void changePasswordTest() {
logger.info("Running Change Password Test");
final String principal = "[email protected]" + realm;
final Uid testUid = new Uid(principal);
Uid uid;
ConnectorObject co;
final ConnectorFacade facade = getFacade(KerberosConnector.class, null);
Set<Attribute> attrs;
attrs = new HashSet<Attribute>();
attrs.add(AttributeBuilder.buildPassword("new-password".toCharArray()));
uid = facade.update(ObjectClass.ACCOUNT, testUid, attrs, null);
Assert.assertEquals(uid.getUidValue(), principal);
co = facade.getObject(ObjectClass.ACCOUNT, testUid, null);
Assert.assertNotNull(co);
// empty password not supported: ConnId expect always non-empty password
//attrs.add(AttributeBuilder.build(OperationalAttributes.PASSWORD_NAME));
}
开发者ID:CESNET,项目名称:kerberos-connector,代码行数:22,代码来源:KerberosConnectorTests.java
示例6: createEqualsExpression
import org.identityconnectors.framework.common.objects.Attribute; //导入依赖的package包/类
@Override
protected SapFilter createEqualsExpression(EqualsFilter filter, boolean not) {
LOG.ok("createEqualsExpression, filter: {0}, not: {1}", filter, not);
if (not) {
return null; // not supported attribute
}
Attribute attr = filter.getAttribute();
LOG.ok("attr.getId: {0}, attr.getValue: {1}", attr.getName(), attr.getValue());
// filter by NAME is the same as by UID
if (Name.NAME.equals(attr.getName()) || Uid.NAME.equals(attr.getName())) {
if (attr.getValue() != null && attr.getValue().get(0) != null) {
SapFilter lf = new SapFilter(String.valueOf(attr.getValue().get(0)));
return lf;
}
}
return null; // not supported attribute
}
开发者ID:Evolveum,项目名称:connector-sap,代码行数:21,代码来源:SapBasicFilterTranslator.java
示例7: Table
import org.identityconnectors.framework.common.objects.Attribute; //导入依赖的package包/类
public Table(Set<Attribute> attributes, String attrName) throws IOException, SAXException, ParserConfigurationException {
List<Object> items = null;
for (Attribute attr : attributes) {
if (attr.getName().startsWith(attrName)) {
update = true;
items = attr.getValue();
if (items != null) {
for (int i = 0; i < items.size(); i++) {
String item = (String) items.get(i);
if (item == null) {
throw new InvalidAttributeValueException("Value " + null + " must be not null for attribute " + attrName);
}
boolean isXml = item.startsWith("<?xml");
this.values.add(new Item(item, isXml, attrName));
}
}
}
}
LOG.ok("items in input: {0}, in output: {1}, update: {2} for attribute {3}", items, values, update, attrName);
}
开发者ID:Evolveum,项目名称:connector-sap,代码行数:23,代码来源:Table.java
示例8: createStartsWithExpression
import org.identityconnectors.framework.common.objects.Attribute; //导入依赖的package包/类
@Override
protected SapFilter createStartsWithExpression(StartsWithFilter filter, boolean not) {
LOG.ok("createStartsWithExpression, filter: {0}, not: {1}", filter, not);
Attribute attr = filter.getAttribute();
LOG.ok("attr.getId: {0}, attr.getValue: {1}", attr.getName(), attr.getValue());
if (notSupportedAttribute(attr.getName())) {
return null; // not supported attribute
}
if (notSupportedValue(attr.getValue())) {
return null; // not supported value/s
}
String operator = not ? SapFilter.OPERATOR_NOT_CONTAINS_PATTERN : SapFilter.OPERATOR_CONTAINS_PATTERN;
String like = (String) attr.getValue().get(0) + SapFilter.ANY_NUMBER_OF_CHARACTERS;
return new SapFilter(operator, attr.getName(), like);
}
开发者ID:Evolveum,项目名称:connector-sap,代码行数:19,代码来源:SapAccountFilterTranslator.java
示例9: createEndsWithExpression
import org.identityconnectors.framework.common.objects.Attribute; //导入依赖的package包/类
@Override
protected SapFilter createEndsWithExpression(EndsWithFilter filter, boolean not) {
LOG.ok("createEndsWithExpression, filter: {0}, not: {1}", filter, not);
Attribute attr = filter.getAttribute();
LOG.ok("attr.getId: {0}, attr.getValue: {1}", attr.getName(), attr.getValue());
if (notSupportedAttribute(attr.getName())) {
return null; // not supported attribute
}
if (notSupportedValue(attr.getValue())) {
return null; // not supported value/s
}
String operator = not ? SapFilter.OPERATOR_NOT_CONTAINS_PATTERN : SapFilter.OPERATOR_CONTAINS_PATTERN;
String like = SapFilter.ANY_NUMBER_OF_CHARACTERS + (String) attr.getValue().get(0);
return new SapFilter(operator, attr.getName(), like);
}
开发者ID:Evolveum,项目名称:connector-sap,代码行数:19,代码来源:SapAccountFilterTranslator.java
示例10: createGreaterThanExpression
import org.identityconnectors.framework.common.objects.Attribute; //导入依赖的package包/类
@Override
protected SapFilter createGreaterThanExpression(GreaterThanFilter filter, boolean not) {
LOG.ok("createGreaterThanExpression, filter: {0}, not: {1}", filter, not);
if (not) {
LOG.ok("not supported native SAP NOT GreaterThanExpression filter, filtering is performed over connector framework (slower)");
return null; // not supported
}
Attribute attr = filter.getAttribute();
LOG.ok("attr.getId: {0}, attr.getValue: {1}", attr.getName(), attr.getValue());
if (notSupportedAttribute(attr.getName())) {
return null; // not supported attribute
}
if (notSupportedValue(attr.getValue())) {
return null; // not supported value/s
}
String value = (String) attr.getValue().get(0);
return new SapFilter(SapFilter.OPERATOR_GREATER_THAN, attr.getName(), value);
}
开发者ID:Evolveum,项目名称:connector-sap,代码行数:22,代码来源:SapAccountFilterTranslator.java
示例11: createGreaterThanOrEqualExpression
import org.identityconnectors.framework.common.objects.Attribute; //导入依赖的package包/类
@Override
protected SapFilter createGreaterThanOrEqualExpression(GreaterThanOrEqualFilter filter, boolean not) {
LOG.ok("createGreaterThanOrEqualExpression, filter: {0}, not: {1}", filter, not);
if (not) {
LOG.ok("not supported native SAP NOT GreaterThanOrEqualExpression filter, filtering is performed over connector framework (slower)");
return null; // not supported
}
Attribute attr = filter.getAttribute();
LOG.ok("attr.getId: {0}, attr.getValue: {1}", attr.getName(), attr.getValue());
if (notSupportedAttribute(attr.getName())) {
return null; // not supported attribute
}
if (notSupportedValue(attr.getValue())) {
return null; // not supported value/s
}
String value = (String) attr.getValue().get(0);
return new SapFilter(SapFilter.OPERATOR_GREATER_EQUAL, attr.getName(), value);
}
开发者ID:Evolveum,项目名称:connector-sap,代码行数:22,代码来源:SapAccountFilterTranslator.java
示例12: createLessThanExpression
import org.identityconnectors.framework.common.objects.Attribute; //导入依赖的package包/类
@Override
protected SapFilter createLessThanExpression(LessThanFilter filter, boolean not) {
LOG.ok("createLessThanExpression, filter: {0}, not: {1}", filter, not);
if (not) {
LOG.ok("not supported native SAP NOT LessThanExpression filter, filtering is performed over connector framework (slower)");
return null; // not supported
}
Attribute attr = filter.getAttribute();
LOG.ok("attr.getId: {0}, attr.getValue: {1}", attr.getName(), attr.getValue());
if (notSupportedAttribute(attr.getName())) {
return null; // not supported attribute
}
if (notSupportedValue(attr.getValue())) {
return null; // not supported value/s
}
String value = (String) attr.getValue().get(0);
return new SapFilter(SapFilter.OPERATOR_LESS_THAN, attr.getName(), value);
}
开发者ID:Evolveum,项目名称:connector-sap,代码行数:22,代码来源:SapAccountFilterTranslator.java
示例13: createLessThanOrEqualExpression
import org.identityconnectors.framework.common.objects.Attribute; //导入依赖的package包/类
@Override
protected SapFilter createLessThanOrEqualExpression(LessThanOrEqualFilter filter, boolean not) {
LOG.ok("createLessThanOrEqualExpression, filter: {0}, not: {1}", filter, not);
if (not) {
LOG.ok("not supported native SAP NOT LessThanOrEqualExpression filter, filtering is performed over connector framework (slower)");
return null; // not supported
}
Attribute attr = filter.getAttribute();
LOG.ok("attr.getId: {0}, attr.getValue: {1}", attr.getName(), attr.getValue());
if (notSupportedAttribute(attr.getName())) {
return null; // not supported attribute
}
if (notSupportedValue(attr.getValue())) {
return null; // not supported value/s
}
String value = (String) attr.getValue().get(0);
return new SapFilter(SapFilter.OPERATOR_LESS_EQUAL, attr.getName(), value);
}
开发者ID:Evolveum,项目名称:connector-sap,代码行数:22,代码来源:SapAccountFilterTranslator.java
示例14: dump
import org.identityconnectors.framework.common.objects.Attribute; //导入依赖的package包/类
private static void dump(Filter filter, StringBuilder sb, int indent) {
DebugUtil.indentDebugDump(sb, indent);
if (filter == null) {
sb.append("null");
return;
}
sb.append(filter.toString());
if (filter instanceof AttributeFilter) {
sb.append("(");
Attribute attribute = ((AttributeFilter)filter).getAttribute();
sb.append(attribute.getName());
sb.append(": ");
List<Object> value = attribute.getValue();
sb.append(value);
// if (value != null && !value.isEmpty()) {
// sb.append(" :").append(attribute.getValue().iterator().next().getClass().getSimpleName());
// }
sb.append(")");
}
if (filter instanceof CompositeFilter) {
for(Filter subfilter: ((CompositeFilter)filter).getFilters()) {
sb.append("\n");
dump(subfilter,sb,indent+1);
}
}
}
开发者ID:Pardus-Engerek,项目名称:engerek,代码行数:27,代码来源:ConnIdUtil.java
示例15: convertToConnIdAttribute
import org.identityconnectors.framework.common.objects.Attribute; //导入依赖的package包/类
Attribute convertToConnIdAttribute(ResourceAttribute<?> mpAttribute, ObjectClassComplexTypeDefinition ocDef) throws SchemaException {
QName midPointAttrQName = mpAttribute.getElementName();
if (midPointAttrQName.equals(SchemaConstants.ICFS_UID)) {
throw new SchemaException("ICF UID explicitly specified in attributes");
}
String connIdAttrName = icfNameMapper.convertAttributeNameToIcf(mpAttribute, ocDef);
Set<Object> connIdAttributeValues = new HashSet<Object>();
for (PrismPropertyValue<?> pval: mpAttribute.getValues()) {
connIdAttributeValues.add(ConnIdUtil.convertValueToIcf(pval, protector, mpAttribute.getElementName()));
}
try {
return AttributeBuilder.build(connIdAttrName, connIdAttributeValues);
} catch (IllegalArgumentException e) {
throw new SchemaException(e.getMessage(), e);
}
}
开发者ID:Pardus-Engerek,项目名称:engerek,代码行数:20,代码来源:ConnIdConvertor.java
示例16: getSingleValue
import org.identityconnectors.framework.common.objects.Attribute; //导入依赖的package包/类
private <T> T getSingleValue(Attribute icfAttr, Class<T> type) throws SchemaException {
List<Object> values = icfAttr.getValue();
if (values != null && !values.isEmpty()) {
if (values.size() > 1) {
throw new SchemaException("Expected single value for " + icfAttr.getName());
}
Object val = convertValueFromIcf(values.get(0), null);
if (val == null) {
return null;
}
if (type.isAssignableFrom(val.getClass())) {
return (T) val;
} else {
throw new SchemaException("Expected type " + type.getName() + " for " + icfAttr.getName()
+ " but got " + val.getClass().getName());
}
} else {
return null;
}
}
开发者ID:Pardus-Engerek,项目名称:engerek,代码行数:22,代码来源:ConnIdConvertor.java
示例17: dumpAttributes
import org.identityconnectors.framework.common.objects.Attribute; //导入依赖的package包/类
private String dumpAttributes(Set<Attribute> attributes) {
if (attributes == null) {
return "(null)";
}
if (attributes.isEmpty()) {
return "(empty)";
}
StringBuilder sb = new StringBuilder();
for (Attribute attr : attributes) {
sb.append("\n");
if (attr.getValue() == null || attr.getValue().isEmpty()) {
sb.append(attr.getName());
sb.append(" (empty)");
} else {
for (Object value : attr.getValue()) {
sb.append(attr.getName());
sb.append(" = ");
sb.append(value);
}
}
}
return sb.toString();
}
开发者ID:Pardus-Engerek,项目名称:engerek,代码行数:24,代码来源:ConnectorInstanceConnIdImpl.java
示例18: addConvertedValues
import org.identityconnectors.framework.common.objects.Attribute; //导入依赖的package包/类
private void addConvertedValues(Collection<PrismPropertyValue<QName>> pvals,
Set<Attribute> attributes, Map<QName,ObjectClassComplexTypeDefinition> auxiliaryObjectClassMap) throws SchemaException {
if (pvals == null) {
return;
}
AttributeBuilder ab = new AttributeBuilder();
ab.setName(PredefinedAttributes.AUXILIARY_OBJECT_CLASS_NAME);
for (PrismPropertyValue<QName> pval: pvals) {
QName auxQName = pval.getValue();
ObjectClassComplexTypeDefinition auxDef = resourceSchema.findObjectClassDefinition(auxQName);
if (auxDef == null) {
throw new SchemaException("Auxiliary object class "+auxQName+" not found in the schema");
}
auxiliaryObjectClassMap.put(auxQName, auxDef);
ObjectClass icfOc = connIdNameMapper.objectClassToIcf(pval.getValue(), resourceSchemaNamespace, connectorType, false);
ab.addValue(icfOc.getObjectClassValue());
}
attributes.add(ab.build());
}
开发者ID:Pardus-Engerek,项目名称:engerek,代码行数:20,代码来源:ConnectorInstanceConnIdImpl.java
示例19: getAttributeSingleValue
import org.identityconnectors.framework.common.objects.Attribute; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public static <T> T getAttributeSingleValue(Set<Attribute> attributes, String attributeName, Class<T> type) {
for (Attribute attr : attributes) {
if (attributeName.equals(attr.getName())) {
List<Object> values = attr.getValue();
if (values == null || values.isEmpty()) {
return null;
}
if (values.size()>1) {
throw new IllegalArgumentException("Multiple values for single valued attribute "+attributeName);
}
if (!(type.isAssignableFrom(values.get(0).getClass()))) {
throw new IllegalArgumentException("Illegal value type "+values.get(0).getClass().getName()+" for attribute "+attributeName+", expecting type "+type.getClass().getName());
}
return (T)values.get(0);
}
}
return null;
}
开发者ID:Pardus-Engerek,项目名称:engerek,代码行数:20,代码来源:Utils.java
示例20: getObjectAttribute
import org.identityconnectors.framework.common.objects.Attribute; //导入依赖的package包/类
/**
* Read attribute for a given connector object.
*
* @param objectClass ConnId's object class
* @param uid ConnId's Uid
* @param options ConnId's OperationOptions
* @param attributeName attribute to read
* @return attribute (if present)
*/
public Attribute getObjectAttribute(
final ObjectClass objectClass,
final Uid uid,
final OperationOptions options,
final String attributeName) {
Attribute attribute = null;
try {
final ConnectorObject object =
connector.getObject(objectClass, uid, options);
attribute = object.getAttributeByName(attributeName);
} catch (NullPointerException e) {
// ignore exception
LOG.debug("Object for '{}' not found", uid.getUidValue());
}
return attribute;
}
开发者ID:ilgrosso,项目名称:oldSyncopeIdM,代码行数:30,代码来源:ConnectorFacadeProxy.java
注:本文中的org.identityconnectors.framework.common.objects.Attribute类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论