2 * Copyright (c) 2014 Contextream, Inc. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
8 package org.opendaylight.lispflowmapping.interfaces.dao;
10 import java.util.ArrayList;
11 import java.util.Date;
12 import java.util.List;
14 import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.control.plane.rev150314.EidToLocatorRecord.Action;
15 import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.control.plane.rev150314.locatorrecords.LocatorRecord;
18 * A RLOC in the mapping service with it's properties.
20 public class MappingServiceRLOCGroup {
22 private List<LocatorRecord> records;
24 private Action action;
25 private boolean authoritative;
26 private Date registerdDate;
28 public MappingServiceRLOCGroup(int ttl, Action action, boolean authoritative) {
29 this(ttl, action, authoritative, new Date(System.currentTimeMillis()));
32 public MappingServiceRLOCGroup(int ttl, Action action, boolean authoritative, Date registerdDate) {
34 this.records = new ArrayList<>();
37 this.authoritative = authoritative;
38 this.registerdDate = registerdDate;
41 public List<LocatorRecord> getRecords() {
45 public MappingServiceRLOCGroup addRecord(LocatorRecord record) {
46 this.records.add(record);
54 public MappingServiceRLOCGroup setTtl(int ttl) {
59 public Action getAction() {
63 public MappingServiceRLOCGroup setAction(Action action) {
68 public boolean isAuthoritative() {
72 public MappingServiceRLOCGroup setAuthoritative(boolean authoritative) {
73 this.authoritative = authoritative;
77 public Date getRegisterdDate() {
81 public MappingServiceRLOCGroup setRegisterdDate(Date registerdDate) {
82 this.registerdDate = registerdDate;
87 public int hashCode() {
90 result = prime * result + ((action == null) ? 0 : action.hashCode());
91 result = prime * result + (authoritative ? 1231 : 1237);
92 result = prime * result + ((records == null) ? 0 : records.hashCode());
93 result = prime * result + ((registerdDate == null) ? 0 : registerdDate.hashCode());
94 result = prime * result + ttl;
99 public boolean equals(Object obj) {
104 if (getClass() != obj.getClass())
106 MappingServiceRLOCGroup other = (MappingServiceRLOCGroup) obj;
107 if (action != other.action)
109 if (authoritative != other.authoritative)
111 if (records == null) {
112 if (other.records != null)
114 } else if (!records.equals(other.records))
116 if (ttl != other.ttl)
122 public String toString() {
123 return "MappingServiceRLOCGroup [records=" + records + ", ttl=" + ttl + ", action=" + action + ", authoritative=" + authoritative
124 + ", registerdDate=" + registerdDate + "]";