Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  /*
   * Licensed to the Apache Software Foundation (ASF) under one or more
   * contributor license agreements.  See the NOTICE file distributed with
   * this work for additional information regarding copyright ownership.
   * The ASF licenses this file to You under the Apache License, Version 2.0
   * (the "License"); you may not use this file except in compliance with
   * the License.  You may obtain a copy of the License at
   *
   *     http://www.apache.org/licenses/LICENSE-2.0
  *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
 package org.jclouds.cloudstack.domain;
 
 import static com.google.common.base.Preconditions.checkNotNull;
 
 import java.util.Date;
 
 
Class Event

Author(s):
Vijay Kiran
 
 public class Event implements Comparable<Event> {
 
    public static Builder<?> builder() {
       return new ConcreteBuilder();
    }
 
    public Builder<?> toBuilder() {
       return new ConcreteBuilder().fromEvent(this);
    }
 
    public abstract static class Builder<T extends Builder<T>> {
       protected abstract T self();
 
       protected String id;
       protected String account;
       protected String description;
       protected Date created;
       protected String domain;
       protected String domainId;
       protected String level;
       protected String parentId;
       protected String state;
       protected String type;
       protected String username;

      

See also:
Event.getId()
 
       public T id(String id) {
          this. = id;
          return self();
       }

      
 
       public T account(String account) {
          this. = account;
          return self();
       }

      
 
       public T description(String description) {
          this. = description;
          return self();
       }

      
 
       public T created(Date created) {
          this. = created;
          return self();
       }

      
 
       public T domain(String domain) {
          this. = domain;
          return self();
       }

      
      public T domainId(String domainId) {
         this. = domainId;
         return self();
      }

      
      public T level(String level) {
         this. = level;
         return self();
      }

      
      public T parentId(String parentId) {
         this. = parentId;
         return self();
      }

      
      public T state(String state) {
         this. = state;
         return self();
      }

      

See also:
Event.getType()
      public T type(String type) {
         this. = type;
         return self();
      }

      
      public T username(String username) {
         this. = username;
         return self();
      }
      public Event build() {
         return new Event();
      }
      public T fromEvent(Event in) {
         return this
               .id(in.getId())
               .account(in.getAccount())
               .description(in.getDescription())
               .created(in.getCreated())
               .domain(in.getDomain())
               .domainId(in.getDomainId())
               .level(in.getLevel())
               .parentId(in.getParentId())
               .state(in.getState())
               .type(in.getType())
               .username(in.getUsername());
      }
   }
   private static class ConcreteBuilder extends Builder<ConcreteBuilder> {
      @Override
      protected ConcreteBuilder self() {
         return this;
      }
   }
   private final String id;
   private final String account;
   private final String description;
   private final Date created;
   private final String domain;
   private final String domainId;
   private final String level;
   private final String parentId;
   private final String state;
   private final String type;
   private final String username;
         "id""account""description""created""domain""domainId""level""parentId""state""type""username"
   })
   protected Event(String id, @Nullable String account, @Nullable String description, @Nullable Date created,
                   @Nullable String domain, @Nullable String domainId, @Nullable String level, @Nullable String parentId,
                   @Nullable String state, @Nullable String type, @Nullable String username) {
      this. = checkNotNull(id"id");
      this. = account;
      this. = description;
      this. = created;
      this. = domain;
      this. = domainId;
      this. = level;
      this. = parentId;
      this. = state;
      this. = type;
      this. = username;
   }

   

Returns:
the ID of the event
   public String getId() {
      return this.;
   }

   

Returns:
the account name for the account that owns the object being acted on in the event (e.g. the owner of the virtual machine, ip address, or security group)
   public String getAccount() {
      return this.;
   }

   

Returns:
the description of the event
   public String getDescription() {
      return this.;
   }

   

Returns:
the date the event was created
   public Date getCreated() {
      return this.;
   }

   

Returns:
the name of the account's domain
   public String getDomain() {
      return this.;
   }

   

Returns:
the id of the account's domain
   public String getDomainId() {
      return this.;
   }

   

Returns:
the event level (INFO, WARN, ERROR)
   public String getLevel() {
      return this.;
   }

   

Returns:
whether the event is parented
   public String getParentId() {
      return this.;
   }

   

Returns:
the state of the event
   public String getState() {
      return this.;
   }

   

Returns:
the type of the event (see event types)
   public String getType() {
      return this.;
   }

   

Returns:
the name of the user who performed the action (can be different from the account if an admin is performing an action for a user, e.g. starting/stopping a user's virtual machine)
   public String getUsername() {
      return this.;
   }
   public int hashCode() {
      return Objects.hashCode();
   }
   public boolean equals(Object obj) {
      if (this == objreturn true;
      if (obj == null || getClass() != obj.getClass()) return false;
      Event that = Event.class.cast(obj);
      return Objects.equal(this.that.id)
            && Objects.equal(this.that.account)
            && Objects.equal(this.that.description)
            && Objects.equal(this.that.created)
            && Objects.equal(this.that.domain)
            && Objects.equal(this.that.domainId)
            && Objects.equal(this.that.level)
            && Objects.equal(this.that.parentId)
            && Objects.equal(this.that.state)
            && Objects.equal(this.that.type)
            && Objects.equal(this.that.username);
   }
   protected ToStringHelper string() {
      return Objects.toStringHelper(this)
            .add("id").add("account").add("description").add("created")
            .add("domain").add("domainId").add("level").add("parentId")
            .add("state").add("type").add("username");
   }
   public String toString() {
      return string().toString();
   }
   public int compareTo(Event other) {
      return .compareTo(other.getId());
   }
New to GrepCode? Check out our FAQ X