/** * <p> * The name of the attribute involved in the condition. * </p> * * @param name * The name of the attribute involved in the condition. * @return Returns a reference to this object so that method calls can be chained together. */ public UpdateCondition withName(String name) { setName(name); return this; }
/** * Constructs a new UpdateCondition object. Callers should use the setter or fluent setter (with...) methods to * initialize any additional object members. * * @param name * The name of the attribute involved in the condition. * @param value * The value of an attribute. This value can only be specified when the <code>Exists</code> parameter is * equal to <code>true</code>. * @param exists * A value specifying whether or not the specified attribute must exist with the specified value in order for * the update condition to be satisfied. Specify <code>true</code> if the attribute must exist for the update * condition to be satisfied. Specify <code>false</code> if the attribute should not exist in order for the * update condition to be satisfied. */ public UpdateCondition(String name, String value, Boolean exists) { setName(name); setValue(value); setExists(exists); }
/** * Register a new instance. Registration will fail if a prior entry exists * * @param instance Instance entry to be registered. * @throws AmazonServiceException If unable to write to Simple DB because of any error. */ public void registerInstance(PriamInstance instance) throws AmazonServiceException { AmazonSimpleDB simpleDBClient = getSimpleDBClient(); PutAttributesRequest putReq = new PutAttributesRequest( DOMAIN, getKey(instance), createAttributesToRegister(instance)); UpdateCondition expected = new UpdateCondition(); expected.setName(Attributes.INSTANCE_ID); expected.setExists(false); putReq.setExpected(expected); simpleDBClient.putAttributes(putReq); }
public UpdateCondition unmarshall(StaxUnmarshallerContext context) throws Exception { UpdateCondition updateCondition = new UpdateCondition(); int originalDepth = context.getCurrentDepth(); int targetDepth = originalDepth + 1; if (context.isStartOfDocument()) targetDepth += 1; while (true) { XMLEvent xmlEvent = context.nextEvent(); if (xmlEvent.isEndDocument()) return updateCondition; if (xmlEvent.isAttribute() || xmlEvent.isStartElement()) { if (context.testExpression("Name", targetDepth)) { updateCondition.setName(StringStaxUnmarshaller.getInstance().unmarshall(context)); continue; } if (context.testExpression("Value", targetDepth)) { updateCondition.setValue(StringStaxUnmarshaller.getInstance().unmarshall(context)); continue; } if (context.testExpression("Exists", targetDepth)) { updateCondition.setExists(BooleanStaxUnmarshaller.getInstance().unmarshall(context)); continue; } } else if (xmlEvent.isEndElement()) { if (context.getCurrentDepth() < originalDepth) { return updateCondition; } } } }
/** * Constructs a new UpdateCondition object. * Callers should use the setter or fluent setter (with...) methods to * initialize any additional object members. * * @param name The name of the attribute involved in the condition. * @param value The value of an attribute. This value can only be * specified when the <code>Exists</code> parameter is equal to * <code>true</code>. * @param exists A value specifying whether or not the specified * attribute must exist with the specified value in order for the update * condition to be satisfied. Specify <code>true</code> if the attribute * must exist for the update condition to be satisfied. Specify * <code>false</code> if the attribute should not exist in order for the * update condition to be satisfied. */ public UpdateCondition(String name, String value, Boolean exists) { setName(name); setValue(value); setExists(exists); }
/** * <p> * The name of the attribute involved in the condition. * </p> * * @param name * The name of the attribute involved in the condition. * @return Returns a reference to this object so that method calls can be chained together. */ public UpdateCondition withName(String name) { setName(name); return this; }
/** * Constructs a new UpdateCondition object. Callers should use the setter or fluent setter (with...) methods to * initialize any additional object members. * * @param name * The name of the attribute involved in the condition. * @param value * The value of an attribute. This value can only be specified when the <code>Exists</code> parameter is * equal to <code>true</code>. * @param exists * A value specifying whether or not the specified attribute must exist with the specified value in order for * the update condition to be satisfied. Specify <code>true</code> if the attribute must exist for the update * condition to be satisfied. Specify <code>false</code> if the attribute should not exist in order for the * update condition to be satisfied. */ public UpdateCondition(String name, String value, Boolean exists) { setName(name); setValue(value); setExists(exists); }
public UpdateCondition unmarshall(StaxUnmarshallerContext context) throws Exception { UpdateCondition updateCondition = new UpdateCondition(); int originalDepth = context.getCurrentDepth(); int targetDepth = originalDepth + 1; if (context.isStartOfDocument()) targetDepth += 1; while (true) { XMLEvent xmlEvent = context.nextEvent(); if (xmlEvent.isEndDocument()) return updateCondition; if (xmlEvent.isAttribute() || xmlEvent.isStartElement()) { if (context.testExpression("Name", targetDepth)) { updateCondition.setName(StringStaxUnmarshaller.getInstance().unmarshall(context)); continue; } if (context.testExpression("Value", targetDepth)) { updateCondition.setValue(StringStaxUnmarshaller.getInstance().unmarshall(context)); continue; } if (context.testExpression("Exists", targetDepth)) { updateCondition.setExists(BooleanStaxUnmarshaller.getInstance().unmarshall(context)); continue; } } else if (xmlEvent.isEndElement()) { if (context.getCurrentDepth() < originalDepth) { return updateCondition; } } } }