Package org.pentaho.platform.repository2.unified.webservices

Examples of org.pentaho.platform.repository2.unified.webservices.StringKeyStringValueDto


    }
    try {
      List<PentahoLocale> locales = getRepoWs().getAvailableLocalesForFileById( file.getId() );
      if ( locales != null && !locales.isEmpty() ) {
        for ( PentahoLocale locale : locales ) {
          availableLocales.add( new LocaleMapDto( locale.toString(), null ) );
        }
      }
    } catch ( Exception e ) {
      throw new InternalError();
    }
View Full Code Here


  private List<LocaleMapDto> getAvailableLocales( Serializable fileId ) {
    List<LocaleMapDto> availableLocales = new ArrayList<LocaleMapDto>();
    List<Locale> locales = unifiedRepository.getAvailableLocalesForFileById( fileId );
    if ( locales != null && !locales.isEmpty() ) {
      for ( Locale locale : locales ) {
        availableLocales.add( new LocaleMapDto( locale.toString(), null ) );
      }
    }
    return availableLocales;
  }
View Full Code Here

   */
  public List<StringKeyStringValueDto> doGetLocaleProperties( String pathId, String locale ) {
    RepositoryFileDto file = getRepoWs().getFile( idToPath( pathId ) );
    List<StringKeyStringValueDto> keyValueList = new ArrayList<StringKeyStringValueDto>();
    if ( file != null ) {
      PropertiesWrapper propertiesWrapper = getRepoWs().getLocalePropertiesForFileById( file.getId(), locale );
      if ( propertiesWrapper != null ) {
        Properties properties = propertiesWrapper.getProperties();
        if ( properties != null && !properties.isEmpty() ) {
          for ( String key : properties.stringPropertyNames() ) {
            keyValueList.add( getStringKeyStringValueDto( key, properties.getProperty( key ) ) );
          }
        }
View Full Code Here

    // here we remove fake admin role added for display purpose only
    List<RepositoryFileAclAceDto> aces = acl.getAces();
    if ( aces != null ) {
      Iterator<RepositoryFileAclAceDto> it = aces.iterator();
      while ( it.hasNext() ) {
        RepositoryFileAclAceDto ace = it.next();
        if ( !ace.isModifiable() ) {
          it.remove();
        }
      }
    }
    getRepoWs().updateAcl( acl );
View Full Code Here

        List<RepositoryFileAclAceDto> aces = getRepoWs().getEffectiveAces( file.getId() );
        fileAcl.setAces( aces, fileAcl.isEntriesInheriting() );
      }

      for ( int i = 0; i < fileAcl.getAces().size(); i++ ) {
        RepositoryFileAclAceDto acl = fileAcl.getAces().get( i );
        if ( acl.getRecipient().equals( getSession().getName() ) ) {
          if ( acl.getPermissions().contains( RepositoryFilePermission.ACL_MANAGEMENT.ordinal() )
            || acl.getPermissions().contains( RepositoryFilePermission.ALL.ordinal() ) ) {
            canManage = true;
            break;
          }
        }
      }
View Full Code Here

    for ( RepositoryFileAclAceDto facl : fileAcl.getAces() ) {
      if ( facl.getRecipient().equals( adminRoleName ) && facl.getRecipientType() == 1 ) {
        return;
      }
    }
    RepositoryFileAclAceDto adminGroup = new RepositoryFileAclAceDto();
    adminGroup.setRecipient( adminRoleName );
    adminGroup.setRecipientType( 1 );
    adminGroup.setModifiable( false );
    List<Integer> perms = new LinkedList<Integer>();
    perms.add( 4 );
    adminGroup.setPermissions( perms );
    fileAcl.getAces().add( adminGroup );
  }
View Full Code Here

   * @param metadata
   * @throws GeneralSecurityException
   */
  public void doSetMetadata( String pathId, List<StringKeyStringValueDto> metadata ) throws GeneralSecurityException {
    RepositoryFileDto file = getRepoWs().getFile( idToPath( pathId ) );
    RepositoryFileAclDto fileAcl = getRepoWs().getAcl( file.getId() );

    boolean canManage =
      getSession().getName().equals( fileAcl.getOwner() )
        || ( getPolicy().isAllowed( RepositoryReadAction.NAME )
        && getPolicy().isAllowed( RepositoryCreateAction.NAME ) && getPolicy().isAllowed(
          AdministerSecurityAction.NAME ) );

    if ( !canManage ) {

      if ( fileAcl.isEntriesInheriting() ) {
        List<RepositoryFileAclAceDto> aces = getRepoWs().getEffectiveAces( file.getId() );
        fileAcl.setAces( aces, fileAcl.isEntriesInheriting() );
      }

      for ( int i = 0; i < fileAcl.getAces().size(); i++ ) {
        RepositoryFileAclAceDto acl = fileAcl.getAces().get( i );
        if ( acl.getRecipient().equals( getSession().getName() ) ) {
          if ( acl.getPermissions().contains( RepositoryFilePermission.ACL_MANAGEMENT.ordinal() )
            || acl.getPermissions().contains( RepositoryFilePermission.ALL.ordinal() ) ) {
            canManage = true;
            break;
View Full Code Here

   * @param pathId (colon separated path for the repository file)
   * @return <code> RepositoryFileAclDto </code>
   */
  public RepositoryFileAclDto doGetFileAcl( String pathId ) {
    RepositoryFileDto file = getRepoWs().getFile( FileUtils.idToPath( pathId ) );
    RepositoryFileAclDto fileAcl = getRepoWs().getAcl( file.getId() );
    if ( fileAcl.isEntriesInheriting() ) {
      List<RepositoryFileAclAceDto> aces =
        getRepoWs().getEffectiveAcesWithForceFlag( file.getId(), fileAcl.isEntriesInheriting() );
      fileAcl.setAces( aces, fileAcl.isEntriesInheriting() );
    }
    addAdminRole( fileAcl );
    return fileAcl;
  }
View Full Code Here

  }

  @Test
  public void testSetFileAcls() throws Exception {
    String pathId = "pathId";
    RepositoryFileAclDto mockRepositoryFileAclDto = mock( RepositoryFileAclDto.class );

    doNothing().when( fileResource.fileService ).setFileAcls( pathId, mockRepositoryFileAclDto );

    Response mockOkResponse = mock( Response.class );
    doReturn( mockOkResponse ).when( fileResource ).buildOkResponse();
View Full Code Here

  }

  @Test
  public void testSetFileAclsError() throws Exception {
    String pathId = "pathId";
    RepositoryFileAclDto mockRepositoryFileAclDto = mock( RepositoryFileAclDto.class );

    Messages mockMessages = mock( Messages.class );
    doReturn( mockMessages ).when( fileResource ).getMessagesInstance();

    Response mockInternalServerErrorResponse = mock( Response.class );
View Full Code Here

TOP

Related Classes of org.pentaho.platform.repository2.unified.webservices.StringKeyStringValueDto

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.