idx int32 46 1.86M | input stringlengths 321 6.6k | target stringlengths 9 1.24k |
|---|---|---|
789,658 | final ListRateBasedRulesResult executeListRateBasedRules(ListRateBasedRulesRequest listRateBasedRulesRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(listRateBasedRulesRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<ListRateBasedRulesRequest> request = null;<NEW_LINE>Response<ListRateBasedRulesResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new ListRateBasedRulesRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(listRateBasedRulesRequest));<NEW_LINE>// Binds the request metrics to the current request.<NEW_LINE>request.setAWSRequestMetrics(awsRequestMetrics);<NEW_LINE>request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);<NEW_LINE>request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());<NEW_LINE>request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());<NEW_LINE>request.<MASK><NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "ListRateBasedRules");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<ListRateBasedRulesResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new ListRateBasedRulesResultJsonUnmarshaller());<NEW_LINE>response = invoke(request, responseHandler, executionContext);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>endClientExecution(awsRequestMetrics, request, response);<NEW_LINE>}<NEW_LINE>} | addHandlerContext(HandlerContextKey.SERVICE_ID, "WAF"); |
308,828 | public void testJsonbDemo() throws Exception {<NEW_LINE>// Convert Java Object --> JSON<NEW_LINE>Team zombies = new Team();<NEW_LINE>zombies.name = "Zombies";<NEW_LINE>zombies.size = 9;<NEW_LINE>zombies.winLossRatio = 0.85f;<NEW_LINE>Jsonb jsonb = JsonbProvider.provider().create().build();<NEW_LINE>String teamJson = jsonb.toJson(zombies);<NEW_LINE>System.out.println(teamJson);<NEW_LINE>assertTrue(teamJson.contains("\"name\":\"Zombies\""));<NEW_LINE>assertTrue<MASK><NEW_LINE>assertTrue(teamJson.contains("\"winLossRatio\":0.8"));<NEW_LINE>// Convert JSON --> Java Object<NEW_LINE>Team rangers = jsonb.fromJson("{\"name\":\"Rangers\",\"size\":7,\"winLossRatio\":0.6}", Team.class);<NEW_LINE>System.out.println(rangers.name);<NEW_LINE>assertEquals("Rangers", rangers.name);<NEW_LINE>assertEquals(7, rangers.size);<NEW_LINE>assertEquals(0.6f, rangers.winLossRatio, 0.01f);<NEW_LINE>} | (teamJson.contains("\"size\":9")); |
1,151,603 | private static void validateAndFormatExpression(Symbol function, AnalyzedColumnDefinition<Symbol> columnDefinitionWithExpressionSymbols, AnalyzedColumnDefinition<Object> columnDefinitionEvaluated, Consumer<String> formattedExpressionConsumer) {<NEW_LINE>String formattedExpression;<NEW_LINE>DataType<?> valueType = function.valueType();<NEW_LINE>DataType<?> definedType = columnDefinitionWithExpressionSymbols.dataType();<NEW_LINE>if (SymbolVisitors.any(Symbols::isAggregate, function)) {<NEW_LINE>throw new UnsupportedOperationException("Aggregation functions are not allowed in generated columns: " + function);<NEW_LINE>}<NEW_LINE>// check for optional defined type and add `cast` to expression if possible<NEW_LINE>if (definedType != null && !definedType.equals(valueType)) {<NEW_LINE>final DataType<?> columnDataType;<NEW_LINE>if (ArrayType.NAME.equals(columnDefinitionWithExpressionSymbols.collectionType())) {<NEW_LINE>columnDataType = new ArrayType<>(definedType);<NEW_LINE>} else {<NEW_LINE>columnDataType = definedType;<NEW_LINE>}<NEW_LINE>if (!valueType.isConvertableTo(columnDataType, false)) {<NEW_LINE>throw new IllegalArgumentException(String.format(Locale.ENGLISH, "expression value type '%s' not supported for conversion to '%s'", valueType<MASK><NEW_LINE>}<NEW_LINE>Symbol castFunction = CastFunctionResolver.generateCastFunction(function, columnDataType);<NEW_LINE>formattedExpression = castFunction.toString(Style.UNQUALIFIED);<NEW_LINE>} else {<NEW_LINE>if (valueType instanceof ArrayType) {<NEW_LINE>columnDefinitionEvaluated.collectionType(ArrayType.NAME);<NEW_LINE>columnDefinitionEvaluated.dataType(ArrayType.unnest(valueType).getName());<NEW_LINE>} else {<NEW_LINE>columnDefinitionEvaluated.dataType(valueType.getName());<NEW_LINE>}<NEW_LINE>formattedExpression = function.toString(Style.UNQUALIFIED);<NEW_LINE>}<NEW_LINE>formattedExpressionConsumer.accept(formattedExpression);<NEW_LINE>} | , columnDataType.getName())); |
1,681,254 | public void init() {<NEW_LINE>if (configurationWrapper != null) {<NEW_LINE>eventMeshEnv = checkNotEmpty(ConfKeys.KEYS_EVENTMESH_ENV);<NEW_LINE>sysID = checkNumeric(ConfKeys.KEYS_EVENTMESH_SYSID);<NEW_LINE>eventMeshCluster = checkNotEmpty(ConfKeys.KEYS_EVENTMESH_SERVER_CLUSTER);<NEW_LINE>eventMeshName = checkNotEmpty(ConfKeys.KEYS_EVENTMESH_SERVER_NAME);<NEW_LINE>eventMeshIDC = checkNotEmpty(ConfKeys.KEYS_EVENTMESH_IDC);<NEW_LINE>eventMeshServerIp = get(ConfKeys.KEYS_EVENTMESH_SERVER_HOST_IP, IPUtils::getLocalAddress);<NEW_LINE>eventMeshConnectorPluginType = checkNotEmpty(ConfKeys.KEYS_ENENTMESH_CONNECTOR_PLUGIN_TYPE);<NEW_LINE>eventMeshServerSecurityEnable = Boolean.parseBoolean(get(ConfKeys.KEYS_EVENTMESH_SECURITY_ENABLED, () -> "false"));<NEW_LINE>eventMeshSecurityPluginType = checkNotEmpty(ConfKeys.KEYS_ENENTMESH_SECURITY_PLUGIN_TYPE);<NEW_LINE>eventMeshServerRegistryEnable = Boolean.parseBoolean(get(ConfKeys.KEYS_EVENTMESH_REGISTRY_ENABLED, () -> "false"));<NEW_LINE>eventMeshRegistryPluginType = checkNotEmpty(ConfKeys.KEYS_ENENTMESH_REGISTRY_PLUGIN_TYPE);<NEW_LINE>String metricsPluginType = <MASK><NEW_LINE>if (StringUtils.isNotEmpty(metricsPluginType)) {<NEW_LINE>eventMeshMetricsPluginType = Arrays.stream(metricsPluginType.split(",")).filter(StringUtils::isNotBlank).map(String::trim).collect(Collectors.toList());<NEW_LINE>}<NEW_LINE>eventMeshServerTraceEnable = Boolean.parseBoolean(get(ConfKeys.KEYS_EVENTMESH_TRACE_ENABLED, () -> "false"));<NEW_LINE>eventMeshTracePluginType = checkNotEmpty(ConfKeys.KEYS_EVENTMESH_TRACE_PLUGIN_TYPE);<NEW_LINE>}<NEW_LINE>} | configurationWrapper.getProp(ConfKeys.KEYS_EVENTMESH_METRICS_PLUGIN_TYPE); |
1,517,519 | public GetVaultLockResult unmarshall(JsonUnmarshallerContext context) throws Exception {<NEW_LINE>GetVaultLockResult getVaultLockResult = new GetVaultLockResult();<NEW_LINE><MASK><NEW_LINE>String currentParentElement = context.getCurrentParentElement();<NEW_LINE>int targetDepth = originalDepth + 1;<NEW_LINE>JsonToken token = context.getCurrentToken();<NEW_LINE>if (token == null)<NEW_LINE>token = context.nextToken();<NEW_LINE>if (token == VALUE_NULL) {<NEW_LINE>return getVaultLockResult;<NEW_LINE>}<NEW_LINE>while (true) {<NEW_LINE>if (token == null)<NEW_LINE>break;<NEW_LINE>if (token == FIELD_NAME || token == START_OBJECT) {<NEW_LINE>if (context.testExpression("Policy", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>getVaultLockResult.setPolicy(context.getUnmarshaller(String.class).unmarshall(context));<NEW_LINE>}<NEW_LINE>if (context.testExpression("State", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>getVaultLockResult.setState(context.getUnmarshaller(String.class).unmarshall(context));<NEW_LINE>}<NEW_LINE>if (context.testExpression("ExpirationDate", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>getVaultLockResult.setExpirationDate(context.getUnmarshaller(String.class).unmarshall(context));<NEW_LINE>}<NEW_LINE>if (context.testExpression("CreationDate", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>getVaultLockResult.setCreationDate(context.getUnmarshaller(String.class).unmarshall(context));<NEW_LINE>}<NEW_LINE>} else if (token == END_ARRAY || token == END_OBJECT) {<NEW_LINE>if (context.getLastParsedParentElement() == null || context.getLastParsedParentElement().equals(currentParentElement)) {<NEW_LINE>if (context.getCurrentDepth() <= originalDepth)<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>token = context.nextToken();<NEW_LINE>}<NEW_LINE>return getVaultLockResult;<NEW_LINE>} | int originalDepth = context.getCurrentDepth(); |
1,300,452 | public static GetEntityListResponse unmarshall(GetEntityListResponse getEntityListResponse, UnmarshallerContext context) {<NEW_LINE>getEntityListResponse.setRequestId(context.stringValue("GetEntityListResponse.requestId"));<NEW_LINE>getEntityListResponse.setCode(context.stringValue("GetEntityListResponse.Code"));<NEW_LINE>getEntityListResponse.setSuccess(context.booleanValue("GetEntityListResponse.Success"));<NEW_LINE>getEntityListResponse.setMessage(context.stringValue("GetEntityListResponse.Message"));<NEW_LINE>Data data = new Data();<NEW_LINE>PageInfo pageInfo = new PageInfo();<NEW_LINE>pageInfo.setCurrentPage(context.integerValue("GetEntityListResponse.Data.PageInfo.CurrentPage"));<NEW_LINE>pageInfo.setPageSize(context.integerValue("GetEntityListResponse.Data.PageInfo.PageSize"));<NEW_LINE>pageInfo.setTotalCount(context.integerValue("GetEntityListResponse.Data.PageInfo.TotalCount"));<NEW_LINE>pageInfo.setCount(context.integerValue("GetEntityListResponse.Data.PageInfo.Count"));<NEW_LINE>data.setPageInfo(pageInfo);<NEW_LINE>List<Entity> list = new ArrayList<Entity>();<NEW_LINE>for (int i = 0; i < context.lengthValue("GetEntityListResponse.Data.List.Length"); i++) {<NEW_LINE>Entity entity = new Entity();<NEW_LINE>entity.setUuid(context.stringValue("GetEntityListResponse.Data.List[" + i + "].Uuid"));<NEW_LINE>entity.setGroupId(context.longValue("GetEntityListResponse.Data.List[" + i + "].GroupId"));<NEW_LINE>entity.setIp(context.stringValue("GetEntityListResponse.Data.List[" + i + "].Ip"));<NEW_LINE>entity.setInstanceName(context.stringValue<MASK><NEW_LINE>entity.setInstanceId(context.stringValue("GetEntityListResponse.Data.List[" + i + "].InstanceId"));<NEW_LINE>entity.setRegion(context.stringValue("GetEntityListResponse.Data.List[" + i + "].Region"));<NEW_LINE>entity.setOs(context.stringValue("GetEntityListResponse.Data.List[" + i + "].Os"));<NEW_LINE>entity.setFlag(context.stringValue("GetEntityListResponse.Data.List[" + i + "].Flag"));<NEW_LINE>entity.setBuyVersion(context.stringValue("GetEntityListResponse.Data.List[" + i + "].BuyVersion"));<NEW_LINE>entity.setAegisOnline(context.booleanValue("GetEntityListResponse.Data.List[" + i + "].AegisOnline"));<NEW_LINE>entity.setAegisVersion(context.stringValue("GetEntityListResponse.Data.List[" + i + "].aegisVersion"));<NEW_LINE>list.add(entity);<NEW_LINE>}<NEW_LINE>data.setList(list);<NEW_LINE>getEntityListResponse.setData(data);<NEW_LINE>return getEntityListResponse;<NEW_LINE>} | ("GetEntityListResponse.Data.List[" + i + "].InstanceName")); |
984,752 | public static void createDomain(File location, String domainName, String username, String adminPassword, String masterPassword, String httpPort, String httpsPort, String adminPort, String domainProperties) throws IOException {<NEW_LINE>final File passwordFile = <MASK><NEW_LINE>if (passwordFile == null) {<NEW_LINE>throw new DomainCreationException();<NEW_LINE>}<NEW_LINE>final ExecutionResults results = SystemUtils.executeCommand(location, getAsadmin(location).getAbsolutePath(), "create-domain", "--interactive=false", "--adminport", adminPort, "--user", username, "--passwordfile", passwordFile.getAbsolutePath(), "--instanceport", httpPort, "--domainproperties", "http.ssl.port=" + httpsPort + (domainProperties != null ? ":" + domainProperties : ""), "--savelogin", domainName);<NEW_LINE>if (results.getStdOut().indexOf(COULD_NOT_CREATE_DOMAIN_MARKER) != -1 || results.getStdErr().indexOf(COULD_NOT_CREATE_DOMAIN_MARKER) != -1) {<NEW_LINE>throw new DomainCreationException(CLI_130);<NEW_LINE>}<NEW_LINE>if (results.getErrorCode() > 0) {<NEW_LINE>throw new DomainCreationException(results.getErrorCode());<NEW_LINE>}<NEW_LINE>} | createPasswordFile(adminPassword, masterPassword, location); |
915,700 | public Object calculate(Context ctx) {<NEW_LINE>if (param == null) {<NEW_LINE>long n = cursor.skip();<NEW_LINE>if (n < Integer.MAX_VALUE) {<NEW_LINE>return new Integer((int) n);<NEW_LINE>} else {<NEW_LINE>return new Long(n);<NEW_LINE>}<NEW_LINE>} else if (param.isLeaf()) {<NEW_LINE>Object obj = param.getLeafExpression().calculate(ctx);<NEW_LINE>if (!(obj instanceof Number)) {<NEW_LINE>MessageManager mm = EngineMessage.get();<NEW_LINE>throw new RQException("skip" + mm.getMessage("function.paramTypeError"));<NEW_LINE>}<NEW_LINE>long n = ((Number) obj).longValue();<NEW_LINE>n = cursor.skip(n);<NEW_LINE>if (n < Integer.MAX_VALUE) {<NEW_LINE>return new Integer((int) n);<NEW_LINE>} else {<NEW_LINE>return new Long(n);<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>if (param.getType() != IParam.Semicolon || param.getSubSize() != 2) {<NEW_LINE>MessageManager mm = EngineMessage.get();<NEW_LINE>throw new RQException("skip" + mm.getMessage("function.invalidParam"));<NEW_LINE>}<NEW_LINE>Expression[] exps;<NEW_LINE>IParam <MASK><NEW_LINE>if (sub == null) {<NEW_LINE>MessageManager mm = EngineMessage.get();<NEW_LINE>throw new RQException("skip" + mm.getMessage("function.invalidParam"));<NEW_LINE>} else if (sub.isLeaf()) {<NEW_LINE>exps = new Expression[] { sub.getLeafExpression() };<NEW_LINE>} else {<NEW_LINE>int count = sub.getSubSize();<NEW_LINE>exps = new Expression[count];<NEW_LINE>for (int i = 0; i < count; ++i) {<NEW_LINE>IParam p = sub.getSub(i);<NEW_LINE>if (p == null || !p.isLeaf()) {<NEW_LINE>MessageManager mm = EngineMessage.get();<NEW_LINE>throw new RQException("skip" + mm.getMessage("function.invalidParam"));<NEW_LINE>}<NEW_LINE>exps[i] = p.getLeafExpression();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>int n = cursor.skipGroup(exps, ctx);<NEW_LINE>return new Integer(n);<NEW_LINE>}<NEW_LINE>} | sub = param.getSub(1); |
34,191 | public void validate(ValidationHelper helper, Context context, String key, Paths t) {<NEW_LINE>if (t != null) {<NEW_LINE>boolean mapContainsInvalidKey = false;<NEW_LINE>for (String path : t.keySet()) {<NEW_LINE>if (path != null && !path.isEmpty()) {<NEW_LINE>if (!path.startsWith("/")) {<NEW_LINE>final String message = Tr.formatMessage(tc, "pathsRequiresSlash", path);<NEW_LINE>helper.addValidationEvent(new ValidationEvent(ValidationEvent.Severity.ERROR, context.getLocation(path), message));<NEW_LINE>}<NEW_LINE>// Ensure map doesn't contain null value<NEW_LINE>if (t.get(path) == null) {<NEW_LINE>final String message = Tr.formatMessage(tc, "nullValueInMap", path);<NEW_LINE>helper.addValidationEvent(new ValidationEvent(ValidationEvent.Severity.ERROR, context.getLocation(path), message));<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>mapContainsInvalidKey = true;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// Ensure map doesn't contain an invalid key<NEW_LINE>if (mapContainsInvalidKey) {<NEW_LINE>final String message = <MASK><NEW_LINE>helper.addValidationEvent(new ValidationEvent(ValidationEvent.Severity.ERROR, context.getLocation(), message));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | Tr.formatMessage(tc, "nullOrEmptyKeyInMap"); |
136,440 | // for filling in the text of a mention<NEW_LINE>public String tokenRangeToString(Pair<Integer, Integer> tokenRange) {<NEW_LINE>List<CoreLabel> tokens = doc.get(CoreAnnotations.TokensAnnotation.class);<NEW_LINE>// see if the token range matches an entity mention<NEW_LINE>List<CoreMap> entityMentionsInDoc = doc.get(CoreAnnotations.MentionsAnnotation.class);<NEW_LINE>Integer potentialMatchingEntityMentionIndex = tokens.get(tokenRange.first).get(CoreAnnotations.EntityMentionIndexAnnotation.class);<NEW_LINE>CoreMap potentialMatchingEntityMention = null;<NEW_LINE>if (entityMentionsInDoc != null && potentialMatchingEntityMentionIndex != null) {<NEW_LINE>potentialMatchingEntityMention = entityMentionsInDoc.get(potentialMatchingEntityMentionIndex);<NEW_LINE>}<NEW_LINE>// if there is a matching entity mention, return it's text (which has been processed to remove<NEW_LINE>// things like newlines and xml)...if there isn't return the full substring of the document text<NEW_LINE>if (potentialMatchingEntityMention != null && potentialMatchingEntityMention.get(CoreAnnotations.CharacterOffsetBeginAnnotation.class) == tokens.get(tokenRange.first).beginPosition() && potentialMatchingEntityMention.get(CoreAnnotations.CharacterOffsetEndAnnotation.class) == tokens.get(tokenRange.second).endPosition()) {<NEW_LINE>return potentialMatchingEntityMention.get(CoreAnnotations.TextAnnotation.class);<NEW_LINE>} else {<NEW_LINE>return doc.get(CoreAnnotations.TextAnnotation.class).substring(tokens.get(tokenRange.first).beginPosition(), tokens.get(tokenRange<MASK><NEW_LINE>}<NEW_LINE>} | .second).endPosition()); |
1,824,554 | private boolean areThereNewFiles(final File installLocation) throws IOException {<NEW_LINE>LogManager.log("areThereNewFiles: location " + installLocation);<NEW_LINE>Set<File> installedFiles = new HashSet<File>();<NEW_LINE>Set<File> existentFilesList = FileUtils.getRecursiveFileSet(installLocation);<NEW_LINE>for (Product product : Registry.getInstance().getProductsToUninstall()) {<NEW_LINE>LogManager.log("Taking product " + product.getUid());<NEW_LINE>if (product.getUid().startsWith("nb-")) {<NEW_LINE>// load the installed files list for this product<NEW_LINE>try {<NEW_LINE>File installedFilesList = product.getInstalledFilesList();<NEW_LINE>if (installedFilesList.exists()) {<NEW_LINE>FilesList list = new FilesList().loadXmlGz(installedFilesList);<NEW_LINE>LogManager.log("loading files list for " + product.getUid());<NEW_LINE>installedFiles.addAll(list.toList());<NEW_LINE>}<NEW_LINE>} catch (XMLException e) {<NEW_LINE>LogManager.log(ErrorLevel.WARNING, "Error loading file list for " + product.getUid());<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// add all updated files and downloaded plugins<NEW_LINE>installedFiles.addAll(UninstallUtils.getFilesToDeteleAfterUninstallation());<NEW_LINE>existentFilesList.removeAll(installedFiles);<NEW_LINE>// remove folders - there still might be some empty folders<NEW_LINE>Iterator<File<MASK><NEW_LINE>while (eflIterator.hasNext()) {<NEW_LINE>if (eflIterator.next().isDirectory()) {<NEW_LINE>eflIterator.remove();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>boolean result = !existentFilesList.isEmpty();<NEW_LINE>LogManager.log(ErrorLevel.DEBUG, "installedFiles " + Arrays.toString(installedFiles.toArray()));<NEW_LINE>LogManager.log(ErrorLevel.DEBUG, "existentFilesList after removal " + Arrays.toString(existentFilesList.toArray()));<NEW_LINE>LogManager.log("areThereNewFiles returned " + result);<NEW_LINE>return result;<NEW_LINE>} | > eflIterator = existentFilesList.iterator(); |
1,090,178 | protected boolean handleProcess(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) throws LayerGenerationException {<NEW_LINE>for (Element e : roundEnv.getElementsAnnotatedWith(VersioningSystem.Registration.class)) {<NEW_LINE>Registration a = e.getAnnotation(VersioningSystem.Registration.class);<NEW_LINE>if (a == null) {<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>// NOI18N<NEW_LINE>File f = layer(e).instanceFile("Services/VersioningSystem", null, a, null);<NEW_LINE>// NOI18N<NEW_LINE>f.methodvalue("instanceCreate", DelegatingVCS.class.getName(), "create");<NEW_LINE>// NOI18N<NEW_LINE>f.stringvalue("instanceOf", org.netbeans.modules.versioning.core.spi.VersioningSystem.class.getName());<NEW_LINE>String[] folderNames = a.metadataFolderNames();<NEW_LINE>for (int i = 0; i < folderNames.length; i++) {<NEW_LINE>// NOI18N<NEW_LINE>f.stringvalue("metadataFolderName" + i, folderNames[i]);<NEW_LINE>}<NEW_LINE>// NOI18N<NEW_LINE>f.instanceAttribute("delegate", VersioningSystem.class);<NEW_LINE>// NOI18N<NEW_LINE>f.bundlevalue("displayName", a.displayName());<NEW_LINE>// NOI18N<NEW_LINE>f.bundlevalue("menuLabel", a.menuLabel());<NEW_LINE>// NOI18N<NEW_LINE>f.stringvalue(<MASK><NEW_LINE>f.write();<NEW_LINE>}<NEW_LINE>return true;<NEW_LINE>} | "actionsCategory", a.actionsCategory()); |
970,245 | public static String identifyVM() {<NEW_LINE>SystemInfo si = new SystemInfo();<NEW_LINE>HardwareAbstractionLayer hw = si.getHardware();<NEW_LINE>// Check CPU Vendor<NEW_LINE>String vendor = hw.getProcessor().getProcessorIdentifier().getVendor().trim();<NEW_LINE>if (vmVendor.containsKey(vendor)) {<NEW_LINE>return vmVendor.get(vendor);<NEW_LINE>}<NEW_LINE>// Try well known MAC addresses<NEW_LINE>List<NetworkIF> nifs = hw.getNetworkIFs();<NEW_LINE>for (NetworkIF nif : nifs) {<NEW_LINE>String mac = nif.getMacaddr().toUpperCase();<NEW_LINE>String oui = mac.length() > 7 ? mac.substring(0, 8) : mac;<NEW_LINE>if (vmMacAddressProps.containsKey(oui)) {<NEW_LINE>return vmMacAddressProps.getProperty(oui);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// Try well known models<NEW_LINE>String model = hw.getComputerSystem().getModel();<NEW_LINE>for (String vm : vmModelArray) {<NEW_LINE>if (model.contains(vm)) {<NEW_LINE>return vm;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>String manufacturer = hw<MASK><NEW_LINE>if ("Microsoft Corporation".equals(manufacturer) && "Virtual Machine".equals(model)) {<NEW_LINE>return "Microsoft Hyper-V";<NEW_LINE>}<NEW_LINE>// Couldn't find VM, return empty string<NEW_LINE>return "";<NEW_LINE>} | .getComputerSystem().getManufacturer(); |
582,786 | private String delta(long time) {<NEW_LINE>// FIXME: a formatter can probably do this.<NEW_LINE>Period period = new Period(time, System.currentTimeMillis());<NEW_LINE>ArrayList<String> parts = new ArrayList<String>();<NEW_LINE>int years = period.getYears();<NEW_LINE>if (years > 0) {<NEW_LINE>parts.add(years + " year" + (years == 1 ? "" : "s"));<NEW_LINE>}<NEW_LINE>int months = period.getMonths();<NEW_LINE>if (months > 0) {<NEW_LINE>parts.add(months + " month" + (months == 1 ? "" : "s"));<NEW_LINE>}<NEW_LINE>int weeks = period.getWeeks();<NEW_LINE>if (weeks > 0) {<NEW_LINE>parts.add(weeks + " week" + (weeks == 1 ? "" : "s"));<NEW_LINE>}<NEW_LINE>int days = period.getDays();<NEW_LINE>if (days > 0) {<NEW_LINE>parts.add(days + " day" + (days == 1 ? "" : "s"));<NEW_LINE>}<NEW_LINE>int hours = period.getHours();<NEW_LINE>if (hours > 0) {<NEW_LINE>parts.add(hours + " hour" + (hours == 1 ? "" : "s"));<NEW_LINE>}<NEW_LINE>int minutes = period.getMinutes();<NEW_LINE>if (minutes > 0) {<NEW_LINE>parts.add(minutes + " minute" + (minutes == 1 ? "" : "s"));<NEW_LINE>}<NEW_LINE>int seconds = period.getSeconds();<NEW_LINE>if (seconds > 0) {<NEW_LINE>parts.add(seconds + " second" + (seconds == 1 ? "" : "s"));<NEW_LINE>}<NEW_LINE>if (parts.size() == 0) {<NEW_LINE><MASK><NEW_LINE>if (millis > 0) {<NEW_LINE>parts.add(millis + " millis");<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return StringUtils.join(parts.toArray(), ' ') + " ago";<NEW_LINE>} | int millis = period.getMillis(); |
416,340 | public DeregisterTaskDefinitionResult unmarshall(JsonUnmarshallerContext context) throws Exception {<NEW_LINE>DeregisterTaskDefinitionResult deregisterTaskDefinitionResult = new DeregisterTaskDefinitionResult();<NEW_LINE>int originalDepth = context.getCurrentDepth();<NEW_LINE>String currentParentElement = context.getCurrentParentElement();<NEW_LINE>int targetDepth = originalDepth + 1;<NEW_LINE>JsonToken token = context.getCurrentToken();<NEW_LINE>if (token == null)<NEW_LINE>token = context.nextToken();<NEW_LINE>if (token == VALUE_NULL) {<NEW_LINE>return deregisterTaskDefinitionResult;<NEW_LINE>}<NEW_LINE>while (true) {<NEW_LINE>if (token == null)<NEW_LINE>break;<NEW_LINE>if (token == FIELD_NAME || token == START_OBJECT) {<NEW_LINE>if (context.testExpression("taskDefinition", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>deregisterTaskDefinitionResult.setTaskDefinition(TaskDefinitionJsonUnmarshaller.getInstance<MASK><NEW_LINE>}<NEW_LINE>} else if (token == END_ARRAY || token == END_OBJECT) {<NEW_LINE>if (context.getLastParsedParentElement() == null || context.getLastParsedParentElement().equals(currentParentElement)) {<NEW_LINE>if (context.getCurrentDepth() <= originalDepth)<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>token = context.nextToken();<NEW_LINE>}<NEW_LINE>return deregisterTaskDefinitionResult;<NEW_LINE>} | ().unmarshall(context)); |
215,950 | public Map<String, Object> props() {<NEW_LINE>Map<String, Object> props = new LinkedHashMap<>();<NEW_LINE>applyTemplates(props, getResolvedExtraProperties());<NEW_LINE>props.put(KEY_DISTRIBUTION_NAME, name);<NEW_LINE>props.put(KEY_DISTRIBUTION_EXECUTABLE, executable.getName());<NEW_LINE>props.put(KEY_DISTRIBUTION_EXECUTABLE_NAME, executable.getName());<NEW_LINE>props.put(KEY_DISTRIBUTION_EXECUTABLE_UNIX, executable.resolveExecutable("linux"));<NEW_LINE>props.put(KEY_DISTRIBUTION_EXECUTABLE_WINDOWS, executable.resolveExecutable("windows"));<NEW_LINE>safePut(KEY_DISTRIBUTION_EXECUTABLE_EXTENSION_UNIX, executable.resolveUnixExtension(), props, true);<NEW_LINE>safePut(KEY_DISTRIBUTION_EXECUTABLE_EXTENSION_WINDOWS, executable.resolveWindowsExtension(), props, true);<NEW_LINE>props.put(KEY_DISTRIBUTION_TAGS_BY_SPACE, String.join(" ", tags));<NEW_LINE>props.put(KEY_DISTRIBUTION_TAGS_BY_COMMA, String.join(",", tags));<NEW_LINE>props.putAll(java.getResolvedExtraProperties());<NEW_LINE>safePut(KEY_DISTRIBUTION_JAVA_GROUP_ID, java.getGroupId(), props, true);<NEW_LINE>safePut(KEY_DISTRIBUTION_JAVA_ARTIFACT_ID, java.getArtifactId(), props, true);<NEW_LINE>safePut(KEY_DISTRIBUTION_JAVA_MAIN_CLASS, java.getMainClass(), props, true);<NEW_LINE>if (isNotBlank(java.getVersion())) {<NEW_LINE>props.put(KEY_DISTRIBUTION_JAVA_VERSION, java.getVersion());<NEW_LINE>SemVer jv = SemVer.of(java.getVersion());<NEW_LINE>safePut(KEY_DISTRIBUTION_JAVA_VERSION_MAJOR, jv.getMajor(), props, true);<NEW_LINE>safePut(KEY_DISTRIBUTION_JAVA_VERSION_MINOR, jv.getMinor(), props, true);<NEW_LINE>safePut(KEY_DISTRIBUTION_JAVA_VERSION_PATCH, jv.getPatch(), props, true);<NEW_LINE>safePut(KEY_DISTRIBUTION_JAVA_VERSION_TAG, jv.<MASK><NEW_LINE>safePut(KEY_DISTRIBUTION_JAVA_VERSION_BUILD, jv.getBuild(), props, true);<NEW_LINE>} else {<NEW_LINE>props.put(KEY_DISTRIBUTION_JAVA_VERSION, "");<NEW_LINE>props.put(KEY_DISTRIBUTION_JAVA_VERSION_MAJOR, "");<NEW_LINE>props.put(KEY_DISTRIBUTION_JAVA_VERSION_MINOR, "");<NEW_LINE>props.put(KEY_DISTRIBUTION_JAVA_VERSION_PATCH, "");<NEW_LINE>props.put(KEY_DISTRIBUTION_JAVA_VERSION_TAG, "");<NEW_LINE>props.put(KEY_DISTRIBUTION_JAVA_VERSION_BUILD, "");<NEW_LINE>}<NEW_LINE>return props;<NEW_LINE>} | getTag(), props, true); |
840,558 | public void endpointProxy(@PathVariable("instanceId") String instanceId, HttpServletRequest servletRequest, HttpServletResponse servletResponse) {<NEW_LINE>ServletServerHttpRequest request = new ServletServerHttpRequest(servletRequest);<NEW_LINE>Flux<DataBuffer> requestBody = DataBufferUtils.readInputStream(request::getBody, this.bufferFactory, 4096);<NEW_LINE>InstanceWebProxy.ForwardRequest fwdRequest = createForwardRequest(request, requestBody, this.adminContextPath + INSTANCE_MAPPED_PATH);<NEW_LINE>this.instanceWebProxy.forward(this.registry.getInstance(InstanceId.of(instanceId)), fwdRequest, (clientResponse) -> {<NEW_LINE>ServerHttpResponse response = new ServletServerHttpResponse(servletResponse);<NEW_LINE>response.setStatusCode(clientResponse.statusCode());<NEW_LINE>response.getHeaders().addAll(this.httpHeadersFilter.filterHeaders(clientResponse.headers().asHttpHeaders()));<NEW_LINE>try {<NEW_LINE>OutputStream responseBody = response.getBody();<NEW_LINE>response.flush();<NEW_LINE>return clientResponse.body(BodyExtractors.toDataBuffers()).window(1).concatMap((body) -> writeAndFlush(body<MASK><NEW_LINE>} catch (IOException ex) {<NEW_LINE>return Mono.error(ex);<NEW_LINE>}<NEW_LINE>}).// We need to explicitly block so the headers are recieved and written<NEW_LINE>// before any async dispatch otherwise the FrameworkServlet will add wrong<NEW_LINE>// Allow header for OPTIONS request<NEW_LINE>block();<NEW_LINE>} | , responseBody)).then(); |
764,789 | void addNestedLink(StoredEntry linkedEntry, String dstName, StoredEntry nestedEntry, long nestedOffset, boolean dummy) throws IOException {<NEW_LINE>Preconditions.checkArgument(linkedEntry != null, "linkedEntry is null");<NEW_LINE>Preconditions.checkArgument(linkedEntry.getCentralDirectoryHeader().<MASK><NEW_LINE>Preconditions.checkArgument(!linkedEntry.isLinkingEntry(), "linkedEntry is a linking entry");<NEW_LINE>var linkingEntry = new StoredEntry(dstName, this, storage, linkedEntry, nestedEntry, nestedOffset, dummy);<NEW_LINE>linkingEntries.add(linkingEntry);<NEW_LINE>linkedEntry.setLocalExtraNoNotify(new ExtraField(ImmutableList.<ExtraField.Segment>builder().add(linkedEntry.getLocalExtra().getSegments().toArray(new ExtraField.Segment[0])).add(new ExtraField.LinkingEntrySegment(linkingEntry)).build()));<NEW_LINE>reAdd(linkedEntry, PositionHint.LOWEST_OFFSET);<NEW_LINE>} | getOffset() < 0, "linkedEntry is not new file"); |
1,708,028 | protected Undertow createServer(HttpHandler contextHandler) {<NEW_LINE>Builder builder = Undertow.builder();<NEW_LINE>// TODO is it a better option?<NEW_LINE>if (getSettings().getBufferSize() > 0) {<NEW_LINE>builder.setBufferSize(getSettings().getBufferSize());<NEW_LINE>}<NEW_LINE>// method builder.setBuffersPerRegion is deprecated<NEW_LINE>if (getSettings().getDirectBuffers()) {<NEW_LINE>builder.setDirectBuffers(getSettings().getDirectBuffers());<NEW_LINE>}<NEW_LINE>if (getSettings().getIoThreads() > 0) {<NEW_LINE>builder.setIoThreads(getSettings().getIoThreads());<NEW_LINE>}<NEW_LINE>if (getSettings().getWorkerThreads() > 0) {<NEW_LINE>builder.setWorkerThreads(getSettings().getWorkerThreads());<NEW_LINE>}<NEW_LINE>if (getSettings().getKeystoreFile() == null) {<NEW_LINE>// HTTP<NEW_LINE>builder.addHttpListener(getSettings().getPort(), getSettings().getHost());<NEW_LINE>} else {<NEW_LINE>// HTTPS<NEW_LINE>builder.setServerOption(UndertowOptions.ENABLE_HTTP2, true);<NEW_LINE>try {<NEW_LINE>KeyStore keyStore = loadKeyStore(getSettings().getKeystoreFile(), getSettings().getKeystorePassword());<NEW_LINE>KeyStore trustStore = loadKeyStore(getSettings().getTruststoreFile(), getSettings().getTruststorePassword());<NEW_LINE>SSLContext sslContext = createSSLContext(keyStore, trustStore);<NEW_LINE>builder.addHttpsListener(getSettings().getPort(), getSettings(<MASK><NEW_LINE>} catch (Exception e) {<NEW_LINE>throw new PippoRuntimeException(e, "Failed to setup an Undertow SSL listener!");<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// add undertow options<NEW_LINE>getSettings().addUndertowOptions(builder);<NEW_LINE>builder.setHandler(contextHandler);<NEW_LINE>return builder.build();<NEW_LINE>} | ).getHost(), sslContext); |
348,711 | final DescribeClientVpnConnectionsResult executeDescribeClientVpnConnections(DescribeClientVpnConnectionsRequest describeClientVpnConnectionsRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(describeClientVpnConnectionsRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<DescribeClientVpnConnectionsRequest> request = null;<NEW_LINE>Response<DescribeClientVpnConnectionsResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new DescribeClientVpnConnectionsRequestMarshaller().marshall(super.beforeMarshalling(describeClientVpnConnectionsRequest));<NEW_LINE>// Binds the request metrics to the current request.<NEW_LINE>request.setAWSRequestMetrics(awsRequestMetrics);<NEW_LINE>request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);<NEW_LINE>request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());<NEW_LINE>request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());<NEW_LINE>request.addHandlerContext(HandlerContextKey.SERVICE_ID, "EC2");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "DescribeClientVpnConnections");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>StaxResponseHandler<DescribeClientVpnConnectionsResult> responseHandler = new StaxResponseHandler<DescribeClientVpnConnectionsResult>(new DescribeClientVpnConnectionsResultStaxUnmarshaller());<NEW_LINE>response = <MASK><NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>endClientExecution(awsRequestMetrics, request, response);<NEW_LINE>}<NEW_LINE>} | invoke(request, responseHandler, executionContext); |
172,593 | public static boolean deleteOldTemporaryFiles(Context context) {<NEW_LINE>File tempDirectory = getDecryptedTempDirectory(context);<NEW_LINE>boolean allFilesDeleted = true;<NEW_LINE>long deletionThreshold = System.currentTimeMillis() - FILE_DELETE_THRESHOLD_MILLISECONDS;<NEW_LINE>for (File tempFile : tempDirectory.listFiles()) {<NEW_LINE>long lastModified = tempFile.lastModified();<NEW_LINE>if (lastModified < deletionThreshold) {<NEW_LINE>boolean fileDeleted = tempFile.delete();<NEW_LINE>if (!fileDeleted) {<NEW_LINE>Timber.e("Failed to delete temporary file");<NEW_LINE>// TODO really do this? might cause our service to stay up indefinitely if a file can't be deleted<NEW_LINE>allFilesDeleted = false;<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>if (K9.isDebugLoggingEnabled()) {<NEW_LINE>String timeLeftStr = String.format(Locale.ENGLISH, "%.2f", (lastModified - deletionThreshold) / 1000 / 60.0);<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>allFilesDeleted = false;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return allFilesDeleted;<NEW_LINE>} | Timber.e("Not deleting temp file (for another %s minutes)", timeLeftStr); |
817,506 | public static void validateAnnouncers(JReleaserContext context, JReleaserContext.Mode mode, Errors errors) {<NEW_LINE>if (!mode.validateConfig()) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>context.getLogger().debug("announce");<NEW_LINE>Announce announce = context.getModel().getAnnounce();<NEW_LINE>validateArticle(context, announce.getArticle(), errors);<NEW_LINE>validateDiscussions(context, announce.getDiscussions(), errors);<NEW_LINE>validateDiscord(context, announce.getDiscord(), errors);<NEW_LINE>validateGitter(context, announce.getGitter(), errors);<NEW_LINE>validateGoogleChat(context, announce.getGoogleChat(), errors);<NEW_LINE>validateMail(context, announce.getMail(), errors);<NEW_LINE>validateMastodon(context, announce.getMastodon(), errors);<NEW_LINE>validateMattermost(context, announce.getMattermost(), errors);<NEW_LINE>validateSdkmanAnnouncer(context, announce.getSdkman(), errors);<NEW_LINE>validateSlack(context, announce.getSlack(), errors);<NEW_LINE>validateTeams(context, announce.getTeams(), errors);<NEW_LINE>validateTelegram(context, announce.getTelegram(), errors);<NEW_LINE>validateTwitter(context, announce.getTwitter(), errors);<NEW_LINE>validateWebhooks(context, <MASK><NEW_LINE>validateZulip(context, announce.getZulip(), errors);<NEW_LINE>if (!announce.isEnabledSet()) {<NEW_LINE>announce.setEnabled(announce.getArticle().isEnabled() || announce.getDiscord().isEnabled() || announce.getDiscussions().isEnabled() || announce.getGitter().isEnabled() || announce.getGoogleChat().isEnabled() || announce.getMail().isEnabled() || announce.getMastodon().isEnabled() || announce.getMattermost().isEnabled() || announce.getSdkman().isEnabled() || announce.getSlack().isEnabled() || announce.getTeams().isEnabled() || announce.getTelegram().isEnabled() || announce.getTwitter().isEnabled() || announce.getConfiguredWebhooks().isEnabled() || announce.getZulip().isEnabled());<NEW_LINE>}<NEW_LINE>} | announce.getConfiguredWebhooks(), errors); |
1,484,123 | public GeckoResult<AllowOrDeny> onLoadRequest(GeckoSession aSession, @NonNull LoadRequest aRequest) {<NEW_LINE>final GeckoResult<AllowOrDeny> <MASK><NEW_LINE>Uri uri = Uri.parse(aRequest.uri);<NEW_LINE>if (UrlUtils.isAboutPage(uri.toString())) {<NEW_LINE>if (UrlUtils.isBookmarksUrl(uri.toString())) {<NEW_LINE>showPanel(Windows.BOOKMARKS);<NEW_LINE>} else if (UrlUtils.isHistoryUrl(uri.toString())) {<NEW_LINE>showPanel(Windows.HISTORY);<NEW_LINE>} else if (UrlUtils.isDownloadsUrl(uri.toString())) {<NEW_LINE>showPanel(Windows.DOWNLOADS);<NEW_LINE>} else if (UrlUtils.isAddonsUrl(uri.toString())) {<NEW_LINE>showPanel(Windows.ADDONS);<NEW_LINE>} else {<NEW_LINE>hideLibraryPanel();<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>hideLibraryPanel();<NEW_LINE>}<NEW_LINE>if ("file".equalsIgnoreCase(uri.getScheme()) && !mWidgetManager.isPermissionGranted(android.Manifest.permission.READ_EXTERNAL_STORAGE)) {<NEW_LINE>mWidgetManager.requestPermission(aRequest.uri, android.Manifest.permission.READ_EXTERNAL_STORAGE, new GeckoSession.PermissionDelegate.Callback() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void grant() {<NEW_LINE>result.complete(AllowOrDeny.ALLOW);<NEW_LINE>}<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void reject() {<NEW_LINE>result.complete(AllowOrDeny.DENY);<NEW_LINE>}<NEW_LINE>});<NEW_LINE>return result;<NEW_LINE>}<NEW_LINE>result.complete(AllowOrDeny.ALLOW);<NEW_LINE>return result;<NEW_LINE>} | result = new GeckoResult<>(); |
28,872 | synchronized public boolean is_winning_candidate(OptimizeRouteTask task) {<NEW_LINE>++num_tasks_finished;<NEW_LINE>ItemRouteResult r = task.getRouteResult();<NEW_LINE>result_map.put(<MASK><NEW_LINE>boolean won = false;<NEW_LINE>if (r.improved()) {<NEW_LINE>if (winning_candidate == null) {<NEW_LINE>won = true;<NEW_LINE>winning_candidate = task;<NEW_LINE>best_route_result = r;<NEW_LINE>} else {<NEW_LINE>if (r.improved_over(best_route_result)) {<NEW_LINE>won = true;<NEW_LINE>winning_candidate.clean();<NEW_LINE>winning_candidate = task;<NEW_LINE>best_route_result = r;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (won && current_board_update_strategy() == BoardUpdateStrategy.GREEDY) {<NEW_LINE>// new tasks will copy the updated board<NEW_LINE>update_master_routing_board();<NEW_LINE>}<NEW_LINE>task_completion_signal.countDown();<NEW_LINE>return won;<NEW_LINE>} | r.item_id(), r); |
1,056,696 | private Iterator<E> iterator(int size) {<NEW_LINE>checkClosed();<NEW_LINE>int memSize = memory.size();<NEW_LINE>// Constructing an iterator from this class is not thread-safe (just<NEW_LINE>// like all the the other methods)<NEW_LINE>if (!finishedAdding && memSize > 1) {<NEW_LINE>E[] array = (E[]) memory.toArray();<NEW_LINE>// don't care if we aborted or not<NEW_LINE>comparator.abortableSort(array);<NEW_LINE>memory = Arrays.asList(array);<NEW_LINE>}<NEW_LINE>finishedAdding = true;<NEW_LINE>if (spilled) {<NEW_LINE>List<Iterator<E>> inputs = new ArrayList<>(size + (memSize > 0 ? 1 : 0));<NEW_LINE>if (memSize > 0) {<NEW_LINE>inputs.<MASK><NEW_LINE>}<NEW_LINE>for (int i = 0; i < size; i++) {<NEW_LINE>File spillFile = getSpillFiles().get(i);<NEW_LINE>try {<NEW_LINE>Iterator<E> irc = getInputIterator(spillFile);<NEW_LINE>inputs.add(irc);<NEW_LINE>} catch (FileNotFoundException e) {<NEW_LINE>// Close any open streams before we throw an exception<NEW_LINE>for (Iterator<E> it : inputs) {<NEW_LINE>Iter.close(it);<NEW_LINE>}<NEW_LINE>throw new AtlasException("Cannot find one of the spill files", e);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>SpillSortIterator<E> ssi = new SpillSortIterator<>(inputs, comparator);<NEW_LINE>registerCloseableIterator(ssi);<NEW_LINE>return ssi;<NEW_LINE>} else {<NEW_LINE>if (memSize > 0) {<NEW_LINE>return memory.iterator();<NEW_LINE>} else {<NEW_LINE>return Iter.nullIterator();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | add(memory.iterator()); |
1,260,167 | public ErrorReason unmarshall(JsonUnmarshallerContext context) throws Exception {<NEW_LINE>ErrorReason errorReason = new ErrorReason();<NEW_LINE><MASK><NEW_LINE>String currentParentElement = context.getCurrentParentElement();<NEW_LINE>int targetDepth = originalDepth + 1;<NEW_LINE>JsonToken token = context.getCurrentToken();<NEW_LINE>if (token == null)<NEW_LINE>token = context.nextToken();<NEW_LINE>if (token == VALUE_NULL) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>while (true) {<NEW_LINE>if (token == null)<NEW_LINE>break;<NEW_LINE>if (token == FIELD_NAME || token == START_OBJECT) {<NEW_LINE>if (context.testExpression("ErrorCode", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>errorReason.setErrorCode(context.getUnmarshaller(String.class).unmarshall(context));<NEW_LINE>}<NEW_LINE>if (context.testExpression("ErrorMessage", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>errorReason.setErrorMessage(context.getUnmarshaller(String.class).unmarshall(context));<NEW_LINE>}<NEW_LINE>} else if (token == END_ARRAY || token == END_OBJECT) {<NEW_LINE>if (context.getLastParsedParentElement() == null || context.getLastParsedParentElement().equals(currentParentElement)) {<NEW_LINE>if (context.getCurrentDepth() <= originalDepth)<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>token = context.nextToken();<NEW_LINE>}<NEW_LINE>return errorReason;<NEW_LINE>} | int originalDepth = context.getCurrentDepth(); |
1,709,001 | public int compareTo(combined_filter_result other) {<NEW_LINE>if (!getClass().equals(other.getClass())) {<NEW_LINE>return getClass().getName().compareTo(other.getClass().getName());<NEW_LINE>}<NEW_LINE>int lastComparison = 0;<NEW_LINE>lastComparison = java.lang.Boolean.valueOf(isSetSuccess()).<MASK><NEW_LINE>if (lastComparison != 0) {<NEW_LINE>return lastComparison;<NEW_LINE>}<NEW_LINE>if (isSetSuccess()) {<NEW_LINE>lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, other.success);<NEW_LINE>if (lastComparison != 0) {<NEW_LINE>return lastComparison;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>lastComparison = java.lang.Boolean.valueOf(isSetEx()).compareTo(other.isSetEx());<NEW_LINE>if (lastComparison != 0) {<NEW_LINE>return lastComparison;<NEW_LINE>}<NEW_LINE>if (isSetEx()) {<NEW_LINE>lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.ex, other.ex);<NEW_LINE>if (lastComparison != 0) {<NEW_LINE>return lastComparison;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return 0;<NEW_LINE>} | compareTo(other.isSetSuccess()); |
606,160 | private void insertJobSpec(@NonNull SQLiteDatabase db, @NonNull JobSpec job) {<NEW_LINE>if (job.isMemoryOnly()) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>ContentValues contentValues = new ContentValues();<NEW_LINE>contentValues.put(Jobs.JOB_SPEC_ID, job.getId());<NEW_LINE>contentValues.put(Jobs.FACTORY_KEY, job.getFactoryKey());<NEW_LINE>contentValues.put(Jobs.QUEUE_KEY, job.getQueueKey());<NEW_LINE>contentValues.put(Jobs.CREATE_TIME, job.getCreateTime());<NEW_LINE>contentValues.put(Jobs.NEXT_RUN_ATTEMPT_TIME, job.getNextRunAttemptTime());<NEW_LINE>contentValues.put(Jobs.RUN_ATTEMPT, job.getRunAttempt());<NEW_LINE>contentValues.put(Jobs.<MASK><NEW_LINE>contentValues.put(Jobs.LIFESPAN, job.getLifespan());<NEW_LINE>contentValues.put(Jobs.SERIALIZED_DATA, job.getSerializedData());<NEW_LINE>contentValues.put(Jobs.SERIALIZED_INPUT_DATA, job.getSerializedInputData());<NEW_LINE>contentValues.put(Jobs.IS_RUNNING, job.isRunning() ? 1 : 0);<NEW_LINE>db.insertWithOnConflict(Jobs.TABLE_NAME, null, contentValues, SQLiteDatabase.CONFLICT_IGNORE);<NEW_LINE>} | MAX_ATTEMPTS, job.getMaxAttempts()); |
1,388,312 | final TagResourceResult executeTagResource(TagResourceRequest tagResourceRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(tagResourceRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<TagResourceRequest> request = null;<NEW_LINE>Response<TagResourceResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new TagResourceRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(tagResourceRequest));<NEW_LINE>// Binds the request metrics to the current request.<NEW_LINE>request.setAWSRequestMetrics(awsRequestMetrics);<NEW_LINE>request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);<NEW_LINE>request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());<NEW_LINE>request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());<NEW_LINE>request.addHandlerContext(HandlerContextKey.SERVICE_ID, "IoT 1Click Projects");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "TagResource");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<TagResourceResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new TagResourceResultJsonUnmarshaller());<NEW_LINE>response = invoke(request, responseHandler, executionContext);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>endClientExecution(awsRequestMetrics, request, response);<NEW_LINE>}<NEW_LINE>} | awsRequestMetrics.endEvent(Field.RequestMarshallTime); |
506,009 | public static Options buildOptions() {<NEW_LINE>Options options = new Options();<NEW_LINE>options.addOption(// Allows for 2 arguments without both being required<NEW_LINE>Option.builder("q").required(true).longOpt("query").// Allows for 2 arguments without both being required<NEW_LINE>numberOfArgs(Option.UNLIMITED_VALUES).valueSeparator(// Appears as "<PATH> <PATH>"<NEW_LINE>' ').// Appears as "<PATH> <PATH>"<NEW_LINE>argName("PATH> <PATH").desc("First argument is the path to the migrated query file. Second argument is the path to the original query file and only required when data is provided.").build());<NEW_LINE>options.addOption(// Allows for 2 arguments without both being required<NEW_LINE>Option.builder("s").longOpt("schema").// Allows for 2 arguments without both being required<NEW_LINE>numberOfArgs(Option.UNLIMITED_VALUES).valueSeparator(// Appears as "<PATH> <PATH>"<NEW_LINE>' ').// Appears as "<PATH> <PATH>"<NEW_LINE>argName("PATH> <PATH").desc("First argument is the path to the migrated schema path. Second argument is the path to the original schema query and is optional. Referenced files should be DDL statements or in JSON format.").build());<NEW_LINE>options.addOption(Option.builder("d").longOpt("data").numberOfArgs(Option.UNLIMITED_VALUES).valueSeparator(' ').argName("PATHS").desc<MASK><NEW_LINE>options.addOption(Option.builder("h").longOpt("help").desc("Print this help screen.").build());<NEW_LINE>return options;<NEW_LINE>} | ("Paths for table data in CSV format. File names should be formatted as \"[dataset].[table].csv\".").build()); |
596,391 | private static List<FileEntriesLayer> createLayersForLayeredSpringBootJar(Path localExplodedJarRoot) throws IOException {<NEW_LINE>Path layerIndexPath = localExplodedJarRoot.resolve(BOOT_INF).resolve("layers.idx");<NEW_LINE>Pattern <MASK><NEW_LINE>Pattern layerEntryPattern = Pattern.compile(" - \"(.*)\"");<NEW_LINE>Map<String, List<String>> layersMap = new LinkedHashMap<>();<NEW_LINE>List<String> layerEntries = null;<NEW_LINE>for (String line : Files.readAllLines(layerIndexPath, StandardCharsets.UTF_8)) {<NEW_LINE>Matcher layerMatcher = layerNamePattern.matcher(line);<NEW_LINE>Matcher entryMatcher = layerEntryPattern.matcher(line);<NEW_LINE>if (layerMatcher.matches()) {<NEW_LINE>layerEntries = new ArrayList<>();<NEW_LINE>String layerName = layerMatcher.group(1);<NEW_LINE>layersMap.put(layerName, layerEntries);<NEW_LINE>} else if (entryMatcher.matches()) {<NEW_LINE>Verify.verifyNotNull(layerEntries).add(entryMatcher.group(1));<NEW_LINE>} else {<NEW_LINE>throw new IllegalStateException("Unable to parse BOOT-INF/layers.idx file in the JAR. Please check the format of layers.idx.");<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// If the layers.idx file looks like this, for example:<NEW_LINE>// - "dependencies":<NEW_LINE>// - "BOOT-INF/lib/dependency1.jar"<NEW_LINE>// - "application":<NEW_LINE>// - "BOOT-INF/classes/"<NEW_LINE>// - "META-INF/"<NEW_LINE>// The predicate for the "dependencies" layer will be true if `path` is equal to<NEW_LINE>// `BOOT-INF/lib/dependency1.jar` and the predicate for the "spring-boot-loader" layer will be<NEW_LINE>// true if `path` is in either 'BOOT-INF/classes/` or `META-INF/`.<NEW_LINE>List<FileEntriesLayer> layers = new ArrayList<>();<NEW_LINE>for (Map.Entry<String, List<String>> entry : layersMap.entrySet()) {<NEW_LINE>String layerName = entry.getKey();<NEW_LINE>List<String> contents = entry.getValue();<NEW_LINE>if (!contents.isEmpty()) {<NEW_LINE>Predicate<Path> belongsToThisLayer = isInListedDirectoryOrIsSameFile(contents, localExplodedJarRoot);<NEW_LINE>layers.add(ArtifactLayers.getDirectoryContentsAsLayer(layerName, localExplodedJarRoot, belongsToThisLayer, JarLayers.APP_ROOT));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return layers;<NEW_LINE>} | layerNamePattern = Pattern.compile("- \"(.*)\":"); |
830,585 | public ListTrackerConsumersResult listTrackerConsumers(ListTrackerConsumersRequest listTrackerConsumersRequest) throws AmazonServiceException, AmazonClientException {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(listTrackerConsumersRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<ListTrackerConsumersRequest> request = null;<NEW_LINE>Response<ListTrackerConsumersResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new ListTrackerConsumersRequestMarshaller().marshall(listTrackerConsumersRequest);<NEW_LINE>// Binds the request metrics to the current request.<NEW_LINE>request.setAWSRequestMetrics(awsRequestMetrics);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>Unmarshaller<ListTrackerConsumersResult, JsonUnmarshallerContext> unmarshaller = new ListTrackerConsumersResultJsonUnmarshaller();<NEW_LINE>JsonResponseHandler<ListTrackerConsumersResult> responseHandler = new JsonResponseHandler<ListTrackerConsumersResult>(unmarshaller);<NEW_LINE>response = <MASK><NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.ClientExecuteTime);<NEW_LINE>endClientExecution(awsRequestMetrics, request, response, LOGGING_AWS_REQUEST_METRIC);<NEW_LINE>}<NEW_LINE>} | invoke(request, responseHandler, executionContext); |
927,365 | protected void populateShell() {<NEW_LINE>Display currentDisplay = Display.getCurrent();<NEW_LINE>Shell parent = currentDisplay != null ? currentDisplay.getActiveShell() : null;<NEW_LINE>shell = new Shell(parent, SWT.APPLICATION_MODAL | SWT.DIALOG_TRIM);<NEW_LINE>shell.setText(Labels.getLabel("title.favorite.edit"));<NEW_LINE>shell.setLayout(formLayout(10, 10, 4));<NEW_LINE>Label messageLabel = new Label(shell, SWT.NONE);<NEW_LINE>messageLabel.setText(Labels.getLabel("text.favorite.edit"));<NEW_LINE>favoritesList = new List(shell, SWT.BORDER | SWT.MULTI | SWT.V_SCROLL);<NEW_LINE>favoritesList.setLayoutData(formData(330, 200, new FormAttachment(0), null, new FormAttachment(messageLabel), null));<NEW_LINE>for (String name : favoritesConfig) {<NEW_LINE>favoritesList.add(name);<NEW_LINE>}<NEW_LINE>Button upButton = new <MASK><NEW_LINE>upButton.setText(Labels.getLabel("button.up"));<NEW_LINE>upButton.addListener(SWT.Selection, new UpButtonListener(favoritesList));<NEW_LINE>Button downButton = new Button(shell, SWT.NONE);<NEW_LINE>downButton.setText(Labels.getLabel("button.down"));<NEW_LINE>downButton.addListener(SWT.Selection, new DownButtonListener(favoritesList));<NEW_LINE>Button renameButton = new Button(shell, SWT.NONE);<NEW_LINE>renameButton.setText(Labels.getLabel("button.rename"));<NEW_LINE>Listener renameListener = new RenameListener();<NEW_LINE>renameButton.addListener(SWT.Selection, renameListener);<NEW_LINE>favoritesList.addListener(SWT.MouseDoubleClick, renameListener);<NEW_LINE>Button deleteButton = new Button(shell, SWT.NONE);<NEW_LINE>deleteButton.setText(Labels.getLabel("button.delete"));<NEW_LINE>deleteButton.addListener(SWT.Selection, new DeleteListener());<NEW_LINE>upButton.setLayoutData(formData(new FormAttachment(favoritesList), new FormAttachment(renameButton, 0, SWT.RIGHT), new FormAttachment(messageLabel), null));<NEW_LINE>downButton.setLayoutData(formData(new FormAttachment(favoritesList), new FormAttachment(renameButton, 0, SWT.RIGHT), new FormAttachment(upButton), null));<NEW_LINE>renameButton.setLayoutData(formData(new FormAttachment(favoritesList), null, new FormAttachment(downButton, 10), null));<NEW_LINE>deleteButton.setLayoutData(formData(new FormAttachment(favoritesList), new FormAttachment(renameButton, 0, SWT.RIGHT), new FormAttachment(renameButton), null));<NEW_LINE>Button okButton = new Button(shell, SWT.NONE);<NEW_LINE>okButton.setText(Labels.getLabel("button.OK"));<NEW_LINE>Button cancelButton = new Button(shell, SWT.NONE);<NEW_LINE>cancelButton.setText(Labels.getLabel("button.cancel"));<NEW_LINE>positionButtonsInFormLayout(okButton, cancelButton, favoritesList);<NEW_LINE>shell.pack();<NEW_LINE>okButton.addListener(SWT.Selection, e -> {<NEW_LINE>saveFavorites();<NEW_LINE>close();<NEW_LINE>});<NEW_LINE>cancelButton.addListener(SWT.Selection, e -> close());<NEW_LINE>} | Button(shell, SWT.NONE); |
1,097,735 | public void findNodeReply(DHTTransportContact _contact, DHTTransportContact[] _contacts) {<NEW_LINE>anti_spoof_done.add(_contact);<NEW_LINE>try {<NEW_LINE>// System.out.println( "cacheForward: pre-store findNode OK" );<NEW_LINE>List<HashWrapper> keys = (List<HashWrapper>) data[1];<NEW_LINE>byte[][] store_keys = new byte[keys.size()][];<NEW_LINE>DHTTransportValue[][] store_values = new DHTTransportValue[store_keys.length][];<NEW_LINE>keys_published[0] += store_keys.length;<NEW_LINE>for (int i = 0; i < store_keys.length; i++) {<NEW_LINE>HashWrapper wrapper = keys.get(i);<NEW_LINE>store_keys[i] = wrapper.getHash();<NEW_LINE>List<DHTDBValueImpl> values = republish.get(wrapper);<NEW_LINE>store_values[i] = new <MASK><NEW_LINE>values_published[0] += store_values[i].length;<NEW_LINE>for (int j = 0; j < values.size(); j++) {<NEW_LINE>DHTDBValueImpl value = values.get(j);<NEW_LINE>// we reduce the cache distance by 1 here as it is incremented by the<NEW_LINE>// recipients<NEW_LINE>store_values[i][j] = value.getValueForRelay(local_contact);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>List<DHTTransportContact> contacts = new ArrayList<>();<NEW_LINE>contacts.add(contact);<NEW_LINE>republish_ops[0]++;<NEW_LINE>control.putDirectEncodedKeys(store_keys, "Republish cache: " + f_con_num + " of " + con_tot, store_values, contacts);<NEW_LINE>} finally {<NEW_LINE>sem.release();<NEW_LINE>}<NEW_LINE>} | DHTTransportValue[values.size()]; |
1,193,185 | private void mergePluginFilesFromDir(final CommandConsole console, String sourcePath, String targetPath) {<NEW_LINE>console.printlnInfoMessage(getMessage("MergePluginFilesTask.merging.plugin.dir", sourcePath));<NEW_LINE>File sourcePathFile = new File(sourcePath);<NEW_LINE>if (!sourcePathFile.exists()) {<NEW_LINE>abort(console, getMessage("MergePluginFilesTask.merging.plugin.source.dir.not.exists", sourcePathFile));<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>if (!sourcePathFile.isDirectory()) {<NEW_LINE>abort(console, getMessage("MergePluginFilesTask.merging.plugin.source.file.not.directory", sourcePathFile));<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>File[] files = sourcePathFile.listFiles(new FilenameFilter() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public boolean accept(File dir, String name) {<NEW_LINE>boolean result = name.matches(FILE_SELECT_REG_EXP);<NEW_LINE>if (result)<NEW_LINE>console.printlnInfoMessage(getMessage("MergePluginFilesTask.merging.plugin.source.file.selected", name));<NEW_LINE>return result;<NEW_LINE>}<NEW_LINE>});<NEW_LINE>// If there is not at least 1 file to be merged abort<NEW_LINE>if (files.length < 1) {<NEW_LINE>abort(console, getMessage("MergePluginFilesTask.merging.plugin.insufficent.number.of.source.files"));<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>String strTargetDir = System.getProperty(CURRENT_DIR);<NEW_LINE>if (targetPath == null) {<NEW_LINE>targetPath = strTargetDir + File.separator + TARGET_MERGED_FILE_NAME;<NEW_LINE>} else {<NEW_LINE>File targetPathFile = new File(targetPath);<NEW_LINE>if (targetPathFile.exists() && targetPathFile.isDirectory()) {<NEW_LINE>targetPath = targetPath + File.separator + TARGET_MERGED_FILE_NAME;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>console.printlnInfoMessage<MASK><NEW_LINE>String[] sourceFileNames = new String[files.length];<NEW_LINE>for (int i = 0; i < files.length; i++) sourceFileNames[i] = files[i].getAbsolutePath();<NEW_LINE>String[] args = new String[sourceFileNames.length + 1];<NEW_LINE>System.arraycopy(sourceFileNames, 0, args, 0, sourceFileNames.length);<NEW_LINE>args[sourceFileNames.length] = targetPath;<NEW_LINE>merge(args);<NEW_LINE>console.printlnInfoMessage(getMessage("MergePluginFilesTask.merging.plugin.target.file.generated"));<NEW_LINE>} | (getMessage("MergePluginFilesTask.merging.plugin.target.file.generating", targetPath)); |
589,243 | public void onCreate(Bundle savedInstanceState) {<NEW_LINE>super.onCreate(savedInstanceState);<NEW_LINE>attributionColors = new int[] { // a runtime app UI color<NEW_LINE>Color.RED, // a runtime app UI color<NEW_LINE>Color.BLUE, // a runtime app UI color<NEW_LINE>Color.YELLOW, // a runtime app UI color<NEW_LINE>ContextCompat.getColor(this, R.color.colorAccent), // dark green<NEW_LINE>ContextCompat.getColor(this, R.color.colorPrimaryDark)<MASK><NEW_LINE>// Mapbox access token is configured here. This needs to be called either in your application<NEW_LINE>// object or in the same activity which contains the mapview.<NEW_LINE>Mapbox.getInstance(this, getString(R.string.access_token));<NEW_LINE>setContentView(R.layout.activity_lab_change_attribution_info_button_color);<NEW_LINE>mapView = findViewById(R.id.mapView);<NEW_LINE>mapView.onCreate(savedInstanceState);<NEW_LINE>mapView.getMapAsync(this);<NEW_LINE>} | , Color.parseColor("#1e7019") }; |
1,146,747 | public static APIUpdateVolumeEvent __example__() {<NEW_LINE>APIUpdateVolumeEvent event = new APIUpdateVolumeEvent();<NEW_LINE>String volumeUuid = uuid();<NEW_LINE>VolumeInventory vol = new VolumeInventory();<NEW_LINE>vol.setName("test-volume");<NEW_LINE>vol.setCreateDate(new Timestamp(org.zstack.header.message.DocUtils.date));<NEW_LINE>vol.setLastOpDate(new Timestamp(org.zstack.header.message.DocUtils.date));<NEW_LINE>vol.setType(VolumeType.Root.toString());<NEW_LINE>vol.setUuid(volumeUuid);<NEW_LINE>vol.setSize(SizeUnit.GIGABYTE.toByte(100));<NEW_LINE>vol.setActualSize(SizeUnit.GIGABYTE.toByte(20));<NEW_LINE>vol.setDeviceId(0);<NEW_LINE>vol.setState(<MASK><NEW_LINE>vol.setFormat("qcow2");<NEW_LINE>vol.setDiskOfferingUuid(uuid());<NEW_LINE>vol.setInstallPath(String.format("/zstack_ps/rootVolumes/acct-36c27e8ff05c4780bf6d2fa65700f22e/vol-%s/%s.qcow2", volumeUuid, volumeUuid));<NEW_LINE>vol.setStatus(VolumeStatus.Ready.toString());<NEW_LINE>vol.setPrimaryStorageUuid(uuid());<NEW_LINE>vol.setVmInstanceUuid(uuid());<NEW_LINE>vol.setRootImageUuid(uuid());<NEW_LINE>event.setInventory(vol);<NEW_LINE>return event;<NEW_LINE>} | VolumeState.Enabled.toString()); |
676,835 | private void createZoneAcls(Configuration c) {<NEW_LINE>// Mapping: zoneName -> (MatchSrcInterface for interfaces in zone)<NEW_LINE>Map<String, MatchSrcInterface> matchSrcInterfaceBySrcZone = toImmutableMap(c.getZones(), Entry::getKey, zoneByNameEntry -> new MatchSrcInterface(zoneByNameEntry.getValue().getInterfaces()));<NEW_LINE>c.getZones().values().stream().map(zone -> {<NEW_LINE>// Don't bother if zone is empty<NEW_LINE>SortedSet<String> interfaces = zone.getInterfaces();<NEW_LINE>if (interfaces.isEmpty()) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>String zoneName = zone.getName();<NEW_LINE>if (_securityLevels.containsKey(zoneName)) {<NEW_LINE>// ASA security level<NEW_LINE>return createAsaSecurityLevelZoneAcl(zone);<NEW_LINE>} else if (_securityZones.containsKey(zoneName)) {<NEW_LINE>// IOS security zone<NEW_LINE>return createIosSecurityZoneAcl(zone, matchSrcInterfaceBySrcZone, c);<NEW_LINE>}<NEW_LINE>// shouldn't reach here<NEW_LINE>return null;<NEW_LINE>}).filter(Objects::nonNull).forEach(acl -> c.getIpAccessLists().put(acl<MASK><NEW_LINE>} | .getName(), acl)); |
779,412 | private void readJSONEncodedItem(String key, SharedPreferences prefs, ReadableArguments options, Promise promise) {<NEW_LINE>String encryptedItemString = prefs.getString(key, null);<NEW_LINE>JSONObject encryptedItem;<NEW_LINE>try {<NEW_LINE>encryptedItem = new JSONObject(encryptedItemString);<NEW_LINE>} catch (JSONException e) {<NEW_LINE>Log.e(TAG, String.format("Could not parse stored value as JSON (key = %s, value = %s)"<MASK><NEW_LINE>promise.reject("E_SECURESTORE_JSON_ERROR", "Could not parse the encrypted JSON item in SecureStore");<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>String scheme = encryptedItem.optString(SCHEME_PROPERTY);<NEW_LINE>if (scheme == null) {<NEW_LINE>Log.e(TAG, String.format("Stored JSON object is missing a scheme (key = %s, value = %s)", key, encryptedItemString));<NEW_LINE>promise.reject("E_SECURESTORE_DECODE_ERROR", "Could not find the encryption scheme used for SecureStore item");<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>String value;<NEW_LINE>try {<NEW_LINE>switch(scheme) {<NEW_LINE>case AESEncrypter.NAME:<NEW_LINE>KeyStore.SecretKeyEntry secretKeyEntry = getKeyEntry(KeyStore.SecretKeyEntry.class, mAESEncrypter, options);<NEW_LINE>value = mAESEncrypter.decryptItem(encryptedItem, secretKeyEntry);<NEW_LINE>break;<NEW_LINE>case HybridAESEncrypter.NAME:<NEW_LINE>KeyStore.PrivateKeyEntry privateKeyEntry = getKeyEntry(KeyStore.PrivateKeyEntry.class, mHybridAESEncrypter, options);<NEW_LINE>value = mHybridAESEncrypter.decryptItem(encryptedItem, privateKeyEntry);<NEW_LINE>break;<NEW_LINE>default:<NEW_LINE>String message = String.format("The item for key \"%s\" in SecureStore has an unknown encoding scheme (%s)", key, scheme);<NEW_LINE>Log.e(TAG, message);<NEW_LINE>promise.reject("E_SECURESTORE_DECODE_ERROR", message);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>} catch (IOException e) {<NEW_LINE>Log.w(TAG, e);<NEW_LINE>promise.reject("E_SECURESTORE_IO_ERROR", "There was an I/O error loading the keystore for SecureStore", e);<NEW_LINE>return;<NEW_LINE>} catch (GeneralSecurityException e) {<NEW_LINE>Log.w(TAG, e);<NEW_LINE>promise.reject("E_SECURESTORE_DECRYPT_ERROR", "Could not decrypt the item in SecureStore", e);<NEW_LINE>return;<NEW_LINE>} catch (JSONException e) {<NEW_LINE>Log.w(TAG, e);<NEW_LINE>promise.reject("E_SECURESTORE_DECODE_ERROR", "Could not decode the encrypted JSON item in SecureStore", e);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>promise.resolve(value);<NEW_LINE>} | , key, encryptedItemString), e); |
1,151,084 | public static QueryDynamicGroupDevicesResponse unmarshall(QueryDynamicGroupDevicesResponse queryDynamicGroupDevicesResponse, UnmarshallerContext _ctx) {<NEW_LINE>queryDynamicGroupDevicesResponse.setRequestId(_ctx.stringValue("QueryDynamicGroupDevicesResponse.RequestId"));<NEW_LINE>queryDynamicGroupDevicesResponse.setSuccess(_ctx.booleanValue("QueryDynamicGroupDevicesResponse.Success"));<NEW_LINE>queryDynamicGroupDevicesResponse.setCode(_ctx.stringValue("QueryDynamicGroupDevicesResponse.Code"));<NEW_LINE>queryDynamicGroupDevicesResponse.setErrorMessage(_ctx.stringValue("QueryDynamicGroupDevicesResponse.ErrorMessage"));<NEW_LINE>queryDynamicGroupDevicesResponse.setPage(_ctx.integerValue("QueryDynamicGroupDevicesResponse.Page"));<NEW_LINE>queryDynamicGroupDevicesResponse.setPageSize(_ctx.integerValue("QueryDynamicGroupDevicesResponse.PageSize"));<NEW_LINE>queryDynamicGroupDevicesResponse.setPageCount(_ctx.integerValue("QueryDynamicGroupDevicesResponse.PageCount"));<NEW_LINE>queryDynamicGroupDevicesResponse.setTotal(_ctx.integerValue("QueryDynamicGroupDevicesResponse.Total"));<NEW_LINE>queryDynamicGroupDevicesResponse.setNextToken(_ctx.stringValue("QueryDynamicGroupDevicesResponse.NextToken"));<NEW_LINE>List<SimpleDeviceInfo> data = new ArrayList<SimpleDeviceInfo>();<NEW_LINE>for (int i = 0; i < _ctx.lengthValue("QueryDynamicGroupDevicesResponse.Data.Length"); i++) {<NEW_LINE>SimpleDeviceInfo simpleDeviceInfo = new SimpleDeviceInfo();<NEW_LINE>simpleDeviceInfo.setProductName(_ctx.stringValue<MASK><NEW_LINE>simpleDeviceInfo.setProductKey(_ctx.stringValue("QueryDynamicGroupDevicesResponse.Data[" + i + "].ProductKey"));<NEW_LINE>simpleDeviceInfo.setDeviceName(_ctx.stringValue("QueryDynamicGroupDevicesResponse.Data[" + i + "].DeviceName"));<NEW_LINE>simpleDeviceInfo.setCategoryKey(_ctx.stringValue("QueryDynamicGroupDevicesResponse.Data[" + i + "].CategoryKey"));<NEW_LINE>simpleDeviceInfo.setNodeType(_ctx.integerValue("QueryDynamicGroupDevicesResponse.Data[" + i + "].NodeType"));<NEW_LINE>simpleDeviceInfo.setStatus(_ctx.stringValue("QueryDynamicGroupDevicesResponse.Data[" + i + "].Status"));<NEW_LINE>simpleDeviceInfo.setIotId(_ctx.stringValue("QueryDynamicGroupDevicesResponse.Data[" + i + "].IotId"));<NEW_LINE>simpleDeviceInfo.setActiveTime(_ctx.stringValue("QueryDynamicGroupDevicesResponse.Data[" + i + "].ActiveTime"));<NEW_LINE>simpleDeviceInfo.setUtcActiveTime(_ctx.stringValue("QueryDynamicGroupDevicesResponse.Data[" + i + "].UtcActiveTime"));<NEW_LINE>simpleDeviceInfo.setLastOnlineTime(_ctx.stringValue("QueryDynamicGroupDevicesResponse.Data[" + i + "].LastOnlineTime"));<NEW_LINE>simpleDeviceInfo.setUtcLastOnlineTime(_ctx.stringValue("QueryDynamicGroupDevicesResponse.Data[" + i + "].UtcLastOnlineTime"));<NEW_LINE>simpleDeviceInfo.setNickname(_ctx.stringValue("QueryDynamicGroupDevicesResponse.Data[" + i + "].Nickname"));<NEW_LINE>data.add(simpleDeviceInfo);<NEW_LINE>}<NEW_LINE>queryDynamicGroupDevicesResponse.setData(data);<NEW_LINE>return queryDynamicGroupDevicesResponse;<NEW_LINE>} | ("QueryDynamicGroupDevicesResponse.Data[" + i + "].ProductName")); |
737,103 | private void handleRestEndpointGroup(Node node, BeanDefinitionBuilder builder, ManagedSet<RestEndpointGroup> groupSet) {<NEW_LINE>for (Node child : childElements(node)) {<NEW_LINE>String nodeName = cleanNodeName(child);<NEW_LINE>if ("endpoint-group".equals(nodeName)) {<NEW_LINE><MASK><NEW_LINE>Node attrEnabled = attributes.getNamedItem("enabled");<NEW_LINE>boolean enabled = attrEnabled != null && getBooleanValue(getTextContent(attrEnabled));<NEW_LINE>String name = getTextContent(attributes.getNamedItem("name"));<NEW_LINE>RestEndpointGroup group;<NEW_LINE>try {<NEW_LINE>group = RestEndpointGroup.valueOf(name);<NEW_LINE>} catch (IllegalArgumentException e) {<NEW_LINE>throw new InvalidConfigurationException("Wrong name attribute value was provided in endpoint-group element: " + name + "\nAllowed values: " + Arrays.toString(RestEndpointGroup.values()));<NEW_LINE>}<NEW_LINE>if (enabled) {<NEW_LINE>groupSet.add(group);<NEW_LINE>} else {<NEW_LINE>groupSet.remove(group);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>builder.addPropertyValue("enabledGroups", groupSet);<NEW_LINE>} | NamedNodeMap attributes = child.getAttributes(); |
808,576 | public static Map<String, Object> encodeRuleDescriptionToMap(RuleDescription ruleDescription) {<NEW_LINE>HashMap<String, Object> descriptionMap = new HashMap<>();<NEW_LINE>if (ruleDescription.getFilter() instanceof SqlFilter) {<NEW_LINE>HashMap<String, Object> filterMap = new HashMap<>();<NEW_LINE>filterMap.put(ClientConstants.REQUEST_RESPONSE_EXPRESSION, ((SqlFilter) ruleDescription.getFilter()).getSqlExpression());<NEW_LINE>descriptionMap.put(ClientConstants.REQUEST_RESPONSE_SQLFILTER, filterMap);<NEW_LINE>} else if (ruleDescription.getFilter() instanceof CorrelationFilter) {<NEW_LINE>CorrelationFilter correlationFilter = (CorrelationFilter) ruleDescription.getFilter();<NEW_LINE>HashMap<String, Object> filterMap = new HashMap<>();<NEW_LINE>filterMap.put(ClientConstants.REQUEST_RESPONSE_CORRELATION_ID, correlationFilter.getCorrelationId());<NEW_LINE>filterMap.put(ClientConstants.REQUEST_RESPONSE_MESSAGE_ID, correlationFilter.getMessageId());<NEW_LINE>filterMap.put(ClientConstants.REQUEST_RESPONSE_TO, correlationFilter.getTo());<NEW_LINE>filterMap.put(ClientConstants.REQUEST_RESPONSE_REPLY_TO, correlationFilter.getReplyTo());<NEW_LINE>filterMap.put(ClientConstants.REQUEST_RESPONSE_LABEL, correlationFilter.getLabel());<NEW_LINE>filterMap.put(ClientConstants.<MASK><NEW_LINE>filterMap.put(ClientConstants.REQUEST_RESPONSE_REPLY_TO_SESSION_ID, correlationFilter.getReplyToSessionId());<NEW_LINE>filterMap.put(ClientConstants.REQUEST_RESPONSE_CONTENT_TYPE, correlationFilter.getContentType());<NEW_LINE>filterMap.put(ClientConstants.REQUEST_RESPONSE_CORRELATION_FILTER_PROPERTIES, correlationFilter.getProperties());<NEW_LINE>descriptionMap.put(ClientConstants.REQUEST_RESPONSE_CORRELATION_FILTER, filterMap);<NEW_LINE>} else {<NEW_LINE>throw new IllegalArgumentException("This API supports the addition of only SQLFilters and CorrelationFilters.");<NEW_LINE>}<NEW_LINE>if (ruleDescription.getAction() == null) {<NEW_LINE>descriptionMap.put(ClientConstants.REQUEST_RESPONSE_SQLRULEACTION, null);<NEW_LINE>} else if (ruleDescription.getAction() instanceof SqlRuleAction) {<NEW_LINE>HashMap<String, Object> sqlActionMap = new HashMap<>();<NEW_LINE>sqlActionMap.put(ClientConstants.REQUEST_RESPONSE_EXPRESSION, ((SqlRuleAction) ruleDescription.getAction()).getSqlExpression());<NEW_LINE>descriptionMap.put(ClientConstants.REQUEST_RESPONSE_SQLRULEACTION, sqlActionMap);<NEW_LINE>} else {<NEW_LINE>throw new IllegalArgumentException("This API supports the addition of only filters with SqlRuleActions.");<NEW_LINE>}<NEW_LINE>descriptionMap.put(ClientConstants.REQUEST_RESPONSE_RULENAME, ruleDescription.getName());<NEW_LINE>return descriptionMap;<NEW_LINE>} | REQUEST_RESPONSE_SESSION_ID, correlationFilter.getSessionId()); |
1,794,158 | private Object script(EffectivePerson effectivePerson, Business business, Statement statement, Runtime runtime, String mode) throws Exception {<NEW_LINE>Object data = null;<NEW_LINE>ScriptContext scriptContext = this.scriptContext(effectivePerson, runtime);<NEW_LINE><MASK><NEW_LINE>if (Statement.MODE_COUNT.equals(mode)) {<NEW_LINE>scriptText = statement.getCountScriptText();<NEW_LINE>}<NEW_LINE>CompiledScript cs = ScriptingFactory.functionalizationCompile(scriptText);<NEW_LINE>String jpql = JsonScriptingExecutor.evalString(cs, scriptContext);<NEW_LINE>Class<? extends JpaObject> cls = this.clazz(business, statement);<NEW_LINE>EntityManager em;<NEW_LINE>if (StringUtils.equalsIgnoreCase(statement.getEntityCategory(), Statement.ENTITYCATEGORY_DYNAMIC) && StringUtils.equalsIgnoreCase(statement.getType(), Statement.TYPE_SELECT)) {<NEW_LINE>em = business.entityManagerContainer().get(DynamicBaseEntity.class);<NEW_LINE>} else {<NEW_LINE>em = business.entityManagerContainer().get(cls);<NEW_LINE>}<NEW_LINE>jpql = this.joinSql(jpql, business);<NEW_LINE>Query query;<NEW_LINE>String upJpql = jpql.toUpperCase();<NEW_LINE>if (upJpql.indexOf(JOIN_KEY) > -1 && upJpql.indexOf(JOIN_ON_KEY) > -1) {<NEW_LINE>query = em.createNativeQuery(jpql);<NEW_LINE>} else {<NEW_LINE>query = em.createQuery(jpql);<NEW_LINE>}<NEW_LINE>for (Parameter<?> p : query.getParameters()) {<NEW_LINE>if (runtime.hasParameter(p.getName())) {<NEW_LINE>query.setParameter(p.getName(), runtime.getParameter(p.getName()));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (StringUtils.equalsIgnoreCase(statement.getType(), Statement.TYPE_SELECT)) {<NEW_LINE>if (Statement.MODE_COUNT.equals(mode)) {<NEW_LINE>data = query.getSingleResult();<NEW_LINE>} else {<NEW_LINE>if (isPageSql(jpql)) {<NEW_LINE>query.setFirstResult((runtime.page - 1) * runtime.size);<NEW_LINE>query.setMaxResults(runtime.size);<NEW_LINE>}<NEW_LINE>data = query.getResultList();<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>business.entityManagerContainer().beginTransaction(cls);<NEW_LINE>data = query.executeUpdate();<NEW_LINE>business.entityManagerContainer().commit();<NEW_LINE>}<NEW_LINE>return data;<NEW_LINE>} | String scriptText = statement.getScriptText(); |
1,566,222 | private boolean processHeartbeatMessage(Msg msg) {<NEW_LINE>// Get the remote heartbeat TTL to setup the timer<NEW_LINE>int remoteHeartbeatTtl = msg.getShort(5);<NEW_LINE>// The remote heartbeat is in 10ths of a second<NEW_LINE>// so we multiply it by 100 to get the timer interval in ms.<NEW_LINE>remoteHeartbeatTtl *= 100;<NEW_LINE>if (!hasTtlTimer && remoteHeartbeatTtl > 0) {<NEW_LINE>ioObject.addTimer(remoteHeartbeatTtl, HEARTBEAT_TTL_TIMER_ID);<NEW_LINE>hasTtlTimer = true;<NEW_LINE>}<NEW_LINE>// extract the ping context that will be sent back inside the pong message<NEW_LINE>int remaining <MASK><NEW_LINE>// As per ZMTP 3.1 the PING command might contain an up to 16 bytes<NEW_LINE>// context which needs to be PONGed back, so build the pong message<NEW_LINE>// here and store it. Truncate it if it's too long.<NEW_LINE>// Given the engine goes straight to outEvent(), sequential PINGs will<NEW_LINE>// not be a problem.<NEW_LINE>if (remaining > 16) {<NEW_LINE>remaining = 16;<NEW_LINE>}<NEW_LINE>final byte[] pingContext = new byte[remaining];<NEW_LINE>msg.getBytes(7, pingContext, 0, remaining);<NEW_LINE>nextMsg = new ProducePongMessage(pingContext);<NEW_LINE>outEvent();<NEW_LINE>return true;<NEW_LINE>} | = msg.size() - 7; |
1,669,911 | private void sendItems(Filter filter, OutputStream out, PropagationMode propagationMode, boolean sendLocation) throws IOException {<NEW_LINE>ContextBootstrap.debug(MessageID.PROPAGATION_STARTED, "Outgoing");<NEW_LINE>SimpleMap map = getMapIfItExists();<NEW_LINE>if (map != null) {<NEW_LINE>ContextBootstrap.debug(MessageID.USING_WIRE_ADAPTER, "Writing to", wireAdapter);<NEW_LINE>wireAdapter.prepareToWriteTo(out);<NEW_LINE>Iterator<Map.Entry<String, Entry>> items = map.iterator(filter, propagationMode);<NEW_LINE>while (items.hasNext()) {<NEW_LINE>Map.Entry<String, Entry> mapEntry = items.next();<NEW_LINE>Entry entry = mapEntry.getValue();<NEW_LINE>Object value = entry.getValue();<NEW_LINE>if (value instanceof ContextLifecycle) {<NEW_LINE>((ContextLifecycle) value).contextToPropagate();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>items = map.iterator(filter, propagationMode);<NEW_LINE>while (items.hasNext()) {<NEW_LINE>Map.Entry<String, Entry<MASK><NEW_LINE>wireAdapter.write(mapEntry.getKey(), mapEntry.getValue());<NEW_LINE>}<NEW_LINE>wireAdapter.flush();<NEW_LINE>}<NEW_LINE>ContextBootstrap.debug(MessageID.PROPAGATION_COMPLETED, "Outgoing");<NEW_LINE>} | > mapEntry = items.next(); |
882,119 | public static QueryTransferInListResponse unmarshall(QueryTransferInListResponse queryTransferInListResponse, UnmarshallerContext _ctx) {<NEW_LINE>queryTransferInListResponse.setRequestId(_ctx.stringValue("QueryTransferInListResponse.RequestId"));<NEW_LINE>queryTransferInListResponse.setTotalItemNum(_ctx.integerValue("QueryTransferInListResponse.TotalItemNum"));<NEW_LINE>queryTransferInListResponse.setCurrentPageNum(_ctx.integerValue("QueryTransferInListResponse.CurrentPageNum"));<NEW_LINE>queryTransferInListResponse.setTotalPageNum(_ctx.integerValue("QueryTransferInListResponse.TotalPageNum"));<NEW_LINE>queryTransferInListResponse.setPageSize(_ctx.integerValue("QueryTransferInListResponse.PageSize"));<NEW_LINE>queryTransferInListResponse.setPrePage(_ctx.booleanValue("QueryTransferInListResponse.PrePage"));<NEW_LINE>queryTransferInListResponse.setNextPage(_ctx.booleanValue("QueryTransferInListResponse.NextPage"));<NEW_LINE>List<TransferInInfo> data = new ArrayList<TransferInInfo>();<NEW_LINE>for (int i = 0; i < _ctx.lengthValue("QueryTransferInListResponse.Data.Length"); i++) {<NEW_LINE>TransferInInfo transferInInfo = new TransferInInfo();<NEW_LINE>transferInInfo.setSubmissionDate(_ctx.stringValue("QueryTransferInListResponse.Data[" + i + "].SubmissionDate"));<NEW_LINE>transferInInfo.setModificationDate(_ctx.stringValue("QueryTransferInListResponse.Data[" + i + "].ModificationDate"));<NEW_LINE>transferInInfo.setUserId(_ctx.stringValue<MASK><NEW_LINE>transferInInfo.setInstanceId(_ctx.stringValue("QueryTransferInListResponse.Data[" + i + "].InstanceId"));<NEW_LINE>transferInInfo.setDomainName(_ctx.stringValue("QueryTransferInListResponse.Data[" + i + "].DomainName"));<NEW_LINE>transferInInfo.setStatus(_ctx.integerValue("QueryTransferInListResponse.Data[" + i + "].Status"));<NEW_LINE>transferInInfo.setSimpleTransferInStatus(_ctx.stringValue("QueryTransferInListResponse.Data[" + i + "].SimpleTransferInStatus"));<NEW_LINE>transferInInfo.setResultCode(_ctx.stringValue("QueryTransferInListResponse.Data[" + i + "].ResultCode"));<NEW_LINE>transferInInfo.setResultDate(_ctx.stringValue("QueryTransferInListResponse.Data[" + i + "].ResultDate"));<NEW_LINE>transferInInfo.setResultMsg(_ctx.stringValue("QueryTransferInListResponse.Data[" + i + "].ResultMsg"));<NEW_LINE>transferInInfo.setTransferAuthorizationCodeSubmissionDate(_ctx.stringValue("QueryTransferInListResponse.Data[" + i + "].TransferAuthorizationCodeSubmissionDate"));<NEW_LINE>transferInInfo.setNeedMailCheck(_ctx.booleanValue("QueryTransferInListResponse.Data[" + i + "].NeedMailCheck"));<NEW_LINE>transferInInfo.setEmail(_ctx.stringValue("QueryTransferInListResponse.Data[" + i + "].Email"));<NEW_LINE>transferInInfo.setWhoisMailStatus(_ctx.booleanValue("QueryTransferInListResponse.Data[" + i + "].WhoisMailStatus"));<NEW_LINE>transferInInfo.setExpirationDate(_ctx.stringValue("QueryTransferInListResponse.Data[" + i + "].ExpirationDate"));<NEW_LINE>transferInInfo.setProgressBarType(_ctx.integerValue("QueryTransferInListResponse.Data[" + i + "].ProgressBarType"));<NEW_LINE>transferInInfo.setSubmissionDateLong(_ctx.longValue("QueryTransferInListResponse.Data[" + i + "].SubmissionDateLong"));<NEW_LINE>transferInInfo.setModificationDateLong(_ctx.longValue("QueryTransferInListResponse.Data[" + i + "].ModificationDateLong"));<NEW_LINE>transferInInfo.setResultDateLong(_ctx.longValue("QueryTransferInListResponse.Data[" + i + "].ResultDateLong"));<NEW_LINE>transferInInfo.setExpirationDateLong(_ctx.longValue("QueryTransferInListResponse.Data[" + i + "].ExpirationDateLong"));<NEW_LINE>transferInInfo.setTransferAuthorizationCodeSubmissionDateLong(_ctx.longValue("QueryTransferInListResponse.Data[" + i + "].TransferAuthorizationCodeSubmissionDateLong"));<NEW_LINE>data.add(transferInInfo);<NEW_LINE>}<NEW_LINE>queryTransferInListResponse.setData(data);<NEW_LINE>return queryTransferInListResponse;<NEW_LINE>} | ("QueryTransferInListResponse.Data[" + i + "].UserId")); |
1,492,426 | public static IpRangeInventory fromMessage(APIAddIpv6RangeByNetworkCidrMsg msg) {<NEW_LINE>IpRangeInventory ipr = new IpRangeInventory();<NEW_LINE>ipr.setNetworkCidr(IPv6NetworkUtils.getFormalCidrOfNetworkCidr(msg.getNetworkCidr()));<NEW_LINE>ipr.setName(msg.getName());<NEW_LINE>ipr.setDescription(msg.getDescription());<NEW_LINE>ipr.setAddressMode(msg.getAddressMode());<NEW_LINE>ipr.setStartIp(IPv6NetworkUtils.getStartIpOfNetworkCidr(msg.getNetworkCidr()));<NEW_LINE>ipr.setEndIp(IPv6NetworkUtils.getEndIpOfNetworkCidr<MASK><NEW_LINE>ipr.setNetmask(IPv6NetworkUtils.getFormalNetmaskOfNetworkCidr(msg.getNetworkCidr()));<NEW_LINE>ipr.setGateway(IPv6NetworkUtils.getGatewayOfNetworkCidr(msg.getNetworkCidr()));<NEW_LINE>ipr.setL3NetworkUuid(msg.getL3NetworkUuid());<NEW_LINE>ipr.setUuid(msg.getResourceUuid());<NEW_LINE>ipr.setIpVersion(IPv6Constants.IPv6);<NEW_LINE>ipr.setPrefixLen(IPv6NetworkUtils.getPrefixLenOfNetworkCidr(msg.getNetworkCidr()));<NEW_LINE>ipr.setIpRangeType(IpRangeType.valueOf(msg.getIpRangeType()));<NEW_LINE>return ipr;<NEW_LINE>} | (msg.getNetworkCidr())); |
1,628,311 | private void initFunctionConsumerOrSupplierFromCatalog(Object targetContext) {<NEW_LINE>String name = resolveName(Function.class, targetContext);<NEW_LINE>this.function = this.catalog.lookup(Function.class, name);<NEW_LINE>if (this.function != null) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>name = resolveName(Consumer.class, targetContext);<NEW_LINE>this.consumer = this.catalog.lookup(Consumer.class, name);<NEW_LINE>if (this.consumer != null) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>name = resolveName(Supplier.class, targetContext);<NEW_LINE>this.supplier = this.catalog.lookup(Supplier.class, name);<NEW_LINE>if (this.supplier != null) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>if (this.catalog.size() >= 1 && this.catalog.size() <= 2) {<NEW_LINE>// we may have RoutingFunction function<NEW_LINE>String functionName = this.catalog.getNames(Function.class).stream().filter(n -> !n.equals(RoutingFunction.FUNCTION_NAME)).findFirst().orElseGet(() -> null);<NEW_LINE>if (functionName != null) {<NEW_LINE>this.function = this.catalog.lookup(Function.class, functionName);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>functionName = this.catalog.getNames(Supplier.class).stream().findFirst()<MASK><NEW_LINE>if (functionName != null) {<NEW_LINE>this.supplier = this.catalog.lookup(Supplier.class, functionName);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>functionName = this.catalog.getNames(Consumer.class).stream().findFirst().orElseGet(() -> null);<NEW_LINE>if (functionName != null) {<NEW_LINE>this.consumer = this.catalog.lookup(Consumer.class, functionName);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>name = this.doResolveName(targetContext);<NEW_LINE>this.function = this.catalog.lookup(Function.class, name);<NEW_LINE>if (this.function != null) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>this.consumer = this.catalog.lookup(Consumer.class, name);<NEW_LINE>if (this.consumer != null) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>this.supplier = this.catalog.lookup(Supplier.class, name);<NEW_LINE>if (this.supplier != null) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | .orElseGet(() -> null); |
209,118 | // ------- RDF collections<NEW_LINE>final public Node Collection(TripleCollectorMark acc) throws ParseException {<NEW_LINE>Node listHead = nRDFnil;<NEW_LINE>Node lastCell = null;<NEW_LINE>int mark;<NEW_LINE>Node n;<NEW_LINE>Token t;<NEW_LINE>t = jj_consume_token(LPAREN);<NEW_LINE>label_15: while (true) {<NEW_LINE>Node cell = createListNode(t.beginLine, t.beginColumn);<NEW_LINE>if (listHead == nRDFnil)<NEW_LINE>listHead = cell;<NEW_LINE>if (lastCell != null)<NEW_LINE>insert(<MASK><NEW_LINE>mark = acc.mark();<NEW_LINE>n = GraphNode(acc);<NEW_LINE>insert(acc, mark, cell, nRDFfirst, n);<NEW_LINE>lastCell = cell;<NEW_LINE>switch((jj_ntk == -1) ? jj_ntk() : jj_ntk) {<NEW_LINE>case IRIref:<NEW_LINE>case PNAME_NS:<NEW_LINE>case PNAME_LN:<NEW_LINE>case BLANK_NODE_LABEL:<NEW_LINE>case VAR1:<NEW_LINE>case VAR2:<NEW_LINE>case TRUE:<NEW_LINE>case FALSE:<NEW_LINE>case INTEGER:<NEW_LINE>case DECIMAL:<NEW_LINE>case DOUBLE:<NEW_LINE>case INTEGER_POSITIVE:<NEW_LINE>case DECIMAL_POSITIVE:<NEW_LINE>case DOUBLE_POSITIVE:<NEW_LINE>case INTEGER_NEGATIVE:<NEW_LINE>case DECIMAL_NEGATIVE:<NEW_LINE>case DOUBLE_NEGATIVE:<NEW_LINE>case STRING_LITERAL1:<NEW_LINE>case STRING_LITERAL2:<NEW_LINE>case STRING_LITERAL_LONG1:<NEW_LINE>case STRING_LITERAL_LONG2:<NEW_LINE>case LPAREN:<NEW_LINE>case NIL:<NEW_LINE>case LBRACKET:<NEW_LINE>case ANON:<NEW_LINE>;<NEW_LINE>break;<NEW_LINE>default:<NEW_LINE>jj_la1[48] = jj_gen;<NEW_LINE>break label_15;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>jj_consume_token(RPAREN);<NEW_LINE>if (lastCell != null)<NEW_LINE>insert(acc, lastCell, nRDFrest, nRDFnil);<NEW_LINE>{<NEW_LINE>if (true)<NEW_LINE>return listHead;<NEW_LINE>}<NEW_LINE>throw new Error("Missing return statement in function");<NEW_LINE>} | acc, lastCell, nRDFrest, cell); |
553,842 | private void renderInitializer(PreparedMethod method) throws IOException {<NEW_LINE>MethodReference ref = method.reference;<NEW_LINE>debugEmitter.emitMethod(ref.getDescriptor());<NEW_LINE>ScopedName name = naming.getNameForInit(ref);<NEW_LINE>renderFunctionDeclaration(name);<NEW_LINE>writer.append("(");<NEW_LINE>for (int i = 0; i < ref.parameterCount(); ++i) {<NEW_LINE>if (i > 0) {<NEW_LINE>writer.append(",").ws();<NEW_LINE>}<NEW_LINE>writer.append(variableNameForInitializer(i));<NEW_LINE>}<NEW_LINE>writer.append(")").ws().append("{")<MASK><NEW_LINE>String instanceName = variableNameForInitializer(ref.parameterCount());<NEW_LINE>writer.append("var " + instanceName).ws().append("=").ws().append("new ").appendClass(ref.getClassName()).append("();").softNewLine();<NEW_LINE>writer.appendMethodBody(ref).append("(" + instanceName);<NEW_LINE>for (int i = 0; i < ref.parameterCount(); ++i) {<NEW_LINE>writer.append(",").ws();<NEW_LINE>writer.append(variableNameForInitializer(i));<NEW_LINE>}<NEW_LINE>writer.append(");").softNewLine();<NEW_LINE>writer.append("return " + instanceName + ";").softNewLine();<NEW_LINE>writer.outdent().append("}");<NEW_LINE>if (name.scoped) {<NEW_LINE>writer.append(";");<NEW_LINE>}<NEW_LINE>writer.newLine();<NEW_LINE>debugEmitter.emitMethod(null);<NEW_LINE>} | .softNewLine().indent(); |
803,787 | private void cleanWorkflowTaskStatus(final String contentTypeInode, final List<WorkflowStep> steps, final Consumer<WorkflowTask> workflowTaskConsumer) throws DotDataException {<NEW_LINE>try {<NEW_LINE>String condition = "";<NEW_LINE>if (steps.size() > 0) {<NEW_LINE>condition = " and status not in (";<NEW_LINE>StringBuilder parameters = new StringBuilder();<NEW_LINE>for (WorkflowStep step : steps) {<NEW_LINE>parameters.append(", ?");<NEW_LINE>}<NEW_LINE>condition += parameters.toString().substring(1) + " )";<NEW_LINE>}<NEW_LINE>final DotConnect db = new DotConnect();<NEW_LINE>db.setSQL(sql.SELECT_TASK_STEPS_TO_CLEAN_BY_STRUCT + condition);<NEW_LINE>db.addParam(contentTypeInode);<NEW_LINE>if (steps.size() > 0) {<NEW_LINE>for (WorkflowStep step : steps) {<NEW_LINE>db.addParam(step.getId());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>final List<WorkflowTask> tasks = this.convertListToObjects(db.<MASK><NEW_LINE>// clean cache<NEW_LINE>tasks.stream().forEach(task -> {<NEW_LINE>cache.remove(task);<NEW_LINE>if (null != workflowTaskConsumer) {<NEW_LINE>workflowTaskConsumer.accept(task);<NEW_LINE>}<NEW_LINE>});<NEW_LINE>db.setSQL(sql.UPDATE_STEPS_BY_STRUCT + condition);<NEW_LINE>db.addParam((Object) null);<NEW_LINE>db.addParam(contentTypeInode);<NEW_LINE>if (steps.size() > 0) {<NEW_LINE>for (WorkflowStep step : steps) {<NEW_LINE>db.addParam(step.getId());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>db.loadResult();<NEW_LINE>} catch (final Exception e) {<NEW_LINE>Logger.error(this.getClass(), e.getMessage(), e);<NEW_LINE>throw new DotDataException(e.getMessage(), e);<NEW_LINE>}<NEW_LINE>} | loadObjectResults(), WorkflowTask.class); |
1,113,523 | private void computeImplementsMaps() {<NEW_LINE>// Construct the immediate supertype relation.<NEW_LINE>Multimap<String, String<MASK><NEW_LINE>superTypesByType.putAll(immediateTypeRelations.immediateImplementedInterfacesByClass);<NEW_LINE>superTypesByType.putAll(Multimaps.forMap(immediateTypeRelations.immediateSuperclassesByClass));<NEW_LINE>superTypesByType.putAll(immediateTypeRelations.immediateSuperInterfacesByInterface);<NEW_LINE>Multimap<String, String> superTypesByTypeClosure = transitiveClosure(superTypesByType);<NEW_LINE>// Remove interfaces from keys and classes from values.<NEW_LINE>implementedInterfacesByClass = ImmutableSetMultimap.copyOf(Multimaps.filterEntries(superTypesByTypeClosure, new Predicate<Entry<String, String>>() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public boolean apply(Entry<String, String> typeTypeEntry) {<NEW_LINE>// Only keep classes as keys and interfaces as values.<NEW_LINE>return allClasses.contains(typeTypeEntry.getKey()) && !allClasses.contains(typeTypeEntry.getValue());<NEW_LINE>}<NEW_LINE>}));<NEW_LINE>classesByImplementingInterface = ImmutableSetMultimap.copyOf(inverse(implementedInterfacesByClass));<NEW_LINE>} | > superTypesByType = HashMultimap.create(); |
334,194 | private void processComponent(ServletContext sc, Element documentElement, NodeList component, TagLibraryImpl taglibrary, String name) {<NEW_LINE>if (component != null && component.getLength() > 0) {<NEW_LINE>String componentType = null;<NEW_LINE>String rendererType = null;<NEW_LINE>String handlerClass = null;<NEW_LINE>Node resourceId = null;<NEW_LINE>for (int i = 0, ilen = component.getLength(); i < ilen; i++) {<NEW_LINE>Node n = component.item(i);<NEW_LINE>if (COMPONENT_TYPE.equals(n.getLocalName())) {<NEW_LINE>componentType = getNodeText(n);<NEW_LINE>} else if (RENDERER_TYPE.equals(n.getLocalName())) {<NEW_LINE>rendererType = getNodeText(n);<NEW_LINE>} else if (HANDLER_CLASS.equals(n.getLocalName())) {<NEW_LINE>handlerClass = getNodeText(n);<NEW_LINE>} else if (RESOURCE_ID.equals(n.getLocalName())) {<NEW_LINE>resourceId = n;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (handlerClass != null) {<NEW_LINE>Class<?> clazz = loadClass(sc, handlerClass, this, null);<NEW_LINE>taglibrary.putComponent(name, componentType, rendererType, clazz);<NEW_LINE>} else if (resourceId != null) {<NEW_LINE>processResourceId(<MASK><NEW_LINE>} else {<NEW_LINE>taglibrary.putComponent(name, componentType, rendererType);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | documentElement, resourceId, taglibrary, name); |
458,732 | private void generateStepExecutionEntry(Long executionId, Long dummyTopLevelStepExecId, BatchStatus batchStatus, String exitStatus) throws Exception {<NEW_LINE>long stepExecutionId = -1L;<NEW_LINE>Connection conn = null;<NEW_LINE>PreparedStatement statement = null;<NEW_LINE>ResultSet rs = null;<NEW_LINE>long time = System.currentTimeMillis();<NEW_LINE>Timestamp timestamp = new Timestamp(time);<NEW_LINE>// I suppose we're not buying ourselves much by enforcing that the FK_TOPLVL_STEPEXECID can never be null<NEW_LINE>String query = // 'T' => (T)op-level.<NEW_LINE>"INSERT INTO JBATCH.STEPTHREADEXECUTION (FK_JOBEXECID, batchstatus, exitstatus, stepname, M_READ, " + "M_WRITE, M_COMMIT, M_ROLLBACK, M_READSKIP, M_PROCESSSKIP, M_WRITESKIP, M_FILTER, STARTTIME, ENDTIME, FK_TOPLVL_STEPEXECID, INTERNALSTATUS, PARTNUM, THREADTYPE) " + "VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, 0, -1, 'T' )";<NEW_LINE>try {<NEW_LINE>conn = getDataSourceConnection();<NEW_LINE>statement = conn.prepareStatement(query, new String[] { "STEPEXECID" });<NEW_LINE>statement.setLong(1, executionId);<NEW_LINE>statement.setInt(2, batchStatus.ordinal());<NEW_LINE>statement.setString(3, exitStatus);<NEW_LINE>statement.setString(4, "stepName_" + executionId);<NEW_LINE>statement.setLong(5, 0);<NEW_LINE>statement.setLong(6, 0);<NEW_LINE>statement.setLong(7, 0);<NEW_LINE>statement.setLong(8, 0);<NEW_LINE>statement.setLong(9, 0);<NEW_LINE>statement.setLong(10, 0);<NEW_LINE>statement.setLong(11, 0);<NEW_LINE>statement.setLong(12, 0);<NEW_LINE>statement.setTimestamp(13, timestamp);<NEW_LINE>statement.setTimestamp(14, timestamp);<NEW_LINE>statement.setLong(15, dummyTopLevelStepExecId);<NEW_LINE>statement.executeUpdate();<NEW_LINE>rs = statement.getGeneratedKeys();<NEW_LINE>if (rs.next()) {<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>} catch (Exception ex) {<NEW_LINE>logger.info("exception creating execution instance: " + ex.toString());<NEW_LINE>throw new TestFailureException(ex.getMessage());<NEW_LINE>} finally {<NEW_LINE>cleanupConnection(conn, rs, statement);<NEW_LINE>}<NEW_LINE>String msg = "generateStepExecutionEntry return execution instance:[" + stepExecutionId + "]";<NEW_LINE>logger.info(msg);<NEW_LINE>} | stepExecutionId = rs.getLong(1); |
1,789,424 | final GetRecoveryGroupReadinessSummaryResult executeGetRecoveryGroupReadinessSummary(GetRecoveryGroupReadinessSummaryRequest getRecoveryGroupReadinessSummaryRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(getRecoveryGroupReadinessSummaryRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<GetRecoveryGroupReadinessSummaryRequest> request = null;<NEW_LINE>Response<GetRecoveryGroupReadinessSummaryResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new GetRecoveryGroupReadinessSummaryRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(getRecoveryGroupReadinessSummaryRequest));<NEW_LINE>// Binds the request metrics to the current request.<NEW_LINE>request.setAWSRequestMetrics(awsRequestMetrics);<NEW_LINE>request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);<NEW_LINE>request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());<NEW_LINE>request.addHandlerContext(<MASK><NEW_LINE>request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Route53 Recovery Readiness");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "GetRecoveryGroupReadinessSummary");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<GetRecoveryGroupReadinessSummaryResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new GetRecoveryGroupReadinessSummaryResultJsonUnmarshaller());<NEW_LINE>response = invoke(request, responseHandler, executionContext);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>endClientExecution(awsRequestMetrics, request, response);<NEW_LINE>}<NEW_LINE>} | HandlerContextKey.SIGNING_REGION, getSigningRegion()); |
766,947 | private JPanel initDateRangeQuerySettingsPanel() {<NEW_LINE>JPanel panel = new JPanel();<NEW_LINE>panel.setOpaque(false);<NEW_LINE>panel.setLayout(new BoxLayout(panel, BoxLayout.PAGE_AXIS));<NEW_LINE>JPanel header = new JPanel(<MASK><NEW_LINE>header.setOpaque(false);<NEW_LINE>header.add(new JLabel(MessageUtils.getLocalizedMessage("search_parser.label.daterange_query")));<NEW_LINE>panel.add(header);<NEW_LINE>JPanel resolution = new JPanel(new FlowLayout(FlowLayout.LEADING));<NEW_LINE>resolution.setOpaque(false);<NEW_LINE>resolution.setBorder(BorderFactory.createEmptyBorder(0, 20, 0, 0));<NEW_LINE>JLabel resLabel = new JLabel(MessageUtils.getLocalizedMessage("search_parser.label.date_res"));<NEW_LINE>resolution.add(resLabel);<NEW_LINE>Arrays.stream(DateTools.Resolution.values()).map(DateTools.Resolution::name).forEach(dateResCB::addItem);<NEW_LINE>dateResCB.setSelectedItem(config.getDateResolution().name());<NEW_LINE>dateResCB.setOpaque(false);<NEW_LINE>resolution.add(dateResCB);<NEW_LINE>panel.add(resolution);<NEW_LINE>JPanel locale = new JPanel(new FlowLayout(FlowLayout.LEADING));<NEW_LINE>locale.setOpaque(false);<NEW_LINE>locale.setBorder(BorderFactory.createEmptyBorder(0, 20, 0, 0));<NEW_LINE>JLabel locLabel = new JLabel(MessageUtils.getLocalizedMessage("search_parser.label.locale"));<NEW_LINE>locale.add(locLabel);<NEW_LINE>locationTF.setColumns(10);<NEW_LINE>locationTF.setText(config.getLocale().toLanguageTag());<NEW_LINE>locale.add(locationTF);<NEW_LINE>JLabel tzLabel = new JLabel(MessageUtils.getLocalizedMessage("search_parser.label.timezone"));<NEW_LINE>locale.add(tzLabel);<NEW_LINE>timezoneTF.setColumns(10);<NEW_LINE>timezoneTF.setText(config.getTimeZone().getID());<NEW_LINE>locale.add(timezoneTF);<NEW_LINE>panel.add(locale);<NEW_LINE>return panel;<NEW_LINE>} | new FlowLayout(FlowLayout.LEADING)); |
9,107 | ActionResult<Wo> execute(EffectivePerson effectivePerson, String id, String path0, String path1, String path2, String path3, String path4, JsonElement jsonElement) throws Exception {<NEW_LINE>ActionResult<Wo> result = new ActionResult<>();<NEW_LINE>Work work = null;<NEW_LINE>try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {<NEW_LINE>Business business = new Business(emc);<NEW_LINE>work = emc.find(id, Work.class);<NEW_LINE>if (null == work) {<NEW_LINE>throw new ExceptionEntityNotExist(id, Work.class);<NEW_LINE>}<NEW_LINE>if (!business.editable(effectivePerson, work)) {<NEW_LINE>throw new ExceptionWorkAccessDenied(effectivePerson.getDistinguishedName(), work.getTitle(), work.getId());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>Wo wo = ThisApplication.context().applications().putQuery(x_processplatform_service_processing.class, Applications.joinQueryUri("data", "work", work.getId(), path0, path1, path2, path3, path4), jsonElement, work.getJob()<MASK><NEW_LINE>result.setData(wo);<NEW_LINE>return result;<NEW_LINE>} | ).getData(Wo.class); |
785,153 | public SegmentWithData peek(final CellRequest request) {<NEW_LINE>final SegmentCacheManager.PeekResponse response = execute(new PeekCommand(request, Locus.peek()));<NEW_LINE>for (SegmentHeader header : response.headerMap.keySet()) {<NEW_LINE>final SegmentBody body = compositeCache.get(header);<NEW_LINE>if (body != null) {<NEW_LINE>final SegmentBuilder.SegmentConverter converter = response.converterMap.get(SegmentCacheIndexImpl.makeConverterKey(header));<NEW_LINE>if (converter != null) {<NEW_LINE>return <MASK><NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>for (Map.Entry<SegmentHeader, Future<SegmentBody>> entry : response.headerMap.entrySet()) {<NEW_LINE>final Future<SegmentBody> bodyFuture = entry.getValue();<NEW_LINE>if (bodyFuture != null) {<NEW_LINE>final SegmentBody body = Util.safeGet(bodyFuture, "Waiting for segment to load");<NEW_LINE>final SegmentHeader header = entry.getKey();<NEW_LINE>final SegmentBuilder.SegmentConverter converter = response.converterMap.get(SegmentCacheIndexImpl.makeConverterKey(header));<NEW_LINE>if (converter != null) {<NEW_LINE>return converter.convert(header, body);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return null;<NEW_LINE>} | converter.convert(header, body); |
394,027 | public void writeScriptUrls(AuraContext context, BaseComponentDef def, Map<String, Object> componentAttributes, StringBuilder sb) throws QuickFixException, IOException {<NEW_LINE>templateUtil.writeHtmlScripts(context, this.getJsClientLibraryUrls(context), Script.LAZY, sb);<NEW_LINE>if (cspInliningService.getInlineMode() != InlineScriptMode.UNSUPPORTED && def != null) {<NEW_LINE>cspInliningService.writeInlineScript(this.getInlineJs(context, def), sb);<NEW_LINE>} else {<NEW_LINE>templateUtil.writeHtmlScript(context, this.getInlineJsUrl(context, componentAttributes), Script.SYNC, sb);<NEW_LINE>}<NEW_LINE>templateUtil.writeHtmlScript(context, this.getFrameworkUrl(), Script.SYNC, sb);<NEW_LINE>if (context.isAppJsSplitEnabled()) {<NEW_LINE>templateUtil.writeHtmlScript(context, this.getAppCoreJsUrl(context, null), Script.SYNC, sb);<NEW_LINE>}<NEW_LINE>templateUtil.writeHtmlScript(context, this.getAppJsUrl(context, null<MASK><NEW_LINE>if (!configAdapter.isBootstrapInliningEnabled()) {<NEW_LINE>templateUtil.writeHtmlScript(context, this.getBootstrapUrl(context, componentAttributes), Script.SYNC, sb);<NEW_LINE>}<NEW_LINE>} | ), Script.SYNC, sb); |
126,974 | public static DiffString concatenate(@Nonnull DiffString s1, @Nonnull DiffString s2) {<NEW_LINE>if (s1.isEmpty())<NEW_LINE>return s2;<NEW_LINE>if (s2.isEmpty())<NEW_LINE>return s1;<NEW_LINE>if (s1.myData == s2.myData && s1.myStart + s1.myLength == s2.myStart) {<NEW_LINE>return create(s1.myData, s1.myStart, <MASK><NEW_LINE>}<NEW_LINE>char[] data = new char[s1.myLength + s2.myLength];<NEW_LINE>System.arraycopy(s1.myData, s1.myStart, data, 0, s1.myLength);<NEW_LINE>System.arraycopy(s2.myData, s2.myStart, data, s1.myLength, s2.myLength);<NEW_LINE>return create(data);<NEW_LINE>} | s1.myLength + s2.myLength); |
1,150,263 | public static ListRepositoryMemberResponse unmarshall(ListRepositoryMemberResponse listRepositoryMemberResponse, UnmarshallerContext _ctx) {<NEW_LINE>listRepositoryMemberResponse.setRequestId(_ctx.stringValue("ListRepositoryMemberResponse.RequestId"));<NEW_LINE>listRepositoryMemberResponse.setErrorCode(_ctx.stringValue("ListRepositoryMemberResponse.ErrorCode"));<NEW_LINE>listRepositoryMemberResponse.setSuccess(_ctx.booleanValue("ListRepositoryMemberResponse.Success"));<NEW_LINE>listRepositoryMemberResponse.setErrorMessage(_ctx.stringValue("ListRepositoryMemberResponse.ErrorMessage"));<NEW_LINE>listRepositoryMemberResponse.setTotal(_ctx.longValue("ListRepositoryMemberResponse.Total"));<NEW_LINE>List<ResultItem> result <MASK><NEW_LINE>for (int i = 0; i < _ctx.lengthValue("ListRepositoryMemberResponse.Result.Length"); i++) {<NEW_LINE>ResultItem resultItem = new ResultItem();<NEW_LINE>resultItem.setAccessLevel(_ctx.integerValue("ListRepositoryMemberResponse.Result[" + i + "].AccessLevel"));<NEW_LINE>resultItem.setExternUserId(_ctx.stringValue("ListRepositoryMemberResponse.Result[" + i + "].ExternUserId"));<NEW_LINE>resultItem.setId(_ctx.longValue("ListRepositoryMemberResponse.Result[" + i + "].Id"));<NEW_LINE>resultItem.setState(_ctx.stringValue("ListRepositoryMemberResponse.Result[" + i + "].State"));<NEW_LINE>resultItem.setAvatarUrl(_ctx.stringValue("ListRepositoryMemberResponse.Result[" + i + "].AvatarUrl"));<NEW_LINE>resultItem.setEmail(_ctx.stringValue("ListRepositoryMemberResponse.Result[" + i + "].Email"));<NEW_LINE>resultItem.setName(_ctx.stringValue("ListRepositoryMemberResponse.Result[" + i + "].Name"));<NEW_LINE>resultItem.setUsername(_ctx.stringValue("ListRepositoryMemberResponse.Result[" + i + "].Username"));<NEW_LINE>result.add(resultItem);<NEW_LINE>}<NEW_LINE>listRepositoryMemberResponse.setResult(result);<NEW_LINE>return listRepositoryMemberResponse;<NEW_LINE>} | = new ArrayList<ResultItem>(); |
1,670,189 | public void dataTypeRenamed(DataTypeManager dtm, DataTypePath oldPath, DataTypePath newPath) {<NEW_LINE>DataTypeManager originalDTM = getOriginalDataTypeManager();<NEW_LINE>if (dtm != originalDTM) {<NEW_LINE>// Different DTM than the one for this data type.<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>if (!isLoaded()) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>if (oldPath.getDataTypeName().equals(newPath.getDataTypeName())) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>String newName = newPath.getDataTypeName();<NEW_LINE>String oldName = oldPath.getDataTypeName();<NEW_LINE>// Does the old name match our original name.<NEW_LINE>// Check originalCompositeId to ensure original type is managed<NEW_LINE>if (originalCompositeId != DataTypeManager.NULL_DATATYPE_ID && oldPath.equals(originalDataTypePath)) {<NEW_LINE>originalDataTypePath = newPath;<NEW_LINE>try {<NEW_LINE>if (viewComposite.getName().equals(oldName)) {<NEW_LINE>setName(newName);<NEW_LINE>compositeInfoChanged();<NEW_LINE>}<NEW_LINE>} catch (DuplicateNameException e) {<NEW_LINE>Msg.error(this, "Unexpected Exception: " + e.getMessage(), e);<NEW_LINE>} catch (InvalidNameException e) {<NEW_LINE>Msg.error(this, "Unexpected Exception: " + e.getMessage(), e);<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>DataType dt = viewDTM.getDataType(oldPath);<NEW_LINE>if (dt != null) {<NEW_LINE>try {<NEW_LINE>dt.setName(newName);<NEW_LINE>fireTableDataChanged();<NEW_LINE>componentDataChanged();<NEW_LINE>} catch (InvalidNameException e) {<NEW_LINE>Msg.error(this, "Unexpected Exception: " + <MASK><NEW_LINE>} catch (DuplicateNameException e) {<NEW_LINE>Msg.error(this, "Unexpected Exception: " + e.getMessage(), e);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | e.getMessage(), e); |
746,005 | private static void callShowWarning(PythonContext context, Object category, Object text, Object message, Object filename, int lineno, Object sourceline, Object sourceIn) {<NEW_LINE>PRaiseNode raise = PRaiseNode.getUncached();<NEW_LINE>Object showFn = getWarningsAttr(context, "_showwarnmsg", sourceIn != null);<NEW_LINE>if (showFn == null) {<NEW_LINE>showWarning(filename, lineno, text, category, sourceline);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>if (!PyCallableCheckNode.getUncached().execute(showFn)) {<NEW_LINE>throw raise.raise(PythonBuiltinClassType.TypeError, "warnings._showwarnmsg() must be set to a callable");<NEW_LINE>}<NEW_LINE>Object warnmsgCls = <MASK><NEW_LINE>if (warnmsgCls == null) {<NEW_LINE>throw raise.raise(PythonBuiltinClassType.RuntimeError, "unable to get warnings.WarningMessage");<NEW_LINE>}<NEW_LINE>Object source = sourceIn == null ? PNone.NONE : sourceIn;<NEW_LINE>assert message != null && category != null && filename != null && source != null;<NEW_LINE>assert message != PNone.NO_VALUE && category != PNone.NO_VALUE && filename != PNone.NO_VALUE && source != PNone.NO_VALUE;<NEW_LINE>Object msg = CallNode.getUncached().execute(warnmsgCls, message, category, filename, lineno, PNone.NONE, PNone.NONE, source);<NEW_LINE>CallNode.getUncached().execute(showFn, msg);<NEW_LINE>} | getWarningsAttr(context, "WarningMessage", false); |
380,639 | public Map<String, Object> buildHiveReader() {<NEW_LINE>DataxHivePojo dataxHivePojo = new DataxHivePojo();<NEW_LINE>dataxHivePojo.setJdbcDatasource(readerDatasource);<NEW_LINE>List<Map<String, Object>> columns = Lists.newArrayList();<NEW_LINE>readerColumns.forEach(c -> {<NEW_LINE>Map<String, Object> column = Maps.newLinkedHashMap();<NEW_LINE>column.put("index", c.split(Constants.SPLIT_SCOLON)[0]);<NEW_LINE>column.put("type", c.split(Constants.SPLIT_SCOLON)[2]);<NEW_LINE>columns.add(column);<NEW_LINE>});<NEW_LINE>dataxHivePojo.setColumns(columns);<NEW_LINE>dataxHivePojo.setReaderDefaultFS(hiveReaderDto.getReaderDefaultFS());<NEW_LINE>dataxHivePojo.setReaderFieldDelimiter(hiveReaderDto.getReaderFieldDelimiter());<NEW_LINE>dataxHivePojo.setReaderFileType(hiveReaderDto.getReaderFileType());<NEW_LINE>dataxHivePojo.<MASK><NEW_LINE>dataxHivePojo.setSkipHeader(hiveReaderDto.getReaderSkipHeader());<NEW_LINE>return readerPlugin.buildHive(dataxHivePojo);<NEW_LINE>} | setReaderPath(hiveReaderDto.getReaderPath()); |
816,167 | private String addDefaultWorkflowScheme(DotConnect dc) throws DotDataException, SQLException {<NEW_LINE>String schemeID = UUIDGenerator.generateUuid();<NEW_LINE>dc.setSQL("SELECT id FROM workflow_scheme WHERE name = 'Default Scheme'");<NEW_LINE>List<Map<String, String>> results = null;<NEW_LINE>results = dc.loadResults();<NEW_LINE>if (results != null && results.size() > 0) {<NEW_LINE>// The scheme already exists, use the existing ID instead<NEW_LINE>schemeID = results.get(0).get("id");<NEW_LINE>} else {<NEW_LINE>dc.executeStatement(// id<NEW_LINE>"insert into workflow_scheme (id, name, description, archived, mandatory, entry_action_id, default_scheme) " + "values ('" + schemeID + // name<NEW_LINE>"'," + // description<NEW_LINE>"'Default Scheme'," + "'This is the default workflow scheme that will be applied to all content'," + // archived<NEW_LINE>DbConnectionFactory.getDBFalse() + "," + // mandatory<NEW_LINE>DbConnectionFactory.getDBFalse() + // entry_action_id<NEW_LINE>"," + "null," + // default_scheme<NEW_LINE>DbConnectionFactory.getDBTrue() + ")");<NEW_LINE>}<NEW_LINE>dc.executeStatement("update workflow_scheme set default_scheme = " + DbConnectionFactory.getDBTrue(<MASK><NEW_LINE>return schemeID;<NEW_LINE>} | ) + " where id = '" + schemeID + "' "); |
636,861 | public void onItemClick(AdapterView<?> parent, View view, int position, long id) {<NEW_LINE>TextView textView = (TextView) view.findViewById(R.id.autoCompleteScreenName);<NEW_LINE>if (textView == null) {<NEW_LINE>textView = (TextView) view.findViewById(R.id.autoCompleteHashtag);<NEW_LINE>}<NEW_LINE>String autoCompleteText = String.valueOf(textView.getText());<NEW_LINE>String editText = String.valueOf(mAutocompleteTarget.getText());<NEW_LINE>int currentStart = mAutocompleteTarget.getSelectionStart();<NEW_LINE>int currentEnd = mAutocompleteTarget.getSelectionEnd();<NEW_LINE>int currentPosition = editText.length() - 1;<NEW_LINE>if (currentStart == currentEnd) {<NEW_LINE>currentPosition = currentStart;<NEW_LINE>}<NEW_LINE>if (currentPosition < 0)<NEW_LINE>currentPosition = 0;<NEW_LINE>int autoCompleteStart = 0;<NEW_LINE>for (int i = currentPosition; i > 0; i--) {<NEW_LINE>String nextChar = editText.substring(i - 1, i).toLowerCase();<NEW_LINE>if (nextChar.equals(" ") || nextChar.equals(".")) {<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>autoCompleteStart = i - 1;<NEW_LINE>}<NEW_LINE>String newText = editText.substring(0, autoCompleteStart) + autoCompleteText + " " + editText.substring(currentPosition);<NEW_LINE>mAutocompleteTarget.setText(newText);<NEW_LINE>mAutocompleteTarget.setSelection(<MASK><NEW_LINE>mAutocompleteListView.setVisibility(View.GONE);<NEW_LINE>} | autoCompleteStart + autoCompleteText.length()); |
446,365 | private static MPrintFormat copy(Properties ctx, int from_AD_PrintFormat_ID, int to_AD_PrintFormat_ID, int to_Client_ID) {<NEW_LINE>MClient company = MClient.get(ctx);<NEW_LINE>s_log.info("From AD_PrintFormat_ID=" + from_AD_PrintFormat_ID + ", To AD_PrintFormat_ID=" + to_AD_PrintFormat_ID + ", To Client_ID=" + to_Client_ID);<NEW_LINE>if (from_AD_PrintFormat_ID == 0)<NEW_LINE>throw new IllegalArgumentException("From_AD_PrintFormat_ID is 0");<NEW_LINE>//<NEW_LINE>MPrintFormat from = new MPrintFormat(ctx, from_AD_PrintFormat_ID, null);<NEW_LINE>// could be 0<NEW_LINE>MPrintFormat to = new MPrintFormat(ctx, to_AD_PrintFormat_ID, null);<NEW_LINE><MASK><NEW_LINE>// New<NEW_LINE>if (to_AD_PrintFormat_ID == 0) {<NEW_LINE>if (to_Client_ID < 0)<NEW_LINE>to_Client_ID = Env.getAD_Client_ID(ctx);<NEW_LINE>to.setClientOrg(to_Client_ID, 0);<NEW_LINE>}<NEW_LINE>// Set Name - Remove TEMPLATE<NEW_LINE>to.setName(company.getValue() + " -> " + Util.replace(to.getName(), "** TEMPLATE **", "").trim());<NEW_LINE>String sql = "SELECT count(*) from AD_PrintFormat WHERE AD_Client_ID = ? AND AD_Table_ID = ? AND Name = ?";<NEW_LINE>String suggestedName = to.getName();<NEW_LINE>int count = 0;<NEW_LINE>while (DB.getSQLValue(to.get_TrxName(), sql, to.getAD_Client_ID(), to.getAD_Table_ID(), suggestedName) > 0) {<NEW_LINE>count++;<NEW_LINE>suggestedName = to.getName() + " (" + count + ")";<NEW_LINE>}<NEW_LINE>to.setName(suggestedName);<NEW_LINE>//<NEW_LINE>to.saveEx();<NEW_LINE>// Copy Items<NEW_LINE>to.setItems(copyItems(from, to));<NEW_LINE>return to;<NEW_LINE>} | MPrintFormat.copyValues(from, to); |
1,306,480 | public Set<ByteArrayWrapper> keys() {<NEW_LINE>Stream<ByteArrayWrapper> baseKeys;<NEW_LINE>Stream<ByteArrayWrapper> committedKeys;<NEW_LINE>Stream<ByteArrayWrapper> uncommittedKeys;<NEW_LINE>Set<ByteArrayWrapper> uncommittedKeysToRemove;<NEW_LINE>this.lock.readLock().lock();<NEW_LINE>try {<NEW_LINE>baseKeys = base.keys().stream();<NEW_LINE>committedKeys = committedCache.entrySet().stream().filter(e -> e.getValue() != null).map(Map.Entry::getKey);<NEW_LINE>uncommittedKeys = uncommittedCache.entrySet().stream().filter(e -> e.getValue() != null).map(Map.Entry::getKey);<NEW_LINE>uncommittedKeysToRemove = uncommittedCache.entrySet().stream().filter(e -> e.getValue() == null).map(Map.Entry::getKey).collect(Collectors.toSet());<NEW_LINE>} finally {<NEW_LINE>this.lock.readLock().unlock();<NEW_LINE>}<NEW_LINE>Stream<ByteArrayWrapper> knownKeys = Stream.concat(Stream.concat(baseKeys, committedKeys), uncommittedKeys);<NEW_LINE>return knownKeys.filter(k -> !uncommittedKeysToRemove.contains(k)).collect(Collectors<MASK><NEW_LINE>} | .toCollection(HashSet::new)); |
213,114 | public boolean readCoordinates() throws IOException {<NEW_LINE>while (true) {<NEW_LINE>// Write a prompt<NEW_LINE>System.out.print("\nTarget x,y\n> ");<NEW_LINE>String inputLine = reader.readLine();<NEW_LINE>if (inputLine == null) {<NEW_LINE>// If the input stream is ended, there is no way to continue the game<NEW_LINE>System.out.println("\nGame quit\n");<NEW_LINE>isQuit = true;<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>// split the input into two fields<NEW_LINE>String[] fields = inputLine.split(",");<NEW_LINE>if (fields.length != 2) {<NEW_LINE>// has to be exactly two<NEW_LINE>System.out.println("Need two coordinates separated by ','");<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>coords = new int[2];<NEW_LINE>boolean error = false;<NEW_LINE>// each field should contain an integer from 1 to the size of the sea<NEW_LINE>try {<NEW_LINE>for (int c = 0; c < 2; ++c) {<NEW_LINE>int val = Integer.parseInt(fields<MASK><NEW_LINE>if ((val < 1) || (val > scale)) {<NEW_LINE>System.out.println("Coordinates must be from 1 to " + scale);<NEW_LINE>error = true;<NEW_LINE>} else {<NEW_LINE>coords[c] = val;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} catch (NumberFormatException ne) {<NEW_LINE>// this happens if the field is not a valid number<NEW_LINE>System.out.println("Coordinates must be numbers");<NEW_LINE>error = true;<NEW_LINE>}<NEW_LINE>if (!error)<NEW_LINE>return true;<NEW_LINE>}<NEW_LINE>} | [c].strip()); |
590,017 | public static SelectInContext createContext(AnActionEvent event) {<NEW_LINE>DataContext dataContext = event.getDataContext();<NEW_LINE>SelectInContext result = createEditorContext(dataContext);<NEW_LINE>if (result != null) {<NEW_LINE>return result;<NEW_LINE>}<NEW_LINE>JComponent sourceComponent = getEventComponent(event);<NEW_LINE>if (sourceComponent == null) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>SelectInContext selectInContext = dataContext.getData(SelectInContext.DATA_KEY);<NEW_LINE>if (selectInContext == null) {<NEW_LINE>selectInContext = createPsiContext(event);<NEW_LINE>}<NEW_LINE>if (selectInContext == null) {<NEW_LINE>Navigatable descriptor = <MASK><NEW_LINE>if (descriptor instanceof OpenFileDescriptor) {<NEW_LINE>final VirtualFile file = ((OpenFileDescriptor) descriptor).getFile();<NEW_LINE>if (file.isValid()) {<NEW_LINE>Project project = dataContext.getData(CommonDataKeys.PROJECT);<NEW_LINE>selectInContext = OpenFileDescriptorContext.create(project, file);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (selectInContext == null) {<NEW_LINE>VirtualFile virtualFile = dataContext.getData(PlatformDataKeys.VIRTUAL_FILE);<NEW_LINE>Project project = dataContext.getData(CommonDataKeys.PROJECT);<NEW_LINE>if (virtualFile != null && project != null) {<NEW_LINE>return new VirtualFileSelectInContext(project, virtualFile);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return selectInContext;<NEW_LINE>} | dataContext.getData(PlatformDataKeys.NAVIGATABLE); |
376,623 | public CodegenExpression make(CodegenMethodScope parent, CodegenClassScope classScope) {<NEW_LINE>CodegenMethod method = parent.makeChild(TimerScheduleSpecComputeFromExpr.EPTYPE, <MASK><NEW_LINE>method.getBlock().declareVarNewInstance(TimerScheduleSpecComputeFromExpr.EPTYPE, "compute").exprDotMethod(ref("compute"), "setDate", dateNode == null ? constantNull() : ExprNodeUtilityCodegen.codegenEvaluator(dateNode.getForge(), method, this.getClass(), classScope)).exprDotMethod(ref("compute"), "setRepetitions", repetitionsNode == null ? constantNull() : ExprNodeUtilityCodegen.codegenEvaluator(repetitionsNode.getForge(), method, this.getClass(), classScope));<NEW_LINE>if (periodNode != null) {<NEW_LINE>method.getBlock().exprDotMethod(ref("compute"), "setTimePeriod", periodNode.makeTimePeriodAnonymous(method, classScope));<NEW_LINE>}<NEW_LINE>method.getBlock().methodReturn(ref("compute"));<NEW_LINE>return localMethod(method);<NEW_LINE>} | this.getClass(), classScope); |
97,956 | public void updatePointData(WptPt pt, double lat, double lon, long time, String description, String name, String category, int color, String iconName, String iconBackground) {<NEW_LINE>currentTrack.getModifiableGpxFile().modifiedTime = time;<NEW_LINE>List<Object> params = new ArrayList<>();<NEW_LINE>params.add(lat);<NEW_LINE>params.add(lon);<NEW_LINE>params.add(time);<NEW_LINE>params.add(description);<NEW_LINE>params.add(name);<NEW_LINE>params.add(category);<NEW_LINE>params.add(color);<NEW_LINE>params.add(iconName);<NEW_LINE>params.add(iconBackground);<NEW_LINE>params.add(pt.getLatitude());<NEW_LINE>params.add(pt.getLongitude());<NEW_LINE>params.add(pt.time);<NEW_LINE>StringBuilder sb = new StringBuilder();<NEW_LINE>String prefix = "UPDATE " + POINT_NAME + " SET " + POINT_COL_LAT + "=?, " + POINT_COL_LON + "=?, " + POINT_COL_DATE + "=?, " + POINT_COL_DESCRIPTION + "=?, " + POINT_COL_NAME + "=?, " + POINT_COL_CATEGORY + "=?, " + POINT_COL_COLOR + "=?, " + POINT_COL_ICON + "=?, " + POINT_COL_BACKGROUND + "=? " + "WHERE " + POINT_COL_LAT + "=? AND " + POINT_COL_LON + "=? AND " + POINT_COL_DATE + "=?";<NEW_LINE>sb.append(prefix);<NEW_LINE>if (pt.desc != null) {<NEW_LINE>sb.append(" AND ").append(POINT_COL_DESCRIPTION).append("=?");<NEW_LINE>params.add(pt.desc);<NEW_LINE>} else {<NEW_LINE>sb.append(" AND ").append(POINT_COL_DESCRIPTION).append(" IS NULL");<NEW_LINE>}<NEW_LINE>if (pt.name != null) {<NEW_LINE>sb.append(" AND ").append(POINT_COL_NAME).append("=?");<NEW_LINE><MASK><NEW_LINE>} else {<NEW_LINE>sb.append(" AND ").append(POINT_COL_NAME).append(" IS NULL");<NEW_LINE>}<NEW_LINE>if (pt.category != null) {<NEW_LINE>sb.append(" AND ").append(POINT_COL_CATEGORY).append("=?");<NEW_LINE>params.add(pt.category);<NEW_LINE>} else {<NEW_LINE>sb.append(" AND ").append(POINT_COL_CATEGORY).append(" IS NULL");<NEW_LINE>}<NEW_LINE>execWithClose(sb.toString(), params.toArray());<NEW_LINE>pt.lat = lat;<NEW_LINE>pt.lon = lon;<NEW_LINE>pt.time = time;<NEW_LINE>pt.desc = description;<NEW_LINE>pt.name = name;<NEW_LINE>pt.category = category;<NEW_LINE>if (color != 0) {<NEW_LINE>pt.setColor(color);<NEW_LINE>}<NEW_LINE>if (iconName != null) {<NEW_LINE>pt.setIconName(iconName);<NEW_LINE>}<NEW_LINE>if (iconBackground != null) {<NEW_LINE>pt.setBackgroundType(iconBackground);<NEW_LINE>}<NEW_LINE>} | params.add(pt.name); |
674,349 | public void initPathSegments() {<NEW_LINE>if (pathSegments != null) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>// this is not super optimised<NEW_LINE>// I don't think we care about it that much though<NEW_LINE>String path = getPath();<NEW_LINE>String[] <MASK><NEW_LINE>pathSegments = new ArrayList<>();<NEW_LINE>boolean hasMatrix = false;<NEW_LINE>for (String i : parts) {<NEW_LINE>if (i.isEmpty()) {<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>PathSegmentImpl ps = new PathSegmentImpl(i, true);<NEW_LINE>hasMatrix = ps.hasMatrixParams() || hasMatrix;<NEW_LINE>pathSegments.add(ps);<NEW_LINE>}<NEW_LINE>if (hasMatrix) {<NEW_LINE>StringBuilder sb = new StringBuilder();<NEW_LINE>for (PathSegment i : pathSegments) {<NEW_LINE>sb.append("/");<NEW_LINE>sb.append(i.getPath());<NEW_LINE>}<NEW_LINE>if (path.endsWith("/")) {<NEW_LINE>sb.append("/");<NEW_LINE>}<NEW_LINE>String newPath = sb.toString();<NEW_LINE>this.path = newPath;<NEW_LINE>if (this.remaining != null) {<NEW_LINE>this.remaining = newPath.substring(getPathWithoutPrefix().length() - this.remaining.length());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | parts = path.split("/"); |
1,263,743 | public void testAssumptionFailure(TestIdentifier testIdentifier, String trace) {<NEW_LINE>if (takeScreenshotOnFailure) {<NEW_LINE>String suffix = "_failure";<NEW_LINE>String filepath = testIdentifier.getTestName() + suffix + SCREENSHOT_SUFFIX;<NEW_LINE>executeOnAdbShell("screencap -p " + screenshotsPathOnDevice + "/" + filepath);<NEW_LINE>getLog().info(deviceLogLinePrefix + INDENT + INDENT + filepath + " saved.");<NEW_LINE>}<NEW_LINE>++testFailureCount;<NEW_LINE>getLog().info(deviceLogLinePrefix + INDENT + INDENT + testIdentifier.toString());<NEW_LINE>getLog().info(deviceLogLinePrefix + INDENT + INDENT + trace);<NEW_LINE>if (createReport) {<NEW_LINE>final Testsuite.Testcase.Failure failure = new Testsuite.Testcase.Failure();<NEW_LINE>failure.setValue(trace);<NEW_LINE>failure.setMessage(parseForMessage(trace));<NEW_LINE>failure.setType(parseForException(trace));<NEW_LINE>currentTestCase.<MASK><NEW_LINE>}<NEW_LINE>} | getFailure().add(failure); |
4,557 | protected void save(final boolean needDismiss) {<NEW_LINE>MapActivity mapActivity = getMapActivity();<NEW_LINE>WptPtEditor editor = getWptPtEditor();<NEW_LINE>WptPt wpt = getWpt();<NEW_LINE>if (mapActivity != null && editor != null && wpt != null) {<NEW_LINE>String name = Algorithms.isEmpty(getNameTextValue()) ? null : getNameTextValue();<NEW_LINE>String address = Algorithms.isEmpty(getAddressTextValue()) ? null : getAddressTextValue();<NEW_LINE>String category = Algorithms.isEmpty(getCategoryTextValue()) ? null : getCategoryTextValue();<NEW_LINE>String description = Algorithms.isEmpty(getDescriptionTextValue()) ? null : getDescriptionTextValue();<NEW_LINE>if (editor.isProcessingTemplate()) {<NEW_LINE>doAddWaypointTemplate(name, address, category, description);<NEW_LINE>} else if (editor.isNew()) {<NEW_LINE>doAddWpt(name, category, description);<NEW_LINE>wpt = getWpt();<NEW_LINE>} else {<NEW_LINE>doUpdateWpt(name, category, description);<NEW_LINE>}<NEW_LINE>if (!Algorithms.isEmpty(wpt.getIconName())) {<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>mapActivity.refreshMap();<NEW_LINE>if (needDismiss) {<NEW_LINE>dismiss(false);<NEW_LINE>}<NEW_LINE>MapContextMenu menu = mapActivity.getContextMenu();<NEW_LINE>if (menu.getLatLon() != null && menu.isActive() && wpt != null) {<NEW_LINE>LatLon latLon = new LatLon(wpt.getLatitude(), wpt.getLongitude());<NEW_LINE>if (menu.getLatLon().equals(latLon)) {<NEW_LINE>menu.update(latLon, new WptLocationPoint(wpt).getPointDescription(mapActivity), wpt);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>saved = true;<NEW_LINE>}<NEW_LINE>} | addLastUsedIcon(wpt.getIconName()); |
484,784 | public static void onHarvest(@Nonnull BlockEvent.HarvestDropsEvent event) {<NEW_LINE>final World world = event.getWorld();<NEW_LINE>if (world == null || world.isRemote || event.getHarvester() == null || event.isSilkTouching() || !isEquipped(event.getHarvester())) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>final IBlockState state = event.getState();<NEW_LINE>if (state == null || !IHarvestingTarget.isDefaultLeaves(state)) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>final boolean exnihilo = hasExNihilo();<NEW_LINE>final boolean powered = isPowered(event.getHarvester(), 1);<NEW_LINE>if (exnihilo && !powered) {<NEW_LINE>// ex nihilo already adds extra drops<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>NNList<ItemStack> list = new NNList<>();<NEW_LINE>final int start = exnihilo ? DarkSteelConfig.crookExtraDropsUnpowered.get() : 0;<NEW_LINE>final int loops = Math.max(start, (powered ? DarkSteelConfig.crookExtraDropsPowered : DarkSteelConfig.crookExtraDropsUnpowered).get());<NEW_LINE>for (int i = start; i < loops; i++) {<NEW_LINE>state.getBlock().getDrops(list, world, event.getPos(), state, event.getFortuneLevel());<NEW_LINE>}<NEW_LINE>event.<MASK><NEW_LINE>} | getDrops().addAll(list); |
1,594,654 | public void cleanupVolumeDuringSnapshotFailure(Long volumeId, Long snapshotId) {<NEW_LINE>SnapshotVO snaphsot = _snapshotDao.findById(snapshotId);<NEW_LINE>if (snaphsot != null) {<NEW_LINE>if (snaphsot.getState() != Snapshot.State.BackedUp) {<NEW_LINE>List<SnapshotDataStoreVO> snapshotDataStoreVOs = _snapshotStoreDao.findBySnapshotId(snapshotId);<NEW_LINE>for (SnapshotDataStoreVO snapshotDataStoreVO : snapshotDataStoreVOs) {<NEW_LINE>s_logger.debug("Remove snapshot " + snapshotId + ", status " + snapshotDataStoreVO.getState() + " on snapshot_store_ref table with id: " + snapshotDataStoreVO.getId());<NEW_LINE>_snapshotStoreDao.remove(snapshotDataStoreVO.getId());<NEW_LINE>}<NEW_LINE>s_logger.debug("Remove snapshot " + snapshotId + " status " + <MASK><NEW_LINE>_snapshotDao.remove(snapshotId);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | snaphsot.getState() + " from snapshot table"); |
1,238,135 | private static void tryAssertion(RegressionEnvironment env) {<NEW_LINE>env.assertStatement("s0", statement -> {<NEW_LINE>FragmentEventType fragmentType = statement.getEventType().getFragmentType("subrow");<NEW_LINE>assertFalse(fragmentType.isIndexed());<NEW_LINE>assertFalse(fragmentType.isNative());<NEW_LINE>Object[][] rows = new Object[][] { { "v1", String.class }, { "v2", Integer.class } };<NEW_LINE>for (int i = 0; i < rows.length; i++) {<NEW_LINE>String message = "Failed assertion for " + rows[i][0];<NEW_LINE>EventPropertyDescriptor prop = fragmentType.getFragmentType().getPropertyDescriptors()[i];<NEW_LINE>assertEquals(message, rows[i][0], prop.getPropertyName());<NEW_LINE>assertEquals(message, rows[i][1], prop.getPropertyType());<NEW_LINE>}<NEW_LINE>});<NEW_LINE>String[] fields = "subrow.v1,subrow.v2".split(",");<NEW_LINE>env.sendEventBean(new SupportBean_S0(1));<NEW_LINE>env.assertPropsNew("s0", fields, new Object[] { null, null });<NEW_LINE>env.sendEventBean(new SupportBean("E1", 10));<NEW_LINE>env.sendEventBean(new SupportBean_S0(2));<NEW_LINE>env.assertPropsNew("s0", fields, new Object<MASK><NEW_LINE>env.sendEventBean(new SupportBean("E2", 20));<NEW_LINE>env.sendEventBean(new SupportBean_S0(3));<NEW_LINE>env.assertPropsNew("s0", fields, new Object[] { "E2", 20 });<NEW_LINE>} | [] { "E1", 10 }); |
1,763,445 | public void readFields(DataInput in) throws IOException {<NEW_LINE>super.readFields(in);<NEW_LINE><MASK><NEW_LINE>for (int i = 0; i < size; i++) {<NEW_LINE>long partitionId = in.readLong();<NEW_LINE>int size2 = in.readInt();<NEW_LINE>Map<Long, Long> tabletIdMap = partitionIdToBaseRollupTabletIdMap.computeIfAbsent(partitionId, k -> Maps.newHashMap());<NEW_LINE>for (int j = 0; j < size2; j++) {<NEW_LINE>long rollupTabletId = in.readLong();<NEW_LINE>long baseTabletId = in.readLong();<NEW_LINE>tabletIdMap.put(rollupTabletId, baseTabletId);<NEW_LINE>}<NEW_LINE>partitionIdToRollupIndex.put(partitionId, MaterializedIndex.read(in));<NEW_LINE>}<NEW_LINE>baseIndexId = in.readLong();<NEW_LINE>rollupIndexId = in.readLong();<NEW_LINE>baseIndexName = Text.readString(in);<NEW_LINE>rollupIndexName = Text.readString(in);<NEW_LINE>size = in.readInt();<NEW_LINE>for (int i = 0; i < size; i++) {<NEW_LINE>Column column = Column.read(in);<NEW_LINE>rollupSchema.add(column);<NEW_LINE>}<NEW_LINE>baseSchemaHash = in.readInt();<NEW_LINE>rollupSchemaHash = in.readInt();<NEW_LINE>rollupKeysType = KeysType.valueOf(Text.readString(in));<NEW_LINE>rollupShortKeyColumnCount = in.readShort();<NEW_LINE>watershedTxnId = in.readLong();<NEW_LINE>if (Catalog.getCurrentCatalogJournalVersion() >= FeMetaVersion.VERSION_85) {<NEW_LINE>storageFormat = TStorageFormat.valueOf(Text.readString(in));<NEW_LINE>}<NEW_LINE>} | int size = in.readInt(); |
545,837 | public static DescribePropertyPortDetailResponse unmarshall(DescribePropertyPortDetailResponse describePropertyPortDetailResponse, UnmarshallerContext _ctx) {<NEW_LINE>describePropertyPortDetailResponse.setRequestId(_ctx.stringValue("DescribePropertyPortDetailResponse.RequestId"));<NEW_LINE>PageInfo pageInfo = new PageInfo();<NEW_LINE>pageInfo.setCount(_ctx.integerValue("DescribePropertyPortDetailResponse.PageInfo.Count"));<NEW_LINE>pageInfo.setPageSize(_ctx.integerValue("DescribePropertyPortDetailResponse.PageInfo.PageSize"));<NEW_LINE>pageInfo.setTotalCount(_ctx.integerValue("DescribePropertyPortDetailResponse.PageInfo.TotalCount"));<NEW_LINE>pageInfo.setCurrentPage(_ctx.integerValue("DescribePropertyPortDetailResponse.PageInfo.CurrentPage"));<NEW_LINE>describePropertyPortDetailResponse.setPageInfo(pageInfo);<NEW_LINE>List<PropertyPort> propertys = new ArrayList<PropertyPort>();<NEW_LINE>for (int i = 0; i < _ctx.lengthValue("DescribePropertyPortDetailResponse.Propertys.Length"); i++) {<NEW_LINE>PropertyPort propertyPort = new PropertyPort();<NEW_LINE>propertyPort.setBindIp(_ctx.stringValue("DescribePropertyPortDetailResponse.Propertys[" + i + "].BindIp"));<NEW_LINE>propertyPort.setPort(_ctx.stringValue("DescribePropertyPortDetailResponse.Propertys[" + i + "].Port"));<NEW_LINE>propertyPort.setInstanceName(_ctx.stringValue("DescribePropertyPortDetailResponse.Propertys[" + i + "].InstanceName"));<NEW_LINE>propertyPort.setProto(_ctx.stringValue("DescribePropertyPortDetailResponse.Propertys[" + i + "].Proto"));<NEW_LINE>propertyPort.setIp(_ctx.stringValue("DescribePropertyPortDetailResponse.Propertys[" + i + "].Ip"));<NEW_LINE>propertyPort.setCreate(_ctx.stringValue<MASK><NEW_LINE>propertyPort.setCreateTimestamp(_ctx.longValue("DescribePropertyPortDetailResponse.Propertys[" + i + "].CreateTimestamp"));<NEW_LINE>propertyPort.setProcName(_ctx.stringValue("DescribePropertyPortDetailResponse.Propertys[" + i + "].ProcName"));<NEW_LINE>propertyPort.setUuid(_ctx.stringValue("DescribePropertyPortDetailResponse.Propertys[" + i + "].Uuid"));<NEW_LINE>propertyPort.setInstanceId(_ctx.stringValue("DescribePropertyPortDetailResponse.Propertys[" + i + "].InstanceId"));<NEW_LINE>propertyPort.setIntranetIp(_ctx.stringValue("DescribePropertyPortDetailResponse.Propertys[" + i + "].IntranetIp"));<NEW_LINE>propertyPort.setInternetIp(_ctx.stringValue("DescribePropertyPortDetailResponse.Propertys[" + i + "].InternetIp"));<NEW_LINE>propertys.add(propertyPort);<NEW_LINE>}<NEW_LINE>describePropertyPortDetailResponse.setPropertys(propertys);<NEW_LINE>return describePropertyPortDetailResponse;<NEW_LINE>} | ("DescribePropertyPortDetailResponse.Propertys[" + i + "].Create")); |
466,780 | public void itemPropertyChanged(Datasource.ItemPropertyChangeEvent<T> e) {<NEW_LINE>if (!"firstName".equals(e.getProperty()) && !"lastName".equals(e.getProperty()) && !"middleName".equals(e.getProperty())) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>String firstName = getFieldValue("firstName");<NEW_LINE>String lastName = getFieldValue("lastName");<NEW_LINE>String middleName = getFieldValue("middleName");<NEW_LINE>String displayedName;<NEW_LINE>try {<NEW_LINE>if (this.pattern == null) {<NEW_LINE>// todo rework with Config interface<NEW_LINE><MASK><NEW_LINE>if (StringUtils.isBlank(pattern))<NEW_LINE>pattern = DEFAULT_NAME_PATTERN;<NEW_LINE>}<NEW_LINE>if (isGeneratingDisplayName(pattern, firstName, lastName, middleName, e.getProperty(), e.getPrevValue())) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>displayedName = UserUtils.formatName(pattern, firstName, lastName, middleName);<NEW_LINE>} catch (ParseException pe) {<NEW_LINE>displayedName = "";<NEW_LINE>}<NEW_LINE>MetaProperty nameProperty = e.getItem().getMetaClass().getProperty("name");<NEW_LINE>if (nameProperty != null && nameProperty.getAnnotations().containsKey("length")) {<NEW_LINE>int length = (int) nameProperty.getAnnotations().get("length");<NEW_LINE>if (displayedName.length() > length) {<NEW_LINE>displayedName = "";<NEW_LINE>}<NEW_LINE>}<NEW_LINE>setFullName(displayedName);<NEW_LINE>} | pattern = AppContext.getProperty("cuba.user.fullNamePattern"); |
1,577,253 | private void insertTimerScheduler(HttpServletRequest request, TimerSchedulerEntity timerSchedulerEntity) throws GovernanceException {<NEW_LINE>try {<NEW_LINE>if (!this.checkProcessorExist(request)) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>this.setRuleDataBaseUrl(timerSchedulerEntity);<NEW_LINE>String url = new StringBuffer(this.getProcessorUrl()).append(ConstantProperties.TIMER_SCHEDULER_INSERT).toString();<NEW_LINE>String jsonString = JsonHelper.object2Json(timerSchedulerEntity);<NEW_LINE>Map map = JsonHelper.json2Object(jsonString, Map.class);<NEW_LINE>map.put("updatedTime", timerSchedulerEntity.getLastUpdate());<NEW_LINE>map.put("createdTime", timerSchedulerEntity.getCreateDate());<NEW_LINE>// updateCEPRuleById<NEW_LINE>log.info("insert timerScheduler ====map:{}", JsonHelper.object2Json(map));<NEW_LINE>CloseableHttpResponse closeResponse = commonService.getCloseResponse(request, url, JsonHelper.object2Json(map));<NEW_LINE>String updateMes = EntityUtils.toString(closeResponse.getEntity());<NEW_LINE>log.info("insert timerScheduler ====result:{}", updateMes);<NEW_LINE>// deal processor result<NEW_LINE>int statusCode = closeResponse.getStatusLine().getStatusCode();<NEW_LINE>if (200 != statusCode) {<NEW_LINE>throw new GovernanceException(ErrorCode.PROCESS_CONNECT_ERROR);<NEW_LINE>}<NEW_LINE>Map jsonObject = JsonHelper.<MASK><NEW_LINE>Integer code = Integer.valueOf(jsonObject.get("errorCode").toString());<NEW_LINE>if (PROCESSOR_SUCCESS_CODE != code) {<NEW_LINE>String msg = jsonObject.get("errorMsg").toString();<NEW_LINE>throw new GovernanceException(msg);<NEW_LINE>}<NEW_LINE>} catch (Exception e) {<NEW_LINE>log.error("processor insert timerScheduler fail", e);<NEW_LINE>throw new GovernanceException("processor insert timerScheduler fail", e);<NEW_LINE>}<NEW_LINE>} | json2Object(updateMes, Map.class); |
1,263,552 | protected void write(ClassWriter classWriter, MethodWriter methodWriter, WriteScope writeScope) {<NEW_LINE>methodWriter.writeStatementOffset(getLocation());<NEW_LINE>Variable variable = writeScope.defineVariable(variableType, variableName);<NEW_LINE>Variable array = writeScope.defineInternalVariable(arrayType, arrayName);<NEW_LINE>Variable index = writeScope.defineInternalVariable(indexType, indexName);<NEW_LINE>getConditionNode().write(classWriter, methodWriter, writeScope);<NEW_LINE>methodWriter.visitVarInsn(array.getAsmType().getOpcode(Opcodes.ISTORE), array.getSlot());<NEW_LINE>methodWriter.push(-1);<NEW_LINE>methodWriter.visitVarInsn(index.getAsmType().getOpcode(Opcodes.ISTORE), index.getSlot());<NEW_LINE>Label begin = new Label();<NEW_LINE>Label end = new Label();<NEW_LINE>methodWriter.mark(begin);<NEW_LINE>methodWriter.visitIincInsn(index.getSlot(), 1);<NEW_LINE>methodWriter.visitVarInsn(index.getAsmType().getOpcode(Opcodes.ILOAD), index.getSlot());<NEW_LINE>methodWriter.visitVarInsn(array.getAsmType().getOpcode(Opcodes.ILOAD), array.getSlot());<NEW_LINE>methodWriter.arrayLength();<NEW_LINE>methodWriter.ifICmp(MethodWriter.GE, end);<NEW_LINE>methodWriter.visitVarInsn(array.getAsmType().getOpcode(Opcodes.ILOAD), array.getSlot());<NEW_LINE>methodWriter.visitVarInsn(index.getAsmType().getOpcode(Opcodes.ILOAD<MASK><NEW_LINE>methodWriter.arrayLoad(MethodWriter.getType(indexedType));<NEW_LINE>methodWriter.writeCast(cast);<NEW_LINE>methodWriter.visitVarInsn(variable.getAsmType().getOpcode(Opcodes.ISTORE), variable.getSlot());<NEW_LINE>Variable loop = writeScope.getInternalVariable("loop");<NEW_LINE>if (loop != null) {<NEW_LINE>methodWriter.writeLoopCounter(loop.getSlot(), getLocation());<NEW_LINE>}<NEW_LINE>getBlockNode().continueLabel = begin;<NEW_LINE>getBlockNode().breakLabel = end;<NEW_LINE>getBlockNode().write(classWriter, methodWriter, writeScope);<NEW_LINE>methodWriter.goTo(begin);<NEW_LINE>methodWriter.mark(end);<NEW_LINE>} | ), index.getSlot()); |
720,523 | private List<I_M_HU> performSplit0(@NonNull final IHUContext localHuContextCopy) {<NEW_LINE>//<NEW_LINE>// using thread-inherited to let this split key work in transaction and out of transaction<NEW_LINE>InterfaceWrapperHelper.setTrxName(huToSplit, ITrx.TRXNAME_ThreadInherited);<NEW_LINE>//<NEW_LINE>// Source: our handling unit<NEW_LINE>final IAllocationSource source = HUListAllocationSourceDestination.of(huToSplit);<NEW_LINE>final IAllocationRequest <MASK><NEW_LINE>//<NEW_LINE>// Perform allocation<NEW_LINE>HULoader.of(source, destination).setAllowPartialLoads(true).setAllowPartialUnloads(allowPartialUnloads).load(request);<NEW_LINE>// NOTE: we are not checking if everything was fully allocated because we can leave the remaining Qty into initial "huToSplit"<NEW_LINE>final List<I_M_HU> result;<NEW_LINE>final IHUProducerAllocationDestination huProducerAllocationDestination = destinationCastOrNull();<NEW_LINE>if (huProducerAllocationDestination != null) {<NEW_LINE>//<NEW_LINE>// Get created HUs in contextProvider's transaction<NEW_LINE>final List<I_M_HU> createdHUs = huProducerAllocationDestination.getCreatedHUs();<NEW_LINE>//<NEW_LINE>// Transfer PI Item Product from HU to split to all HUs that we created<NEW_LINE>setM_HU_PI_Item_Product(huToSplit, request.getProductId(), createdHUs);<NEW_LINE>//<NEW_LINE>// Assign createdHUs to documentLine<NEW_LINE>// NOTE: Even if IHUTrxListener implementations are already assigning HUs to documents,<NEW_LINE>// the top level HUs (i.e. LUs) are not assigned because only those HUs on which it were material transactions are detected<NEW_LINE>if (documentLine != null) {<NEW_LINE>documentLine.getHUAllocations().addAssignedHUs(createdHUs);<NEW_LINE>}<NEW_LINE>result = huProducerAllocationDestination.getCreatedHUs();<NEW_LINE>} else {<NEW_LINE>result = Collections.emptyList();<NEW_LINE>}<NEW_LINE>destroyIfEmptyStorage(localHuContextCopy);<NEW_LINE>return result;<NEW_LINE>} | request = requestProvider.apply(localHuContextCopy); |
1,433,767 | final GetActivityTaskResult executeGetActivityTask(GetActivityTaskRequest getActivityTaskRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(getActivityTaskRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<GetActivityTaskRequest> request = null;<NEW_LINE>Response<GetActivityTaskResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new GetActivityTaskRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(getActivityTaskRequest));<NEW_LINE>// Binds the request metrics to the current request.<NEW_LINE>request.setAWSRequestMetrics(awsRequestMetrics);<NEW_LINE>request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);<NEW_LINE>request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());<NEW_LINE>request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());<NEW_LINE>request.addHandlerContext(HandlerContextKey.SERVICE_ID, "SFN");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "GetActivityTask");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<GetActivityTaskResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(<MASK><NEW_LINE>response = invoke(request, responseHandler, executionContext);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>endClientExecution(awsRequestMetrics, request, response);<NEW_LINE>}<NEW_LINE>} | false), new GetActivityTaskResultJsonUnmarshaller()); |
972,610 | public void testXAOptionABMT() throws Exception {<NEW_LINE>String deliveryID = "MD_test3a";<NEW_LINE>prepareTRA();<NEW_LINE>// construct a FVTMessage<NEW_LINE>FVTMessage message = new FVTMessage();<NEW_LINE>message.addTestResult("BMTNonJMS", 31);<NEW_LINE>// Add a FVTXAResourceImpl for this delivery.<NEW_LINE>message.addXAResource("BMTNonJMS"<MASK><NEW_LINE>// Add a option A<NEW_LINE>Method m = MessageListener.class.getMethod("onStringMessage", new Class[] { String.class });<NEW_LINE>message.add("BMTNonJMS", "message1", m, 31);<NEW_LINE>message.add("BMTNonJMS", "message2", m, 31);<NEW_LINE>System.out.println(message.toString());<NEW_LINE>baseProvider.sendDirectMessage(deliveryID, message);<NEW_LINE>MessageEndpointTestResults results = baseProvider.getTestResult(deliveryID);<NEW_LINE>assertTrue("isDeliveryTransacted returns false for a method in a BMT MDB.", !results.isDeliveryTransacted());<NEW_LINE>assertTrue("Number of messages delivered is 2", results.getNumberOfMessagesDelivered() == 2);<NEW_LINE>assertTrue("Delivery option A is used for this test.", results.optionAMessageDeliveryUsed());<NEW_LINE>// assertTrue("This message delivery is in a local transaction context.", results.mdbInvokedInLocalTransactionContext());<NEW_LINE>assertFalse("The commit should not be driven on the XAResource provided by TRA.", results.raXaResourceCommitWasDriven());<NEW_LINE>assertFalse("The RA XAResource should not be enlisted in the global transaction.", results.raXaResourceEnlisted());<NEW_LINE>baseProvider.releaseDeliveryId(deliveryID);<NEW_LINE>} | , 31, new FVTXAResourceImpl()); |
1,379,819 | public InstanceStateChange unmarshall(StaxUnmarshallerContext context) throws Exception {<NEW_LINE>InstanceStateChange instanceStateChange = new InstanceStateChange();<NEW_LINE><MASK><NEW_LINE>int targetDepth = originalDepth + 1;<NEW_LINE>if (context.isStartOfDocument())<NEW_LINE>targetDepth += 1;<NEW_LINE>while (true) {<NEW_LINE>int xmlEvent = context.nextEvent();<NEW_LINE>if (xmlEvent == XmlPullParser.END_DOCUMENT)<NEW_LINE>return instanceStateChange;<NEW_LINE>if (xmlEvent == XmlPullParser.START_TAG) {<NEW_LINE>if (context.testExpression("instanceId", targetDepth)) {<NEW_LINE>instanceStateChange.setInstanceId(StringStaxUnmarshaller.getInstance().unmarshall(context));<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>if (context.testExpression("currentState", targetDepth)) {<NEW_LINE>instanceStateChange.setCurrentState(InstanceStateStaxUnmarshaller.getInstance().unmarshall(context));<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>if (context.testExpression("previousState", targetDepth)) {<NEW_LINE>instanceStateChange.setPreviousState(InstanceStateStaxUnmarshaller.getInstance().unmarshall(context));<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>} else if (xmlEvent == XmlPullParser.END_TAG) {<NEW_LINE>if (context.getCurrentDepth() < originalDepth) {<NEW_LINE>return instanceStateChange;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | int originalDepth = context.getCurrentDepth(); |
343,803 | public void update(RowBasedPartition partition, int factor, double[] scalars) {<NEW_LINE>double gamma = scalars[0];<NEW_LINE>double epsilon = scalars[1];<NEW_LINE>double beta = scalars[2];<NEW_LINE>double lr = scalars[3];<NEW_LINE>double regParam = scalars[4];<NEW_LINE>double epoch = scalars[5];<NEW_LINE>double batchSize = scalars[6];<NEW_LINE>if (epoch == 0) {<NEW_LINE>epoch = 1;<NEW_LINE>}<NEW_LINE>double powBeta = <MASK><NEW_LINE>double powGamma = Math.pow(gamma, epoch);<NEW_LINE>for (int f = 0; f < factor; f++) {<NEW_LINE>ServerRow gradientServerRow = partition.getRow(f + 3 * factor);<NEW_LINE>try {<NEW_LINE>gradientServerRow.startWrite();<NEW_LINE>Vector weight = ServerRowUtils.getVector(partition.getRow(f));<NEW_LINE>Vector velocity = ServerRowUtils.getVector(partition.getRow(f + factor));<NEW_LINE>Vector square = ServerRowUtils.getVector(partition.getRow(f + 2 * factor));<NEW_LINE>Vector gradient = ServerRowUtils.getVector(gradientServerRow);<NEW_LINE>if (batchSize > 1) {<NEW_LINE>gradient.idiv(batchSize);<NEW_LINE>}<NEW_LINE>if (regParam != 0.0) {<NEW_LINE>gradient.iaxpy(weight, regParam);<NEW_LINE>}<NEW_LINE>OptFuncs.iexpsmoothing(velocity, gradient, beta);<NEW_LINE>OptFuncs.iexpsmoothing2(square, gradient, gamma);<NEW_LINE>Vector delta = OptFuncs.adamdelta(velocity, square, powBeta, powGamma);<NEW_LINE>weight.iaxpy(delta, -lr);<NEW_LINE>gradient.clear();<NEW_LINE>} finally {<NEW_LINE>gradientServerRow.endWrite();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | Math.pow(beta, epoch); |
1,483,712 | public static BooleanExpression isFilePresentForSelectedEntry(StateManager stateManager, PreferencesService preferencesService) {<NEW_LINE>ObservableList<BibEntry> selectedEntries = stateManager.getSelectedEntries();<NEW_LINE>Binding<Boolean> fileIsPresent = EasyBind.valueAt(selectedEntries, 0).map(entry -> {<NEW_LINE>List<LinkedFile> files = entry.getFiles();<NEW_LINE>if ((entry.getFiles().size() > 0) && stateManager.getActiveDatabase().isPresent()) {<NEW_LINE>if (files.get(0).isOnlineLink()) {<NEW_LINE>return true;<NEW_LINE>}<NEW_LINE>Optional<Path> filename = FileHelper.find(stateManager.getActiveDatabase().get(), files.get(0).getLink(<MASK><NEW_LINE>return filename.isPresent();<NEW_LINE>} else {<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>}).orElse(false);<NEW_LINE>return BooleanExpression.booleanExpression(fileIsPresent);<NEW_LINE>} | ), preferencesService.getFilePreferences()); |
940,643 | public boolean isAvailable(boolean forceCheck, boolean notifyUI) {<NEW_LINE>synchronized (this) {<NEW_LINE>if (!gotVersion) {<NEW_LINE>// version has not been scanned yet, run the version command<NEW_LINE>// NOI18N<NEW_LINE>LOG.log(Level.FINE, "Call to hg version not finished");<NEW_LINE>if (forceCheck) {<NEW_LINE>if (LOG.isLoggable(Level.FINEST)) {<NEW_LINE>// NOI18N<NEW_LINE>LOG.log(Level.FINEST, "isAvailable performed", new Exception());<NEW_LINE>}<NEW_LINE>checkVersionIntern();<NEW_LINE>} else {<NEW_LINE>return true;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (version != null && !goodVersion) {<NEW_LINE>// hg is present but it's version is unsupported<NEW_LINE>// a warning message is printed into log, always only once per netbeans session<NEW_LINE>OutputLogger logger = getLogger(Mercurial.MERCURIAL_OUTPUT_TAB_TITLE);<NEW_LINE>// NOI18N);<NEW_LINE>logger.outputInRed(NbBundle.getMessage(Mercurial.class, "MSG_USING_UNRECOGNIZED_VERSION_MSG", version));<NEW_LINE>logger.closeLog();<NEW_LINE>// NOI18N<NEW_LINE>LOG.log(<MASK><NEW_LINE>// do not show the warning next time<NEW_LINE>goodVersion = true;<NEW_LINE>} else if (version == null) {<NEW_LINE>// hg is not present at all, show a warning dialog<NEW_LINE>if (notifyUI) {<NEW_LINE>OutputLogger logger = getLogger(Mercurial.MERCURIAL_OUTPUT_TAB_TITLE);<NEW_LINE>// NOI18N);<NEW_LINE>logger.outputInRed(NbBundle.getMessage(Mercurial.class, "MSG_VERSION_NONE_OUTPUT_MSG"));<NEW_LINE>// NOI18N<NEW_LINE>HgUtils.warningDialog(Mercurial.class, "MSG_VERSION_NONE_TITLE", "MSG_VERSION_NONE_MSG");<NEW_LINE>logger.closeLog();<NEW_LINE>// NOI18N<NEW_LINE>LOG.warning("Hg is not available");<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// true if hg is present<NEW_LINE>return goodVersion;<NEW_LINE>} | Level.WARNING, "Using an unsupported hg version: {0}", version); |
1,572,080 | public String visitCompoundPredicate(CompoundPredicateOperator predicate, Void context) {<NEW_LINE>if (CompoundPredicateOperator.CompoundType.NOT.equals(predicate.getCompoundType())) {<NEW_LINE>return "NOT " + print(predicate.getChild(0));<NEW_LINE>} else if (CompoundPredicateOperator.CompoundType.AND.equals(predicate.getCompoundType())) {<NEW_LINE>String leftPredicate;<NEW_LINE>if (predicate.getChild(0) instanceof CompoundPredicateOperator && ((CompoundPredicateOperator) predicate.getChild(0)).getCompoundType().equals(CompoundPredicateOperator.CompoundType.OR)) {<NEW_LINE>leftPredicate = "(" + print(predicate.getChild(0)) + ")";<NEW_LINE>} else {<NEW_LINE>leftPredicate = print(predicate.getChild(0));<NEW_LINE>}<NEW_LINE>String rightPredicate;<NEW_LINE>if (predicate.getChild(1) instanceof CompoundPredicateOperator && ((CompoundPredicateOperator) predicate.getChild(1)).getCompoundType().equals(CompoundPredicateOperator.CompoundType.OR)) {<NEW_LINE>rightPredicate = "(" + print(predicate.getChild(1)) + ")";<NEW_LINE>} else {<NEW_LINE>rightPredicate = print<MASK><NEW_LINE>}<NEW_LINE>return leftPredicate + " " + predicate.getCompoundType().toString() + " " + rightPredicate;<NEW_LINE>} else {<NEW_LINE>return print(predicate.getChild(0)) + " " + predicate.getCompoundType().toString() + " " + print(predicate.getChild(1));<NEW_LINE>}<NEW_LINE>} | (predicate.getChild(1)); |
341,981 | private void init(long transferBlockSize) {<NEW_LINE>List<TorrentFile> files = torrent.getFiles();<NEW_LINE>long totalSize = torrent.getSize();<NEW_LINE><MASK><NEW_LINE>transferBlockSize = Math.min(transferBlockSize, chunkSize);<NEW_LINE>int chunksTotal = PieceUtils.calculateNumberOfChunks(totalSize, chunkSize);<NEW_LINE>List<List<TorrentFile>> pieceNumToFile = new ArrayList<>(chunksTotal);<NEW_LINE>final Map<StorageUnit, TorrentFile> storageUnitsToFilesMap = buildStorageUnitToFilesMap(files);<NEW_LINE>// filter out empty files (and create them at once)<NEW_LINE>List<StorageUnit> nonEmptyStorageUnits = handleEmptyStorageUnits(storageUnitsToFilesMap);<NEW_LINE>List<ChunkDescriptor> chunks = PieceUtils.buildChunkDescriptors(torrent, transferBlockSize, totalSize, chunkSize, chunksTotal, pieceNumToFile, storageUnitsToFilesMap, nonEmptyStorageUnits);<NEW_LINE>List<List<CompletableTorrentFile>> countdownTorrentFiles = createListOfCountdownFiles(torrent.getFiles(), pieceNumToFile);<NEW_LINE>this.bitfield = buildBitfield(chunks, countdownTorrentFiles);<NEW_LINE>this.chunkDescriptors = chunks;<NEW_LINE>this.storageUnits = nonEmptyStorageUnits;<NEW_LINE>this.filesForPieces = pieceNumToFile;<NEW_LINE>} | long chunkSize = torrent.getChunkSize(); |
783,322 | public static NavTreeSettings readFromRequest(final PwmRequest pwmRequest) throws PwmUnrecoverableException, IOException {<NEW_LINE>final Map<String, Object> inputParameters = pwmRequest.readBodyAsJsonMap(PwmHttpRequestWrapper.Flag.BypassValidation);<NEW_LINE>final boolean modifiedSettingsOnly = (<MASK><NEW_LINE>final int level = (int) ((double) inputParameters.get("level"));<NEW_LINE>final String filterText = (String) inputParameters.get("text");<NEW_LINE>final DomainStateReader domainStateReader = DomainStateReader.forRequest(pwmRequest);<NEW_LINE>final boolean manageHttps = pwmRequest.getPwmApplication().getPwmEnvironment().getFlags().contains(PwmEnvironment.ApplicationFlag.ManageHttps);<NEW_LINE>return NavTreeSettings.builder().modifiedSettingsOnly(modifiedSettingsOnly).domainManageMode(domainStateReader.getMode()).mangeHttps(manageHttps).level(level).filterText(filterText).locale(pwmRequest.getLocale()).build();<NEW_LINE>} | boolean) inputParameters.get("modifiedSettingsOnly"); |
208,918 | private void populateWritersFromMultiplexParams() {<NEW_LINE>final TabbedTextFileWithHeaderParser libraryParamsParser = new TabbedTextFileWithHeaderParser(MULTIPLEX_PARAMS);<NEW_LINE>final Set<String> <MASK><NEW_LINE>final List<String> sampleBarcodeColumnLabels = new ArrayList<>();<NEW_LINE>for (int i = 1; i <= inputReadStructure.sampleBarcodes.length(); i++) {<NEW_LINE>sampleBarcodeColumnLabels.add("BARCODE_" + i);<NEW_LINE>}<NEW_LINE>expectedColumnLabels.addAll(sampleBarcodeColumnLabels);<NEW_LINE>assertExpectedColumns(libraryParamsParser.columnLabels(), expectedColumnLabels);<NEW_LINE>final List<TabbedTextFileWithHeaderParser.Row> rows = libraryParamsParser.iterator().toList();<NEW_LINE>final Set<String> seenBarcodes = new HashSet<>();<NEW_LINE>for (final TabbedTextFileWithHeaderParser.Row row : rows) {<NEW_LINE>List<String> sampleBarcodeValues = null;<NEW_LINE>if (!sampleBarcodeColumnLabels.isEmpty()) {<NEW_LINE>sampleBarcodeValues = new ArrayList<>();<NEW_LINE>for (final String sampleBarcodeLabel : sampleBarcodeColumnLabels) {<NEW_LINE>sampleBarcodeValues.add(row.getField(sampleBarcodeLabel));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>final String key = (sampleBarcodeValues == null || sampleBarcodeValues.contains("N")) ? null : StringUtil.join("", sampleBarcodeValues);<NEW_LINE>if (seenBarcodes.contains(key)) {<NEW_LINE>// This will catch the case of having more than 1 line in a non-barcoded MULTIPLEX_PARAMS file<NEW_LINE>throw new PicardException("Row for barcode " + key + " appears more than once in MULTIPLEX_PARAMS file " + MULTIPLEX_PARAMS);<NEW_LINE>} else {<NEW_LINE>seenBarcodes.add(key);<NEW_LINE>}<NEW_LINE>sampleBarcodeClusterWriterMap.put(key, buildWriter(new File(row.getField("OUTPUT_PREFIX")), rows.size()));<NEW_LINE>}<NEW_LINE>if (seenBarcodes.isEmpty()) {<NEW_LINE>throw new PicardException("MULTIPLEX_PARAMS file " + MULTIPLEX_PARAMS + " does have any data rows.");<NEW_LINE>}<NEW_LINE>libraryParamsParser.close();<NEW_LINE>} | expectedColumnLabels = CollectionUtil.makeSet("OUTPUT_PREFIX"); |
911,938 | public boolean apply(Game game, Ability source) {<NEW_LINE>MageObject sourceObject = source.getSourceObject(game);<NEW_LINE>if (sourceObject != null) {<NEW_LINE>DiscardTargetCost cost = new DiscardTargetCost(new TargetCardInHand(3, 3, new FilterCard()));<NEW_LINE>for (UUID playerId : game.getState().getPlayerList(source.getControllerId())) {<NEW_LINE>Player player = game.getPlayer(playerId);<NEW_LINE>cost.clearPaid();<NEW_LINE>if (player != null && cost.canPay(source, source, player.getId(), game) && player.chooseUse(outcome, "Discard three cards to counter " + sourceObject.getIdName() + '?', source, game)) {<NEW_LINE>if (cost.pay(source, game, source, playerId, false, null)) {<NEW_LINE>game.informPlayers(player.getLogName() + " discards 3 cards to counter " + sourceObject.getIdName() + '.');<NEW_LINE>Spell spell = game.getStack().<MASK><NEW_LINE>if (spell != null) {<NEW_LINE>game.getStack().counter(spell.getId(), source, game);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return true;<NEW_LINE>}<NEW_LINE>return false;<NEW_LINE>} | getSpell(source.getSourceId()); |
1,652,476 | public void run(RegressionEnvironment env) {<NEW_LINE>String epl = "@name('s0') select intPrimitive, s1.* as s1stream, theString, symbol as sym, s0.* as s0stream from SupportBean#length(3) as s0, " + "SupportMarketDataBean#keepall as s1";<NEW_LINE>env.compileDeploy(epl).addListener("s0");<NEW_LINE>env.assertStatement("s0", statement -> {<NEW_LINE>EventType type = statement.getEventType();<NEW_LINE>assertEquals(5, type.getPropertyNames().length);<NEW_LINE>assertEquals(Integer.class, type.getPropertyType("intPrimitive"));<NEW_LINE>assertEquals(SupportMarketDataBean.class, type.getPropertyType("s1stream"));<NEW_LINE>assertEquals(SupportBean.class, type.getPropertyType("s0stream"));<NEW_LINE>assertEquals(String.class, type.getPropertyType("sym"));<NEW_LINE>assertEquals(String.class, type.getPropertyType("theString"));<NEW_LINE>assertEquals(Map.class, type.getUnderlyingType());<NEW_LINE>});<NEW_LINE>Object eventOne = sendBeanEvent(env, "E1", 13);<NEW_LINE>env.assertListenerNotInvoked("s0");<NEW_LINE>Object eventTwo = sendMarketEvent(env, "E2");<NEW_LINE>String[] fields = new String[] { "intPrimitive", "sym", "theString", "s0stream", "s1stream" };<NEW_LINE>env.assertEventNew("s0", event -> {<NEW_LINE>EPAssertionUtil.assertProps(event, fields, new Object[] { 13, "E2", "E1", eventOne, eventTwo });<NEW_LINE>EventBean theEvent = (EventBean) ((Map) event.getUnderlying<MASK><NEW_LINE>assertSame(eventOne, theEvent.getUnderlying());<NEW_LINE>});<NEW_LINE>env.undeployAll();<NEW_LINE>} | ()).get("s0stream"); |
1,800,470 | public void accept(PurchaseOrderSupplierLine purchaseOrderSupplierLine) throws AxelorException {<NEW_LINE>PurchaseOrderLine purchaseOrderLine = purchaseOrderSupplierLine.getPurchaseOrderLine();<NEW_LINE>purchaseOrderLine.setEstimatedDelivDate(purchaseOrderSupplierLine.getEstimatedDelivDate());<NEW_LINE>Partner supplierPartner = purchaseOrderSupplierLine.getSupplierPartner();<NEW_LINE>Company company = purchaseOrderLine.getPurchaseOrder().getCompany();<NEW_LINE>if (Beans.get(BlockingService.class).getBlocking(supplierPartner, company, BlockingRepository.PURCHASE_BLOCKING) != null) {<NEW_LINE>throw new AxelorException(TraceBackRepository.CATEGORY_INCONSISTENCY, I18n.get<MASK><NEW_LINE>}<NEW_LINE>purchaseOrderLine.setSupplierPartner(supplierPartner);<NEW_LINE>purchaseOrderLine.setPrice(purchaseOrderSupplierLine.getPrice());<NEW_LINE>purchaseOrderLine.setExTaxTotal(PurchaseOrderLineServiceImpl.computeAmount(purchaseOrderLine.getQty(), purchaseOrderLine.getPrice()));<NEW_LINE>purchaseOrderSupplierLine.setStateSelect(PurchaseOrderSupplierLineRepository.STATE_ACCEPTED);<NEW_LINE>poSupplierLineRepo.save(purchaseOrderSupplierLine);<NEW_LINE>} | (IExceptionMessage.SUPPLIER_BLOCKED), supplierPartner); |
837,409 | public int compareTo(@Nonnull StdArrangementMatchRule o) {<NEW_LINE>final Set<ArrangementSettingsToken> tokens = ArrangementUtil.extractTokens(getMatcher().getCondition()).keySet();<NEW_LINE>final Set<ArrangementSettingsToken> tokens1 = ArrangementUtil.extractTokens(o.getMatcher().getCondition()).keySet();<NEW_LINE>if (tokens1.containsAll(tokens)) {<NEW_LINE>return tokens.containsAll(tokens1) ? 0 : 1;<NEW_LINE>} else {<NEW_LINE>if (tokens.containsAll(tokens1)) {<NEW_LINE>return -1;<NEW_LINE>}<NEW_LINE>final String entryType = getEntryType(tokens);<NEW_LINE><MASK><NEW_LINE>final int compare = StringUtil.compare(entryType, entryType1, false);<NEW_LINE>if (compare != 0 || tokens.size() == tokens1.size()) {<NEW_LINE>return compare;<NEW_LINE>}<NEW_LINE>return tokens.size() < tokens1.size() ? 1 : -1;<NEW_LINE>}<NEW_LINE>} | final String entryType1 = getEntryType(tokens1); |
1,718,665 | public String executeRun() {<NEW_LINE>Timestamp dateDoc = getDateNextRun();<NEW_LINE>if (!calculateRuns()) {<NEW_LINE>throw new IllegalStateException("No Runs Left");<NEW_LINE>}<NEW_LINE>// log<NEW_LINE>MRecurringRun run = new MRecurringRun(getCtx(), this);<NEW_LINE>String msg = "@Created@ ";<NEW_LINE>// Copy<NEW_LINE>if (getRecurringType().equals(MRecurring.RECURRINGTYPE_Order)) {<NEW_LINE>MOrder from = new MOrder(getCtx(), getC_Order_ID(), get_TrxName());<NEW_LINE>final boolean counter = false;<NEW_LINE>final boolean copyASI = false;<NEW_LINE>MOrder order = copyOrderFrom(from, from.getAD_Org(), dateDoc, from.getC_DocType_ID(), from.isSOTrx(), counter, copyASI, get_TrxName());<NEW_LINE>run.setC_Order_ID(order.getC_Order_ID());<NEW_LINE>msg += order.getDocumentNo();<NEW_LINE>} else if (getRecurringType().equals(MRecurring.RECURRINGTYPE_Invoice)) {<NEW_LINE>MInvoice from = new MInvoice(getCtx(), getC_Invoice_ID(), get_TrxName());<NEW_LINE>MInvoice invoice = MInvoice.copyFrom(from, dateDoc, dateDoc, from.getC_DocType_ID(), from.isSOTrx(), <MASK><NEW_LINE>run.setC_Invoice_ID(invoice.getC_Invoice_ID());<NEW_LINE>msg += invoice.getDocumentNo();<NEW_LINE>} else if (getRecurringType().equals(MRecurring.RECURRINGTYPE_Project)) {<NEW_LINE>MProject project = MProject.copyFrom(getCtx(), getC_Project_ID(), dateDoc, get_TrxName());<NEW_LINE>run.setC_Project_ID(project.getC_Project_ID());<NEW_LINE>msg += project.getValue();<NEW_LINE>} else // metas-tsa: commented out because<NEW_LINE>// * we moved MJournalBatch to de.metas.acct<NEW_LINE>// * we are not using this functionality at all<NEW_LINE>// else if (getRecurringType().equals(MRecurring.RECURRINGTYPE_GLJournal))<NEW_LINE>// {<NEW_LINE>// MJournalBatch journal = MJournalBatch.copyFrom (getCtx(), getGL_JournalBatch_ID(), dateDoc, get_TrxName());<NEW_LINE>// run.setGL_JournalBatch_ID(journal.getGL_JournalBatch_ID());<NEW_LINE>// msg += journal.getDocumentNo();<NEW_LINE>// }<NEW_LINE>{<NEW_LINE>return "Invalid @RecurringType@ = " + getRecurringType();<NEW_LINE>}<NEW_LINE>run.save(get_TrxName());<NEW_LINE>//<NEW_LINE>setDateLastRun(run.getUpdated());<NEW_LINE>setRunsRemaining(getRunsRemaining() - 1);<NEW_LINE>setDateNextRun();<NEW_LINE>save(get_TrxName());<NEW_LINE>return msg;<NEW_LINE>} | false, get_TrxName(), false); |
643,588 | public KvMetadata resolveMetadata(boolean isKey, List<MappingField> resolvedFields, Map<String, String> options, InternalSerializationService serializationService) {<NEW_LINE>Map<QueryPath, MappingField> fieldsByPath = extractFields(resolvedFields, isKey);<NEW_LINE>String typeNameProperty = isKey ? OPTION_KEY_COMPACT_TYPE_NAME : OPTION_VALUE_COMPACT_TYPE_NAME;<NEW_LINE>String typeName = options.get(typeNameProperty);<NEW_LINE>List<TableField> fields = new ArrayList<<MASK><NEW_LINE>for (Entry<QueryPath, MappingField> entry : fieldsByPath.entrySet()) {<NEW_LINE>QueryPath path = entry.getKey();<NEW_LINE>QueryDataType type = entry.getValue().type();<NEW_LINE>String name = entry.getValue().name();<NEW_LINE>fields.add(new MapTableField(name, type, false, path));<NEW_LINE>}<NEW_LINE>maybeAddDefaultField(isKey, resolvedFields, fields, QueryDataType.OBJECT);<NEW_LINE>Schema schema = resolveSchema(typeName, fieldsByPath);<NEW_LINE>return new KvMetadata(fields, GenericQueryTargetDescriptor.DEFAULT, new CompactUpsertTargetDescriptor(schema));<NEW_LINE>} | >(fieldsByPath.size()); |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.