use of org.apache.syncope.common.lib.to.AttrTO in project syncope by apache.
the class ConfigurationLogic method get.
@PreAuthorize("hasRole('" + StandardEntitlement.CONFIGURATION_GET + "')")
@Transactional(readOnly = true)
public AttrTO get(final String schema) {
AttrTO result;
Optional<? extends CPlainAttr> conf = confDAO.find(schema);
if (conf.isPresent()) {
result = binder.getAttrTO(conf.get());
} else {
PlainSchema plainSchema = plainSchemaDAO.find(schema);
if (plainSchema == null) {
throw new NotFoundException("Configuration schema " + schema);
}
result = new AttrTO();
result.setSchema(schema);
}
return result;
}
use of org.apache.syncope.common.lib.to.AttrTO in project syncope by apache.
the class AnyObjectITCase method readAttrs.
@Test
public void readAttrs() {
AnyObjectTO anyObjectTO = getSampleTO("readAttrs");
anyObjectTO = createAnyObject(anyObjectTO).getEntity();
assertNotNull(anyObjectTO);
Set<AttrTO> attrs = anyObjectService.read(anyObjectTO.getKey(), SchemaType.PLAIN);
assertEquals(anyObjectTO.getPlainAttrs(), attrs);
AttrTO location = anyObjectService.read(anyObjectTO.getKey(), SchemaType.PLAIN, "location");
assertEquals(anyObjectTO.getPlainAttr("location").get(), location);
}
use of org.apache.syncope.common.lib.to.AttrTO in project syncope by apache.
the class AnyObjectITCase method updateAttr.
@Test
public void updateAttr() {
AnyObjectTO anyObjectTO = getSampleTO("updateAttr");
anyObjectTO = createAnyObject(anyObjectTO).getEntity();
assertNotNull(anyObjectTO);
AttrTO updated = attrTO("location", "newlocation");
anyObjectService.update(anyObjectTO.getKey(), SchemaType.PLAIN, updated);
AttrTO location = anyObjectService.read(anyObjectTO.getKey(), SchemaType.PLAIN, "location");
// need to remove schemaInfo which is included when reading the any object
location.setSchemaInfo(null);
assertEquals(updated, location);
}
use of org.apache.syncope.common.lib.to.AttrTO in project syncope by apache.
the class ConfigurationITCase method create.
@Test
public void create() {
PlainSchemaTO testKey = new PlainSchemaTO();
testKey.setKey("testKey" + getUUIDString());
testKey.setType(AttrSchemaType.String);
createSchema(SchemaType.PLAIN, testKey);
AttrTO conf = new AttrTO.Builder().schema(testKey.getKey()).value("testValue").build();
configurationService.set(conf);
AttrTO actual = configurationService.get(conf.getSchema());
actual.setSchemaInfo(null);
assertEquals(actual, conf);
}
use of org.apache.syncope.common.lib.to.AttrTO in project syncope by apache.
the class ConfigurationITCase method list.
@Test
public void list() {
List<AttrTO> wholeConf = configurationService.list();
assertNotNull(wholeConf);
for (AttrTO conf : wholeConf) {
assertNotNull(conf);
}
}
Aggregations