@Override public Properties getLocalePropertiesForFile( RepositoryFile repositoryFile, String locale ) { if ( org.apache.commons.lang.StringUtils.isBlank( locale ) ) { locale = RepositoryFile.DEFAULT_LOCALE; } if ( repositoryFile != null && repositoryFile.getLocalePropertiesMap() != null ) { Properties properties = repositoryFile.getLocalePropertiesMap().get( locale ); return properties; } return null; }
@Override public List<Locale> getAvailableLocalesForFile( RepositoryFile repositoryFile ) { List<Locale> localeList = new ArrayList<Locale>(); if ( repositoryFile != null && repositoryFile.getLocalePropertiesMap() != null ) { for ( String localeName : repositoryFile.getLocalePropertiesMap().keySet() ) { String[] localePieces = localeName.split( "_" ); String language = localePieces[0]; String country = ( localePieces.length > 1 ) ? localePieces[1] : ""; String variant = ( localePieces.length > 2 ) ? localePieces[2] : ""; Locale locale = new Locale( language, country, variant ); localeList.add( locale ); } } return localeList; }
private static String findDesc( final RepositoryFile file ) { String desc = null; if ( file.getLocalePropertiesMap() != null ) { Properties properties = file.getLocalePropertiesMap().get( Locale.getDefault().toString() ); if ( properties == null ) { properties = file.getLocalePropertiesMap().get( RepositoryFile.DEFAULT_LOCALE ); if ( properties != null ) { desc = properties.getProperty( RepositoryFile.FILE_DESCRIPTION ); if ( StringUtils.isBlank( desc ) ) { desc = properties.getProperty( RepositoryFile.DESCRIPTION ); } } } } return desc; }
private static String findTitle( final RepositoryFile file ) { String title = null; if ( file.getLocalePropertiesMap() != null ) { Properties properties = file.getLocalePropertiesMap().get( Locale.getDefault().toString() ); if ( properties == null ) { properties = file.getLocalePropertiesMap().get( RepositoryFile.DEFAULT_LOCALE ); if ( properties != null ) { title = properties.getProperty( RepositoryFile.FILE_TITLE ); if ( StringUtils.isBlank( title ) ) { title = properties.getProperty( RepositoryFile.TITLE ); } } } } return title; }
public static Node updateFolderNode( final Session session, final PentahoJcrConstants pentahoJcrConstants, final RepositoryFile folder ) throws RepositoryException { Node folderNode = session.getNodeByIdentifier( folder.getId().toString() ); // guard against using a file retrieved from a more lenient session inside a more strict session Assert.notNull( folderNode ); preventLostUpdate( session, pentahoJcrConstants, folder ); folderNode.setProperty( pentahoJcrConstants.getPHO_HIDDEN(), folder.isHidden() ); folderNode.setProperty( pentahoJcrConstants.getPHO_ACLNODE(), folder.isAclNode() ); if ( folder.getLocalePropertiesMap() != null && !folder.getLocalePropertiesMap().isEmpty() ) { Node localePropertiesMapNode = null; if ( !folderNode.hasNode( pentahoJcrConstants.getPHO_LOCALES() ) ) { localePropertiesMapNode = folderNode.addNode( pentahoJcrConstants.getPHO_LOCALES(), pentahoJcrConstants.getPHO_NT_LOCALE() ); } else { localePropertiesMapNode = folderNode.getNode( pentahoJcrConstants.getPHO_LOCALES() ); } setLocalePropertiesMap( session, pentahoJcrConstants, localePropertiesMapNode, folder.getLocalePropertiesMap() ); } return folderNode; }
fileNode.setProperty( pentahoJcrConstants.getPHO_FILESIZE(), content.getDataSize() ); fileNode.setProperty( pentahoJcrConstants.getPHO_ACLNODE(), file.isAclNode() ); if ( file.getLocalePropertiesMap() != null && !file.getLocalePropertiesMap().isEmpty() ) { Node localePropertiesMapNode = null; if ( !fileNode.hasNode( pentahoJcrConstants.getPHO_LOCALES() ) ) { localePropertiesMapNode = fileNode.getNode( pentahoJcrConstants.getPHO_LOCALES() ); setLocalePropertiesMap( session, pentahoJcrConstants, localePropertiesMapNode, file.getLocalePropertiesMap() );
if ( file.getLocalePropertiesMap() != null && !file.getLocalePropertiesMap().isEmpty() ) { Node localeNodes = fileNode.addNode( pentahoJcrConstants.getPHO_LOCALES(), pentahoJcrConstants.getPHO_NT_LOCALE() ); setLocalePropertiesMap( session, pentahoJcrConstants, localeNodes, file.getLocalePropertiesMap() );
if ( v.getLocalePropertiesMap() != null ) { f.setLocalePropertiesMapEntries( new ArrayList<LocaleMapDto>() ); for ( Map.Entry<String, Properties> entry : v.getLocalePropertiesMap().entrySet() ) {
public Builder( final RepositoryFile other ) { this( other.getName() ); synchronized ( other ) { this.id( other.getId() ).path( other.getPath() ).createdDate( other.getCreatedDate() ).creatorId( other.getCreatorId() ).fileSize( other.getFileSize() ).folder( other.isFolder() ).lastModificationDate( other.getLastModifiedDate() ).versioned( other.isVersioned() ).hidden( other.isHidden() ).schedulable( other.isSchedulable() ).versionId( other.getVersionId() ).locked( other.isLocked() ).lockDate( other.getLockDate() ).lockOwner( other.getLockOwner() ).lockMessage( other.getLockMessage() ).title( other.getTitle() ).description( other.getDescription() ).locale( other.getLocale() ).originalParentFolderPath( other.getOriginalParentFolderPath() ).deletedDate( other.getDeletedDate() ).localePropertiesMap( other.getLocalePropertiesMap() ).aclNode( other.isAclNode() ); } }