instruction string | input string | output string | source_file string | priority int64 |
|---|---|---|---|---|
请完成以下Java代码 | public boolean canConvert(final String filterId)
{
return Objects.equals(filterId, FILTER_ID);
}
@Override
public FilterSql getSql(
@NonNull final DocumentFilter filter,
final SqlOptions sqlOpts_NOTUSED,
@NonNull final SqlDocumentFilterConverterContext context)
{
final String barcodeString = StringUtils.trimBlankToNull(filter.getParameterValueAsString(PARAM_Barcode, null));
if (barcodeString == null)
{
// shall not happen
throw new AdempiereException("Barcode parameter is not set: " + filter);
}
//
// Get M_HU_IDs by barcode
final ImmutableSet<HuId> huIds;
final GlobalQRCode globalQRCode = GlobalQRCode.parse(barcodeString).orNullIfError();
if (globalQRCode != null)
{
final HUQRCode huQRCode = HUQRCode.fromGlobalQRCode(globalQRCode);
final HUQRCodesService huQRCodesService = SpringContextHolder.instance.getBean(HUQRCodesService.class);
final HuId huId = huQRCodesService.getHuIdByQRCodeIfExists(huQRCode).orElse(null);
huIds = huId != null ? ImmutableSet.of(huId) : ImmutableSet.of();
}
else
{
final IHandlingUnitsDAO handlingUnitsDAO = Services.get(IHandlingUnitsDAO.class);
huIds = handlingUnitsDAO.createHUQueryBuilder()
.setContext(PlainContextAware.newOutOfTrx())
.onlyContextClient(false) // avoid enforcing context AD_Client_ID because it might be that we are not in a user thread (so no context)
.setOnlyWithBarcode(barcodeString)
.setOnlyTopLevelHUs(false)
.createQueryBuilder()
.setOption(IQueryBuilder.OPTION_Explode_OR_Joins_To_SQL_Unions)
.create()
.idsAsSet(HuId::ofRepoId);
}
if (huIds.isEmpty())
{
return FilterSql.ALLOW_NONE;
}
final IHandlingUnitsBL handlingUnitsBL = Services.get(IHandlingUnitsBL.class);
final ImmutableSet<HuId> topLevelHuIds = handlingUnitsBL.getTopLevelHUs(huIds);
final ISqlQueryFilter sqlQueryFilter = new InArrayQueryFilter<>(I_M_HU.COLUMNNAME_M_HU_ID, topLevelHuIds);
return FilterSql.ofWhereClause(SqlAndParams.of(sqlQueryFilter.getSql(), sqlQueryFilter.getSqlParams(Env.getCtx())));
} | }
protected boolean isAlwaysUseSameLayout()
{
return Services.get(ISysConfigBL.class).getBooleanValue(SYSCFG_AlwaysUseSameLayout, false);
}
protected RelatedProcessDescriptor createProcessDescriptor(@NonNull final Class<?> processClass)
{
return RelatedProcessDescriptor.builder()
.processId(adProcessDAO.retrieveProcessIdByClassIfUnique(processClass))
.displayPlace(RelatedProcessDescriptor.DisplayPlace.ViewQuickActions)
.build();
}
@Value(staticConstructor = "of")
private static class ViewLayoutKey
{
@NonNull
WindowId windowId;
@NonNull
JSONViewDataType viewDataType;
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.ui.web.base\src\main\java\de\metas\ui\web\handlingunits\HUEditorViewFactoryTemplate.java | 1 |
请完成以下Java代码 | public Execution getExecution() {
ExecutionEntity execution = getExecutionFromContext();
if (execution != null) {
return execution;
} else {
return getScopedAssociation().getExecution();
}
}
@Override
public Object getVariable(String variableName) {
ExecutionEntity execution = getExecutionFromContext();
if (execution != null) {
return execution.getVariable(variableName);
} else {
return getScopedAssociation().getVariable(variableName);
}
}
@Override
public void setVariable(String variableName, Object value) {
ExecutionEntity execution = getExecutionFromContext();
if (execution != null) {
execution.setVariable(variableName, value);
execution.getVariable(variableName);
} else {
getScopedAssociation().setVariable(variableName, value);
}
}
protected ExecutionEntity getExecutionFromContext() {
if (Context.getCommandContext() != null) {
ExecutionContext executionContext = ExecutionContextHolder.getExecutionContext();
if (executionContext != null) { | return executionContext.getExecution();
}
}
return null;
}
@Override
public Task getTask() {
if (Context.getCommandContext() != null) {
throw new FlowableCdiException("Cannot work with tasks in an active command.");
}
return getScopedAssociation().getTask();
}
@Override
public void setTask(Task task) {
if (Context.getCommandContext() != null) {
throw new FlowableCdiException("Cannot work with tasks in an active command.");
}
getScopedAssociation().setTask(task);
}
@Override
public Map<String, Object> getCachedVariables() {
if (Context.getCommandContext() != null) {
throw new FlowableCdiException("Cannot work with cached variables in an active command.");
}
return getScopedAssociation().getCachedVariables();
}
} | repos\flowable-engine-main\modules\flowable-cdi\src\main\java\org\flowable\cdi\impl\context\DefaultContextAssociationManager.java | 1 |
请完成以下Java代码 | public static JSONLookupValuesList error(@NonNull JsonErrorItem error)
{
return new JSONLookupValuesList(error);
}
@JsonProperty("values")
private final List<JSONLookupValue> values;
@JsonProperty("defaultValue")
@JsonInclude(JsonInclude.Include.NON_ABSENT)
private String defaultId;
@JsonProperty("error")
@JsonInclude(JsonInclude.Include.NON_ABSENT)
@Nullable private final JsonErrorItem error;
private LinkedHashMap<String, Object> otherProperties;
@VisibleForTesting
JSONLookupValuesList(final ImmutableList<JSONLookupValue> values, final DebugProperties otherProperties)
{
this.values = values;
this.error = null;
if (otherProperties != null && !otherProperties.isEmpty())
{
this.otherProperties = new LinkedHashMap<>(otherProperties.toMap());
}
}
private JSONLookupValuesList()
{
this.values = ImmutableList.of();
this.error = null;
}
private JSONLookupValuesList(@NonNull JsonErrorItem error)
{
this.values = ImmutableList.of();
this.error = error;
}
@Override
public String toString()
{
return MoreObjects.toStringHelper(this)
.omitNullValues()
.add("values", values)
.add("error", error)
.add("properties", otherProperties == null || otherProperties.isEmpty() ? null : otherProperties) | .toString();
}
public List<JSONLookupValue> getValues()
{
return values;
}
@JsonAnyGetter
public Map<String, Object> getOtherProperties()
{
return otherProperties == null ? ImmutableMap.of() : otherProperties;
}
@JsonAnySetter
public void putOtherProperty(final String name, final String jsonValue)
{
if (otherProperties == null)
{
otherProperties = new LinkedHashMap<>();
}
otherProperties.put(name, jsonValue);
}
@JsonSetter
public JSONLookupValuesList setDefaultId(final String defaultId)
{
this.defaultId = defaultId;
return this;
}
public String getDefaultId()
{
return defaultId;
}
@Nullable
public JsonErrorItem getError()
{
return error;
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.ui.web.base\src\main\java\de\metas\ui\web\window\datatypes\json\JSONLookupValuesList.java | 1 |
请完成以下Java代码 | public class AIWithHUPIAttributeValue extends AbstractHUAttributeValue
{
private final I_M_AttributeInstance attributeInstance;
private final boolean isGeneratedAttribute;
public AIWithHUPIAttributeValue(
@NonNull final IAttributeStorage attributeStorage,
@NonNull final I_M_AttributeInstance attributeInstance,
@NonNull final I_M_HU_PI_Attribute piAttribute,
final boolean isGeneratedAttribute)
{
super(attributeStorage,
piAttribute,
Boolean.TRUE // ASI attributes are ALWAYS created from template attributes
);
this.attributeInstance = attributeInstance;
this.isGeneratedAttribute = isGeneratedAttribute;
}
@Override
protected void setInternalValueString(final String value)
{
attributeInstance.setValue(value);
}
@Override
protected void setInternalValueNumber(final BigDecimal value)
{
attributeInstance.setValueNumber(value);
}
@Override
protected String getInternalValueString()
{
return attributeInstance.getValue();
}
@Override
protected BigDecimal getInternalValueNumber()
{
return attributeInstance.getValueNumber();
}
@Override
protected String getInternalValueStringInitial()
{
return null;
}
/**
* @return <code>null</code>.
*/
@Override
protected BigDecimal getInternalValueNumberInitial()
{
return null;
} | @Override
protected void setInternalValueStringInitial(final String value)
{
throw new UnsupportedOperationException("Setting initial value not supported");
}
@Override
protected void setInternalValueNumberInitial(final BigDecimal value)
{
throw new UnsupportedOperationException("Setting initial value not supported");
}
@Override
public boolean isNew()
{
return isGeneratedAttribute;
}
@Override
protected void setInternalValueDate(Date value)
{
attributeInstance.setValueDate(TimeUtil.asTimestamp(value));
}
@Override
protected Date getInternalValueDate()
{
return attributeInstance.getValueDate();
}
@Override
protected void setInternalValueDateInitial(Date value)
{
throw new UnsupportedOperationException("Setting initial value not supported");
}
@Override
protected Date getInternalValueDateInitial()
{
return null;
}
@Override
public boolean isOnlyIfInProductAttributeSet()
{
// FIXME tsa: figure out why this returns false instead of using the flag from M_HU_PI_Attribute?!
return false;
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.handlingunits.base\src\main\java\de\metas\handlingunits\attribute\storage\impl\AIWithHUPIAttributeValue.java | 1 |
请完成以下Java代码 | public DateValue readValue(TypedValueField typedValueField) {
Date date = null;
String value = (String) typedValueField.getValue();
if (value != null) {
SimpleDateFormat sdf = new SimpleDateFormat(dateFormat);
try {
date = sdf.parse(value);
}
catch (ParseException e) {
throw LOG.valueMapperExceptionWhileParsingDate(value, e);
}
}
return Variables.dateValue(date);
} | public void writeValue(DateValue dateValue, TypedValueField typedValueField) {
Date date = (Date) dateValue.getValue();
if (date != null) {
SimpleDateFormat sdf = new SimpleDateFormat(dateFormat);
typedValueField.setValue(sdf.format(date));
}
}
protected boolean canReadValue(TypedValueField typedValueField) {
Object value = typedValueField.getValue();
return value == null || value instanceof String;
}
} | repos\camunda-bpm-platform-master\clients\java\client\src\main\java\org\camunda\bpm\client\variable\impl\mapper\DateValueMapper.java | 1 |
请完成以下Java代码 | protected @Nullable Object getPreAuthenticatedPrincipal(HttpServletRequest request) {
String principal = (String) request.getAttribute(this.principalEnvironmentVariable);
if (principal == null && this.exceptionIfVariableMissing) {
throw new PreAuthenticatedCredentialsNotFoundException(
this.principalEnvironmentVariable + " variable not found in request.");
}
return principal;
}
/**
* Credentials aren't usually applicable, but if a
* {@code credentialsEnvironmentVariable} is set, this will be read and used as the
* credentials value. Otherwise a dummy value will be used.
*/
@Override
protected @Nullable Object getPreAuthenticatedCredentials(HttpServletRequest request) {
if (this.credentialsEnvironmentVariable != null) {
return request.getAttribute(this.credentialsEnvironmentVariable);
}
return "N/A";
} | public void setPrincipalEnvironmentVariable(String principalEnvironmentVariable) {
Assert.hasText(principalEnvironmentVariable, "principalEnvironmentVariable must not be empty or null");
this.principalEnvironmentVariable = principalEnvironmentVariable;
}
public void setCredentialsEnvironmentVariable(String credentialsEnvironmentVariable) {
Assert.hasText(credentialsEnvironmentVariable, "credentialsEnvironmentVariable must not be empty or null");
this.credentialsEnvironmentVariable = credentialsEnvironmentVariable;
}
/**
* Defines whether an exception should be raised if the principal variable is missing.
* Defaults to {@code true}.
* @param exceptionIfVariableMissing set to {@code false} to override the default
* behaviour and allow the request to proceed if no variable is found.
*/
public void setExceptionIfVariableMissing(boolean exceptionIfVariableMissing) {
this.exceptionIfVariableMissing = exceptionIfVariableMissing;
}
} | repos\spring-security-main\web\src\main\java\org\springframework\security\web\authentication\preauth\RequestAttributeAuthenticationFilter.java | 1 |
请完成以下Java代码 | public class RModelCalculationContext
{
private final IRModelMetadata metadata;
private int columnIndex = -1;
private int groupColumnIndex = -1;
private int level = -1;
private Object[] groupLevel2Value;
public RModelCalculationContext(final IRModelMetadata metadata)
{
super();
Check.assumeNotNull(metadata, "metadata not null");
this.metadata = metadata;
}
@Override
public String toString()
{
return "RModelCalculationPosition ["
+ "columnIndex=" + columnIndex
+ ", groupColumnIndex=" + groupColumnIndex
+ ", level=" + level
+ "]";
}
public IRModelMetadata getMetadata()
{
return metadata;
}
public int getColumnIndex()
{
return columnIndex;
}
public void setColumnIndex(int columnIndex)
{
this.columnIndex = columnIndex;
}
/**
* @return column index of the column on which we are groupping now
*/ | public int getGroupColumnIndex()
{
return groupColumnIndex;
}
public void setGroupColumnIndex(int groupColumnIndex)
{
this.groupColumnIndex = groupColumnIndex;
}
public int getLevel()
{
return level;
}
public void setLevel(int level)
{
this.level = level;
}
public Object[] getGroupLevel2Value()
{
return groupLevel2Value;
}
public void setGroupLevel2Value(Object[] groupLevel2Value)
{
this.groupLevel2Value = groupLevel2Value;
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.business\src\main\java\org\compiere\report\core\RModelCalculationContext.java | 1 |
请完成以下Java代码 | public java.lang.String getRemoteHost()
{
return get_ValueAsString(COLUMNNAME_RemoteHost);
}
@Override
public void setRequestURI (final @Nullable java.lang.String RequestURI)
{
set_Value (COLUMNNAME_RequestURI, RequestURI);
}
@Override
public java.lang.String getRequestURI()
{
return get_ValueAsString(COLUMNNAME_RequestURI);
}
/**
* Status AD_Reference_ID=541316
* Reference name: StatusList
*/
public static final int STATUS_AD_Reference_ID=541316;
/** Empfangen = Empfangen */
public static final String STATUS_Empfangen = "Empfangen";
/** Verarbeitet = Verarbeitet */
public static final String STATUS_Verarbeitet = "Verarbeitet";
/** Fehler = Fehler */
public static final String STATUS_Fehler = "Fehler";
@Override
public void setStatus (final java.lang.String Status)
{
set_Value (COLUMNNAME_Status, Status);
}
@Override | public java.lang.String getStatus()
{
return get_ValueAsString(COLUMNNAME_Status);
}
@Override
public void setTime (final java.sql.Timestamp Time)
{
set_Value (COLUMNNAME_Time, Time);
}
@Override
public java.sql.Timestamp getTime()
{
return get_ValueAsTimestamp(COLUMNNAME_Time);
}
@Override
public void setUI_Trace_ExternalId (final @Nullable java.lang.String UI_Trace_ExternalId)
{
set_Value (COLUMNNAME_UI_Trace_ExternalId, UI_Trace_ExternalId);
}
@Override
public java.lang.String getUI_Trace_ExternalId()
{
return get_ValueAsString(COLUMNNAME_UI_Trace_ExternalId);
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_API_Request_Audit.java | 1 |
请完成以下Java代码 | public void setQtyDelivered (final BigDecimal QtyDelivered)
{
set_Value (COLUMNNAME_QtyDelivered, QtyDelivered);
}
@Override
public BigDecimal getQtyDelivered()
{
final BigDecimal bd = get_ValueAsBigDecimal(COLUMNNAME_QtyDelivered);
return bd != null ? bd : BigDecimal.ZERO;
}
@Override
public void setQtyInTransit (final BigDecimal QtyInTransit)
{
set_Value (COLUMNNAME_QtyInTransit, QtyInTransit);
}
@Override
public BigDecimal getQtyInTransit() | {
final BigDecimal bd = get_ValueAsBigDecimal(COLUMNNAME_QtyInTransit);
return bd != null ? bd : BigDecimal.ZERO;
}
@Override
public void setQtyOrdered (final BigDecimal QtyOrdered)
{
set_Value (COLUMNNAME_QtyOrdered, QtyOrdered);
}
@Override
public BigDecimal getQtyOrdered()
{
final BigDecimal bd = get_ValueAsBigDecimal(COLUMNNAME_QtyOrdered);
return bd != null ? bd : BigDecimal.ZERO;
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\eevolution\model\X_DD_OrderLine_Alternative.java | 1 |
请完成以下Java代码 | public VariableInstanceQuery orderByTenantId() {
orderBy(VariableInstanceQueryProperty.TENANT_ID);
return this;
}
@Override
protected boolean hasExcludingConditions() {
return super.hasExcludingConditions() || CompareUtil.elementIsNotContainedInArray(variableName, variableNames);
}
// results ////////////////////////////////////////////////////
@Override
public long executeCount(CommandContext commandContext) {
checkQueryOk();
ensureVariablesInitialized();
return commandContext
.getVariableInstanceManager()
.findVariableInstanceCountByQueryCriteria(this);
}
@Override
public List<VariableInstance> executeList(CommandContext commandContext, Page page) {
checkQueryOk();
ensureVariablesInitialized();
List<VariableInstance> result = commandContext
.getVariableInstanceManager()
.findVariableInstanceByQueryCriteria(this, page);
if (result == null) {
return result;
}
// iterate over the result array to initialize the value and serialized value of the variable
for (VariableInstance variableInstance : result) {
VariableInstanceEntity variableInstanceEntity = (VariableInstanceEntity) variableInstance;
if (shouldFetchValue(variableInstanceEntity)) {
try {
variableInstanceEntity.getTypedValue(isCustomObjectDeserializationEnabled);
} catch(Exception t) {
// do not fail if one of the variables fails to load
LOG.exceptionWhileGettingValueForVariable(t);
}
}
}
return result;
}
protected boolean shouldFetchValue(VariableInstanceEntity entity) {
// do not fetch values for byte arrays eagerly (unless requested by the user)
return isByteArrayFetchingEnabled
|| !AbstractTypedValueSerializer.BINARY_VALUE_TYPES.contains(entity.getSerializer().getType().getName());
}
// getters ////////////////////////////////////////////////////
public String getVariableId() {
return variableId;
}
public String getVariableName() {
return variableName;
}
public String[] getVariableNames() { | return variableNames;
}
public String getVariableNameLike() {
return variableNameLike;
}
public String[] getExecutionIds() {
return executionIds;
}
public String[] getProcessInstanceIds() {
return processInstanceIds;
}
public String[] getCaseExecutionIds() {
return caseExecutionIds;
}
public String[] getCaseInstanceIds() {
return caseInstanceIds;
}
public String[] getTaskIds() {
return taskIds;
}
public String[] getBatchIds() {
return batchIds;
}
public String[] getVariableScopeIds() {
return variableScopeIds;
}
public String[] getActivityInstanceIds() {
return activityInstanceIds;
}
} | repos\camunda-bpm-platform-master\engine\src\main\java\org\camunda\bpm\engine\impl\VariableInstanceQueryImpl.java | 1 |
请完成以下Java代码 | public static Object convertValueToJson(final Object value)
{
if (value == null)
{
return null;
}
else if (value instanceof String)
{
return value;
}
else if (value instanceof Integer)
{
return value;
}
else if (value instanceof BigDecimal)
{
return value.toString();
}
else if (value instanceof Boolean)
{
return value;
}
else if (value instanceof java.sql.Timestamp)
{
final LocalDateTime localDateTime = ((Timestamp)value).toLocalDateTime();
final LocalDate localDate = localDateTime.toLocalDate();
if (localDateTime.equals(localDate.atStartOfDay())) | {
return localDate.toString();
}
else
{
return localDateTime.toLocalTime();
}
}
else
{
return value.toString();
}
}
} | repos\metasfresh-new_dawn_uat\misc\de-metas-common\de-metas-common-manufacturing\src\main\java\de\metas\common\handlingunits\JsonHUAttribute.java | 1 |
请在Spring Boot框架中完成以下Java代码 | public String getResourceName() {
return resourceName;
}
public void setResourceName(String resourceName) {
this.resourceName = resourceName;
}
@ApiModelProperty(example = "46aa6b3a-c0a1-11e6-bc93-6ab56fad108a")
public String getDeploymentId() {
return deploymentId;
}
public void setDeploymentId(String deploymentId) {
this.deploymentId = deploymentId;
}
@ApiModelProperty(example = "null") | public String getTenantId() {
return tenantId;
}
public void setTenantId(String tenantId) {
this.tenantId = tenantId;
}
@ApiModelProperty(example = "decision_table")
public String getDecisionType() {
return decisionType;
}
public void setDecisionType(String decisionType) {
this.decisionType = decisionType;
}
} | repos\flowable-engine-main\modules\flowable-dmn-rest\src\main\java\org\flowable\dmn\rest\service\api\repository\DecisionResponse.java | 2 |
请完成以下Java代码 | 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;
}
/** Set Quantity Invoiced.
@param ServiceLevelInvoiced
Quantity of product or service invoiced
*/
public void setServiceLevelInvoiced (BigDecimal ServiceLevelInvoiced)
{
set_ValueNoCheck (COLUMNNAME_ServiceLevelInvoiced, ServiceLevelInvoiced);
}
/** Get Quantity Invoiced.
@return Quantity of product or service invoiced
*/
public BigDecimal getServiceLevelInvoiced ()
{
BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_ServiceLevelInvoiced); | if (bd == null)
return Env.ZERO;
return bd;
}
/** Set Quantity Provided.
@param ServiceLevelProvided
Quantity of service or product provided
*/
public void setServiceLevelProvided (BigDecimal ServiceLevelProvided)
{
set_ValueNoCheck (COLUMNNAME_ServiceLevelProvided, ServiceLevelProvided);
}
/** Get Quantity Provided.
@return Quantity of service or product provided
*/
public BigDecimal getServiceLevelProvided ()
{
BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_ServiceLevelProvided);
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_C_ServiceLevel.java | 1 |
请在Spring Boot框架中完成以下Java代码 | protected @NonNull <K, V> CacheTypeAwareRegionFactoryBean<K, V> configureAsLocalClientRegion(
@NonNull Environment environment, @NonNull CacheTypeAwareRegionFactoryBean<K, V> clientRegion) {
ClientRegionShortcut shortcut =
environment.getProperty(SPRING_DATA_GEMFIRE_CACHE_CLIENT_REGION_SHORTCUT_PROPERTY,
ClientRegionShortcut.class, LOCAL_CLIENT_REGION_SHORTCUT);
clientRegion.setClientRegionShortcut(shortcut);
clientRegion.setPoolName(GemfireUtils.DEFAULT_POOL_NAME);
return clientRegion;
}
protected @NonNull <K, V> ClientRegionFactoryBean<K, V> configureAsLocalClientRegion(
@NonNull Environment environment, @NonNull ClientRegionFactoryBean<K, V> clientRegion) {
ClientRegionShortcut shortcut =
environment.getProperty(SPRING_DATA_GEMFIRE_CACHE_CLIENT_REGION_SHORTCUT_PROPERTY,
ClientRegionShortcut.class, LOCAL_CLIENT_REGION_SHORTCUT);
clientRegion.setPoolName(null);
clientRegion.setShortcut(shortcut);
return clientRegion;
}
public static final class AllClusterNotAvailableConditions extends AllNestedConditions {
public AllClusterNotAvailableConditions() {
super(ConfigurationPhase.PARSE_CONFIGURATION);
}
@Conditional(ClusterNotAvailableCondition.class)
static class IsClusterNotAvailableCondition { }
@Conditional(NotCloudFoundryEnvironmentCondition.class) | static class IsNotCloudFoundryEnvironmentCondition { }
@Conditional(NotKubernetesEnvironmentCondition.class)
static class IsNotKubernetesEnvironmentCondition { }
}
public static final class ClusterNotAvailableCondition extends ClusterAwareConfiguration.ClusterAwareCondition {
@Override
public synchronized boolean matches(@NonNull ConditionContext conditionContext,
@NonNull AnnotatedTypeMetadata typeMetadata) {
return !super.matches(conditionContext, typeMetadata);
}
}
public static final class NotCloudFoundryEnvironmentCondition implements Condition {
@Override
public boolean matches(@NonNull ConditionContext context, @NonNull AnnotatedTypeMetadata metadata) {
return !CloudPlatform.CLOUD_FOUNDRY.isActive(context.getEnvironment());
}
}
public static final class NotKubernetesEnvironmentCondition implements Condition {
@Override
public boolean matches(@NonNull ConditionContext context, @NonNull AnnotatedTypeMetadata metadata) {
return !CloudPlatform.KUBERNETES.isActive(context.getEnvironment());
}
}
} | repos\spring-boot-data-geode-main\spring-geode-project\spring-geode\src\main\java\org\springframework\geode\config\annotation\ClusterNotAvailableConfiguration.java | 2 |
请完成以下Java代码 | public void setCaseDefinitionName(String caseDefinitionName) {
this.caseDefinitionName = caseDefinitionName;
}
public int getXmlLineNumber() {
return xmlLineNumber;
}
public void setXmlLineNumber(int xmlLineNumber) {
this.xmlLineNumber = xmlLineNumber;
}
public int getXmlColumnNumber() {
return xmlColumnNumber;
}
public void setXmlColumnNumber(int xmlColumnNumber) {
this.xmlColumnNumber = xmlColumnNumber;
}
public String getProblem() {
return problem;
}
public void setProblem(String problem) {
this.problem = problem;
}
public String getDefaultDescription() {
return defaultDescription;
}
public void setDefaultDescription(String defaultDescription) {
this.defaultDescription = defaultDescription;
}
public String getItemId() {
return itemId;
}
public void setItemId(String itemId) {
this.itemId = itemId;
}
public String getItemName() {
return itemName;
}
public void setItemName(String itemName) {
this.itemName = itemName;
}
@Override | public String toString() {
StringBuilder strb = new StringBuilder();
strb.append("[Validation set: '").append(validatorSetName).append("' | Problem: '").append(problem).append("'] : ");
strb.append(defaultDescription);
strb.append(" - [Extra info : ");
boolean extraInfoAlreadyPresent = false;
if (caseDefinitionId != null) {
strb.append("caseDefinitionId = ").append(caseDefinitionId);
extraInfoAlreadyPresent = true;
}
if (caseDefinitionName != null) {
if (extraInfoAlreadyPresent) {
strb.append(" | ");
}
strb.append("caseDefinitionName = ").append(caseDefinitionName).append(" | ");
extraInfoAlreadyPresent = true;
}
if (itemId != null) {
if (extraInfoAlreadyPresent) {
strb.append(" | ");
}
strb.append("id = ").append(itemId).append(" | ");
extraInfoAlreadyPresent = true;
}
if (itemName != null) {
if (extraInfoAlreadyPresent) {
strb.append(" | ");
}
strb.append("name = ").append(itemName).append(" | ");
extraInfoAlreadyPresent = true;
}
strb.append("]");
if (xmlLineNumber > 0 && xmlColumnNumber > 0) {
strb.append(" ( line: ").append(xmlLineNumber).append(", column: ").append(xmlColumnNumber).append(")");
}
return strb.toString();
}
} | repos\flowable-engine-main\modules\flowable-case-validation\src\main\java\org\flowable\cmmn\validation\validator\ValidationEntry.java | 1 |
请在Spring Boot框架中完成以下Java代码 | private static URL toURL(@NonNull final I_MSV3_Vendor_Config configDataRecord)
{
try
{
return new URL(configDataRecord.getMSV3_BaseUrl());
}
catch (MalformedURLException e)
{
throw new AdempiereException("The MSV3_BaseUrl value of the given MSV3_Vendor_Config can't be parsed as URL", e)
.appendParametersToMessage()
.setParameter("MSV3_BaseUrl", configDataRecord.getMSV3_BaseUrl())
.setParameter("MSV3_Vendor_Config", configDataRecord);
}
}
public MSV3ClientConfig save(@NonNull final MSV3ClientConfig config)
{
final I_MSV3_Vendor_Config configRecord = createOrUpdateRecord(config);
saveRecord(configRecord);
return config.toBuilder()
.configId(MSV3ClientConfigId.ofRepoId(configRecord.getMSV3_Vendor_Config_ID()))
.build();
}
private I_MSV3_Vendor_Config createOrUpdateRecord(@NonNull final MSV3ClientConfig config)
{
final I_MSV3_Vendor_Config configRecord;
if (config.getConfigId() != null)
{
final int repoId = config.getConfigId().getRepoId();
configRecord = load(repoId, I_MSV3_Vendor_Config.class);
}
else
{
configRecord = newInstance(I_MSV3_Vendor_Config.class);
}
configRecord.setC_BPartner_ID(config.getBpartnerId().getBpartnerId());
configRecord.setMSV3_BaseUrl(config.getBaseUrl().toExternalForm());
configRecord.setPassword(config.getAuthPassword()); | configRecord.setUserID(config.getAuthUsername());
return configRecord;
}
private ClientSoftwareId retrieveSoftwareIndentifier()
{
try
{
final ADSystemInfo adSystem = Services.get(ISystemBL.class).get();
return ClientSoftwareId.of("metasfresh-" + adSystem.getDbVersion());
}
catch (final RuntimeException e)
{
return ClientSoftwareId.of("metasfresh-<unable to retrieve version!>");
}
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.vertical.pharma.vendor.gateway.msv3\src\main\java\de\metas\vertical\pharma\vendor\gateway\msv3\config\MSV3ClientConfigRepository.java | 2 |
请完成以下Java代码 | public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public Long getBookId() {
return bookId;
}
public void setBookId(Long bookId) {
this.bookId = bookId;
}
public int getStars() {
return stars;
}
public void setStars(int stars) {
this.stars = stars; | }
public boolean isFromCache() {
return fromCache;
}
public void setFromCache(boolean fromCache) {
this.fromCache = fromCache;
}
public Long getCachedTS() {
return cachedTS;
}
public void setCachedTS(Long cachedTS) {
this.cachedTS = cachedTS;
}
} | repos\tutorials-master\spring-cloud-modules\spring-cloud-bootstrap\zipkin-log-svc-rating\src\main\java\com\baeldung\spring\cloud\bootstrap\svcrating\rating\Rating.java | 1 |
请完成以下Java代码 | public final class MessageAuthorizationContext<T> {
private final Message<T> message;
private final Map<String, String> variables;
/**
* Creates an instance.
* @param message the {@link HttpServletRequest} to use
*/
public MessageAuthorizationContext(Message<T> message) {
this(message, Collections.emptyMap());
}
/**
* Creates an instance.
* @param message the {@link HttpServletRequest} to use
* @param variables a map containing key-value pairs representing extracted variable
* names and variable values
*/
public MessageAuthorizationContext(Message<T> message, Map<String, String> variables) {
this.message = message;
this.variables = variables; | }
/**
* Returns the {@link HttpServletRequest}.
* @return the {@link HttpServletRequest} to use
*/
public Message<T> getMessage() {
return this.message;
}
/**
* Returns the extracted variable values where the key is the variable name and the
* value is the variable value.
* @return a map containing key-value pairs representing extracted variable names and
* variable values
*/
public Map<String, String> getVariables() {
return this.variables;
}
} | repos\spring-security-main\messaging\src\main\java\org\springframework\security\messaging\access\intercept\MessageAuthorizationContext.java | 1 |
请完成以下Java代码 | public Object getPersistentState() {
Map<String, Object> persistentState = new HashMap<>();
persistentState.put("caseDefinitionId", caseDefinitionId);
persistentState.put("caseInstanceId", caseInstanceId);
persistentState.put("planItemInstanceId", planItemInstanceId);
persistentState.put("onPartId", onPartId);
persistentState.put("ifPart", ifPartId);
persistentState.put("timeStamp", timeStamp);
return persistentState;
}
@Override
public String getCaseDefinitionId() {
return caseDefinitionId;
}
@Override
public void setCaseDefinitionId(String caseDefinitionId) {
this.caseDefinitionId = caseDefinitionId;
}
@Override
public String getCaseInstanceId() {
return caseInstanceId;
}
@Override
public void setCaseInstanceId(String caseInstanceId) {
this.caseInstanceId = caseInstanceId;
}
@Override
public String getPlanItemInstanceId() {
return planItemInstanceId;
}
@Override
public void setPlanItemInstanceId(String planItemInstanceId) {
this.planItemInstanceId = planItemInstanceId;
}
@Override
public String getOnPartId() {
return onPartId;
}
@Override
public void setOnPartId(String onPartId) { | this.onPartId = onPartId;
}
@Override
public String getIfPartId() {
return ifPartId;
}
@Override
public void setIfPartId(String ifPartId) {
this.ifPartId = ifPartId;
}
@Override
public Date getTimeStamp() {
return timeStamp;
}
@Override
public void setTimeStamp(Date timeStamp) {
this.timeStamp = timeStamp;
}
} | repos\flowable-engine-main\modules\flowable-cmmn-engine\src\main\java\org\flowable\cmmn\engine\impl\persistence\entity\SentryPartInstanceEntityImpl.java | 1 |
请在Spring Boot框架中完成以下Java代码 | public class CompositeJobExecutionListenerJobDemo {
@Autowired
private JobBuilderFactory jobBuilderFactory;
@Autowired
private StepBuilderFactory stepBuilderFactory;
@Bean
public Job compositeJobExecutionListenerJob() {
return jobBuilderFactory.get("compositeJobExecutionListenerJob")
.start(step())
.listener(compositeJobExecutionListener())
.build();
}
private Step step() {
return stepBuilderFactory.get("step")
.tasklet((contribution, chunkContext) -> {
System.out.println("执行步骤....");
return RepeatStatus.FINISHED;
}).build();
}
private CompositeJobExecutionListener compositeJobExecutionListener() {
CompositeJobExecutionListener listener = new CompositeJobExecutionListener();
// 任务监听器1
JobExecutionListener jobExecutionListenerOne = new JobExecutionListener() {
@Override
public void beforeJob(JobExecution jobExecution) {
System.out.println("任务监听器One,before job execute: " + jobExecution.getJobInstance().getJobName());
}
@Override | public void afterJob(JobExecution jobExecution) {
System.out.println("任务监听器One,after job execute: " + jobExecution.getJobInstance().getJobName());
}
};
// 任务监听器2
JobExecutionListener jobExecutionListenerTwo = new JobExecutionListener() {
@Override
public void beforeJob(JobExecution jobExecution) {
System.out.println("任务监听器Two,before job execute: " + jobExecution.getJobInstance().getJobName());
}
@Override
public void afterJob(JobExecution jobExecution) {
System.out.println("任务监听器Two,after job execute: " + jobExecution.getJobInstance().getJobName());
}
};
// 聚合
listener.setListeners(Arrays.asList(jobExecutionListenerOne, jobExecutionListenerTwo));
return listener;
}
} | repos\SpringAll-master\71.spring-batch-listener\src\main\java\cc\mrbird\batch\job\CompositeJobExecutionListenerJobDemo.java | 2 |
请在Spring Boot框架中完成以下Java代码 | public class AlipayController {
@Autowired
private AlipayConfig alipayConfig;
@Autowired
private AlipayService alipayService;
@ApiOperation("支付宝电脑网站支付")
@RequestMapping(value = "/pay", method = RequestMethod.GET)
public void pay(AliPayParam aliPayParam, HttpServletResponse response) throws IOException {
response.setContentType("text/html;charset=" + alipayConfig.getCharset());
response.getWriter().write(alipayService.pay(aliPayParam));
response.getWriter().flush();
response.getWriter().close();
}
@ApiOperation("支付宝手机网站支付")
@RequestMapping(value = "/webPay", method = RequestMethod.GET)
public void webPay(AliPayParam aliPayParam, HttpServletResponse response) throws IOException {
response.setContentType("text/html;charset=" + alipayConfig.getCharset());
response.getWriter().write(alipayService.webPay(aliPayParam));
response.getWriter().flush(); | response.getWriter().close();
}
@ApiOperation(value = "支付宝异步回调",notes = "必须为POST请求,执行成功返回success,执行失败返回failure")
@RequestMapping(value = "/notify", method = RequestMethod.POST)
public String notify(HttpServletRequest request){
Map<String, String> params = new HashMap<>();
Map<String, String[]> requestParams = request.getParameterMap();
for (String name : requestParams.keySet()) {
params.put(name, request.getParameter(name));
}
return alipayService.notify(params);
}
@ApiOperation(value = "支付宝统一收单线下交易查询",notes = "订单支付成功返回交易状态:TRADE_SUCCESS")
@RequestMapping(value = "/query", method = RequestMethod.GET)
@ResponseBody
public CommonResult<String> query(String outTradeNo, String tradeNo){
return CommonResult.success(alipayService.query(outTradeNo,tradeNo));
}
} | repos\mall-master\mall-portal\src\main\java\com\macro\mall\portal\controller\AlipayController.java | 2 |
请完成以下Java代码 | public void put(String endpoint, TbX509DtlsSessionInfo msg) {
try (var c = connectionFactory.getConnection()) {
var serializedMsg = JavaSerDesUtil.encode(msg);
if (serializedMsg != null) {
c.set(getKey(endpoint), serializedMsg);
} else {
throw new RuntimeException("Problem with serialization of message: " + msg);
}
}
}
@Override
public TbX509DtlsSessionInfo get(String endpoint) {
try (var c = connectionFactory.getConnection()) {
var data = c.get(getKey(endpoint));
if (data != null) {
return JavaSerDesUtil.decode(data); | } else {
return null;
}
}
}
@Override
public void remove(String endpoint) {
try (var c = connectionFactory.getConnection()) {
c.del(getKey(endpoint));
}
}
private byte[] getKey(String endpoint) {
return (SESSION_EP + endpoint).getBytes();
}
} | repos\thingsboard-master\common\transport\lwm2m\src\main\java\org\thingsboard\server\transport\lwm2m\server\store\TbLwM2MDtlsSessionRedisStore.java | 1 |
请完成以下Java代码 | public void setM_RMAType_ID (int M_RMAType_ID)
{
if (M_RMAType_ID < 1)
set_ValueNoCheck (COLUMNNAME_M_RMAType_ID, null);
else
set_ValueNoCheck (COLUMNNAME_M_RMAType_ID, Integer.valueOf(M_RMAType_ID));
}
/** Get RMA Type.
@return Return Material Authorization Type
*/
public int getM_RMAType_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_M_RMAType_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());
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_M_RMAType.java | 1 |
请完成以下Java代码 | public JComponent getComponent()
{
return button;
}
public void addMouseListener(final MouseListener l)
{
button.addMouseListener(l);
}
public void addActionListener(final ActionListener l)
{
button.addActionListener(l);
} | public FavoritesGroup getGroup()
{
return group;
}
public MTreeNode getNode()
{
return node;
}
public int getNode_ID()
{
return node.getNode_ID();
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\client\src\main\java-legacy\org\compiere\grid\tree\FavoriteItem.java | 1 |
请完成以下Java代码 | public void sendEvent(String rawEvent, Map<String, Object> headerMap) {
if (exchange != null) {
rabbitOperations.convertAndSend(exchange, routingKey, rawEvent, m -> {
for (String headerKey : headerMap.keySet()) {
m.getMessageProperties().getHeaders().put(headerKey, headerMap.get(headerKey));
}
return m;
});
} else {
rabbitOperations.convertAndSend(routingKey, rawEvent, m -> {
for (String headerKey : headerMap.keySet()) {
m.getMessageProperties().getHeaders().put(headerKey, headerMap.get(headerKey));
}
return m;
});
}
}
public RabbitOperations getRabbitOperations() {
return rabbitOperations;
} | public void setRabbitOperations(RabbitOperations rabbitOperations) {
this.rabbitOperations = rabbitOperations;
}
public String getExchange() {
return exchange;
}
public void setExchange(String exchange) {
this.exchange = exchange;
}
public String getRoutingKey() {
return routingKey;
}
public void setRoutingKey(String routingKey) {
this.routingKey = routingKey;
}
} | repos\flowable-engine-main\modules\flowable-event-registry-spring\src\main\java\org\flowable\eventregistry\spring\rabbit\RabbitOperationsOutboundEventChannelAdapter.java | 1 |
请完成以下Java代码 | public void setInputVerifier (InputVerifier l)
{
m_textPane.setInputVerifier(l);
}
// metas: begin
public String getContentType()
{
if (m_textPane != null)
return m_textPane.getContentType();
return null;
}
private void setHyperlinkListener()
{
if (hyperlinkListenerClass == null)
{
return;
}
try
{
final HyperlinkListener listener = (HyperlinkListener)hyperlinkListenerClass.newInstance();
m_textPane.addHyperlinkListener(listener);
}
catch (Exception e)
{
log.warn("Cannot instantiate hyperlink listener - " + hyperlinkListenerClass, e);
}
}
private static Class<?> hyperlinkListenerClass; | static
{
final String hyperlinkListenerClassname = "de.metas.adempiere.gui.ADHyperlinkHandler";
try
{
hyperlinkListenerClass = Thread.currentThread().getContextClassLoader().loadClass(hyperlinkListenerClassname);
}
catch (Exception e)
{
log.warn("Cannot instantiate hyperlink listener - " + hyperlinkListenerClassname, e);
}
}
@Override
public final ICopyPasteSupportEditor getCopyPasteSupport()
{
return copyPasteSupport;
}
// metas: end
} // CTextPane | repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-legacy\org\compiere\swing\CTextPane.java | 1 |
请完成以下Java代码 | public static ImmutableSet<PaymentId> fromIntSet(@NonNull final Collection<Integer> repoIds)
{
if (repoIds.isEmpty())
{
return ImmutableSet.of();
}
return repoIds.stream().map(PaymentId::ofRepoIdOrNull).filter(Objects::nonNull).collect(ImmutableSet.toImmutableSet());
}
public static ImmutableSet<Integer> toIntSet(@NonNull final Collection<PaymentId> ids)
{
if (ids.isEmpty())
{
return ImmutableSet.of();
}
return ids.stream().map(PaymentId::getRepoId).collect(ImmutableSet.toImmutableSet());
}
int repoId;
private PaymentId(final int repoId) | {
this.repoId = Check.assumeGreaterThanZero(repoId, "C_Payment_ID");
}
@Override
@JsonValue
public int getRepoId()
{
return repoId;
}
public static boolean equals(@Nullable PaymentId id1, @Nullable PaymentId id2)
{
return Objects.equals(id1, id2);
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.business\src\main\java\de\metas\payment\PaymentId.java | 1 |
请完成以下Java代码 | public void setUnitCcy(String value) {
this.unitCcy = value;
}
/**
* Gets the value of the xchgRate property.
*
* @return
* possible object is
* {@link BigDecimal }
*
*/
public BigDecimal getXchgRate() {
return xchgRate;
}
/**
* Sets the value of the xchgRate property.
*
* @param value
* allowed object is
* {@link BigDecimal }
*
*/
public void setXchgRate(BigDecimal value) {
this.xchgRate = value;
}
/**
* Gets the value of the ctrctId property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getCtrctId() {
return ctrctId;
}
/**
* Sets the value of the ctrctId property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setCtrctId(String value) { | this.ctrctId = value;
}
/**
* Gets the value of the qtnDt property.
*
* @return
* possible object is
* {@link XMLGregorianCalendar }
*
*/
public XMLGregorianCalendar getQtnDt() {
return qtnDt;
}
/**
* Sets the value of the qtnDt property.
*
* @param value
* allowed object is
* {@link XMLGregorianCalendar }
*
*/
public void setQtnDt(XMLGregorianCalendar value) {
this.qtnDt = 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\CurrencyExchange5.java | 1 |
请完成以下Java代码 | public String toString() {
return new ToStringBuilder(this).append("INTVALUE", this.intValue).append("STRINGVALUE", this.strSample).toString();
}
public static void main(final String[] arguments) {
final BuilderMethods simple1 = new BuilderMethods(1, "The First One");
System.out.println(simple1.getName());
System.out.println(simple1.hashCode());
System.out.println(simple1.toString());
SampleLazyInitializer sampleLazyInitializer = new SampleLazyInitializer();
try {
sampleLazyInitializer.get();
} catch (ConcurrentException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
SampleBackgroundInitializer sampleBackgroundInitializer = new SampleBackgroundInitializer();
sampleBackgroundInitializer.start();
// Proceed with other tasks instead of waiting for the SampleBackgroundInitializer task to finish.
try {
Object result = sampleBackgroundInitializer.get();
} catch (ConcurrentException e) { | e.printStackTrace();
}
}
}
class SampleBackgroundInitializer extends BackgroundInitializer<String> {
@Override
protected String initialize() throws Exception {
return null;
}
// Any complex task that takes some time
} | repos\tutorials-master\libraries-apache-commons\src\main\java\com\baeldung\commons\lang3\BuilderMethods.java | 1 |
请在Spring Boot框架中完成以下Java代码 | public void setTenantId(String tenantId) {
this.tenantId = tenantId;
}
public String getTenantId() {
return tenantId;
}
public void setTenantIdLike(String tenantIdLike) {
this.tenantIdLike = tenantIdLike;
}
public String getTenantIdLike() {
return tenantIdLike;
}
public void setWithoutTenantId(Boolean withoutTenantId) {
this.withoutTenantId = withoutTenantId;
}
public Boolean getWithoutTenantId() {
return withoutTenantId;
}
public String getCandidateOrAssigned() {
return candidateOrAssigned;
}
public void setCandidateOrAssigned(String candidateOrAssigned) {
this.candidateOrAssigned = candidateOrAssigned;
}
public String getCategory() {
return category;
}
public void setCategory(String category) {
this.category = category;
}
public List<String> getCategoryIn() {
return categoryIn;
}
public void setCategoryIn(List<String> categoryIn) {
this.categoryIn = categoryIn;
}
public List<String> getCategoryNotIn() {
return categoryNotIn;
}
public void setCategoryNotIn(List<String> categoryNotIn) {
this.categoryNotIn = categoryNotIn; | }
public Boolean getWithoutCategory() {
return withoutCategory;
}
public void setWithoutCategory(Boolean withoutCategory) {
this.withoutCategory = withoutCategory;
}
public String getRootScopeId() {
return rootScopeId;
}
public void setRootScopeId(String rootScopeId) {
this.rootScopeId = rootScopeId;
}
public String getParentScopeId() {
return parentScopeId;
}
public void setParentScopeId(String parentScopeId) {
this.parentScopeId = parentScopeId;
}
public Set<String> getScopeIds() {
return scopeIds;
}
public void setScopeIds(Set<String> scopeIds) {
this.scopeIds = scopeIds;
}
} | repos\flowable-engine-main\modules\flowable-rest\src\main\java\org\flowable\rest\service\api\runtime\task\TaskQueryRequest.java | 2 |
请在Spring Boot框架中完成以下Java代码 | public Book postBook(@NotNull @Valid @RequestBody final Book book) {
return book;
}
@RequestMapping(method = RequestMethod.HEAD, value = "/")
@ResponseStatus(HttpStatus.OK)
public Book headBook() {
return new Book();
}
@DeleteMapping("/{id}")
@ResponseStatus(HttpStatus.OK)
public long deleteBook(@PathVariable final long id) {
return id;
}
@Operation(summary = "Create a new book") | @ApiResponses(value = {
@ApiResponse(responseCode = "201", description = "Book created successfully",
content = { @Content(mediaType = "application/json",
schema = @Schema(implementation = Book.class)) }),
@ApiResponse(responseCode = "400", description = "Invalid input provided") })
@PostMapping("/body-description")
public Book createBook(@io.swagger.v3.oas.annotations.parameters.RequestBody(
description = "Book to create", required = true,
content = @Content(mediaType = "application/json",
schema = @Schema(implementation = Book.class),
examples = @ExampleObject(value = "{ \"title\": \"New Book\", \"author\": \"Author Name\" }")))
@RequestBody Book book) {
return null;
}
} | repos\tutorials-master\spring-boot-modules\spring-boot-springdoc\src\main\java\com\baeldung\springdoc\controller\BookController.java | 2 |
请完成以下Java代码 | public class CustomBatchIterator<T> implements Iterator<List<T>> {
private final int batchSize;
private List<T> currentBatch;
private final Iterator<T> iterator;
private CustomBatchIterator(Iterator<T> sourceIterator, int batchSize) {
this.batchSize = batchSize;
this.iterator = sourceIterator;
}
@Override
public List<T> next() {
prepareNextBatch();
return currentBatch;
}
@Override
public boolean hasNext() { | return iterator.hasNext();
}
public static <T> Stream<List<T>> batchStreamOf(Stream<T> stream, int batchSize) {
return stream(new CustomBatchIterator<>(stream.iterator(), batchSize));
}
private static <T> Stream<T> stream(Iterator<T> iterator) {
return StreamSupport.stream(Spliterators.spliteratorUnknownSize(iterator, ORDERED), false);
}
private void prepareNextBatch() {
currentBatch = new ArrayList<>(batchSize);
while (iterator.hasNext() && currentBatch.size() < batchSize) {
currentBatch.add(iterator.next());
}
}
} | repos\tutorials-master\core-java-modules\core-java-streams-4\src\main\java\com\baeldung\streams\processing\CustomBatchIterator.java | 1 |
请完成以下Java代码 | public void setC_Flatrate_Conditions_ID (final int C_Flatrate_Conditions_ID)
{
if (C_Flatrate_Conditions_ID < 1)
set_Value (COLUMNNAME_C_Flatrate_Conditions_ID, null);
else
set_Value (COLUMNNAME_C_Flatrate_Conditions_ID, C_Flatrate_Conditions_ID);
}
@Override
public int getC_Flatrate_Conditions_ID()
{
return get_ValueAsInt(COLUMNNAME_C_Flatrate_Conditions_ID);
}
@Override
public void setC_UOM_ID (final int C_UOM_ID)
{
if (C_UOM_ID < 1)
set_Value (COLUMNNAME_C_UOM_ID, null);
else
set_Value (COLUMNNAME_C_UOM_ID, C_UOM_ID);
}
@Override
public int getC_UOM_ID()
{
return get_ValueAsInt(COLUMNNAME_C_UOM_ID);
}
@Override
public void setIsAllowSeparateInvoicing (final boolean IsAllowSeparateInvoicing)
{
set_Value (COLUMNNAME_IsAllowSeparateInvoicing, IsAllowSeparateInvoicing);
}
@Override
public boolean isAllowSeparateInvoicing()
{
return get_ValueAsBoolean(COLUMNNAME_IsAllowSeparateInvoicing);
}
@Override
public void setIsHideWhenPrinting (final boolean IsHideWhenPrinting)
{
set_Value (COLUMNNAME_IsHideWhenPrinting, IsHideWhenPrinting);
}
@Override
public boolean isHideWhenPrinting()
{
return get_ValueAsBoolean(COLUMNNAME_IsHideWhenPrinting);
}
@Override
public void setM_Product_ID (final int M_Product_ID)
{
if (M_Product_ID < 1)
set_Value (COLUMNNAME_M_Product_ID, null);
else | set_Value (COLUMNNAME_M_Product_ID, M_Product_ID);
}
@Override
public int getM_Product_ID()
{
return get_ValueAsInt(COLUMNNAME_M_Product_ID);
}
@Override
public void setQty (final BigDecimal Qty)
{
set_Value (COLUMNNAME_Qty, Qty);
}
@Override
public BigDecimal getQty()
{
final BigDecimal bd = get_ValueAsBigDecimal(COLUMNNAME_Qty);
return bd != null ? bd : BigDecimal.ZERO;
}
@Override
public void setSeqNo (final int SeqNo)
{
set_Value (COLUMNNAME_SeqNo, SeqNo);
}
@Override
public int getSeqNo()
{
return get_ValueAsInt(COLUMNNAME_SeqNo);
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\de\metas\order\model\X_C_CompensationGroup_Schema_TemplateLine.java | 1 |
请在Spring Boot框架中完成以下Java代码 | public @Nullable Duration getStaleWhileRevalidate() {
return this.staleWhileRevalidate;
}
public void setStaleWhileRevalidate(@Nullable Duration staleWhileRevalidate) {
this.customized = true;
this.staleWhileRevalidate = staleWhileRevalidate;
}
public @Nullable Duration getStaleIfError() {
return this.staleIfError;
}
public void setStaleIfError(@Nullable Duration staleIfError) {
this.customized = true;
this.staleIfError = staleIfError;
}
public @Nullable Duration getSMaxAge() {
return this.sMaxAge;
}
public void setSMaxAge(@Nullable Duration sMaxAge) {
this.customized = true;
this.sMaxAge = sMaxAge;
}
public @Nullable CacheControl toHttpCacheControl() {
PropertyMapper map = PropertyMapper.get();
CacheControl control = createCacheControl();
map.from(this::getMustRevalidate).whenTrue().toCall(control::mustRevalidate);
map.from(this::getNoTransform).whenTrue().toCall(control::noTransform);
map.from(this::getCachePublic).whenTrue().toCall(control::cachePublic);
map.from(this::getCachePrivate).whenTrue().toCall(control::cachePrivate);
map.from(this::getProxyRevalidate).whenTrue().toCall(control::proxyRevalidate);
map.from(this::getStaleWhileRevalidate)
.to((duration) -> control.staleWhileRevalidate(duration.getSeconds(), TimeUnit.SECONDS));
map.from(this::getStaleIfError)
.to((duration) -> control.staleIfError(duration.getSeconds(), TimeUnit.SECONDS));
map.from(this::getSMaxAge)
.to((duration) -> control.sMaxAge(duration.getSeconds(), TimeUnit.SECONDS));
// check if cacheControl remained untouched
if (control.getHeaderValue() == null) {
return null;
} | return control;
}
private CacheControl createCacheControl() {
if (Boolean.TRUE.equals(this.noStore)) {
return CacheControl.noStore();
}
if (Boolean.TRUE.equals(this.noCache)) {
return CacheControl.noCache();
}
if (this.maxAge != null) {
return CacheControl.maxAge(this.maxAge.getSeconds(), TimeUnit.SECONDS);
}
return CacheControl.empty();
}
private boolean hasBeenCustomized() {
return this.customized;
}
}
}
}
} | repos\spring-boot-4.0.1\core\spring-boot-autoconfigure\src\main\java\org\springframework\boot\autoconfigure\web\WebProperties.java | 2 |
请完成以下Java代码 | public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
User user = (User) o;
return id == user.id &&
age == user.age &&
Objects.equals(name, user.name) &&
Objects.equals(creationDate, user.creationDate) &&
Objects.equals(email, user.email) &&
Objects.equals(status, user.status);
}
@Override
public int hashCode() {
return Objects.hash(id, name, creationDate, age, email, status);
}
public LocalDate getLastLoginDate() { | return lastLoginDate;
}
public void setLastLoginDate(LocalDate lastLoginDate) {
this.lastLoginDate = lastLoginDate;
}
public boolean isActive() {
return active;
}
public void setActive(boolean active) {
this.active = active;
}
} | repos\tutorials-master\persistence-modules\spring-data-jpa-enterprise\src\main\java\com\baeldung\boot\domain\User.java | 1 |
请完成以下Java代码 | private String createInfo(@NonNull final I_SEPA_Export_Line line)
{
final StringBuilder sb = new StringBuilder();
if (line.getC_BPartner_ID() > 0)
{
sb.append("@C_BPartner_ID@ ");
sb.append(getBPartnerNameById(line.getC_BPartner_ID()));
}
if (line.getC_BP_BankAccount_ID() > 0)
{
sb.append(" @C_BP_BankAccount_ID@ ");
sb.append(line.getC_BP_BankAccount().getDescription());
}
return Services.get(IMsgBL.class).parseTranslation(InterfaceWrapperHelper.getCtx(line), sb.toString());
}
@VisibleForTesting
@Nullable
static String replaceForbiddenChars(@Nullable final String input)
{
if (input == null)
{
return null;
}
return input.replaceAll(FORBIDDEN_CHARS, "_");
}
private String getBPartnerNameById(final int bpartnerRepoId)
{
final IBPartnerBL bpartnerService = Services.get(IBPartnerBL.class);
return bpartnerService.getBPartnerName(BPartnerId.ofRepoIdOrNull(bpartnerRepoId));
}
@NonNull
private PartyIdentification32CHName convertPartyIdentification32CHName(
@NonNull final I_SEPA_Export_Line line,
@Nullable final BankAccount bankAccount,
@NonNull final String paymentType)
{
final PartyIdentification32CHName cdtr = objectFactory.createPartyIdentification32CHName();
if (bankAccount == null)
{
cdtr.setNm(SepaUtils.replaceForbiddenChars(getFirstNonEmpty(
line::getSEPA_MandateRefNo,
() -> getBPartnerNameById(line.getC_BPartner_ID()))));
}
else
{
cdtr.setNm(SepaUtils.replaceForbiddenChars(getFirstNonEmpty(
bankAccount::getAccountName,
line::getSEPA_MandateRefNo,
() -> getBPartnerNameById(line.getC_BPartner_ID()))));
} | final Properties ctx = InterfaceWrapperHelper.getCtx(line);
final I_C_BPartner_Location billToLocation = partnerDAO.retrieveBillToLocation(ctx, line.getC_BPartner_ID(), true, ITrx.TRXNAME_None);
if ((bankAccount == null || !bankAccount.isAddressComplete()) && billToLocation == null)
{
return cdtr;
}
final I_C_Location location = locationDAO.getById(LocationId.ofRepoId(billToLocation.getC_Location_ID()));
final PostalAddress6CH pstlAdr;
if (Objects.equals(paymentType, PAYMENT_TYPE_5) || Objects.equals(paymentType, PAYMENT_TYPE_6))
{
pstlAdr = createUnstructuredPstlAdr(bankAccount, location);
}
else
{
pstlAdr = createStructuredPstlAdr(bankAccount, location);
}
cdtr.setPstlAdr(pstlAdr);
return cdtr;
}
@VisibleForTesting
static boolean isInvalidQRReference(@NonNull final String reference)
{
if (reference.length() != 27)
{
return true;
}
final int[] checkSequence = { 0, 9, 4, 6, 8, 2, 7, 1, 3, 5 };
int carryOver = 0;
for (int i = 1; i <= reference.length() - 1; i++)
{
final int idx = ((carryOver + Integer.parseInt(reference.substring(i - 1, i))) % 10);
carryOver = checkSequence[idx];
}
return !(Integer.parseInt(reference.substring(26)) == (10 - carryOver) % 10);
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.payment.sepa\base\src\main\java\de\metas\payment\sepa\sepamarshaller\impl\SEPAVendorCreditTransferMarshaler_Pain_001_001_03_CH_02.java | 1 |
请完成以下Java代码 | public void setC_BPartner_ID (int C_BPartner_ID)
{
if (C_BPartner_ID < 1)
set_Value (COLUMNNAME_C_BPartner_ID, null);
else
set_Value (COLUMNNAME_C_BPartner_ID, Integer.valueOf(C_BPartner_ID));
}
/** Get Business Partner .
@return Identifies a Business Partner
*/
public int getC_BPartner_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_C_BPartner_ID);
if (ii == null)
return 0;
return ii.intValue();
}
/** Set EMail Address.
@param EMail
Electronic Mail Address
*/
public void setEMail (String EMail)
{
set_Value (COLUMNNAME_EMail, EMail);
}
/** Get EMail Address.
@return Electronic Mail Address
*/
public String getEMail ()
{
return (String)get_Value(COLUMNNAME_EMail);
}
public I_M_PriceList getM_PriceList() throws RuntimeException
{
return (I_M_PriceList)MTable.get(getCtx(), I_M_PriceList.Table_Name)
.getPO(getM_PriceList_ID(), get_TrxName()); }
/** Set Price List.
@param M_PriceList_ID
Unique identifier of a Price List
*/
public void setM_PriceList_ID (int M_PriceList_ID)
{
if (M_PriceList_ID < 1)
set_Value (COLUMNNAME_M_PriceList_ID, null);
else
set_Value (COLUMNNAME_M_PriceList_ID, Integer.valueOf(M_PriceList_ID));
}
/** Get Price List.
@return Unique identifier of a Price List
*/
public int getM_PriceList_ID () | {
Integer ii = (Integer)get_Value(COLUMNNAME_M_PriceList_ID);
if (ii == null)
return 0;
return ii.intValue();
}
/** Set Session ID.
@param Session_ID Session ID */
public void setSession_ID (int Session_ID)
{
if (Session_ID < 1)
set_Value (COLUMNNAME_Session_ID, null);
else
set_Value (COLUMNNAME_Session_ID, Integer.valueOf(Session_ID));
}
/** Get Session ID.
@return Session ID */
public int getSession_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_Session_ID);
if (ii == null)
return 0;
return ii.intValue();
}
/** Get Record ID/ColumnName
@return ID/ColumnName pair
*/
public KeyNamePair getKeyNamePair()
{
return new KeyNamePair(get_ID(), String.valueOf(getSession_ID()));
}
/** Set W_Basket_ID.
@param W_Basket_ID
Web Basket
*/
public void setW_Basket_ID (int W_Basket_ID)
{
if (W_Basket_ID < 1)
set_ValueNoCheck (COLUMNNAME_W_Basket_ID, null);
else
set_ValueNoCheck (COLUMNNAME_W_Basket_ID, Integer.valueOf(W_Basket_ID));
}
/** Get W_Basket_ID.
@return Web Basket
*/
public int getW_Basket_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_W_Basket_ID);
if (ii == null)
return 0;
return ii.intValue();
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_W_Basket.java | 1 |
请完成以下Java代码 | public static void setDtlsConnectorConfigCidLength(Configuration serverCoapConfig, Integer cIdLength) {
serverCoapConfig.setTransient(DTLS_CONNECTION_ID_LENGTH);
serverCoapConfig.setTransient(DTLS_CONNECTION_ID_NODE_ID);
serverCoapConfig.set(DTLS_CONNECTION_ID_LENGTH, cIdLength);
if (cIdLength > 4) {
serverCoapConfig.set(DTLS_CONNECTION_ID_NODE_ID, 0);
} else {
serverCoapConfig.set(DTLS_CONNECTION_ID_NODE_ID, null);
}
}
public static ConcurrentHashMap<Integer, String[]> groupByObjectIdVersionedIds(Set<String> targetIds) {
return targetIds.stream()
.collect(Collectors.groupingBy(
id -> new LwM2mPath(fromVersionedIdToObjectId(id)).getObjectId(),
ConcurrentHashMap::new,
Collectors.collectingAndThen(
Collectors.toList(),
list -> list.toArray(new String[0])
)
));
}
public static boolean areArraysStringEqual(String[] oldValue, String[] newValue) {
if (oldValue == null || newValue == null) return false;
if (oldValue.length != newValue.length) return false;
String[] sorted1 = oldValue.clone();
String[] sorted2 = newValue.clone();
Arrays.sort(sorted1);
Arrays.sort(sorted2);
return Arrays.equals(sorted1, sorted2);
}
public static ConcurrentHashMap<Integer, String[]> deepCopyConcurrentMap(Map<Integer, String[]> original) {
return original.isEmpty() ? new ConcurrentHashMap<>() : original.entrySet().stream()
.collect(Collectors.toMap(
Map.Entry::getKey,
entry -> entry.getValue() != null ? entry.getValue().clone() : null,
(v1, v2) -> v1, // merge function in case of duplicate keys
ConcurrentHashMap::new | ));
}
public static boolean areMapsEqual(Map<Integer, String[]> m1, Map<Integer, String[]> m2) {
if (m1.size() != m2.size()) return false;
for (Integer key : m1.keySet()) {
if (!m2.containsKey(key)) return false;
String[] arr1 = m1.get(key);
String[] arr2 = m2.get(key);
if (arr1 == null || arr2 == null) {
if (arr1 != arr2) return false;
String[] sorted1 = arr1.clone();
String[] sorted2 = arr2.clone();
Arrays.sort(sorted1);
Arrays.sort(sorted2);
if (!Arrays.equals(sorted1, sorted2)) return false;
}
}
return true;
}
} | repos\thingsboard-master\common\transport\lwm2m\src\main\java\org\thingsboard\server\transport\lwm2m\utils\LwM2MTransportUtil.java | 1 |
请完成以下Java代码 | public CommandInterceptor createTransactionInterceptor() {
return null;
}
@Override
protected void postProcessEngineInitialisation() {
// empty here. will be done in registerTenant
}
@Override
public Runnable getProcessEngineCloseRunnable() {
return new Runnable() {
@Override
public void run() {
for (String tenantId : tenantInfoHolder.getAllTenants()) {
tenantInfoHolder.setCurrentTenantId(tenantId);
if (asyncExecutor != null) {
commandExecutor.execute(new ClearProcessInstanceLockTimesCmd(asyncExecutor.getLockOwner()));
}
commandExecutor.execute(getProcessEngineCloseCommand());
tenantInfoHolder.clearCurrentTenantId();
}
} | };
}
public Command<Void> getProcessEngineCloseCommand() {
return new Command<>() {
@Override
public Void execute(CommandContext commandContext) {
CommandContextUtil.getProcessEngineConfiguration(commandContext).getCommandExecutor().execute(new SchemaOperationProcessEngineClose());
return null;
}
};
}
public TenantInfoHolder getTenantInfoHolder() {
return tenantInfoHolder;
}
} | repos\flowable-engine-main\modules\flowable-engine\src\main\java\org\flowable\engine\impl\cfg\multitenant\MultiSchemaMultiTenantProcessEngineConfiguration.java | 1 |
请在Spring Boot框架中完成以下Java代码 | public String getFREETEXT() {
return freetext;
}
/**
* Sets the value of the freetext property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setFREETEXT(String value) {
this.freetext = value;
}
/**
* Gets the value of the freetextcode property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getFREETEXTCODE() {
return freetextcode;
}
/**
* Sets the value of the freetextcode property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setFREETEXTCODE(String value) {
this.freetextcode = value;
}
/**
* Gets the value of the freetextlanguage property.
*
* @return
* possible object is | * {@link String }
*
*/
public String getFREETEXTLANGUAGE() {
return freetextlanguage;
}
/**
* Sets the value of the freetextlanguage property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setFREETEXTLANGUAGE(String value) {
this.freetextlanguage = value;
}
/**
* Gets the value of the freetextfunction property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getFREETEXTFUNCTION() {
return freetextfunction;
}
/**
* Sets the value of the freetextfunction property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setFREETEXTFUNCTION(String value) {
this.freetextfunction = value;
}
} | repos\metasfresh-new_dawn_uat\misc\services\camel\de-metas-camel-edi\src\main\java-xjc_stepcom_desadv\de\metas\edi\esb\jaxb\stepcom\desadv\DTEXT1.java | 2 |
请完成以下Java代码 | public ELResolver getELResolver() {
return elResolver;
}
@Override
public FunctionMapper getFunctionMapper() {
return null;
}
@Override
public VariableMapper getVariableMapper() {
return null;
}
// delegate methods ////////////////////////////
@Override
@SuppressWarnings("rawtypes")
public Object getContext(Class key) {
return delegateContext.getContext(key);
}
@Override
public boolean equals(Object obj) {
return delegateContext.equals(obj);
}
@Override
public Locale getLocale() {
return delegateContext.getLocale();
}
@Override
public boolean isPropertyResolved() {
return delegateContext.isPropertyResolved(); | }
@Override
@SuppressWarnings("rawtypes")
public void putContext(Class key, Object contextObject) {
delegateContext.putContext(key, contextObject);
}
@Override
public void setLocale(Locale locale) {
delegateContext.setLocale(locale);
}
@Override
public void setPropertyResolved(boolean resolved) {
delegateContext.setPropertyResolved(resolved);
}
} | repos\camunda-bpm-platform-master\engine-cdi\core\src\main\java\org\camunda\bpm\engine\cdi\impl\el\ElContextDelegate.java | 1 |
请完成以下Java代码 | String getConfigSummary()
{
return config != null ? config.toString() : "";
}
@Nullable
String getRequestAsString()
{
return elementToString(requestElement);
}
@Nullable
String getResponseAsString()
{
return elementToString(responseElement);
}
@Nullable
private String elementToString(@Nullable final Object element)
{
if (element == null)
{
return null;
}
try
{ | final StringResult result = new StringResult();
marshaller.marshal(element, result);
return cleanupPdfData(result.toString());
}
catch (final Exception ex)
{
throw new AdempiereException("Failed converting " + element + " to String", ex);
}
}
/**
* remove the pdfdata since it's long and useless and we also attach it to the PO record
*/
@NonNull
@VisibleForTesting
static String cleanupPdfData(@NonNull final String s)
{
return s.replaceAll(PARCELLABELS_PDF_REGEX, PARCELLABELS_PDF_REPLACEMENT_TEXT);
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.shipper.gateway.dpd\src\main\java\de\metas\shipper\gateway\dpd\logger\DpdClientLogEvent.java | 1 |
请在Spring Boot框架中完成以下Java代码 | public Amount getPriceSubtotal()
{
return priceSubtotal;
}
public void setPriceSubtotal(Amount priceSubtotal)
{
this.priceSubtotal = priceSubtotal;
}
public PricingSummary tax(Amount tax)
{
this.tax = tax;
return this;
}
/**
* Get tax
*
* @return tax
**/
@javax.annotation.Nullable
@ApiModelProperty(value = "")
public Amount getTax()
{
return tax;
}
public void setTax(Amount tax)
{
this.tax = tax;
}
public PricingSummary total(Amount total)
{
this.total = total;
return this;
}
/**
* Get total
*
* @return total
**/
@javax.annotation.Nullable
@ApiModelProperty(value = "")
public Amount getTotal()
{
return total;
}
public void setTotal(Amount total)
{
this.total = total;
}
@Override
public boolean equals(Object o)
{ | if (this == o)
{
return true;
}
if (o == null || getClass() != o.getClass())
{
return false;
}
PricingSummary pricingSummary = (PricingSummary)o;
return Objects.equals(this.adjustment, pricingSummary.adjustment) &&
Objects.equals(this.deliveryCost, pricingSummary.deliveryCost) &&
Objects.equals(this.deliveryDiscount, pricingSummary.deliveryDiscount) &&
Objects.equals(this.fee, pricingSummary.fee) &&
Objects.equals(this.priceDiscountSubtotal, pricingSummary.priceDiscountSubtotal) &&
Objects.equals(this.priceSubtotal, pricingSummary.priceSubtotal) &&
Objects.equals(this.tax, pricingSummary.tax) &&
Objects.equals(this.total, pricingSummary.total);
}
@Override
public int hashCode()
{
return Objects.hash(adjustment, deliveryCost, deliveryDiscount, fee, priceDiscountSubtotal, priceSubtotal, tax, total);
}
@Override
public String toString()
{
StringBuilder sb = new StringBuilder();
sb.append("class PricingSummary {\n");
sb.append(" adjustment: ").append(toIndentedString(adjustment)).append("\n");
sb.append(" deliveryCost: ").append(toIndentedString(deliveryCost)).append("\n");
sb.append(" deliveryDiscount: ").append(toIndentedString(deliveryDiscount)).append("\n");
sb.append(" fee: ").append(toIndentedString(fee)).append("\n");
sb.append(" priceDiscountSubtotal: ").append(toIndentedString(priceDiscountSubtotal)).append("\n");
sb.append(" priceSubtotal: ").append(toIndentedString(priceSubtotal)).append("\n");
sb.append(" tax: ").append(toIndentedString(tax)).append("\n");
sb.append(" total: ").append(toIndentedString(total)).append("\n");
sb.append("}");
return sb.toString();
}
/**
* Convert the given object to string with each line indented by 4 spaces
* (except the first line).
*/
private String toIndentedString(Object o)
{
if (o == null)
{
return "null";
}
return o.toString().replace("\n", "\n ");
}
} | repos\metasfresh-new_dawn_uat\misc\services\camel\de-metas-camel-externalsystems\de-metas-camel-ebay\ebay-api-client\src\main\java\de\metas\camel\externalsystems\ebay\api\model\PricingSummary.java | 2 |
请完成以下Java代码 | public void setA_Table_Rate_Type (String A_Table_Rate_Type)
{
set_Value (COLUMNNAME_A_Table_Rate_Type, A_Table_Rate_Type);
}
/** Get Type.
@return Type */
public String getA_Table_Rate_Type ()
{
return (String)get_Value(COLUMNNAME_A_Table_Rate_Type);
}
/** A_Term AD_Reference_ID=53256 */
public static final int A_TERM_AD_Reference_ID=53256;
/** Period = PR */
public static final String A_TERM_Period = "PR";
/** Yearly = YR */
public static final String A_TERM_Yearly = "YR";
/** Set Period/Yearly.
@param A_Term Period/Yearly */
public void setA_Term (String A_Term)
{
set_Value (COLUMNNAME_A_Term, A_Term);
}
/** Get Period/Yearly.
@return Period/Yearly */
public String getA_Term ()
{
return (String)get_Value(COLUMNNAME_A_Term);
}
/** 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 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;
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_A_Depreciation_Table_Header.java | 1 |
请在Spring Boot框架中完成以下Java代码 | public class PmsProductAttributeCategoryServiceImpl implements PmsProductAttributeCategoryService {
@Autowired
private PmsProductAttributeCategoryMapper productAttributeCategoryMapper;
@Autowired
private PmsProductAttributeCategoryDao productAttributeCategoryDao;
@Override
public int create(String name) {
PmsProductAttributeCategory productAttributeCategory = new PmsProductAttributeCategory();
productAttributeCategory.setName(name);
return productAttributeCategoryMapper.insertSelective(productAttributeCategory);
}
@Override
public int update(Long id, String name) {
PmsProductAttributeCategory productAttributeCategory = new PmsProductAttributeCategory();
productAttributeCategory.setName(name);
productAttributeCategory.setId(id);
return productAttributeCategoryMapper.updateByPrimaryKeySelective(productAttributeCategory);
} | @Override
public int delete(Long id) {
return productAttributeCategoryMapper.deleteByPrimaryKey(id);
}
@Override
public PmsProductAttributeCategory getItem(Long id) {
return productAttributeCategoryMapper.selectByPrimaryKey(id);
}
@Override
public List<PmsProductAttributeCategory> getList(Integer pageSize, Integer pageNum) {
PageHelper.startPage(pageNum,pageSize);
return productAttributeCategoryMapper.selectByExample(new PmsProductAttributeCategoryExample());
}
@Override
public List<PmsProductAttributeCategoryItem> getListWithAttr() {
return productAttributeCategoryDao.getListWithAttr();
}
} | repos\mall-master\mall-admin\src\main\java\com\macro\mall\service\impl\PmsProductAttributeCategoryServiceImpl.java | 2 |
请完成以下Java代码 | public int getCM_AccessProfile_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_CM_AccessProfile_ID);
if (ii == null)
return 0;
return ii.intValue();
}
public I_CM_Media getCM_Media() throws RuntimeException
{
return (I_CM_Media)MTable.get(getCtx(), I_CM_Media.Table_Name)
.getPO(getCM_Media_ID(), get_TrxName()); }
/** Set Media Item.
@param CM_Media_ID
Contains media content like images, flash movies etc.
*/
public void setCM_Media_ID (int CM_Media_ID) | {
if (CM_Media_ID < 1)
set_ValueNoCheck (COLUMNNAME_CM_Media_ID, null);
else
set_ValueNoCheck (COLUMNNAME_CM_Media_ID, Integer.valueOf(CM_Media_ID));
}
/** Get Media Item.
@return Contains media content like images, flash movies etc.
*/
public int getCM_Media_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_CM_Media_ID);
if (ii == null)
return 0;
return ii.intValue();
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_CM_AccessMedia.java | 1 |
请完成以下Java代码 | private static ImmutableMap<Integer, SeqNo> createCache(final int lastSeqNoValue)
{
final ImmutableMap.Builder<Integer, SeqNo> builder = ImmutableMap.builder();
for (int i = 0; i <= lastSeqNoValue; i += STEP)
{
builder.put(i, new SeqNo(i));
}
return builder.build();
}
@JsonCreator
public static SeqNo ofInt(final int value)
{
final SeqNo seqNo = cache.get(value);
return seqNo != null ? seqNo : new SeqNo(value);
}
@Deprecated
@Override
public String toString()
{
return String.valueOf(value);
}
@JsonValue | public int toInt()
{
return value;
}
public SeqNo next()
{
return ofInt(value / STEP * STEP + STEP);
}
@Override
public int compareTo(@NonNull final SeqNo other)
{
return this.value - other.value;
}
public static boolean equals(@Nullable final SeqNo seqNo1, @Nullable final SeqNo seqNo2)
{
return Objects.equals(seqNo1, seqNo2);
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.util\src\main\java\de\metas\util\lang\SeqNo.java | 1 |
请在Spring Boot框架中完成以下Java代码 | public void notifySend(String notifyUrl, String merchantOrderNo, String merchantNo) {
RpNotifyRecord record = new RpNotifyRecord();
record.setNotifyTimes(0);
record.setLimitNotifyTimes(5);
record.setStatus(NotifyStatusEnum.CREATED.name());
record.setUrl(notifyUrl);
record.setMerchantOrderNo(merchantOrderNo);
record.setMerchantNo(merchantNo);
record.setNotifyType(NotifyTypeEnum.MERCHANT.name());
Object toJSON = JSONObject.toJSON(record);
final String str = toJSON.toString();
notifyJmsTemplate.setDefaultDestinationName(MqConfig.MERCHANT_NOTIFY_QUEUE);
notifyJmsTemplate.send(new MessageCreator() {
public Message createMessage(Session session) throws JMSException {
return session.createTextMessage(str);
}
});
}
/**
* 订单通知
*
* @param merchantOrderNo
*/
@Override
public void orderSend(String bankOrderNo) {
final String orderNo = bankOrderNo;
jmsTemplate.setDefaultDestinationName(MqConfig.ORDER_NOTIFY_QUEUE);
jmsTemplate.send(new MessageCreator() {
public Message createMessage(Session session) throws JMSException {
return session.createTextMessage(orderNo);
}
});
}
/**
* 通过ID获取通知记录
*
* @param id
* @return
*/
@Override
public RpNotifyRecord getNotifyRecordById(String id) {
return rpNotifyRecordDao.getById(id);
}
/**
* 根据商户编号,商户订单号,通知类型获取通知记录
*
* @param merchantNo
* 商户编号 | * @param merchantOrderNo
* 商户订单号
* @param notifyType
* 消息类型
* @return
*/
@Override
public RpNotifyRecord getNotifyByMerchantNoAndMerchantOrderNoAndNotifyType(String merchantNo,
String merchantOrderNo, String notifyType) {
return rpNotifyRecordDao.getNotifyByMerchantNoAndMerchantOrderNoAndNotifyType(merchantNo, merchantOrderNo,
notifyType);
}
@Override
public PageBean<RpNotifyRecord> queryNotifyRecordListPage(PageParam pageParam, Map<String, Object> paramMap) {
return rpNotifyRecordDao.listPage(pageParam, paramMap);
}
/**
* 创建消息通知
*
* @param rpNotifyRecord
*/
@Override
public long createNotifyRecord(RpNotifyRecord rpNotifyRecord) {
return rpNotifyRecordDao.insert(rpNotifyRecord);
}
/**
* 修改消息通知
*
* @param rpNotifyRecord
*/
@Override
public void updateNotifyRecord(RpNotifyRecord rpNotifyRecord) {
rpNotifyRecordDao.update(rpNotifyRecord);
}
/**
* 创建消息通知记录
*
* @param rpNotifyRecordLog
* @return
*/
@Override
public long createNotifyRecordLog(RpNotifyRecordLog rpNotifyRecordLog) {
return rpNotifyRecordLogDao.insert(rpNotifyRecordLog);
}
} | repos\roncoo-pay-master\roncoo-pay-service\src\main\java\com\roncoo\pay\notify\service\impl\RpNotifyServiceImpl.java | 2 |
请在Spring Boot框架中完成以下Java代码 | public class UserController {
@Inject
private BindingResult bindingResult;
private static final List<User> users = new ArrayList<>();
@Inject
private Models models;
/**
* This is a controller. It displays a initial form to the user.
* @return The view name
*/
@GET
@Controller
public String showForm() {
return "user.jsp";
}
/**
* The method handles the form submits
* Handles HTTP POST and is CSRF protected. The client invoking this controller should provide a CSRF token.
* @param user The user details that has to be stored
* @return Returns a view name
*/
@POST
@Controller
@CsrfProtected
public String saveUser(@Valid @BeanParam User user) {
if (bindingResult.isFailed()) {
models.put("errors", bindingResult.getAllErrors());
return "user.jsp";
} | String id = UUID.randomUUID().toString();
user.setId(id);
users.add(user);
return "redirect:users/success";
}
/**
* Handles a redirect view
* @return The view name
*/
@GET
@Controller
@Path("success")
public String saveUserSuccess() {
return "success.jsp";
}
/**
* The REST API that returns all the user details in the JSON format
* @return The list of users that are saved. The List<User> is converted into Json Array.
* If no user is present a empty array is returned
*/
@GET
@Produces(MediaType.APPLICATION_JSON)
public List<User> getUsers() {
return users;
}
} | repos\tutorials-master\web-modules\jakarta-ee\src\main\java\com\baeldung\eclipse\krazo\UserController.java | 2 |
请完成以下Java代码 | static SslBundle of(@Nullable SslStoreBundle stores, @Nullable SslBundleKey key, @Nullable SslOptions options,
@Nullable String protocol, @Nullable SslManagerBundle managers) {
SslManagerBundle managersToUse = (managers != null) ? managers : SslManagerBundle.from(stores, key);
return new SslBundle() {
@Override
public SslStoreBundle getStores() {
return (stores != null) ? stores : SslStoreBundle.NONE;
}
@Override
public SslBundleKey getKey() {
return (key != null) ? key : SslBundleKey.NONE;
}
@Override
public SslOptions getOptions() {
return (options != null) ? options : SslOptions.NONE;
}
@Override
public String getProtocol() {
return (!StringUtils.hasText(protocol)) ? DEFAULT_PROTOCOL : protocol;
}
@Override
public SslManagerBundle getManagers() {
return managersToUse;
}
@Override
public String toString() {
ToStringCreator creator = new ToStringCreator(this);
creator.append("key", getKey());
creator.append("options", getOptions());
creator.append("protocol", getProtocol());
creator.append("stores", getStores());
return creator.toString();
}
}; | }
/**
* Factory method to create a new {@link SslBundle} which uses the system defaults.
* @return a new {@link SslBundle} instance
* @since 3.5.0
*/
static SslBundle systemDefault() {
try {
KeyManagerFactory keyManagerFactory = KeyManagerFactory
.getInstance(KeyManagerFactory.getDefaultAlgorithm());
keyManagerFactory.init(null, null);
TrustManagerFactory trustManagerFactory = TrustManagerFactory
.getInstance(TrustManagerFactory.getDefaultAlgorithm());
trustManagerFactory.init((KeyStore) null);
SSLContext sslContext = SSLContext.getDefault();
return of(null, null, null, null, new SslManagerBundle() {
@Override
public KeyManagerFactory getKeyManagerFactory() {
return keyManagerFactory;
}
@Override
public TrustManagerFactory getTrustManagerFactory() {
return trustManagerFactory;
}
@Override
public SSLContext createSslContext(String protocol) {
return sslContext;
}
});
}
catch (NoSuchAlgorithmException | KeyStoreException | UnrecoverableKeyException ex) {
throw new IllegalStateException("Could not initialize system default SslBundle: " + ex.getMessage(), ex);
}
}
} | repos\spring-boot-4.0.1\core\spring-boot\src\main\java\org\springframework\boot\ssl\SslBundle.java | 1 |
请完成以下Java代码 | public class Pizza {
private static EnumSet<PizzaStatusEnum> deliveredPizzaStatuses = EnumSet.of(PizzaStatusEnum.DELIVERED);
private PizzaStatusEnum status;
public enum PizzaStatusEnum {
ORDERED(5) {
@Override
public boolean isOrdered() {
return true;
}
},
READY(2) {
@Override
public boolean isReady() {
return true;
}
},
DELIVERED(0) {
@Override
public boolean isDelivered() {
return true;
}
};
private int timeToDelivery;
public boolean isOrdered() {
return false;
}
public boolean isReady() {
return false;
}
public boolean isDelivered() {
return false;
}
public int getTimeToDelivery() {
return timeToDelivery;
}
PizzaStatusEnum(int timeToDelivery) {
this.timeToDelivery = timeToDelivery;
}
}
public PizzaStatusEnum getStatus() {
return status;
}
public void setStatus(PizzaStatusEnum status) {
this.status = status; | }
public boolean isDeliverable() {
return this.status.isReady();
}
public void printTimeToDeliver() {
System.out.println("Time to delivery is " + this.getStatus().getTimeToDelivery() + " days");
}
public static List<Pizza> getAllUndeliveredPizzas(List<Pizza> input) {
return input.stream().filter((s) -> !deliveredPizzaStatuses.contains(s.getStatus())).collect(Collectors.toList());
}
public static EnumMap<PizzaStatusEnum, List<Pizza>> groupPizzaByStatus(List<Pizza> pzList) {
return pzList.stream().collect(Collectors.groupingBy(Pizza::getStatus, () -> new EnumMap<>(PizzaStatusEnum.class), Collectors.toList()));
}
public void deliver() {
if (isDeliverable()) {
PizzaDeliverySystemConfiguration.getInstance().getDeliveryStrategy().deliver(this);
this.setStatus(PizzaStatusEnum.DELIVERED);
}
}
public int getDeliveryTimeInDays() {
switch (status) {
case ORDERED: return 5;
case READY: return 2;
case DELIVERED: return 0;
}
return 0;
}
} | repos\tutorials-master\core-java-modules\core-java-lang-oop-types\src\main\java\com\baeldung\enums\Pizza.java | 1 |
请完成以下Java代码 | public <T> T[] toArray(T[] a) {
return ruleResults.toArray(a);
}
@Override
public boolean add(DmnDecisionResultEntries e) {
throw new UnsupportedOperationException("decision result is immutable");
}
@Override
public boolean remove(Object o) {
throw new UnsupportedOperationException("decision result is immutable");
}
@Override
public boolean containsAll(Collection<?> c) {
return ruleResults.containsAll(c);
}
@Override
public boolean addAll(Collection<? extends DmnDecisionResultEntries> c) {
throw new UnsupportedOperationException("decision result is immutable");
}
@Override
public boolean addAll(int index, Collection<? extends DmnDecisionResultEntries> c) {
throw new UnsupportedOperationException("decision result is immutable");
}
@Override
public boolean removeAll(Collection<?> c) {
throw new UnsupportedOperationException("decision result is immutable");
}
@Override
public boolean retainAll(Collection<?> c) {
throw new UnsupportedOperationException();
}
@Override
public void clear() {
throw new UnsupportedOperationException("decision result is immutable");
}
@Override
public DmnDecisionResultEntries set(int index, DmnDecisionResultEntries element) {
throw new UnsupportedOperationException("decision result is immutable");
}
@Override
public void add(int index, DmnDecisionResultEntries element) {
throw new UnsupportedOperationException("decision result is immutable");
}
@Override
public DmnDecisionResultEntries remove(int index) {
throw new UnsupportedOperationException("decision result is immutable");
}
@Override
public int indexOf(Object o) {
return ruleResults.indexOf(o);
}
@Override | public int lastIndexOf(Object o) {
return ruleResults.lastIndexOf(o);
}
@Override
public ListIterator<DmnDecisionResultEntries> listIterator() {
return asUnmodifiableList().listIterator();
}
@Override
public ListIterator<DmnDecisionResultEntries> listIterator(int index) {
return asUnmodifiableList().listIterator(index);
}
@Override
public List<DmnDecisionResultEntries> subList(int fromIndex, int toIndex) {
return asUnmodifiableList().subList(fromIndex, toIndex);
}
@Override
public String toString() {
return ruleResults.toString();
}
protected List<DmnDecisionResultEntries> asUnmodifiableList() {
return Collections.unmodifiableList(ruleResults);
}
} | repos\camunda-bpm-platform-master\engine-dmn\engine\src\main\java\org\camunda\bpm\dmn\engine\impl\DmnDecisionResultImpl.java | 1 |
请完成以下Java代码 | public void updateInvoiceDetail(final I_C_Invoice_Detail invoiceDetail, final IHandlingUnitsInfo handlingUnitsInfo)
{
// nothing
}
/**
* @return and ad-hoc implementation that actually works; TODO: fuse with the one in de.metas.materialtracking.
*/
@Override
public IHandlingUnitsInfoWritableQty createHUInfoWritableQty(@NonNull final IHandlingUnitsInfo wrappedHUInfo)
{
return new IHandlingUnitsInfoWritableQty()
{
private int qtyTU = wrappedHUInfo.getQtyTU();
@Override
public String getTUName()
{
return wrappedHUInfo.getTUName();
}
@Override
public int getQtyTU()
{
return qtyTU; | }
@Override
public IHandlingUnitsInfo add(@NonNull final IHandlingUnitsInfo infoToAdd)
{
Check.assume(Objects.equals(infoToAdd.getTUName(), this.getTUName()), "infoToAdd {} has a TUName that differs from ours {}", infoToAdd, this);
return new PlainHandlingUnitsInfo(
wrappedHUInfo.getTUName(),
wrappedHUInfo.getQtyTU() + infoToAdd.getQtyTU());
}
@Override
public void setQtyTU(int qtyTU)
{
this.qtyTU = qtyTU;
}
@Override
public String toString()
{
return ObjectUtils.toString(this);
}
};
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.materialtracking\src\main\java\de\metas\materialtracking\spi\impl\HandlingUnitsInfoFactory.java | 1 |
请完成以下Java代码 | protected String doIt() throws Exception
{
final I_M_ReceiptSchedule receiptSchedule = getProcessInfo().getRecordIfApplies(I_M_ReceiptSchedule.class, ITrx.TRXNAME_ThreadInherited).orElse(null);
final int emptiesInOutId;
if (receiptSchedule == null)
{
emptiesInOutId = createDraftEmptiesDocument();
}
else
{
final I_M_InOut emptiesInOut = huEmptiesService.createDraftEmptiesInOutFromReceiptSchedule(receiptSchedule, getReturnMovementType());
emptiesInOutId = emptiesInOut == null ? -1 : emptiesInOut.getM_InOut_ID();
}
//
// Notify frontend that the empties document shall be opened in single document layout (not grid)
if (emptiesInOutId > 0)
{
getResult().setRecordToOpen(TableRecordReference.of(I_M_InOut.Table_Name, emptiesInOutId), getTargetWindowId(), OpenTarget.SingleDocument);
}
return MSG_OK;
}
private int createDraftEmptiesDocument()
{ | final DocumentPath documentPath = DocumentPath.builder()
.setDocumentType(WindowId.of(getTargetWindowId()))
.setDocumentId(DocumentId.NEW_ID_STRING)
.allowNewDocumentId()
.build();
final DocumentId documentId = documentsRepo.forDocumentWritable(documentPath, NullDocumentChangesCollector.instance, document -> {
huEmptiesService.newReturnsInOutProducer(getCtx())
.setMovementType(getReturnMovementType())
.setMovementDate(de.metas.common.util.time.SystemTime.asDayTimestamp())
.fillReturnsInOutHeader(InterfaceWrapperHelper.create(document, I_M_InOut.class));
return document.getDocumentId();
});
return documentId.toInt();
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.ui.web.base\src\main\java\de\metas\ui\web\handlingunits\process\WEBUI_M_ReceiptSchedule_CreateEmptiesReturns_Base.java | 1 |
请完成以下Java代码 | private State pushElementToStack(Stack stack, String block, List<Stack<String>> currentStackList, int currentStateHeuristics, Stack<String> goalStateStack) {
stack.push(block);
int newStateHeuristics = getHeuristicsValue(currentStackList, goalStateStack);
if (newStateHeuristics > currentStateHeuristics) {
return new State(currentStackList, newStateHeuristics);
}
stack.pop();
return null;
}
/**
* This method returns heuristics value for given state with respect to goal
* state
*/
public int getHeuristicsValue(List<Stack<String>> currentState, Stack<String> goalStateStack) {
Integer heuristicValue;
heuristicValue = currentState.stream()
.mapToInt(stack -> {
return getHeuristicsValueForStack(stack, currentState, goalStateStack);
})
.sum();
return heuristicValue; | }
/**
* This method returns heuristics value for a particular stack
*/
public int getHeuristicsValueForStack(Stack<String> stack, List<Stack<String>> currentState, Stack<String> goalStateStack) {
int stackHeuristics = 0;
boolean isPositioneCorrect = true;
int goalStartIndex = 0;
for (String currentBlock : stack) {
if (isPositioneCorrect && currentBlock.equals(goalStateStack.get(goalStartIndex))) {
stackHeuristics += goalStartIndex;
} else {
stackHeuristics -= goalStartIndex;
isPositioneCorrect = false;
}
goalStartIndex++;
}
return stackHeuristics;
}
} | repos\tutorials-master\algorithms-modules\algorithms-miscellaneous-4\src\main\java\com\baeldung\algorithms\hillclimbing\HillClimbing.java | 1 |
请完成以下Java代码 | public void updateExternalTaskSuspensionStateByProcessDefinitionKey(String processDefinitionKey, SuspensionState suspensionState) {
updateExternalTaskSuspensionState(null, null, processDefinitionKey, suspensionState);
}
public void updateExternalTaskSuspensionStateByProcessDefinitionKeyAndTenantId(String processDefinitionKey, String processDefinitionTenantId, SuspensionState suspensionState) {
Map<String, Object> parameters = new HashMap<>();
parameters.put("processDefinitionKey", processDefinitionKey);
parameters.put("isProcessDefinitionTenantIdSet", true);
parameters.put("processDefinitionTenantId", processDefinitionTenantId);
parameters.put("suspensionState", suspensionState.getStateCode());
getDbEntityManager().update(ExternalTaskEntity.class, "updateExternalTaskSuspensionStateByParameters", configureParameterizedQuery(parameters));
}
protected void configureQuery(ExternalTaskQueryImpl query) {
getAuthorizationManager().configureExternalTaskQuery(query);
getTenantManager().configureQuery(query);
}
protected void configureQuery(ListQueryParameterObject parameter) {
getAuthorizationManager().configureExternalTaskFetch(parameter);
getTenantManager().configureQuery(parameter);
}
protected ListQueryParameterObject configureParameterizedQuery(Object parameter) {
return getTenantManager().configureQuery(parameter);
}
protected boolean shouldApplyOrdering(boolean usePriority, boolean useCreateTime) {
return usePriority || useCreateTime;
} | protected boolean useCreateTime(List<QueryOrderingProperty> orderingProperties) {
return orderingProperties.stream()
.anyMatch(orderingProperty -> CREATE_TIME.getName().equals(orderingProperty.getQueryProperty().getName()));
}
public void fireExternalTaskAvailableEvent() {
Context.getCommandContext()
.getTransactionContext()
.addTransactionListener(TransactionState.COMMITTED, new TransactionListener() {
@Override
public void execute(CommandContext commandContext) {
ProcessEngineImpl.EXT_TASK_CONDITIONS.signalAll();
}
});
}
} | repos\camunda-bpm-platform-master\engine\src\main\java\org\camunda\bpm\engine\impl\persistence\entity\ExternalTaskManager.java | 1 |
请在Spring Boot框架中完成以下Java代码 | public void remove(final String... keys) {
for (String key : keys) {
remove(key);
}
}
/**
* batch delete with pattern
* @param pattern
*/
public void removePattern(final String pattern) {
Set<Serializable> keys = redisTemplate.keys(pattern);
if (keys.size() > 0)
redisTemplate.delete(keys);
}
/**
* hash set
* @param key
* @param hashKey
* @param value
*/
public void hashSet(String key, Object hashKey, Object value){
HashOperations<String, Object, Object> hash = redisTemplate.opsForHash();
hash.put(key,hashKey,value);
}
/**
* hash get
* @param key
* @param hashKey
* @return
*/
public Object hashGet(String key, Object hashKey){
HashOperations<String, Object, Object> hash = redisTemplate.opsForHash();
return hash.get(key,hashKey);
}
/**
* list push
* @param k
* @param v
*/
public void push(String k,Object v){
ListOperations<String, Object> list = redisTemplate.opsForList();
list.rightPush(k,v);
}
/**
* list range
* @param k | * @param l
* @param l1
* @return
*/
public List<Object> range(String k, long l, long l1){
ListOperations<String, Object> list = redisTemplate.opsForList();
return list.range(k,l,l1);
}
/**
* set add
* @param key
* @param value
*/
public void setAdd(String key,Object value){
SetOperations<String, Object> set = redisTemplate.opsForSet();
set.add(key,value);
}
/**
* set get
* @param key
* @return
*/
public Set<Object> setMembers(String key){
SetOperations<String, Object> set = redisTemplate.opsForSet();
return set.members(key);
}
/**
* ordered set add
* @param key
* @param value
* @param scoure
*/
public void zAdd(String key,Object value,double scoure){
ZSetOperations<String, Object> zset = redisTemplate.opsForZSet();
zset.add(key,value,scoure);
}
/**
* rangeByScore
* @param key
* @param scoure
* @param scoure1
* @return
*/
public Set<Object> rangeByScore(String key,double scoure,double scoure1){
ZSetOperations<String, Object> zset = redisTemplate.opsForZSet();
return zset.rangeByScore(key, scoure, scoure1);
}
} | repos\spring-boot-leaning-master\1.x\第09课:如何玩转 Redis\spring-boot-redis\src\main\java\com\neo\service\RedisService.java | 2 |
请在Spring Boot框架中完成以下Java代码 | public class CandidateStockChangeDetailId implements RepoIdAware
{
@JsonCreator
public static CandidateStockChangeDetailId ofRepoId(final int repoId)
{
return new CandidateStockChangeDetailId(repoId);
}
@Nullable
public static CandidateStockChangeDetailId ofRepoIdOrNull(final int repoId)
{
return repoId > 0 ? new CandidateStockChangeDetailId(repoId) : null;
}
public static int toRepoId(final CandidateStockChangeDetailId id)
{
return id != null ? id.getRepoId() : -1;
} | int repoId;
private CandidateStockChangeDetailId(final int repoId)
{
this.repoId = Check.assumeGreaterThanZero(repoId, "MD_Candidate_StockChange_Detail_ID");
}
@Override
@JsonValue
public int getRepoId()
{
return repoId;
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.material\dispo-commons\src\main\java\de\metas\material\dispo\commons\candidate\CandidateStockChangeDetailId.java | 2 |
请完成以下Java代码 | public String getErrorDetailsByteArrayId() {
return errorDetailsByteArrayId;
}
public void setErrorDetailsByteArrayId(String errorDetailsByteArrayId) {
this.errorDetailsByteArrayId = errorDetailsByteArrayId;
}
public String getErrorDetails() {
ByteArrayEntity byteArray = getErrorByteArray();
return ExceptionUtil.getExceptionStacktrace(byteArray);
}
public void setErrorDetails(String exception) {
EnsureUtil.ensureNotNull("exception", exception);
byte[] exceptionBytes = toByteArray(exception);
ByteArrayEntity byteArray = createExceptionByteArray(EXCEPTION_NAME, exceptionBytes, ResourceTypes.HISTORY);
byteArray.setRootProcessInstanceId(rootProcessInstanceId);
byteArray.setRemovalTime(removalTime);
errorDetailsByteArrayId = byteArray.getId();
}
protected ByteArrayEntity getErrorByteArray() {
if (errorDetailsByteArrayId != null) {
return Context
.getCommandContext()
.getDbEntityManager()
.selectById(ByteArrayEntity.class, errorDetailsByteArrayId);
}
return null;
}
public String getActivityId() {
return activityId;
}
public void setActivityId(String activityId) {
this.activityId = activityId;
}
public String getActivityInstanceId() {
return activityInstanceId;
}
public void setActivityInstanceId(String activityInstanceId) {
this.activityInstanceId = activityInstanceId;
}
public String getTenantId() {
return tenantId;
} | public void setTenantId(String tenantId) {
this.tenantId = tenantId;
}
public long getPriority() {
return priority;
}
public void setPriority(long priority) {
this.priority = priority;
}
public int getState() {
return state;
}
public void setState(int state) {
this.state = state;
}
@Override
public boolean isCreationLog() {
return state == ExternalTaskState.CREATED.getStateCode();
}
@Override
public boolean isFailureLog() {
return state == ExternalTaskState.FAILED.getStateCode();
}
@Override
public boolean isSuccessLog() {
return state == ExternalTaskState.SUCCESSFUL.getStateCode();
}
@Override
public boolean isDeletionLog() {
return state == ExternalTaskState.DELETED.getStateCode();
}
@Override
public String getRootProcessInstanceId() {
return rootProcessInstanceId;
}
public void setRootProcessInstanceId(String rootProcessInstanceId) {
this.rootProcessInstanceId = rootProcessInstanceId;
}
} | repos\camunda-bpm-platform-master\engine\src\main\java\org\camunda\bpm\engine\impl\history\event\HistoricExternalTaskLogEntity.java | 1 |
请完成以下Spring Boot application配置 | server:
port: 8088
spring:
ai:
openai:
base-url: https://api.openai.com/
api-key: sk-xxx
embedding:
options:
model: text-davinci-003
chat:
#指定某一个API配置(覆盖全局配置)
api-key: s | k-xxx
base-url: https://api.openai.com/
options:
model: gpt-3.5-turbo # 模型配置 | repos\springboot-demo-master\ai\src\main\resources\application.yaml | 2 |
请在Spring Boot框架中完成以下Java代码 | public PageBean<RpNotifyRecord> queryNotifyRecordListPage(PageParam pageParam, Map<String, Object> paramMap) {
return rpNotifyRecordDao.listPage(pageParam, paramMap);
}
/**
* 创建消息通知
*
* @param rpNotifyRecord
*/
@Override
public long createNotifyRecord(RpNotifyRecord rpNotifyRecord) {
return rpNotifyRecordDao.insert(rpNotifyRecord);
}
/**
* 修改消息通知
*
* @param rpNotifyRecord
*/ | @Override
public void updateNotifyRecord(RpNotifyRecord rpNotifyRecord) {
rpNotifyRecordDao.update(rpNotifyRecord);
}
/**
* 创建消息通知记录
*
* @param rpNotifyRecordLog
* @return
*/
@Override
public long createNotifyRecordLog(RpNotifyRecordLog rpNotifyRecordLog) {
return rpNotifyRecordLogDao.insert(rpNotifyRecordLog);
}
} | repos\roncoo-pay-master\roncoo-pay-service\src\main\java\com\roncoo\pay\notify\service\impl\RpNotifyServiceImpl.java | 2 |
请完成以下Java代码 | public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
SysDepartTreeModel model = (SysDepartTreeModel) o;
return Objects.equals(id, model.id) &&
Objects.equals(parentId, model.parentId) &&
Objects.equals(departName, model.departName) &&
Objects.equals(departNameEn, model.departNameEn) &&
Objects.equals(departNameAbbr, model.departNameAbbr) &&
Objects.equals(departOrder, model.departOrder) &&
Objects.equals(description, model.description) &&
Objects.equals(orgCategory, model.orgCategory) &&
Objects.equals(orgType, model.orgType) &&
Objects.equals(orgCode, model.orgCode) &&
Objects.equals(mobile, model.mobile) &&
Objects.equals(fax, model.fax) &&
Objects.equals(address, model.address) &&
Objects.equals(memo, model.memo) &&
Objects.equals(status, model.status) &&
Objects.equals(delFlag, model.delFlag) &&
Objects.equals(qywxIdentifier, model.qywxIdentifier) &&
Objects.equals(createBy, model.createBy) &&
Objects.equals(createTime, model.createTime) && | Objects.equals(updateBy, model.updateBy) &&
Objects.equals(updateTime, model.updateTime) &&
Objects.equals(directorUserIds, model.directorUserIds) &&
Objects.equals(positionId, model.positionId) &&
Objects.equals(depPostParentId, model.depPostParentId) &&
Objects.equals(children, model.children);
}
/**
* 重写hashCode方法
*/
@Override
public int hashCode() {
return Objects.hash(id, parentId, departName, departNameEn, departNameAbbr,
departOrder, description, orgCategory, orgType, orgCode, mobile, fax, address,
memo, status, delFlag, qywxIdentifier, createBy, createTime, updateBy, updateTime,
children,directorUserIds, positionId, depPostParentId);
}
} | repos\JeecgBoot-main\jeecg-boot\jeecg-module-system\jeecg-system-biz\src\main\java\org\jeecg\modules\system\model\SysDepartTreeModel.java | 1 |
请完成以下Java代码 | private void init()
{
} // init
/*************************************************************************/
/** Mandatory (default false) */
private boolean m_mandatory = false;
/**
* Set Editor Mandatory
* @param mandatory true, if you have to enter data
*/
@Override
public void setMandatory (boolean mandatory)
{
m_mandatory = mandatory;
setBackground(false);
} // setMandatory
/**
* Is Field mandatory
* @return true, if mandatory
*/
@Override
public boolean isMandatory()
{
return m_mandatory;
} // isMandatory
/**
* Enable Editor
* @param rw true, if you can enter/select data
*/
@Override
public void setReadWrite (boolean rw)
{
if (super.isEditable() != rw)
super.setEditable (rw);
setBackground(false);
} // setEditable
/**
* Is it possible to edit
* @return true, if editable
*/
@Override
public boolean isReadWrite()
{
return super.isEditable();
} // isReadWrite
/**
* Set Background based on editable / mandatory / error
* @param error if true, set background to error color, otherwise mandatory/editable
*/
@Override
public void setBackground (boolean error)
{
if (error)
setBackground(AdempierePLAF.getFieldBackground_Error());
else if (!isReadWrite())
setBackground(AdempierePLAF.getFieldBackground_Inactive());
else if (m_mandatory)
setBackground(AdempierePLAF.getFieldBackground_Mandatory());
else
setBackground(AdempierePLAF.getFieldBackground_Normal());
} // setBackground
/**
* Set Background
* @param bg
*/
@Override
public void setBackground (Color bg)
{
if (bg.equals(getBackground()))
return;
super.setBackground(bg);
} // setBackground | /**
* Set Editor to value
* @param value value of the editor
*/
@Override
public void setValue (Object value)
{
if (value == null)
setText("");
else
setText(value.toString());
} // setValue
/**
* Return Editor value
* @return current value
*/
@Override
public Object getValue()
{
return new String(super.getPassword());
} // getValue
/**
* Return Display Value
* @return displayed String value
*/
@Override
public String getDisplay()
{
return new String(super.getPassword());
} // getDisplay
} | repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-legacy\org\compiere\swing\CPassword.java | 1 |
请在Spring Boot框架中完成以下Java代码 | private static class AnnotatedPoint implements Comparable<AnnotatedPoint>
{
@NonNull
Instant value;
@NonNull
PointType type;
public static AnnotatedPoint of(@NonNull final Instant instant, @NonNull final PointType type)
{
return AnnotatedPoint.builder()
.value(instant)
.type(type)
.build();
}
@Override
public int compareTo(@NonNull final AnnotatedPoint other)
{
if (other.value.compareTo(this.value) == 0) | {
return this.type.ordinal() < other.type.ordinal() ? -1 : 1;
}
else
{
return this.value.compareTo(other.value);
}
}
// the order is important here, as if multiple points have the same value
// this is the order in which we deal with them
public enum PointType
{
End, GapEnd, GapStart, Start
}
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.util\src\main\java\de\metas\util\time\IntervalUtils.java | 2 |
请完成以下Java代码 | public void setIsbn(String isbn) {
this.isbn = isbn;
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if(obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false; | }
final IdBook other = (IdBook) obj;
if (!Objects.equals(this.id, other.id)) {
return false;
}
return true;
}
@Override
public int hashCode() {
int hash = 3;
hash = 89 * hash + Objects.hashCode(this.id);
return hash;
}
} | repos\Hibernate-SpringBoot-master\HibernateSpringBootLombokEqualsAndHashCode\src\main\java\com\app\IdBook.java | 1 |
请完成以下Java代码 | public List<JobEntity> findJobsByTypeAndProcessDefinitionId(
final String jobHandlerType,
final String processDefinitionId
) {
Map<String, String> params = new HashMap<String, String>(2);
params.put("handlerType", jobHandlerType);
params.put("processDefinitionId", processDefinitionId);
return getDbSqlSession().selectList("selectJobByTypeAndProcessDefinitionId", params);
}
@Override
@SuppressWarnings("unchecked")
public List<JobEntity> findJobsByProcessInstanceId(final String processInstanceId) {
return getDbSqlSession().selectList("selectJobsByProcessInstanceId", processInstanceId);
}
@Override
@SuppressWarnings("unchecked")
public List<JobEntity> findExpiredJobs(Page page) {
Date now = getClock().getCurrentTime();
return getDbSqlSession().selectList("selectExpiredJobs", now, page);
}
@Override
@SuppressWarnings("unchecked")
public List<Job> findJobsByQueryCriteria(JobQueryImpl jobQuery, Page page) {
final String query = "selectJobByQueryCriteria";
return getDbSqlSession().selectList(query, jobQuery, page);
}
@Override
public long findJobCountByQueryCriteria(JobQueryImpl jobQuery) {
return (Long) getDbSqlSession().selectOne("selectJobCountByQueryCriteria", jobQuery);
} | @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("updateJobTenantIdForDeployment", params);
}
@Override
public void resetExpiredJob(String jobId) {
Map<String, Object> params = new HashMap<String, Object>(2);
params.put("id", jobId);
getDbSqlSession().update("resetExpiredJob", params);
}
} | repos\Activiti-develop\activiti-core\activiti-engine\src\main\java\org\activiti\engine\impl\persistence\entity\data\impl\MybatisJobDataManager.java | 1 |
请完成以下Java代码 | public void setSeqNo (final int SeqNo)
{
set_Value (COLUMNNAME_SeqNo, SeqNo);
}
@Override
public int getSeqNo()
{
return get_ValueAsInt(COLUMNNAME_SeqNo);
}
/**
* Type AD_Reference_ID=540836
* Reference name: C_CompensationGroup_SchemaLine_Type
*/
public static final int TYPE_AD_Reference_ID=540836;
/** Revenue = R */ | public static final String TYPE_Revenue = "R";
/** Flatrate = F */
public static final String TYPE_Flatrate = "F";
@Override
public void setType (final @Nullable java.lang.String Type)
{
set_Value (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\de\metas\order\model\X_C_CompensationGroup_SchemaLine.java | 1 |
请完成以下Java代码 | public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getDescription() {
return description;
}
public void setDescription(String description) { | this.description = description;
}
public double getPrice() {
return price;
}
public void setPrice(double price) {
this.price = price;
}
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status;
}
} | repos\tutorials-master\libraries-data-db-2\src\main\java\com\baeldung\libraries\jdo\query\ProductItem.java | 1 |
请完成以下Java代码 | static boolean loadDat()
{
ByteArray byteArray = ByteArray.createByteArray(path + Predefine.VALUE_EXT);
if (byteArray == null) return false;
int size = byteArray.nextInt();
Character[] valueArray = new Character[size];
for (int i = 0; i < valueArray.length; ++i)
{
valueArray[i] = byteArray.nextChar();
}
return trie.load(path + Predefine.TRIE_EXT, valueArray);
}
/**
* 是否包含key
* @param key
* @return
*/
public static boolean containsKey(String key)
{
return trie.containsKey(key);
}
/**
* 包含key,且key至少长length
* @param key
* @param length
* @return
*/
public static boolean containsKey(String key, int length)
{
if (!trie.containsKey(key)) return false;
return key.length() >= length;
}
public static Character get(String key)
{
return trie.get(key);
}
public static DoubleArrayTrie<Character>.LongestSearcher getSearcher(char[] charArray)
{
return trie.getLongestSearcher(charArray, 0);
}
/**
* 最长分词
*/
public static class Searcher extends BaseSearcher<Character>
{
/**
* 分词从何处开始,这是一个状态
*/
int begin; | DoubleArrayTrie<Character> trie;
protected Searcher(char[] c, DoubleArrayTrie<Character> trie)
{
super(c);
this.trie = trie;
}
protected Searcher(String text, DoubleArrayTrie<Character> trie)
{
super(text);
this.trie = trie;
}
@Override
public Map.Entry<String, Character> next()
{
// 保证首次调用找到一个词语
Map.Entry<String, Character> result = null;
while (begin < c.length)
{
LinkedList<Map.Entry<String, Character>> entryList = trie.commonPrefixSearchWithValue(c, begin);
if (entryList.size() == 0)
{
++begin;
}
else
{
result = entryList.getLast();
offset = begin;
begin += result.getKey().length();
break;
}
}
if (result == null)
{
return null;
}
return result;
}
}
} | repos\springboot-demo-master\hanlp\src\main\java\demo\hankcs\hanlp\dictionary\nr\JapanesePersonDictionary.java | 1 |
请完成以下Java代码 | public Pair<Vertex, Edge> nextMinimum(){
Edge nextMinimum = new Edge(Integer.MAX_VALUE);
Vertex nextVertex = this;
Iterator<Map.Entry<Vertex,Edge>> it = edges.entrySet().iterator();
while (it.hasNext()) {
Map.Entry<Vertex,Edge> pair = it.next();
if (!pair.getKey().isVisited()){
if (!pair.getValue().isIncluded()) {
if (pair.getValue().getWeight() < nextMinimum.getWeight()) {
nextMinimum = pair.getValue();
nextVertex = pair.getKey();
}
}
}
}
return new Pair<>(nextVertex, nextMinimum);
}
public String originalToString(){
StringBuilder sb = new StringBuilder();
Iterator<Map.Entry<Vertex,Edge>> it = edges.entrySet().iterator();
while (it.hasNext()) {
Map.Entry<Vertex,Edge> pair = it.next();
if (!pair.getValue().isPrinted()) {
sb.append(getLabel());
sb.append(" --- ");
sb.append(pair.getValue().getWeight());
sb.append(" --- ");
sb.append(pair.getKey().getLabel());
sb.append("\n");
pair.getValue().setPrinted(true);
}
}
return sb.toString();
}
public String includedToString(){
StringBuilder sb = new StringBuilder();
if (isVisited()) { | Iterator<Map.Entry<Vertex,Edge>> it = edges.entrySet().iterator();
while (it.hasNext()) {
Map.Entry<Vertex,Edge> pair = it.next();
if (pair.getValue().isIncluded()) {
if (!pair.getValue().isPrinted()) {
sb.append(getLabel());
sb.append(" --- ");
sb.append(pair.getValue().getWeight());
sb.append(" --- ");
sb.append(pair.getKey().getLabel());
sb.append("\n");
pair.getValue().setPrinted(true);
}
}
}
}
return sb.toString();
}
} | repos\tutorials-master\algorithms-modules\algorithms-miscellaneous-5\src\main\java\com\baeldung\algorithms\prim\Vertex.java | 1 |
请完成以下Java代码 | public KeyNamePair getKeyNamePair()
{
return new KeyNamePair(get_ID(), getName());
}
/** Set Percentage.
@param Percentage
Percent of the entire amount
*/
public void setPercentage (int Percentage)
{
set_Value (COLUMNNAME_Percentage, Integer.valueOf(Percentage));
}
/** Get Percentage.
@return Percent of the entire amount
*/
public int getPercentage ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_Percentage);
if (ii == null)
return 0;
return ii.intValue(); | }
/** Set Search Key.
@param Value
Search key for the record in the format required - must be unique
*/
public void setValue (String Value)
{
set_Value (COLUMNNAME_Value, Value);
}
/** Get Search Key.
@return Search key for the record in the format required - must be unique
*/
public String getValue ()
{
return (String)get_Value(COLUMNNAME_Value);
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\eevolution\model\X_C_TaxBase.java | 1 |
请完成以下Java代码 | private Class<?> loadClass(final String classname, final boolean isServerProcess)
{
if (classname == null)
{
return null;
}
ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
if (classLoader == null)
{
classLoader = getClass().getClassLoader();
}
try
{
return classLoader.loadClass(classname);
}
catch (final ClassNotFoundException ex)
{
if (isServerProcess && Ini.isSwingClient())
{
// it might be that the class is available only on server
// so, for now, we consider the preconditions are applicable.
return null;
}
else
{
presetRejectWithInternalReason("cannot load class " + classname, ex);
return null;
}
}
}
private Class<? extends IProcessPrecondition> toProcessPreconditionsClassOrNull(final Class<?> clazz)
{
if (clazz != null && IProcessPrecondition.class.isAssignableFrom(clazz))
{
return clazz.asSubclass(IProcessPrecondition.class);
}
else
{
return null;
}
}
private void presetRejectWithInternalReason(final String errorMessage, final Throwable ex)
{
logger.warn("Marked checker as not applicable: {} because {}", this, errorMessage, ex);
_presetResolution = ProcessPreconditionsResolution.rejectWithInternalReason(errorMessage); | }
private ProcessPreconditionsResolution getPresetResolution()
{
return _presetResolution;
}
private boolean hasPresetResolution()
{
return _presetResolution != null;
}
private Class<? extends IProcessPrecondition> getPreconditionsClass()
{
return _preconditionsClass;
}
private ProcessClassInfo getProcessClassInfo()
{
if (_processClassInfo == null)
{
_processClassInfo = ProcessClassInfo.of(_processClass);
}
return _processClassInfo;
}
public ProcessPreconditionChecker setPreconditionsContext(final IProcessPreconditionsContext preconditionsContext)
{
setPreconditionsContext(() -> preconditionsContext);
return this;
}
public ProcessPreconditionChecker setPreconditionsContext(final Supplier<IProcessPreconditionsContext> preconditionsContextSupplier)
{
_preconditionsContextSupplier = preconditionsContextSupplier;
return this;
}
private IProcessPreconditionsContext getPreconditionsContext()
{
Check.assumeNotNull(_preconditionsContextSupplier, "Parameter preconditionsContextSupplier is not null");
final IProcessPreconditionsContext preconditionsContext = _preconditionsContextSupplier.get();
Check.assumeNotNull(preconditionsContext, "Parameter preconditionsContext is not null");
return preconditionsContext;
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\de\metas\process\ProcessPreconditionChecker.java | 1 |
请完成以下Java代码 | public IDeviceResponse handleRequest(@NonNull final DeviceRequestConfigureDevice request)
{
final Map<String, IDeviceConfigParam> parameters = request.getParameters();
final IDeviceConfigParam epClass = parameters.get(AbstractTcpScales.PARAM_ENDPOINT_CLASS);
final IDeviceConfigParam epHost = parameters.get(AbstractTcpScales.PARAM_ENDPOINT_IP);
final IDeviceConfigParam epPort = parameters.get(AbstractTcpScales.PARAM_ENDPOINT_PORT);
final IDeviceConfigParam epReturnLastLine = parameters.get(AbstractTcpScales.PARAM_ENDPOINT_RETURN_LAST_LINE);
final IDeviceConfigParam epReadTimeoutMillis = parameters.get(AbstractTcpScales.PARAM_ENDPOINT_READ_TIMEOUT_MILLIS);
final IDeviceConfigParam roundToPrecision = parameters.get(AbstractTcpScales.PARAM_ROUND_TO_PRECISION); // task 09207
TcpConnectionEndPoint ep = null;
try
{
@SuppressWarnings("unchecked")
final Class<TcpConnectionEndPoint> c = (Class<TcpConnectionEndPoint>)Class.forName(epClass.getValue());
ep = c.newInstance();
}
catch (final ClassNotFoundException e)
{
throw new DeviceException("Caught a ClassNotFoundException: " + e.getLocalizedMessage(), e);
}
catch (final InstantiationException e)
{
throw new DeviceException("Caught an InstantiationException: " + e.getLocalizedMessage(), e);
}
catch (final IllegalAccessException e)
{
throw new DeviceException("Caught an IllegalAccessException: " + e.getLocalizedMessage(), e);
}
ep.setHost(epHost.getValue());
ep.setPort(Integer.parseInt(epPort.getValue()));
if (ep instanceof TcpConnectionReadLineEndPoint)
{
((TcpConnectionReadLineEndPoint)ep).setReturnLastLine(BooleanUtils.toBoolean(epReturnLastLine.getValue())); | }
ep.setReadTimeoutMillis(Integer.parseInt(epReadTimeoutMillis.getValue()));
device.setEndPoint(ep);
device.setRoundToPrecision(Integer.parseInt(roundToPrecision.getValue()));
device.configureStatic();
return new IDeviceResponse()
{
};
}
@Override
public String toString()
{
return MoreObjects.toStringHelper(this)
.add("device", device)
.toString();
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.device.scales\src\main\java\de\metas\device\scales\impl\ConfigureDeviceHandler.java | 1 |
请在Spring Boot框架中完成以下Java代码 | public void configure()
{
final CachingProvider cachingProvider = Caching.getCachingProvider();
final CacheManager cacheManager = cachingProvider.getCacheManager();
final MutableConfiguration<GetCurrenciesRequest, Object> config = new MutableConfiguration<>();
config.setTypes(GetCurrenciesRequest.class, Object.class);
config.setExpiryPolicyFactory(CreatedExpiryPolicy.factoryOf(new Duration(TimeUnit.DAYS, 1)));
final Cache<GetCurrenciesRequest, Object> cache = cacheManager.createCache("currency", config);
final JCachePolicy jcachePolicy = new JCachePolicy();
jcachePolicy.setCache(cache);
from(direct(GET_CURRENCY_ROUTE_ID))
.id(GET_CURRENCY_ROUTE_ID)
.streamCache("true")
.policy(jcachePolicy)
.log("Route invoked. Results will be cached")
.process(this::getCurrencies);
}
private void getCurrencies(final Exchange exchange)
{
final GetCurrenciesRequest getCurrenciesRequest = exchange.getIn().getBody(GetCurrenciesRequest.class);
if (getCurrenciesRequest == null)
{
throw new RuntimeException("No getCurrenciesRequest provided!");
}
final PInstanceLogger pInstanceLogger = PInstanceLogger.of(processLogger);
final ShopwareClient shopwareClient = ShopwareClient
.of(getCurrenciesRequest.getClientId(), getCurrenciesRequest.getClientSecret(), getCurrenciesRequest.getBaseUrl(), pInstanceLogger);
final JsonCurrencies currencies = shopwareClient.getCurrencies(); | if (CollectionUtils.isEmpty(currencies.getCurrencyList()))
{
throw new RuntimeException("No currencies return from Shopware!");
}
final ImmutableMap<String, String> currencyId2IsoCode = currencies.getCurrencyList().stream()
.collect(ImmutableMap.toImmutableMap(JsonCurrency::getId, JsonCurrency::getIsoCode));
final CurrencyInfoProvider currencyInfoProvider = CurrencyInfoProvider.builder()
.currencyId2IsoCode(currencyId2IsoCode)
.build();
exchange.getIn().setBody(currencyInfoProvider);
}
} | repos\metasfresh-new_dawn_uat\misc\services\camel\de-metas-camel-externalsystems\de-metas-camel-shopware6\src\main\java\de\metas\camel\externalsystems\shopware6\currency\GetCurrenciesRoute.java | 2 |
请完成以下Java代码 | private boolean isConsiderHUsFromTheWholeWarehouse()
{
return sysConfigBL.getBooleanValue(SYS_CONFIG_CONSIDER_HUs_FROM_THE_WHOLE_WAREHOUSE, false);
}
@NonNull
private AllocableHUsList getAvailableHusForLine(
@NonNull final PPOrderBOMLineId orderBOMLineId,
@NonNull final LocatorId pickFromLocatorId)
{
final I_PP_Order_BOMLine orderBOMLine = ppOrderBOMBL.getOrderBOMLineById(orderBOMLineId);
final RawMaterialsIssueStrategy issueStrategy = ppOrderRouting.getIssueStrategyForRawMaterialsActivity();
final RawMaterialsIssueStrategy actualStrategy = issueStrategy.applies(BOMComponentIssueMethod.ofNullableCode(orderBOMLine.getIssueMethod()))
? issueStrategy
: RawMaterialsIssueStrategy.DEFAULT;
final ProductId productId = ProductId.ofRepoId(orderBOMLine.getM_Product_ID());
switch (actualStrategy)
{
case AssignedHUsOnly:
return allocableHUsMap.getAllocableHUs(AllocableHUsGroupingKey.onlySourceHUs(productId));
case DEFAULT:
return allocableHUsMap.getAllocableHUs(AllocableHUsGroupingKey.of(productId, pickFromLocatorId));
default:
throw new AdempiereException("Unknown RawMaterialsIssueStrategy")
.appendParametersToMessage()
.setParameter("RawMaterialsIssueStrategy", issueStrategy);
}
}
@NonNull
private Stream<I_M_HU> streamIncludedTUs(@NonNull final AllocableHU allocableHU) | {
if (!handlingUnitsBL.isLoadingUnit(allocableHU.getTopLevelHU()))
{
return Stream.empty();
}
return handlingUnitsDAO.retrieveIncludedHUs(allocableHU.getTopLevelHU())
.stream()
.filter(handlingUnitsBL::isTransportUnitOrAggregate);
}
private static LocatorId getPickFromLocatorId(@NonNull final I_PP_Order_BOMLine orderBOMLine)
{
return LocatorId.ofRepoId(orderBOMLine.getM_Warehouse_ID(), orderBOMLine.getM_Locator_ID());
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.handlingunits.base\src\main\java\de\metas\manufacturing\issue\plan\PPOrderIssuePlanCreateCommand.java | 1 |
请完成以下Java代码 | public class DomainDetail {
/**
* id : 11000002000016
* sitename : 新浪网
* sitedomain : sina.com.cn
* sitetype : 交互式
* cdate : 2016-01-21
* comtype : 企业单位
* comname : 北京新浪互联信息服务有限公司
* comaddress : 北京市网安总队
* updateTime : 2017-09-09
*/
private String id;
private String sitename;
private String sitedomain;
private String sitetype;
private String cdate;
private String comtype;
private String comname;
private String comaddress;
private String updateTime;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getSitename() {
return sitename;
}
public void setSitename(String sitename) {
this.sitename = sitename;
}
public String getSitedomain() {
return sitedomain;
}
public void setSitedomain(String sitedomain) {
this.sitedomain = sitedomain;
}
public String getSitetype() {
return sitetype;
}
public void setSitetype(String sitetype) {
this.sitetype = sitetype;
}
public String getCdate() { | return cdate;
}
public void setCdate(String cdate) {
this.cdate = cdate;
}
public String getComtype() {
return comtype;
}
public void setComtype(String comtype) {
this.comtype = comtype;
}
public String getComname() {
return comname;
}
public void setComname(String comname) {
this.comname = comname;
}
public String getComaddress() {
return comaddress;
}
public void setComaddress(String comaddress) {
this.comaddress = comaddress;
}
public String getUpdateTime() {
return updateTime;
}
public void setUpdateTime(String updateTime) {
this.updateTime = updateTime;
}
@Override
public String toString() {
return "DomainDetail{" + "id='" + id + '\'' + ", sitename='" + sitename + '\'' + ", sitedomain='" + sitedomain
+ '\'' + ", sitetype='" + sitetype + '\'' + ", cdate='" + cdate + '\'' + ", comtype='" + comtype + '\''
+ ", comname='" + comname + '\'' + ", comaddress='" + comaddress + '\'' + ", updateTime='" + updateTime
+ '\'' + '}';
}
} | repos\spring-boot-quick-master\quick-feign\src\main\java\com\quick\feign\entity\DomainDetail.java | 1 |
请完成以下Java代码 | public void setQty (final BigDecimal Qty)
{
set_Value (COLUMNNAME_Qty, Qty);
}
@Override
public BigDecimal getQty()
{
final BigDecimal bd = get_ValueAsBigDecimal(COLUMNNAME_Qty);
return bd != null ? bd : BigDecimal.ZERO;
}
/**
* RevaluationType AD_Reference_ID=541641
* Reference name: M_CostRevaluation_Detail_RevaluationType
*/
public static final int REVALUATIONTYPE_AD_Reference_ID=541641;
/** CurrentCostBeforeRevaluation = CCB */
public static final String REVALUATIONTYPE_CurrentCostBeforeRevaluation = "CCB";
/** CurrentCostAfterRevaluation = CCA */
public static final String REVALUATIONTYPE_CurrentCostAfterRevaluation = "CCA";
/** CostDetailAdjustment = CDA */
public static final String REVALUATIONTYPE_CostDetailAdjustment = "CDA";
@Override
public void setRevaluationType (final java.lang.String RevaluationType)
{
set_Value (COLUMNNAME_RevaluationType, RevaluationType);
} | @Override
public java.lang.String getRevaluationType()
{
return get_ValueAsString(COLUMNNAME_RevaluationType);
}
@Override
public void setSeqNo (final int SeqNo)
{
set_Value (COLUMNNAME_SeqNo, SeqNo);
}
@Override
public int getSeqNo()
{
return get_ValueAsInt(COLUMNNAME_SeqNo);
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_M_CostRevaluation_Detail.java | 1 |
请在Spring Boot框架中完成以下Java代码 | public boolean isContainsCommissionTriggers(@NonNull final InvoiceId invoiceId)
{
final Set<SalesInvoiceLineDocumentId> invoiceLineIds = invoiceDAO.retrieveLines(invoiceId)
.stream()
.map(I_C_InvoiceLine::getC_InvoiceLine_ID)
.map(invoiceLineId -> InvoiceAndLineId.ofRepoId(invoiceId, invoiceLineId))
.map(SalesInvoiceLineDocumentId::new)
.collect(ImmutableSet.toImmutableSet());
final boolean linesSubjectToCommission = commissionInstanceDAO.isILsReferencedByCommissionInstances(invoiceLineIds);
if (linesSubjectToCommission)
{
return true;
} | final List<I_C_Invoice_Candidate> invoiceCandidates = invoiceCandDAO.retrieveInvoiceCandidates(invoiceId);
if (invoiceCandidates.isEmpty())
{
return false;
}
final Set<SalesInvoiceCandidateDocumentId> invoiceCandIdSet = invoiceCandidates.stream()
.map(I_C_Invoice_Candidate::getC_Invoice_Candidate_ID)
.map(InvoiceCandidateId::ofRepoId)
.map(SalesInvoiceCandidateDocumentId::new)
.collect(ImmutableSet.toImmutableSet());
return commissionInstanceDAO.isICsReferencedByCommissionInstances(invoiceCandIdSet);
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.contracts\src\main\java\de\metas\contracts\commission\commissioninstance\services\CommissionTriggerService.java | 2 |
请完成以下Java代码 | public final class OAuth2AuthorizationCodeAuthenticationConverter implements AuthenticationConverter {
@Nullable
@Override
public Authentication convert(HttpServletRequest request) {
MultiValueMap<String, String> parameters = OAuth2EndpointUtils.getFormParameters(request);
// grant_type (REQUIRED)
String grantType = parameters.getFirst(OAuth2ParameterNames.GRANT_TYPE);
if (!AuthorizationGrantType.AUTHORIZATION_CODE.getValue().equals(grantType)) {
return null;
}
Authentication clientPrincipal = SecurityContextHolder.getContext().getAuthentication();
// code (REQUIRED)
String code = parameters.getFirst(OAuth2ParameterNames.CODE);
if (!StringUtils.hasText(code) || parameters.get(OAuth2ParameterNames.CODE).size() != 1) {
OAuth2EndpointUtils.throwError(OAuth2ErrorCodes.INVALID_REQUEST, OAuth2ParameterNames.CODE,
OAuth2EndpointUtils.ACCESS_TOKEN_REQUEST_ERROR_URI);
}
// redirect_uri (REQUIRED)
// Required only if the "redirect_uri" parameter was included in the authorization
// request
String redirectUri = parameters.getFirst(OAuth2ParameterNames.REDIRECT_URI); | if (StringUtils.hasText(redirectUri) && parameters.get(OAuth2ParameterNames.REDIRECT_URI).size() != 1) {
OAuth2EndpointUtils.throwError(OAuth2ErrorCodes.INVALID_REQUEST, OAuth2ParameterNames.REDIRECT_URI,
OAuth2EndpointUtils.ACCESS_TOKEN_REQUEST_ERROR_URI);
}
Map<String, Object> additionalParameters = new HashMap<>();
parameters.forEach((key, value) -> {
if (!key.equals(OAuth2ParameterNames.GRANT_TYPE) && !key.equals(OAuth2ParameterNames.CLIENT_ID)
&& !key.equals(OAuth2ParameterNames.CODE) && !key.equals(OAuth2ParameterNames.REDIRECT_URI)) {
additionalParameters.put(key, (value.size() == 1) ? value.get(0) : value.toArray(new String[0]));
}
});
// Validate DPoP Proof HTTP Header (if available)
OAuth2EndpointUtils.validateAndAddDPoPParametersIfAvailable(request, additionalParameters);
return new OAuth2AuthorizationCodeAuthenticationToken(code, clientPrincipal, redirectUri, additionalParameters);
}
} | repos\spring-security-main\oauth2\oauth2-authorization-server\src\main\java\org\springframework\security\oauth2\server\authorization\web\authentication\OAuth2AuthorizationCodeAuthenticationConverter.java | 1 |
请完成以下Java代码 | public boolean supports(Class<?> authentication) {
return UsernamePasswordAuthenticationToken.class.isAssignableFrom(authentication);
}
/**
* Determines whether the supplied password will be used as the credentials in the
* successful authentication token. If set to false, then the password will be
* obtained from the UserDetails object created by the configured
* {@code UserDetailsContextMapper}. Often it will not be possible to read the
* password from the directory, so defaults to true.
* @param useAuthenticationRequestCredentials whether to use the credentials in the
* authentication request
*/
public void setUseAuthenticationRequestCredentials(boolean useAuthenticationRequestCredentials) {
this.useAuthenticationRequestCredentials = useAuthenticationRequestCredentials;
}
@Override
public void setMessageSource(@NonNull MessageSource messageSource) {
this.messages = new MessageSourceAccessor(messageSource);
}
/**
* Sets the {@link GrantedAuthoritiesMapper} used for converting the authorities
* loaded from storage to a new set of authorities which will be associated to the
* {@link UsernamePasswordAuthenticationToken}. If not set, defaults to a
* {@link NullAuthoritiesMapper}.
* @param authoritiesMapper the {@link GrantedAuthoritiesMapper} used for mapping the
* user's authorities
*/
public void setAuthoritiesMapper(GrantedAuthoritiesMapper authoritiesMapper) {
this.authoritiesMapper = authoritiesMapper;
}
/**
* Allows a custom strategy to be used for creating the <tt>UserDetails</tt> which | * will be stored as the principal in the <tt>Authentication</tt> returned by the
* {@link #createSuccessfulAuthentication(org.springframework.security.authentication.UsernamePasswordAuthenticationToken, org.springframework.security.core.userdetails.UserDetails)}
* method.
* @param userDetailsContextMapper the strategy instance. If not set, defaults to a
* simple <tt>LdapUserDetailsMapper</tt>.
*/
public void setUserDetailsContextMapper(UserDetailsContextMapper userDetailsContextMapper) {
Assert.notNull(userDetailsContextMapper, "UserDetailsContextMapper must not be null");
this.userDetailsContextMapper = userDetailsContextMapper;
}
/**
* Provides access to the injected {@code UserDetailsContextMapper} strategy for use
* by subclasses.
*/
protected UserDetailsContextMapper getUserDetailsContextMapper() {
return this.userDetailsContextMapper;
}
} | repos\spring-security-main\ldap\src\main\java\org\springframework\security\ldap\authentication\AbstractLdapAuthenticationProvider.java | 1 |
请完成以下Java代码 | protected org.compiere.model.POInfo initPO (Properties ctx)
{
org.compiere.model.POInfo poi = org.compiere.model.POInfo.getPOInfo (ctx, Table_Name, get_TrxName());
return poi;
}
/** Set Beschreibung.
@param Description Beschreibung */
@Override
public void setDescription (java.lang.String Description)
{
set_Value (COLUMNNAME_Description, Description);
}
/** Get Beschreibung.
@return Beschreibung */
@Override
public java.lang.String getDescription ()
{
return (java.lang.String)get_Value(COLUMNNAME_Description);
}
/** Set Dosage Form.
@param M_DosageForm_ID Dosage Form */
@Override
public void setM_DosageForm_ID (int M_DosageForm_ID)
{
if (M_DosageForm_ID < 1)
set_ValueNoCheck (COLUMNNAME_M_DosageForm_ID, null);
else
set_ValueNoCheck (COLUMNNAME_M_DosageForm_ID, Integer.valueOf(M_DosageForm_ID));
}
/** Get Dosage Form. | @return Dosage Form */
@Override
public int getM_DosageForm_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_M_DosageForm_ID);
if (ii == null)
return 0;
return ii.intValue();
}
/** Set Name.
@param Name
Alphanumeric identifier of the entity
*/
@Override
public void setName (java.lang.String Name)
{
set_Value (COLUMNNAME_Name, Name);
}
/** Get Name.
@return Alphanumeric identifier of the entity
*/
@Override
public java.lang.String getName ()
{
return (java.lang.String)get_Value(COLUMNNAME_Name);
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.vertical.pharma\src\main\java-gen\de\metas\vertical\pharma\model\X_M_DosageForm.java | 1 |
请完成以下Java代码 | public void changeStatusTo(@NonNull final PPOrderRoutingActivityStatus newStatus)
{
final PPOrderRoutingActivityStatus currentStatus = getStatus();
if (currentStatus.equals(newStatus))
{
return;
}
currentStatus.assertCanChangeTo(newStatus);
this.status = newStatus;
}
void reportProgress(final PPOrderActivityProcessReport report)
{
changeStatusTo(PPOrderRoutingActivityStatus.IN_PROGRESS);
if (getDateStart() == null)
{
setDateStart(report.getFinishDate().minus(report.getDuration()));
}
if (getDateFinish() == null || getDateFinish().isBefore(report.getFinishDate()))
{
setDateFinish(report.getFinishDate());
}
if (report.getQtyProcessed() != null)
{
setQtyDelivered(getQtyDelivered().add(report.getQtyProcessed()));
}
if (report.getQtyScrapped() != null)
{
setQtyScrapped(getQtyScrapped().add(report.getQtyScrapped()));
}
if (report.getQtyRejected() != null)
{
setQtyRejected(getQtyRejected().add(report.getQtyRejected()));
}
setDurationReal(getDurationReal().plus(report.getDuration()));
setSetupTimeReal(getSetupTimeReal().plus(report.getSetupTime()));
}
void closeIt()
{
if (getStatus() == PPOrderRoutingActivityStatus.CLOSED)
{
logger.warn("Activity already closed - {}", this);
return;
}
else if (getStatus() == PPOrderRoutingActivityStatus.IN_PROGRESS)
{
completeIt();
}
changeStatusTo(PPOrderRoutingActivityStatus.CLOSED);
if (getDateFinish() != null)
{
setDateFinish(SystemTime.asInstant());
} | if (!Objects.equals(getDurationRequired(), getDurationReal()))
{
// addDescription(Services.get(IMsgBL.class).parseTranslation(getCtx(), "@closed@ ( @Duration@ :" + getDurationRequiered() + ") ( @QtyRequiered@ :" + getQtyRequiered() + ")"));
setDurationRequired(getDurationReal());
setQtyRequired(getQtyDelivered());
}
}
void uncloseIt()
{
if (getStatus() != PPOrderRoutingActivityStatus.CLOSED)
{
logger.warn("Only Closed activities can be unclosed - {}", this);
return;
}
changeStatusTo(PPOrderRoutingActivityStatus.IN_PROGRESS);
}
void voidIt()
{
if (getStatus() == PPOrderRoutingActivityStatus.VOIDED)
{
logger.warn("Activity already voided - {}", this);
return;
}
changeStatusTo(PPOrderRoutingActivityStatus.VOIDED);
setQtyRequired(getQtyRequired().toZero());
setSetupTimeRequired(Duration.ZERO);
setDurationRequired(Duration.ZERO);
}
public void completeIt()
{
changeStatusTo(PPOrderRoutingActivityStatus.COMPLETED);
if (getDateFinish() == null)
{
setDateFinish(SystemTime.asInstant());
}
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.manufacturing\src\main\java\org\eevolution\api\PPOrderRoutingActivity.java | 1 |
请完成以下Java代码 | public void setName (final java.lang.String Name)
{
set_Value (COLUMNNAME_Name, Name);
}
@Override
public java.lang.String getName()
{
return get_ValueAsString(COLUMNNAME_Name);
}
@Override
public void setStdPrecision (final int StdPrecision)
{
set_Value (COLUMNNAME_StdPrecision, StdPrecision);
}
@Override
public int getStdPrecision()
{
return get_ValueAsInt(COLUMNNAME_StdPrecision);
}
@Override
public void setUOMSymbol (final java.lang.String UOMSymbol)
{
set_Value (COLUMNNAME_UOMSymbol, UOMSymbol);
}
@Override
public java.lang.String getUOMSymbol()
{
return get_ValueAsString(COLUMNNAME_UOMSymbol);
}
/**
* UOMType AD_Reference_ID=53323
* Reference name: UOM Type
*/
public static final int UOMTYPE_AD_Reference_ID=53323;
/** Angle = AN */
public static final String UOMTYPE_Angle = "AN";
/** Area = AR */
public static final String UOMTYPE_Area = "AR";
/** Data Storage = DS */
public static final String UOMTYPE_DataStorage = "DS";
/** Density = DE */
public static final String UOMTYPE_Density = "DE";
/** Energy = EN */
public static final String UOMTYPE_Energy = "EN";
/** Force = FO */
public static final String UOMTYPE_Force = "FO";
/** Kitchen Measures = KI */
public static final String UOMTYPE_KitchenMeasures = "KI";
/** Length = LE */
public static final String UOMTYPE_Length = "LE";
/** Power = PO */ | public static final String UOMTYPE_Power = "PO";
/** Pressure = PR */
public static final String UOMTYPE_Pressure = "PR";
/** Temperature = TE */
public static final String UOMTYPE_Temperature = "TE";
/** Time = TM */
public static final String UOMTYPE_Time = "TM";
/** Torque = TO */
public static final String UOMTYPE_Torque = "TO";
/** Velocity = VE */
public static final String UOMTYPE_Velocity = "VE";
/** Volume Liquid = VL */
public static final String UOMTYPE_VolumeLiquid = "VL";
/** Volume Dry = VD */
public static final String UOMTYPE_VolumeDry = "VD";
/** Weigth = WE */
public static final String UOMTYPE_Weigth = "WE";
/** Currency = CU */
public static final String UOMTYPE_Currency = "CU";
/** Data Speed = DV */
public static final String UOMTYPE_DataSpeed = "DV";
/** Frequency = FR */
public static final String UOMTYPE_Frequency = "FR";
/** Other = OT */
public static final String UOMTYPE_Other = "OT";
/** Gesundheitswesen = HC */
public static final String UOMTYPE_Gesundheitswesen = "HC";
/** Zeit (Erfassungsgenauigkeit) = TD */
public static final String UOMTYPE_ZeitErfassungsgenauigkeit = "TD";
@Override
public void setUOMType (final java.lang.String UOMType)
{
set_Value (COLUMNNAME_UOMType, UOMType);
}
@Override
public java.lang.String getUOMType()
{
return get_ValueAsString(COLUMNNAME_UOMType);
}
@Override
public void setX12DE355 (final java.lang.String X12DE355)
{
set_Value (COLUMNNAME_X12DE355, X12DE355);
}
@Override
public java.lang.String getX12DE355()
{
return get_ValueAsString(COLUMNNAME_X12DE355);
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_C_UOM.java | 1 |
请完成以下Java代码 | public Evaluatee2 asEvaluatee()
{
return new Evaluatee2()
{
@Override
public String get_ValueAsString(final String variableName)
{
if (!has_Variable(variableName))
{
return "";
}
final Object value = POJOWrapper.this.getValuesMap().get(variableName);
return value == null ? "" : value.toString();
}
@Override
public boolean has_Variable(final String variableName)
{
return POJOWrapper.this.hasColumnName(variableName);
}
@Override
public String get_ValueOldAsString(final String variableName)
{
throw new UnsupportedOperationException("not implemented");
}
};
}
public IModelInternalAccessor getModelInternalAccessor()
{
if (_modelInternalAccessor == null) | {
_modelInternalAccessor = new POJOModelInternalAccessor(this);
}
return _modelInternalAccessor;
}
POJOModelInternalAccessor _modelInternalAccessor = null;
public static IModelInternalAccessor getModelInternalAccessor(final Object model)
{
final POJOWrapper wrapper = getWrapper(model);
if (wrapper == null)
{
return null;
}
return wrapper.getModelInternalAccessor();
}
public boolean isProcessed()
{
return hasColumnName("Processed")
? StringUtils.toBoolean(getValue("Processed", Object.class))
: false;
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\org\adempiere\ad\wrapper\POJOWrapper.java | 1 |
请完成以下Java代码 | protected PvmExecutionImpl newProcessInstance() {
return new ExecutionImpl();
}
public List<ActivityImpl> getInitialActivityStack() {
return getInitialActivityStack(initial);
}
public synchronized List<ActivityImpl> getInitialActivityStack(ActivityImpl startActivity) {
List<ActivityImpl> initialActivityStack = initialActivityStacks.get(startActivity);
if(initialActivityStack == null) {
initialActivityStack = new ArrayList<ActivityImpl>();
ActivityImpl activity = startActivity;
while (activity!=null) {
initialActivityStack.add(0, activity);
activity = activity.getParentFlowScopeActivity();
}
initialActivityStacks.put(startActivity, initialActivityStack);
}
return initialActivityStack;
}
public String getDiagramResourceName() {
return null;
}
public String getDeploymentId() {
return null;
}
public void addLaneSet(LaneSet newLaneSet) {
getLaneSets().add(newLaneSet);
}
public Lane getLaneForId(String id) {
if(laneSets != null && laneSets.size() > 0) {
Lane lane;
for(LaneSet set : laneSets) {
lane = set.getLaneForId(id);
if(lane != null) {
return lane;
}
}
}
return null;
}
@Override
public CoreActivityBehavior<? extends BaseDelegateExecution> getActivityBehavior() {
// unsupported in PVM
return null;
}
// getters and setters //////////////////////////////////////////////////////
public ActivityImpl getInitial() {
return initial;
}
public void setInitial(ActivityImpl initial) {
this.initial = initial;
}
@Override
public String toString() { | return "ProcessDefinition("+id+")";
}
public String getDescription() {
return (String) getProperty("documentation");
}
/**
* @return all lane-sets defined on this process-instance. Returns an empty list if none are defined.
*/
public List<LaneSet> getLaneSets() {
if(laneSets == null) {
laneSets = new ArrayList<LaneSet>();
}
return laneSets;
}
public void setParticipantProcess(ParticipantProcess participantProcess) {
this.participantProcess = participantProcess;
}
public ParticipantProcess getParticipantProcess() {
return participantProcess;
}
public boolean isScope() {
return true;
}
public PvmScope getEventScope() {
return null;
}
public ScopeImpl getFlowScope() {
return null;
}
public PvmScope getLevelOfSubprocessScope() {
return null;
}
@Override
public boolean isSubProcessScope() {
return true;
}
} | repos\camunda-bpm-platform-master\engine\src\main\java\org\camunda\bpm\engine\impl\pvm\process\ProcessDefinitionImpl.java | 1 |
请完成以下Java代码 | protected String doIt()
{
final IDunningDAO dunningDAO = Services.get(IDunningDAO.class);
//
// Generate dunning candidates
for (final I_C_Dunning dunning : dunningDAO.retrieveDunnings())
{
for (final I_C_DunningLevel dunningLevel : dunningDAO.retrieveDunningLevels(dunning))
{
generateCandidates(dunningLevel);
}
}
return MSG_OK;
}
private void generateCandidates(final I_C_DunningLevel dunningLevel)
{ | final IDunningBL dunningBL = Services.get(IDunningBL.class);
trxManager.runInNewTrx(new TrxRunnableAdapter()
{
@Override
public void run(String localTrxName) throws Exception
{
final IDunningContext context = dunningBL.createDunningContext(getCtx(), dunningLevel, p_DunningDate, get_TrxName());
context.setProperty(IDunningCandidateProducer.CONTEXT_FullUpdate, p_IsFullUpdate);
final int countDelete = Services.get(IDunningDAO.class).deleteNotProcessedCandidates(context, dunningLevel);
addLog("@C_DunningLevel@ " + dunningLevel.getName() + ": " + countDelete + " record(s) deleted");
final int countCreateUpdate = dunningBL.createDunningCandidates(context);
addLog("@C_DunningLevel@ " + dunningLevel.getName() + ": " + countCreateUpdate + " record(s) created/updated");
}
});
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.dunning\src\main\java\de\metas\dunning\process\C_Dunning_Candidate_Create.java | 1 |
请完成以下Java代码 | protected void singleSelect(ObjectNode parent, SingleSelectCapability capability,
Function<MetadataElement, ObjectNode> valueMapper, Function<String, String> defaultMapper) {
ObjectNode single = nodeFactory.objectNode();
single.put("type", capability.getType().getName());
DefaultMetadataElement defaultType = capability.getDefault();
if (defaultType != null) {
single.put("default", defaultMapper.apply(defaultType.getId()));
}
ArrayNode values = nodeFactory.arrayNode();
values.addAll(capability.getContent().stream().map(valueMapper).collect(Collectors.toList()));
single.set("values", values);
parent.set(capability.getId(), single);
}
protected void text(ObjectNode parent, TextCapability capability) {
ObjectNode text = nodeFactory.objectNode();
text.put("type", capability.getType().getName());
String defaultValue = capability.getContent();
if (StringUtils.hasText(defaultValue)) {
text.put("default", defaultValue);
}
parent.set(capability.getId(), text);
}
protected ObjectNode mapDependencyGroup(DependencyGroup group) {
ObjectNode result = nodeFactory.objectNode();
result.put("name", group.getName());
if ((group instanceof Describable) && ((Describable) group).getDescription() != null) {
result.put("description", ((Describable) group).getDescription());
}
ArrayNode items = nodeFactory.arrayNode();
group.getContent().forEach((it) -> {
JsonNode dependency = mapDependency(it);
if (dependency != null) {
items.add(dependency);
}
});
result.set("values", items);
return result;
} | protected ObjectNode mapDependency(Dependency dependency) {
if (dependency.getCompatibilityRange() == null) {
// only map the dependency if no compatibilityRange is set
return mapValue(dependency);
}
return null;
}
protected ObjectNode mapType(Type type) {
ObjectNode result = mapValue(type);
result.put("action", type.getAction());
ObjectNode tags = nodeFactory.objectNode();
type.getTags().forEach(tags::put);
result.set("tags", tags);
return result;
}
private ObjectNode mapVersionMetadata(MetadataElement value) {
ObjectNode result = nodeFactory.objectNode();
result.put("id", formatVersion(value.getId()));
result.put("name", value.getName());
return result;
}
protected String formatVersion(String versionId) {
Version version = VersionParser.DEFAULT.safeParse(versionId);
return (version != null) ? version.format(Format.V1).toString() : versionId;
}
protected ObjectNode mapValue(MetadataElement value) {
ObjectNode result = nodeFactory.objectNode();
result.put("id", value.getId());
result.put("name", value.getName());
if ((value instanceof Describable) && ((Describable) value).getDescription() != null) {
result.put("description", ((Describable) value).getDescription());
}
return result;
}
} | repos\initializr-main\initializr-web\src\main\java\io\spring\initializr\web\mapper\InitializrMetadataV2JsonMapper.java | 1 |
请完成以下Java代码 | public CaseInstanceStartEventSubscriptionDeletionBuilder addCorrelationParameterValue(String parameterName, Object parameterValue) {
correlationParameterValues.put(parameterName, parameterValue);
return this;
}
@Override
public CaseInstanceStartEventSubscriptionDeletionBuilder addCorrelationParameterValues(Map<String, Object> parameters) {
correlationParameterValues.putAll(parameters);
return this;
}
public String getCaseDefinitionId() {
return caseDefinitionId;
}
public String getTenantId() {
return tenantId;
}
public boolean hasCorrelationParameterValues() {
return correlationParameterValues.size() > 0;
} | public Map<String, Object> getCorrelationParameterValues() {
return correlationParameterValues;
}
@Override
public void deleteSubscriptions() {
checkValidInformation();
cmmnRuntimeService.deleteCaseInstanceStartEventSubscriptions(this);
}
protected void checkValidInformation() {
if (StringUtils.isEmpty(caseDefinitionId)) {
throw new FlowableIllegalArgumentException("The case definition must be provided using the exact id of the version the subscription was registered for.");
}
}
} | repos\flowable-engine-main\modules\flowable-cmmn-engine\src\main\java\org\flowable\cmmn\engine\impl\runtime\CaseInstanceStartEventSubscriptionDeletionBuilderImpl.java | 1 |
请在Spring Boot框架中完成以下Java代码 | static class HazelcastInstanceEntityManagerFactoryDependsOnConfiguration {
}
static class HazelcastInstanceEntityManagerFactoryDependsOnPostProcessor
extends EntityManagerFactoryDependsOnPostProcessor {
HazelcastInstanceEntityManagerFactoryDependsOnPostProcessor() {
super("hazelcastInstance");
}
}
static class OnHazelcastAndJpaCondition extends AllNestedConditions {
OnHazelcastAndJpaCondition() { | super(ConfigurationPhase.REGISTER_BEAN);
}
@ConditionalOnBean(name = "hazelcastInstance")
static class HasHazelcastInstance {
}
@ConditionalOnBean(AbstractEntityManagerFactoryBean.class)
static class HasJpa {
}
}
} | repos\spring-boot-4.0.1\module\spring-boot-hazelcast\src\main\java\org\springframework\boot\hazelcast\autoconfigure\HazelcastJpaDependencyAutoConfiguration.java | 2 |
请完成以下Java代码 | public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getUserName() {
return userName;
}
public void setUserName(String userName) {
this.userName = userName;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public String getUserToken() {
return userToken;
}
public void setUserToken(String userToken) {
this.userToken = userToken;
} | public int getIsDeleted() {
return isDeleted;
}
public void setIsDeleted(int isDeleted) {
this.isDeleted = isDeleted;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
@Override
public String toString() {
return "AdminUser{" +
"id=" + id +
", userName='" + userName + '\'' +
", password='" + password + '\'' +
", userToken='" + userToken + '\'' +
", isDeleted=" + isDeleted +
", createTime=" + createTime +
'}';
}
} | repos\spring-boot-projects-main\SpringBoot前后端分离实战项目源码\spring-boot-project-front-end&back-end\src\main\java\cn\lanqiao\springboot3\entity\AdminUser.java | 1 |
请完成以下Java代码 | public void setC_Prepayment_Acct (int C_Prepayment_Acct)
{
set_Value (COLUMNNAME_C_Prepayment_Acct, Integer.valueOf(C_Prepayment_Acct));
}
/** Get Customer Prepayment.
@return Account for customer prepayments
*/
public int getC_Prepayment_Acct ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_C_Prepayment_Acct);
if (ii == null)
return 0;
return ii.intValue();
}
public I_C_ValidCombination getC_Receivable_A() throws RuntimeException
{
return (I_C_ValidCombination)MTable.get(getCtx(), I_C_ValidCombination.Table_Name)
.getPO(getC_Receivable_Acct(), get_TrxName()); }
/** Set Customer Receivables.
@param C_Receivable_Acct
Account for Customer Receivables
*/
public void setC_Receivable_Acct (int C_Receivable_Acct)
{
set_Value (COLUMNNAME_C_Receivable_Acct, Integer.valueOf(C_Receivable_Acct));
}
/** Get Customer Receivables.
@return Account for Customer Receivables
*/
public int getC_Receivable_Acct ()
{ | Integer ii = (Integer)get_Value(COLUMNNAME_C_Receivable_Acct);
if (ii == null)
return 0;
return ii.intValue();
}
public I_C_ValidCombination getC_Receivable_Services_A() throws RuntimeException
{
return (I_C_ValidCombination)MTable.get(getCtx(), I_C_ValidCombination.Table_Name)
.getPO(getC_Receivable_Services_Acct(), get_TrxName()); }
/** Set Receivable Services.
@param C_Receivable_Services_Acct
Customer Accounts Receivables Services Account
*/
public void setC_Receivable_Services_Acct (int C_Receivable_Services_Acct)
{
set_Value (COLUMNNAME_C_Receivable_Services_Acct, Integer.valueOf(C_Receivable_Services_Acct));
}
/** Get Receivable Services.
@return Customer Accounts Receivables Services Account
*/
public int getC_Receivable_Services_Acct ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_C_Receivable_Services_Acct);
if (ii == null)
return 0;
return ii.intValue();
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_C_BP_Customer_Acct.java | 1 |
请完成以下Java代码 | public class UserCreationDTO {
private String name;
private String password;
private List<String> roles;
UserCreationDTO() {}
public String getName() {
return name;
}
public String getPassword() {
return password;
}
public List<String> getRoles() { | return roles;
}
void setName(String name) {
this.name = name;
}
void setPassword(String password) {
this.password = password;
}
void setRoles(List<String> roles) {
this.roles = roles;
}
} | repos\tutorials-master\patterns-modules\design-patterns-architectural\src\main\java\com\baeldung\dtopattern\api\UserCreationDTO.java | 1 |
请完成以下Java代码 | public int hashCode() {
return Objects.hash(super.hashCode(), firstName, lastName, email);
}
public static class Builder {
private String firstName;
private String lastName;
private String email;
private String username;
private String password;
private Collection<? extends GrantedAuthority> authorities;
public Builder withFirstName(String firstName) {
this.firstName = firstName;
return this;
}
public Builder withLastName(String lastName) {
this.lastName = lastName;
return this;
}
public Builder withEmail(String email) {
this.email = email;
return this;
}
public Builder withUsername(String username) {
this.username = username;
return this;
} | public Builder withPassword(String password) {
this.password = password;
return this;
}
public Builder withAuthorities(Collection<? extends GrantedAuthority> authorities) {
this.authorities = authorities;
return this;
}
public CustomUserDetails build() {
return new CustomUserDetails(this);
}
}
} | repos\tutorials-master\spring-security-modules\spring-security-web-thymeleaf\src\main\java\com\baeldung\customuserdetails\CustomUserDetails.java | 1 |
请完成以下Java代码 | public Date getCreatedTime() {
return createdTime;
}
/**
* 设置 创建时间.
*
* @param createdTime 创建时间.
*/
public void setCreatedTime(Date createdTime) {
this.createdTime = createdTime;
}
/**
* 获取 更新时间.
*
* @return 更新时间.
*/ | public Date getUpdatedTime() {
return updatedTime;
}
/**
* 设置 更新时间.
*
* @param updatedTime 更新时间.
*/
public void setUpdatedTime(Date updatedTime) {
this.updatedTime = updatedTime;
}
protected Serializable pkVal() {
return this.id;
}
} | repos\SpringBootBucket-master\springboot-jwt\src\main\java\com\xncoding\jwt\dao\domain\Role.java | 1 |
请在Spring Boot框架中完成以下Java代码 | public class HealthcareChPdfAttachmentController
{
private final OrderCandidatesRestEndpoint orderCandidatesRestEndpoint;
public HealthcareChPdfAttachmentController(
@NonNull final OrderCandidatesRestEndpoint orderCandidatesRestEndpoint)
{
this.orderCandidatesRestEndpoint = orderCandidatesRestEndpoint;
}
@PostMapping("/attachedPdfFiles/{externalReference}")
@ApiOperation(value = "Attach a PDF document to order line candidates with the given externalOrderId. The attachment is tagged with\n"
+ TAGNAME_CONCATENATE_PDF_TO_INVOICE_PDF + "=true, so the PDF will eventually be appended to the invoice's PDF\n"
+ ATTACHMENT_TAGNAME_BELONGS_TO_EXTERNAL_REFERENCE + "=externalReference, so the base64-encoded PDF will eventually included in the invoice's forum-datenaustausch.ch-XML")
// TODO only allow PDF
public ResponseEntity<JsonAttachment> attachPdfFile(
@ApiParam(required = true, value = "Reference string that was returned by the invoice-rest-controller") //
@PathVariable("externalReference") final String externalReference,
@RequestParam("file") @NonNull final MultipartFile file) | throws IOException
{
final ImmutableList<String> tags = ImmutableList.of(
ATTACHMENT_TAGNAME_EXPORT_PROVIDER/* name */, ForumDatenaustauschChConstants.INVOICE_EXPORT_PROVIDER_ID/* value */,
ATTACHMENT_TAGNAME_BELONGS_TO_EXTERNAL_REFERENCE/* name */, externalReference/* value */,
TAGNAME_CONCATENATE_PDF_TO_INVOICE_PDF/* name */, Boolean.TRUE.toString()/* value */);
return orderCandidatesRestEndpoint
.attachFile(
RestApiConstants.INPUT_SOURCE_INTERAL_NAME,
externalReference,
tags,
file);
}
@ResponseStatus(code = HttpStatus.NOT_FOUND, reason = "No order line candidates were found for the given externalOrderId")
public static class OLCandsNotFoundExeception extends RuntimeException
{
private static final long serialVersionUID = 8216181888558013882L;
}
} | repos\metasfresh-new_dawn_uat\backend\vertical-healthcare_ch\forum_datenaustausch_ch.invoice_rest-api\src\main\java\de\metas\vertical\healthcare\forum_datenaustausch_ch\rest\HealthcareChPdfAttachmentController.java | 2 |
请完成以下Java代码 | public int getM_AttributeSet_IncludedTab_ID()
{
return get_ValueAsInt(COLUMNNAME_M_AttributeSet_IncludedTab_ID);
}
@Override
public void setM_AttributeValue_ID (final int M_AttributeValue_ID)
{
if (M_AttributeValue_ID < 1)
set_Value (COLUMNNAME_M_AttributeValue_ID, null);
else
set_Value (COLUMNNAME_M_AttributeValue_ID, M_AttributeValue_ID);
}
@Override
public int getM_AttributeValue_ID()
{
return get_ValueAsInt(COLUMNNAME_M_AttributeValue_ID);
}
@Override
public void setRecord_Attribute_ID (final int Record_Attribute_ID)
{
if (Record_Attribute_ID < 1)
set_ValueNoCheck (COLUMNNAME_Record_Attribute_ID, null);
else
set_ValueNoCheck (COLUMNNAME_Record_Attribute_ID, Record_Attribute_ID);
}
@Override
public int getRecord_Attribute_ID()
{
return get_ValueAsInt(COLUMNNAME_Record_Attribute_ID);
}
@Override
public void setRecord_ID (final int Record_ID)
{
if (Record_ID < 0)
set_ValueNoCheck (COLUMNNAME_Record_ID, null);
else
set_ValueNoCheck (COLUMNNAME_Record_ID, Record_ID);
}
@Override
public int getRecord_ID()
{
return get_ValueAsInt(COLUMNNAME_Record_ID);
} | @Override
public void setValueDate (final @Nullable java.sql.Timestamp ValueDate)
{
set_Value (COLUMNNAME_ValueDate, ValueDate);
}
@Override
public java.sql.Timestamp getValueDate()
{
return get_ValueAsTimestamp(COLUMNNAME_ValueDate);
}
@Override
public void setValueNumber (final @Nullable BigDecimal ValueNumber)
{
set_Value (COLUMNNAME_ValueNumber, ValueNumber);
}
@Override
public BigDecimal getValueNumber()
{
final BigDecimal bd = get_ValueAsBigDecimal(COLUMNNAME_ValueNumber);
return bd != null ? bd : BigDecimal.ZERO;
}
@Override
public void setValueString (final @Nullable java.lang.String ValueString)
{
set_Value (COLUMNNAME_ValueString, ValueString);
}
@Override
public java.lang.String getValueString()
{
return get_ValueAsString(COLUMNNAME_ValueString);
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_Record_Attribute.java | 1 |
请完成以下Java代码 | public org.compiere.model.I_C_CountryArea getC_CountryArea() throws RuntimeException
{
return get_ValueAsPO(COLUMNNAME_C_CountryArea_ID, org.compiere.model.I_C_CountryArea.class);
}
@Override
public void setC_CountryArea(org.compiere.model.I_C_CountryArea C_CountryArea)
{
set_ValueFromPO(COLUMNNAME_C_CountryArea_ID, org.compiere.model.I_C_CountryArea.class, C_CountryArea);
}
/** Set Country Area.
@param C_CountryArea_ID Country Area */
@Override
public void setC_CountryArea_ID (int C_CountryArea_ID)
{
if (C_CountryArea_ID < 1)
set_ValueNoCheck (COLUMNNAME_C_CountryArea_ID, null);
else
set_ValueNoCheck (COLUMNNAME_C_CountryArea_ID, Integer.valueOf(C_CountryArea_ID));
}
/** Get Country Area.
@return Country Area */
@Override
public int getC_CountryArea_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_C_CountryArea_ID);
if (ii == null)
return 0;
return ii.intValue();
}
/** Set Gültig ab.
@param ValidFrom | Gültig ab inklusiv (erster Tag)
*/
@Override
public void setValidFrom (java.sql.Timestamp ValidFrom)
{
set_Value (COLUMNNAME_ValidFrom, ValidFrom);
}
/** Get Gültig ab.
@return Gültig ab inklusiv (erster Tag)
*/
@Override
public java.sql.Timestamp getValidFrom ()
{
return (java.sql.Timestamp)get_Value(COLUMNNAME_ValidFrom);
}
/** Set Gültig bis.
@param ValidTo
Gültig bis inklusiv (letzter Tag)
*/
@Override
public void setValidTo (java.sql.Timestamp ValidTo)
{
set_Value (COLUMNNAME_ValidTo, ValidTo);
}
/** Get Gültig bis.
@return Gültig bis inklusiv (letzter Tag)
*/
@Override
public java.sql.Timestamp getValidTo ()
{
return (java.sql.Timestamp)get_Value(COLUMNNAME_ValidTo);
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_C_CountryArea_Assign.java | 1 |
请完成以下Java代码 | private DocumentFilterList getFilters()
{
return _filtersById.isEmpty() ? DocumentFilterList.EMPTY : DocumentFilterList.ofList(_filtersById.values());
}
public Builder addFiltersIfAbsent(final Collection<DocumentFilter> filters)
{
filters.forEach(filter -> {
final boolean notDuplicate = isNotDuplicateDocumentFilter(filter);
if (notDuplicate)
{
_filtersById.putIfAbsent(filter.getFilterId(), filter);
}
});
return this;
}
public Builder refreshViewOnChangeEvents(final boolean refreshViewOnChangeEvents)
{
this.refreshViewOnChangeEvents = refreshViewOnChangeEvents;
return this;
}
private boolean isRefreshViewOnChangeEvents()
{
return refreshViewOnChangeEvents;
}
public Builder viewInvalidationAdvisor(@NonNull final IViewInvalidationAdvisor viewInvalidationAdvisor)
{
this.viewInvalidationAdvisor = viewInvalidationAdvisor;
return this;
} | private IViewInvalidationAdvisor getViewInvalidationAdvisor()
{
return viewInvalidationAdvisor;
}
public Builder applySecurityRestrictions(final boolean applySecurityRestrictions)
{
this.applySecurityRestrictions = applySecurityRestrictions;
return this;
}
private boolean isApplySecurityRestrictions()
{
return applySecurityRestrictions;
}
}
} | repos\metasfresh-new_dawn_uat\backend\de.metas.ui.web.base\src\main\java\de\metas\ui\web\view\DefaultView.java | 1 |
请在Spring Boot框架中完成以下Java代码 | public void configure(AuthorizationServerEndpointsConfigurer endpoints) throws Exception {
endpoints.tokenStore(jwtTokenStore()).accessTokenConverter(jwtAccessTokenConverter());
DefaultTokenServices tokenServices = (DefaultTokenServices) endpoints.getDefaultAuthorizationServerTokenServices();
tokenServices.setTokenStore(endpoints.getTokenStore());
tokenServices.setSupportRefreshToken(true);
tokenServices.setClientDetailsService(endpoints.getClientDetailsService());
tokenServices.setTokenEnhancer(endpoints.getTokenEnhancer());
tokenServices.setAccessTokenValiditySeconds((int) TimeUnit.DAYS.toSeconds(1)); // 一天有效期
endpoints.tokenServices(tokenServices);
}
@Override
public void configure(AuthorizationServerSecurityConfigurer security) throws Exception {
security.tokenKeyAccess("isAuthenticated()"); | }
@Bean
public TokenStore jwtTokenStore() {
return new JwtTokenStore(jwtAccessTokenConverter());
}
@Bean
public JwtAccessTokenConverter jwtAccessTokenConverter(){
JwtAccessTokenConverter converter = new JwtAccessTokenConverter();
converter.setSigningKey("testKey");
return converter;
}
} | repos\Spring-Boot-In-Action-master\springbt_sso_jwt\codesheep-server\src\main\java\cn\codesheep\config\AuthorizationServerConfig.java | 2 |
请完成以下Java代码 | public static class Person {
private String name;
private String address;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getAddress() {
return address;
}
public void setAddress(String address) {
this.address = address;
}
}
public String getHost() {
return host;
}
public void setHost(String host) {
this.host = host;
}
public int getPort() { | return port;
}
public void setPort(int port) {
this.port = port;
}
public boolean isResend() {
return resend;
}
public void setResend(boolean resend) {
this.resend = resend;
}
public Person getSender() {
return sender;
}
public void setSender(Person sender) {
this.sender = sender;
}
} | repos\tutorials-master\spring-boot-modules\spring-boot-properties-3\src\main\java\com\baeldung\properties\json\CustomJsonProperties.java | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.