public Deployment unmarshall(StaxUnmarshallerContext context) throws Exception {
    Deployment deployment = new Deployment();
    int originalDepth = context.getCurrentDepth();
    int targetDepth = originalDepth + 1;

    if (context.isStartOfDocument()) targetDepth += 1;

    while (true) {
      XMLEvent xmlEvent = context.nextEvent();
      if (xmlEvent.isEndDocument()) return deployment;

      if (xmlEvent.isAttribute() || xmlEvent.isStartElement()) {

        if (context.testExpression("VersionLabel", targetDepth)) {
          deployment.setVersionLabel(StringStaxUnmarshaller.getInstance().unmarshall(context));
          continue;
        }

        if (context.testExpression("DeploymentId", targetDepth)) {
          deployment.setDeploymentId(LongStaxUnmarshaller.getInstance().unmarshall(context));
          continue;
        }

        if (context.testExpression("Status", targetDepth)) {
          deployment.setStatus(StringStaxUnmarshaller.getInstance().unmarshall(context));
          continue;
        }

        if (context.testExpression("DeploymentTime", targetDepth)) {
          deployment.setDeploymentTime(DateStaxUnmarshaller.getInstance().unmarshall(context));
          continue;
        }
      } else if (xmlEvent.isEndElement()) {
        if (context.getCurrentDepth() < originalDepth) {
          return deployment;
        }
      }
    }
  }
Ejemplo n.º 2
0
 /**
  * For in-progress deployments, the time that the deloyment started.
  *
  * <p>For completed deployments, the time that the deployment ended.
  *
  * @param deploymentTime For in-progress deployments, the time that the deloyment started.
  *     <p>For completed deployments, the time that the deployment ended.
  * @return Returns a reference to this object so that method calls can be chained together.
  */
 public Deployment withDeploymentTime(java.util.Date deploymentTime) {
   setDeploymentTime(deploymentTime);
   return this;
 }