Ejemplo n.º 1
0
 public void delete(ObjectClass objectClass, Uid uid, OperationOptions options) {
   if (null == uid.getRevision()) {
     throw new PreconditionRequiredException("Version is required for MVCC");
   } else if (config.getGuid().toString().equals(uid.getRevision())) {
     // Delete
   } else {
     throw new PreconditionFailedException(
         "Current version of resource is 0 and not match with: " + uid.getRevision());
   }
 }
Ejemplo n.º 2
0
 public Uid create(
     ObjectClass objectClass, Set<Attribute> createAttributes, OperationOptions options) {
   AttributesAccessor accessor = new AttributesAccessor(createAttributes);
   if (accessor.hasAttribute("fail")) {
     throw new ConnectorException("Test Exception");
   } else if (accessor.hasAttribute("exist") && accessor.findBoolean("exist")) {
     throw new AlreadyExistsException(accessor.getName().getNameValue());
   } else if (accessor.hasAttribute("emails")) {
     Object value = AttributeUtil.getSingleValue(accessor.find("emails"));
     if (value instanceof Map) {
       return new Uid((String) ((Map) value).get("email"));
     } else {
       throw new InvalidAttributeValueException("Expecting Map");
     }
   }
   return new Uid(config.getGuid().toString());
 }
Ejemplo n.º 3
0
 public SyncToken getLatestSyncToken(ObjectClass objectClass) {
   return new SyncToken(config.getGuid().toString());
 }
Ejemplo n.º 4
0
 public void init(Configuration cfg) {
   config = (TstStatefulConnectorConfig) cfg;
   config.getGuid();
 }