Skip to content

Commit

Permalink
moh-abed added Collaboration Collaborators and Tenant.
Browse files Browse the repository at this point in the history
  • Loading branch information
vlingo-java committed Apr 28, 2013
1 parent c08a247 commit 74e959d
Show file tree
Hide file tree
Showing 10 changed files with 190 additions and 1 deletion.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
IDDD_Samples.suo
/iddd_agilepm/bin/
/iddd_agilepm/obj/
/iddd_collaboration/bin/
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
namespace SaaSOvation.Collaboration.Domain.Model.Collaborators
{
public sealed class Author : Collaborator
{
public Author(string identity, string name, string emailAddress)
: base(identity, name, emailAddress)
{
}

protected override int GetHashPrimeValue()
{
return 19;
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
namespace SaaSOvation.Collaboration.Domain.Model.Collaborators
{
using System;

public abstract class Collaborator : IComparable<Collaborator>
{
protected Collaborator()
{
}

protected Collaborator(string identity, string name, string emailAddress)
{
Identity = identity;
Name = name;
EmailAddress = emailAddress;
}

public string EmailAddress { get; private set; }
public string Identity { get; private set; }
public string Name { get; private set; }

public int CompareTo(Collaborator collaborator)
{
var diff = String.Compare(Identity, collaborator.Identity, StringComparison.Ordinal);

if (diff == 0)
{
diff = String.Compare(EmailAddress, collaborator.EmailAddress, StringComparison.Ordinal);

if (diff == 0)
{
diff = String.Compare(Name, collaborator.Name, StringComparison.Ordinal);
}
}

return diff;
}

public override bool Equals(object anObject)
{
var equalObjects = false;

if (anObject != null && GetType() == anObject.GetType())
{
var typedObject = (Collaborator)anObject;
equalObjects =
EmailAddress.Equals(typedObject.EmailAddress) &&
Identity.Equals(typedObject.Identity) &&
Name.Equals(typedObject.Name);
}

return equalObjects;
}

public override int GetHashCode()
{
var hash = 57691 * GetHashPrimeValue()
+ Identity.GetHashCode()
+ Name.GetHashCode()
+ EmailAddress.GetHashCode();

return hash;
}

public override string ToString()
{
return GetType().Name +
" [emailAddress=" + EmailAddress + ", identity=" + Identity + ", Name=" + Name + "]";
}

protected abstract int GetHashPrimeValue();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
namespace SaaSOvation.Collaboration.Domain.Model.Collaborators
{
public sealed class Creator : Collaborator
{
public Creator(string identity, string name, string emailAddress)
: base(identity, name, emailAddress)
{
}

protected override int GetHashPrimeValue()
{
return 43;
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
namespace SaaSOvation.Collaboration.Domain.Model.Collaborators
{
using SaaSOvation.Collaboration.Domain.Model.Tenants;

public interface ICollaboratorService
{
Author AuthorFrom(Tenant tenant, string identity);

Creator CreatorFrom(Tenant tenant, string identity);

Moderator ModeratorFrom(Tenant tenant, string identity);

Owner OwnerFrom(Tenant enant, string identity);

Participant ParticipantFrom(Tenant tenant, string identity);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
namespace SaaSOvation.Collaboration.Domain.Model.Collaborators
{
public sealed class Moderator : Collaborator
{
public Moderator(string identity, string name, string emailAddress)
: base(identity, name, emailAddress)
{
}

protected override int GetHashPrimeValue()
{
return 59;
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
namespace SaaSOvation.Collaboration.Domain.Model.Collaborators
{
public sealed class Owner : Collaborator
{
public Owner(string identity, string name, string emailAddress)
: base(identity, name, emailAddress)
{
}

protected override int GetHashPrimeValue()
{
return 29;
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
namespace SaaSOvation.Collaboration.Domain.Model.Collaborators
{
public sealed class Participant : Collaborator
{
public Participant(string identity, string name, string emailAddress)
: base(identity, name, emailAddress)
{
}

protected override int GetHashPrimeValue()
{
return 23;
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
namespace SaaSOvation.Collaboration.Domain.Model.Tenants
{
public sealed class Tenant
{
public Tenant(string id)
{
this.Id = id;
}

public string Id { get; private set; }
}
}
13 changes: 12 additions & 1 deletion iddd_collaboration/iddd_collaboration.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,19 @@
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Class1.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="SaaSOvation.Collaboration.Domain.Model.Collaborators\Author.cs" />
<Compile Include="SaaSOvation.Collaboration.Domain.Model.Collaborators\Collaborator .cs" />
<Compile Include="SaaSOvation.Collaboration.Domain.Model.Collaborators\Creator.cs" />
<Compile Include="SaaSOvation.Collaboration.Domain.Model.Collaborators\ICollaboratorService.cs" />
<Compile Include="SaaSOvation.Collaboration.Domain.Model.Collaborators\Moderator.cs" />
<Compile Include="SaaSOvation.Collaboration.Domain.Model.Collaborators\Owner.cs" />
<Compile Include="SaaSOvation.Collaboration.Domain.Model.Collaborators\Participant.cs" />
<Compile Include="SaaSOvation.Collaboration.Domain.Model.Tenants\Tenant.cs" />
</ItemGroup>
<ItemGroup>
<Folder Include="SaaSOvation.Collaboration.Domain.Model.Calendars\" />
<Folder Include="SaaSOvation.Collaboration.Domain.Model.Forums\" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Expand Down

0 comments on commit 74e959d

Please sign in to comment.