id
stringlengths
7
14
text
stringlengths
1
106k
161005_85
@Override public String execute( final Context context, final String classname, final Map< String, String > params ) throws PluginException { if( !m_pluginsEnabled ) { return ""; } final ResourceBundle rb = Preferences.getBundle( context, Plugin.CORE_PLUGINS_RESOURCEBUNDLE ); final boolean debug = TextUtil.isPositive( params.get( PARAM_DEBUG ) ); try { // Create... final Plugin plugin = newWikiPlugin( classname, rb ); if( plugin == null ) { return "Plugin '" + classname + "' not compatible with this version of JSPWiki"; } // ...and launch. try { return plugin.execute( context, params ); } catch( final PluginException e ) { if( debug ) { return stackTrace( params, e ); } // Just pass this exception onward. throw ( PluginException )e.fillInStackTrace(); } catch( final Throwable t ) { // But all others get captured here. log.info( "Plugin failed while executing:", t ); if( debug ) { return stackTrace( params, t ); } throw new PluginException( rb.getString( "plugin.error.failed" ), t ); } } catch( final ClassCastException e ) { throw new PluginException( MessageFormat.format( rb.getString( "plugin.error.notawikiplugin" ), classname ), e ); } }
161005_86
@Override public String execute( final Context context, final String classname, final Map< String, String > params ) throws PluginException { if( !m_pluginsEnabled ) { return ""; } final ResourceBundle rb = Preferences.getBundle( context, Plugin.CORE_PLUGINS_RESOURCEBUNDLE ); final boolean debug = TextUtil.isPositive( params.get( PARAM_DEBUG ) ); try { // Create... final Plugin plugin = newWikiPlugin( classname, rb ); if( plugin == null ) { return "Plugin '" + classname + "' not compatible with this version of JSPWiki"; } // ...and launch. try { return plugin.execute( context, params ); } catch( final PluginException e ) { if( debug ) { return stackTrace( params, e ); } // Just pass this exception onward. throw ( PluginException )e.fillInStackTrace(); } catch( final Throwable t ) { // But all others get captured here. log.info( "Plugin failed while executing:", t ); if( debug ) { return stackTrace( params, t ); } throw new PluginException( rb.getString( "plugin.error.failed" ), t ); } } catch( final ClassCastException e ) { throw new PluginException( MessageFormat.format( rb.getString( "plugin.error.notawikiplugin" ), classname ), e ); } }
161005_87
@Override public String execute( final Context context, final String classname, final Map< String, String > params ) throws PluginException { if( !m_pluginsEnabled ) { return ""; } final ResourceBundle rb = Preferences.getBundle( context, Plugin.CORE_PLUGINS_RESOURCEBUNDLE ); final boolean debug = TextUtil.isPositive( params.get( PARAM_DEBUG ) ); try { // Create... final Plugin plugin = newWikiPlugin( classname, rb ); if( plugin == null ) { return "Plugin '" + classname + "' not compatible with this version of JSPWiki"; } // ...and launch. try { return plugin.execute( context, params ); } catch( final PluginException e ) { if( debug ) { return stackTrace( params, e ); } // Just pass this exception onward. throw ( PluginException )e.fillInStackTrace(); } catch( final Throwable t ) { // But all others get captured here. log.info( "Plugin failed while executing:", t ); if( debug ) { return stackTrace( params, t ); } throw new PluginException( rb.getString( "plugin.error.failed" ), t ); } } catch( final ClassCastException e ) { throw new PluginException( MessageFormat.format( rb.getString( "plugin.error.notawikiplugin" ), classname ), e ); } }
161005_88
@Override public String execute( final Context context, final String classname, final Map< String, String > params ) throws PluginException { if( !m_pluginsEnabled ) { return ""; } final ResourceBundle rb = Preferences.getBundle( context, Plugin.CORE_PLUGINS_RESOURCEBUNDLE ); final boolean debug = TextUtil.isPositive( params.get( PARAM_DEBUG ) ); try { // Create... final Plugin plugin = newWikiPlugin( classname, rb ); if( plugin == null ) { return "Plugin '" + classname + "' not compatible with this version of JSPWiki"; } // ...and launch. try { return plugin.execute( context, params ); } catch( final PluginException e ) { if( debug ) { return stackTrace( params, e ); } // Just pass this exception onward. throw ( PluginException )e.fillInStackTrace(); } catch( final Throwable t ) { // But all others get captured here. log.info( "Plugin failed while executing:", t ); if( debug ) { return stackTrace( params, t ); } throw new PluginException( rb.getString( "plugin.error.failed" ), t ); } } catch( final ClassCastException e ) { throw new PluginException( MessageFormat.format( rb.getString( "plugin.error.notawikiplugin" ), classname ), e ); } }
161005_89
@Override public String execute( final Context context, final String classname, final Map< String, String > params ) throws PluginException { if( !m_pluginsEnabled ) { return ""; } final ResourceBundle rb = Preferences.getBundle( context, Plugin.CORE_PLUGINS_RESOURCEBUNDLE ); final boolean debug = TextUtil.isPositive( params.get( PARAM_DEBUG ) ); try { // Create... final Plugin plugin = newWikiPlugin( classname, rb ); if( plugin == null ) { return "Plugin '" + classname + "' not compatible with this version of JSPWiki"; } // ...and launch. try { return plugin.execute( context, params ); } catch( final PluginException e ) { if( debug ) { return stackTrace( params, e ); } // Just pass this exception onward. throw ( PluginException )e.fillInStackTrace(); } catch( final Throwable t ) { // But all others get captured here. log.info( "Plugin failed while executing:", t ); if( debug ) { return stackTrace( params, t ); } throw new PluginException( rb.getString( "plugin.error.failed" ), t ); } } catch( final ClassCastException e ) { throw new PluginException( MessageFormat.format( rb.getString( "plugin.error.notawikiplugin" ), classname ), e ); } }
161005_90
@Override public String execute( final Context context, final String classname, final Map< String, String > params ) throws PluginException { if( !m_pluginsEnabled ) { return ""; } final ResourceBundle rb = Preferences.getBundle( context, Plugin.CORE_PLUGINS_RESOURCEBUNDLE ); final boolean debug = TextUtil.isPositive( params.get( PARAM_DEBUG ) ); try { // Create... final Plugin plugin = newWikiPlugin( classname, rb ); if( plugin == null ) { return "Plugin '" + classname + "' not compatible with this version of JSPWiki"; } // ...and launch. try { return plugin.execute( context, params ); } catch( final PluginException e ) { if( debug ) { return stackTrace( params, e ); } // Just pass this exception onward. throw ( PluginException )e.fillInStackTrace(); } catch( final Throwable t ) { // But all others get captured here. log.info( "Plugin failed while executing:", t ); if( debug ) { return stackTrace( params, t ); } throw new PluginException( rb.getString( "plugin.error.failed" ), t ); } } catch( final ClassCastException e ) { throw new PluginException( MessageFormat.format( rb.getString( "plugin.error.notawikiplugin" ), classname ), e ); } }
161005_91
@Override public String execute( final Context context, final String classname, final Map< String, String > params ) throws PluginException { if( !m_pluginsEnabled ) { return ""; } final ResourceBundle rb = Preferences.getBundle( context, Plugin.CORE_PLUGINS_RESOURCEBUNDLE ); final boolean debug = TextUtil.isPositive( params.get( PARAM_DEBUG ) ); try { // Create... final Plugin plugin = newWikiPlugin( classname, rb ); if( plugin == null ) { return "Plugin '" + classname + "' not compatible with this version of JSPWiki"; } // ...and launch. try { return plugin.execute( context, params ); } catch( final PluginException e ) { if( debug ) { return stackTrace( params, e ); } // Just pass this exception onward. throw ( PluginException )e.fillInStackTrace(); } catch( final Throwable t ) { // But all others get captured here. log.info( "Plugin failed while executing:", t ); if( debug ) { return stackTrace( params, t ); } throw new PluginException( rb.getString( "plugin.error.failed" ), t ); } } catch( final ClassCastException e ) { throw new PluginException( MessageFormat.format( rb.getString( "plugin.error.notawikiplugin" ), classname ), e ); } }
161005_92
@Override public String execute( final Context context, final String classname, final Map< String, String > params ) throws PluginException { if( !m_pluginsEnabled ) { return ""; } final ResourceBundle rb = Preferences.getBundle( context, Plugin.CORE_PLUGINS_RESOURCEBUNDLE ); final boolean debug = TextUtil.isPositive( params.get( PARAM_DEBUG ) ); try { // Create... final Plugin plugin = newWikiPlugin( classname, rb ); if( plugin == null ) { return "Plugin '" + classname + "' not compatible with this version of JSPWiki"; } // ...and launch. try { return plugin.execute( context, params ); } catch( final PluginException e ) { if( debug ) { return stackTrace( params, e ); } // Just pass this exception onward. throw ( PluginException )e.fillInStackTrace(); } catch( final Throwable t ) { // But all others get captured here. log.info( "Plugin failed while executing:", t ); if( debug ) { return stackTrace( params, t ); } throw new PluginException( rb.getString( "plugin.error.failed" ), t ); } } catch( final ClassCastException e ) { throw new PluginException( MessageFormat.format( rb.getString( "plugin.error.notawikiplugin" ), classname ), e ); } }
161005_93
@Override public String execute( final Context context, final String classname, final Map< String, String > params ) throws PluginException { if( !m_pluginsEnabled ) { return ""; } final ResourceBundle rb = Preferences.getBundle( context, Plugin.CORE_PLUGINS_RESOURCEBUNDLE ); final boolean debug = TextUtil.isPositive( params.get( PARAM_DEBUG ) ); try { // Create... final Plugin plugin = newWikiPlugin( classname, rb ); if( plugin == null ) { return "Plugin '" + classname + "' not compatible with this version of JSPWiki"; } // ...and launch. try { return plugin.execute( context, params ); } catch( final PluginException e ) { if( debug ) { return stackTrace( params, e ); } // Just pass this exception onward. throw ( PluginException )e.fillInStackTrace(); } catch( final Throwable t ) { // But all others get captured here. log.info( "Plugin failed while executing:", t ); if( debug ) { return stackTrace( params, t ); } throw new PluginException( rb.getString( "plugin.error.failed" ), t ); } } catch( final ClassCastException e ) { throw new PluginException( MessageFormat.format( rb.getString( "plugin.error.notawikiplugin" ), classname ), e ); } }
161005_94
@Override public String execute( final Context context, final String classname, final Map< String, String > params ) throws PluginException { if( !m_pluginsEnabled ) { return ""; } final ResourceBundle rb = Preferences.getBundle( context, Plugin.CORE_PLUGINS_RESOURCEBUNDLE ); final boolean debug = TextUtil.isPositive( params.get( PARAM_DEBUG ) ); try { // Create... final Plugin plugin = newWikiPlugin( classname, rb ); if( plugin == null ) { return "Plugin '" + classname + "' not compatible with this version of JSPWiki"; } // ...and launch. try { return plugin.execute( context, params ); } catch( final PluginException e ) { if( debug ) { return stackTrace( params, e ); } // Just pass this exception onward. throw ( PluginException )e.fillInStackTrace(); } catch( final Throwable t ) { // But all others get captured here. log.info( "Plugin failed while executing:", t ); if( debug ) { return stackTrace( params, t ); } throw new PluginException( rb.getString( "plugin.error.failed" ), t ); } } catch( final ClassCastException e ) { throw new PluginException( MessageFormat.format( rb.getString( "plugin.error.notawikiplugin" ), classname ), e ); } }
161005_95
@Override public String execute( final Context context, final Map<String, String> params) throws PluginException { final ResourceBundle rb = Preferences.getBundle(context, Plugin.CORE_PLUGINS_RESOURCEBUNDLE); final ReferenceManager referenceManager = context.getEngine().getManager( ReferenceManager.class ); final int items = TextUtil.parseIntParameter(params.get(PARAM_MAX), ALL_ITEMS); String extras = params.get(PARAM_EXTRAS); if (extras == null) { extras = rb.getString("referringundefinedpagesplugin.more"); } final Collection< String > uncreatedPages = referenceManager.findUncreated(); super.initialize( context, params ); Collection< String > result = null; final TreeMap< String, String > sortedMap = new TreeMap<>(); if( uncreatedPages != null ) { for( final String uncreatedPageName : uncreatedPages ) { final Collection< String > referrers = referenceManager.findReferrers( uncreatedPageName ); if( referrers != null ) { for( final String referringPage : referrers ) { sortedMap.put( referringPage, "" ); } } } result = sortedMap.keySet(); } result = super.filterAndSortCollection( result ); final String wikitext = wikitizeCollection( result, m_separator, items ); final StringBuilder resultHTML = new StringBuilder(); resultHTML.append( makeHTML( context, wikitext ) ); // add the more.... text if( items < result.size() && items > 0 ) { final Object[] args = { "" + ( result.size() - items ) }; extras = MessageFormat.format( extras, args ); resultHTML.append( "<br/>" + extras + "<br/>" ); } return resultHTML.toString(); }
161005_96
@Override public String execute( final Context context, final Map<String, String> params) throws PluginException { final ResourceBundle rb = Preferences.getBundle(context, Plugin.CORE_PLUGINS_RESOURCEBUNDLE); final ReferenceManager referenceManager = context.getEngine().getManager( ReferenceManager.class ); final int items = TextUtil.parseIntParameter(params.get(PARAM_MAX), ALL_ITEMS); String extras = params.get(PARAM_EXTRAS); if (extras == null) { extras = rb.getString("referringundefinedpagesplugin.more"); } final Collection< String > uncreatedPages = referenceManager.findUncreated(); super.initialize( context, params ); Collection< String > result = null; final TreeMap< String, String > sortedMap = new TreeMap<>(); if( uncreatedPages != null ) { for( final String uncreatedPageName : uncreatedPages ) { final Collection< String > referrers = referenceManager.findReferrers( uncreatedPageName ); if( referrers != null ) { for( final String referringPage : referrers ) { sortedMap.put( referringPage, "" ); } } } result = sortedMap.keySet(); } result = super.filterAndSortCollection( result ); final String wikitext = wikitizeCollection( result, m_separator, items ); final StringBuilder resultHTML = new StringBuilder(); resultHTML.append( makeHTML( context, wikitext ) ); // add the more.... text if( items < result.size() && items > 0 ) { final Object[] args = { "" + ( result.size() - items ) }; extras = MessageFormat.format( extras, args ); resultHTML.append( "<br/>" + extras + "<br/>" ); } return resultHTML.toString(); }
161005_97
@Override public String execute( final Context context, final Map<String, String> params) throws PluginException { final ResourceBundle rb = Preferences.getBundle(context, Plugin.CORE_PLUGINS_RESOURCEBUNDLE); final ReferenceManager referenceManager = context.getEngine().getManager( ReferenceManager.class ); final int items = TextUtil.parseIntParameter(params.get(PARAM_MAX), ALL_ITEMS); String extras = params.get(PARAM_EXTRAS); if (extras == null) { extras = rb.getString("referringundefinedpagesplugin.more"); } final Collection< String > uncreatedPages = referenceManager.findUncreated(); super.initialize( context, params ); Collection< String > result = null; final TreeMap< String, String > sortedMap = new TreeMap<>(); if( uncreatedPages != null ) { for( final String uncreatedPageName : uncreatedPages ) { final Collection< String > referrers = referenceManager.findReferrers( uncreatedPageName ); if( referrers != null ) { for( final String referringPage : referrers ) { sortedMap.put( referringPage, "" ); } } } result = sortedMap.keySet(); } result = super.filterAndSortCollection( result ); final String wikitext = wikitizeCollection( result, m_separator, items ); final StringBuilder resultHTML = new StringBuilder(); resultHTML.append( makeHTML( context, wikitext ) ); // add the more.... text if( items < result.size() && items > 0 ) { final Object[] args = { "" + ( result.size() - items ) }; extras = MessageFormat.format( extras, args ); resultHTML.append( "<br/>" + extras + "<br/>" ); } return resultHTML.toString(); }
161005_98
@Override public String execute( final Context context, final Map<String, String> params) throws PluginException { final ResourceBundle rb = Preferences.getBundle(context, Plugin.CORE_PLUGINS_RESOURCEBUNDLE); final ReferenceManager referenceManager = context.getEngine().getManager( ReferenceManager.class ); final int items = TextUtil.parseIntParameter(params.get(PARAM_MAX), ALL_ITEMS); String extras = params.get(PARAM_EXTRAS); if (extras == null) { extras = rb.getString("referringundefinedpagesplugin.more"); } final Collection< String > uncreatedPages = referenceManager.findUncreated(); super.initialize( context, params ); Collection< String > result = null; final TreeMap< String, String > sortedMap = new TreeMap<>(); if( uncreatedPages != null ) { for( final String uncreatedPageName : uncreatedPages ) { final Collection< String > referrers = referenceManager.findReferrers( uncreatedPageName ); if( referrers != null ) { for( final String referringPage : referrers ) { sortedMap.put( referringPage, "" ); } } } result = sortedMap.keySet(); } result = super.filterAndSortCollection( result ); final String wikitext = wikitizeCollection( result, m_separator, items ); final StringBuilder resultHTML = new StringBuilder(); resultHTML.append( makeHTML( context, wikitext ) ); // add the more.... text if( items < result.size() && items > 0 ) { final Object[] args = { "" + ( result.size() - items ) }; extras = MessageFormat.format( extras, args ); resultHTML.append( "<br/>" + extras + "<br/>" ); } return resultHTML.toString(); }
161005_99
@Override public String execute( final Context context, final Map< String, String > params ) throws PluginException { final ReferenceManager refmgr = context.getEngine().getManager( ReferenceManager.class ); String pageName = params.get( PARAM_PAGE ); final ResourceBundle rb = Preferences.getBundle( context, Plugin.CORE_PLUGINS_RESOURCEBUNDLE ); StringBuilder result = new StringBuilder( 256 ); if( pageName == null ) { pageName = context.getPage().getName(); } final Page page = context.getEngine().getManager( PageManager.class ).getPage( pageName ); if( page != null ) { Collection< String > links = refmgr.findReferrers( page.getName() ); String wikitext; super.initialize( context, params ); final int items = TextUtil.parseIntParameter( params.get( PARAM_MAX ), ALL_ITEMS ); String extras = TextUtil.replaceEntities( params.get( PARAM_EXTRAS ) ); if( extras == null ) { extras = rb.getString("referringpagesplugin.more"); } if( log.isDebugEnabled() ) { log.debug( "Fetching referring pages for " + page.getName() + " with a max of "+items); } if( links != null && links.size() > 0 ) { links = filterAndSortCollection( links ); wikitext = wikitizeCollection( links, m_separator, items ); result.append( makeHTML( context, wikitext ) ); if( items < links.size() && items > 0 ) { final Object[] args = { "" + ( links.size() - items) }; extras = MessageFormat.format(extras, args); result.append( "<br />" ) .append( "<a class='morelink' href='" ) .append( context.getURL( ContextEnum.PAGE_INFO.getRequestContext(), page.getName() ) ) .append( "' " ) .append( ">" ) .append( extras ) .append( "</a><br />" ); } } // // If nothing was left after filtering or during search // if( links == null || links.size() == 0 ) { wikitext = rb.getString( "referringpagesplugin.nobody" ); result.append( makeHTML( context, wikitext ) ); } else { if( m_show.equals( PARAM_SHOW_VALUE_COUNT ) ) { result = new StringBuilder(); result.append( links.size() ); if( m_lastModified ) { result.append( " (" ).append( m_dateFormat.format( m_dateLastModified ) ).append( ")" ); } } } return result.toString(); } return ""; }
1613090_0
public abstract void createTableLike(String dbName, String existingTblName, sts, boolean isExternal, ;
1613090_1
public abstract void renameTable(String dbName, String oldName, ;
1613090_2
public abstract void updateTableSchema(String dbName, String tableName, List<HCatFieldSchema> columnSchema) ;
1613090_3
;
1613090_4
public static boolean isset(String s) { return (s != null) && (s.length() > 0); }
1613090_5
public static boolean isset(String s) { return (s != null) && (s.length() > 0); }
1613090_6
public static String extractPercentComplete(String line) { Matcher jar = JAR_COMPLETE.matcher(line); if (jar.find()) return jar.group().trim(); Matcher pig = PIG_COMPLETE.matcher(line); if (pig.find()) return pig.group().trim(); return null; }
1613090_7
public static String encodeArray(String[] plain) { if (plain == null) return null; String[] escaped = new String[plain.length]; for (int i = 0; i < plain.length; ++i) { if (plain[i] == null) { plain[i] = ""; } escaped[i] = StringUtils.escapeString(plain[i]); } return StringUtils.arrayToString(escaped); }
1613090_8
public static String[] decodeArray(String s) { if (s == null) return null; String[] escaped = StringUtils.split(s); String[] plain = new String[escaped.length]; for (int i = 0; i < escaped.length; ++i) plain[i] = StringUtils.unEscapeString(escaped[i]); return plain; }
1613090_9
public static Path hadoopFsPath(String fname, Configuration conf, String user) throws URISyntaxException, FileNotFoundException, IOException, InterruptedException { if (fname == null || conf == null) { return null; } final Configuration fConf = new Configuration(conf); final String finalFName = new String(fname); UserGroupInformation ugi = UserGroupInformation.getLoginUser(); final FileSystem defaultFs = ugi.doAs(new PrivilegedExceptionAction<FileSystem>() { public FileSystem run() throws URISyntaxException, FileNotFoundException, IOException, InterruptedException { return FileSystem.get(new URI(finalFName), fConf); } }); URI u = new URI(fname); Path p = new Path(u).makeQualified(defaultFs); if (hadoopFsIsMissing(defaultFs, p)) throw new FileNotFoundException("File " + fname + " does not exist."); return p; }
1619254_0
public void setAnswerType(QuestionType answerType) { QuestionType previousBasicAnswerType = this.getBasicAnswerType(); QuestionType basicAnswerType = answerType; if (basicAnswerType == null || (!basicAnswerType.equals(QuestionType.TYPE_TEXT) && !basicAnswerType.equals(QuestionType.TYPE_NUMBER) && !basicAnswerType.equals(QuestionType.TYPE_DECIMAL) && !basicAnswerType.equals(QuestionType.TYPE_BOOLEAN) && !basicAnswerType.equals(QuestionType.TYPE_DATE) && !basicAnswerType.equals(QuestionType.TYPE_LIST))) { throw new IllegalArgumentException("answerType " + answerType + " is invalid"); } this.answerType = answerType; if (!basicAnswerType.equals(previousBasicAnswerType)) { clearAnswer(); } }
1619254_1
@Modifies( { "lastAnswer", "decimalAnswer", "numberAnswer", "textAnswer", "booleanAnswer", "listAnswer", "dateAnswer", "answered" } ) public void setAnswer(Object answer) { if (answerType == null) { throw new IllegalStateException("answerType has not been specified"); } QuestionType basicAnswerType = getBasicAnswerType(); setLastAnswer( (answer != null) ? answer.toString() : null); if (basicAnswerType.equals(QuestionType.TYPE_TEXT)) { setTextAnswer((String) answer); } if (basicAnswerType.equals(QuestionType.TYPE_NUMBER)) { if (answer != null) { setNumberAnswer(((Number) answer).longValue()); } else { setNumberAnswer(null); } } if (basicAnswerType.equals(QuestionType.TYPE_DECIMAL)) { setDecimalAnswer((BigDecimal) answer); } if (basicAnswerType.equals(QuestionType.TYPE_BOOLEAN)) { setBooleanAnswer((Boolean) answer); } if (basicAnswerType.equals(QuestionType.TYPE_DATE)) { setDateAnswer((Date) answer); } if (basicAnswerType.equals(QuestionType.TYPE_LIST)) { setListAnswer((String) answer); } }
1619254_2
public Object getAnswer() { if (answerType == null) { throw new IllegalStateException("answerType has not been specified"); } QuestionType basicAnswerType = getBasicAnswerType(); if (basicAnswerType.equals(QuestionType.TYPE_TEXT)) { return textAnswer; } if (basicAnswerType.equals(QuestionType.TYPE_NUMBER)) { return numberAnswer; } if (basicAnswerType.equals(QuestionType.TYPE_DECIMAL)) { return decimalAnswer; } if (basicAnswerType.equals(QuestionType.TYPE_BOOLEAN)) { return booleanAnswer; } if (basicAnswerType.equals(QuestionType.TYPE_DATE)) { return getDateAnswer(); } if (basicAnswerType.equals(QuestionType.TYPE_LIST)) { return listAnswer; } throw new IllegalStateException(); }
1619254_3
@Modifies( "items" ) public void setItems(String[] items) { this.items.clear(); if (items != null) { for (String s : items) { addItem(s); } } }
1619254_4
@Modifies( "items" ) public void addItem(String itemId) { if (validItemId(itemId)) { this.items.add(itemId); } }
1619254_5
@Modifies( "items" ) public void setItemsAsString(String items) { this.items.clear(); if (items != null) { StringTokenizer tok = new StringTokenizer(items,COMMA_SEPARATOR); while (tok.hasMoreTokens()) { this.items.add(tok.nextToken()); } } }
1619254_6
@Modifies( "items" ) public void setItems(String[] items) { this.items.clear(); if (items != null) { for (String s : items) { addItem(s); } } }
1619254_7
@Modifies( "items" ) public void addItem(String itemId) { if (validItemId(itemId)) { this.items.add(itemId); } }
1619254_8
@Modifies( "items" ) public void insertItem(String itemId, String beforeItemId) { if ((beforeItemId == null) || (beforeItemId.length() == 0)) { addItem(itemId); } else if (validItemId(itemId)) { int pos = this.items.indexOf(beforeItemId); if (pos < 0) { addItem(itemId); } else { this.items.add(pos, itemId); } } }
1619254_9
public void setValue(double value) { this.value = value; }
1619733_1
public static void main( String[] argv ) { Logger logger = Logger.getLogger(ModeShapeExample.class); logger.debug("Starting the custom logging example application"); // Create and start the engine ... logger.debug("Starting the ModeShape engine ..."); ModeShapeEngine engine = new ModeShapeEngine(); engine.start(); // Load the configuration for a repository via the classloader (can also use path to a file)... Repository repository = null; String repositoryName = null; try { URL url = ModeShapeExample.class.getClassLoader().getResource("my-repository-config.json"); RepositoryConfiguration config = RepositoryConfiguration.read(url); // We could change the name of the repository programmatically ... // config = config.withName("Some Other Repository"); // Verify the configuration for the repository ... Problems problems = config.validate(); if (problems.hasErrors()) { System.err.println("Problems starting the engine."); System.err.println(problems); System.exit(-1); } // Deploy the repository ... logger.debug("Deploying the '{0}' repository ...", config.getName()); repository = engine.deploy(config); repositoryName = config.getName(); } catch (Throwable e) { e.printStackTrace(); System.exit(-1); return; } Session session = null; try { // Get the repository logger.debug("Getting the '{0}' repository and creating a Session ...", repositoryName); repository = engine.getRepository(repositoryName); // Create a session ... session = repository.login("default"); // Get the root node ... Node root = session.getRootNode(); assert root != null; System.out.println("Found the root node in the \"" + session.getWorkspace().getName() + "\" workspace"); } catch (RepositoryException e) { e.printStackTrace(); } finally { if (session != null) session.logout(); System.out.println("Shutting down engine ..."); try { engine.shutdown().get(); System.out.println("Success!"); } catch (Exception e) { e.printStackTrace(); } } }
1619733_3
public static void main( String[] argv ) { // Create and start the engine ... ModeShapeEngine engine = new ModeShapeEngine(); engine.start(); // Load the configuration for a repository via the classloader (can also use path to a file)... Repository repository = null; String repositoryName = null; try { URL url = ModeShapeExample.class.getClassLoader().getResource("my-repository-config.json"); RepositoryConfiguration config = RepositoryConfiguration.read(url); // We could change the name of the repository programmatically ... // config = config.withName("Some Other Repository"); // Verify the configuration for the repository ... Problems problems = config.validate(); if (problems.hasErrors()) { System.err.println("Problems starting the engine."); System.err.println(problems); System.exit(-1); } // Deploy the repository ... repository = engine.deploy(config); repositoryName = config.getName(); } catch (Throwable e) { e.printStackTrace(); System.exit(-1); return; } Session session = null; try { // Get the repository repository = engine.getRepository(repositoryName); // Create a session ... session = repository.login("default"); // Get the root node ... Node root = session.getRootNode(); assert root != null; System.out.println("Found the root node in the \"" + session.getWorkspace().getName() + "\" workspace"); } catch (RepositoryException e) { e.printStackTrace(); } finally { if (session != null) session.logout(); System.out.println("Shutting down engine ..."); try { engine.shutdown().get(); System.out.println("Success!"); } catch (Exception e) { e.printStackTrace(); } } }
1619733_5
public static void main( String[] argv ) { // Create and start the engine ... ModeShapeEngine engine = new ModeShapeEngine(); engine.start(); // Load the configuration for a repository via the classloader (can also use path to a file)... Repository repository = null; try { URL url = ModeShapeExample.class.getClassLoader().getResource("my-repository-config.json"); RepositoryConfiguration config = RepositoryConfiguration.read(url); // Verify the configuration for the repository ... Problems problems = config.validate(); if (problems.hasErrors()) { System.err.println("Problems starting the engine."); System.err.println(problems); System.exit(-1); } // Deploy the repository ... repository = engine.deploy(config); } catch (Throwable e) { e.printStackTrace(); System.exit(-1); return; } try { // setup some global Picketbox state SecurityFactory.prepare(); verifyAuthenticationAndAuthorization(repository, "admin", true, true); verifyAuthenticationAndAuthorization(repository, "john", true, true); verifyAuthenticationAndAuthorization(repository, "sue", true, true); verifyAuthenticationAndAuthorization(repository, "bob", true, false); verifyAuthenticationAndAuthorization(repository, "dummy", false, false); } catch (Exception e) { e.printStackTrace(); } finally { // cleanup the global picketbox state SecurityFactory.release(); try { engine.shutdown().get(); System.out.println("Success!"); } catch (Exception e) { e.printStackTrace(); } } }
1619733_6
public static void main( String[] argv ) { // Create and start the engine ... ModeShapeEngine engine = new ModeShapeEngine(); engine.start(); // Load the configuration for a repository via the classloader (can also use path to a file)... Repository repository = null; String repositoryName = null; try { URL url = ModeShapeExample.class.getClassLoader().getResource("repository-config.json"); RepositoryConfiguration config = RepositoryConfiguration.read(url); // Verify the configuration for the repository ... Problems problems = config.validate(); if (problems.hasErrors()) { System.err.println("Problems starting the engine."); System.err.println(problems); System.exit(-1); } // Deploy the repository ... repository = engine.deploy(config); repositoryName = config.getName(); } catch (Throwable e) { e.printStackTrace(); System.exit(-1); return; } Session session = null; try { //create some files on the file system File folder = prepareFS(); // Get the repository repository = engine.getRepository(repositoryName); // Create a session ... session = repository.login("default"); // Get the root node ... Node root = session.getRootNode(); assert root != null; String workspaceName = session.getWorkspace().getName(); System.out.println("Found the root node in the \"" + workspaceName + "\" workspace"); Node rootFolder = session.getNode("/rootFolder"); System.out.println("/rootFolder (projection root)"); NodeIterator childIterator = rootFolder.getNodes(); while (childIterator.hasNext()) { Node child = childIterator.nextNode(); String primaryType = child.getPrimaryNodeType().getName(); System.out.println("+---> " + child.getName() + " (" + primaryType + ")"); child.addMixin("file:anyProperties"); child.setProperty("customProperty", "custom value"); } session.save(); System.out.println( "Stored some custom properties in json files, checkout the " + folder.getAbsolutePath() + " folder"); } catch (Exception e) { e.printStackTrace(); } finally { if (session != null) { session.logout(); } System.out.println("Shutting down engine ..."); try { engine.shutdown().get(); System.out.println("Success!"); } catch (Exception e) { e.printStackTrace(); } } }
1619733_7
public Database parse( File file ) throws IOException { // Read the file into a single string ... String ddl = readFile(file); // Create the object that will parse the file ... DdlParsers parsers = new DdlParsers(); AstNode node = parsers.parse(ddl, file.getName()); // Now process the AST ... System.out.println(node.toString()); return processStatements(node); }
1619733_8
public static void main( String[] argv ) { Random rnd = new Random(); // Create and start the engine ... ModeShapeEngine engine = new ModeShapeEngine(); engine.start(); // Load the configuration for a repository via the classloader (can also use path to a file)... Repository repository = null; String repositoryName = null; try { URL url = ModeShapeExample.class.getClassLoader().getResource("my-repository-config.json"); RepositoryConfiguration config = RepositoryConfiguration.read(url); // We could change the name of the repository programmatically ... // config = config.withName("Some Other Repository"); // Verify the configuration for the repository ... Problems problems = config.validate(); if (problems.hasErrors()) { System.err.println("Problems starting the engine."); System.err.println(problems); System.exit(-1); } // Deploy the repository ... repository = engine.deploy(config); repositoryName = config.getName(); } catch (Throwable e) { e.printStackTrace(); System.exit(-1); return; } Session session = null; try { // Get the repository repository = engine.getRepository(repositoryName); // Create a session ... session = repository.login("default"); // Get the root node ... Node root = session.getRootNode(); assert root != null; System.out.println("Found the root node in the \"" + session.getWorkspace().getName() + "\" workspace"); Node n = root.addNode("Node" + rnd.nextInt()); n.setProperty("key", "value"); n.setProperty("content", session.getValueFactory().createBinary(new ByteArrayInputStream(new byte[1000]))); session.save(); System.out.println("Added one node under root"); System.out.println("+ Root childs"); NodeIterator it = root.getNodes(); while (it.hasNext()) { System.out.println("+---> " + it.nextNode().getName()); } } catch (Exception e) { e.printStackTrace(); } finally { if (session != null) session.logout(); System.out.println("Shutting down engine ..."); try { engine.shutdown().get(); System.out.println("Success!"); } catch (Exception e) { e.printStackTrace(); } } }
1619733_9
public static void main( String[] argv ) { // Create and start the engine ... ModeShapeEngine engine = new ModeShapeEngine(); engine.start(); // Load the configuration for a repository via the classloader (can also use path to a file)... Repository repository = null; String repositoryName = null; try { URL url = ModeShapeExample.class.getClassLoader().getResource("my-repository-config.json"); RepositoryConfiguration config = RepositoryConfiguration.read(url); // Verify the configuration for the repository ... Problems problems = config.validate(); if (problems.hasErrors()) { System.err.println("Problems starting the engine."); System.err.println(problems); System.exit(-1); } // Deploy the repository ... repository = engine.deploy(config); repositoryName = config.getName(); } catch (Throwable e) { e.printStackTrace(); System.exit(-1); return; } Session session = null; JcrTools tools = new JcrTools(); try { // Get the repository repository = engine.getRepository(repositoryName); // Create a session ... session = repository.login("default"); // Create the '/files' node that is an 'nt:folder' ... Node root = session.getRootNode(); Node filesNode = root.addNode("files", "nt:folder"); assert filesNode != null; // Update a couple of files ... tools.uploadFile(session, "/files/caution.png", getFile("caution.png")); tools.uploadFile(session, "/files/sample1.mp3", getFile("sample1.mp3")); tools.uploadFile(session, "/files/fixedWidthFile.txt", getFile("fixedWidthFile.txt")); tools.uploadFile(session, "/files/MySource.java", getFile("MySource.java")); // Save the session ... session.save(); // Now look for the output. Note that sequencing may take a bit, so we'll cheat by just trying // to find the node until we can find it, waiting a maximum amount of time before failing. // The proper way is to either use events or not to expect the sequencers have finished. Node png = findNodeAndWait(session, "/images/caution.png", 10, TimeUnit.SECONDS); if (print) tools.printSubgraph(png); Node sampleMp3 = findNodeAndWait(session, "/audio/sample1.mp3", 10, TimeUnit.SECONDS); if (print) tools.printSubgraph(sampleMp3); Node javaClass = findNodeAndWait(session, "/java/MySource.java", 10, TimeUnit.SECONDS); if (print) tools.printSubgraph(javaClass); Node textFile = findNodeAndWait(session, "/text/fixedWidthFile.txt", 10, TimeUnit.SECONDS); if (print) tools.printSubgraph(textFile); } catch (IOException e) { e.printStackTrace(); } catch (RepositoryException e) { e.printStackTrace(); } catch (InterruptedException e) { e.printStackTrace(); } finally { if (session != null) session.logout(); System.out.println("Shutting down engine ..."); try { engine.shutdown().get(); System.out.println("Success!"); } catch (Exception e) { e.printStackTrace(); } } }
1626780_0
public Map<String, Integer> asMap() { ImmutableMap.Builder<String, Integer> ret = ImmutableMap.builder(); for (Map.Entry<String, Node> ent : this.rootNode.children.entrySet()) { populateMap(ret, ent.getKey(), ent.getValue()); } return ret.build(); }
1626780_1
public NodeTree withValue(String node, int value) { String[] parts = SPLIT_REGEX.split(node.toLowerCase()); Node newRoot = new Node(new HashMap<>(this.rootNode.children)); Node newPtr = newRoot; Node currentPtr = this.rootNode; newPtr.value = currentPtr == null ? 0 : currentPtr.value; for (String part : parts) { Node oldChild = currentPtr == null ? null : currentPtr.children.get(part); Node newChild = new Node(oldChild != null ? new HashMap<>(oldChild.children) : new HashMap<String, Node>()); newPtr.children.put(part, newChild); currentPtr = oldChild; newPtr = newChild; } newPtr.value = value; return new NodeTree(newRoot); }
1626780_2
public NodeTree withAll(Map<String, Integer> values) { NodeTree ret = this; for (Map.Entry<String, Integer> ent : values.entrySet()) { ret = ret.withValue(ent.getKey(), ent.getValue()); } return ret; }
1626780_3
public static SchemaMigration twoToThree() { // The big one return dao -> { dao.legacy().renameTable(dao, "permissions", "permissions_old"); dao.legacy().renameTable(dao, "permissions_entity", "permissions_entity_old"); dao.legacy().renameTable(dao, "permissions_inheritance", "permissions_inheritance_old"); dao.initializeTables(); // Transfer world inheritance try (PreparedStatement stmt = dao.prepareStatement("SELECT id, child, parent FROM {}permissions_inheritance_old WHERE type=2 ORDER BY child, parent, id ASC")) { ResultSet rs = stmt.executeQuery(); try (PreparedStatement insert = dao.prepareStatement(dao.getInsertContextInheritanceQuery())) { insert.setString(1, "world"); insert.setString(3, "world"); while (rs.next()) { insert.setString(2, rs.getString(2)); insert.setString(4, rs.getString(3)); insert.addBatch(); } insert.executeBatch(); } } Map<String, List<SubjectRef>> defaultSubjects = new HashMap<>(); Map<String, List<Map.Entry<SubjectRef, Integer>>> tempRankLadders = new HashMap<>(); try (PreparedStatement select = dao.prepareStatement("SELECT type, name FROM {}permissions_entity_old")) { ResultSet rs = select.executeQuery(); while (rs.next()) { SubjectRef ref = dao.getOrCreateSubjectRef(LegacyMigration.Type.values()[rs.getInt(1)].name().toLowerCase(), rs.getString(2)); Segment currentSeg = null; String currentWorld = null; Map<String, Segment> worldSegments = new HashMap<>(); try (PreparedStatement selectPermissionsOptions = dao.prepareStatement("SELECT id, permission, world, value FROM {}permissions_old WHERE type=? AND name=? ORDER BY world, id DESC")) { selectPermissionsOptions.setInt(1, rs.getInt(1)); selectPermissionsOptions.setString(2, rs.getString(2)); ResultSet perms = selectPermissionsOptions.executeQuery(); Map<String, Integer> newPerms = new HashMap<>(); Map<String, String> options = new HashMap<>(); String rank = null, rankLadder = null; int defaultVal = 0; while (perms.next()) { String worldChecked = perms.getString(3); if (worldChecked != null && worldChecked.isEmpty()) { worldChecked = null; } if (currentSeg == null || !Objects.equals(worldChecked, currentWorld)) { if (currentSeg != null) { if (!options.isEmpty()) { dao.setOptions(currentSeg, options); options.clear(); } if (!newPerms.isEmpty()) { dao.setPermissions(currentSeg, newPerms); newPerms.clear(); } if (defaultVal != 0) { dao.setDefaultValue(currentSeg, defaultVal); defaultVal = 0; } } currentWorld = worldChecked; currentSeg = Segment.unallocated(currentWorld == null ? ImmutableSet.of() : ImmutableSet.of(new ContextValue<String>("world", currentWorld))); dao.allocateSegment(ref, currentSeg); worldSegments.put(currentWorld, currentSeg); } String key = perms.getString(2); final String value = perms.getString(4); if (value == null || value.isEmpty()) { // permission int val = key.startsWith("-") ? -1 : 1; if (val == -1) { key = key.substring(1); } if (key.equals("*")) { defaultVal = val; continue; } key = ConversionUtils.convertLegacyPermission(key); newPerms.put(key, val); } else { if (currentWorld == null) { boolean rankEq = key.equals("rank"), rankLadderEq = !rankEq && key.equals("rank-ladder"); if (rankEq || rankLadderEq) { if (rankEq) { rank = value; } else { // then it's the rank ladder rankLadder = value; } if (rank != null && rankLadder != null) { List<Map.Entry<SubjectRef, Integer>> ladder = tempRankLadders.computeIfAbsent(rankLadder, ign -> new ArrayList<>()); try { ladder.add(Maps.immutableEntry(ref, Integer.parseInt(rank))); } catch (IllegalArgumentException ex) {} rankLadder = null; rank = null; } continue; } } if (key.equals("default") && value.equalsIgnoreCase("true")) { defaultSubjects.computeIfAbsent(currentWorld, ign -> new ArrayList<>()).add(ref); continue; } options.put(key, value); } } if (currentSeg != null) { if (!options.isEmpty()) { dao.setOptions(currentSeg, options); } if (!newPerms.isEmpty()) { dao.setPermissions(currentSeg, newPerms); } if (defaultVal != 0) { dao.setDefaultValue(currentSeg, defaultVal); } if (rank != null) { List<Map.Entry<SubjectRef, Integer>> ladder = tempRankLadders.computeIfAbsent("default", ign -> new ArrayList<>()); try { ladder.add(Maps.immutableEntry(ref, Integer.parseInt(rank))); } catch (IllegalArgumentException ex) {} } } } for (Map.Entry<String, List<Map.Entry<SubjectRef, Integer>>> ent : tempRankLadders.entrySet()) { List<SubjectRef> ladder = ent.getValue().stream() .sorted((a, b) -> Integer.compare(b.getValue(), a.getValue())) .map(Map.Entry::getKey) .collect(GuavaCollectors.toImmutableList()); dao.setRankLadder(ent.getKey(), new SqlRankLadder(ent.getKey(), ladder)); } if (!defaultSubjects.isEmpty()) { SubjectRef defaultSubj = dao.getOrCreateSubjectRef(PermissionsEx.SUBJECTS_FALLBACK, PermissionsEx.SUBJECTS_USER); List<Segment> segments = new ArrayList<>(dao.getSegments(defaultSubj)); for (Map.Entry<String, List<SubjectRef>> ent : defaultSubjects.entrySet()) { Segment seg = null; if (!segments.isEmpty()) { for (Segment segment : segments) { if (ent.getKey() == null && segment.getContexts().isEmpty()) { seg = segment; break; } else if (segment.getContexts().size() == 1) { ContextValue<?> ctx = segment.getContexts().iterator().next(); if (ctx.getKey().equals("world") && ctx.getRawValue().equals(ent.getKey())) { seg = segment; break; } } } } if (seg == null) { seg = Segment.unallocated(ent.getKey() == null ? ImmutableSet.of() : ImmutableSet.of(new ContextValue<String>("world", ent.getKey()))); dao.allocateSegment(defaultSubj, seg); segments.add(seg); } dao.setParents(seg, ent.getValue()); } } try (PreparedStatement selectInheritance = dao.prepareStatement(dao.legacy().getSelectParentsQuery())) { selectInheritance.setString(1, rs.getString(2)); selectInheritance.setInt(2, rs.getInt(1)); ResultSet inheritance = selectInheritance.executeQuery(); List<SubjectRef> newInheritance = new LinkedList<>(); while (inheritance.next()) { if (currentSeg == null || !Objects.equals(inheritance.getString(3), currentWorld)) { if (currentSeg != null && !newInheritance.isEmpty()) { dao.setParents(currentSeg, newInheritance); newInheritance.clear(); } currentWorld = inheritance.getString(3); currentSeg = worldSegments.get(currentWorld); if (currentSeg == null) { currentSeg = Segment.unallocated(currentWorld == null ? ImmutableSet.of() : ImmutableSet.of(new ContextValue<String>("world", currentWorld))); dao.allocateSegment(ref, currentSeg); worldSegments.put(currentWorld, currentSeg); } } newInheritance.add(dao.getOrCreateSubjectRef(PermissionsEx.SUBJECTS_GROUP, inheritance.getString(2))); } if (currentSeg != null && !newInheritance.isEmpty()) { dao.setParents(currentSeg, newInheritance); newInheritance.clear(); } } } } dao.deleteTable("permissions_old"); dao.deleteTable("permissions_entity_old"); dao.deleteTable("permissions_inheritance_old"); }; }
1626780_4
public Optional<SubjectRef> getSubjectRef(int id) throws SQLException { try (PreparedStatement stmt = prepareStatement(getGetSubjectRefIdQuery())) { stmt.setInt(1, id); ResultSet res = stmt.executeQuery(); if (!res.next()) { return Optional.empty(); } return Optional.of(new SubjectRef(id, res.getString(1), res.getString(2))); } }
1626780_5
public SubjectRef getOrCreateSubjectRef(String type, String name) throws SQLException { final SubjectRef ret = SubjectRef.unresolved(type, name); allocateSubjectRef(ret); return ret; }
1626780_6
public boolean removeSubject(SubjectRef ref) throws SQLException { try (PreparedStatement stmt = prepareStatement(getDeleteSubjectIdQuery())) { stmt.setInt(1, ref.getId()); return stmt.executeUpdate() > 0; } }
1626780_7
public Set<String> getRegisteredTypes() throws SQLException { try (ResultSet rs = prepareStatement(getSelectSubjectTypesQuery()).executeQuery()) { ImmutableSet.Builder<String> ret = ImmutableSet.builder(); while (rs.next()) { ret.add(rs.getString(1)); } return ret.build(); } }
1626780_8
public Set<String> getAllIdentifiers(String type) throws SQLException { try (PreparedStatement stmt = prepareStatement(getSelectSubjectIdentifiersQuery())) { stmt.setString(1, type); ResultSet rs = stmt.executeQuery(); ImmutableSet.Builder<String> ret = ImmutableSet.builder(); while (rs.next()) { ret.add(rs.getString(1)); } return ret.build(); } }
1626780_9
public void setDefaultValue(Segment segment, Integer permissionDefault) throws SQLException { try (PreparedStatement stmt = prepareStatement(getUpdatePermissionDefaultQuery())) { if (permissionDefault == null) { stmt.setNull(1, Types.INTEGER); } else { stmt.setInt(1, permissionDefault); } stmt.setInt(2, segment.getId()); stmt.executeUpdate(); } }
1628050_0
public static TxnId parse (String idString) { Matcher matcher = pattern.matcher(idString); if (!matcher.matches() && matcher.groupCount() != 5) throw new IllegalArgumentException("Invalid idString '" + idString + "'"); return new TxnId().init( Integer.parseInt(matcher.group(1)), Integer.parseInt(matcher.group(2)), Integer.parseInt(matcher.group(3)), Integer.parseInt(matcher.group(4)), Integer.parseInt(matcher.group(5)) ); }
1628050_1
public static TxnId parse (String idString) { Matcher matcher = pattern.matcher(idString); if (!matcher.matches() && matcher.groupCount() != 5) throw new IllegalArgumentException("Invalid idString '" + idString + "'"); return new TxnId().init( Integer.parseInt(matcher.group(1)), Integer.parseInt(matcher.group(2)), Integer.parseInt(matcher.group(3)), Integer.parseInt(matcher.group(4)), Integer.parseInt(matcher.group(5)) ); }
1628050_2
public static void validate (APICredential cred, SecretKey secretKey, byte[]... payLoad) throws NoSuchAlgorithmException, InvalidKeyException { if (!VERSION.equals(cred.getVersion())) throw new IllegalArgumentException ("unsupported.version"); assertNotNull(payLoad, "invalid.payLoad"); assertNotNull(secretKey, "invalid.secret"); assertNotNull(cred.getHash(), "invalid.null.hash"); assertTimestamp(cred.getTimestamp()); assertEquals(computeHash(secretKey, cred.getTimestamp(), cred.getNonce(), payLoad), cred.getHash(), "invalid.hash"); }
1628050_3
public static void validate (APICredential cred, SecretKey secretKey, byte[]... payLoad) throws NoSuchAlgorithmException, InvalidKeyException { if (!VERSION.equals(cred.getVersion())) throw new IllegalArgumentException ("unsupported.version"); assertNotNull(payLoad, "invalid.payLoad"); assertNotNull(secretKey, "invalid.secret"); assertNotNull(cred.getHash(), "invalid.null.hash"); assertTimestamp(cred.getTimestamp()); assertEquals(computeHash(secretKey, cred.getTimestamp(), cred.getNonce(), payLoad), cred.getHash(), "invalid.hash"); }
1628050_4
public GLTransaction createReverse() { return createReverse(false); }
1628050_5
public long next (long wrapAt) { synchronized (this) { if (++value > wrapAt) value = 1; } return value; }
1628050_6
public long next (long wrapAt) { synchronized (this) { if (++value > wrapAt) value = 1; } return value; }
1628050_7
@Override public int unpack(byte[] inStream, int offset, Map<String, String> fields) throws ISOException { int packedSize = interpretter.getPackedLength(size); if (inStream.length - offset < packedSize) { throw new ISOException(String.format("Field [%s] at offset [%d]:Expecting %d bytes found %d", getName(),offset,packedSize, inStream.length - offset)); } String interprettedvalue = interpretter.uninterpret(inStream, offset, size); if (getValue() != null) { if (!getValue().equals(interprettedvalue)) { throw new ISOException(String.format("Field [%s] at offset [%d]:Expected %s but found %s", getName(),offset,getValue(), interprettedvalue)); } } fields.put(getName(),interprettedvalue); value = interprettedvalue; return offset + packedSize; }
1628050_8
@Override public int unpack(byte[] inStream, int offset, Map<String, String> fields) throws ISOException { int packedSize = interpretter.getPackedLength(size); if (inStream.length - offset < packedSize) { throw new ISOException(String.format("Field [%s] at offset [%d]:Expecting %d bytes found %d", getName(),offset,packedSize, inStream.length - offset)); } String interprettedvalue = interpretter.uninterpret(inStream, offset, size); if (getValue() != null) { if (!getValue().equals(interprettedvalue)) { throw new ISOException(String.format("Field [%s] at offset [%d]:Expected %s but found %s", getName(),offset,getValue(), interprettedvalue)); } } fields.put(getName(),interprettedvalue); value = interprettedvalue; return offset + packedSize; }
1628050_9
@Override public int unpack(byte[] inStream, int offset, Map<String, String> fields) throws ISOException { int packedSize = interpretter.getPackedLength(size); if (inStream.length - offset < packedSize) { throw new ISOException(String.format("Field [%s] at offset [%d]:Expecting %d bytes found %d", getName(),offset,packedSize, inStream.length - offset)); } String interprettedvalue = interpretter.uninterpret(inStream, offset, size); if (getValue() != null) { if (!getValue().equals(interprettedvalue)) { throw new ISOException(String.format("Field [%s] at offset [%d]:Expected %s but found %s", getName(),offset,getValue(), interprettedvalue)); } } fields.put(getName(),interprettedvalue); value = interprettedvalue; return offset + packedSize; }
1639726_0
private void register(String cpaId, Class<? extends Validator> handlerClass, Properties config) { String contentType = config.getProperty("contentType"); ValidatorComponent vc = getComponent(); if(contentType == null) { vc.registerDefault(cpaId, handlerClass,config); } else { vc.register(cpaId, contentType, handlerClass,config); } }
1639726_1
private String checkMessageStatus(String input)throws SOAPRequestException{ if(input !=null && !(input.equalsIgnoreCase(MessageClassifier.INTERNAL_STATUS_RECEIVED) || input.equalsIgnoreCase(MessageClassifier.INTERNAL_STATUS_PENDING) || input.equalsIgnoreCase(MessageClassifier.INTERNAL_STATUS_PROCESSING) || input.equalsIgnoreCase(MessageClassifier.INTERNAL_STATUS_PROCESSED) || input.equalsIgnoreCase(MessageClassifier.INTERNAL_STATUS_PROCESSED_ERROR) || input.equalsIgnoreCase(MessageClassifier.INTERNAL_STATUS_DELIVERED) || input.equalsIgnoreCase(MessageClassifier.INTERNAL_STATUS_DELIVERY_FAILURE))){ String errMsg = "No such message status, you have entered ["+input+"]"; throw new SOAPRequestException(errMsg); }else{ return (input==null?input:input.toUpperCase()); } }
1639726_2
private String checkMessageBox(String input)throws SOAPRequestException{ if(input !=null && !(input.equalsIgnoreCase(MessageClassifier.MESSAGE_BOX_INBOX) || input.equalsIgnoreCase(MessageClassifier.MESSAGE_BOX_OUTBOX))){ String errMsg = "Wrong Message Box entered, you have entered: ["+ input+"]"; throw new SOAPRequestException(errMsg); }else{ return (input==null?input:input.toLowerCase()); } }
1639726_3
public void onMessage(Message message) { log().debug("got message:" + message.getSource().toString()); try { EbmsRequest ebmsRequest = buildEbmsRequest(message); getMSH().processOutboundMessage(ebmsRequest, null); } catch (Exception e) { log().error("Failed to process outbound message: " + e); log().debug("",e); throw new RuntimeException(e); } }
1639726_4
public int findInboxReadyMaxSequenceNoByCpa(MessageDVO data) throws DAOException { List l = super.find( "find_inbox_ready_max_sequence_no_by_cpa", new Object[] { data.getCpaId(), data.getService(), data.getAction(), data.getConvId() }); Iterator i = l.iterator(); if (i.hasNext()) { MessageDataSourceDVO resultData = (MessageDataSourceDVO) i.next(); return resultData.getSequenceNo(); } return -1; }
1639726_5
public List findMessageByCpa(MessageDVO data, int numberOfMessage) throws DAOException { List parameters = new ArrayList(); String sql = super.getFinder("find_message_by_cpa"); parameters.add(data.getCpaId()); parameters.add(data.getService()); parameters.add(data.getAction()); if (data.getConvId() != null) { sql += " AND " + getFilter("find_message_by_cpa_filter_conv_id"); parameters.add(data.getConvId()); } if (data.getFromPartyId() != null) { sql += " AND " + getFilter("find_message_by_cpa_filter_from_party_id"); parameters.add(data.getFromPartyId()); } if (data.getFromPartyRole() != null) { sql += " AND " + getFilter("find_message_by_cpa_filter_from_party_role"); parameters.add(data.getFromPartyRole()); } if (data.getToPartyId() != null) { sql += " AND " + getFilter("find_message_by_cpa_filter_to_party_id"); parameters.add(data.getToPartyId()); } if (data.getToPartyRole() != null) { sql += " AND " + getFilter("find_message_by_cpa_filter_to_party_role"); parameters.add(data.getToPartyRole()); } sql += " " + getOrder("find_message_by_cpa_order"); parameters.add(new Integer(numberOfMessage)); return executeQuery(sql, parameters.toArray()); }
1639726_6
public List findMessagesByHistory(MessageDVO data, int numberOfMessage, int offset) throws DAOException { List parameters = new ArrayList(); boolean hasSearchCriteria = false; String sql = super.getFinder("find_message_by_history"); if (data.getMessageId() != null && !data.getMessageId().trim().equals("")) { sql += " AND " + getFilter("find_message_by_history_filter_message_id"); parameters.add(data.getMessageId()); } if (data.getMessageBox() != null && !data.getMessageBox().trim().equals("")) { sql += " AND " + getFilter("find_message_by_history_filter_message_box"); parameters.add(data.getMessageBox()); } if (data.getCpaId() != null && !data.getCpaId().trim().equals("")) { sql += " AND " + getFilter("find_message_by_history_filter_cpa_id"); parameters.add(data.getCpaId()); } if (data.getService() != null && !data.getService().trim().equals("")) { sql += " AND " + getFilter("find_message_by_history_filter_service"); parameters.add(data.getService()); } if (data.getAction() != null && !data.getAction().trim().equals("")) { sql += " AND " + getFilter("find_message_by_history_filter_action"); parameters.add(data.getAction()); } if (data.getStatus() != null && !data.getStatus().trim().equals("")) { sql += " AND " + getFilter("find_message_by_history_filter_status"); parameters.add(data.getStatus()); } if (data.getConvId() != null && !data.getConvId().trim().equals("")) { sql += " AND " + getFilter("find_message_by_history_filter_conv_id"); parameters.add(data.getConvId()); } (data.getPrimalMessageId() != null && !data.getPrimalMessageId().trim().equals("")) { sql += " AND " + getFilter("find_message_by_history_filter_primal_message_id"); parameters.add(data.getPrimalMessageId()); } l += " " + getOrder("find_message_by_history_order"); parameters.add(new Integer(numberOfMessage)); parameters.add(new Integer(offset)); return executeQuery(sql, parameters.toArray()); }
1639726_7
public int findNumberOfMessagesByHistory(MessageDVO data) throws DAOException { try { List parameters = new ArrayList(); String sql = super.getFinder("find_number_of_message_by_history"); if (data.getMessageId() != null && !data.getMessageId().trim().equals("")) { sql += " AND " + getFilter("find_number_of_message_by_history_filter_message_id"); parameters.add(data.getMessageId()); } if (data.getMessageBox() != null && !data.getMessageBox().trim().equals("")) { sql += " AND " + getFilter("find_number_of_message_by_history_filter_message_box"); parameters.add(data.getMessageBox()); } if (data.getCpaId() != null && !data.getCpaId().trim().equals("")) { sql += " AND " + getFilter("find_number_of_message_by_history_filter_cpa_id"); parameters.add(data.getCpaId()); } if (data.getService() != null && !data.getService().trim().equals("")) { sql += " AND " +getFilter("find_number_of_message_by_history_filter_service"); parameters.add(data.getService()); } if (data.getAction() != null && !data.getAction().trim().equals("")) { sql += " AND " + getFilter("find_number_of_message_by_history_filter_action"); parameters.add(data.getAction()); } if (data.getStatus() != null && !data.getStatus().trim().equals("")) { sql += " AND " + getFilter("find_number_of_message_by_history_filter_status"); parameters.add(data.getStatus()); } if (data.getConvId() != null && !data.getConvId().trim().equals("")) { sql += " AND " + getFilter("find_number_of_message_by_history_filter_conv_id"); parameters.add(data.getConvId()); } (data.getPrimalMessageId() != null && !data.getPrimalMessageId().trim().equals("")) { sql += " AND " + getFilter("find_number_of_message_by_history_filter_primal_message_id"); parameters.add(data.getPrimalMessageId()); } List queryResult = executeRawQuery(sql, parameters.toArray()); List resultEntry = (List) queryResult.get(0); return ((Number) resultEntry.get(0)).intValue(); } catch (Exception e) { throw new DAOException( "Unable to find the number of messages by history", e); } }
1639726_8
public long findInboxNextOrderNo() throws DAOException { try { List result = super.executeRawQuery(super.getFinder("find_inbox_next_order_no"), new Object[] {}); List resultEntry = (List) result.get(0); return ((Number) resultEntry.get(0)).longValue(); } catch (Exception e) { return 1; } }
1639726_9
@Override public void messageReceived(EbxmlMessage requestMessage) { try { initialiseJMSConnection(); sendMessageToQueue(requestMessage); closeSession(); } catch (JMSException e) { EbmsProcessor.core.log.error(e); connection = null; } }
1642369_0
public Page<City> findCities(CitySearchCriteria criteria, Pageable pageable) { Assert.notNull(criteria, "Criteria must not be null"); String name = criteria.getName(); if (!StringUtils.hasLength(name)) { return this.cityRepository.findAll(null); } String country = ""; int splitPos = name.lastIndexOf(","); if (splitPos >= 0) { country = name.substring(splitPos + 1); name = name.substring(0, splitPos); } name = "%" + name.trim() + "%"; country = "%" + country.trim() + "%"; return this.cityRepository.findByNameLikeAndCountryLikeAllIgnoringCase(name, country, pageable); }
1642369_1
public Page<City> findCities(CitySearchCriteria criteria, Pageable pageable) { Assert.notNull(criteria, "Criteria must not be null"); String name = criteria.getName(); if (!StringUtils.hasLength(name)) { return this.cityRepository.findAll(null); } String country = ""; int splitPos = name.lastIndexOf(","); if (splitPos >= 0) { country = name.substring(splitPos + 1); name = name.substring(0, splitPos); } name = "%" + name.trim() + "%"; country = "%" + country.trim() + "%"; return this.cityRepository.findByNameLikeAndCountryLikeAllIgnoringCase(name, country, pageable); }
1642369_2
public Page<City> findCities(CitySearchCriteria criteria, Pageable pageable) { Assert.notNull(criteria, "Criteria must not be null"); String name = criteria.getName(); if (!StringUtils.hasLength(name)) { return this.cityRepository.findAll(null); } String country = ""; int splitPos = name.lastIndexOf(","); if (splitPos >= 0) { country = name.substring(splitPos + 1); name = name.substring(0, splitPos); } name = "%" + name.trim() + "%"; country = "%" + country.trim() + "%"; return this.cityRepository.findByNameLikeAndCountryLikeAllIgnoringCase(name, country, pageable); }
1642369_3
public Page<City> findCities(CitySearchCriteria criteria, Pageable pageable) { Assert.notNull(criteria, "Criteria must not be null"); String name = criteria.getName(); if (!StringUtils.hasLength(name)) { return this.cityRepository.findAll(null); } String country = ""; int splitPos = name.lastIndexOf(","); if (splitPos >= 0) { country = name.substring(splitPos + 1); name = name.substring(0, splitPos); } name = "%" + name.trim() + "%"; country = "%" + country.trim() + "%"; return this.cityRepository.findByNameLikeAndCountryLikeAllIgnoringCase(name, country, pageable); }
1642369_4
public City getCity(String name, String country) { Assert.notNull(name, "Name must not be null"); Assert.notNull(country, "Country must not be null"); return this.cityRepository.findByNameAndCountryAllIgnoringCase(name, country); }
1642369_5
public Page<HotelSummary> getHotels(City city, Pageable pageable) { Assert.notNull(city, "City must not be null"); return this.hotelSummaryRepository.findByCity(city, pageable); }
1642369_6
public Hotel getHotel(City city, String name) { Assert.notNull(city, "City must not be null"); Assert.hasLength(name, "Name must not be empty"); return this.hotelRepository.findByCityAndName(city, name); }
1642369_7
public Page<Review> getReviews(Hotel hotel, Pageable pageable) { Assert.notNull(hotel, "Hotel must not be null"); return this.reviewRepository.findByHotel(hotel, pageable); }
1642369_8
public Review getReview(Hotel hotel, int reviewNumber) { Assert.notNull(hotel, "Hotel must not be null"); return this.reviewRepository.findByHotelAndIndex(hotel, reviewNumber); }
1642369_9
public ReviewsSummary getReviewSummary(Hotel hotel) { List<RatingCount> ratingCounts = this.hotelSummaryRepository.findRatingCounts(hotel); return new ReviewsSummaryImpl(ratingCounts); }
1644461_0
public static Graph create( String sourceName, RepositoryConnectionFactory connectionFactory, ExecutionContext context ) { return new Graph(sourceName, connectionFactory, context); }
1644461_1
public Move<Conjunction<Graph>> move( Node from ) { return move(from.getLocation()); }
1644461_2
public Copy<Graph> copy( Node from ) { return copy(from.getLocation()); }
1644461_3
public Conjunction<Graph> delete( Node at ) { requests.deleteBranch(at.getLocation(), getCurrentWorkspaceName()); return nextGraph; }
1644461_4
public CreateWorkspace createWorkspace() { return new CreateWorkspace() { /** * {@inheritDoc} * * @see org.modeshape.graph.Graph.NameWorkspace#named(java.lang.String) */ public Workspace named( String workspaceName ) { CreateWorkspaceRequest request = requests.createWorkspace(workspaceName, CreateConflictBehavior.DO_NOT_CREATE); return setWorkspace(request.getActualWorkspaceName(), request.getActualLocationOfRoot()); } /** * {@inheritDoc} * * @see org.modeshape.graph.Graph.CreateWorkspace#namedSomethingLike(java.lang.String) */ public Workspace namedSomethingLike( String workspaceName ) { CreateWorkspaceRequest request = requests.createWorkspace(workspaceName, CreateConflictBehavior.CREATE_WITH_ADJUSTED_NAME); return setWorkspace(request.getActualWorkspaceName(), request.getActualLocationOfRoot()); } /** * {@inheritDoc} * * @see org.modeshape.graph.Graph.CreateWorkspace#clonedFrom(java.lang.String) */ public NameWorkspace clonedFrom( final String nameOfWorkspaceToClone ) { return new NameWorkspace() { /** * {@inheritDoc} * * @see org.modeshape.graph.Graph.NameWorkspace#named(java.lang.String) */ public Workspace named( String nameOfWorkspaceToCreate ) { CloneWorkspaceRequest request = requests.cloneWorkspace(nameOfWorkspaceToClone, nameOfWorkspaceToCreate, CreateConflictBehavior.DO_NOT_CREATE, CloneConflictBehavior.DO_NOT_CLONE); return setWorkspace(request.getActualWorkspaceName(), request.getActualLocationOfRoot()); } /** * {@inheritDoc} * * @see org.modeshape.graph.Graph.NameWorkspace#namedSomethingLike(java.lang.String) */ public Workspace namedSomethingLike( String nameOfWorkspaceToCreate ) { CloneWorkspaceRequest request = requests.cloneWorkspace(nameOfWorkspaceToClone, nameOfWorkspaceToCreate, CreateConflictBehavior.CREATE_WITH_ADJUSTED_NAME, CloneConflictBehavior.DO_NOT_CLONE); return setWorkspace(request.getActualWorkspaceName(), request.getActualLocationOfRoot()); } }; } }; }
1644461_5
public CreateWorkspace createWorkspace() { return new CreateWorkspace() { /** * {@inheritDoc} * * @see org.modeshape.graph.Graph.NameWorkspace#named(java.lang.String) */ public Workspace named( String workspaceName ) { CreateWorkspaceRequest request = requests.createWorkspace(workspaceName, CreateConflictBehavior.DO_NOT_CREATE); return setWorkspace(request.getActualWorkspaceName(), request.getActualLocationOfRoot()); } /** * {@inheritDoc} * * @see org.modeshape.graph.Graph.CreateWorkspace#namedSomethingLike(java.lang.String) */ public Workspace namedSomethingLike( String workspaceName ) { CreateWorkspaceRequest request = requests.createWorkspace(workspaceName, CreateConflictBehavior.CREATE_WITH_ADJUSTED_NAME); return setWorkspace(request.getActualWorkspaceName(), request.getActualLocationOfRoot()); } /** * {@inheritDoc} * * @see org.modeshape.graph.Graph.CreateWorkspace#clonedFrom(java.lang.String) */ public NameWorkspace clonedFrom( final String nameOfWorkspaceToClone ) { return new NameWorkspace() { /** * {@inheritDoc} * * @see org.modeshape.graph.Graph.NameWorkspace#named(java.lang.String) */ public Workspace named( String nameOfWorkspaceToCreate ) { CloneWorkspaceRequest request = requests.cloneWorkspace(nameOfWorkspaceToClone, nameOfWorkspaceToCreate, CreateConflictBehavior.DO_NOT_CREATE, CloneConflictBehavior.DO_NOT_CLONE); return setWorkspace(request.getActualWorkspaceName(), request.getActualLocationOfRoot()); } /** * {@inheritDoc} * * @see org.modeshape.graph.Graph.NameWorkspace#namedSomethingLike(java.lang.String) */ public Workspace namedSomethingLike( String nameOfWorkspaceToCreate ) { CloneWorkspaceRequest request = requests.cloneWorkspace(nameOfWorkspaceToClone, nameOfWorkspaceToCreate, CreateConflictBehavior.CREATE_WITH_ADJUSTED_NAME, CloneConflictBehavior.DO_NOT_CLONE); return setWorkspace(request.getActualWorkspaceName(), request.getActualLocationOfRoot()); } }; } }; }
1644461_6
public CreateWorkspace createWorkspace() { return new CreateWorkspace() { /** * {@inheritDoc} * * @see org.modeshape.graph.Graph.NameWorkspace#named(java.lang.String) */ public Workspace named( String workspaceName ) { CreateWorkspaceRequest request = requests.createWorkspace(workspaceName, CreateConflictBehavior.DO_NOT_CREATE); return setWorkspace(request.getActualWorkspaceName(), request.getActualLocationOfRoot()); } /** * {@inheritDoc} * * @see org.modeshape.graph.Graph.CreateWorkspace#namedSomethingLike(java.lang.String) */ public Workspace namedSomethingLike( String workspaceName ) { CreateWorkspaceRequest request = requests.createWorkspace(workspaceName, CreateConflictBehavior.CREATE_WITH_ADJUSTED_NAME); return setWorkspace(request.getActualWorkspaceName(), request.getActualLocationOfRoot()); } /** * {@inheritDoc} * * @see org.modeshape.graph.Graph.CreateWorkspace#clonedFrom(java.lang.String) */ public NameWorkspace clonedFrom( final String nameOfWorkspaceToClone ) { return new NameWorkspace() { /** * {@inheritDoc} * * @see org.modeshape.graph.Graph.NameWorkspace#named(java.lang.String) */ public Workspace named( String nameOfWorkspaceToCreate ) { CloneWorkspaceRequest request = requests.cloneWorkspace(nameOfWorkspaceToClone, nameOfWorkspaceToCreate, CreateConflictBehavior.DO_NOT_CREATE, CloneConflictBehavior.DO_NOT_CLONE); return setWorkspace(request.getActualWorkspaceName(), request.getActualLocationOfRoot()); } /** * {@inheritDoc} * * @see org.modeshape.graph.Graph.NameWorkspace#namedSomethingLike(java.lang.String) */ public Workspace namedSomethingLike( String nameOfWorkspaceToCreate ) { CloneWorkspaceRequest request = requests.cloneWorkspace(nameOfWorkspaceToClone, nameOfWorkspaceToCreate, CreateConflictBehavior.CREATE_WITH_ADJUSTED_NAME, CloneConflictBehavior.DO_NOT_CLONE); return setWorkspace(request.getActualWorkspaceName(), request.getActualLocationOfRoot()); } }; } }; }
1644461_7
public CreateWorkspace createWorkspace() { return new CreateWorkspace() { /** * {@inheritDoc} * * @see org.modeshape.graph.Graph.NameWorkspace#named(java.lang.String) */ public Workspace named( String workspaceName ) { CreateWorkspaceRequest request = requests.createWorkspace(workspaceName, CreateConflictBehavior.DO_NOT_CREATE); return setWorkspace(request.getActualWorkspaceName(), request.getActualLocationOfRoot()); } /** * {@inheritDoc} * * @see org.modeshape.graph.Graph.CreateWorkspace#namedSomethingLike(java.lang.String) */ public Workspace namedSomethingLike( String workspaceName ) { CreateWorkspaceRequest request = requests.createWorkspace(workspaceName, CreateConflictBehavior.CREATE_WITH_ADJUSTED_NAME); return setWorkspace(request.getActualWorkspaceName(), request.getActualLocationOfRoot()); } /** * {@inheritDoc} * * @see org.modeshape.graph.Graph.CreateWorkspace#clonedFrom(java.lang.String) */ public NameWorkspace clonedFrom( final String nameOfWorkspaceToClone ) { return new NameWorkspace() { /** * {@inheritDoc} * * @see org.modeshape.graph.Graph.NameWorkspace#named(java.lang.String) */ public Workspace named( String nameOfWorkspaceToCreate ) { CloneWorkspaceRequest request = requests.cloneWorkspace(nameOfWorkspaceToClone, nameOfWorkspaceToCreate, CreateConflictBehavior.DO_NOT_CREATE, CloneConflictBehavior.DO_NOT_CLONE); return setWorkspace(request.getActualWorkspaceName(), request.getActualLocationOfRoot()); } /** * {@inheritDoc} * * @see org.modeshape.graph.Graph.NameWorkspace#namedSomethingLike(java.lang.String) */ public Workspace namedSomethingLike( String nameOfWorkspaceToCreate ) { CloneWorkspaceRequest request = requests.cloneWorkspace(nameOfWorkspaceToClone, nameOfWorkspaceToCreate, CreateConflictBehavior.CREATE_WITH_ADJUSTED_NAME, CloneConflictBehavior.DO_NOT_CLONE); return setWorkspace(request.getActualWorkspaceName(), request.getActualLocationOfRoot()); } }; } }; }
1644461_8
public Workspace useWorkspace( String workspaceName ) { VerifyWorkspaceRequest request = requests.verifyWorkspace(workspaceName); return setWorkspace(request.getActualWorkspaceName(), request.getActualLocationOfRoot()); }
1644461_9
public QueryResults search( final String fullTextSearchExpression, int maxResults, int offset ) { FullTextSearchRequest request = requests.search(getCurrentWorkspaceName(), fullTextSearchExpression, maxResults, offset); QueryResults results = new org.modeshape.graph.query.process.QueryResults(request.getResultColumns(), request.getStatistics(), request.getTuples()); return results; }
1644585_0
@Override public void applyTo(ServerDriverHttpUriRequest request) { request.setSocketTimeout(timeout); }
1644585_1
public String toString() { return mutableUrl.toString(); }
1644585_2
public String toString() { return mutableUrl.toString(); }
1644585_3
@Override public void applyTo(ServerDriverHttpUriRequest request) { request.setConnectionTimeout(connectionTimeout); request.setSocketTimeout(socketTimeout); }
1644585_4
@Override public void applyTo(ServerDriverHttpUriRequest request) { HttpUriRequest internalRequest = request.getHttpUriRequest(); if (!(internalRequest instanceof HttpEntityEnclosingRequest)) { return; } HttpEntityEnclosingRequest entityRequest = (HttpEntityEnclosingRequest) internalRequest; entityRequest.setHeader("Content-type", contentType); entityRequest.setEntity(new StringEntity(content, createContentType(contentType))); }
1644585_5
@Override public void applyTo(ServerDriverHttpUriRequest request) { HttpUriRequest internalRequest = request.getHttpUriRequest(); if (!(internalRequest instanceof HttpEntityEnclosingRequest)) { return; } HttpEntityEnclosingRequest entityRequest = (HttpEntityEnclosingRequest) internalRequest; entityRequest.setHeader("Content-type", contentType); entityRequest.setEntity(new StringEntity(content, createContentType(contentType))); }
1644585_6
@Override public void applyTo(ServerDriverHttpUriRequest request) { HttpUriRequest internalRequest = request.getHttpUriRequest(); if (!(internalRequest instanceof HttpEntityEnclosingRequest)) { return; } HttpEntityEnclosingRequest entityRequest = (HttpEntityEnclosingRequest) internalRequest; entityRequest.setHeader("Content-type", contentType); ByteArrayEntity entity = new ByteArrayEntity(content); entity.setContentType(contentType); entityRequest.setEntity(entity); }
1644585_7
@Override public void applyTo(ServerDriverHttpUriRequest request) { HttpUriRequest internalRequest = request.getHttpUriRequest(); if (!(internalRequest instanceof HttpEntityEnclosingRequest)) { return; } HttpEntityEnclosingRequest entityRequest = (HttpEntityEnclosingRequest) internalRequest; entityRequest.setHeader("Content-type", contentType); ByteArrayEntity entity = new ByteArrayEntity(content); entity.setContentType(contentType); entityRequest.setEntity(entity); }