Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JNG-5368 add access instance helper methods #49

Merged

Conversation

noherczeg
Copy link
Contributor

@noherczeg noherczeg commented Jan 3, 2024

TaskJNG-5368 Util for querying instance from access by identifier

import { ViewCreatureStored, ViewGalaxyStored, ViewMatterStored, ViewPlanetStored } from '../data-api';
import type { JudoDownloadFile, JudoMetaData } from '../data-api/common';

export interface AccessService {
  getMetaData(): Promise<JudoMetaData>;

  uploadFile(attributePath: string, file: File): Promise<string>;

  downloadFile(downloadToken: string, disposition: 'inline' | 'attachment'): Promise<any>;

  findInstanceOfCreatures(identifier: string, mask?: string): Promise<ViewCreatureStored | undefined>;
  findInstanceOfGalaxies(identifier: string, mask?: string): Promise<ViewGalaxyStored | undefined>;
  findInstanceOfMatter(identifier: string, mask?: string): Promise<ViewMatterStored | undefined>;
}

HashSet<String> tokens = new LinkedHashSet<>();
if (application.getPrincipal() != null) {
tokens.add(classDataName(application.getPrincipal(), "Stored"));
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stream pricipalToken = Stream.empty();
if (application.getPrincipal() != null) {
   principalToken = Stream.of(classDataName(application.getPrincipal(), "Stored"));
}
return Stream.concat(
              getAccessRelationsTypes(application)
                .stream(), 
                .map(r -> classDataName(relation.getTarget(), "Stored")), 
              principalToken)
         .distinct()
         .sorted()
         .collect(Collectors.joining(","));

@noherczeg noherczeg merged commit b332e83 into develop Jan 3, 2024
3 checks passed
@noherczeg noherczeg deleted the feature/JNG-5368-add-access-instance-helper-methods branch January 3, 2024 16:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants