【问题标题】:How can I keep the relation between the Manager and the Server while the Manager has a relation to a reference?当管理器与引用有关系时,如何保持管理器和服务器之间的关系?
【发布时间】:2015-08-19 00:05:39
【问题描述】:

在一个能够创建和管理计算表的项目上,其中每个工作表。

它有一个所有者和两组用户:可以更改电子表格的用户和可以阅读电子表格的用户。电子表格中的每个单元格都可以作为文字内容、对同一工作表的另一个单元格的引用或函数

现在假设您要添加以下要求:

• 应用程序现在应该支持第二种类型的引用:外部引用。

在这种情况下,引用与电子表格的单元格相关。

引用外部由id行表示;! col,其中 id 表示包含所需单元格的标识符电子表格(带有行地址;col)。

这样我就有了这个根据域的代码源:

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;
}

• 出于可扩展性的原因,应用程序可能是分布式的 在多个服务器上,每个服务器负责管理叶子的子集 计算。

因此,外部引用不能直接引用 另一个工作表的单元格,因为这两个工作表可能会发生 有问题的计算(包含外部参考并在外部参考中引用的计算)位于不同的服务器上。要解决此问题,请考虑使用新实体 RemoteCellManager。

服务器的这个实体的一个实例,这个实例将在与服务器关联的电子表格的上下文中管理所有创建的外部引用。

因此,每当创建外部引用、要在字段中考虑的新类型实体时,都应将其记录在此实体中。出于优化原因,每个引用 external 都保留引用的外部单元格的值。

如果单元格发生更改,则应更新其所有外部引用。实体“RemoteCellManager”负责执行此更新。

对于这个解决方案,我将了解实体如何获取“RemoteCellManager”单元格已更改的信息及其新值。

• 出于性能原因将限制外部参考的数量

它们可以在服务器上创建。

这个数字等于 100。

我对这个问题的解决方案是基于拥有下一个代码源:

class ExternalReference {
    int cellRow;
    int cellCol;
    int cellID;
}

class RemoteCellManager extends ExternalReference { }

relation ServerHasExternalReference {
    ExternalReference playsRole reference {
        multiplicity 0..100;
    }
}

我的问题是,当 Manager 与引用有关系时,如何在 Manager 和 Server 之间建立关系?

【问题讨论】:

    标签: java dml


    【解决方案1】:

    使用领域建模语言 (DML) 通过外部参考方法更好地理解管理器和服务器之间的关系:

    class ExternalReference {
        int cellRow;
        int cellCol;
        int cellID;
    }
    
    class RemoteCellManager extends ExternalReference { }
    
    relation RemoteCellManagerHasExternalReference {
        RemoteCellManager playsRole manager {
            multiplicity 1..1;
        }
        ExternalReference playsRole reference {
            multiplicity 0..100;
        }
    }
    

    我的想法是,根据我对解释的理解,将RemoteCellReference 扩展到ExternalReference,然后我们需要对playsRole 和multiplicity 进行编码,并具有相关性。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-04-03
      • 2021-12-11
      • 2016-11-14
      相关资源
      最近更新 更多