~ubuntu-branches/ubuntu/raring/eucalyptus/raring

« back to all changes in this revision

Viewing changes to clc/modules/reporting/src/main/java/com/eucalyptus/reporting/modules/s3/S3SummaryKey.java

  • Committer: Package Import Robot
  • Author(s): Brian Thomason
  • Date: 2011-11-29 13:17:52 UTC
  • mfrom: (1.2.1 upstream)
  • mto: This revision was merged to the branch mainline in revision 185.
  • Revision ID: package-import@ubuntu.com-20111129131752-rq31al3ntutv2vvl
Tags: upstream-3.0.999beta1
ImportĀ upstreamĀ versionĀ 3.0.999beta1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
package com.eucalyptus.reporting.modules.s3;
 
2
 
 
3
 
 
4
public class S3SummaryKey
 
5
{
 
6
        private final String ownerId;
 
7
        private final String accountId;
 
8
 
 
9
        public S3SummaryKey(String ownerId, String accountId)
 
10
        {
 
11
                super();
 
12
                this.ownerId = ownerId;
 
13
                this.accountId = accountId;
 
14
        }
 
15
 
 
16
        public S3SummaryKey(S3SnapshotKey snapshotKey)
 
17
        {
 
18
                this(snapshotKey.getOwnerId(), snapshotKey.getAccountId());
 
19
        }
 
20
        
 
21
        public String getOwnerId()
 
22
        {
 
23
                return ownerId;
 
24
        }
 
25
 
 
26
        public String getAccountId()
 
27
        {
 
28
                return accountId;
 
29
        }
 
30
        
 
31
        public String toString()
 
32
        {
 
33
                return String.format("[owner:%s,account:%s", ownerId, accountId);
 
34
        }
 
35
 
 
36
        @Override
 
37
        public int hashCode()
 
38
        {
 
39
                final int prime = 31;
 
40
                int result = 1;
 
41
                result = prime * result
 
42
                                + ((accountId == null) ? 0 : accountId.hashCode());
 
43
                result = prime * result + ((ownerId == null) ? 0 : ownerId.hashCode());
 
44
                return result;
 
45
        }
 
46
 
 
47
        @Override
 
48
        public boolean equals(Object obj)
 
49
        {
 
50
                if (this == obj)
 
51
                        return true;
 
52
                if (obj == null)
 
53
                        return false;
 
54
                if (getClass() != obj.getClass())
 
55
                        return false;
 
56
                S3SummaryKey other = (S3SummaryKey) obj;
 
57
                if (accountId == null) {
 
58
                        if (other.accountId != null)
 
59
                                return false;
 
60
                } else if (!accountId.equals(other.accountId))
 
61
                        return false;
 
62
                if (ownerId == null) {
 
63
                        if (other.ownerId != null)
 
64
                                return false;
 
65
                } else if (!ownerId.equals(other.ownerId))
 
66
                        return false;
 
67
                return true;
 
68
        }
 
69
 
 
70
        
 
71
        
 
72
        
 
73
}