instruction
string
input
string
output
string
source_file
string
priority
int64
请完成以下Java代码
public class AppEngineImpl implements AppEngine { private static final Logger LOGGER = LoggerFactory.getLogger(AppEngineImpl.class); protected String name; protected AppEngineConfiguration appEngineConfiguration; protected AppManagementService appManagementService; protected AppRepositoryService appRepositoryService; public AppEngineImpl(AppEngineConfiguration appEngineConfiguration) { this.appEngineConfiguration = appEngineConfiguration; this.name = appEngineConfiguration.getEngineName(); this.appManagementService = appEngineConfiguration.getAppManagementService(); this.appRepositoryService = appEngineConfiguration.getAppRepositoryService(); if (appEngineConfiguration.getSchemaManagementCmd() != null) { CommandExecutor commandExecutor = appEngineConfiguration.getCommandExecutor(); commandExecutor.execute(appEngineConfiguration.getSchemaCommandConfig(), appEngineConfiguration.getSchemaManagementCmd()); } LOGGER.info("AppEngine {} created", name); AppEngines.registerAppEngine(this); } @Override public String getName() { return name; } public void setName(String name) { this.name = name; } @Override public void close() { AppEngines.unregister(this); appEngineConfiguration.close(); if (appEngineConfiguration.getEngineLifecycleListeners() != null) { for (EngineLifecycleListener engineLifecycleListener : appEngineConfiguration.getEngineLifecycleListeners()) { engineLifecycleListener.onEngineClosed(this); }
} } @Override public AppEngineConfiguration getAppEngineConfiguration() { return appEngineConfiguration; } public void setAppEngineConfiguration(AppEngineConfiguration appEngineConfiguration) { this.appEngineConfiguration = appEngineConfiguration; } @Override public AppManagementService getAppManagementService() { return appManagementService; } public void setAppManagementService(AppManagementService appManagementService) { this.appManagementService = appManagementService; } @Override public AppRepositoryService getAppRepositoryService() { return appRepositoryService; } public void setAppRepositoryService(AppRepositoryService appRepositoryService) { this.appRepositoryService = appRepositoryService; } }
repos\flowable-engine-main\modules\flowable-app-engine\src\main\java\org\flowable\app\engine\impl\AppEngineImpl.java
1
请完成以下Java代码
public IDunningCandidateProducer getDunningCandidateProducer(final IDunnableDoc sourceDoc) { Check.assume(sourceDoc != null, "sourceDoc is not null"); IDunningCandidateProducer selectedProducer = null; for (final IDunningCandidateProducer producer : producers) { if (!producer.isHandled(sourceDoc)) { continue; } if (selectedProducer != null) { throw new DunningException("Multiple producers found for " + sourceDoc + ": " + selectedProducer + ", " + producer); } selectedProducer = producer;
} if (selectedProducer == null) { throw new DunningException("No " + IDunningCandidateProducer.class + " found for " + sourceDoc); } return selectedProducer; } @Override public String toString() { return "DefaultDunningCandidateProducerFactory [producerClasses=" + producerClasses + ", producers=" + producers + "]"; } }
repos\metasfresh-new_dawn_uat\backend\de.metas.dunning\src\main\java\de\metas\dunning\api\impl\DefaultDunningCandidateProducerFactory.java
1
请完成以下Java代码
public int getC_AcctSchema_ID () { Integer ii = (Integer)get_Value(COLUMNNAME_C_AcctSchema_ID); if (ii == null) return 0; return ii.intValue(); } public I_C_Period getC_Period() throws RuntimeException { return (I_C_Period)MTable.get(getCtx(), I_C_Period.Table_Name) .getPO(getC_Period_ID(), get_TrxName()); } /** Set Period. @param C_Period_ID Period of the Calendar */ public void setC_Period_ID (int C_Period_ID) { if (C_Period_ID < 1) set_Value (COLUMNNAME_C_Period_ID, null); else set_Value (COLUMNNAME_C_Period_ID, Integer.valueOf(C_Period_ID)); } /** Get Period. @return Period of the Calendar */ public int getC_Period_ID () { Integer ii = (Integer)get_Value(COLUMNNAME_C_Period_ID); if (ii == null) return 0; return ii.intValue(); } /** Set Account Date. @param DateAcct Accounting Date */ public void setDateAcct (Timestamp DateAcct) { set_Value (COLUMNNAME_DateAcct, DateAcct); } /** Get Account Date. @return Accounting Date */ public Timestamp getDateAcct () { return (Timestamp)get_Value(COLUMNNAME_DateAcct); } /** PostingType AD_Reference_ID=125 */ public static final int POSTINGTYPE_AD_Reference_ID=125; /** Actual = A */ public static final String POSTINGTYPE_Actual = "A"; /** Budget = B */ public static final String POSTINGTYPE_Budget = "B"; /** Commitment = E */ public static final String POSTINGTYPE_Commitment = "E"; /** Statistical = S */ public static final String POSTINGTYPE_Statistical = "S"; /** Reservation = R */ public static final String POSTINGTYPE_Reservation = "R"; /** Set PostingType. @param PostingType The type of posted amount for the transaction */ public void setPostingType (String PostingType) { set_Value (COLUMNNAME_PostingType, PostingType); } /** Get PostingType. @return The type of posted amount for the transaction */ public String getPostingType () { return (String)get_Value(COLUMNNAME_PostingType); }
/** Set Processed. @param Processed The document has been processed */ public void setProcessed (boolean Processed) { set_Value (COLUMNNAME_Processed, Boolean.valueOf(Processed)); } /** Get Processed. @return The document has been processed */ public boolean isProcessed () { Object oo = get_Value(COLUMNNAME_Processed); if (oo != null) { if (oo instanceof Boolean) return ((Boolean)oo).booleanValue(); return "Y".equals(oo); } return false; } /** Set Process Now. @param Processing Process Now */ public void setProcessing (boolean Processing) { set_Value (COLUMNNAME_Processing, Boolean.valueOf(Processing)); } /** Get Process Now. @return Process Now */ public boolean isProcessing () { Object oo = get_Value(COLUMNNAME_Processing); if (oo != null) { if (oo instanceof Boolean) return ((Boolean)oo).booleanValue(); return "Y".equals(oo); } return false; } }
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_A_Asset_Transfer.java
1
请完成以下Java代码
public int getRecord_ID () { Integer ii = (Integer)get_Value(COLUMNNAME_Record_ID); if (ii == null) return 0; return ii.intValue(); } /** Set V_Date. @param V_Date V_Date */ public void setV_Date (Timestamp V_Date) { set_Value (COLUMNNAME_V_Date, V_Date); } /** Get V_Date. @return V_Date */ public Timestamp getV_Date () { return (Timestamp)get_Value(COLUMNNAME_V_Date); } /** Set V_Number. @param V_Number V_Number */ public void setV_Number (String V_Number) { set_Value (COLUMNNAME_V_Number, V_Number); } /** Get V_Number. @return V_Number */ public String getV_Number () { return (String)get_Value(COLUMNNAME_V_Number); }
/** Set V_String. @param V_String V_String */ public void setV_String (String V_String) { set_Value (COLUMNNAME_V_String, V_String); } /** Get V_String. @return V_String */ public String getV_String () { return (String)get_Value(COLUMNNAME_V_String); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_AD_Attribute_Value.java
1
请在Spring Boot框架中完成以下Java代码
public class UserRegistrationController { @Autowired private UserService userService; @ModelAttribute("user") public UserRegistrationDto userRegistrationDto(){ return new UserRegistrationDto(); } @GetMapping public String showRegistrationForm(Model model){ return "registration"; } @PostMapping
public String registerUserAccount(@ModelAttribute("user") @Valid UserRegistrationDto userDto, BindingResult result) { User existing = userService.findByEmail(userDto.getEmail()); if (existing != null){ result.rejectValue("email", null, "There is already an account registered with that email"); } if (result.hasErrors()){ return "registration"; } userService.save(userDto); return "redirect:/registration?success"; } }
repos\Spring-Boot-Advanced-Projects-main\Springboot-Registration-Page\src\main\java\aspera\registration\web\UserRegistrationController.java
2
请在Spring Boot框架中完成以下Java代码
public class ClientRestController { private static final String RESOURCE_URI = "http://localhost:8082/spring-security-oauth-resource/foos/1"; @Autowired WebClient webClient; @GetMapping("/auth-code") Mono<String> useOauthWithAuthCode() { Mono<String> retrievedResource = webClient.get() .uri(RESOURCE_URI) .retrieve() .bodyToMono(String.class); return retrievedResource.map(string -> "We retrieved the following resource using Oauth: " + string); } @GetMapping("/auth-code-annotated") Mono<String> useOauthWithAuthCodeAndAnnotation(@RegisteredOAuth2AuthorizedClient("bael") OAuth2AuthorizedClient authorizedClient) { Mono<String> retrievedResource = webClient.get() .uri(RESOURCE_URI) .attributes(oauth2AuthorizedClient(authorizedClient))
.retrieve() .bodyToMono(String.class); return retrievedResource.map(string -> "We retrieved the following resource using Oauth: " + string + ". Principal associated: " + authorizedClient.getPrincipalName() + ". Token will expire at: " + authorizedClient.getAccessToken() .getExpiresAt()); } @GetMapping("/auth-code-explicit-client") Mono<String> useOauthWithExpicitClient() { Mono<String> retrievedResource = webClient.get() .uri(RESOURCE_URI) .attributes(clientRegistrationId("bael")) .retrieve() .bodyToMono(String.class); return retrievedResource.map(string -> "We retrieved the following resource using Oauth: " + string); } }
repos\tutorials-master\spring-reactive-modules\spring-reactive-oauth\src\main\java\com\baeldung\webclient\authorizationcodeclient\web\ClientRestController.java
2
请完成以下Java代码
protected final ImmutableList<I_M_HU> getSelectedHUs() { return streamSelectedHUs(Select.ONLY_TOPLEVEL).collect(ImmutableList.toImmutableList()); } @Override protected String doIt() { final LocatorId locatorId = getMoveToLocatorId(); final List<I_M_HU> hus = getSelectedHUs(); if (hus.isEmpty()) { throw new AdempiereException("@NoSelection@"); } checkHUsEligible().throwExceptionIfRejected();
movementResult = huMovementBL.moveHUsToLocator(hus, locatorId); return MSG_OK; } @Override protected void postProcess(final boolean success) { if (movementResult != null) { getView().invalidateAll(); } } public abstract ProcessPreconditionsResolution checkHUsEligible(); }
repos\metasfresh-new_dawn_uat\backend\de.metas.ui.web.base\src\main\java\de\metas\ui\web\handlingunits\process\WEBUI_M_HU_MoveToAnotherWarehouse_Template.java
1
请完成以下Java代码
public boolean equals(Object obj) { if (this == obj) { return true; } final QueryOrderByItem other = EqualsBuilder.getOther(this, obj); if (other == null) { return false; } return new EqualsBuilder() .append(this.columnName, other.columnName) .append(this.direction, other.direction) .isEqual(); } /** * @return the columnName
*/ public String getColumnName() { return columnName; } public Direction getDirection() { return direction; } public Nulls getNulls() { return nulls; } }
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\org\adempiere\ad\dao\impl\QueryOrderByItem.java
1
请完成以下Java代码
private String getClassPathIndexFileLocation(Archive archive) throws IOException { Manifest manifest = archive.getManifest(); Attributes attributes = (manifest != null) ? manifest.getMainAttributes() : null; String location = (attributes != null) ? attributes.getValue(BOOT_CLASSPATH_INDEX_ATTRIBUTE) : null; return (location != null) ? location : getEntryPathPrefix() + DEFAULT_CLASSPATH_INDEX_FILE_NAME; } /** * Return the archive being launched or {@code null} if there is no archive. * @return the launched archive */ protected abstract Archive getArchive(); /** * Returns the main class that should be launched. * @return the name of the main class * @throws Exception if the main class cannot be obtained */ protected abstract String getMainClass() throws Exception; /** * Returns the archives that will be used to construct the class path. * @return the class path archives * @throws Exception if the class path archives cannot be obtained */ protected abstract Set<URL> getClassPathUrls() throws Exception; /** * Return the path prefix for relevant entries in the archive. * @return the entry path prefix */ protected String getEntryPathPrefix() {
return "BOOT-INF/"; } /** * Determine if the specified entry is a nested item that should be added to the * classpath. * @param entry the entry to check * @return {@code true} if the entry is a nested item (jar or directory) */ protected boolean isIncludedOnClassPath(Archive.Entry entry) { return isLibraryFileOrClassesDirectory(entry); } protected boolean isLibraryFileOrClassesDirectory(Archive.Entry entry) { String name = entry.name(); if (entry.isDirectory()) { return name.equals("BOOT-INF/classes/"); } return name.startsWith("BOOT-INF/lib/"); } protected boolean isIncludedOnClassPathAndNotIndexed(Entry entry) { if (!isIncludedOnClassPath(entry)) { return false; } return (this.classPathIndex == null) || !this.classPathIndex.containsEntry(entry.name()); } }
repos\spring-boot-4.0.1\loader\spring-boot-loader\src\main\java\org\springframework\boot\loader\launch\Launcher.java
1
请完成以下Java代码
final protected EnumItem<E>[] loadValueArray(ByteArray byteArray) { if (byteArray == null) { return null; } E[] nrArray = values(); int size = byteArray.nextInt(); EnumItem<E>[] valueArray = new EnumItem[size]; for (int i = 0; i < size; ++i) { int currentSize = byteArray.nextInt(); EnumItem<E> item = newItem(); for (int j = 0; j < currentSize; ++j) { E nr = nrArray[byteArray.nextInt()]; int frequency = byteArray.nextInt(); item.labelMap.put(nr, frequency);
} valueArray[i] = item; } return valueArray; } @Override protected void saveValue(EnumItem<E> item, DataOutputStream out) throws IOException { out.writeInt(item.labelMap.size()); for (Map.Entry<E, Integer> entry : item.labelMap.entrySet()) { out.writeInt(entry.getKey().ordinal()); out.writeInt(entry.getValue()); } } }
repos\springboot-demo-master\hanlp\src\main\java\demo\hankcs\hanlp\dictionary\common\EnumItemDictionary.java
1
请在Spring Boot框架中完成以下Java代码
public List<RestVariable> getVariables() { return variables; } public void setVariables(List<RestVariable> variables) { this.variables = variables; } @JsonTypeInfo(use = Id.CLASS, defaultImpl = RestVariable.class) public List<RestVariable> getTransientVariables() { return transientVariables; } public void setTransientVariables(List<RestVariable> transientVariables) { this.transientVariables = transientVariables; } @JsonTypeInfo(use = Id.CLASS, defaultImpl = RestVariable.class) public List<RestVariable> getStartFormVariables() { return startFormVariables; } public void setStartFormVariables(List<RestVariable> startFormVariables) { this.startFormVariables = startFormVariables; } public String getOutcome() { return outcome; } public void setOutcome(String outcome) { this.outcome = outcome;
} @JsonIgnore public boolean isTenantSet() { return tenantId != null && !StringUtils.isEmpty(tenantId); } public boolean getReturnVariables() { return returnVariables; } public void setReturnVariables(boolean returnVariables) { this.returnVariables = returnVariables; } }
repos\flowable-engine-main\modules\flowable-cmmn-rest\src\main\java\org\flowable\cmmn\rest\service\api\runtime\caze\CaseInstanceCreateRequest.java
2
请完成以下Java代码
private static final class AttributeValuesMap { @Getter private final NamePair nullValue; private final ImmutableMap<String, NamePair> valuesByKey; private final ImmutableList<NamePair> valuesList; private final ImmutableMap<String, AttributeValueId> attributeValueIdByKey; private AttributeValuesMap(final Attribute attribute, final Collection<AttributeListValue> attributeValues) { final ImmutableMap.Builder<String, NamePair> valuesByKey = ImmutableMap.builder(); final ImmutableMap.Builder<String, AttributeValueId> attributeValueIdByKey = ImmutableMap.builder(); NamePair nullValue = null; for (final AttributeListValue av : attributeValues) { if (!av.isActive()) { continue; } final ValueNamePair vnp = toValueNamePair(av); valuesByKey.put(vnp.getValue(), vnp); attributeValueIdByKey.put(vnp.getValue(), av.getId()); // // Null placeholder value (if defined) if (av.isNullFieldValue()) { Check.assumeNull(nullValue, "Only one null value shall be defined for {}, but we found: {}, {}", attribute.getDisplayName().getDefaultValue(), nullValue, av); nullValue = vnp; } } this.valuesByKey = valuesByKey.build(); this.valuesList = ImmutableList.copyOf(this.valuesByKey.values()); this.attributeValueIdByKey = attributeValueIdByKey.build(); this.nullValue = nullValue; } @Override public String toString() { return MoreObjects.toStringHelper(this) .add("values", valuesList) .add("nullValue", nullValue)
.toString(); } public List<NamePair> getValues() { return valuesList; } public NamePair getValueByKeyOrNull(final String key) { return valuesByKey.get(key); } public AttributeValueId getAttributeValueId(final String valueKey) { final AttributeValueId attributeValueId = attributeValueIdByKey.get(valueKey); if (attributeValueId == null) { throw new AdempiereException("No M_AttributeValue_ID found for '" + valueKey + "'"); } return attributeValueId; } } }
repos\metasfresh-new_dawn_uat\backend\de.metas.business\src\main\java\org\adempiere\mm\attributes\spi\impl\DefaultAttributeValuesProvider.java
1
请完成以下Java代码
public String getFinauditer() { return finauditer; } public void setFinauditer(String finauditer) { this.finauditer = finauditer; } public String getFinaudittime() { return finaudittime; } public void setFinaudittime(String finaudittime) { this.finaudittime = finaudittime; } public String getEdittime() { return edittime; }
public void setEdittime(String edittime) { this.edittime = edittime; } public String getStartdate() { return startdate; } public void setStartdate(String startdate) { this.startdate = startdate; } public String getEnddate() { return enddate; } public void setEnddate(String enddate) { this.enddate = enddate; } }
repos\SpringBootBucket-master\springboot-batch\src\main\java\com\xncoding\trans\modules\vtoll\BudgetVtoll.java
1
请完成以下Java代码
public boolean genericTypeIsValid(final Class<?> clazz, final Type field) { if (field instanceof ParameterizedType) { final ParameterizedType parameterizedType = (ParameterizedType) field; final Type type = parameterizedType.getActualTypeArguments()[0]; return type.equals(clazz); } else { logger.warn(WARN_NON_GENERIC_VALUE); return true; } } public final Object getBeanInstance(final String beanName, final Class<?> genericClass, final Class<?> paramClass) { Object daoInstance = null; if (!configurableListableBeanFactory.containsBean(beanName)) { logger.info("Creating new DataAccess bean named '{}'.", beanName); Object toRegister = null; try { final Constructor<?> ctr = genericClass.getConstructor(Class.class); toRegister = ctr.newInstance(paramClass); } catch (final Exception e) {
logger.error(ERROR_CREATE_INSTANCE, genericClass.getTypeName(), e); throw new RuntimeException(e); } daoInstance = configurableListableBeanFactory.initializeBean(toRegister, beanName); configurableListableBeanFactory.autowireBeanProperties(daoInstance, AUTOWIRE_MODE, true); configurableListableBeanFactory.registerSingleton(beanName, daoInstance); logger.info("Bean named '{}' created successfully.", beanName); } else { daoInstance = configurableListableBeanFactory.getBean(beanName); logger.info("Bean named '{}' already exist used as current bean reference.", beanName); } return daoInstance; } }
repos\tutorials-master\persistence-modules\spring-data-jpa-annotations-2\src\main\java\com\baeldung\customannotation\DataAccessFieldCallback.java
1
请在Spring Boot框架中完成以下Java代码
public class StockController { @Autowired private StockService stockService; @RequestMapping(value = "stock", produces = MediaType.APPLICATION_JSON_UTF8_VALUE) public Object stock() { // 商品ID long commodityId = 1; // 库存ID String redisKey = "redis_key:stock:" + commodityId; long stock = stockService.stock(redisKey, 60 * 60, 2, () -> initStock(commodityId)); return stock >= 0; } /** * 获取初始的库存 * * @return */ private int initStock(long commodityId) { // TODO 这里做一些初始化库存的操作 return 1000; } @RequestMapping(value = "getStock", produces = MediaType.APPLICATION_JSON_UTF8_VALUE) public Object getStock() { // 商品ID long commodityId = 1; // 库存ID
String redisKey = "redis_key:stock:" + commodityId; return stockService.getStock(redisKey); } @RequestMapping(value = "addStock", produces = MediaType.APPLICATION_JSON_UTF8_VALUE) public Object addStock() { // 商品ID long commodityId = 2; // 库存ID String redisKey = "redis_key:stock:" + commodityId; return stockService.addStock(redisKey, 2); } }
repos\spring-boot-student-master\spring-boot-student-stock-redis\src\main\java\com\xiaolyuh\controller\StockController.java
2
请完成以下Java代码
public class EnsureUtil { private static final EnsureUtilLogger LOG = UtilsLogger.ENSURE_UTIL_LOGGER; /** * Ensures that the parameter is not null. * * @param parameterName the parameter name * @param value the value to ensure to be not null * @throws IllegalArgumentException if the parameter value is null */ public static void ensureNotNull(String parameterName, Object value) { if(value == null) { throw LOG.parameterIsNullException(parameterName); } } /**
* Ensure the object is of a given type and return the casted object * * @param objectName the name of the parameter * @param object the parameter value * @param type the expected type * @return the parameter casted to the requested type * @throws IllegalArgumentException in case object cannot be casted to type */ @SuppressWarnings("unchecked") public static <T> T ensureParamInstanceOf(String objectName, Object object, Class<T> type) { if(type.isAssignableFrom(object.getClass())) { return (T) object; } else { throw LOG.unsupportedParameterType(objectName, object, type); } } }
repos\camunda-bpm-platform-master\commons\utils\src\main\java\org\camunda\commons\utils\EnsureUtil.java
1
请在Spring Boot框架中完成以下Java代码
public CandidateSaveResult onCandidateNewOrChange( @NonNull final Candidate candidate, @NonNull final OnNewOrChangeAdvise advise) { candidate.validateNonStockCandidate(); final CandidateHandler candidateChangeHandler = getHandlerFor(candidate); return candidateChangeHandler.onCandidateNewOrChange(candidate, advise); } public void onCandidateDelete(@NonNull final Candidate candidate) { candidate.validateNonStockCandidate(); final CandidateHandler candidateChangeHandler = getHandlerFor(candidate); candidateChangeHandler.onCandidateDelete(candidate); } private CandidateHandler getHandlerFor(final Candidate candidate) { final CandidateHandler candidateChangeHandler = type2handler.get(candidate.getType()); if (candidateChangeHandler == null) { throw new AdempiereException("The given candidate has an unsupported type") .appendParametersToMessage() .setParameter("type", candidate.getType()) .setParameter("candidate", candidate); } return candidateChangeHandler; }
@VisibleForTesting static ImmutableMap<CandidateType, CandidateHandler> createMapOfHandlers(@NonNull final Collection<CandidateHandler> handlers) { final ImmutableMap.Builder<CandidateType, CandidateHandler> builder = ImmutableMap.builder(); for (final CandidateHandler handler : handlers) { if (handler.getHandeledTypes().isEmpty()) { logger.warn("Skip handler because no handled types provided: {}", handler); continue; } for (final CandidateType type : handler.getHandeledTypes()) { builder.put(type, handler); // builder already prohibits duplicate keys } } return builder.build(); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.material\dispo-service\src\main\java\de\metas\material\dispo\service\candidatechange\CandidateChangeService.java
2
请在Spring Boot框架中完成以下Java代码
public String getScopeType() { return scopeType; } public void setScopeType(String scopeType) { this.scopeType = scopeType; } @ApiModelProperty(example = "2020-06-03T22:05:05.474+0000") public Date getCreateTime() { return createTime; } public void setCreateTime(Date createTime) { this.createTime = createTime; } @ApiModelProperty(example = "2020-06-03T22:05:05.474+0000") public Date getCompleteTime() { return completeTime; } public void setCompleteTime(Date completeTime) { this.completeTime = completeTime; } @ApiModelProperty(example = "completed")
public String getStatus() { return status; } public void setStatus(String status) { this.status = status; } public void setTenantId(String tenantId) { this.tenantId = tenantId; } @ApiModelProperty(example = "null") public String getTenantId() { return tenantId; } }
repos\flowable-engine-main\modules\flowable-rest\src\main\java\org\flowable\rest\service\api\management\BatchPartResponse.java
2
请完成以下Java代码
public class Message { private final Instant time; private final String user; private final String message; public Message(String user, String message) { this.time = Instant.now(); this.user = user; this.message = message; } public Instant getTime() { return time; } public String getUser() {
return user; } public String getMessage() { return message; } @Override public String toString() { return time + " - " + user + ": " + message; } public static Message parse(String string) { String[] arr = string.split(";", 2); return new Message(arr[0], arr[1]); } }
repos\tutorials-master\libraries-server-2\src\main\java\com\baeldung\netty\customhandlersandlisteners\model\Message.java
1
请完成以下Java代码
public DirectMovementsFromSchedulesGenerator skipCompletingDDOrder() { this.skipCompletingDDOrder = true; return this; } /** * Do direct movements (e.g. skip the InTransit warehouse) */ public void generateDirectMovements() { trxManager.runInThreadInheritedTrx(this::generateDirectMovementsInTrx); } private void generateDirectMovementsInTrx() { trxManager.assertThreadInheritedTrxExists(); markExecuted(); schedules.forEach(this::generateDirectMovement); } private void markExecuted() { if (executed) { throw new AdempiereException("Already executed"); } this.executed = true; } private void generateDirectMovement(final DDOrderMoveSchedule schedule) { // // Make sure DD Order is completed final DDOrderId ddOrderId = schedule.getDdOrderId(); if (!skipCompletingDDOrder) { final I_DD_Order ddOrder = getDDOrderById(ddOrderId); ddOrderService.completeDDOrderIfNeeded(ddOrder); } schedule.assertNotPickedFrom(); schedule.assertNotDroppedTo(); final Quantity qtyToMove = schedule.getQtyToPick(); final HuId huIdToMove = schedule.getPickFromHUId(); final MovementId directMovementId = createDirectMovement(schedule, huIdToMove); schedule.markAsPickedFrom( null, DDOrderMoveSchedulePickedHUs.of( DDOrderMoveSchedulePickedHU.builder() .actualHUIdPicked(huIdToMove) .qtyPicked(qtyToMove)
.pickFromMovementId(directMovementId) .inTransitLocatorId(null) .dropToLocatorId(schedule.getDropToLocatorId()) .build()) ); schedule.markAsDroppedTo(schedule.getDropToLocatorId(), directMovementId); ddOrderMoveScheduleService.save(schedule); } private MovementId createDirectMovement( final @NonNull DDOrderMoveSchedule schedule, final @NonNull HuId huIdToMove) { final HUMovementGeneratorResult result = new HUMovementGenerator(toMovementGenerateRequest(schedule, huIdToMove)) .sharedHUIdsWithPackingMaterialsTransferred(huIdsWithPackingMaterialsTransferred) .createMovement(); return result.getSingleMovementLineId().getMovementId(); } private HUMovementGenerateRequest toMovementGenerateRequest( final @NonNull DDOrderMoveSchedule schedule, final @NonNull HuId huIdToMove) { final I_DD_Order ddOrder = ddOrdersCache.getById(schedule.getDdOrderId()); return DDOrderMovementHelper.prepareMovementGenerateRequest(ddOrder, schedule.getDdOrderLineId()) .movementDate(movementDate) .fromLocatorId(schedule.getPickFromLocatorId()) .toLocatorId(locatorToIdOverride != null ? locatorToIdOverride : schedule.getDropToLocatorId()) .huIdToMove(huIdToMove) .build(); } private I_DD_Order getDDOrderById(final DDOrderId ddOrderId) { return ddOrdersCache.getById(ddOrderId); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.handlingunits.base\src\main\java\de\metas\distribution\ddorder\movement\generate\DirectMovementsFromSchedulesGenerator.java
1
请完成以下Java代码
public LocalDate getParameterAsLocalDate(final String parameterName) { return params.getParameterAsLocalDate(parameterName); } @Override public ZonedDateTime getParameterAsZonedDateTime(final String parameterName) { return params.getParameterAsZonedDateTime(parameterName); } @Nullable @Override public Instant getParameterAsInstant(final String parameterName) { return params.getParameterAsInstant(parameterName); } @Override public boolean getParameterAsBool(final String parameterName) { return params.getParameterAsBool(parameterName);
} @Nullable @Override public Boolean getParameterAsBoolean(final String parameterName, @Nullable final Boolean defaultValue) { return params.getParameterAsBoolean(parameterName, defaultValue); } @Override public <T extends Enum<T>> Optional<T> getParameterAsEnum(final String parameterName, final Class<T> enumType) { return params.getParameterAsEnum(parameterName, enumType); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.util\src\main\java\org\adempiere\util\api\ForwardingParams.java
1
请在Spring Boot框架中完成以下Java代码
public class EmbeddedLdapProperties { /** * Embedded LDAP port. */ private int port; /** * Embedded LDAP credentials. */ private Credential credential = new Credential(); /** * List of base DNs. */ @Delimiter(Delimiter.NONE) private List<String> baseDn = new ArrayList<>(); /** * Schema (LDIF) script resource reference. */ private String ldif = "classpath:schema.ldif"; /** * Schema validation. */ private final Validation validation = new Validation(); /** * SSL configuration. */ private final Ssl ssl = new Ssl(); public int getPort() { return this.port; } public void setPort(int port) { this.port = port; } public Credential getCredential() { return this.credential; } public void setCredential(Credential credential) { this.credential = credential; } public List<String> getBaseDn() { return this.baseDn; } public void setBaseDn(List<String> baseDn) { this.baseDn = baseDn; } public String getLdif() { return this.ldif; } public void setLdif(String ldif) { this.ldif = ldif; } public Validation getValidation() { return this.validation; } public Ssl getSsl() { return this.ssl; } public static class Credential { /** * Embedded LDAP username. */ private @Nullable String username; /** * Embedded LDAP password. */ private @Nullable String password; public @Nullable String getUsername() { return this.username; } public void setUsername(@Nullable String username) { this.username = username; } public @Nullable String getPassword() { return this.password; } public void setPassword(@Nullable String password) { this.password = password; } boolean isAvailable() {
return StringUtils.hasText(this.username) && StringUtils.hasText(this.password); } } public static class Ssl { /** * Whether to enable SSL support. Enabled automatically if "bundle" is provided * unless specified otherwise. */ private @Nullable Boolean enabled; /** * SSL bundle name. */ private @Nullable String bundle; public boolean isEnabled() { return (this.enabled != null) ? this.enabled : this.bundle != null; } public void setEnabled(boolean enabled) { this.enabled = enabled; } public @Nullable String getBundle() { return this.bundle; } public void setBundle(@Nullable String bundle) { this.bundle = bundle; } } public static class Validation { /** * Whether to enable LDAP schema validation. */ private boolean enabled = true; /** * Path to the custom schema. */ private @Nullable Resource schema; public boolean isEnabled() { return this.enabled; } public void setEnabled(boolean enabled) { this.enabled = enabled; } public @Nullable Resource getSchema() { return this.schema; } public void setSchema(@Nullable Resource schema) { this.schema = schema; } } }
repos\spring-boot-main\module\spring-boot-ldap\src\main\java\org\springframework\boot\ldap\autoconfigure\embedded\EmbeddedLdapProperties.java
2
请完成以下Java代码
public void setScrappedQty (BigDecimal ScrappedQty) { set_ValueNoCheck (COLUMNNAME_ScrappedQty, ScrappedQty); } /** Get Verworfene Menge. @return Durch QA verworfene Menge */ public BigDecimal getScrappedQty () { BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_ScrappedQty); if (bd == null) return Env.ZERO; return bd; } /** Set Zielmenge. @param TargetQty
Zielmenge der Warenbewegung */ public void setTargetQty (BigDecimal TargetQty) { set_ValueNoCheck (COLUMNNAME_TargetQty, TargetQty); } /** Get Zielmenge. @return Zielmenge der Warenbewegung */ public BigDecimal getTargetQty () { BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_TargetQty); if (bd == null) return Env.ZERO; return bd; } }
repos\metasfresh-new_dawn_uat\backend\de.metas.swat\de.metas.swat.base\src\main\java-gen\org\adempiere\model\X_RV_M_InOutLine_Overview.java
1
请完成以下Java代码
public BigDecimal getMinQty () { BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_MinQty); if (bd == null) return Env.ZERO; return bd; } public I_M_Product getM_Product() throws RuntimeException { return (I_M_Product)MTable.get(getCtx(), I_M_Product.Table_Name) .getPO(getM_Product_ID(), get_TrxName()); } /** Set Product. @param M_Product_ID Product, Service, Item */ public void setM_Product_ID (int M_Product_ID) { if (M_Product_ID < 1) set_Value (COLUMNNAME_M_Product_ID, null); else set_Value (COLUMNNAME_M_Product_ID, Integer.valueOf(M_Product_ID)); } /** Get Product. @return Product, Service, Item */ public int getM_Product_ID () { Integer ii = (Integer)get_Value(COLUMNNAME_M_Product_ID); if (ii == null) return 0; return ii.intValue(); } /** Set Total Quantity. @param TotalQty
Total Quantity */ public void setTotalQty (BigDecimal TotalQty) { set_Value (COLUMNNAME_TotalQty, TotalQty); } /** Get Total Quantity. @return Total Quantity */ public BigDecimal getTotalQty () { BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_TotalQty); if (bd == null) return Env.ZERO; return bd; } }
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_M_DistributionRunLine.java
1
请完成以下Java代码
List<Vertex> getAdjVertices(String label) { return adjVertices.get(new Vertex(label)); } String printGraph() { StringBuffer sb = new StringBuffer(); for(Vertex v : adjVertices.keySet()) { sb.append(v); sb.append(adjVertices.get(v)); } return sb.toString(); } class Vertex { String label; Vertex(String label) { this.label = label; } @Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + getOuterType().hashCode(); result = prime * result + ((label == null) ? 0 : label.hashCode()); return result; } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false;
Vertex other = (Vertex) obj; if (!getOuterType().equals(other.getOuterType())) return false; if (label == null) { if (other.label != null) return false; } else if (!label.equals(other.label)) return false; return true; } @Override public String toString() { return label; } private Graph getOuterType() { return Graph.this; } } }
repos\tutorials-master\data-structures\src\main\java\com\baeldung\graph\Graph.java
1
请完成以下Java代码
public class GroupHeaderSDD { @XmlElement(name = "MsgId", required = true) protected String msgId; @XmlElement(name = "CreDtTm", required = true) @XmlSchemaType(name = "dateTime") protected XMLGregorianCalendar creDtTm; @XmlElement(name = "NbOfTxs", required = true) protected String nbOfTxs; @XmlElement(name = "CtrlSum") protected BigDecimal ctrlSum; @XmlElement(name = "InitgPty", required = true) protected PartyIdentificationSEPA1 initgPty; /** * Gets the value of the msgId property. * * @return * possible object is * {@link String } * */ public String getMsgId() { return msgId; } /** * Sets the value of the msgId property. * * @param value * allowed object is * {@link String } * */ public void setMsgId(String value) { this.msgId = value; } /** * Gets the value of the creDtTm property. * * @return * possible object is * {@link XMLGregorianCalendar } * */ public XMLGregorianCalendar getCreDtTm() { return creDtTm; } /** * Sets the value of the creDtTm property. * * @param value * allowed object is * {@link XMLGregorianCalendar } * */ public void setCreDtTm(XMLGregorianCalendar value) { this.creDtTm = value; } /** * Gets the value of the nbOfTxs property. * * @return * possible object is * {@link String } * */ public String getNbOfTxs() { return nbOfTxs; } /** * Sets the value of the nbOfTxs property. * * @param value * allowed object is * {@link String } * */ public void setNbOfTxs(String value) {
this.nbOfTxs = value; } /** * Gets the value of the ctrlSum property. * * @return * possible object is * {@link BigDecimal } * */ public BigDecimal getCtrlSum() { return ctrlSum; } /** * Sets the value of the ctrlSum property. * * @param value * allowed object is * {@link BigDecimal } * */ public void setCtrlSum(BigDecimal value) { this.ctrlSum = value; } /** * Gets the value of the initgPty property. * * @return * possible object is * {@link PartyIdentificationSEPA1 } * */ public PartyIdentificationSEPA1 getInitgPty() { return initgPty; } /** * Sets the value of the initgPty property. * * @param value * allowed object is * {@link PartyIdentificationSEPA1 } * */ public void setInitgPty(PartyIdentificationSEPA1 value) { this.initgPty = value; } }
repos\metasfresh-new_dawn_uat\backend\de.metas.payment.sepa\schema-pain_008_003_02\src\main\java-xjc\de\metas\payment\sepa\jaxb\sct\pain_008_003_02\GroupHeaderSDD.java
1
请完成以下Java代码
public void parseIntermediateCatchEvent(Element intermediateEventElement, ScopeImpl scope, ActivityImpl activity) { addStartEventListener(activity); addEndEventListener(activity); } @Override public void parseBoundaryEvent(Element boundaryEventElement, ScopeImpl scopeElement, ActivityImpl activity) { addStartEventListener(activity); addEndEventListener(activity); } @Override public void parseIntermediateMessageCatchEventDefinition(Element messageEventDefinition, ActivityImpl nestedActivity) { } @Override public void parseBoundaryMessageEventDefinition(Element element, boolean interrupting, ActivityImpl messageActivity) { } @Override
public void parseBoundaryEscalationEventDefinition(Element escalationEventDefinition, boolean interrupting, ActivityImpl boundaryEventActivity) { } @Override public void parseBoundaryConditionalEventDefinition(Element element, boolean interrupting, ActivityImpl conditionalActivity) { } @Override public void parseIntermediateConditionalEventDefinition(Element conditionalEventDefinition, ActivityImpl conditionalActivity) { } public void parseConditionalStartEventForEventSubprocess(Element element, ActivityImpl conditionalActivity, boolean interrupting) { } @Override public void parseIoMapping(Element extensionElements, ActivityImpl activity, IoMapping inputOutput) { } }
repos\camunda-bpm-platform-master\engine\src\main\java\org\camunda\bpm\application\impl\event\ProcessApplicationEventParseListener.java
1
请完成以下Java代码
public EventSubscriptionEntity createSubscriptionForStartEvent(ProcessDefinitionEntity processDefinition) { EventSubscriptionEntity eventSubscriptionEntity = new EventSubscriptionEntity(eventType); VariableScope scopeForExpression = StartProcessVariableScope.getSharedInstance(); String eventName = resolveExpressionOfEventName(scopeForExpression); eventSubscriptionEntity.setEventName(eventName); eventSubscriptionEntity.setActivityId(activityId); eventSubscriptionEntity.setConfiguration(processDefinition.getId()); eventSubscriptionEntity.setTenantId(processDefinition.getTenantId()); return eventSubscriptionEntity; } /** * Creates and inserts a subscription entity depending on the message type of this declaration. */ public EventSubscriptionEntity createSubscriptionForExecution(ExecutionEntity execution) { EventSubscriptionEntity eventSubscriptionEntity = new EventSubscriptionEntity(execution, eventType); String eventName = resolveExpressionOfEventName(execution); eventSubscriptionEntity.setEventName(eventName); if (activityId != null) { ActivityImpl activity = execution.getProcessDefinition().findActivity(activityId); eventSubscriptionEntity.setActivity(activity); } eventSubscriptionEntity.insert(); LegacyBehavior.removeLegacySubscriptionOnParent(execution, eventSubscriptionEntity); return eventSubscriptionEntity; } /** * Resolves the event name within the given scope. */ public String resolveExpressionOfEventName(VariableScope scope) { if (isExpressionAvailable()) { if(scope instanceof BaseDelegateExecution) {
// the variable scope execution is also the current context execution // during expression evaluation the current context is updated with the scope execution return (String) eventName.getValue(scope, (BaseDelegateExecution) scope); } else { return (String) eventName.getValue(scope); } } else { return null; } } protected boolean isExpressionAvailable() { return eventName != null; } public void updateSubscription(EventSubscriptionEntity eventSubscription) { String eventName = resolveExpressionOfEventName(eventSubscription.getExecution()); eventSubscription.setEventName(eventName); eventSubscription.setActivityId(activityId); } }
repos\camunda-bpm-platform-master\engine\src\main\java\org\camunda\bpm\engine\impl\bpmn\parser\EventSubscriptionDeclaration.java
1
请在Spring Boot框架中完成以下Java代码
public boolean isAllowSpecialFloatingPointValues() { return this.allowSpecialFloatingPointValues; } public void setAllowSpecialFloatingPointValues(boolean allowSpecialFloatingPointValues) { this.allowSpecialFloatingPointValues = allowSpecialFloatingPointValues; } public String getClassDiscriminator() { return this.classDiscriminator; } public void setClassDiscriminator(String classDiscriminator) { this.classDiscriminator = classDiscriminator; } public ClassDiscriminatorMode getClassDiscriminatorMode() { return this.classDiscriminatorMode; } public void setClassDiscriminatorMode(ClassDiscriminatorMode classDiscriminatorMode) { this.classDiscriminatorMode = classDiscriminatorMode; } public boolean isDecodeEnumsCaseInsensitive() { return this.decodeEnumsCaseInsensitive; } public void setDecodeEnumsCaseInsensitive(boolean decodeEnumsCaseInsensitive) { this.decodeEnumsCaseInsensitive = decodeEnumsCaseInsensitive; } public boolean isUseAlternativeNames() { return this.useAlternativeNames; } public void setUseAlternativeNames(boolean useAlternativeNames) { this.useAlternativeNames = useAlternativeNames; } public boolean isAllowTrailingComma() { return this.allowTrailingComma; } public void setAllowTrailingComma(boolean allowTrailingComma) { this.allowTrailingComma = allowTrailingComma; }
public boolean isAllowComments() { return this.allowComments; } public void setAllowComments(boolean allowComments) { this.allowComments = allowComments; } /** * Enum representing strategies for JSON property naming. The values correspond to * {@link kotlinx.serialization.json.JsonNamingStrategy} implementations that cannot * be directly referenced. */ public enum JsonNamingStrategy { /** * Snake case strategy. */ SNAKE_CASE, /** * Kebab case strategy. */ KEBAB_CASE } }
repos\spring-boot-4.0.1\module\spring-boot-kotlinx-serialization-json\src\main\java\org\springframework\boot\kotlinx\serialization\json\autoconfigure\KotlinxSerializationJsonProperties.java
2
请完成以下Java代码
public java.lang.String getPostingType() { return get_ValueAsString(COLUMNNAME_PostingType); } @Override public void setRV_DATEV_Export_Fact_Acct_Invoice_ID (final int RV_DATEV_Export_Fact_Acct_Invoice_ID) { if (RV_DATEV_Export_Fact_Acct_Invoice_ID < 1) set_ValueNoCheck (COLUMNNAME_RV_DATEV_Export_Fact_Acct_Invoice_ID, null); else set_ValueNoCheck (COLUMNNAME_RV_DATEV_Export_Fact_Acct_Invoice_ID, RV_DATEV_Export_Fact_Acct_Invoice_ID); } @Override public int getRV_DATEV_Export_Fact_Acct_Invoice_ID() { return get_ValueAsInt(COLUMNNAME_RV_DATEV_Export_Fact_Acct_Invoice_ID); } @Override public void setTaxAmtSource (final @Nullable BigDecimal TaxAmtSource) { set_ValueNoCheck (COLUMNNAME_TaxAmtSource, TaxAmtSource); } @Override
public BigDecimal getTaxAmtSource() { final BigDecimal bd = get_ValueAsBigDecimal(COLUMNNAME_TaxAmtSource); return bd != null ? bd : BigDecimal.ZERO; } @Override public void setVATCode (final @Nullable java.lang.String VATCode) { set_ValueNoCheck (COLUMNNAME_VATCode, VATCode); } @Override public java.lang.String getVATCode() { return get_ValueAsString(COLUMNNAME_VATCode); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.datev\src\main\java-gen\de\metas\datev\model\X_RV_DATEV_Export_Fact_Acct_Invoice.java
1
请完成以下Java代码
public int getCommission_Product_ID() { return get_ValueAsInt(COLUMNNAME_Commission_Product_ID); } @Override public void setIsSimulation (final boolean IsSimulation) { set_Value (COLUMNNAME_IsSimulation, IsSimulation); } @Override public boolean isSimulation() { return get_ValueAsBoolean(COLUMNNAME_IsSimulation); } @Override public void setIsSOTrx (final boolean IsSOTrx) { set_Value (COLUMNNAME_IsSOTrx, IsSOTrx); } @Override public boolean isSOTrx() { return get_ValueAsBoolean(COLUMNNAME_IsSOTrx); } @Override public void setLevelHierarchy (final int LevelHierarchy) { set_ValueNoCheck (COLUMNNAME_LevelHierarchy, LevelHierarchy); } @Override public int getLevelHierarchy() { return get_ValueAsInt(COLUMNNAME_LevelHierarchy); } @Override public void setPointsSum_Forecasted (final BigDecimal PointsSum_Forecasted) { set_Value (COLUMNNAME_PointsSum_Forecasted, PointsSum_Forecasted); } @Override public BigDecimal getPointsSum_Forecasted() { final BigDecimal bd = get_ValueAsBigDecimal(COLUMNNAME_PointsSum_Forecasted); return bd != null ? bd : BigDecimal.ZERO; } @Override public void setPointsSum_Invoiceable (final BigDecimal PointsSum_Invoiceable) { set_ValueNoCheck (COLUMNNAME_PointsSum_Invoiceable, PointsSum_Invoiceable); } @Override public BigDecimal getPointsSum_Invoiceable() { final BigDecimal bd = get_ValueAsBigDecimal(COLUMNNAME_PointsSum_Invoiceable); return bd != null ? bd : BigDecimal.ZERO; } @Override public void setPointsSum_Invoiced (final BigDecimal PointsSum_Invoiced) { set_Value (COLUMNNAME_PointsSum_Invoiced, PointsSum_Invoiced);
} @Override public BigDecimal getPointsSum_Invoiced() { final BigDecimal bd = get_ValueAsBigDecimal(COLUMNNAME_PointsSum_Invoiced); return bd != null ? bd : BigDecimal.ZERO; } @Override public void setPointsSum_Settled (final BigDecimal PointsSum_Settled) { set_Value (COLUMNNAME_PointsSum_Settled, PointsSum_Settled); } @Override public BigDecimal getPointsSum_Settled() { final BigDecimal bd = get_ValueAsBigDecimal(COLUMNNAME_PointsSum_Settled); return bd != null ? bd : BigDecimal.ZERO; } @Override public void setPointsSum_ToSettle (final BigDecimal PointsSum_ToSettle) { set_Value (COLUMNNAME_PointsSum_ToSettle, PointsSum_ToSettle); } @Override public BigDecimal getPointsSum_ToSettle() { final BigDecimal bd = get_ValueAsBigDecimal(COLUMNNAME_PointsSum_ToSettle); return bd != null ? bd : BigDecimal.ZERO; } }
repos\metasfresh-new_dawn_uat\backend\de.metas.contracts\src\main\java-gen\de\metas\contracts\commission\model\X_C_Commission_Share.java
1
请在Spring Boot框架中完成以下Java代码
public class SsoAuthorizationServerConfig extends AuthorizationServerConfigurerAdapter { @Autowired private PasswordEncoder passwordEncoder; @Autowired private UserDetailService userDetailService; @Bean public TokenStore jwtTokenStore() { return new JwtTokenStore(jwtAccessTokenConverter()); } @Bean public JwtAccessTokenConverter jwtAccessTokenConverter() { JwtAccessTokenConverter accessTokenConverter = new JwtAccessTokenConverter(); accessTokenConverter.setSigningKey("test_key"); return accessTokenConverter; } @Override public void configure(ClientDetailsServiceConfigurer clients) throws Exception { clients.inMemory() .withClient("app-a") .secret(passwordEncoder.encode("app-a-1234")) .authorizedGrantTypes("refresh_token","authorization_code") .accessTokenValiditySeconds(3600) .scopes("all") .autoApprove(true) .redirectUris("http://127.0.0.1:9090/app1/login") .and() .withClient("app-b") .secret(passwordEncoder.encode("app-b-1234"))
.authorizedGrantTypes("refresh_token","authorization_code") .accessTokenValiditySeconds(7200) .scopes("all") .autoApprove(true) .redirectUris("http://127.0.0.1:9091/app2/login"); } @Override public void configure(AuthorizationServerEndpointsConfigurer endpoints) { endpoints.tokenStore(jwtTokenStore()) .accessTokenConverter(jwtAccessTokenConverter()) .userDetailsService(userDetailService); } @Override public void configure(AuthorizationServerSecurityConfigurer security) { security.tokenKeyAccess("isAuthenticated()"); // 获取密钥需要身份认证 } }
repos\SpringAll-master\66.Spring-Security-OAuth2-SSO\sso-server\src\main\java\cc\mrbird\sso\server\config\SsoAuthorizationServerConfig.java
2
请完成以下Java代码
public class JakartaTransactionInterceptor extends AbstractTransactionInterceptor { protected final static CommandLogger LOG = ProcessEngineLogger.CMD_LOGGER; protected final TransactionManager transactionManager; public JakartaTransactionInterceptor(TransactionManager transactionManager, boolean requiresNew, ProcessEngineConfigurationImpl processEngineConfiguration) { super(requiresNew, processEngineConfiguration); this.transactionManager = transactionManager; } @Override protected void doBegin() { try { transactionManager.begin(); } catch (NotSupportedException e) { throw new TransactionException("Unable to begin transaction", e); } catch (SystemException e) { throw new TransactionException("Unable to begin transaction", e); } } @Override protected boolean isExisting() { try { return transactionManager.getStatus() != Status.STATUS_NO_TRANSACTION; } catch (SystemException e) { throw new TransactionException("Unable to retrieve transaction status", e); } } @Override protected Transaction doSuspend() { try { return transactionManager.suspend(); } catch (SystemException e) { throw new TransactionException("Unable to suspend transaction", e); } } @Override protected void doResume(Object tx) { if (tx != null) { try { transactionManager.resume((Transaction) tx); } catch (SystemException e) { throw new TransactionException("Unable to resume transaction", e); } catch (InvalidTransactionException e) { throw new TransactionException("Unable to resume transaction", e); } } } @Override protected void doCommit() { try { transactionManager.commit();
} catch (HeuristicMixedException e) { throw new TransactionException("Unable to commit transaction", e); } catch (HeuristicRollbackException e) { throw new TransactionException("Unable to commit transaction", e); } catch (RollbackException e) { handleRollbackException(e); } catch (SystemException e) { throw new TransactionException("Unable to commit transaction", e); } catch (RuntimeException e) { doRollback(true); throw e; } catch (Error e) { doRollback(true); throw e; } } @Override protected void doRollback(boolean isNew) { try { if (isNew) { transactionManager.rollback(); } else { transactionManager.setRollbackOnly(); } } catch (SystemException e) { LOG.exceptionWhileRollingBackTransaction(e); } } }
repos\camunda-bpm-platform-master\engine\src\main\java\org\camunda\bpm\engine\impl\interceptor\JakartaTransactionInterceptor.java
1
请完成以下Java代码
void start() { List<CompletableFuture<String>> futures = new ArrayList<>(); for (int i = 1; i <= 1000; i++) { String operationId = "Operation-" + i; futures.add(asyncOperation(operationId)); } CompletableFuture<?>[] futuresArray = futures.toArray(new CompletableFuture<?>[0]); CompletableFuture<List<String>> listFuture = CompletableFuture.allOf(futuresArray).thenApply(v -> futures.stream().map(CompletableFuture::join).collect(Collectors.toList())); try { final List<String> results = listFuture.join(); System.out.println("Printing first 10 results"); for (int i = 0; i < 10; i++) { System.out.println("Finished " + results.get(i)); } } finally {
close(); } } void close() { asyncOperationEmulation.shutdownNow(); } public static void main(String[] args) { new Application().initialize() // Switch between .startNaive() and .start() to test both implementations // .startNaive(); .start(); } }
repos\tutorials-master\core-java-modules\core-java-concurrency-basic-3\src\main\java\com\baeldung\concurrent\completablefuturelist\Application.java
1
请在Spring Boot框架中完成以下Java代码
JvmThreadMetrics jvmThreadMetrics(ObjectProvider<JvmThreadMeterConventions> jvmThreadMeterConventions) { JvmThreadMeterConventions conventions = jvmThreadMeterConventions.getIfAvailable(); return (conventions != null) ? new JvmThreadMetrics(Collections.emptyList(), conventions) : new JvmThreadMetrics(); } @Bean @ConditionalOnMissingBean ClassLoaderMetrics classLoaderMetrics( ObjectProvider<JvmClassLoadingMeterConventions> jvmClassLoadingMeterConventions) { JvmClassLoadingMeterConventions conventions = jvmClassLoadingMeterConventions.getIfAvailable(); return (conventions != null) ? new ClassLoaderMetrics(conventions) : new ClassLoaderMetrics(); } @Bean @ConditionalOnMissingBean JvmInfoMetrics jvmInfoMetrics() { return new JvmInfoMetrics(); } @Bean @ConditionalOnMissingBean JvmCompilationMetrics jvmCompilationMetrics() { return new JvmCompilationMetrics(); } @Configuration(proxyBeanMethods = false) @ConditionalOnClass(name = VIRTUAL_THREAD_METRICS_CLASS) static class VirtualThreadMetricsConfiguration { @Bean @ConditionalOnMissingBean(type = VIRTUAL_THREAD_METRICS_CLASS) @ImportRuntimeHints(VirtualThreadMetricsRuntimeHintsRegistrar.class) MeterBinder virtualThreadMetrics() throws ClassNotFoundException { Class<?> virtualThreadMetricsClass = ClassUtils.forName(VIRTUAL_THREAD_METRICS_CLASS,
getClass().getClassLoader()); return (MeterBinder) BeanUtils.instantiateClass(virtualThreadMetricsClass); } } static final class VirtualThreadMetricsRuntimeHintsRegistrar implements RuntimeHintsRegistrar { @Override public void registerHints(RuntimeHints hints, @Nullable ClassLoader classLoader) { hints.reflection() .registerTypeIfPresent(classLoader, VIRTUAL_THREAD_METRICS_CLASS, MemberCategory.INVOKE_PUBLIC_CONSTRUCTORS); } } }
repos\spring-boot-main\module\spring-boot-micrometer-metrics\src\main\java\org\springframework\boot\micrometer\metrics\autoconfigure\jvm\JvmMetricsAutoConfiguration.java
2
请完成以下Java代码
public LookupDataSourceContext.Builder newContextForFetchingList() { return LookupDataSourceContext.builder(modelTableName); } @Override public LookupValuesPage retrieveEntities(final LookupDataSourceContext evalCtx) { logger.trace("Retrieving entries for: {}", evalCtx); if (evalCtx.isAnyFilter()) { // usually that's the case of dropdowns. In that case we don't want to use elasticsearch. logger.trace("Fallback to database lookup because ANY filter was used"); return databaseLookup.findEntities(evalCtx); } final QueryBuilder query = createElasticsearchQuery(evalCtx); logger.trace("ES query: {}", query); final int maxSize = Math.min(evalCtx.getLimit(100), 100); final SearchResponse searchResponse = elasticsearchClient.prepareSearch(esIndexName) .setQuery(query) .setExplain(logger.isTraceEnabled()) .setSize(maxSize) .addStoredField(esKeyColumnName) // not sure it's right .get(); logger.trace("ES response: {}", searchResponse); final List<Integer> recordIds = Stream.of(searchResponse.getHits().getHits()) .map(this::extractId) .distinct() .collect(ImmutableList.toImmutableList()); logger.trace("Record IDs: {}", recordIds); final LookupValuesList lookupValues = databaseLookup.findByIdsOrdered(recordIds); logger.trace("Lookup values: {}", lookupValues); return lookupValues.pageByOffsetAndLimit(0, Integer.MAX_VALUE); } private int extractId(@NonNull final SearchHit hit) { final Object value = hit .getFields() .get(esKeyColumnName) .getValue(); return NumberUtils.asInt(value, -1); } private QueryBuilder createElasticsearchQuery(final LookupDataSourceContext evalCtx) { final String text = evalCtx.getFilter(); return QueryBuilders.multiMatchQuery(text, esSearchFieldNames); } @Override public boolean isCached() { return true; } @Override public String getCachePrefix() { return null; } @Override public Optional<String> getLookupTableName() { return Optional.of(modelTableName); } @Override public void cacheInvalidate() { // nothing } @Override public LookupDataSourceFetcher getLookupDataSourceFetcher() { return this; }
@Override public boolean isHighVolume() { return true; } @Override public LookupSource getLookupSourceType() { return LookupSource.lookup; } @Override public boolean hasParameters() { return true; } @Override public boolean isNumericKey() { return true; } @Override public Set<String> getDependsOnFieldNames() { return null; } @Override public Optional<WindowId> getZoomIntoWindowId() { return Optional.empty(); } @Override public SqlForFetchingLookupById getSqlForFetchingLookupByIdExpression() { return sqlLookupDescriptor != null ? sqlLookupDescriptor.getSqlForFetchingLookupByIdExpression() : null; } }
repos\metasfresh-new_dawn_uat\backend\de.metas.ui.web.base\src\main\java\de\metas\ui\web\window\descriptor\FullTextSearchLookupDescriptor.java
1
请完成以下Java代码
public static Attributes of(final ImmutableAttributeSet attributeSet) { if (attributeSet.isEmpty()) {return EMPTY;} return ofList( attributeSet.getAttributeCodes() .stream() .map(attributeCode -> toAttribute(attributeSet, attributeCode)) .collect(ImmutableList.toImmutableList()) ); } private static Attribute toAttribute(@NonNull ImmutableAttributeSet attributeSet, @NonNull AttributeCode attributeCode) { return Attribute.builder() .attributeCode(attributeCode) .displayName(TranslatableStrings.anyLanguage(attributeSet.getAttributeNameByCode(attributeCode))) .valueType(attributeSet.getAttributeValueType(attributeCode)) .value(attributeSet.getValue(attributeCode)) .build(); } public static Attributes ofList(final List<Attribute> list) { return list.isEmpty() ? EMPTY : new Attributes(list); } public boolean hasAttribute(final @NonNull AttributeCode attributeCode) { return byCode.containsKey(attributeCode); } @NonNull public Attribute getAttribute(@NonNull final AttributeCode attributeCode) { final Attribute attribute = byCode.get(attributeCode); if (attribute == null)
{ throw new AdempiereException("No attribute `" + attributeCode + "` found in " + byCode.keySet()); } return attribute; } public List<Attribute> getAttributes() {return list;} public Attributes retainOnly(@NonNull final Set<AttributeCode> attributeCodes, @NonNull final Attributes fallback) { Check.assumeNotEmpty(attributeCodes, "attributeCodes is not empty"); final ArrayList<Attribute> newList = new ArrayList<>(); for (AttributeCode attributeCode : attributeCodes) { if (hasAttribute(attributeCode)) { newList.add(getAttribute(attributeCode)); } else if (fallback.hasAttribute(attributeCode)) { newList.add(fallback.getAttribute(attributeCode)); } } return ofList(newList); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.inventory.mobileui\src\main\java\de\metas\inventory\mobileui\deps\products\Attributes.java
1
请完成以下Java代码
public class ProcessEngineDetails { public static final String EDITION_ENTERPRISE = "enterprise"; public static final String EDITION_COMMUNITY = "community"; protected String version; protected String edition; public ProcessEngineDetails(String version, String edition) { this.version = version; this.edition = edition; } public String getVersion() { return version;
} public void setVersion(String version) { this.version = version; } public String getEdition() { return edition; } public void setEdition(String edition) { this.edition = edition; } }
repos\camunda-bpm-platform-master\engine\src\main\java\org\camunda\bpm\engine\impl\util\ProcessEngineDetails.java
1
请完成以下Java代码
public void setName (String Name) { set_Value (COLUMNNAME_Name, Name); } /** Get Name. @return Alphanumeric identifier of the entity */ public String getName () { return (String)get_Value(COLUMNNAME_Name); } /** Get Record ID/ColumnName @return ID/ColumnName pair */ public KeyNamePair getKeyNamePair() { return new KeyNamePair(get_ID(), getName()); } /** Set Note. @param Note Optional additional user defined information */ public void setNote (String Note) { set_Value (COLUMNNAME_Note, Note); } /** Get Note. @return Optional additional user defined information */ public String getNote () { return (String)get_Value(COLUMNNAME_Note); } /** Set Process Now. @param Processing Process Now */ public void setProcessing (boolean Processing) { set_Value (COLUMNNAME_Processing, Boolean.valueOf(Processing)); } /** Get Process Now.
@return Process Now */ public boolean isProcessing () { Object oo = get_Value(COLUMNNAME_Processing); if (oo != null) { if (oo instanceof Boolean) return ((Boolean)oo).booleanValue(); return "Y".equals(oo); } return false; } /** Set Remote Addr. @param Remote_Addr Remote Address */ public void setRemote_Addr (String Remote_Addr) { set_Value (COLUMNNAME_Remote_Addr, Remote_Addr); } /** Get Remote Addr. @return Remote Address */ public String getRemote_Addr () { return (String)get_Value(COLUMNNAME_Remote_Addr); } /** Set Remote Host. @param Remote_Host Remote host Info */ public void setRemote_Host (String Remote_Host) { set_Value (COLUMNNAME_Remote_Host, Remote_Host); } /** Get Remote Host. @return Remote host Info */ public String getRemote_Host () { return (String)get_Value(COLUMNNAME_Remote_Host); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_A_Registration.java
1
请在Spring Boot框架中完成以下Java代码
public class ChargeId implements RepoIdAware { int repoId; @JsonCreator public static ChargeId ofRepoId(final int repoId) { return new ChargeId(repoId); } public static ChargeId ofRepoIdOrNull(final int repoId) { return repoId > 0 ? new ChargeId(repoId) : null; } public static int toRepoId(final ChargeId id) {
return id != null ? id.getRepoId() : -1; } private ChargeId(final int repoId) { this.repoId = Check.assumeGreaterThanZero(repoId, "C_Charge_ID"); } @Override @JsonValue public int getRepoId() { return repoId; } }
repos\metasfresh-new_dawn_uat\backend\de.metas.business\src\main\java\de\metas\costing\ChargeId.java
2
请完成以下Java代码
public boolean getParameter_ToAsBoolean() { return StringUtils.toBoolean(m_Parameter_To); } @Nullable public Timestamp getParameterAsTimestamp() { return TimeUtil.asTimestamp(m_Parameter); } @Nullable public Timestamp getParameter_ToAsTimestamp() { return TimeUtil.asTimestamp(m_Parameter_To); } @Nullable public LocalDate getParameterAsLocalDate() { return TimeUtil.asLocalDate(m_Parameter); } @Nullable public LocalDate getParameter_ToAsLocalDate() { return TimeUtil.asLocalDate(m_Parameter_To); } @Nullable public ZonedDateTime getParameterAsZonedDateTime() { return TimeUtil.asZonedDateTime(m_Parameter); } @Nullable public Instant getParameterAsInstant() { return TimeUtil.asInstant(m_Parameter); } @Nullable public ZonedDateTime getParameter_ToAsZonedDateTime() { return TimeUtil.asZonedDateTime(m_Parameter_To); } @Nullable public BigDecimal getParameterAsBigDecimal() { return toBigDecimal(m_Parameter); } @Nullable public BigDecimal getParameter_ToAsBigDecimal() {
return toBigDecimal(m_Parameter_To); } @Nullable private static BigDecimal toBigDecimal(@Nullable final Object value) { if (value == null) { return null; } else if (value instanceof BigDecimal) { return (BigDecimal)value; } else if (value instanceof Integer) { return BigDecimal.valueOf((Integer)value); } else { return new BigDecimal(value.toString()); } } } // ProcessInfoParameter
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\de\metas\process\ProcessInfoParameter.java
1
请完成以下Java代码
public class ProcessElementImpl implements PvmProcessElement { private static final long serialVersionUID = 1L; protected String id; protected ProcessDefinitionImpl processDefinition; protected Map<String, Object> properties; public ProcessElementImpl(String id, ProcessDefinitionImpl processDefinition) { this.id = id; this.processDefinition = processDefinition; } public void setProperty(String name, Object value) { if (properties == null) { properties = new HashMap<>(); } properties.put(name, value); } @Override public Object getProperty(String name) { if (properties == null) { return null; } return properties.get(name); } @SuppressWarnings("unchecked") public Map<String, Object> getProperties() { if (properties == null) { return Collections.EMPTY_MAP;
} return properties; } // getters and setters ////////////////////////////////////////////////////// @Override public String getId() { return id; } public void setProperties(Map<String, Object> properties) { this.properties = properties; } @Override public ProcessDefinitionImpl getProcessDefinition() { return processDefinition; } }
repos\flowable-engine-main\modules\flowable5-engine\src\main\java\org\activiti\engine\impl\pvm\process\ProcessElementImpl.java
1
请完成以下Java代码
protected void logInfo(String id, String messageTemplate, Object... parameters) { if(delegateLogger.isInfoEnabled()) { String msg = formatMessageTemplate(id, messageTemplate); delegateLogger.info(msg, parameters); } } /** * Logs an 'WARN' message * * @param id the unique id of this log message * @param messageTemplate the message template to use * @param parameters a list of optional parameters */ protected void logWarn(String id, String messageTemplate, Object... parameters) { if(delegateLogger.isWarnEnabled()) { String msg = formatMessageTemplate(id, messageTemplate); delegateLogger.warn(msg, parameters); } } /** * Logs an 'ERROR' message * * @param id the unique id of this log message * @param messageTemplate the message template to use * @param parameters a list of optional parameters */ protected void logError(String id, String messageTemplate, Object... parameters) { if(delegateLogger.isErrorEnabled()) { String msg = formatMessageTemplate(id, messageTemplate); delegateLogger.error(msg, parameters); } } /** * @return true if the logger will log 'DEBUG' messages */ public boolean isDebugEnabled() { return delegateLogger.isDebugEnabled(); } /** * @return true if the logger will log 'INFO' messages */ public boolean isInfoEnabled() { return delegateLogger.isInfoEnabled(); } /** * @return true if the logger will log 'WARN' messages */ public boolean isWarnEnabled() { return delegateLogger.isWarnEnabled(); }
/** * @return true if the logger will log 'ERROR' messages */ public boolean isErrorEnabled() { return delegateLogger.isErrorEnabled(); } /** * Formats a message template * * @param id the id of the message * @param messageTemplate the message template to use * * @return the formatted template */ protected String formatMessageTemplate(String id, String messageTemplate) { return projectCode + "-" + componentId + id + " " + messageTemplate; } /** * Prepares an exception message * * @param id the id of the message * @param messageTemplate the message template to use * @param parameters the parameters for the message (optional) * * @return the prepared exception message */ protected String exceptionMessage(String id, String messageTemplate, Object... parameters) { String formattedTemplate = formatMessageTemplate(id, messageTemplate); if(parameters == null || parameters.length == 0) { return formattedTemplate; } else { return MessageFormatter.arrayFormat(formattedTemplate, parameters).getMessage(); } } }
repos\camunda-bpm-platform-master\commons\logging\src\main\java\org\camunda\commons\logging\BaseLogger.java
1
请完成以下Java代码
public HistoricTaskInstanceEntity findHistoricTaskInstanceById(String taskId) { if (taskId == null) { throw new ActivitiIllegalArgumentException("Invalid historic task id : null"); } if (getHistoryManager().isHistoryEnabled()) { return (HistoricTaskInstanceEntity) getDbSqlSession().selectOne("selectHistoricTaskInstance", taskId); } return null; } @SuppressWarnings("unchecked") public List<HistoricTaskInstance> findHistoricTasksByParentTaskId(String parentTaskId) { return getDbSqlSession().selectList("selectHistoricTasksByParentTaskId", parentTaskId); } public void deleteHistoricTaskInstanceById(String taskId) { if (getHistoryManager().isHistoryEnabled()) { HistoricTaskInstanceEntity historicTaskInstance = findHistoricTaskInstanceById(taskId); if (historicTaskInstance != null) { CommandContext commandContext = Context.getCommandContext(); List<HistoricTaskInstance> subTasks = findHistoricTasksByParentTaskId(taskId); for (HistoricTaskInstance subTask : subTasks) { deleteHistoricTaskInstanceById(subTask.getId()); } commandContext .getHistoricDetailEntityManager() .deleteHistoricDetailsByTaskId(taskId); commandContext .getHistoricVariableInstanceEntityManager() .deleteHistoricVariableInstancesByTaskId(taskId); commandContext .getCommentEntityManager() .deleteCommentsByTaskId(taskId); commandContext .getAttachmentEntityManager() .deleteAttachmentsByTaskId(taskId);
commandContext.getHistoricIdentityLinkEntityManager() .deleteHistoricIdentityLinksByTaskId(taskId); getDbSqlSession().delete(historicTaskInstance); } } } @SuppressWarnings("unchecked") public List<HistoricTaskInstance> findHistoricTaskInstancesByNativeQuery(Map<String, Object> parameterMap, int firstResult, int maxResults) { return getDbSqlSession().selectListWithRawParameter("selectHistoricTaskInstanceByNativeQuery", parameterMap, firstResult, maxResults); } public long findHistoricTaskInstanceCountByNativeQuery(Map<String, Object> parameterMap) { return (Long) getDbSqlSession().selectOne("selectHistoricTaskInstanceCountByNativeQuery", parameterMap); } }
repos\flowable-engine-main\modules\flowable5-engine\src\main\java\org\activiti\engine\impl\persistence\entity\HistoricTaskInstanceEntityManager.java
1
请在Spring Boot框架中完成以下Java代码
public @Nullable Origin getOrigin() { return this.origin; } /** * Return an array of {@link ConfigDataLocation} elements built by splitting this * {@link ConfigDataLocation} around a delimiter of {@code ";"}. * @return the split locations * @since 2.4.7 */ public ConfigDataLocation[] split() { return split(";"); } /** * Return an array of {@link ConfigDataLocation} elements built by splitting this * {@link ConfigDataLocation} around the specified delimiter. * @param delimiter the delimiter to split on * @return the split locations * @since 2.4.7 */ public ConfigDataLocation[] split(String delimiter) { Assert.state(!this.value.isEmpty(), "Unable to split empty locations"); String[] values = StringUtils.delimitedListToStringArray(toString(), delimiter); ConfigDataLocation[] result = new ConfigDataLocation[values.length]; for (int i = 0; i < values.length; i++) { int index = i; ConfigDataLocation configDataLocation = of(values[index]); result[i] = configDataLocation.withOrigin(getOrigin()); } return result; } /** * Create a new {@link ConfigDataLocation} with a specific {@link Origin}. * @param origin the origin to set * @return a new {@link ConfigDataLocation} instance. */ ConfigDataLocation withOrigin(@Nullable Origin origin) { return new ConfigDataLocation(this.optional, this.value, origin); } @Override public boolean equals(Object obj) { if (this == obj) { return true; }
if (obj == null || getClass() != obj.getClass()) { return false; } ConfigDataLocation other = (ConfigDataLocation) obj; return this.value.equals(other.value); } @Override public int hashCode() { return this.value.hashCode(); } @Override public String toString() { return (!this.optional) ? this.value : OPTIONAL_PREFIX + this.value; } /** * Factory method to create a new {@link ConfigDataLocation} from a string. * @param location the location string * @return the {@link ConfigDataLocation} (which may be empty) */ public static ConfigDataLocation of(@Nullable String location) { boolean optional = location != null && location.startsWith(OPTIONAL_PREFIX); String value = (location != null && optional) ? location.substring(OPTIONAL_PREFIX.length()) : location; return (StringUtils.hasText(value)) ? new ConfigDataLocation(optional, value, null) : EMPTY; } static boolean isNotEmpty(@Nullable ConfigDataLocation location) { return (location != null) && !location.getValue().isEmpty(); } }
repos\spring-boot-4.0.1\core\spring-boot\src\main\java\org\springframework\boot\context\config\ConfigDataLocation.java
2
请完成以下Java代码
public frameset addElement(String hashcode,Element element) { addElementToRegistry(hashcode,element); return(this); } /** Adds an Element to the element. @param hashcode name of element for hash table @param element Adds an Element to the element. */ public frameset addElement(String hashcode,String element) { addElementToRegistry(hashcode,element); return(this); } /** Adds an Element to the element. @param element Adds an Element to the element. */ public frameset addElement(Element element) { addElementToRegistry(element); return(this); } /** Adds an Element to the element. @param element Adds an Element to the element. */ public frameset addElement(String element) { addElementToRegistry(element); return(this); } /** Removes an Element from the element. @param hashcode the name of the element to be removed. */ public frameset removeElement(String hashcode) { removeElementFromRegistry(hashcode); return(this); } /** The onload event occurs when the user agent finishes loading a window or all frames within a frameset. This attribute may be used with body
and frameset elements. @param The script */ public void setOnLoad(String script) { addAttribute ( "onload", script ); } /** The onunload event occurs when the user agent removes a document from a window or frame. This attribute may be used with body and frameset elements. @param The script */ public void setOnUnload(String script) { addAttribute ( "onunload", script ); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\tools\src\main\java-legacy\org\apache\ecs\xhtml\frameset.java
1
请完成以下Java代码
private static SessionFactory makeSessionFactory(ServiceRegistry serviceRegistry) { MetadataSources metadataSources = new MetadataSources(serviceRegistry); metadataSources.addPackage("com.baeldung.hibernate.pojo"); metadataSources.addAnnotatedClass(Person.class); metadataSources.addAnnotatedClass(Student.class); metadataSources.addAnnotatedClass(Individual.class); metadataSources.addAnnotatedClass(PessimisticLockingEmployee.class); metadataSources.addAnnotatedClass(PessimisticLockingStudent.class); metadataSources.addAnnotatedClass(PessimisticLockingCourse.class); metadataSources.addAnnotatedClass(com.baeldung.hibernate.pessimisticlocking.Customer.class); metadataSources.addAnnotatedClass(com.baeldung.hibernate.pessimisticlocking.Address.class); metadataSources.addAnnotatedClass(DeptEmployee.class); metadataSources.addAnnotatedClass(com.baeldung.hibernate.entities.Department.class); metadataSources.addAnnotatedClass(OptimisticLockingCourse.class); metadataSources.addAnnotatedClass(OptimisticLockingStudent.class); metadataSources.addAnnotatedClass(Post.class); Metadata metadata = metadataSources.getMetadataBuilder() .build(); return metadata.getSessionFactoryBuilder() .build(); }
private static ServiceRegistry configureServiceRegistry() throws IOException { return configureServiceRegistry(getProperties()); } private static ServiceRegistry configureServiceRegistry(Properties properties) throws IOException { return new StandardServiceRegistryBuilder().applySettings(properties) .build(); } public static Properties getProperties() throws IOException { Properties properties = new Properties(); URL propertiesURL = Thread.currentThread() .getContextClassLoader() .getResource(StringUtils.defaultString(PROPERTY_FILE_NAME, "hibernate.properties")); try (FileInputStream inputStream = new FileInputStream(propertiesURL.getFile())) { properties.load(inputStream); } return properties; } }
repos\tutorials-master\persistence-modules\hibernate-jpa\src\main\java\com\baeldung\hibernate\HibernateUtil.java
1
请在Spring Boot框架中完成以下Java代码
public void publishProductExcludeDeleted(final ProductId productId, final BPartnerId... bpartnerIds) { final PZN pzn = getPZNByProductId(productId); final List<MSV3ProductExclude> eventItems = Stream.of(bpartnerIds) .filter(Objects::nonNull) .distinct() .map(bpartnerId -> MSV3ProductExclude.builder() .pzn(pzn) .bpartnerId(bpartnerId.getRepoId()) .delete(true) .build()) .collect(ImmutableList.toImmutableList()); if (eventItems.isEmpty()) {
return; } msv3ServerPeerService.publishProductExcludes(MSV3ProductExcludesUpdateEvent.builder() .items(eventItems) .build()); } private int getPublishAllStockAvailabilityBatchSize() { return Services .get(ISysConfigBL.class) .getIntValue(SYSCONFIG_STOCK_AVAILABILITY_BATCH_SIZE, 500); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.vertical.pharma.msv3.server-peer-metasfresh\src\main\java\de\metas\vertical\pharma\msv3\server\peer\metasfresh\services\MSV3StockAvailabilityService.java
2
请完成以下Java代码
public String getActivtyInstanceId() { return activityInstanceId; } public String getActivityInstanceId() { return activityInstanceId; } public void setActivityInstanceId(String activityInstanceId) { this.activityInstanceId = activityInstanceId; } public String getCaseDefinitionKey() { return caseDefinitionKey; } public void setCaseDefinitionKey(String caseDefinitionKey) { this.caseDefinitionKey = caseDefinitionKey; } public String getCaseDefinitionId() { return caseDefinitionId; } public void setCaseDefinitionId(String caseDefinitionId) { this.caseDefinitionId = caseDefinitionId; } public String getCaseInstanceId() { return caseInstanceId; } public void setCaseInstanceId(String caseInstanceId) { this.caseInstanceId = caseInstanceId; } public String getCaseExecutionId() { return caseExecutionId; } public void setCaseExecutionId(String caseExecutionId) { this.caseExecutionId = caseExecutionId; } public String getErrorMessage() { return typedValueField.getErrorMessage(); } public String getTenantId() { return tenantId; } public void setTenantId(String tenantId) { this.tenantId = tenantId; } public String getState() { return state; } public void setState(String state) { this.state = state; } public Date getCreateTime() { return createTime; } public void setCreateTime(Date createTime) { this.createTime = createTime;
} public String getRootProcessInstanceId() { return rootProcessInstanceId; } public void setRootProcessInstanceId(String rootProcessInstanceId) { this.rootProcessInstanceId = rootProcessInstanceId; } public Date getRemovalTime() { return removalTime; } public void setRemovalTime(Date removalTime) { this.removalTime = removalTime; } @Override public String toString() { return this.getClass().getSimpleName() + "[id=" + id + ", processDefinitionKey=" + processDefinitionKey + ", processDefinitionId=" + processDefinitionId + ", rootProcessInstanceId=" + rootProcessInstanceId + ", removalTime=" + removalTime + ", processInstanceId=" + processInstanceId + ", taskId=" + taskId + ", executionId=" + executionId + ", tenantId=" + tenantId + ", activityInstanceId=" + activityInstanceId + ", caseDefinitionKey=" + caseDefinitionKey + ", caseDefinitionId=" + caseDefinitionId + ", caseInstanceId=" + caseInstanceId + ", caseExecutionId=" + caseExecutionId + ", name=" + name + ", createTime=" + createTime + ", revision=" + revision + ", serializerName=" + getSerializerName() + ", longValue=" + longValue + ", doubleValue=" + doubleValue + ", textValue=" + textValue + ", textValue2=" + textValue2 + ", state=" + state + ", byteArrayId=" + getByteArrayId() + "]"; } }
repos\camunda-bpm-platform-master\engine\src\main\java\org\camunda\bpm\engine\impl\persistence\entity\HistoricVariableInstanceEntity.java
1
请在Spring Boot框架中完成以下Java代码
public String getTaxfree() { return taxfree; } public void setTaxfree(final String taxfree) { this.taxfree = taxfree; } @Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + (cInvoiceID == null ? 0 : cInvoiceID.hashCode()); result = prime * result + (isoCode == null ? 0 : isoCode.hashCode()); result = prime * result + (netDays == null ? 0 : netDays.hashCode()); result = prime * result + (netdate == null ? 0 : netdate.hashCode()); result = prime * result + (singlevat == null ? 0 : singlevat.hashCode()); result = prime * result + (taxfree == null ? 0 : taxfree.hashCode()); return result; } @Override public boolean equals(final Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final Cctop120V other = (Cctop120V)obj; if (cInvoiceID == null) { if (other.cInvoiceID != null) { return false; } } else if (!cInvoiceID.equals(other.cInvoiceID)) { return false; } if (isoCode == null) { if (other.isoCode != null) { return false; } } else if (!isoCode.equals(other.isoCode)) { return false; } if (netDays == null) { if (other.netDays != null) { return false; } } else if (!netDays.equals(other.netDays)) { return false; } if (netdate == null) { if (other.netdate != null)
{ return false; } } else if (!netdate.equals(other.netdate)) { return false; } if (singlevat == null) { if (other.singlevat != null) { return false; } } else if (!singlevat.equals(other.singlevat)) { return false; } if (taxfree == null) { if (other.taxfree != null) { return false; } } else if (!taxfree.equals(other.taxfree)) { return false; } return true; } @Override public String toString() { return "Cctop120V [cInvoiceID=" + cInvoiceID + ", isoCode=" + isoCode + ", netdate=" + netdate + ", netDays=" + netDays + ", singlevat=" + singlevat + ", taxfree=" + taxfree + "]"; } }
repos\metasfresh-new_dawn_uat\misc\services\camel\de-metas-camel-edi\src\main\java\de\metas\edi\esb\invoicexport\compudata\Cctop120V.java
2
请完成以下Java代码
public void setPassword(String password) { this.password = password; } public void setEmail(String email) { this.email = email; } public Timestamp getCreatedOn() { return createdOn; } public void setCreatedOn(Timestamp createdOn) { this.createdOn = createdOn; } public void setLastLogin(Timestamp lastLogin) { this.lastLogin = lastLogin; } public Permission getPermission() {
return permission; } public void setPermission(Permission permission) { this.permission = permission; } public String getEmail() { return email; } @Override public String toString() { return "Account{" + "userId=" + userId + ", username='" + username + '\'' + ", password='" + password + '\'' + ", email='" + email + '\'' + ", createdOn=" + createdOn + ", lastLogin=" + lastLogin + ", permission=" + permission + '}'; } }
repos\tutorials-master\persistence-modules\spring-boot-persistence-2\src\main\java\com\baeldung\findby\Account.java
1
请完成以下Java代码
public void setQtyInUOM (final @Nullable BigDecimal QtyInUOM) { set_Value (COLUMNNAME_QtyInUOM, QtyInUOM); } @Override public BigDecimal getQtyInUOM() { final BigDecimal bd = get_ValueAsBigDecimal(COLUMNNAME_QtyInUOM); return bd != null ? bd : BigDecimal.ZERO; } /** * Type AD_Reference_ID=541716 * Reference name: M_MatchInv_Type */
public static final int TYPE_AD_Reference_ID=541716; /** Material = M */ public static final String TYPE_Material = "M"; /** Cost = C */ public static final String TYPE_Cost = "C"; @Override public void setType (final java.lang.String Type) { set_ValueNoCheck (COLUMNNAME_Type, Type); } @Override public java.lang.String getType() { return get_ValueAsString(COLUMNNAME_Type); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_M_MatchInv.java
1
请完成以下Java代码
public class JobAcquisitionAdd extends AbstractAddStepHandler { public static final JobAcquisitionAdd INSTANCE = new JobAcquisitionAdd(); private JobAcquisitionAdd() { super(SubsystemAttributeDefinitons.JOB_ACQUISITION_ATTRIBUTES); } @Override protected void performRuntime(final OperationContext context, final ModelNode operation, final ModelNode model) throws OperationFailedException { String acquisitionName = PathAddress.pathAddress(operation.get(ModelDescriptionConstants.ADDRESS)).getLastElement().getValue(); MscRuntimeContainerJobExecutor mscRuntimeContainerJobExecutor = new MscRuntimeContainerJobExecutor(); if (model.hasDefined(SubsystemAttributeDefinitons.PROPERTIES.getName())) {
List<Property> properties = SubsystemAttributeDefinitons.PROPERTIES.resolveModelAttribute(context, model).asPropertyList(); for (Property property : properties) { PropertyHelper.applyProperty(mscRuntimeContainerJobExecutor, property.getName(), property.getValue().asString()); } } // start new service for job executor ServiceController<RuntimeContainerJobExecutor> serviceController = context.getServiceTarget().addService(ServiceNames.forMscRuntimeContainerJobExecutorService(acquisitionName), mscRuntimeContainerJobExecutor) .addDependency(ServiceNames.forMscRuntimeContainerDelegate()) .addDependency(ServiceNames.forMscExecutorService()) .setInitialMode(Mode.ACTIVE) .install(); } }
repos\camunda-bpm-platform-master\distro\wildfly26\subsystem\src\main\java\org\camunda\bpm\container\impl\jboss\extension\handler\JobAcquisitionAdd.java
1
请在Spring Boot框架中完成以下Java代码
public void process(final Exchange exchange) { // i'm sure that there are better ways, but we want the EDIFeedbackRoute to identify that the error is coming from *this* route. exchange.getIn().setHeader(EDIXmlFeedbackHelper.HEADER_ROUTE_ID, ROUTE_ID); final EDIExpDesadvType xmlDesadv = exchange.getIn().getBody(EDIExpDesadvType.class); // throw exceptions if mandatory fields are missing exchange.getIn().setHeader(EDIXmlFeedbackHelper.HEADER_ADClientValueAttr, xmlDesadv.getADClientValueAttr()); exchange.getIn().setHeader(EDIXmlFeedbackHelper.HEADER_RecordID, xmlDesadv.getEDIDesadvID().longValue()); } }) .log(LoggingLevel.INFO, "EDI: Converting XML Java Object -> EDI Java Object...") .bean(CompuDataDesadvBean.class, AbstractEDIDesadvCommonBean.METHOD_createEDIData) .log(LoggingLevel.INFO, "EDI: Marshalling EDI Java Object to EDI Format using SDF...") .marshal(sdf)
.log(LoggingLevel.INFO, "EDI: Setting output filename pattern from properties...") .setHeader(Exchange.FILE_NAME).simple(desadvFilenamePattern) .log(LoggingLevel.INFO, "EDI: Sending the EDI file to the FILE component...") .to("{{" + CompuDataDesadvRoute.EP_EDI_FILE_DESADV + "}}") .log(LoggingLevel.INFO, "EDI: Creating metasfresh feedback XML Java Object...") .process(new EDIXmlSuccessFeedbackProcessor<EDIDesadvFeedbackType>(EDIDesadvFeedbackType.class, CompuDataDesadvRoute.EDIDesadvFeedback_QNAME, CompuDataDesadvRoute.METHOD_setEDIDesadvID)) .log(LoggingLevel.INFO, "EDI: Marshalling XML Java Object feedback -> XML document...") .marshal(jaxb) .log(LoggingLevel.INFO, "EDI: Sending success response to metasfresh...") .setHeader(RabbitMQConstants.ROUTING_KEY).simple(feedbackMessageRoutingKey) // https://github.com/apache/camel/blob/master/components/camel-rabbitmq/src/main/docs/rabbitmq-component.adoc .setHeader(RabbitMQConstants.CONTENT_ENCODING).simple(StandardCharsets.UTF_8.name()) .to("{{" + Constants.EP_AMQP_TO_MF + "}}"); } }
repos\metasfresh-new_dawn_uat\misc\services\camel\de-metas-camel-edi\src\main\java\de\metas\edi\esb\desadvexport\compudata\CompuDataDesadvRoute.java
2
请在Spring Boot框架中完成以下Java代码
public class RestUrlBuilder { protected String baseUrl = ""; protected RestUrlBuilder() { } protected RestUrlBuilder(String baseUrl) { this.baseUrl = baseUrl; } public String getBaseUrl() { return baseUrl; } public String buildUrl(String[] fragments, Object... arguments) { return new StringBuilder(baseUrl).append("/").append(MessageFormat.format(StringUtils.join(fragments, '/'), arguments)).toString(); } /** Uses baseUrl as the base URL */ public static RestUrlBuilder usingBaseUrl(String baseUrl) { if (baseUrl == null) { throw new FlowableIllegalArgumentException("baseUrl can not be null");
} if (baseUrl.endsWith("/")) { baseUrl = baseUrl.substring(0, baseUrl.length() - 1); } return new RestUrlBuilder(baseUrl); } /** Extracts the base URL from the request */ public static RestUrlBuilder fromRequest(HttpServletRequest request) { return usingBaseUrl(ServletUriComponentsBuilder.fromServletMapping(request).build().toUriString()); } /** Extracts the base URL from current request */ public static RestUrlBuilder fromCurrentRequest() { return usingBaseUrl(ServletUriComponentsBuilder.fromCurrentServletMapping().build().toUriString()); } }
repos\flowable-engine-main\modules\flowable-event-registry-rest\src\main\java\org\flowable\eventregistry\rest\service\api\RestUrlBuilder.java
2
请完成以下Java代码
public void setAD_PrinterHW_MediaSize_ID (int AD_PrinterHW_MediaSize_ID) { if (AD_PrinterHW_MediaSize_ID < 1) set_Value (COLUMNNAME_AD_PrinterHW_MediaSize_ID, null); else set_Value (COLUMNNAME_AD_PrinterHW_MediaSize_ID, Integer.valueOf(AD_PrinterHW_MediaSize_ID)); } @Override public int getAD_PrinterHW_MediaSize_ID() { return get_ValueAsInt(COLUMNNAME_AD_PrinterHW_MediaSize_ID); } @Override public de.metas.printing.model.I_AD_PrinterHW_MediaTray getAD_PrinterHW_MediaTray() { return get_ValueAsPO(COLUMNNAME_AD_PrinterHW_MediaTray_ID, de.metas.printing.model.I_AD_PrinterHW_MediaTray.class); } @Override public void setAD_PrinterHW_MediaTray(de.metas.printing.model.I_AD_PrinterHW_MediaTray AD_PrinterHW_MediaTray) { set_ValueFromPO(COLUMNNAME_AD_PrinterHW_MediaTray_ID, de.metas.printing.model.I_AD_PrinterHW_MediaTray.class, AD_PrinterHW_MediaTray); } @Override public void setAD_PrinterHW_MediaTray_ID (int AD_PrinterHW_MediaTray_ID) { if (AD_PrinterHW_MediaTray_ID < 1) set_Value (COLUMNNAME_AD_PrinterHW_MediaTray_ID, null); else set_Value (COLUMNNAME_AD_PrinterHW_MediaTray_ID, Integer.valueOf(AD_PrinterHW_MediaTray_ID)); } @Override public int getAD_PrinterHW_MediaTray_ID() { return get_ValueAsInt(COLUMNNAME_AD_PrinterHW_MediaTray_ID); } @Override public void setCalX (int CalX) { set_Value (COLUMNNAME_CalX, Integer.valueOf(CalX)); } @Override public int getCalX() { return get_ValueAsInt(COLUMNNAME_CalX); } @Override public void setCalY (int CalY) { set_Value (COLUMNNAME_CalY, Integer.valueOf(CalY)); } @Override public int getCalY() { return get_ValueAsInt(COLUMNNAME_CalY); } @Override public void setHostKey (java.lang.String HostKey) {
throw new IllegalArgumentException ("HostKey is virtual column"); } @Override public java.lang.String getHostKey() { return (java.lang.String)get_Value(COLUMNNAME_HostKey); } @Override public void setIsManualCalibration (boolean IsManualCalibration) { set_Value (COLUMNNAME_IsManualCalibration, Boolean.valueOf(IsManualCalibration)); } @Override public boolean isManualCalibration() { return get_ValueAsBoolean(COLUMNNAME_IsManualCalibration); } @Override public void setMeasurementX (java.math.BigDecimal MeasurementX) { set_Value (COLUMNNAME_MeasurementX, MeasurementX); } @Override public java.math.BigDecimal getMeasurementX() { BigDecimal bd = get_ValueAsBigDecimal(COLUMNNAME_MeasurementX); return bd != null ? bd : BigDecimal.ZERO; } @Override public void setMeasurementY (java.math.BigDecimal MeasurementY) { set_Value (COLUMNNAME_MeasurementY, MeasurementY); } @Override public java.math.BigDecimal getMeasurementY() { BigDecimal bd = get_ValueAsBigDecimal(COLUMNNAME_MeasurementY); return bd != null ? bd : BigDecimal.ZERO; } }
repos\metasfresh-new_dawn_uat\backend\de.metas.printing\de.metas.printing.base\src\main\java-gen\de\metas\printing\model\X_AD_PrinterHW_Calibration.java
1
请完成以下Java代码
public static <T> CommonResult<T> validateFailed() { return failed(ResultCode.VALIDATE_FAILED); } /** * 参数验证失败返回结果 * @param message 提示信息 */ public static <T> CommonResult<T> validateFailed(String message) { return new CommonResult<T>(ResultCode.VALIDATE_FAILED.getCode(), message, null); } /** * 未登录返回结果 */ public static <T> CommonResult<T> unauthorized(T data) { return new CommonResult<T>(ResultCode.UNAUTHORIZED.getCode(), ResultCode.UNAUTHORIZED.getMessage(), data); } /** * 未授权返回结果 */ public static <T> CommonResult<T> forbidden(T data) { return new CommonResult<T>(ResultCode.FORBIDDEN.getCode(), ResultCode.FORBIDDEN.getMessage(), data); } public long getCode() { return code; } public void setCode(long code) {
this.code = code; } public String getMessage() { return message; } public void setMessage(String message) { this.message = message; } public T getData() { return data; } public void setData(T data) { this.data = data; } }
repos\mall-master\mall-common\src\main\java\com\macro\mall\common\api\CommonResult.java
1
请完成以下Java代码
public class ChequeDeliveryMethod1Choice { @XmlElement(name = "Cd") @XmlSchemaType(name = "string") protected ChequeDelivery1Code cd; @XmlElement(name = "Prtry") protected String prtry; /** * Gets the value of the cd property. * * @return * possible object is * {@link ChequeDelivery1Code } * */ public ChequeDelivery1Code getCd() { return cd; } /** * Sets the value of the cd property. * * @param value * allowed object is * {@link ChequeDelivery1Code } * */ public void setCd(ChequeDelivery1Code value) { this.cd = value; } /** * Gets the value of the prtry property. *
* @return * possible object is * {@link String } * */ public String getPrtry() { return prtry; } /** * Sets the value of the prtry property. * * @param value * allowed object is * {@link String } * */ public void setPrtry(String value) { this.prtry = value; } }
repos\metasfresh-new_dawn_uat\backend\de.metas.payment.sepa\schema-pain_001_01_03_ch_02\src\main\java-xjc\de\metas\payment\sepa\jaxb\sct\pain_001_001_03_ch_02\ChequeDeliveryMethod1Choice.java
1
请完成以下Java代码
public PartyIdentification32 getOwnr() { return ownr; } /** * Sets the value of the ownr property. * * @param value * allowed object is * {@link PartyIdentification32 } * */ public void setOwnr(PartyIdentification32 value) { this.ownr = value; } /** * Gets the value of the svcr property. * * @return * possible object is * {@link BranchAndFinancialInstitutionIdentification4 } * */ public BranchAndFinancialInstitutionIdentification4 getSvcr() {
return svcr; } /** * Sets the value of the svcr property. * * @param value * allowed object is * {@link BranchAndFinancialInstitutionIdentification4 } * */ public void setSvcr(BranchAndFinancialInstitutionIdentification4 value) { this.svcr = value; } }
repos\metasfresh-new_dawn_uat\backend\de.metas.banking\de.metas.banking.camt53\src\main\java-xjc\de\metas\banking\camt53\jaxb\camt053_001_02\CashAccount20.java
1
请完成以下Java代码
public String toString() { return "CloseableCollector[" + collector + "]"; } private void open() { if (THREAD_LOCAL_COLLECTOR.get() != null) { throw new AdempiereException("A thread level collector was already set"); } THREAD_LOCAL_COLLECTOR.set(collector); } @Override
public void close() { if (closed.getAndSet(true)) { return; // already closed } THREAD_LOCAL_COLLECTOR.set(null); sendAllAndClose(collector, websocketSender); } @VisibleForTesting ImmutableList<JSONDocumentChangedWebSocketEvent> getEvents() {return collector.getEvents();} } }
repos\metasfresh-new_dawn_uat\backend\de.metas.ui.web.base\src\main\java\de\metas\ui\web\window\events\DocumentWebsocketPublisher.java
1
请完成以下Java代码
public boolean isInOrStatement() { return inOrStatement; } public boolean isFinished() { return finished; } public boolean isUnfinished() { return unfinished; } public String getTaskName() { return taskName; } public String getTaskNameLike() { return taskNameLike; } public List<String> getTaskNameList() { return taskNameList; } public List<String> getTaskNameListIgnoreCase() { return taskNameListIgnoreCase; } public String getTaskDescription() { return taskDescription; } public String getTaskDescriptionLike() { return taskDescriptionLike; } public String getTaskDeleteReason() { return taskDeleteReason; } public String getTaskDeleteReasonLike() { return taskDeleteReasonLike; } public List<String> getTaskAssigneeIds() { return taskAssigneeIds; } public String getTaskAssignee() { return taskAssignee; } public String getTaskAssigneeLike() { return taskAssigneeLike; } public String getTaskId() { return taskId; } public String getTaskDefinitionKey() { return taskDefinitionKey; }
public String getTaskOwnerLike() { return taskOwnerLike; } public String getTaskOwner() { return taskOwner; } public String getTaskParentTaskId() { return taskParentTaskId; } public Date getCreationDate() { return creationDate; } public String getCandidateUser() { return candidateUser; } public String getCandidateGroup() { return candidateGroup; } public String getInvolvedUser() { return involvedUser; } public List<String> getInvolvedGroups() { return involvedGroups; } public String getProcessDefinitionKeyLikeIgnoreCase() { return processDefinitionKeyLikeIgnoreCase; } public String getProcessInstanceBusinessKeyLikeIgnoreCase() { return processInstanceBusinessKeyLikeIgnoreCase; } public String getTaskNameLikeIgnoreCase() { return taskNameLikeIgnoreCase; } public String getTaskDescriptionLikeIgnoreCase() { return taskDescriptionLikeIgnoreCase; } public String getTaskOwnerLikeIgnoreCase() { return taskOwnerLikeIgnoreCase; } public String getTaskAssigneeLikeIgnoreCase() { return taskAssigneeLikeIgnoreCase; } public String getLocale() { return locale; } public List<HistoricTaskInstanceQueryImpl> getOrQueryObjects() { return orQueryObjects; } }
repos\Activiti-develop\activiti-core\activiti-engine\src\main\java\org\activiti\engine\impl\HistoricTaskInstanceQueryImpl.java
1
请完成以下Java代码
public int getC_Campaign_ID() { if (m_ioLine == null) { return 0; } return m_ioLine.getC_Campaign_ID(); } /** * Get Org Trx * * @return Org Trx if based on shipment line and 0 for charge based */ public int getAD_OrgTrx_ID() { if (m_ioLine == null) { return 0; } return m_ioLine.getAD_OrgTrx_ID(); } /** * Get User1 * * @return user1 if based on shipment line and 0 for charge based */ public int getUser1_ID() { if (m_ioLine == null) { return 0; } return m_ioLine.getUser1_ID(); } /** * Get User2 * * @return user2 if based on shipment line and 0 for charge based */ public int getUser2_ID() { if (m_ioLine == null) { return 0; } return m_ioLine.getUser2_ID(); } /** * Get Attribute Set Instance * * @return ASI if based on shipment line and 0 for charge based */ public int getM_AttributeSetInstance_ID() {
if (m_ioLine == null) { return 0; } return m_ioLine.getM_AttributeSetInstance_ID(); } /** * Get Locator * * @return locator if based on shipment line and 0 for charge based */ public int getM_Locator_ID() { if (m_ioLine == null) { return 0; } return m_ioLine.getM_Locator_ID(); } /** * Get Tax * * @return Tax based on Invoice/Order line and Tax exempt for charge based */ public int getC_Tax_ID() { return taxId; } } // MRMALine
repos\metasfresh-new_dawn_uat\backend\de.metas.business\src\main\java-legacy\org\compiere\model\MRMALine.java
1
请在Spring Boot框架中完成以下Java代码
class SyncBPartnerImportService extends AbstractSyncImportService { private final BPartnerRepository bpartnersRepo; private final SyncContractListImportService contractsListImportService; private final SyncUserImportService usersImportService; private final SyncRfqImportService rfqImportService; public SyncBPartnerImportService( @NonNull final BPartnerRepository bpartnersRepo, @NonNull final SyncContractListImportService contractsListImportService, @NonNull final SyncUserImportService usersImportService, @NonNull final SyncRfqImportService rfqImportService) { this.bpartnersRepo = bpartnersRepo; this.contractsListImportService = contractsListImportService; this.usersImportService = usersImportService; this.rfqImportService = rfqImportService; } public void importBPartner(final SyncBPartner syncBpartner) { // // Import the BPartner only final BPartner bpartner = importBPartnerNoCascade(syncBpartner); if (bpartner == null) { return; } // // Users usersImportService.importUsers(bpartner, syncBpartner.getUsers()); // // Contracts if (syncBpartner.isSyncContracts()) { try { contractsListImportService.importContracts(bpartner, syncBpartner.getContracts()); } catch (final Exception ex) { logger.warn("Failed importing contracts for {}. Skipped", bpartner, ex); } } // // RfQs try { final List<SyncRfQ> rfqs = syncBpartner.getRfqs(); rfqImportService.importRfQs(bpartner, rfqs); } catch (final Exception ex) { logger.warn("Failed importing contracts for {}. Skipped", bpartner, ex); } }
@Nullable private BPartner importBPartnerNoCascade(final SyncBPartner syncBpartner) { // // BPartner BPartner bpartner = bpartnersRepo.findByUuid(syncBpartner.getUuid()); // // Handle delete request if (syncBpartner.isDeleted()) { if (bpartner != null) { deleteBPartner(bpartner); } return bpartner; } if (bpartner == null) { bpartner = new BPartner(); bpartner.setUuid(syncBpartner.getUuid()); } bpartner.setDeleted(false); bpartner.setName(syncBpartner.getName()); bpartnersRepo.save(bpartner); logger.debug("Imported: {} -> {}", syncBpartner, bpartner); return bpartner; } private void deleteBPartner(final BPartner bpartner) { if (bpartner.isDeleted()) { return; } bpartner.setDeleted(true); bpartnersRepo.save(bpartner); logger.debug("Deleted: {}", bpartner); } }
repos\metasfresh-new_dawn_uat\misc\services\procurement-webui\procurement-webui-backend\src\main\java\de\metas\procurement\webui\sync\SyncBPartnerImportService.java
2
请完成以下Java代码
public class OrderAttachmentViewFactory implements IViewFactory { public static final String OrderAttachmentView_String = "OrderAttachmentView"; public static final WindowId WINDOWID = WindowId.fromJson(OrderAttachmentView_String); private final AttachmentEntryService attachmentEntryService; private final OrderAttachmentRowsRepository rowsRepo; public OrderAttachmentViewFactory( @NonNull final AttachmentEntryService attachmentEntryService, @NonNull final AlbertaPrescriptionRequestDAO albertaPrescriptionRequestDAO, @NonNull final AttachmentEntryRepository attachmentEntryRepository, @NonNull final AlbertaPatientRepository albertaPatientRepository, @NonNull final PurchaseCandidateRepository purchaseCandidateRepository, @NonNull final LookupDataSourceFactory lookupDataSourceFactory) { this.attachmentEntryService = attachmentEntryService; this.rowsRepo = OrderAttachmentRowsRepository.builder() .albertaPrescriptionRequestDAO(albertaPrescriptionRequestDAO) .attachmentEntryRepository(attachmentEntryRepository) .albertaPatientRepository(albertaPatientRepository) .purchaseCandidateRepository(purchaseCandidateRepository) .lookupDataSourceFactory(lookupDataSourceFactory) .build(); } @Override public IView createView(@NonNull final CreateViewRequest request) { final ViewId viewId = request.getViewId(); viewId.assertWindowId(WINDOWID); final OrderId orderId = request.getParameterAs(PARAM_PURCHASE_ORDER_ID, OrderId.class); Check.assumeNotNull(orderId, PARAM_PURCHASE_ORDER_ID + " is mandatory!"); final OrderAttachmentRows rows = rowsRepo.getByPurchaseOrderId(orderId);
return OrderAttachmentView.builder() .attachmentEntryService(attachmentEntryService) .viewId(viewId) .rows(rows) .build(); } @Override public ViewLayout getViewLayout(final WindowId windowId, final JSONViewDataType viewDataType, final ViewProfileId profileId) { return ViewLayout.builder() .setWindowId(WINDOWID) .setCaption(Services.get(IMsgBL.class).translatable(I_C_Order.COLUMNNAME_C_Order_ID)) .setAllowOpeningRowDetails(false) .allowViewCloseAction(ViewCloseAction.DONE) .addElementsFromViewRowClass(OrderAttachmentRow.class, viewDataType) .build(); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.ui.web.base\src\main\java\de\metas\ui\web\order\attachmenteditor\OrderAttachmentViewFactory.java
1
请完成以下Java代码
public void handleChildCompletion(CmmnActivityExecution execution, CmmnActivityExecution child) { fireForceUpdate(execution); if (execution.isActive()) { checkAndCompleteCaseExecution(execution); } } public void handleChildDisabled(CmmnActivityExecution execution, CmmnActivityExecution child) { fireForceUpdate(execution); if (execution.isActive()) { checkAndCompleteCaseExecution(execution); } } public void handleChildSuspension(CmmnActivityExecution execution, CmmnActivityExecution child) { // if the given execution is not suspending currently, then ignore this notification. if (execution.isSuspending() && isAbleToSuspend(execution)) { String id = execution.getId(); CaseExecutionState currentState = execution.getCurrentState(); if (SUSPENDING_ON_SUSPENSION.equals(currentState)) { execution.performSuspension(); } else if (SUSPENDING_ON_PARENT_SUSPENSION.equals(currentState)) { execution.performParentSuspension(); } else { throw LOG.suspendCaseException(id, currentState); } } } public void handleChildTermination(CmmnActivityExecution execution, CmmnActivityExecution child) { fireForceUpdate(execution); if (execution.isActive()) { checkAndCompleteCaseExecution(execution); } else if (execution.isTerminating() && isAbleToTerminate(execution)) { String id = execution.getId(); CaseExecutionState currentState = execution.getCurrentState(); if (TERMINATING_ON_TERMINATION.equals(currentState)) { execution.performTerminate(); } else if (TERMINATING_ON_EXIT.equals(currentState)) { execution.performExit();
} else if (TERMINATING_ON_PARENT_TERMINATION.equals(currentState)) { throw LOG.illegalStateTransitionException("parentTerminate", id, getTypeName()); } else { throw LOG.terminateCaseException(id, currentState); } } } protected void checkAndCompleteCaseExecution(CmmnActivityExecution execution) { if (canComplete(execution)) { execution.complete(); } } protected void fireForceUpdate(CmmnActivityExecution execution) { if (execution instanceof CaseExecutionEntity) { CaseExecutionEntity entity = (CaseExecutionEntity) execution; entity.forceUpdate(); } } protected String getTypeName() { return "stage"; } }
repos\camunda-bpm-platform-master\engine\src\main\java\org\camunda\bpm\engine\impl\cmmn\behavior\StageActivityBehavior.java
1
请在Spring Boot框架中完成以下Java代码
public class JwtSigner implements UserTokenProvider { private final KeyPair keyPair = Keys.keyPairFor(SignatureAlgorithm.RS256); private final JwtParser jwtParser = Jwts.parserBuilder() .setSigningKey(keyPair.getPublic()) .build(); private final JwtProperties jwtProperties; public Jws<Claims> validate(String jwt) { return jwtParser.parseClaimsJws(jwt); } public String generateToken(String userId) { return Jwts.builder() .signWith(keyPair.getPrivate(), SignatureAlgorithm.RS256) .setSubject(userId) .setExpiration(expirationDate())
.compact(); } private Date expirationDate() { var expirationDate = System.currentTimeMillis() + getSessionTime(); return new Date(expirationDate); } private long getSessionTime() { return jwtProperties.getSessionTime() * 1000L; } @Override public String getToken(String userId) { return generateToken(userId); } }
repos\realworld-spring-webflux-master\src\main\java\com\realworld\springmongo\security\JwtSigner.java
2
请完成以下Java代码
public String getTargetTableName() { return targetTableName; } public void setTargetTableName(String targetTableName) { this.targetTableName = targetTableName; } public Set<String> getTargetKeyColumns() { return targetKeyColumns; } public void setTargetKeyColumns(String... columns) { final Set<String> s = new HashSet<String>(); for (String c : columns) s.add(c); this.targetKeyColumns = s; } public String getSql() { return sql; } public void setSql(String sql) { this.sql = sql; } public void addSourceTable(String tableName, String... columns) { Set<String> s = new HashSet<String>(); for (String c : columns) s.add(c); sourceTables.put(tableName, s); } public Set<String> getSourceTables() { return sourceTables.keySet(); }
public Set<String> getSourceColumns(String sourceTableName) { return sourceTables.get(sourceTableName); } public void addRelation(String sourceTableName, String targetTableName, String whereClause) { final MultiKey key = new MultiKey(sourceTableName, targetTableName); relations.put(key, whereClause); } public String getRelationWhereClause(String sourceTableName, String targetTableName) { final MultiKey key = new MultiKey(sourceTableName, targetTableName); return relations.get(key); } @Override public String toString() { return "MViewMetadata [targetTableName=" + targetTableName + ", targetKeyColumns=" + targetKeyColumns + ", sourceTables=" + sourceTables + ", sql=" + sql + "]"; } }
repos\metasfresh-new_dawn_uat\backend\de.metas.swat\de.metas.swat.base\src\main\java\de\metas\adempiere\engine\MViewMetadata.java
1
请完成以下Java代码
public void setDropShip_Location_Value_ID(final int DropShip_Location_Value_ID) { delegate.setDropShip_Location_Value_ID(DropShip_Location_Value_ID); } @Override public int getDropShip_User_ID() { return delegate.getDropShip_User_ID(); } @Override public void setDropShip_User_ID(final int DropShip_User_ID) { delegate.setDropShip_User_ID(DropShip_User_ID); } @Override public void setRenderedAddressAndCapturedLocation(final @NonNull RenderedAddressAndCapturedLocation from) { IDocumentDeliveryLocationAdapter.super.setRenderedAddressAndCapturedLocation(from); } @Override public void setRenderedAddress(final @NonNull RenderedAddressAndCapturedLocation from) { IDocumentDeliveryLocationAdapter.super.setRenderedAddress(from); }
@Override public Optional<DocumentLocation> toPlainDocumentLocation(final IDocumentLocationBL documentLocationBL) { return documentLocationBL.toPlainDocumentLocation(this); } @Override public DropShipLocationAdapter toOldValues() { InterfaceWrapperHelper.assertNotOldValues(delegate); return new DropShipLocationAdapter(InterfaceWrapperHelper.createOld(delegate, I_C_OLCand.class)); } @Override public I_C_OLCand getWrappedRecord() { return delegate; } }
repos\metasfresh-new_dawn_uat\backend\de.metas.salescandidate.base\src\main\java\de\metas\ordercandidate\location\adapter\DropShipLocationAdapter.java
1
请完成以下Java代码
public static String gensalt(int log_rounds) throws IllegalArgumentException { return gensalt(log_rounds, new SecureRandom()); } public static String gensalt(String prefix) { return gensalt(prefix, GENSALT_DEFAULT_LOG2_ROUNDS); } /** * Generate a salt for use with the BCrypt.hashpw() method, selecting a reasonable * default for the number of hashing rounds to apply * @return an encoded salt value */ public static String gensalt() { return gensalt(GENSALT_DEFAULT_LOG2_ROUNDS); } /** * Check that a plaintext password matches a previously hashed one * @param plaintext the plaintext password to verify * @param hashed the previously-hashed password * @return true if the passwords match, false otherwise */ public static boolean checkpw(String plaintext, String hashed) { byte[] passwordb = plaintext.getBytes(StandardCharsets.UTF_8);
return equalsNoEarlyReturn(hashed, hashpwforcheck(passwordb, hashed)); } /** * Check that a password (as a byte array) matches a previously hashed one * @param passwordb the password to verify, as a byte array * @param hashed the previously-hashed password * @return true if the passwords match, false otherwise * @since 5.3 */ public static boolean checkpw(byte[] passwordb, String hashed) { return equalsNoEarlyReturn(hashed, hashpwforcheck(passwordb, hashed)); } static boolean equalsNoEarlyReturn(String a, String b) { return MessageDigest.isEqual(a.getBytes(StandardCharsets.UTF_8), b.getBytes(StandardCharsets.UTF_8)); } }
repos\spring-security-main\crypto\src\main\java\org\springframework\security\crypto\bcrypt\BCrypt.java
1
请完成以下Spring Boot application配置
spring: cloud: stream: default: producer: useNativeEncoding: true consumer: useNativeEncoding: true bindings: input: destination: employee-details content-type: application/*+avro group: group-1 concurrency: 3 output: destination: employee-details content-type: application/*+avro kafka: binder: producer-properties: key.serializer: io.confluent.kafka.serializers.KafkaAvroSerializer value.serializer: io.confluent.kafka.serializers.KafkaAvroSerializer schema.registry.url: http://localhost:
8081 consumer-properties: key.deserializer: io.confluent.kafka.serializers.KafkaAvroDeserializer value.deserializer: io.confluent.kafka.serializers.KafkaAvroDeserializer schema.registry.url: http://localhost:8081 specific.avro.reader: true
repos\tutorials-master\spring-cloud-modules\spring-cloud-stream\spring-cloud-stream-kafka\src\main\resources\application.yaml
2
请在Spring Boot框架中完成以下Java代码
public Response retrieveCard() { httpRequestCounter.add(1, Attributes.builder().put("endpoint", "/trivia").build()); Span span = tracer.spanBuilder("retreive_card") .setAttribute("http.method", "GET") .setAttribute("http.url", WORD_SERVICE_URL) .setSpanKind(SpanKind.CLIENT).startSpan(); try (Scope scope = span.makeCurrent()) { Instant start = Instant.now(); span.addEvent("http.request.word-api", start); WordResponse wordResponse = triviaService.requestWordFromSource(Context.current().with(span), WORD_SERVICE_URL);
span.setAttribute("http.status_code", wordResponse.httpResponseCode()); logger.info("word-api response payload: {}", wordResponse.wordWithDefinition()); return Response.ok(wordResponse.wordWithDefinition()).build(); } catch(IOException exception) { span.setStatus(StatusCode.ERROR, "Error retreiving info from dictionary service"); span.recordException(exception); logger.error("Error while calling dictionary service", exception); return Response.noContent().build(); } finally { span.end(); } } }
repos\tutorials-master\libraries-open-telemetry\otel-collector\trivia-service\src\main\java\com\baeldung\TriviaResource.java
2
请完成以下Java代码
public class CompositeRecordInterceptor<K, V> implements RecordInterceptor<K, V> { private final Collection<RecordInterceptor<K, V>> delegates = new ArrayList<>(); /** * Construct an instance with the provided delegates. * @param delegates the delegates. */ @SafeVarargs @SuppressWarnings("varargs") public CompositeRecordInterceptor(RecordInterceptor<K, V>... delegates) { Assert.notNull(delegates, "'delegates' cannot be null"); Assert.noNullElements(delegates, "'delegates' cannot have null entries"); this.delegates.addAll(Arrays.asList(delegates)); } @Override @Nullable public ConsumerRecord<K, V> intercept(ConsumerRecord<K, V> record, Consumer<K, V> consumer) { ConsumerRecord<K, V> recordToIntercept = record; for (RecordInterceptor<K, V> delegate : this.delegates) { recordToIntercept = delegate.intercept(recordToIntercept, consumer); if (recordToIntercept == null) { break; } } return recordToIntercept; } @Override public void success(ConsumerRecord<K, V> record, Consumer<K, V> consumer) { this.delegates.forEach(del -> del.success(record, consumer)); } @Override
public void failure(ConsumerRecord<K, V> record, Exception exception, Consumer<K, V> consumer) { this.delegates.forEach(del -> del.failure(record, exception, consumer)); } @Override public void setupThreadState(Consumer<?, ?> consumer) { this.delegates.forEach(del -> del.setupThreadState(consumer)); } @Override public void clearThreadState(Consumer<?, ?> consumer) { this.delegates.forEach(del -> del.clearThreadState(consumer)); } @Override public void afterRecord(ConsumerRecord<K, V> record, Consumer<K, V> consumer) { this.delegates.forEach(del -> del.afterRecord(record, consumer)); } /** * Add an {@link RecordInterceptor} to delegates. * @param recordInterceptor the interceptor. * @since 4.0 */ public void addRecordInterceptor(RecordInterceptor<K, V> recordInterceptor) { this.delegates.add(recordInterceptor); } }
repos\spring-kafka-main\spring-kafka\src\main\java\org\springframework\kafka\listener\CompositeRecordInterceptor.java
1
请完成以下Java代码
public Class<? extends SuspendedJobEntity> getManagedEntityClass() { return SuspendedJobEntityImpl.class; } @Override public SuspendedJobEntity create() { return new SuspendedJobEntityImpl(); } @Override @SuppressWarnings("unchecked") public List<Job> findJobsByQueryCriteria(SuspendedJobQueryImpl jobQuery, Page page) { String query = "selectSuspendedJobByQueryCriteria"; return getDbSqlSession().selectList(query, jobQuery, page); } @Override public long findJobCountByQueryCriteria(SuspendedJobQueryImpl jobQuery) { return (Long) getDbSqlSession().selectOne("selectSuspendedJobCountByQueryCriteria", jobQuery); } @Override public List<SuspendedJobEntity> findJobsByExecutionId(final String executionId) {
return getList("selectSuspendedJobsByExecutionId", executionId, suspendedJobsByExecutionIdMatcher, true); } @Override @SuppressWarnings("unchecked") public List<SuspendedJobEntity> findJobsByProcessInstanceId(final String processInstanceId) { return getDbSqlSession().selectList("selectSuspendedJobsByProcessInstanceId", processInstanceId); } @Override public void updateJobTenantIdForDeployment(String deploymentId, String newTenantId) { HashMap<String, Object> params = new HashMap<String, Object>(); params.put("deploymentId", deploymentId); params.put("tenantId", newTenantId); getDbSqlSession().update("updateSuspendedJobTenantIdForDeployment", params); } }
repos\Activiti-develop\activiti-core\activiti-engine\src\main\java\org\activiti\engine\impl\persistence\entity\data\impl\MybatisSuspendedJobDataManager.java
1
请在Spring Boot框架中完成以下Java代码
public void putMediaConvertCache(String key, String value) { RMapCache<String, String> convertedList = redissonClient.getMapCache(FILE_PREVIEW_MEDIA_CONVERT_KEY); convertedList.fastPut(key, value); } @Override public String getMediaConvertCache(String key) { RMapCache<String, String> convertedList = redissonClient.getMapCache(FILE_PREVIEW_MEDIA_CONVERT_KEY); return convertedList.get(key); } @Override public void cleanCache() { cleanPdfCache(); cleanImgCache(); cleanPdfImgCache(); cleanMediaConvertCache(); } @Override public void addQueueTask(String url) { RBlockingQueue<String> queue = redissonClient.getBlockingQueue(TASK_QUEUE_NAME); queue.addAsync(url); } @Override public String takeQueueTask() throws InterruptedException { RBlockingQueue<String> queue = redissonClient.getBlockingQueue(TASK_QUEUE_NAME); return queue.take(); } private void cleanPdfCache() {
RMapCache<String, String> pdfCache = redissonClient.getMapCache(FILE_PREVIEW_PDF_KEY); pdfCache.clear(); } private void cleanImgCache() { RMapCache<String, List<String>> imgCache = redissonClient.getMapCache(FILE_PREVIEW_IMGS_KEY); imgCache.clear(); } private void cleanPdfImgCache() { RMapCache<String, Integer> pdfImg = redissonClient.getMapCache(FILE_PREVIEW_PDF_IMGS_KEY); pdfImg.clear(); } private void cleanMediaConvertCache() { RMapCache<String, Integer> mediaConvertCache = redissonClient.getMapCache(FILE_PREVIEW_MEDIA_CONVERT_KEY); mediaConvertCache.clear(); } }
repos\kkFileView-master\server\src\main\java\cn\keking\service\cache\impl\CacheServiceRedisImpl.java
2
请完成以下Java代码
boolean isMatching(final AddToResultGroupRequest request) { if (!product.isMatching(request.getProductId().getRepoId())) { return false; } if (!warehouse.isMatching(request.getWarehouseId())) { return false; } return storageAttributesKeyMatcher.matches(request.getStorageAttributesKey()); } public void addQtyToAllMatchingGroups(@NonNull final AddToResultGroupRequest request) { if (!isMatching(request)) { return; } boolean addedToAtLeastOneGroup = false; for (final AvailableForSaleResultGroupBuilder group : groups) { if (!isGroupMatching(group, request)) { continue; } if (!group.isAlreadyIncluded(request)) { group.addQty(request); } addedToAtLeastOneGroup = true; } if (!addedToAtLeastOneGroup) { final AttributesKey storageAttributesKey = storageAttributesKeyMatcher.toAttributeKeys(request.getStorageAttributesKey()); final AvailableForSaleResultGroupBuilder group = newGroup(request, storageAttributesKey); group.addQty(request); } } private boolean isGroupAttributesKeyMatching( @NonNull final AvailableForSaleResultGroupBuilder group, @NonNull final AttributesKey requestStorageAttributesKey) { final AttributesKey groupAttributesKey = group.getStorageAttributesKey(); if (groupAttributesKey.isAll()) { return true; } else if (groupAttributesKey.isOther()) { // accept it. We assume that the actual matching was done on Bucket level and not on Group level return true; } else if (groupAttributesKey.isNone())
{ // shall not happen return false; } else { final AttributesKeyPattern groupAttributePattern = AttributesKeyPatternsUtil.ofAttributeKey(groupAttributesKey); return groupAttributePattern.matches(requestStorageAttributesKey); } } private AvailableForSaleResultGroupBuilder newGroup( @NonNull final AddToResultGroupRequest request, @NonNull final AttributesKey storageAttributesKey) { final AvailableForSaleResultGroupBuilder group = AvailableForSaleResultGroupBuilder.builder() .productId(request.getProductId()) .storageAttributesKey(storageAttributesKey) .warehouseId(request.getWarehouseId()) .build(); groups.add(group); return group; } public void addDefaultEmptyGroupIfPossible() { if (product.isAny()) { return; } final AttributesKey defaultAttributesKey = this.storageAttributesKeyMatcher.toAttributeKeys().orElse(null); if (defaultAttributesKey == null) { return; } final WarehouseId warehouseId = warehouse.getWarehouseId(); if (warehouseId == null) { return; } final AvailableForSaleResultGroupBuilder group = AvailableForSaleResultGroupBuilder.builder() .productId(ProductId.ofRepoId(product.getProductId())) .storageAttributesKey(defaultAttributesKey) .warehouseId(warehouseId) .build(); groups.add(group); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.material\cockpit\src\main\java\de\metas\material\cockpit\availableforsales\AvailableForSaleResultBucket.java
1
请完成以下Java代码
public List<ActivatePlanItemDefinitionMapping> getActivatePlanItemDefinitionMappings() { return activatePlanItemDefinitionMappings; } @Override public List<TerminatePlanItemDefinitionMapping> getTerminatePlanItemDefinitionMappings() { return terminatePlanItemDefinitionMappings; } @Override public List<MoveToAvailablePlanItemDefinitionMapping> getMoveToAvailablePlanItemDefinitionMappings() { return moveToAvailablePlanItemDefinitionMappings; } @Override public List<WaitingForRepetitionPlanItemDefinitionMapping> getWaitingForRepetitionPlanItemDefinitionMappings() { return waitingForRepetitionPlanItemDefinitionMappings; } @Override public List<RemoveWaitingForRepetitionPlanItemDefinitionMapping> getRemoveWaitingForRepetitionPlanItemDefinitionMappings() { return removeWaitingForRepetitionPlanItemDefinitionMappings; } @Override public List<ChangePlanItemIdMapping> getChangePlanItemIdMappings() { return changePlanItemIdMappings; } @Override public List<ChangePlanItemIdWithDefinitionIdMapping> getChangePlanItemIdWithDefinitionIdMappings() { return changePlanItemIdWithDefinitionIdMappings; } @Override public List<ChangePlanItemDefinitionWithNewTargetIdsMapping> getChangePlanItemDefinitionWithNewTargetIdsMappings() { return changePlanItemDefinitionWithNewTargetIdsMappings; } @Override
public String getPreUpgradeExpression() { return preUpgradeExpression; } @Override public String getPostUpgradeExpression() { return postUpgradeExpression; } @Override public Map<String, Map<String, Object>> getPlanItemLocalVariables() { return this.planItemLocalVariables; } @Override public Map<String, Object> getCaseInstanceVariables() { return this.caseInstanceVariables; } @Override public String asJsonString() { return CaseInstanceMigrationDocumentConverter.convertToJsonString(this); } }
repos\flowable-engine-main\modules\flowable-cmmn-engine\src\main\java\org\flowable\cmmn\engine\impl\migration\CaseInstanceMigrationDocumentImpl.java
1
请在Spring Boot框架中完成以下Java代码
public int getVersion() { return version; } public void setVersion(int version) { this.version = version; } public String getResourceName() { return resourceName; } public void setResourceName(String resourceName) { this.resourceName = resourceName; }
public String getDeploymentId() { return deploymentId; } public void setDeploymentId(String deploymentId) { this.deploymentId = deploymentId; } public String getTenantId() { return tenantId; } public void setTenantId(String tenantId) { this.tenantId = tenantId; } }
repos\flowable-engine-main\modules\flowable-cmmn-rest\src\main\java\org\flowable\cmmn\rest\service\api\repository\FormDefinitionResponse.java
2
请完成以下Java代码
public long findTenantCountByQueryCriteria(DbTenantQueryImpl query) { configureQuery(query, Resources.TENANT); return (Long) getDbEntityManager().selectOne("selectTenantCountByQueryCriteria", query); } public List<Tenant> findTenantByQueryCriteria(DbTenantQueryImpl query) { configureQuery(query, Resources.TENANT); return getDbEntityManager().selectList("selectTenantByQueryCriteria", query); } //memberships ////////////////////////////////////////// protected boolean existsMembership(String userId, String groupId) { Map<String, String> key = new HashMap<>(); key.put("userId", userId); key.put("groupId", groupId); return ((Long) getDbEntityManager().selectOne("selectMembershipCount", key)) > 0; } protected boolean existsTenantMembership(String tenantId, String userId, String groupId) { Map<String, String> key = new HashMap<>(); key.put("tenantId", tenantId); if (userId != null) { key.put("userId", userId); }
if (groupId != null) { key.put("groupId", groupId); } return ((Long) getDbEntityManager().selectOne("selectTenantMembershipCount", key)) > 0; } //authorizations //////////////////////////////////////////////////// @Override protected void configureQuery(@SuppressWarnings("rawtypes") AbstractQuery query, Resource resource) { Context.getCommandContext() .getAuthorizationManager() .configureQuery(query, resource); } @Override protected void checkAuthorization(Permission permission, Resource resource, String resourceId) { Context.getCommandContext() .getAuthorizationManager() .checkAuthorization(permission, resource, resourceId); } }
repos\camunda-bpm-platform-master\engine\src\main\java\org\camunda\bpm\engine\impl\identity\db\DbReadOnlyIdentityServiceProvider.java
1
请完成以下Java代码
public boolean isCustomerReturn(@NonNull final org.compiere.model.I_M_InOut inout) { return huInOutBL.isCustomerReturn(inout); } public boolean isVendorReturn(@NonNull final org.compiere.model.I_M_InOut inout) { return huInOutBL.isVendorReturn(inout); } public boolean isEmptiesReturn(@NonNull final org.compiere.model.I_M_InOut inout) { return huInOutBL.isEmptiesReturn(inout); } public MultiCustomerHUReturnsResult createCustomerReturnInOutForHUs(final Collection<I_M_HU> shippedHUsToReturn) { return MultiCustomerHUReturnsInOutProducer.builder() .shippedHUsToReturn(shippedHUsToReturn) .build() .create(); } public void createVendorReturnInOutForHUs(final List<I_M_HU> hus, final Timestamp movementDate) { MultiVendorHUReturnsInOutProducer.newInstance() .setMovementDate(movementDate) .addHUsToReturn(hus) .create(); } public List<InOutId> createCustomerReturnsFromCandidates(@NonNull final List<CustomerReturnLineCandidate> candidates) { return customerReturnsWithoutHUsProducer.create(candidates); } public I_M_InOutLine createCustomerReturnLine(@NonNull final CreateCustomerReturnLineReq request) { return customerReturnsWithoutHUsProducer.createReturnLine(request); } public void assignHandlingUnitToHeaderAndLine( @NonNull final org.compiere.model.I_M_InOutLine customerReturnLine, @NonNull final I_M_HU hu) {
final ImmutableList<I_M_HU> hus = ImmutableList.of(hu); assignHandlingUnitsToHeaderAndLine(customerReturnLine, hus); } public void assignHandlingUnitsToHeaderAndLine( @NonNull final org.compiere.model.I_M_InOutLine customerReturnLine, @NonNull final List<I_M_HU> hus) { if (hus.isEmpty()) { return; } final InOutId customerReturnId = InOutId.ofRepoId(customerReturnLine.getM_InOut_ID()); final I_M_InOut customerReturn = huInOutBL.getById(customerReturnId, I_M_InOut.class); huInOutBL.addAssignedHandlingUnits(customerReturn, hus); huInOutBL.setAssignedHandlingUnits(customerReturnLine, hus); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.handlingunits.base\src\main\java\de\metas\handlingunits\inout\returns\ReturnsServiceFacade.java
1
请完成以下Java代码
public void registerInterceptor(@NonNull final ExternalSystemScriptedExportConversionInterceptor interceptor) { externalSystemScriptedExportConversionLock.lock(); try { registerInterceptor0(interceptor); } finally { externalSystemScriptedExportConversionLock.unlock(); } } public void unregisterInterceptorByTableAndClientId(@NonNull final AdTableAndClientId tableAndClientId) { externalSystemScriptedExportConversionLock.lock(); try { unregisterInterceptorByTableAndClientId0(tableAndClientId); } finally { externalSystemScriptedExportConversionLock.unlock(); } } private void registerInterceptor0(@NonNull final ExternalSystemScriptedExportConversionInterceptor interceptor) { final AdTableAndClientId tableAndClientId = AdTableAndClientId.of(interceptor.getTableId(), ClientId.ofRepoId(interceptor.getAD_Client_ID())); unregisterInterceptorByTableAndClientId0(tableAndClientId);
interceptor.init(); tableId2ModelInterceptor.put(tableAndClientId, interceptor); } private void unregisterInterceptorByTableAndClientId0(@NonNull final AdTableAndClientId tableAndClientId) { final ExternalSystemScriptedExportConversionInterceptor interceptor = tableId2ModelInterceptor.get(tableAndClientId); if (interceptor == null) { // no interceptor was not registered for given table, nothing to unregister return; } interceptor.destroy(); tableId2ModelInterceptor.remove(tableAndClientId); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.externalsystem\src\main\java\de\metas\externalsystem\scriptedexportconversion\interceptor\ExternalSystemScriptedExportConversionInterceptorRegistry.java
1
请完成以下Java代码
private Transaction doSuspend() { try { return transactionManager.suspend(); } catch (SystemException e) { throw new TransactionException("Unable to suspend transaction", e); } } private void doResume(Transaction tx) { if (tx != null) { try { transactionManager.resume(tx); } catch (SystemException | InvalidTransactionException e) { throw new TransactionException("Unable to resume transaction", e); } } } private void doCommit() { try { transactionManager.commit(); } catch (HeuristicMixedException | SystemException | RollbackException | HeuristicRollbackException e) { throw new TransactionException("Unable to commit transaction", e); } catch (RuntimeException | Error e) { doRollback(true, e); throw e; } } private void doRollback(boolean isNew, Throwable originalException) { Throwable rollbackEx = null; try { if (isNew) { transactionManager.rollback(); } else { transactionManager.setRollbackOnly(); } } catch (SystemException e) { LOGGER.debug("Error when rolling back transaction", e); } catch (RuntimeException | Error e) { rollbackEx = e; throw e; } finally { if (rollbackEx != null && originalException != null) {
LOGGER.error("Error when rolling back transaction, original exception was:", originalException); } } } private static class TransactionException extends RuntimeException { private static final long serialVersionUID = 1L; private TransactionException() { } private TransactionException(String s) { super(s); } private TransactionException(String s, Throwable throwable) { super(s, throwable); } private TransactionException(Throwable throwable) { super(throwable); } } }
repos\flowable-engine-main\modules\flowable-engine-common\src\main\java\org\flowable\common\engine\impl\interceptor\JtaTransactionInterceptor.java
1
请在Spring Boot框架中完成以下Java代码
public String getId() { return id; } public void setId(String id) { this.id = id; } public String getProdName() { return prodName; } public void setProdName(String prodName) { this.prodName = prodName; } public String getShopPriceStart() { return shopPriceStart; } public void setShopPriceStart(String shopPriceStart) { this.shopPriceStart = shopPriceStart; } public String getShopPriceEnd() { return shopPriceEnd; } public void setShopPriceEnd(String shopPriceEnd) { this.shopPriceEnd = shopPriceEnd; } public String getTopCategoryId() { return topCategoryId; } public void setTopCategoryId(String topCategoryId) { this.topCategoryId = topCategoryId; } public String getSubCategoryId() { return subCategoryId; } public void setSubCategoryId(String subCategoryId) { this.subCategoryId = subCategoryId; } public String getBrandId() { return brandId; } public void setBrandId(String brandId) { this.brandId = brandId; } public Integer getProdStateCode() { return prodStateCode; } public void setProdStateCode(Integer prodStateCode) { this.prodStateCode = prodStateCode; }
public String getCompanyId() { return companyId; } public void setCompanyId(String companyId) { this.companyId = companyId; } public Integer getOrderByPrice() { return orderByPrice; } public void setOrderByPrice(Integer orderByPrice) { this.orderByPrice = orderByPrice; } public Integer getOrderBySales() { return orderBySales; } public void setOrderBySales(Integer orderBySales) { this.orderBySales = orderBySales; } @Override public String toString() { return "ProdQueryReq{" + "id='" + id + '\'' + ", prodName='" + prodName + '\'' + ", shopPriceStart='" + shopPriceStart + '\'' + ", shopPriceEnd='" + shopPriceEnd + '\'' + ", topCategoryId='" + topCategoryId + '\'' + ", subCategoryId='" + subCategoryId + '\'' + ", brandId='" + brandId + '\'' + ", prodStateCode=" + prodStateCode + ", companyId='" + companyId + '\'' + ", orderByPrice=" + orderByPrice + ", orderBySales=" + orderBySales + ", page=" + page + ", numPerPage=" + numPerPage + '}'; } }
repos\SpringBoot-Dubbo-Docker-Jenkins-master\Gaoxi-Common-Service-Facade\src\main\java\com\gaoxi\req\product\ProdQueryReq.java
2
请完成以下Java代码
public static final FieldGroupType forCodeOrDefault(final String code, final FieldGroupType defaultType) { final FieldGroupType type = code2type.get(code); return type == null ? defaultType : type; } private static final ImmutableMap<String, FieldGroupType> code2type = ImmutableMap.<String, FieldGroupType> builder() .put(X_AD_FieldGroup.FIELDGROUPTYPE_Label, Label) .put(X_AD_FieldGroup.FIELDGROUPTYPE_Tab, Tab) .put(X_AD_FieldGroup.FIELDGROUPTYPE_Collapse, Collapsible) .build(); } private final String fieldGroupName; private final FieldGroupType fieldGroupType; private final boolean collapsedByDefault; private FieldGroupVO(final String fieldGroupName, final FieldGroupType fieldGroupType, final boolean collapsedByDefault) { super(); this.fieldGroupName = fieldGroupName == null ? "" : fieldGroupName; this.fieldGroupType = fieldGroupType == null ? FieldGroupType.Label : fieldGroupType; this.collapsedByDefault = collapsedByDefault; } @Override public String toString() { return MoreObjects.toStringHelper(this)
.add("name", fieldGroupName) .add("type", fieldGroupType) .add("collapsedByDefault", collapsedByDefault) .toString(); } public String getFieldGroupName() { return fieldGroupName; } public FieldGroupType getFieldGroupType() { return fieldGroupType; } public boolean isCollapsedByDefault() { return collapsedByDefault; } }
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-legacy\org\compiere\model\FieldGroupVO.java
1
请完成以下Java代码
private Principal getPrincipal() { final PrincipalType principalType = PrincipalType.ofCode(principalTypeCode); if (PrincipalType.USER.equals(principalType)) { return Principal.userId(userId); } else if (PrincipalType.USER_GROUP.equals(principalType)) { return Principal.userGroupId(userGroupId); } else { throw new AdempiereException("@Unknown@ @PrincipalType@: " + principalType); } } private Set<Access> getPermissionsToGrant() { final Access permission = getPermissionOrNull(); if (permission == null) { throw new FillMandatoryException(PARAM_PermissionCode); } if (Access.WRITE.equals(permission)) { return ImmutableSet.of(Access.READ, Access.WRITE); } else { return ImmutableSet.of(permission);
} } private Access getPermissionOrNull() { if (Check.isEmpty(permissionCode)) { return null; } else { return Access.ofCode(permissionCode); } } }
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\de\metas\security\process\UserGroupRecordAccess_Base.java
1
请完成以下Java代码
public void cleanup() throws ResourceException { // no-op } public void destroy() throws ResourceException { // no-op } public void addConnectionEventListener(ConnectionEventListener listener) { if (listener == null) { throw new IllegalArgumentException("Listener is null"); } listeners.add(listener); } public void removeConnectionEventListener(ConnectionEventListener listener) { if (listener == null) { throw new IllegalArgumentException("Listener is null"); } listeners.remove(listener); } void closeHandle(JcaExecutorServiceConnection handle) { ConnectionEvent event = new ConnectionEvent(this, ConnectionEvent.CONNECTION_CLOSED); event.setConnectionHandle(handle); for (ConnectionEventListener cel : listeners) { cel.connectionClosed(event); } } public PrintWriter getLogWriter() throws ResourceException { return logwriter; } public void setLogWriter(PrintWriter out) throws ResourceException { logwriter = out; } public LocalTransaction getLocalTransaction() throws ResourceException { throw new NotSupportedException("LocalTransaction not supported"); }
public XAResource getXAResource() throws ResourceException { throw new NotSupportedException("GetXAResource not supported not supported"); } public ManagedConnectionMetaData getMetaData() throws ResourceException { return null; } // delegate methods ///////////////////////////////////////// public boolean schedule(Runnable runnable, boolean isLongRunning) { return delegate.schedule(runnable, isLongRunning); } public Runnable getExecuteJobsRunnable(List<String> jobIds, ProcessEngineImpl processEngine) { return delegate.getExecuteJobsRunnable(jobIds, processEngine); } }
repos\camunda-bpm-platform-master\javaee\jobexecutor-ra\src\main\java\org\camunda\bpm\container\impl\threading\ra\outbound\JcaExecutorServiceManagedConnection.java
1
请完成以下Java代码
class SysConfigEntry { @Getter private final String name; private final ImmutableMap<ClientAndOrgId, SysConfigEntryValue> entryValues; @Builder public SysConfigEntry( @NonNull final String name, @NonNull @Singular final List<SysConfigEntryValue> entryValues) { this.name = name; this.entryValues = Maps.uniqueIndex(entryValues, SysConfigEntryValue::getClientAndOrgId); } public boolean isNameStartsWith(@NonNull final String prefix) { if (Check.isBlank(prefix)) { throw new AdempiereException("Blank prefix is not allowed"); } return name.startsWith(prefix); } public boolean isClientAndOrgMatching(@NonNull final ClientAndOrgId clientAndOrgId) { for (ClientAndOrgId currentClientAndOrgId = clientAndOrgId; currentClientAndOrgId != null; currentClientAndOrgId = getFallbackClientAndOrgId(currentClientAndOrgId)) { if (entryValues.containsKey(currentClientAndOrgId)) { return true; } } return false; } @Nullable private ClientAndOrgId getFallbackClientAndOrgId(@NonNull final ClientAndOrgId clientAndOrgId) { if (!clientAndOrgId.getOrgId().isAny()) { return clientAndOrgId.withAnyOrgId(); } else if (!clientAndOrgId.getClientId().isSystem()) { return clientAndOrgId.withSystemClientId(); } else { return null; } }
public Optional<String> getValueAsString(@NonNull final ClientAndOrgId clientAndOrgId) { for (ClientAndOrgId currentClientAndOrgId = clientAndOrgId; currentClientAndOrgId != null; currentClientAndOrgId = getFallbackClientAndOrgId(currentClientAndOrgId)) { final SysConfigEntryValue entryValue = entryValues.get(currentClientAndOrgId); if (entryValue != null) { return Optional.of(entryValue.getValue()); } } return Optional.empty(); } // // // ------------------------------- // // public static class SysConfigEntryBuilder { public String getName() { return name; } } }
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\org\adempiere\service\impl\SysConfigEntry.java
1
请在Spring Boot框架中完成以下Java代码
public class ArticleServiceImpl implements ArticleService { @Resource private ArticleDao articleDao; @Override public PageResult getArticlePage(PageUtil pageUtil) { List<Article> articleList = articleDao.findArticles(pageUtil); int total = articleDao.getTotalArticles(pageUtil); PageResult pageResult = new PageResult(articleList, total, pageUtil.getLimit(), pageUtil.getPage()); return pageResult; } @Override public Article queryObject(Integer id) { Article article = articleDao.getArticleById(id); if (article != null) { return article; } return null; } @Override public List<Article> queryList(Map<String, Object> map) { List<Article> articles = articleDao.findArticles(map); return articles; }
@Override public int queryTotal(Map<String, Object> map) { return articleDao.getTotalArticles(map); } @Override public int save(Article article) { return articleDao.insertArticle(article); } @Override public int update(Article article) { article.setUpdateTime(new Date()); return articleDao.updArticle(article); } @Override public int delete(Integer id) { return articleDao.delArticle(id); } @Override public int deleteBatch(Integer[] ids) { return articleDao.deleteBatch(ids); } }
repos\spring-boot-projects-main\SpringBoot前后端分离实战项目源码\spring-boot-project-front-end&back-end\src\main\java\cn\lanqiao\springboot3\service\impl\ArticleServiceImpl.java
2
请完成以下Java代码
public void persistXML() { PersistenceManagerFactory pmf = new JDOPersistenceManagerFactory(pumdXML, null); PersistenceManager pm = pmf.getPersistenceManager(); Transaction tx = pm.currentTransaction(); try { tx.begin(); ProductXML productXML = new ProductXML(0, "Tablet", 80.0); pm.makePersistent(productXML); ProductXML productXML2 = new ProductXML(1, "Phone", 20.0); pm.makePersistent(productXML2); ProductXML productXML3 = new ProductXML(2, "Laptop", 200.0); pm.makePersistent(productXML3); tx.commit(); } finally { if (tx.isActive()) { tx.rollback(); } pm.close(); } } @SuppressWarnings({ "rawtypes", "unchecked" }) public void listXMLProducts() { PersistenceManagerFactory pmf = new JDOPersistenceManagerFactory(pumdXML, null); PersistenceManager pm = pmf.getPersistenceManager(); Transaction tx = pm.currentTransaction();
try { tx.begin(); Query q = pm.newQuery("SELECT FROM " + ProductXML.class.getName()); List<ProductXML> products = (List<ProductXML>) q.execute(); Iterator<ProductXML> iter = products.iterator(); while (iter.hasNext()) { ProductXML p = iter.next(); LOGGER.log(Level.WARNING, "Product name: {0} - Price: {1}", new Object[] { p.getName(), p.getPrice() }); pm.deletePersistent(p); } LOGGER.log(Level.INFO, "--------------------------------------------------------------"); tx.commit(); } finally { if (tx.isActive()) { tx.rollback(); } pm.close(); } } }
repos\tutorials-master\libraries-data-db-2\src\main\java\com\baeldung\libraries\jdo\GuideToJDO.java
1
请在Spring Boot框架中完成以下Java代码
static class HazelcastCacheMeterBinderProviderConfiguration { @Bean HazelcastCacheMeterBinderProvider hazelcastCacheMeterBinderProvider() { return new HazelcastCacheMeterBinderProvider(); } } @Configuration(proxyBeanMethods = false) @ConditionalOnClass({ JCacheCache.class, javax.cache.CacheManager.class }) @ConditionalOnMissingBean(JCacheCacheMeterBinderProvider.class) static class JCacheCacheMeterBinderProviderConfiguration { @Bean JCacheCacheMeterBinderProvider jCacheCacheMeterBinderProvider() { return new JCacheCacheMeterBinderProvider();
} } @Configuration(proxyBeanMethods = false) @ConditionalOnClass(RedisCache.class) static class RedisCacheMeterBinderProviderConfiguration { @Bean RedisCacheMeterBinderProvider redisCacheMeterBinderProvider() { return new RedisCacheMeterBinderProvider(); } } }
repos\spring-boot-4.0.1\module\spring-boot-cache\src\main\java\org\springframework\boot\cache\autoconfigure\metrics\CacheMeterBinderProvidersConfiguration.java
2
请完成以下Java代码
protected String getDesciption(CmmnElement element) { String description = element.getDescription(); if (description == null) { PlanItemDefinition definition = getDefinition(element); description = definition.getDescription(); } return description; } protected String getDocumentation(CmmnElement element) { Collection<Documentation> documentations = element.getDocumentations(); if (documentations.isEmpty()) { PlanItemDefinition definition = getDefinition(element); documentations = definition.getDocumentations(); } if (documentations.isEmpty()) { return null; } StringBuilder builder = new StringBuilder(); for (Documentation doc : documentations) { String content = doc.getTextContent();
if (content == null || content.isEmpty()) { continue; } if (builder.length() != 0) { builder.append("\n\n"); } builder.append(content.trim()); } return builder.toString(); } protected boolean isPlanItem(CmmnElement element) { return element instanceof PlanItem; } protected boolean isDiscretionaryItem(CmmnElement element) { return element instanceof DiscretionaryItem; } protected abstract List<String> getStandardEvents(CmmnElement element); }
repos\camunda-bpm-platform-master\engine\src\main\java\org\camunda\bpm\engine\impl\cmmn\handler\ItemHandler.java
1
请完成以下Java代码
public org.compiere.model.I_Fact_Acct getFact_Acct() { return get_ValueAsPO(COLUMNNAME_Fact_Acct_ID, org.compiere.model.I_Fact_Acct.class); } @Override public void setFact_Acct(org.compiere.model.I_Fact_Acct Fact_Acct) { set_ValueFromPO(COLUMNNAME_Fact_Acct_ID, org.compiere.model.I_Fact_Acct.class, Fact_Acct); } /** Set Accounting Fact. @param Fact_Acct_ID Accounting Fact */ @Override public void setFact_Acct_ID (int Fact_Acct_ID) { if (Fact_Acct_ID < 1) set_Value (COLUMNNAME_Fact_Acct_ID, null); else set_Value (COLUMNNAME_Fact_Acct_ID, Integer.valueOf(Fact_Acct_ID)); } /** Get Accounting Fact. @return Accounting Fact */ @Override public int getFact_Acct_ID () { Integer ii = (Integer)get_Value(COLUMNNAME_Fact_Acct_ID); if (ii == null) return 0; return ii.intValue(); } /** * PostingType AD_Reference_ID=125 * Reference name: _Posting Type */ public static final int POSTINGTYPE_AD_Reference_ID=125; /** Actual = A */ public static final String POSTINGTYPE_Actual = "A"; /** Budget = B */ public static final String POSTINGTYPE_Budget = "B"; /** Commitment = E */ public static final String POSTINGTYPE_Commitment = "E"; /** Statistical = S */ public static final String POSTINGTYPE_Statistical = "S"; /** Reservation = R */ public static final String POSTINGTYPE_Reservation = "R"; /** Actual Year End = Y */ public static final String POSTINGTYPE_ActualYearEnd = "Y"; /** Set Buchungsart. @param PostingType Die Art des gebuchten Betrages dieser Transaktion */ @Override public void setPostingType (java.lang.String PostingType) { set_Value (COLUMNNAME_PostingType, PostingType); } /** Get Buchungsart. @return Die Art des gebuchten Betrages dieser Transaktion */ @Override public java.lang.String getPostingType () { return (java.lang.String)get_Value(COLUMNNAME_PostingType); } /** Set Processing Tag. @param ProcessingTag Processing Tag */ @Override
public void setProcessingTag (java.lang.String ProcessingTag) { set_Value (COLUMNNAME_ProcessingTag, ProcessingTag); } /** Get Processing Tag. @return Processing Tag */ @Override public java.lang.String getProcessingTag () { return (java.lang.String)get_Value(COLUMNNAME_ProcessingTag); } /** Set Menge. @param Qty Menge */ @Override public void setQty (java.math.BigDecimal Qty) { set_Value (COLUMNNAME_Qty, Qty); } /** Get Menge. @return Menge */ @Override public java.math.BigDecimal getQty () { BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_Qty); if (bd == null) return BigDecimal.ZERO; return bd; } }
repos\metasfresh-new_dawn_uat\backend\de.metas.acct.base\src\main\java-gen\de\metas\acct\model\X_Fact_Acct_Log.java
1
请完成以下Java代码
public KeyNamePair getKeyNamePair() { return new KeyNamePair(get_ID(), getName()); } /** Set Process Now. @param Processing Process Now */ public void setProcessing (boolean Processing) { set_Value (COLUMNNAME_Processing, Boolean.valueOf(Processing)); } /** Get Process Now. @return Process Now */ public boolean isProcessing () { Object oo = get_Value(COLUMNNAME_Processing); if (oo != null) { if (oo instanceof Boolean) return ((Boolean)oo).booleanValue(); return "Y".equals(oo); } return false; } /** Set Total Ratio. @param RatioTotal Total of relative weight in a distribution */
public void setRatioTotal (BigDecimal RatioTotal) { set_Value (COLUMNNAME_RatioTotal, RatioTotal); } /** Get Total Ratio. @return Total of relative weight in a distribution */ public BigDecimal getRatioTotal () { BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_RatioTotal); if (bd == null) return Env.ZERO; return bd; } }
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_M_DistributionList.java
1
请完成以下Java代码
public ImmutableList<I_ESR_ImportFile> retrieveActiveESRImportFiles(@NonNull final I_ESR_Import esrImport) { return queryBL.createQueryBuilder(I_ESR_ImportFile.class) .addOnlyActiveRecordsFilter() .addEqualsFilter(I_ESR_ImportFile.COLUMNNAME_ESR_Import_ID, esrImport.getESR_Import_ID()) .create() .listImmutable(I_ESR_ImportFile.class); } @Override public ImmutableList<I_ESR_ImportLine> retrieveActiveESRImportLinesFromFile(@NonNull final I_ESR_ImportFile esrImportFile) { return queryBL.createQueryBuilder(I_ESR_ImportLine.class) .addOnlyActiveRecordsFilter() .addEqualsFilter(I_ESR_ImportLine.COLUMNNAME_ESR_ImportFile_ID, esrImportFile.getESR_ImportFile_ID()) .create() .listImmutable(I_ESR_ImportLine.class); } @Override public I_ESR_ImportFile getImportFileById(final int esrImportFileId) { return load(esrImportFileId, I_ESR_ImportFile.class); }
@Override public void validateEsrImport(final I_ESR_Import esrImport) { final ImmutableList<I_ESR_ImportFile> esrImportFiles = retrieveActiveESRImportFiles(esrImport); final boolean isValid = esrImportFiles.stream() .allMatch(I_ESR_ImportFile::isValid); esrImport.setIsValid(isValid); save(esrImport); } @Override public I_ESR_Import getById(final ESRImportId esrImportId) { return load(esrImportId.getRepoId(), I_ESR_Import.class); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.payment.esr\src\main\java\de\metas\payment\esr\api\impl\ESRImportDAO.java
1
请完成以下Java代码
public void setValidate(Boolean value) { this.validate = value; } /** * Gets the value of the obligation property. * * @return * possible object is * {@link Boolean } * */ public boolean isObligation() { if (obligation == null) { return true; } else { return obligation; } } /** * Sets the value of the obligation property. * * @param value * allowed object is * {@link Boolean } * */ public void setObligation(Boolean value) { this.obligation = value; } /** * Gets the value of the sectionCode property. * * @return * possible object is * {@link String } * */ public String getSectionCode() { return sectionCode; } /** * Sets the value of the sectionCode property. * * @param value * allowed object is * {@link String } * */ public void setSectionCode(String value) { this.sectionCode = value; } /** * Gets the value of the remark property. * * @return * possible object is * {@link String } * */ public String getRemark() { return remark; }
/** * Sets the value of the remark property. * * @param value * allowed object is * {@link String } * */ public void setRemark(String value) { this.remark = value; } /** * Gets the value of the serviceAttributes property. * * @return * possible object is * {@link Long } * */ public long getServiceAttributes() { if (serviceAttributes == null) { return 0L; } else { return serviceAttributes; } } /** * Sets the value of the serviceAttributes property. * * @param value * allowed object is * {@link Long } * */ public void setServiceAttributes(Long value) { this.serviceAttributes = value; } }
repos\metasfresh-new_dawn_uat\backend\vertical-healthcare_ch\forum_datenaustausch_ch.invoice_440_request\src\main\java-xjc\de\metas\vertical\healthcare_ch\forum_datenaustausch_ch\invoice_440\request\RecordServiceType.java
1
请完成以下Java代码
private boolean isFailOnFirstError() { return _failOnFirstError; } public HUMoveToDirectWarehouseService setFailIfNoHUs(final boolean failIfNoHUs) { _failIfNoHUs = failIfNoHUs; return this; } private boolean isFailIfNoHUs() { return _failIfNoHUs; } public HUMoveToDirectWarehouseService setDocumentsCollection(final DocumentCollection documentsCollection) { this.documentsCollection = documentsCollection; return this; } public HUMoveToDirectWarehouseService setHUView(final HUEditorView huView) { this.huView = huView; return this; } private void notifyHUMoved(final I_M_HU hu) { final HuId huId = HuId.ofRepoId(hu.getM_HU_ID()); // // Invalidate all documents which are about this HU. if (documentsCollection != null) { try { documentsCollection.invalidateDocumentByRecordId(I_M_HU.Table_Name, huId.getRepoId()); } catch (final Exception ex) { logger.warn("Failed invalidating documents for M_HU_ID={}. Ignored", huId, ex); } } // // Remove this HU from the view
// Don't invalidate. We will do it at the end of all processing. // // NOTE/Later edit: we decided to not remove it anymore // because in some views it might make sense to keep it there. // The right way would be to check if after moving it, the HU is still elgible for view's filters. // // if (huView != null) { huView.removeHUIds(ImmutableSet.of(huId)); } } /** * @return target warehouse where the HUs will be moved to. */ @NonNull private LocatorId getTargetLocatorId() { if (_targetLocatorId == null) { _targetLocatorId = huMovementBL.getDirectMoveLocatorId(); } return _targetLocatorId; } }
repos\metasfresh-new_dawn_uat\backend\de.metas.ui.web.base\src\main\java\de\metas\ui\web\handlingunits\process\HUMoveToDirectWarehouseService.java
1
请完成以下Java代码
public void parseText(String text, AhoCorasickDoubleArrayTrie.IHit<V> processor) { int length = text.length(); int begin = 0; BaseNode<V> state = this; for (int i = begin; i < length; ++i) { state = state.transition(text.charAt(i)); if (state != null) { V value = state.getValue(); if (value != null) { processor.hit(begin, i + 1, value); } /*如果是最后一位,这里不能直接跳出循环, 要继续从下一个字符开始判断*/ if (i == length - 1) { i = begin; ++begin; state = this; } } else { i = begin; ++begin; state = this; } } } /** * 匹配文本 * * @param text 文本 * @param processor 处理器 */ public void parseText(char[] text, AhoCorasickDoubleArrayTrie.IHit<V> processor) { int length = text.length; int begin = 0; BaseNode<V> state = this; for (int i = begin; i < length; ++i) { state = state.transition(text[i]); if (state != null) {
V value = state.getValue(); if (value != null) { processor.hit(begin, i + 1, value); } /*如果是最后一位,这里不能直接跳出循环, 要继续从下一个字符开始判断*/ if (i == length - 1) { i = begin; ++begin; state = this; } } else { i = begin; ++begin; state = this; } } } }
repos\springboot-demo-master\hanlp\src\main\java\demo\hankcs\hanlp\collection\trie\bintrie\BinTrie.java
1
请完成以下Java代码
public int getAD_Table_ID () { Integer ii = (Integer)get_Value(COLUMNNAME_AD_Table_ID); if (ii == null) return 0; return ii.intValue(); } public I_C_DocType getC_DocType() throws RuntimeException { return (I_C_DocType)MTable.get(getCtx(), I_C_DocType.Table_Name) .getPO(getC_DocType_ID(), get_TrxName()); } /** Set Document Type. @param C_DocType_ID Document type or rules */ public void setC_DocType_ID (int C_DocType_ID) { if (C_DocType_ID < 0) set_Value (COLUMNNAME_C_DocType_ID, null); else set_Value (COLUMNNAME_C_DocType_ID, Integer.valueOf(C_DocType_ID)); } /** Get Document Type. @return Document type or rules */ public int getC_DocType_ID () { Integer ii = (Integer)get_Value(COLUMNNAME_C_DocType_ID); if (ii == null) return 0; return ii.intValue(); } /** Set Description. @param Description Optional short description of the record */ public void setDescription (String Description) { set_Value (COLUMNNAME_Description, Description); } /** Get Description.
@return Optional short description of the record */ public String getDescription () { return (String)get_Value(COLUMNNAME_Description); } /** ReplicationType AD_Reference_ID=126 */ public static final int REPLICATIONTYPE_AD_Reference_ID=126; /** Local = L */ public static final String REPLICATIONTYPE_Local = "L"; /** Merge = M */ public static final String REPLICATIONTYPE_Merge = "M"; /** Reference = R */ public static final String REPLICATIONTYPE_Reference = "R"; /** Broadcast = B */ public static final String REPLICATIONTYPE_Broadcast = "B"; /** Set Replication Type. @param ReplicationType Type of Data Replication */ public void setReplicationType (String ReplicationType) { set_Value (COLUMNNAME_ReplicationType, ReplicationType); } /** Get Replication Type. @return Type of Data Replication */ public String getReplicationType () { return (String)get_Value(COLUMNNAME_ReplicationType); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_AD_ReplicationDocument.java
1
请完成以下Java代码
public class AlarmDataUpdate extends DataUpdate<AlarmData> { @Getter private long allowedEntities; @Getter private long totalEntities; public AlarmDataUpdate(int cmdId, PageData<AlarmData> data, List<AlarmData> update, long allowedEntities, long totalEntities) { super(cmdId, data, update, SubscriptionErrorCode.NO_ERROR.getCode(), null); this.allowedEntities = allowedEntities; this.totalEntities = totalEntities; } public AlarmDataUpdate(int cmdId, int errorCode, String errorMsg) { super(cmdId, null, null, errorCode, errorMsg); }
@Override public CmdUpdateType getCmdUpdateType() { return CmdUpdateType.ALARM_DATA; } @JsonCreator public AlarmDataUpdate(@JsonProperty("cmdId") int cmdId, @JsonProperty("data") PageData<AlarmData> data, @JsonProperty("update") List<AlarmData> update, @JsonProperty("errorCode") int errorCode, @JsonProperty("errorMsg") String errorMsg, @JsonProperty("allowedEntities") long allowedEntities, @JsonProperty("totalEntities") long totalEntities) { super(cmdId, data, update, errorCode, errorMsg); this.allowedEntities = allowedEntities; this.totalEntities = totalEntities; } }
repos\thingsboard-master\application\src\main\java\org\thingsboard\server\service\ws\telemetry\cmd\v2\AlarmDataUpdate.java
1
请完成以下Java代码
public int getC_Year_ID () { Integer ii = (Integer)get_Value(COLUMNNAME_C_Year_ID); if (ii == null) return 0; return ii.intValue(); } /** Set Description. @param Description Optional short description of the record */ public void setDescription (String Description) { set_Value (COLUMNNAME_Description, Description); } /** Get Description. @return Optional short description of the record */ public String getDescription () { return (String)get_Value(COLUMNNAME_Description); } /** Set Comment/Help. @param Help Comment or Hint */ public void setHelp (String Help) { set_Value (COLUMNNAME_Help, Help); } /** Get Comment/Help. @return Comment or Hint */ public String getHelp () { return (String)get_Value(COLUMNNAME_Help); } /** Set Default. @param IsDefault Default value */ public void setIsDefault (boolean IsDefault) { set_Value (COLUMNNAME_IsDefault, Boolean.valueOf(IsDefault)); } /** Get Default. @return Default value */ public boolean isDefault () { Object oo = get_Value(COLUMNNAME_IsDefault); if (oo != null) { if (oo instanceof Boolean) return ((Boolean)oo).booleanValue(); return "Y".equals(oo); } return false; } /** Set Demand. @param M_Demand_ID Material Demand */ public void setM_Demand_ID (int M_Demand_ID) { if (M_Demand_ID < 1) set_ValueNoCheck (COLUMNNAME_M_Demand_ID, null); else set_ValueNoCheck (COLUMNNAME_M_Demand_ID, Integer.valueOf(M_Demand_ID));
} /** Get Demand. @return Material Demand */ public int getM_Demand_ID () { Integer ii = (Integer)get_Value(COLUMNNAME_M_Demand_ID); if (ii == null) return 0; return ii.intValue(); } /** Set Name. @param Name Alphanumeric identifier of the entity */ public void setName (String Name) { set_Value (COLUMNNAME_Name, Name); } /** Get Name. @return Alphanumeric identifier of the entity */ public String getName () { return (String)get_Value(COLUMNNAME_Name); } /** Get Record ID/ColumnName @return ID/ColumnName pair */ public KeyNamePair getKeyNamePair() { return new KeyNamePair(get_ID(), getName()); } /** Set Process Now. @param Processing Process Now */ public void setProcessing (boolean Processing) { set_Value (COLUMNNAME_Processing, Boolean.valueOf(Processing)); } /** Get Process Now. @return Process Now */ public boolean isProcessing () { Object oo = get_Value(COLUMNNAME_Processing); if (oo != null) { if (oo instanceof Boolean) return ((Boolean)oo).booleanValue(); return "Y".equals(oo); } return false; } }
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_M_Demand.java
1
请在Spring Boot框架中完成以下Java代码
public class OrderLineId implements RepoIdAware { @JsonCreator public static OrderLineId ofRepoId(final int repoId) { return new OrderLineId(repoId); } @Nullable public static OrderLineId ofRepoIdOrNull(final int repoId) { return repoId > 0 ? new OrderLineId(repoId) : null; } public static Optional<OrderLineId> optionalOfRepoId(final int repoId) { return Optional.ofNullable(ofRepoIdOrNull(repoId)); } public static OrderLineId cast(@NonNull final RepoIdAware id) { return (OrderLineId)id; } public static int toRepoId(@Nullable final OrderLineId orderLineId) { return orderLineId != null ? orderLineId.getRepoId() : -1; } public static Set<Integer> toIntSet(final Collection<OrderLineId> orderLineIds) { return orderLineIds.stream().map(OrderLineId::getRepoId).collect(ImmutableSet.toImmutableSet()); } int repoId;
private OrderLineId(final int repoId) { this.repoId = Check.assumeGreaterThanZero(repoId, "repoId"); } @Override @JsonValue public int getRepoId() { return repoId; } public static boolean equals(@Nullable final OrderLineId id1, @Nullable final OrderLineId id2) {return Objects.equals(id1, id2);} }
repos\metasfresh-new_dawn_uat\backend\de.metas.business\src\main\java\de\metas\order\OrderLineId.java
2