Ejemplo n.º 1
0
  /**
   * @param model
   * @param modelDto
   * @param adminRoleAdded
   * @return
   */
  private ArrayList<ParticipantDTO> updateTopLevelRoles(Model model) {
    List<Role> topLevelRoles = null;
    topLevelRoles = model.getAllTopLevelRoles();
    ArrayList<ParticipantDTO> allTopLevelRoles = new ArrayList<ParticipantDTO>();

    for (Role role : topLevelRoles) {
      // We the "Administrator" role that belong to Predefined model
      if (PredefinedConstants.ADMINISTRATOR_ROLE.equals(role.getId())) {
        if (PredefinedConstants.PREDEFINED_MODEL_ID.equals(model.getId())) {
          ParticipantDTO participantDTO = new ParticipantDTO(role);
          participantDTO.type = ParticipantManagementUtils.getParticipantType(role).name();
          allTopLevelRoles.add(participantDTO);
        }
        continue;
      }

      String modelId = ModelUtils.extractModelId(role.getQualifiedId());

      if ((modelId == null) || (modelId.equals(model.getId()))) {
        ParticipantDTO participantDTO = new ParticipantDTO(role);
        participantDTO.type = ParticipantManagementUtils.getParticipantType(role).name();
        allTopLevelRoles.add(participantDTO);
      }
    }
    return allTopLevelRoles;
  }
Ejemplo n.º 2
0
  /**
   * @param model
   * @param modelDto
   * @return
   */
  private List<ParticipantDTO> updateTopLevelOrganizations(Model model) {
    List<Organization> topLevelOrganizations = null;

    topLevelOrganizations = model.getAllTopLevelOrganizations();
    List<ParticipantDTO> allTopLevelOrganizations = new ArrayList<ParticipantDTO>();

    for (Organization organization : topLevelOrganizations) {
      String modelId = ModelUtils.extractModelId(organization.getQualifiedId());
      if (modelId.equals(model.getId())) {
        ParticipantDTO participantDTO = new ParticipantDTO(organization);
        participantDTO.type = ParticipantManagementUtils.getParticipantType(organization).name();
        allTopLevelOrganizations.add(participantDTO);
      }
    }

    return allTopLevelOrganizations;
  }