On a project that enables the creation and management of calculation sheets, wherein each worksheet.
It has an owner and two sets of users: those who can change the spreadsheet and those who can read the spreadsheet. Every cell in a spreadsheet can have as a literal content, a reference to another cell of the same sheet or a function
Now suppose if you want to add the following requirements:
• The application should now support a second type of reference: external reference.
In this case, the reference relates to a cell of a spreadsheet.
The reference external are represented by id row;! col, where id represents the identifier spreadsheet containing the desired cell (with the row address; col).
So that I have this source of code according to the domain:
class BubbleDocs{
int nextDocumentId;
}
class User {
String userToken;
String username;
String password;
String name;
String email;
}
class Session {
DateTime LastAccess;
}
class SpreadSheet {
int id;
String spreadSheetName;
String ownerUsername;
LocalDate creationDate;
int numberRows;
int numberColumns;
}
class Access {
}
RemoteCellManager {
int spreadSheetID;
bool updated;
}
class Cell {
int cellRow;
int cellColumn;
boolean protect;
}
• For scalability reasons, it may happen that the application is distributed on multiple servers, each responsible for managing a subset of leaves calculation.
For this reason, an external reference can not refer directly the cell of another worksheet as it may happen that the two sheets calculation in question (the one containing the external reference and referenced in the reference external) are on different servers. To resolve this issue goes away consider a new entity, RemoteCellManager.
An instance of this entity for server and this instance will manage all created external references in the context of spreadsheets associated with the server.
So whenever an external reference, a new type of entity to consider in the field is created, this should be recorded in this entity. For optimization reasons, each reference external keeps the value of the referenced external cell.
Where a cell is changed, all its external references should be updated. The entity 'RemoteCellManager' is responsible for performing this update.
To this solution I will should how the entities get 'RemoteCellManager' the information that a cell has changed and what its new value.
• For performance reasons will be limited the number of external references
They can be created on a server.
This number is equal to 100.
My solution for this problem is based on having the next source of code:
class ExternalReference {
int cellRow;
int cellCol;
int cellID;
}
class RemoteCellManager extends ExternalReference { }
relation ServerHasExternalReference {
ExternalReference playsRole reference {
multiplicity 0..100;
}
}
My question is, how can I make the relation between the Manager and the Server while the Manager has a relation to a reference?