instruction
string | input
string | output
string | source_file
string | priority
int64 |
|---|---|---|---|---|
请完成以下Java代码
|
public String toString()
{
StringBuffer sb = new StringBuffer ("X_GL_Budget[")
.append(get_ID()).append("]");
return sb.toString();
}
/** BudgetStatus AD_Reference_ID=178 */
public static final int BUDGETSTATUS_AD_Reference_ID=178;
/** Draft = D */
public static final String BUDGETSTATUS_Draft = "D";
/** Approved = A */
public static final String BUDGETSTATUS_Approved = "A";
/** Set Budget Status.
@param BudgetStatus
Indicates the current status of this budget
*/
public void setBudgetStatus (String BudgetStatus)
{
set_Value (COLUMNNAME_BudgetStatus, BudgetStatus);
}
/** Get Budget Status.
@return Indicates the current status of this budget
*/
public String getBudgetStatus ()
{
return (String)get_Value(COLUMNNAME_BudgetStatus);
}
/** 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 Budget.
@param GL_Budget_ID
General Ledger Budget
*/
public void setGL_Budget_ID (int GL_Budget_ID)
{
if (GL_Budget_ID < 1)
set_ValueNoCheck (COLUMNNAME_GL_Budget_ID, null);
else
set_ValueNoCheck (COLUMNNAME_GL_Budget_ID, Integer.valueOf(GL_Budget_ID));
}
/** Get Budget.
|
@return General Ledger Budget
*/
public int getGL_Budget_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_GL_Budget_ID);
if (ii == null)
return 0;
return ii.intValue();
}
/** Set Primary.
@param IsPrimary
Indicates if this is the primary budget
*/
public void setIsPrimary (boolean IsPrimary)
{
set_Value (COLUMNNAME_IsPrimary, Boolean.valueOf(IsPrimary));
}
/** Get Primary.
@return Indicates if this is the primary budget
*/
public boolean isPrimary ()
{
Object oo = get_Value(COLUMNNAME_IsPrimary);
if (oo != null)
{
if (oo instanceof Boolean)
return ((Boolean)oo).booleanValue();
return "Y".equals(oo);
}
return false;
}
/** 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_GL_Budget.java
| 1
|
请完成以下Java代码
|
public abstract class JobRetryCmd implements Command<Object> {
protected static final long serialVersionUID = 1L;
protected String jobId;
protected Throwable exception;
public JobRetryCmd(String jobId, Throwable exception) {
this.jobId = jobId;
this.exception = exception;
}
protected JobEntity getJob() {
return Context
.getCommandContext()
.getJobManager()
.findJobById(jobId);
}
protected void logException(JobEntity job) {
if(exception != null) {
job.setExceptionMessage(exception.getMessage());
job.setExceptionStacktrace(getExceptionStacktrace());
}
}
protected void decrementRetries(JobEntity job) {
if (exception == null || shouldDecrementRetriesFor(exception)) {
job.setRetries(job.getRetries() - 1);
}
}
|
protected String getExceptionStacktrace() {
return ExceptionUtil.getExceptionStacktrace(exception);
}
protected boolean shouldDecrementRetriesFor(Throwable t) {
return !(t instanceof OptimisticLockingException);
}
protected void notifyAcquisition(CommandContext commandContext) {
JobExecutor jobExecutor = Context.getProcessEngineConfiguration().getJobExecutor();
MessageAddedNotification messageAddedNotification = new MessageAddedNotification(jobExecutor);
TransactionContext transactionContext = commandContext.getTransactionContext();
transactionContext.addTransactionListener(TransactionState.COMMITTED, messageAddedNotification);
}
}
|
repos\camunda-bpm-platform-master\engine\src\main\java\org\camunda\bpm\engine\impl\cmd\JobRetryCmd.java
| 1
|
请完成以下Java代码
|
public PublicKeyCredentialRequestOptionsBuilder userVerification(UserVerificationRequirement userVerification) {
this.userVerification = userVerification;
return this;
}
/**
* Sets the {@link #getExtensions()} property
* @param extensions the extensions
* @return the {@link PublicKeyCredentialRequestOptionsBuilder}
*/
public PublicKeyCredentialRequestOptionsBuilder extensions(AuthenticationExtensionsClientInputs extensions) {
this.extensions = extensions;
return this;
}
/**
* Allows customizing the {@link PublicKeyCredentialRequestOptionsBuilder}
* @param customizer the {@link Consumer} used to customize the builder
* @return the {@link PublicKeyCredentialRequestOptionsBuilder}
*/
public PublicKeyCredentialRequestOptionsBuilder customize(
|
Consumer<PublicKeyCredentialRequestOptionsBuilder> customizer) {
customizer.accept(this);
return this;
}
/**
* Builds a new {@link PublicKeyCredentialRequestOptions}
* @return a new {@link PublicKeyCredentialRequestOptions}
*/
public PublicKeyCredentialRequestOptions build() {
if (this.challenge == null) {
this.challenge = Bytes.random();
}
return new PublicKeyCredentialRequestOptions(this.challenge, this.timeout, this.rpId, this.allowCredentials,
this.userVerification, this.extensions);
}
}
}
|
repos\spring-security-main\webauthn\src\main\java\org\springframework\security\web\webauthn\api\PublicKeyCredentialRequestOptions.java
| 1
|
请完成以下Java代码
|
private static boolean isLoopbackAddress(String host) {
if (!StringUtils.hasText(host)) {
return false;
}
// IPv6 loopback address should either be "0:0:0:0:0:0:0:1" or "::1"
if ("[0:0:0:0:0:0:0:1]".equals(host) || "[::1]".equals(host)) {
return true;
}
// IPv4 loopback address ranges from 127.0.0.1 to 127.255.255.255
String[] ipv4Octets = host.split("\\.");
if (ipv4Octets.length != 4) {
return false;
}
try {
int[] address = new int[ipv4Octets.length];
for (int i = 0; i < ipv4Octets.length; i++) {
address[i] = Integer.parseInt(ipv4Octets[i]);
}
return address[0] == 127 && address[1] >= 0 && address[1] <= 255 && address[2] >= 0 && address[2] <= 255
&& address[3] >= 1 && address[3] <= 255;
}
catch (NumberFormatException ex) {
return false;
}
}
private static void throwError(String errorCode, String parameterName,
OAuth2AuthorizationCodeRequestAuthenticationToken authorizationCodeRequestAuthentication,
RegisteredClient registeredClient) {
throwError(errorCode, parameterName, ERROR_URI, authorizationCodeRequestAuthentication, registeredClient);
}
private static void throwError(String errorCode, String parameterName, String errorUri,
OAuth2AuthorizationCodeRequestAuthenticationToken authorizationCodeRequestAuthentication,
RegisteredClient registeredClient) {
OAuth2Error error = new OAuth2Error(errorCode, "OAuth 2.0 Parameter: " + parameterName, errorUri);
throwError(error, parameterName, authorizationCodeRequestAuthentication, registeredClient);
}
private static void throwError(OAuth2Error error, String parameterName,
OAuth2AuthorizationCodeRequestAuthenticationToken authorizationCodeRequestAuthentication,
RegisteredClient registeredClient) {
String redirectUri = StringUtils.hasText(authorizationCodeRequestAuthentication.getRedirectUri())
|
? authorizationCodeRequestAuthentication.getRedirectUri()
: registeredClient.getRedirectUris().iterator().next();
if (error.getErrorCode().equals(OAuth2ErrorCodes.INVALID_REQUEST)
&& parameterName.equals(OAuth2ParameterNames.REDIRECT_URI)) {
redirectUri = null; // Prevent redirects
}
OAuth2AuthorizationCodeRequestAuthenticationToken authorizationCodeRequestAuthenticationResult = new OAuth2AuthorizationCodeRequestAuthenticationToken(
authorizationCodeRequestAuthentication.getAuthorizationUri(),
authorizationCodeRequestAuthentication.getClientId(),
(Authentication) authorizationCodeRequestAuthentication.getPrincipal(), redirectUri,
authorizationCodeRequestAuthentication.getState(), authorizationCodeRequestAuthentication.getScopes(),
authorizationCodeRequestAuthentication.getAdditionalParameters());
authorizationCodeRequestAuthenticationResult.setAuthenticated(true);
throw new OAuth2AuthorizationCodeRequestAuthenticationException(error,
authorizationCodeRequestAuthenticationResult);
}
}
|
repos\spring-security-main\oauth2\oauth2-authorization-server\src\main\java\org\springframework\security\oauth2\server\authorization\authentication\OAuth2AuthorizationCodeRequestAuthenticationValidator.java
| 1
|
请完成以下Java代码
|
public boolean onSent(R request) {
client.lock();
try {
UUID rpcId = new UUID(this.request.getRequestIdMSB(), this.request.getRequestIdLSB());
if (rpcId.equals(client.getLastSentRpcId())) {
log.debug("[{}]][{}] Rpc has already sent!", client.getEndpoint(), rpcId);
return false;
}
client.setLastSentRpcId(rpcId);
} finally {
client.unlock();
}
transportService.process(client.getSession(), this.request, RpcStatus.SENT, TransportServiceCallback.EMPTY);
return true;
}
@Override
public void onSuccess(R request, T response) {
transportService.process(client.getSession(), this.request, RpcStatus.DELIVERED, true, TransportServiceCallback.EMPTY);
sendRpcReplyOnSuccess(response);
if (callback != null) {
callback.onSuccess(request, response);
}
}
@Override
public void onValidationError(String params, String msg) {
sendRpcReplyOnValidationError(msg);
if (callback != null) {
callback.onValidationError(params, msg);
}
}
@Override
public void onError(String params, Exception e) {
if (e instanceof TimeoutException || e instanceof org.eclipse.leshan.core.request.exception.TimeoutException) {
client.setLastSentRpcId(null);
transportService.process(client.getSession(), this.request, RpcStatus.TIMEOUT, TransportServiceCallback.EMPTY);
} else if (!(e instanceof ClientSleepingException)) {
sendRpcReplyOnError(e);
}
if (callback != null) {
callback.onError(params, e);
}
}
|
protected void reply(LwM2MRpcResponseBody response) {
TransportProtos.ToDeviceRpcResponseMsg.Builder msg = TransportProtos.ToDeviceRpcResponseMsg.newBuilder().setRequestId(request.getRequestId());
String responseAsString = JacksonUtil.toString(response);
if (StringUtils.isEmpty(response.getError())) {
msg.setPayload(responseAsString);
} else {
msg.setError(responseAsString);
}
transportService.process(client.getSession(), msg.build(), null);
}
abstract protected void sendRpcReplyOnSuccess(T response);
protected void sendRpcReplyOnValidationError(String msg) {
reply(LwM2MRpcResponseBody.builder().result(ResponseCode.BAD_REQUEST.getName()).error(msg).build());
}
protected void sendRpcReplyOnError(Exception e) {
String error = e.getMessage();
if (error == null) {
error = e.toString();
}
reply(LwM2MRpcResponseBody.builder().result(ResponseCode.INTERNAL_SERVER_ERROR.getName()).error(error).build());
}
}
|
repos\thingsboard-master\common\transport\lwm2m\src\main\java\org\thingsboard\server\transport\lwm2m\server\rpc\RpcDownlinkRequestCallbackProxy.java
| 1
|
请完成以下Java代码
|
public static class InstanceResponse {
private final InstanceId instanceId;
private final int status;
@Nullable
@JsonInclude(JsonInclude.Include.NON_EMPTY)
private final String body;
@Nullable
@JsonInclude(JsonInclude.Include.NON_EMPTY)
private final String contentType;
}
|
@lombok.Data
@lombok.Builder(builderClassName = "Builder")
public static class ForwardRequest {
private final URI uri;
private final HttpMethod method;
private final HttpHeaders headers;
private final BodyInserter<?, ? super ClientHttpRequest> body;
}
}
|
repos\spring-boot-admin-master\spring-boot-admin-server\src\main\java\de\codecentric\boot\admin\server\web\InstanceWebProxy.java
| 1
|
请完成以下Java代码
|
public class LocalizedException extends Exception {
private static final long serialVersionUID = 1L;
private final String messageKey;
private final Locale locale;
public LocalizedException(String messageKey) {
this(messageKey, Locale.getDefault());
}
public LocalizedException(String messageKey, Locale locale) {
this.messageKey = messageKey;
this.locale = locale;
}
/**
* @return a localized message based on the messageKey provided at instantiation.
*/
public String getMessage() {
|
/*
* This is a deliberate role reversal of the default implementation of getLocalizedMessage.
* some logging frameworks like Log4J 1 & 2 and Logback will use getMessage instead of
* getLocalizedMessage when logging Throwables. If we want to use these frameworks in client
* applications to log localized messages, then we'll need to override getMessage in a
* similar fashion to return the appropriate content. Or, you can call getLocalizedMessage
* on your own to create the log content.
*/
return getLocalizedMessage();
}
/**
* @return a localized message based on the messageKey provided at instantiation.
*/
public String getLocalizedMessage() {
/*
* java.util.logging uses getLocalizedMessage when logging Throwables.
*/
return Messages.getMessageForLocale(messageKey, locale);
}
}
|
repos\tutorials-master\core-java-modules\core-java-exceptions-3\src\main\java\com\baeldung\exceptions\localization\LocalizedException.java
| 1
|
请完成以下Java代码
|
public void setLetterBody (java.lang.String LetterBody)
{
set_Value (COLUMNNAME_LetterBody, LetterBody);
}
/** Get Body.
@return Body */
@Override
public java.lang.String getLetterBody ()
{
return (java.lang.String)get_Value(COLUMNNAME_LetterBody);
}
/** Set Body (parsed).
@param LetterBodyParsed Body (parsed) */
@Override
public void setLetterBodyParsed (java.lang.String LetterBodyParsed)
{
set_Value (COLUMNNAME_LetterBodyParsed, LetterBodyParsed);
}
/** Get Body (parsed).
@return Body (parsed) */
@Override
public java.lang.String getLetterBodyParsed ()
{
return (java.lang.String)get_Value(COLUMNNAME_LetterBodyParsed);
}
/** Set Subject.
@param LetterSubject Subject */
@Override
public void setLetterSubject (java.lang.String LetterSubject)
{
set_Value (COLUMNNAME_LetterSubject, LetterSubject);
|
}
/** Get Subject.
@return Subject */
@Override
public java.lang.String getLetterSubject ()
{
return (java.lang.String)get_Value(COLUMNNAME_LetterSubject);
}
/** Set Datensatz-ID.
@param Record_ID
Direct internal record ID
*/
@Override
public void setRecord_ID (int Record_ID)
{
if (Record_ID < 0)
set_ValueNoCheck (COLUMNNAME_Record_ID, null);
else
set_ValueNoCheck (COLUMNNAME_Record_ID, Integer.valueOf(Record_ID));
}
/** Get Datensatz-ID.
@return Direct internal record ID
*/
@Override
public int getRecord_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_Record_ID);
if (ii == null)
return 0;
return ii.intValue();
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.swat\de.metas.swat.base\src\main\java-gen\de\metas\letters\model\X_C_Letter.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public void setSuperProcessInstanceId(String superProcessInstanceId) {
this.superProcessInstanceId = superProcessInstanceId;
}
public List<RestVariable> getVariables() {
return variables;
}
public void setVariables(List<RestVariable> variables) {
this.variables = variables;
}
public void addVariable(RestVariable variable) {
variables.add(variable);
}
@ApiModelProperty(example = "null")
public void setTenantId(String tenantId) {
this.tenantId = tenantId;
}
public String getTenantId() {
return tenantId;
}
@ApiModelProperty(example = "active")
public String getState() {
return state;
}
public void setState(String state) {
this.state = state;
}
@ApiModelProperty(example = "123")
public String getCallbackId() {
return callbackId;
}
|
public void setCallbackId(String callbackId) {
this.callbackId = callbackId;
}
@ApiModelProperty(example = "cmmn-1.1-to-cmmn-1.1-child-case")
public String getCallbackType() {
return callbackType;
}
public void setCallbackType(String callbackType) {
this.callbackType = callbackType;
}
@ApiModelProperty(example = "123")
public String getReferenceId() {
return referenceId;
}
public void setReferenceId(String referenceId) {
this.referenceId = referenceId;
}
@ApiModelProperty(example = "event-to-cmmn-1.1-case")
public String getReferenceType() {
return referenceType;
}
public void setReferenceType(String referenceType) {
this.referenceType = referenceType;
}
}
|
repos\flowable-engine-main\modules\flowable-cmmn-rest\src\main\java\org\flowable\cmmn\rest\service\api\history\caze\HistoricCaseInstanceResponse.java
| 2
|
请完成以下Java代码
|
public final class AuthorizeReturnObjectDataHintsRegistrar implements SecurityHintsRegistrar {
private final AuthorizationProxyFactory proxyFactory;
private final SecurityAnnotationScanner<AuthorizeReturnObject> scanner = SecurityAnnotationScanners
.requireUnique(AuthorizeReturnObject.class);
private final Set<Class<?>> visitedClasses = new HashSet<>();
public AuthorizeReturnObjectDataHintsRegistrar(AuthorizationProxyFactory proxyFactory) {
this.proxyFactory = proxyFactory;
}
@Override
public void registerHints(RuntimeHints hints, ConfigurableListableBeanFactory beanFactory) {
List<Class<?>> toProxy = new ArrayList<>();
for (String name : beanFactory.getBeanDefinitionNames()) {
ResolvableType type = beanFactory.getBeanDefinition(name).getResolvableType();
if (!RepositoryFactoryBeanSupport.class.isAssignableFrom(type.toClass())) {
continue;
}
Class<?>[] generics = type.resolveGenerics();
Class<?> entity = generics[1];
AuthorizeReturnObject authorize = beanFactory.findAnnotationOnBean(name, AuthorizeReturnObject.class);
if (authorize != null) {
toProxy.add(entity);
|
continue;
}
Class<?> repository = generics[0];
for (Method method : repository.getDeclaredMethods()) {
AuthorizeReturnObject returnObject = this.scanner.scan(method, repository);
if (returnObject == null) {
continue;
}
// optimistically assume that the entity needs wrapping if any of the
// repository methods use @AuthorizeReturnObject
toProxy.add(entity);
break;
}
}
new AuthorizeReturnObjectHintsRegistrar(this.proxyFactory, toProxy).registerHints(hints, beanFactory);
}
}
|
repos\spring-security-main\data\src\main\java\org\springframework\security\data\aot\hint\AuthorizeReturnObjectDataHintsRegistrar.java
| 1
|
请完成以下Java代码
|
public static void compressFile(Path file, Path destination) throws IOException, CompressorException {
String format = FileNameUtils.getExtension(destination);
try (OutputStream out = Files.newOutputStream(destination);
BufferedOutputStream buffer = new BufferedOutputStream(out);
CompressorOutputStream compressor = new CompressorStreamFactory().createCompressorOutputStream(format, buffer)) {
IOUtils.copy(Files.newInputStream(file), compressor);
}
}
public static void zip(Path file, Path destination) throws IOException {
try (InputStream input = Files.newInputStream(file);
OutputStream output = Files.newOutputStream(destination);
ZipArchiveOutputStream archive = new ZipArchiveOutputStream(output)) {
archive.setLevel(Deflater.BEST_COMPRESSION);
archive.setMethod(ZipEntry.DEFLATED);
archive.putArchiveEntry(new ZipArchiveEntry(file.getFileName()
.toString()));
IOUtils.copy(input, archive);
archive.closeArchiveEntry();
}
}
public static void extractOne(Path archivePath, String fileName, Path destinationDirectory) throws IOException, ArchiveException {
try (InputStream input = Files.newInputStream(archivePath);
|
BufferedInputStream buffer = new BufferedInputStream(input);
ArchiveInputStream<?> archive = new ArchiveStreamFactory().createArchiveInputStream(buffer)) {
ArchiveEntry entry;
while ((entry = archive.getNextEntry()) != null) {
if (entry.getName()
.equals(fileName)) {
Path outFile = destinationDirectory.resolve(fileName);
Files.createDirectories(outFile.getParent());
try (OutputStream os = Files.newOutputStream(outFile)) {
IOUtils.copy(archive, os);
}
break;
}
}
}
}
}
|
repos\tutorials-master\libraries-apache-commons-2\src\main\java\com\baeldung\commons\compress\CompressUtils.java
| 1
|
请完成以下Java代码
|
public ImmutableList<InOutId> retrieveShipmentsWithoutShipperTransportation(@NonNull final Timestamp date)
{
return queryBL
.createQueryBuilder(de.metas.inout.model.I_M_InOut.class)
.addOnlyActiveRecordsFilter()
.addEqualsFilter(I_M_InOut.COLUMNNAME_MovementDate, date)
.addEqualsFilter(I_M_InOut.COLUMNNAME_IsSOTrx, true)
.addEqualsFilter(de.metas.inout.model.I_M_InOut.COLUMNNAME_M_ShipperTransportation, null)
.create()
.idsAsSet(InOutId::ofRepoId)
.asList();
}
@Override
public Stream<I_M_InOut> retrieveByQuery(@NonNull final InOutQuery query)
{
return toSqlQuery(query).create().stream();
}
private IQueryBuilder<I_M_InOut> toSqlQuery(@NonNull final InOutQuery query)
{
final IQueryBuilder<I_M_InOut> sqlQueryBuilder = queryBL.createQueryBuilder(I_M_InOut.class)
.setLimit(query.getLimit())
.addOnlyActiveRecordsFilter();
if (query.getMovementDateFrom() != null)
{
sqlQueryBuilder.addCompareFilter(I_M_InOut.COLUMNNAME_MovementDate, Operator.GREATER_OR_EQUAL, query.getMovementDateFrom());
|
}
if (query.getMovementDateTo() != null)
{
sqlQueryBuilder.addCompareFilter(I_M_InOut.COLUMNNAME_MovementDate, Operator.LESS_OR_EQUAL, query.getMovementDateTo());
}
if (query.getDocStatus() != null)
{
sqlQueryBuilder.addEqualsFilter(I_M_InOut.COLUMNNAME_DocStatus, query.getDocStatus());
}
if (query.getExcludeDocStatuses() != null && !query.getExcludeDocStatuses().isEmpty())
{
sqlQueryBuilder.addNotInArrayFilter(I_M_InOut.COLUMNNAME_DocStatus, query.getExcludeDocStatuses());
}
if (!query.getOrderIds().isEmpty())
{
sqlQueryBuilder.addInArrayFilter(I_M_InOut.COLUMNNAME_C_Order_ID, query.getOrderIds());
}
return sqlQueryBuilder;
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.business\src\main\java\de\metas\inout\impl\InOutDAO.java
| 1
|
请完成以下Java代码
|
public int getM_Material_Tracking_Report_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_M_Material_Tracking_Report_ID);
if (ii == null)
return 0;
return ii.intValue();
}
/** Set Verarbeitet.
@param Processed
Checkbox sagt aus, ob der Beleg verarbeitet wurde.
*/
@Override
public void setProcessed (boolean Processed)
{
set_Value (COLUMNNAME_Processed, Boolean.valueOf(Processed));
}
/** Get Verarbeitet.
|
@return Checkbox sagt aus, ob der Beleg verarbeitet wurde.
*/
@Override
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.materialtracking\src\main\java-gen\de\metas\materialtracking\ch\lagerkonf\model\X_M_Material_Tracking_Report.java
| 1
|
请完成以下Java代码
|
public class Person extends LdapUserDetailsImpl {
private static final long serialVersionUID = 620L;
private String givenName;
private String sn;
private String description;
private String telephoneNumber;
private List<String> cn = new ArrayList<>();
protected Person() {
}
public String getGivenName() {
return this.givenName;
}
public String getSn() {
return this.sn;
}
public String[] getCn() {
return this.cn.toArray(new String[0]);
}
public String getDescription() {
return this.description;
}
public String getTelephoneNumber() {
return this.telephoneNumber;
}
protected void populateContext(DirContextAdapter adapter) {
adapter.setAttributeValue("givenName", this.givenName);
adapter.setAttributeValue("sn", this.sn);
adapter.setAttributeValues("cn", getCn());
adapter.setAttributeValue("description", getDescription());
adapter.setAttributeValue("telephoneNumber", getTelephoneNumber());
if (getPassword() != null) {
adapter.setAttributeValue("userPassword", getPassword());
}
adapter.setAttributeValues("objectclass", new String[] { "top", "person" });
}
public static class Essence extends LdapUserDetailsImpl.Essence {
public Essence() {
}
public Essence(DirContextOperations ctx) {
super(ctx);
setCn(ctx.getStringAttributes("cn"));
setGivenName(ctx.getStringAttribute("givenName"));
setSn(ctx.getStringAttribute("sn"));
setDescription(ctx.getStringAttribute("description"));
setTelephoneNumber(ctx.getStringAttribute("telephoneNumber"));
Object password = ctx.getObjectAttribute("userPassword");
if (password != null) {
setPassword(LdapUtils.convertPasswordToString(password));
}
}
public Essence(Person copyMe) {
super(copyMe);
setGivenName(copyMe.givenName);
setSn(copyMe.sn);
setDescription(copyMe.getDescription());
|
setTelephoneNumber(copyMe.getTelephoneNumber());
((Person) this.instance).cn = new ArrayList<>(copyMe.cn);
}
@Override
protected LdapUserDetailsImpl createTarget() {
return new Person();
}
public void setGivenName(String givenName) {
((Person) this.instance).givenName = givenName;
}
public void setSn(String sn) {
((Person) this.instance).sn = sn;
}
public void setCn(String[] cn) {
((Person) this.instance).cn = Arrays.asList(cn);
}
public void addCn(String value) {
((Person) this.instance).cn.add(value);
}
public void setTelephoneNumber(String tel) {
((Person) this.instance).telephoneNumber = tel;
}
public void setDescription(String desc) {
((Person) this.instance).description = desc;
}
@Override
public LdapUserDetails createUserDetails() {
Person p = (Person) super.createUserDetails();
Assert.notNull(p.cn, "person.sn cannot be null");
Assert.notEmpty(p.cn, "person.cn cannot be empty");
// TODO: Check contents for null entries
return p;
}
}
}
|
repos\spring-security-main\ldap\src\main\java\org\springframework\security\ldap\userdetails\Person.java
| 1
|
请完成以下Java代码
|
public boolean accept(final T model)
{
throw new UnsupportedOperationException();
}
@Override
public String getSql()
{
final IValidationRuleFactory validationRuleFactory = Services.get(IValidationRuleFactory.class);
final IValidationContext evalCtx = validationRuleFactory.createValidationContext(evaluatee);
final IValidationRule valRule = validationRuleFactory.create(
tableName,
adValRuleId,
null, // ctx table name
null // ctx column name
);
final IStringExpression prefilterWhereClauseExpr = valRule.getPrefilterWhereClause();
final String prefilterWhereClause = prefilterWhereClauseExpr.evaluate(evalCtx, OnVariableNotFound.ReturnNoResult);
if (prefilterWhereClauseExpr.isNoResult(prefilterWhereClause))
|
{
final String prefilterWhereClauseDefault = "1=0";
logger.warn("Cannot evaluate {} using {}. Returning {}.", prefilterWhereClauseExpr, evalCtx, prefilterWhereClauseDefault);
return prefilterWhereClauseDefault;
}
return prefilterWhereClause;
}
@Override
public List<Object> getSqlParams(final Properties ctx)
{
return Collections.emptyList();
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\org\adempiere\ad\dao\impl\ValidationRuleQueryFilter.java
| 1
|
请完成以下Java代码
|
public Object invoke(final Object self, final Method thisMethod, final Method proceed, final Object[] methodArgs) throws Throwable
{
@SuppressWarnings("unchecked")
final T serviceInstance = (T)self;
return invokeForJavassist0(interceptorInstance, serviceInstance, thisMethod, proceed, methodArgs);
}
};
// check out the deprecation notice.
// also note that we don't need the caching that badly since we are intercepting singletons, and that right now we have all the setup in this method (ofc we can retain that advantage, but it's more effort).
// for now I think if is OK this way. If we change it, we should at any rate make sure to still keep the interceptor's code localized in this class.
factory.setHandler(handler);
@SuppressWarnings("unchecked")
final Class<T> serviceInstanceInterceptedClass = (Class<T>) factory.createClass();
return serviceInstanceInterceptedClass;
}
// there were no registered interceptors
return serviceInstanceClass;
}
catch (Exception e)
{
throw ServicesException.wrapIfNeeded(e);
}
}
/**
|
* Called when there we got an error/warning while creating the intercepted class.
*
* @param ex
*/
private final void onException(final ServicesException ex)
{
if (FAIL_ON_ERROR)
{
throw ex;
}
else
{
ex.printStackTrace(System.err);
}
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.util\src\main\java\org\adempiere\util\proxy\impl\JavaAssistInterceptor.java
| 1
|
请完成以下Java代码
|
public void addStockRecord(@NonNull final I_MD_Stock stockRecord)
{
final I_C_UOM uom = cache.getUomByProductId(ProductId.ofRepoId(stockRecord.getM_Product_ID()));
qtyOnHandStock = addToNullable(qtyOnHandStock, stockRecord.getQtyOnHand(), uom);
stockRecordIds.add(stockRecord.getMD_Stock_ID());
}
public MaterialCockpitRow createIncludedRow(@NonNull final MainRowWithSubRows mainRowBucket)
{
final MainRowBucketId productIdAndDate = assumeNotNull(
mainRowBucket.getProductIdAndDate(),
"productIdAndDate may not be null; mainRowBucket={}", mainRowBucket);
return MaterialCockpitRow.attributeSubRowBuilder()
.cache(cache)
.lookups(rowLookups)
.date(productIdAndDate.getDate())
.productId(productIdAndDate.getProductId().getRepoId())
.dimensionGroup(dimensionSpecGroup)
|
.pmmQtyPromisedAtDate(getPmmQtyPromisedAtDate())
.qtyMaterialentnahmeAtDate(getQtyMaterialentnahmeAtDate())
.qtyDemandPPOrderAtDate(getQtyDemandPPOrderAtDate())
.qtySupplyPurchaseOrderAtDate(getQtySupplyPurchaseOrderAtDate())
.qtySupplyPurchaseOrder(getQtySupplyPurchaseOrder())
.qtyDemandSalesOrderAtDate(getQtyDemandSalesOrderAtDate())
.qtyDemandSalesOrder(getQtyDemandSalesOrder())
.qtyDemandDDOrderAtDate(getQtyDemandDDOrderAtDate())
.qtyDemandSumAtDate(getQtyDemandSumAtDate())
.qtySupplyPPOrderAtDate(getQtySupplyPPOrderAtDate())
.qtySupplyDDOrderAtDate(getQtySupplyDDOrderAtDate())
.qtySupplySumAtDate(getQtySupplySumAtDate())
.qtySupplyRequiredAtDate(getQtySupplyRequiredAtDate())
.qtySupplyToScheduleAtDate(getQtySupplyToScheduleAtDate())
.qtyOnHandStock(getQtyOnHandStock())
.qtyExpectedSurplusAtDate(getQtyExpectedSurplusAtDate())
.allIncludedCockpitRecordIds(cockpitRecordIds)
.allIncludedStockRecordIds(stockRecordIds)
.qtyConvertor(qtyConvertorService.getQtyConvertorIfConfigured(productIdAndDate))
.build();
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.ui.web.base\src\main\java\de\metas\ui\web\material\cockpit\rowfactory\DimensionGroupSubRowBucket.java
| 1
|
请完成以下Java代码
|
private static void unlockAllNoFail(final List<Lock> locks)
{
if (locks.isEmpty())
{
return;
}
for (final Lock lock : locks)
{
if (lock.isClosed())
{
continue;
}
try
{
lock.unlockAll();
}
catch (Exception ex)
{
logger.warn("Failed to unlock {}. Ignored", lock, ex);
}
}
}
@Override
public boolean isClosed()
{
return closed.get();
}
@Override
public void close()
{
// If it was already closed, do nothing (method contract).
if (isClosed())
|
{
return;
}
unlockAll();
}
private void assertHasRealOwner()
{
final LockOwner owner = getOwner();
Check.assume(owner.isRealOwner(), "lock {} shall have an owner", this);
}
@Override
public ILockAutoCloseable asAutoCloseable()
{
return new LockAutoCloseable(this);
}
@Override
public ILockAutoCloseable asAutocloseableOnTrxClose(final String trxName)
{
return new LockAutoCloseableOnTrxClose(this, trxName);
}
@Override
public boolean isLocked(final Object model)
{
final int adTableId = InterfaceWrapperHelper.getModelTableId(model);
final int recordId = InterfaceWrapperHelper.getId(model);
return getLockDatabase().isLocked(adTableId, recordId, getOwner());
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.async\src\main\java\de\metas\lock\api\impl\Lock.java
| 1
|
请完成以下Java代码
|
public String getTarget() {
return target;
}
/**
* Sets the value of the target property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setTarget(String value) {
this.target = value;
}
/**
* Gets the value of the id property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getId() {
return id;
}
/**
* Sets the value of the id property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setId(String value) {
this.id = value;
|
}
/**
* Gets a map that contains attributes that aren't bound to any typed property on this class.
*
* <p>
* the map is keyed by the name of the attribute and
* the value is the string value of the attribute.
*
* the map returned by this method is live, and you can add new attribute
* by updating the map directly. Because of this design, there's no setter.
*
*
* @return
* always non-null
*/
public Map<QName, String> getOtherAttributes() {
return otherAttributes;
}
}
|
repos\metasfresh-new_dawn_uat\backend\vertical-healthcare_ch\forum_datenaustausch_ch.invoice_440_request\src\main\java-xjc\de\metas\vertical\healthcare_ch\forum_datenaustausch_ch\invoice_440\request\EncryptionPropertyType.java
| 1
|
请完成以下Java代码
|
public final class UUIDs
{
public static int toId(final UUID uuid)
{
// System.out.println("toId: " + uuid + "====================================");
if (uuid.version() != 3)
{
throw new RuntimeException("not valid uuid: " + uuid + ": version != 3");
}
final long msb = uuid.getMostSignificantBits();
// System.out.println("msb=" + toByteString(msb));
// System.out.println("lsb=" + toByteString(uuid.getLeastSignificantBits()));
long id = msb & 0xFFFF0000;
// System.out.println(" id=" + toByteString(id) + " = " + id);
id = id >> 8 * 4;
// System.out.println(" id=" + toByteString(id) + " = " + id);
return (int)id;
}
public static UUID fromId(final int id)
{
final byte[] data = ByteBuffer.allocate(16).putInt(id).array();
// System.out.println("data=" + toString(data));
data[6] &= 0x0f; /* clear version */
data[6] |= 0x30; /* set to version 3 */
data[8] &= 0x3f; /* clear variant */
data[8] |= 0x80; /* set to IETF variant */
// System.out.println("data=" + toString(data));
long msb = 0;
long lsb = 0;
for (int i = 0; i < 8; i++)
{
msb = msb << 8 | data[i] & 0xff;
}
for (int i = 8; i < 16; i++)
{
lsb = lsb << 8 | data[i] & 0xff;
}
// System.out.println("msb=" + msb);
// System.out.println("lsb=" + lsb);
return new UUID(msb, lsb);
}
public static String fromIdAsString(final int id)
{
return fromId(id).toString();
}
public static int toId(final String uuid)
{
if (uuid == null || uuid.trim().isEmpty())
{
return -1;
}
return toId(UUID.fromString(uuid));
}
|
private static final String toString(byte[] data)
{
StringBuilder sb = new StringBuilder();
for (final byte b : data)
{
if (sb.length() > 0)
{
sb.append(", ");
}
sb.append(b);
}
return sb
.insert(0, "[" + data.length + "] ")
.toString();
}
@SuppressWarnings("unused")
private static final String toByteString(final long data)
{
final byte[] dataBytes = ByteBuffer.allocate(8).putLong(data).array();
return toString(dataBytes);
}
private UUIDs()
{
super();
}
}
|
repos\metasfresh-new_dawn_uat\misc\de-metas-common\de-metas-common-procurement\src\main\java\de\metas\common\procurement\sync\util\UUIDs.java
| 1
|
请完成以下Java代码
|
public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
if (SpringBeanHolder.applicationContext != null) {
log.warn("SpringContextHolder中的ApplicationContext被覆盖, 原有ApplicationContext为:" + SpringBeanHolder.applicationContext);
}
SpringBeanHolder.applicationContext = applicationContext;
if (addCallback) {
for (SpringBeanHolder.CallBack callBack : SpringBeanHolder.CALL_BACKS) {
callBack.executor();
}
CALL_BACKS.clear();
}
SpringBeanHolder.addCallback = false;
}
/**
* 获取 @Service 的所有 bean 名称
* @return /
*/
public static List<String> getAllServiceBeanName() {
return new ArrayList<>(Arrays.asList(applicationContext
.getBeanNamesForAnnotation(Service.class)));
}
interface CallBack {
|
/**
* 回调执行方法
*/
void executor();
/**
* 本回调任务名称
* @return /
*/
default String getCallBackName() {
return Thread.currentThread().getId() + ":" + this.getClass().getName();
}
}
}
|
repos\eladmin-master\eladmin-common\src\main\java\me\zhengjie\utils\SpringBeanHolder.java
| 1
|
请完成以下Java代码
|
private boolean schemaBreakMatches(
final PricingConditionsBreak schemaBreak,
final BigDecimal breakValue,
final PricingConditionsBreakQuery query)
{
final PricingConditionsBreakMatchCriteria matchCriteria = schemaBreak.getMatchCriteria();
return matchCriteria.breakValueMatches(breakValue)
&& matchCriteria.productMatches(query.getProduct())
&& matchCriteria.attributeMatches(query.getAttributes());
}
private BigDecimal extractBreakValue(final PricingConditionsBreakQuery query)
{
if (!isBreaksDiscountType())
{
throw new AdempiereException("DiscountType shall be Breaks: " + this);
}
else if (breakValueType == BreakValueType.QUANTITY)
{
return query.getQty();
}
else if (breakValueType == BreakValueType.AMOUNT)
{
return query.getAmt();
}
else if (breakValueType == BreakValueType.ATTRIBUTE)
{
final ImmutableAttributeSet attributes = query.getAttributes();
if (attributes.hasAttribute(breakAttributeId))
{
return attributes.getValueAsBigDecimal(breakAttributeId);
}
else
{
return null;
}
}
else
{
throw new AdempiereException("Unknown break value type: " + breakValueType);
}
|
}
public Stream<PricingConditionsBreak> streamBreaksMatchingAnyOfProducts(final Set<ProductAndCategoryAndManufacturerId> products)
{
Check.assumeNotEmpty(products, "products is not empty");
return getBreaks()
.stream()
.filter(schemaBreak -> schemaBreak.getMatchCriteria().productMatchesAnyOf(products));
}
public PricingConditionsBreak getBreakById(@NonNull final PricingConditionsBreakId breakId)
{
PricingConditionsBreakId.assertMatching(getId(), breakId);
return getBreaks()
.stream()
.filter(schemaBreak -> breakId.equals(schemaBreak.getId()))
.findFirst()
.orElseThrow(() -> new AdempiereException("No break found for " + breakId + " in " + this));
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.business\src\main\java\de\metas\pricing\conditions\PricingConditions.java
| 1
|
请完成以下Java代码
|
public String getEncodedData() {
return Optional.ofNullable(data)
.map(Base64.getEncoder()::encodeToString)
.orElse(null);
}
@JsonSetter("data")
public void setEncodedData(String data) {
this.data = Optional.ofNullable(data)
.map(Base64.getDecoder()::decode)
.orElse(null);
}
@JsonGetter("preview")
public String getEncodedPreview() {
return Optional.ofNullable(preview)
.map(Base64.getEncoder()::encodeToString)
.orElse(null);
}
@JsonSetter("preview")
public void setEncodedPreview(String preview) {
|
this.preview = Optional.ofNullable(preview)
.map(Base64.getDecoder()::decode)
.orElse(null);
}
@JsonIgnore
public TbResourceDataInfo toResourceDataInfo() {
return new TbResourceDataInfo(data, getDescriptor());
}
@Override
public String toString() {
return super.toString();
}
}
|
repos\thingsboard-master\common\data\src\main\java\org\thingsboard\server\common\data\TbResource.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
static class CacheManagerValidator implements InitializingBean {
private final CacheProperties cacheProperties;
private final ObjectProvider<CacheManager> cacheManager;
CacheManagerValidator(CacheProperties cacheProperties, ObjectProvider<CacheManager> cacheManager) {
this.cacheProperties = cacheProperties;
this.cacheManager = cacheManager;
}
@Override
public void afterPropertiesSet() {
Assert.state(this.cacheManager.getIfAvailable() != null,
() -> "No cache manager could be auto-configured, check your configuration (caching type is '"
+ this.cacheProperties.getType() + "')");
}
}
/**
* {@link ImportSelector} to add {@link CacheType} configuration classes.
|
*/
static class CacheConfigurationImportSelector implements ImportSelector {
@Override
public String[] selectImports(AnnotationMetadata importingClassMetadata) {
CacheType[] types = CacheType.values();
String[] imports = new String[types.length];
for (int i = 0; i < types.length; i++) {
imports[i] = CacheConfigurations.getConfigurationClass(types[i]);
}
return imports;
}
}
}
|
repos\spring-boot-4.0.1\module\spring-boot-cache\src\main\java\org\springframework\boot\cache\autoconfigure\CacheAutoConfiguration.java
| 2
|
请完成以下Java代码
|
public void setTenantIdIn(List<String> tenantIds) {
this.tenantIds = tenantIds;
}
@CamundaQueryParam(value = "withoutTenantId", converter = BooleanConverter.class)
public void setWithoutTenantId(Boolean withoutTenantId) {
this.withoutTenantId = withoutTenantId;
}
@CamundaQueryParam(value = "includeJobDefinitionsWithoutTenantId", converter = BooleanConverter.class)
public void setIncludeJobDefinitionsWithoutTenantId(Boolean includeJobDefinitionsWithoutTenantId) {
this.includeJobDefinitionsWithoutTenantId = includeJobDefinitionsWithoutTenantId;
}
@Override
protected boolean isValidSortByValue(String value) {
return VALID_SORT_BY_VALUES.contains(value);
}
@Override
protected JobDefinitionQuery createNewQuery(ProcessEngine engine) {
return engine.getManagementService().createJobDefinitionQuery();
}
@Override
protected void applyFilters(JobDefinitionQuery query) {
if (jobDefinitionId != null) {
query.jobDefinitionId(jobDefinitionId);
}
if (activityIdIn != null && activityIdIn.length > 0) {
query.activityIdIn(activityIdIn);
}
if (processDefinitionId != null) {
query.processDefinitionId(processDefinitionId);
}
if (processDefinitionKey != null) {
query.processDefinitionKey(processDefinitionKey);
}
if (jobType != null) {
query.jobType(jobType);
}
if (jobConfiguration != null) {
query.jobConfiguration(jobConfiguration);
}
|
if (TRUE.equals(active)) {
query.active();
}
if (TRUE.equals(suspended)) {
query.suspended();
}
if (TRUE.equals(withOverridingJobPriority)) {
query.withOverridingJobPriority();
}
if (tenantIds != null && !tenantIds.isEmpty()) {
query.tenantIdIn(tenantIds.toArray(new String[tenantIds.size()]));
}
if (TRUE.equals(withoutTenantId)) {
query.withoutTenantId();
}
if (TRUE.equals(includeJobDefinitionsWithoutTenantId)) {
query.includeJobDefinitionsWithoutTenantId();
}
}
@Override
protected void applySortBy(JobDefinitionQuery query, String sortBy, Map<String, Object> parameters, ProcessEngine engine) {
if (sortBy.equals(SORT_BY_JOB_DEFINITION_ID)) {
query.orderByJobDefinitionId();
} else if (sortBy.equals(SORT_BY_ACTIVITY_ID)) {
query.orderByActivityId();
} else if (sortBy.equals(SORT_BY_PROCESS_DEFINITION_ID)) {
query.orderByProcessDefinitionId();
} else if (sortBy.equals(SORT_BY_PROCESS_DEFINITION_KEY)) {
query.orderByProcessDefinitionKey();
} else if (sortBy.equals(SORT_BY_JOB_TYPE)) {
query.orderByJobType();
} else if (sortBy.equals(SORT_BY_JOB_CONFIGURATION)) {
query.orderByJobConfiguration();
} else if (sortBy.equals(SORT_BY_TENANT_ID)) {
query.orderByTenantId();
}
}
}
|
repos\camunda-bpm-platform-master\engine-rest\engine-rest\src\main\java\org\camunda\bpm\engine\rest\dto\management\JobDefinitionQueryDto.java
| 1
|
请完成以下Java代码
|
public String getOperator()
{
return operator;
}
@Override
public String toString()
{
return getExpressionString();
}
@Override
public ILogicExpression evaluatePartial(final Evaluatee ctx)
{
if (isConstant())
{
return this;
}
final ILogicExpression leftExpression = getLeft();
final ILogicExpression newLeftExpression = leftExpression.evaluatePartial(ctx);
final ILogicExpression rightExpression = getRight();
final ILogicExpression newRightExpression = rightExpression.evaluatePartial(ctx);
|
final String logicOperator = getOperator();
if (newLeftExpression.isConstant() && newRightExpression.isConstant())
{
final BooleanEvaluator logicExprEvaluator = LogicExpressionEvaluator.getBooleanEvaluatorByOperator(logicOperator);
final boolean result = logicExprEvaluator.evaluateOrNull(newLeftExpression::constantValue, newRightExpression::constantValue);
return ConstantLogicExpression.of(result);
}
else if (Objects.equals(leftExpression, newLeftExpression)
&& Objects.equals(rightExpression, newRightExpression))
{
return this;
}
else
{
return LogicExpression.of(newLeftExpression, logicOperator, newRightExpression);
}
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\org\adempiere\ad\expression\api\impl\LogicExpression.java
| 1
|
请完成以下Java代码
|
public List<EventSubscriptionEntity> executeList(CommandContext commandContext, Page page) {
checkQueryOk();
return commandContext.getEventSubscriptionEntityManager().findEventSubscriptionsByQueryCriteria(this, page);
}
// getters //////////////////////////////////////////
public String getEventSubscriptionId() {
return eventSubscriptionId;
}
public String getEventName() {
return eventName;
}
public String getEventType() {
return eventType;
}
|
public String getExecutionId() {
return executionId;
}
public String getProcessInstanceId() {
return processInstanceId;
}
public String getActivityId() {
return activityId;
}
public String getConfiguration() {
return configuration;
}
}
|
repos\Activiti-develop\activiti-core\activiti-engine\src\main\java\org\activiti\engine\impl\EventSubscriptionQueryImpl.java
| 1
|
请完成以下Spring Boot application配置
|
#
# Copyright 2015-2023 the original author or authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
logging.level.root=WARN
logging.level.sample.mybatis.thymeleaf.mapper=TRACE
mybatis.mapper-locations=classpath*:/mappers/*.xml
mybatis.type
|
-aliases-package=sample.mybatis.thymeleaf.domain
mybatis.scripting-language-driver.thymeleaf.template-file.base-dir=mappers/
mybatis.scripting-language-driver.thymeleaf.template-file.path-provider.includes-package-path=false
mybatis.scripting-language-driver.thymeleaf.template-file.path-provider.separate-directory-per-mapper=false
|
repos\spring-boot-starter-master\mybatis-spring-boot-samples\mybatis-spring-boot-sample-thymeleaf\src\main\resources\application.properties
| 2
|
请完成以下Java代码
|
private static final class WrappedDocumentFilterList
{
public static WrappedDocumentFilterList ofFilters(final DocumentFilterList filters)
{
if (filters == null || filters.isEmpty())
{
return EMPTY;
}
final ImmutableList<JSONDocumentFilter> jsonFiltersEffective = null;
return new WrappedDocumentFilterList(jsonFiltersEffective, filters);
}
public static WrappedDocumentFilterList ofJSONFilters(final List<JSONDocumentFilter> jsonFilters)
{
if (jsonFilters == null || jsonFilters.isEmpty())
{
return EMPTY;
}
final ImmutableList<JSONDocumentFilter> jsonFiltersEffective = ImmutableList.copyOf(jsonFilters);
final DocumentFilterList filtersEffective = null;
return new WrappedDocumentFilterList(jsonFiltersEffective, filtersEffective);
}
public static final WrappedDocumentFilterList EMPTY = new WrappedDocumentFilterList();
private final ImmutableList<JSONDocumentFilter> jsonFilters;
private final DocumentFilterList filters;
private WrappedDocumentFilterList(@Nullable final ImmutableList<JSONDocumentFilter> jsonFilters, @Nullable final DocumentFilterList filters)
{
this.jsonFilters = jsonFilters;
this.filters = filters;
}
/**
|
* empty constructor
*/
private WrappedDocumentFilterList()
{
filters = DocumentFilterList.EMPTY;
jsonFilters = null;
}
public DocumentFilterList unwrap(final DocumentFilterDescriptorsProvider descriptors)
{
if (filters != null)
{
return filters;
}
if (jsonFilters == null || jsonFilters.isEmpty())
{
return DocumentFilterList.EMPTY;
}
return JSONDocumentFilter.unwrapList(jsonFilters, descriptors);
}
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.ui.web.base\src\main\java\de\metas\ui\web\view\CreateViewRequest.java
| 1
|
请完成以下Java代码
|
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
|
请完成以下Java代码
|
private DestinationTopic.Properties createProperties(long delayMs, String suffix) {
return new DestinationTopic.Properties(delayMs, suffix, getDestinationTopicType(delayMs), this.maxAttempts,
this.numPartitions, this.dltStrategy, this.kafkaOperations, this.shouldRetryOn, this.timeout);
}
private String joinWithRetrySuffix(long parameter) {
return String.join("-", this.destinationTopicSuffixes.getRetrySuffix(), String.valueOf(parameter));
}
public static class DestinationTopicSuffixes {
private final String retryTopicSuffix;
private final String dltSuffix;
public DestinationTopicSuffixes(@Nullable String retryTopicSuffix, @Nullable String dltSuffix) {
|
this.retryTopicSuffix = StringUtils.hasText(retryTopicSuffix)
? retryTopicSuffix
: RetryTopicConstants.DEFAULT_RETRY_SUFFIX;
this.dltSuffix = StringUtils.hasText(dltSuffix) ? dltSuffix : RetryTopicConstants.DEFAULT_DLT_SUFFIX;
}
public String getRetrySuffix() {
return this.retryTopicSuffix;
}
public String getDltSuffix() {
return this.dltSuffix;
}
}
}
|
repos\spring-kafka-main\spring-kafka\src\main\java\org\springframework\kafka\retrytopic\DestinationTopicPropertiesFactory.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public class DruidOneConfig extends DruidConfig{
private String url;
private String username;
private String password;
private String driverClassName;
private int initialSize;
private int minIdle;
private int maxActive;
public String getUrl() {
return url;
}
public void setUrl(String url) {
this.url = url;
}
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 getDriverClassName() {
return driverClassName;
}
public void setDriverClassName(String driverClassName) {
this.driverClassName = driverClassName;
}
public int getInitialSize() {
return initialSize;
}
public void setInitialSize(int initialSize) {
|
this.initialSize = initialSize;
}
public int getMinIdle() {
return minIdle;
}
public void setMinIdle(int minIdle) {
this.minIdle = minIdle;
}
public int getMaxActive() {
return maxActive;
}
public void setMaxActive(int maxActive) {
this.maxActive = maxActive;
}
}
|
repos\spring-boot-leaning-master\2.x_42_courses\第 3-7 课: Spring Boot 集成 Druid 监控数据源\spring-boot-multi-Jpa-druid\src\main\java\com\neo\config\druid\DruidOneConfig.java
| 2
|
请完成以下Java代码
|
public class PlainValidationContext implements IValidationContext
{
private String contextTableName;
private String tableName;
private final Map<String, String> values = new HashMap<String, String>();
@Override
public String get_ValueAsString(String variableName)
{
return values.get(variableName);
}
public void setValue(String variableName, String value)
{
values.put(variableName, value);
}
public void setContextTableName(String contextTableName)
{
values.put(PARAMETER_ContextTableName, contextTableName);
}
@Override
public String getTableName()
|
{
return tableName;
}
public void setTableName(String tableName)
{
this.tableName = tableName;
}
@Override
public String toString()
{
return String.format("PlainValidationContext [contextTableName=%s, tableName=%s, values=%s]", contextTableName, tableName, values);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\org\adempiere\ad\validationRule\impl\PlainValidationContext.java
| 1
|
请完成以下Java代码
|
public de.metas.printing.model.I_C_Printing_Queue getC_Printing_Queue()
{
return get_ValueAsPO(COLUMNNAME_C_Printing_Queue_ID, de.metas.printing.model.I_C_Printing_Queue.class);
}
@Override
public void setC_Printing_Queue(de.metas.printing.model.I_C_Printing_Queue C_Printing_Queue)
{
set_ValueFromPO(COLUMNNAME_C_Printing_Queue_ID, de.metas.printing.model.I_C_Printing_Queue.class, C_Printing_Queue);
}
@Override
public void setC_Printing_Queue_ID (int C_Printing_Queue_ID)
{
if (C_Printing_Queue_ID < 1)
set_ValueNoCheck (COLUMNNAME_C_Printing_Queue_ID, null);
else
set_ValueNoCheck (COLUMNNAME_C_Printing_Queue_ID, Integer.valueOf(C_Printing_Queue_ID));
}
@Override
public int getC_Printing_Queue_ID()
{
return get_ValueAsInt(COLUMNNAME_C_Printing_Queue_ID);
|
}
@Override
public void setC_Printing_Queue_Recipient_ID (int C_Printing_Queue_Recipient_ID)
{
if (C_Printing_Queue_Recipient_ID < 1)
set_ValueNoCheck (COLUMNNAME_C_Printing_Queue_Recipient_ID, null);
else
set_ValueNoCheck (COLUMNNAME_C_Printing_Queue_Recipient_ID, Integer.valueOf(C_Printing_Queue_Recipient_ID));
}
@Override
public int getC_Printing_Queue_Recipient_ID()
{
return get_ValueAsInt(COLUMNNAME_C_Printing_Queue_Recipient_ID);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.printing\de.metas.printing.base\src\main\java-gen\de\metas\printing\model\X_C_Printing_Queue_Recipient.java
| 1
|
请完成以下Java代码
|
private boolean isValidHu(@NonNull final PickingSlotRow pickingSlotRowOrHU)
{
if (!pickingSlotRowOrHU.isPickedHURow())
{
return false;
// return ProcessPreconditionsResolution.reject(msgBL.getTranslatableMsgText(MSG_WEBUI_PICKING_SELECT_PICKED_HU));
}
if (!pickingSlotRowOrHU.isTopLevelHU())
{
return false;
// return ProcessPreconditionsResolution.reject(msgBL.getTranslatableMsgText(MSG_WEBUI_PICKING_SELECT_PICKED_HU));
}
if (checkIsEmpty(pickingSlotRowOrHU))
{
return false;
// return ProcessPreconditionsResolution.reject(msgBL.getTranslatableMsgText(MSG_WEBUI_PICKING_PICK_SOMETHING));
}
//noinspection RedundantIfStatement
if (pickingSlotRowOrHU.isProcessed())
{
return false;
// return ProcessPreconditionsResolution.reject(msgBL.getTranslatableMsgText(MSG_WEBUI_PICKING_NO_UNPROCESSED_RECORDS));
}
return true;
}
@Override
protected String doIt() throws Exception
{
final PickingSlotRow rowToProcess = getSingleSelectedRow();
final ImmutableSet<HuId> hUs = filterOutInvalidHUs(rowToProcess);
final ShipmentScheduleId shipmentScheduleId = null;
//noinspection ConstantConditions
pickingCandidateService.processForHUIds(hUs, shipmentScheduleId);
return MSG_OK;
|
}
@Override
protected void postProcess(final boolean success)
{
if (!success)
{
return;
}
invalidatePickingSlotsView();
invalidatePackablesView();
}
private boolean checkIsEmpty(final PickingSlotRow pickingSlotRowOrHU)
{
Check.assume(pickingSlotRowOrHU.isPickedHURow(), "Was expecting an HuId but found none!");
if (pickingSlotRowOrHU.getHuQtyCU() != null && pickingSlotRowOrHU.getHuQtyCU().signum() > 0)
{
return false;
}
final I_M_HU hu = handlingUnitsBL.getById(pickingSlotRowOrHU.getHuId());
return handlingUnitsBL.isEmptyStorage(hu);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.ui.web.base\src\main\java\de\metas\ui\web\picking\pickingslot\process\WEBUI_Picking_M_Picking_Candidate_Process.java
| 1
|
请完成以下Java代码
|
public final class ImpFormat
{
@Getter
@NonNull
private final ImpFormatId id;
@Getter
@NonNull
private final String name;
@Getter
@NonNull
private final ImpFormatType formatType;
@Getter
private final boolean multiLine;
@Getter
private final boolean manualImport;
@Getter
@NonNull
private final Charset charset;
@Getter
private final int skipFirstNRows;
/**
* The Table to be imported
*/
@Getter
@NonNull
private final ImportTableDescriptor importTableDescriptor;
@Getter
@NonNull
private final ImmutableList<ImpFormatColumn> columns;
@Builder
private ImpFormat(
|
@NonNull final ImpFormatId id,
@NonNull final String name,
@NonNull final ImpFormatType formatType,
final boolean multiLine,
final boolean manualImport,
@NonNull final ImportTableDescriptor importTableDescriptor,
@NonNull @Singular final List<ImpFormatColumn> columns,
@NonNull final Charset charset,
final int skipFirstNRows)
{
Check.assumeNotEmpty(name, "name is not empty");
Check.assumeNotEmpty(columns, "columns is not empty");
this.id = id;
this.name = name;
this.formatType = formatType;
this.multiLine = multiLine;
this.manualImport = manualImport;
this.importTableDescriptor = importTableDescriptor;
this.columns = ImmutableList.copyOf(columns);
this.charset = charset;
this.skipFirstNRows = Math.max(skipFirstNRows, 0);
}
public String getImportTableName()
{
return getImportTableDescriptor().getTableName();
}
public String getImportKeyColumnName()
{
return getImportTableDescriptor().getKeyColumnName();
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\de\metas\impexp\format\ImpFormat.java
| 1
|
请完成以下Java代码
|
public void setAD_JavaClass_Type_ID (int AD_JavaClass_Type_ID)
{
if (AD_JavaClass_Type_ID < 1)
set_ValueNoCheck (COLUMNNAME_AD_JavaClass_Type_ID, null);
else
set_ValueNoCheck (COLUMNNAME_AD_JavaClass_Type_ID, Integer.valueOf(AD_JavaClass_Type_ID));
}
/** Get Java Class Type.
@return Java Class Type */
@Override
public int getAD_JavaClass_Type_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_AD_JavaClass_Type_ID);
if (ii == null)
return 0;
return ii.intValue();
}
/** Set Java-Klasse.
@param Classname Java-Klasse */
@Override
public void setClassname (java.lang.String Classname)
{
set_Value (COLUMNNAME_Classname, Classname);
}
/** Get Java-Klasse.
@return Java-Klasse */
@Override
public java.lang.String getClassname ()
{
return (java.lang.String)get_Value(COLUMNNAME_Classname);
}
/** 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 Interface.
@param IsInterface Interface */
|
@Override
public void setIsInterface (boolean IsInterface)
{
set_Value (COLUMNNAME_IsInterface, Boolean.valueOf(IsInterface));
}
/** Get Interface.
@return Interface */
@Override
public boolean isInterface ()
{
Object oo = get_Value(COLUMNNAME_IsInterface);
if (oo != null)
{
if (oo instanceof Boolean)
return ((Boolean)oo).booleanValue();
return "Y".equals(oo);
}
return false;
}
/** 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.adempiere.adempiere\base\src\main\java-gen\de\metas\javaclasses\model\X_AD_JavaClass.java
| 1
|
请完成以下Java代码
|
public static void validate(List<? extends KvEntry> tsKvEntries, boolean valueNoXssValidation) {
tsKvEntries.forEach(tsKvEntry -> validate(tsKvEntry, valueNoXssValidation));
}
public static void validate(KvEntry tsKvEntry, boolean valueNoXssValidation) {
if (tsKvEntry == null) {
throw new IncorrectParameterException("Key value entry can't be null");
}
String key = tsKvEntry.getKey();
if (StringUtils.isBlank(key)) {
throw new DataValidationException("Key can't be null or empty");
}
if (key.length() > 255) {
throw new DataValidationException("Validation error: key length must be equal or less than 255");
}
Boolean isValid = validatedKeys.asMap().get(key);
if (isValid == null) {
isValid = NoXssValidator.isValid(key);
validatedKeys.put(key, isValid);
}
if (!isValid) {
throw new DataValidationException("Validation error: key is malformed");
}
if (valueNoXssValidation) {
Object value = tsKvEntry.getValue();
if (value instanceof CharSequence || value instanceof JsonNode) {
if (!NoXssValidator.isValid(value.toString())) {
throw new DataValidationException("Validation error: value is malformed");
}
}
}
}
public static List<TsKvEntry> toTsKvEntryList(Map<Long, List<KvEntry>> tsKvMap) {
List<TsKvEntry> tsKvEntryList = new ArrayList<>();
for (Map.Entry<Long, List<KvEntry>> tsKvEntry : tsKvMap.entrySet()) {
for (KvEntry kvEntry : tsKvEntry.getValue()) {
tsKvEntryList.add(new BasicTsKvEntry(tsKvEntry.getKey(), kvEntry));
}
}
return tsKvEntryList;
|
}
public static List<AttributeKvEntry> filterChangedAttr(List<AttributeKvEntry> currentAttributes, List<AttributeKvEntry> newAttributes) {
if (currentAttributes == null || currentAttributes.isEmpty()) {
return newAttributes;
}
Map<String, AttributeKvEntry> currentAttrMap = currentAttributes.stream()
.collect(Collectors.toMap(AttributeKvEntry::getKey, Function.identity(), (existing, replacement) -> existing));
return newAttributes.stream()
.filter(item -> {
AttributeKvEntry cacheAttr = currentAttrMap.get(item.getKey());
return cacheAttr == null
|| !Objects.equals(item.getValue(), cacheAttr.getValue()) //JSON and String can be equals by value, but different by type
|| !Objects.equals(item.getDataType(), cacheAttr.getDataType());
})
.collect(Collectors.toList());
}
}
|
repos\thingsboard-master\dao\src\main\java\org\thingsboard\server\dao\util\KvUtils.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
private boolean isProductCompatible(
@NonNull final Workplace workplace,
@NonNull final ShipmentSchedule schedule)
{
final ImmutableSet<ProductId> workplaceProducts = workplace.getProductIds();
final ImmutableSet<ProductCategoryId> workplaceCategories = workplace.getProductCategoryIds();
if (workplaceProducts.isEmpty() && workplaceCategories.isEmpty())
{
return true;
}
final ProductId scheduleProductId = schedule.getProductId();
if (!workplaceProducts.isEmpty() && workplaceProducts.contains(scheduleProductId))
{
return true;
}
final ProductCategoryId productCategoryId = productsById.get(scheduleProductId).getProductCategoryId();
Check.assumeNotNull(productCategoryId, "ProductCategoryId of {} is not null", scheduleProductId);
return !workplaceCategories.isEmpty() && workplaceCategories.contains(productCategoryId);
}
private boolean isCarrierCompatible(
@NonNull final Workplace workplace,
@NonNull final ShipmentSchedule schedule)
{
final ImmutableSet<CarrierProductId> workplaceCarrierProducts = workplace.getCarrierProductIds();
if (workplaceCarrierProducts.isEmpty())
{
return true;
}
final CarrierProductId carrierProductId = schedule.getCarrierProductId();
if (carrierProductId == null)
{
return false;
}
return workplaceCarrierProducts.contains(carrierProductId);
}
private boolean isExternalSystemCompatible(
@NonNull final Workplace workplace,
@NonNull final ShipmentSchedule schedule)
{
final ImmutableSet<ExternalSystemId> workplaceExternalSystems = workplace.getExternalSystemIds();
if (workplaceExternalSystems.isEmpty())
{
|
return true;
}
final ExternalSystemId externalSystemId = schedule.getExternalSystemId();
if (externalSystemId == null)
{
return false;
}
return workplaceExternalSystems.contains(externalSystemId);
}
private boolean isPriorityCompatible(
@NonNull final Workplace workplace,
@NonNull final ShipmentSchedule schedule)
{
final PriorityRule priorityRule = workplace.getPriorityRule();
if (priorityRule == null)
{
return true;
}
return PriorityRule.equals(priorityRule, schedule.getPriorityRule());
}
private static class WorkplacesCapacity
{
private final Map<WorkplaceId, Integer> assignedCountPerWorkplace = new HashMap<>();
void increase(@NonNull final WorkplaceId workplaceId)
{
assignedCountPerWorkplace.merge(workplaceId, 1, Integer::sum);
}
boolean hasCapacity(@NonNull final Workplace workplace)
{
final int currentAssigned = assignedCountPerWorkplace.getOrDefault(workplace.getId(), 0);
return currentAssigned < workplace.getMaxPickingJobs();
}
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.handlingunits.base\src\main\java\de\metas\handlingunits\picking\job_schedule\service\commands\PickingJobScheduleAutoAssignCommand.java
| 2
|
请完成以下Java代码
|
public static AttributeSetId ofRepoId(final int repoId)
{
final AttributeSetId id = ofRepoIdOrNull(repoId);
if (id == null)
{
throw new AdempiereException("Invalid repoId: " + repoId);
}
return id;
}
public static AttributeSetId ofRepoIdOrNone(final int repoId)
{
final AttributeSetId id = ofRepoIdOrNull(repoId);
return id != null ? id : NONE;
}
@Nullable
public static AttributeSetId ofRepoIdOrNull(final int repoId)
{
if (repoId == NONE.repoId)
{
return NONE;
}
else if (repoId > 0)
{
return new AttributeSetId(repoId);
}
else
{
return null;
}
}
public static int toRepoId(@Nullable final AttributeSetId attributeSetId)
{
|
return attributeSetId != null ? attributeSetId.getRepoId() : -1;
}
private AttributeSetId(final int repoId)
{
this.repoId = Check.assumeGreaterOrEqualToZero(repoId, "M_AttributeSet_ID");
}
@Override
@JsonValue
public int getRepoId()
{
return repoId;
}
public boolean isNone()
{
return repoId == NONE.repoId;
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\org\adempiere\mm\attributes\AttributeSetId.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public Result thread(String arg) {
// 资源的唯一标识
String resourceName = "testSentinel";
int time = random.nextInt(700);
Entry entry = null;
String retVal;
try {
entry = SphU.entry(resourceName, EntryType.IN);
Thread.sleep(time);
if (time > 690) {
throw new RuntimeException("耗时太长啦");
}
retVal = "passed";
} catch (BlockException e) {
// logger.error("请求拒绝 {}", e.getMessage(), e);
|
retVal = "blocked";
} catch (Exception e) {
// logger.error("异常 {}", e.getMessage(), e);
// 异常数统计埋点
Tracer.trace(e);
throw new RuntimeException(e);
} finally {
if (entry != null) {
entry.exit();
}
}
return Result.success(retVal + "::" + time);
}
}
|
repos\spring-boot-student-master\spring-boot-student-sentinel\src\main\java\com\xiaolyuh\service\impl\PersonServiceImpl.java
| 2
|
请在Spring Boot框架中完成以下Java代码
|
public boolean supportsTemporaryTables() {
return true;
}
public String getCreateTemporaryTableString() {
return "create temporary table if not exists";
}
public boolean dropTemporaryTableAfterUse() {
return false;
}
public boolean supportsCurrentTimestampSelection() {
return true;
}
public boolean isCurrentTimestampSelectStringCallable() {
return false;
}
public String getCurrentTimestampSelectString() {
return "select current_timestamp";
}
public boolean supportsUnionAll() {
return true;
}
public boolean hasAlterTable() {
return false; // As specify in NHibernate dialect
}
public boolean dropConstraints() {
return false;
}
public String getAddColumnString() {
return "add column";
}
public String getForUpdateString() {
return "";
}
public boolean supportsOuterJoinForUpdate() {
return false;
}
public String getDropForeignKeyString() {
throw new UnsupportedOperationException("No drop foreign key syntax supported by SQLiteDialect");
|
}
public String getAddForeignKeyConstraintString(String constraintName,
String[] foreignKey, String referencedTable, String[] primaryKey,
boolean referencesPrimaryKey) {
throw new UnsupportedOperationException("No add foreign key syntax supported by SQLiteDialect");
}
public String getAddPrimaryKeyConstraintString(String constraintName) {
throw new UnsupportedOperationException("No add primary key syntax supported by SQLiteDialect");
}
public boolean supportsIfExistsBeforeTableName() {
return true;
}
public boolean supportsCascadeDelete() {
return false;
}
}
|
repos\SpringBoot-vue-master\src\main\java\com\boylegu\springboot_vue\config\SQLiteDialect.java
| 2
|
请在Spring Boot框架中完成以下Java代码
|
public class WorkstationRestController
{
@NonNull private final ResourceService resourceService;
@NonNull private final UserWorkstationService userWorkstationService;
@NonNull private final WorkplaceService workplaceService;
@NonNull
private Resource getWorkstationById(final ResourceId workstationId)
{
final Resource workstation = resourceService.getById(workstationId);
assertWorkstation(workstation);
return workstation;
}
private static void assertWorkstation(final Resource workstation)
{
if (!workstation.isWorkstation())
{
throw new AdempiereException("Not a workstation QR Code");
}
}
private JsonWorkstation toJson(final Resource workstation)
{
final ResourceId workstationId = workstation.getResourceId();
final WorkplaceId workplaceId = workstation.getWorkplaceId();
final String workplaceName = workplaceId != null ? workplaceService.getById(workplaceId).getName() : null;
return JsonWorkstation.builder()
.id(workstationId)
.name(workstation.getName())
.qrCode(workstation.toQrCode().toGlobalQRCodeJsonString())
.workplaceName(workplaceName)
.isUserAssigned(userWorkstationService.isUserAssigned(Env.getLoggedUserId(), workstationId))
.build();
}
@GetMapping
public JsonWorkstationSettings getStatus()
{
|
return JsonWorkstationSettings.builder()
.assignedWorkstation(userWorkstationService.getUserWorkstationId(Env.getLoggedUserId())
.map(resourceService::getById)
.map(this::toJson)
.orElse(null))
.build();
}
@PostMapping("/assign")
public JsonWorkstation assign(@RequestBody @NonNull final JsonAssignWorkstationRequest request)
{
final Resource workstation = getWorkstationById(request.getWorkstationIdEffective());
final UserId loggedUserId = Env.getLoggedUserId();
userWorkstationService.assign(loggedUserId, workstation.getResourceId());
Optional.ofNullable(workstation.getWorkplaceId())
.ifPresent(workplaceId -> workplaceService.assignWorkplace(loggedUserId, workplaceId));
return toJson(workstation);
}
@PostMapping("/byQRCode")
public JsonWorkstation getWorkstationByQRCode(@RequestBody @NonNull final JsonGetWorkstationByQRCodeRequest request)
{
final ResourceQRCode qrCode = ResourceQRCode.ofGlobalQRCodeJsonString(request.getQrCode());
final Resource workstation = getWorkstationById(qrCode.getResourceId());
return toJson(workstation);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.business.rest-api-impl\src\main\java\de\metas\rest_api\v2\workstation\WorkstationRestController.java
| 2
|
请完成以下Java代码
|
public void setUI_ApplicationId (final @Nullable java.lang.String UI_ApplicationId)
{
set_Value (COLUMNNAME_UI_ApplicationId, UI_ApplicationId);
}
@Override
public java.lang.String getUI_ApplicationId()
{
return get_ValueAsString(COLUMNNAME_UI_ApplicationId);
}
@Override
public void setUI_DeviceId (final @Nullable java.lang.String UI_DeviceId)
{
set_Value (COLUMNNAME_UI_DeviceId, UI_DeviceId);
}
@Override
public java.lang.String getUI_DeviceId()
{
return get_ValueAsString(COLUMNNAME_UI_DeviceId);
}
@Override
public void setUI_TabId (final @Nullable java.lang.String UI_TabId)
{
set_Value (COLUMNNAME_UI_TabId, UI_TabId);
}
@Override
public java.lang.String getUI_TabId()
{
return get_ValueAsString(COLUMNNAME_UI_TabId);
}
@Override
public void setUI_Trace_ID (final int UI_Trace_ID)
{
if (UI_Trace_ID < 1)
set_ValueNoCheck (COLUMNNAME_UI_Trace_ID, null);
else
set_ValueNoCheck (COLUMNNAME_UI_Trace_ID, UI_Trace_ID);
}
@Override
public int getUI_Trace_ID()
{
return get_ValueAsInt(COLUMNNAME_UI_Trace_ID);
}
@Override
|
public void setURL (final @Nullable java.lang.String URL)
{
set_Value (COLUMNNAME_URL, URL);
}
@Override
public java.lang.String getURL()
{
return get_ValueAsString(COLUMNNAME_URL);
}
@Override
public void setUserAgent (final @Nullable java.lang.String UserAgent)
{
set_Value (COLUMNNAME_UserAgent, UserAgent);
}
@Override
public java.lang.String getUserAgent()
{
return get_ValueAsString(COLUMNNAME_UserAgent);
}
@Override
public void setUserName (final @Nullable java.lang.String UserName)
{
set_Value (COLUMNNAME_UserName, UserName);
}
@Override
public java.lang.String getUserName()
{
return get_ValueAsString(COLUMNNAME_UserName);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_UI_Trace.java
| 1
|
请完成以下Java代码
|
public class C_OrderLine
{
private final IHUPackingAwareBL packingAwareBL = Services.get(IHUPackingAwareBL.class);
/**
* Task 06915: only updating on QtyEntered, but not on M_HU_PI_Item_Product_ID, because when the HU_PI_Item_Product changes, we want QtyEnteredTU to stay the same.
*
*/
@CalloutMethod(columnNames = { I_C_OrderLine.COLUMNNAME_QtyEntered })
public void updateQtyTU(final I_C_OrderLine orderLine, final ICalloutField field)
{
final IHUPackingAware packingAware = new OrderLineHUPackingAware(orderLine);
packingAwareBL.setQtyTU(packingAware);
packingAwareBL.setQtyLUFromQtyTU(packingAware);
packingAware.setQty(packingAware.getQty());
}
/**
* Task 06915: If QtyEnteredTU or M_HU_PI_Item_Product_ID change, then update QtyEntered (i.e. the CU qty).
*
*/
@CalloutMethod(columnNames = { I_C_OrderLine.COLUMNNAME_QtyEnteredTU, I_C_OrderLine.COLUMNNAME_M_HU_PI_Item_Product_ID })
public void updateQtyCU(final I_C_OrderLine orderLine, final ICalloutField field)
{
final IHUPackingAware packingAware = new OrderLineHUPackingAware(orderLine);
setQtuCUFromQtyTU(packingAware);
packingAwareBL.setQtyLUFromQtyTU(packingAware);
// Update lineNetAmt, because QtyEnteredCU changed : see task 06727
Services.get(IOrderLineBL.class).updateLineNetAmtFromQtyEntered(orderLine);
}
private void setQtuCUFromQtyTU(final IHUPackingAware packingAware)
{
final int qtyPacks = packingAware.getQtyTU().intValue();
packingAwareBL.setQtyCUFromQtyTU(packingAware, qtyPacks);
}
|
@CalloutMethod(columnNames = { I_C_OrderLine.COLUMNNAME_QtyLU, I_C_OrderLine.COLUMNNAME_M_LU_HU_PI_ID })
public void updateQtyTUCU(final I_C_OrderLine orderLine, final ICalloutField field)
{
packingAwareBL.validateLUQty(orderLine.getQtyLU());
final IHUPackingAware packingAware = new OrderLineHUPackingAware(orderLine);
packingAwareBL.setQtyTUFromQtyLU(packingAware);
updateQtyCU(orderLine, field);
}
@CalloutMethod(columnNames = { I_C_OrderLine.COLUMNNAME_C_BPartner_ID
, I_C_OrderLine.COLUMNNAME_QtyEntered
, I_C_OrderLine.COLUMNNAME_M_HU_PI_Item_Product_ID
, I_C_OrderLine.COLUMNNAME_M_Product_ID })
public void onHURelevantChange(final I_C_OrderLine orderLine, final ICalloutField field)
{
final I_C_OrderLine ol = InterfaceWrapperHelper.create(orderLine, I_C_OrderLine.class);
Services.get(IHUOrderBL.class).updateOrderLine(ol, field.getColumnName());
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.handlingunits.base\src\main\java\de\metas\handlingunits\callout\C_OrderLine.java
| 1
|
请完成以下Java代码
|
public Criteria andPicNotBetween(String value1, String value2) {
addCriterion("pic not between", value1, value2, "pic");
return (Criteria) this;
}
}
public static class Criteria extends GeneratedCriteria {
protected Criteria() {
super();
}
}
public static class Criterion {
private String condition;
private Object value;
private Object secondValue;
private boolean noValue;
private boolean singleValue;
private boolean betweenValue;
private boolean listValue;
private String typeHandler;
public String getCondition() {
return condition;
}
public Object getValue() {
return value;
}
public Object getSecondValue() {
return secondValue;
}
public boolean isNoValue() {
return noValue;
}
public boolean isSingleValue() {
return singleValue;
}
public boolean isBetweenValue() {
return betweenValue;
}
public boolean isListValue() {
return listValue;
}
public String getTypeHandler() {
return typeHandler;
}
protected Criterion(String condition) {
super();
this.condition = condition;
this.typeHandler = null;
this.noValue = true;
|
}
protected Criterion(String condition, Object value, String typeHandler) {
super();
this.condition = condition;
this.value = value;
this.typeHandler = typeHandler;
if (value instanceof List<?>) {
this.listValue = true;
} else {
this.singleValue = true;
}
}
protected Criterion(String condition, Object value) {
this(condition, value, null);
}
protected Criterion(String condition, Object value, Object secondValue, String typeHandler) {
super();
this.condition = condition;
this.value = value;
this.secondValue = secondValue;
this.typeHandler = typeHandler;
this.betweenValue = true;
}
protected Criterion(String condition, Object value, Object secondValue) {
this(condition, value, secondValue, null);
}
}
}
|
repos\mall-master\mall-mbg\src\main\java\com\macro\mall\model\PmsAlbumPicExample.java
| 1
|
请完成以下Java代码
|
public final Map<String, Parameter> getCurrentParams()
{
return currentParams;
}
@Override
public Parameter getParameter(final String name)
{
return getCurrentParams().get(name);
}
@Override
public boolean hasParameter(final String name)
{
return getCurrentParams().containsKey(name);
|
}
private static Map<String, Parameter> mkMap(Collection<Parameter> params)
{
final Map<String, Parameter> name2param = new HashMap<String, Parameter>(
params.size());
for (final Parameter param : params)
{
name2param.put(param.name, param);
}
return Collections.unmodifiableMap(name2param);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.swat\de.metas.swat.base\src\main\java\de\metas\impex\spi\impl\BaseConnector.java
| 1
|
请完成以下Java代码
|
public List<ProcessDefinition> executeList(CommandContext commandContext, Page page) {
checkQueryOk();
return commandContext.getProcessDefinitionEntityManager().findProcessDefinitionsByQueryCriteria(this, page);
}
public void checkQueryOk() {
super.checkQueryOk();
}
// getters ////////////////////////////////////////////
public String getDeploymentId() {
return deploymentId;
}
public Set<String> getDeploymentIds() {
return deploymentIds;
}
public String getId() {
return id;
}
public Set<String> getIds() {
return ids;
}
public String getName() {
return name;
}
public String getNameLike() {
return nameLike;
}
public String getKey() {
return key;
}
public String getIdOrKey() {
return idOrKey;
}
public String getKeyLike() {
return keyLike;
}
public Set<String> getKeys() {
return keys;
}
public Integer getVersion() {
return version;
}
public Integer getVersionGt() {
return versionGt;
}
public Integer getVersionGte() {
return versionGte;
}
public Integer getVersionLt() {
return versionLt;
}
public Integer getVersionLte() {
return versionLte;
}
public boolean isLatest() {
return latest;
}
public String getCategory() {
return category;
}
public String getCategoryLike() {
return categoryLike;
}
public String getResourceName() {
return resourceName;
}
public String getResourceNameLike() {
return resourceNameLike;
}
public SuspensionState getSuspensionState() {
return suspensionState;
}
|
public void setSuspensionState(SuspensionState suspensionState) {
this.suspensionState = suspensionState;
}
public String getCategoryNotEquals() {
return categoryNotEquals;
}
public String getTenantId() {
return tenantId;
}
public String getTenantIdLike() {
return tenantIdLike;
}
public boolean isWithoutTenantId() {
return withoutTenantId;
}
public String getAuthorizationUserId() {
return authorizationUserId;
}
public String getProcDefId() {
return procDefId;
}
public String getEventSubscriptionName() {
return eventSubscriptionName;
}
public String getEventSubscriptionType() {
return eventSubscriptionType;
}
public ProcessDefinitionQueryImpl startableByUser(String userId) {
if (userId == null) {
throw new ActivitiIllegalArgumentException("userId is null");
}
this.authorizationUserId = userId;
return this;
}
public ProcessDefinitionQuery startableByGroups(List<String> groupIds) {
authorizationGroups = groupIds;
return this;
}
}
|
repos\Activiti-develop\activiti-core\activiti-engine\src\main\java\org\activiti\engine\impl\ProcessDefinitionQueryImpl.java
| 1
|
请完成以下Java代码
|
public void setName (final @Nullable java.lang.String Name)
{
set_ValueNoCheck (COLUMNNAME_Name, Name);
}
@Override
public java.lang.String getName()
{
return get_ValueAsString(COLUMNNAME_Name);
}
@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 setUPC (final @Nullable java.lang.String UPC)
{
set_Value (COLUMNNAME_UPC, UPC);
}
@Override
public java.lang.String getUPC()
{
|
return get_ValueAsString(COLUMNNAME_UPC);
}
@Override
public void setValidFrom (final java.sql.Timestamp ValidFrom)
{
set_Value (COLUMNNAME_ValidFrom, ValidFrom);
}
@Override
public java.sql.Timestamp getValidFrom()
{
return get_ValueAsTimestamp(COLUMNNAME_ValidFrom);
}
@Override
public void setValidTo (final @Nullable java.sql.Timestamp ValidTo)
{
set_Value (COLUMNNAME_ValidTo, ValidTo);
}
@Override
public java.sql.Timestamp getValidTo()
{
return get_ValueAsTimestamp(COLUMNNAME_ValidTo);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.handlingunits.base\src\main\java-gen\de\metas\handlingunits\model\X_M_HU_PI_Item_Product.java
| 1
|
请完成以下Java代码
|
public UpdateProcessInstanceSuspensionStateBuilderImpl byProcessDefinitionKey(String processDefinitionKey) {
ensureNotNull("processDefinitionKey", processDefinitionKey);
this.processDefinitionKey = processDefinitionKey;
return this;
}
@Override
public UpdateProcessInstanceSuspensionStateBuilderImpl processDefinitionWithoutTenantId() {
this.processDefinitionTenantId = null;
this.isProcessDefinitionTenantIdSet = true;
return this;
}
@Override
public UpdateProcessInstanceSuspensionStateBuilderImpl processDefinitionTenantId(String tenantId) {
ensureNotNull("tenantId", tenantId);
this.processDefinitionTenantId = tenantId;
this.isProcessDefinitionTenantIdSet = true;
return this;
}
@Override
public void activate() {
validateParameters();
ActivateProcessInstanceCmd command = new ActivateProcessInstanceCmd(this);
commandExecutor.execute(command);
}
@Override
public void suspend() {
validateParameters();
SuspendProcessInstanceCmd command = new SuspendProcessInstanceCmd(this);
commandExecutor.execute(command);
}
protected void validateParameters() {
ensureOnlyOneNotNull("Need to specify either a process instance id, a process definition id or a process definition key.", processInstanceId, processDefinitionId, processDefinitionKey);
|
if (isProcessDefinitionTenantIdSet && (processInstanceId != null || processDefinitionId != null)) {
throw LOG.exceptionUpdateSuspensionStateForTenantOnlyByProcessDefinitionKey();
}
ensureNotNull("commandExecutor", commandExecutor);
}
public String getProcessDefinitionKey() {
return processDefinitionKey;
}
public String getProcessDefinitionId() {
return processDefinitionId;
}
public String getProcessDefinitionTenantId() {
return processDefinitionTenantId;
}
public boolean isProcessDefinitionTenantIdSet() {
return isProcessDefinitionTenantIdSet;
}
public String getProcessInstanceId() {
return processInstanceId;
}
}
|
repos\camunda-bpm-platform-master\engine\src\main\java\org\camunda\bpm\engine\impl\runtime\UpdateProcessInstanceSuspensionStateBuilderImpl.java
| 1
|
请完成以下Java代码
|
public ProcessPreconditionsResolution checkPreconditionsApplicable(final IProcessPreconditionsContext context)
{
if (context.isNoSelection())
{
return ProcessPreconditionsResolution.rejectBecauseNoSelection();
}
if (!context.isSingleSelection())
{
return ProcessPreconditionsResolution.rejectBecauseNotSingleSelection();
}
final I_M_InOut shipment = context.getSelectedModel(I_M_InOut.class);
// guard against null (might happen if the selected ID is not valid)
if (shipment == null)
{
return ProcessPreconditionsResolution.rejectBecauseNoSelection();
}
return checkEligibleForHUsSelection(shipment);
}
/**
* @return true if given shipment is eligible for HU selection
*/
public static ProcessPreconditionsResolution checkEligibleForHUsSelection(final I_M_InOut shipment)
{
// shipment must be completed or closed closed
final String docStatus = shipment.getDocStatus();
if (!(docStatus.equals(X_M_InOut.DOCSTATUS_Completed) || docStatus.equals(X_M_InOut.DOCSTATUS_Closed)))
{
return ProcessPreconditionsResolution.reject("shipment not completed");
}
final List<I_M_HU> shipmentHandlingUnits = Services.get(IHUInOutDAO.class).retrieveShippedHandlingUnits(shipment);
if (shipmentHandlingUnits.isEmpty())
{
return ProcessPreconditionsResolution.reject("shipment has no handling units assigned");
}
return ProcessPreconditionsResolution.accept();
|
}
@Override
protected String doIt() throws Exception
{
final I_M_InOut shipment = getRecord(I_M_InOut.class);
final List<I_M_HU> shipmentHandlingUnits = Services.get(IHUInOutDAO.class).retrieveShippedHandlingUnits(shipment);
getResult().setRecordToOpen(RecordsToOpen.builder()
.records(TableRecordReference.ofCollection(shipmentHandlingUnits))
.adWindowId(null)
.target(RecordsToOpen.OpenTarget.GridView)
.targetTab(RecordsToOpen.TargetTab.SAME_TAB_OVERLAY)
.automaticallySetReferencingDocumentPaths(true)
.useAutoFilters(false)
.build());
return MSG_OK;
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.ui.web.base\src\main\java\de\metas\ui\web\handlingunits\process\WEBUI_M_InOut_Shipment_SelectHUs.java
| 1
|
请完成以下Java代码
|
public String getProcessDefinitionId() {
return processDefinitionId;
}
public String getProcessDefinitionKey() {
return processDefinitionKey;
}
public List<String> getProcessDefinitionKeyIn() {
return processDefinitionKeyIn;
}
public String getProcessDefinitionIdLike() {
return processDefinitionKey + ":%:%";
}
public String getProcessDefinitionName() {
return processDefinitionName;
}
public String getProcessDefinitionCategory() {
return processDefinitionCategory;
}
public Integer getProcessDefinitionVersion() {
return processDefinitionVersion;
}
public String getProcessInstanceId() {
return processInstanceId;
}
public Set<String> getProcessInstanceIds() {
return processInstanceIds;
}
public String getStartedBy() {
return startedBy;
}
public String getSuperProcessInstanceId() {
return superProcessInstanceId;
}
public boolean isExcludeSubprocesses() {
return excludeSubprocesses;
}
public List<String> getProcessKeyNotIn() {
return processKeyNotIn;
}
public Date getStartedAfter() {
return startedAfter;
}
public Date getStartedBefore() {
return startedBefore;
}
public Date getFinishedAfter() {
return finishedAfter;
}
public Date getFinishedBefore() {
return finishedBefore;
}
public String getInvolvedUser() {
return involvedUser;
}
public String getName() {
return name;
}
public String getNameLike() {
return nameLike;
}
public static long getSerialversionuid() {
return serialVersionUID;
}
public String getDeploymentId() {
|
return deploymentId;
}
public List<String> getDeploymentIds() {
return deploymentIds;
}
public boolean isFinished() {
return finished;
}
public boolean isUnfinished() {
return unfinished;
}
public boolean isDeleted() {
return deleted;
}
public boolean isNotDeleted() {
return notDeleted;
}
public boolean isIncludeProcessVariables() {
return includeProcessVariables;
}
public boolean isWithJobException() {
return withJobException;
}
public String getTenantId() {
return tenantId;
}
public String getTenantIdLike() {
return tenantIdLike;
}
public boolean isWithoutTenantId() {
return withoutTenantId;
}
public String getNameLikeIgnoreCase() {
return nameLikeIgnoreCase;
}
public List<HistoricProcessInstanceQueryImpl> getOrQueryObjects() {
return orQueryObjects;
}
}
|
repos\flowable-engine-main\modules\flowable5-engine\src\main\java\org\activiti\engine\impl\HistoricProcessInstanceQueryImpl.java
| 1
|
请完成以下Java代码
|
public Collection<BPartnerContact> getUnusedContacts()
{
return id2UnusedContact.values();
}
public void resetDefaultContactFlags()
{
for (final BPartnerContact bpartnerContact : getUnusedContacts())
{
bpartnerContact.getContactType().setDefaultContact(false);
}
}
public void resetShipToDefaultFlags()
{
for (final BPartnerContact bpartnerContact : getUnusedContacts())
{
bpartnerContact.getContactType().setShipToDefault(false);
}
}
public void resetPurchaseDefaultFlags()
{
for (final BPartnerContact bpartnerContact : getUnusedContacts())
{
bpartnerContact.getContactType().setPurchaseDefault(false);
}
}
|
public void resetSalesDefaultFlags()
{
for (final BPartnerContact bpartnerContact : getUnusedContacts())
{
bpartnerContact.getContactType().setSalesDefault(false);
}
}
public void resetBillToDefaultFlags()
{
for (final BPartnerContact bpartnerContact : getUnusedContacts())
{
bpartnerContact.getContactType().setBillToDefault(false);
}
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.business.rest-api-impl\src\main\java\de\metas\rest_api\v1\bpartner\bpartnercomposite\jsonpersister\ShortTermContactIndex.java
| 1
|
请完成以下Java代码
|
public int getSubProducer_BPartner_ID()
{
return get_ValueAsInt(COLUMNNAME_SubProducer_BPartner_ID);
}
/**
* SubProducerBPartner_Value AD_Reference_ID=138
* Reference name: C_BPartner (Trx)
*/
public static final int SUBPRODUCERBPARTNER_VALUE_AD_Reference_ID=138;
@Override
public void setSubProducerBPartner_Value (final @Nullable java.lang.String SubProducerBPartner_Value)
{
set_Value (COLUMNNAME_SubProducerBPartner_Value, SubProducerBPartner_Value);
}
@Override
public java.lang.String getSubProducerBPartner_Value()
{
return get_ValueAsString(COLUMNNAME_SubProducerBPartner_Value);
}
@Override
public void setTE (final @Nullable java.lang.String TE)
{
set_Value (COLUMNNAME_TE, TE);
}
@Override
public java.lang.String getTE()
{
return get_ValueAsString(COLUMNNAME_TE);
}
@Override
public void setUPC (final @Nullable java.lang.String UPC)
{
set_Value (COLUMNNAME_UPC, UPC);
}
@Override
public java.lang.String getUPC()
{
return get_ValueAsString(COLUMNNAME_UPC);
}
@Override
public void setWarehouseLocatorIdentifier (final @Nullable java.lang.String WarehouseLocatorIdentifier)
{
set_Value (COLUMNNAME_WarehouseLocatorIdentifier, WarehouseLocatorIdentifier);
}
@Override
public java.lang.String getWarehouseLocatorIdentifier()
{
return get_ValueAsString(COLUMNNAME_WarehouseLocatorIdentifier);
}
@Override
|
public void setWarehouseValue (final @Nullable java.lang.String WarehouseValue)
{
set_Value (COLUMNNAME_WarehouseValue, WarehouseValue);
}
@Override
public java.lang.String getWarehouseValue()
{
return get_ValueAsString(COLUMNNAME_WarehouseValue);
}
@Override
public void setX (final @Nullable java.lang.String X)
{
set_Value (COLUMNNAME_X, X);
}
@Override
public java.lang.String getX()
{
return get_ValueAsString(COLUMNNAME_X);
}
@Override
public void setX1 (final @Nullable java.lang.String X1)
{
set_Value (COLUMNNAME_X1, X1);
}
@Override
public java.lang.String getX1()
{
return get_ValueAsString(COLUMNNAME_X1);
}
@Override
public void setY (final @Nullable java.lang.String Y)
{
set_Value (COLUMNNAME_Y, Y);
}
@Override
public java.lang.String getY()
{
return get_ValueAsString(COLUMNNAME_Y);
}
@Override
public void setZ (final @Nullable java.lang.String Z)
{
set_Value (COLUMNNAME_Z, Z);
}
@Override
public java.lang.String getZ()
{
return get_ValueAsString(COLUMNNAME_Z);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_I_Inventory.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public void createNewUser() {
try {
LOGGER.info("Creating new user");
FacesContext context = FacesContext.getCurrentInstance();
boolean operationStatus = userDao.createUser(userName);
context.isValidationFailed();
if (operationStatus) {
operationMessage = "User " + userName + " created";
}
} catch (Exception ex) {
LOGGER.error("Error registering new user ");
ex.printStackTrace();
operationMessage = "Error " + userName + " not created";
}
}
public String getUserName() {
return userName;
}
public void setUserName(String userName) {
this.userName = userName;
}
|
public void setUserDao(UserManagementDAO userDao) {
this.userDao = userDao;
}
public UserManagementDAO getUserDao() {
return this.userDao;
}
public String getOperationMessage() {
return operationMessage;
}
public void setOperationMessage(String operationMessage) {
this.operationMessage = operationMessage;
}
}
|
repos\tutorials-master\web-modules\jsf\src\main\java\com\baeldung\springintegration\controllers\RegistrationBean.java
| 2
|
请完成以下Java代码
|
public java.lang.String getTaxID()
{
return get_ValueAsString(COLUMNNAME_TaxID);
}
@Override
public void setTitle (final @Nullable java.lang.String Title)
{
set_Value (COLUMNNAME_Title, Title);
}
@Override
public java.lang.String getTitle()
{
return get_ValueAsString(COLUMNNAME_Title);
}
@Override
public void setVolume (final @Nullable BigDecimal Volume)
{
set_Value (COLUMNNAME_Volume, Volume);
}
@Override
public BigDecimal getVolume()
{
final BigDecimal bd = get_ValueAsBigDecimal(COLUMNNAME_Volume);
return bd != null ? bd : BigDecimal.ZERO;
}
@Override
public org.compiere.model.I_C_Location getWarehouse_Location()
{
return get_ValueAsPO(COLUMNNAME_Warehouse_Location_ID, org.compiere.model.I_C_Location.class);
}
@Override
public void setWarehouse_Location(final org.compiere.model.I_C_Location Warehouse_Location)
{
set_ValueFromPO(COLUMNNAME_Warehouse_Location_ID, org.compiere.model.I_C_Location.class, Warehouse_Location);
}
|
@Override
public void setWarehouse_Location_ID (final int Warehouse_Location_ID)
{
if (Warehouse_Location_ID < 1)
set_Value (COLUMNNAME_Warehouse_Location_ID, null);
else
set_Value (COLUMNNAME_Warehouse_Location_ID, Warehouse_Location_ID);
}
@Override
public int getWarehouse_Location_ID()
{
return get_ValueAsInt(COLUMNNAME_Warehouse_Location_ID);
}
@Override
public void setWeight (final @Nullable BigDecimal Weight)
{
set_Value (COLUMNNAME_Weight, Weight);
}
@Override
public BigDecimal getWeight()
{
final BigDecimal bd = get_ValueAsBigDecimal(COLUMNNAME_Weight);
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_Order_Header_v.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public class UnacquireExternalWorkerJobCmd implements Command<Void> {
protected final String jobId;
protected final String workerId;
protected final JobServiceConfiguration jobServiceConfiguration;
public UnacquireExternalWorkerJobCmd(String jobId, String workerId, JobServiceConfiguration jobServiceConfiguration) {
this.jobId = jobId;
this.workerId = workerId;
this.jobServiceConfiguration = jobServiceConfiguration;
}
@Override
public Void execute(CommandContext commandContext) {
if (StringUtils.isEmpty(jobId)) {
throw new FlowableIllegalArgumentException("job id must not be empty");
}
if (StringUtils.isEmpty(workerId)) {
throw new FlowableIllegalArgumentException("worker id must not be empty");
}
ExternalWorkerJobEntityManager externalWorkerJobEntityManager = jobServiceConfiguration.getExternalWorkerJobEntityManager();
ExternalWorkerJobEntity jobEntity = externalWorkerJobEntityManager.findById(jobId);
|
if (jobEntity == null) {
throw new FlowableException("Could not find job for id " + jobId);
}
if (!jobEntity.getLockOwner().equals(workerId)) {
throw new FlowableException(jobEntity + " is locked with a different worker id");
}
jobEntity.setLockExpirationTime(null);
jobEntity.setLockOwner(null);
externalWorkerJobEntityManager.update(jobEntity);
if (jobEntity.isExclusive()) {
new UnlockExclusiveJobCmd(jobEntity, jobServiceConfiguration).execute(commandContext);
}
return null;
}
}
|
repos\flowable-engine-main\modules\flowable-job-service\src\main\java\org\flowable\job\service\impl\cmd\UnacquireExternalWorkerJobCmd.java
| 2
|
请完成以下Java代码
|
public static Message ofMissingADMessage(@Nullable final String text)
{
final String textNorm = StringUtils.trimBlankToNull(text);
if (textNorm == null)
{
return EMPTY;
}
return new Message(
null,
AdMessageKey.of(textNorm),
ImmutableTranslatableString.ofDefaultValue(text),
null,
true,
null);
}
@Nullable @Getter private final AdMessageId adMessageId;
@NonNull @Getter private final AdMessageKey adMessage;
@NonNull private final ITranslatableString msgText;
@Nullable private final ITranslatableString msgTip;
@NonNull private final ITranslatableString msgTextAndTip;
@Getter private final boolean missing;
@Getter @Nullable private String errorCode;
private Message(
@Nullable final AdMessageId adMessageId,
@NonNull final AdMessageKey adMessage,
@NonNull final ImmutableTranslatableString msgText,
@Nullable final ImmutableTranslatableString msgTip,
final boolean missing,
@Nullable final String errorCode)
{
this.adMessageId = adMessageId;
this.adMessage = adMessage;
this.msgText = msgText;
this.msgTip = msgTip;
if (!TranslatableStrings.isBlank(this.msgTip)) // messageTip on next line, if exists
{
this.msgTextAndTip = TranslatableStrings.builder()
.append(this.msgText)
.append(SEPARATOR)
.append(this.msgTip)
.build();
}
else
{
this.msgTextAndTip = msgText;
|
}
this.missing = missing;
this.errorCode = errorCode;
}
private Message()
{
this.adMessageId = null;
this.adMessage = EMPTY_AD_Message;
this.msgText = TranslatableStrings.empty();
this.msgTip = null;
this.msgTextAndTip = this.msgText;
this.missing = true;
}
public String getMsgText(@NonNull final String adLanguage)
{
return msgText.translate(adLanguage);
}
public String getMsgTip(@NonNull final String adLanguage)
{
return msgTip != null ? msgTip.translate(adLanguage) : "";
}
public String getMsgTextAndTip(@NonNull final String adLanguage)
{
return msgTextAndTip.translate(adLanguage);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\de\metas\i18n\Message.java
| 1
|
请完成以下Java代码
|
protected void init(String text, Icon icon) {
// substitutes the underlying checkbox model:
// if we had call setModel an exception would be raised
// because setModel calls a getModel that return a
// QuadristateButtonModel, but at this point we
// have a JToggleButtonModel
this.model = new QuadristateButtonModel();
super.setModel(this.model); // side effect: set listeners
super.init(text, icon);
}
@Override
public QuadristateButtonModel getModel() {
return (QuadristateButtonModel) super.getModel();
}
public void setModel(QuadristateButtonModel model) {
super.setModel(model);
}
@Override
@Deprecated
public void setModel(ButtonModel model) {
// if (!(model instanceof TristateButtonModel))
// useless: Java always calls the most specific method
super.setModel(model);
}
|
/** No one may add mouse listeners, not even Swing! */
@Override
public void addMouseListener(MouseListener l) {
}
/**
* Set the new state to either CHECKED, UNCHECKED or GREY_CHECKED. If
* state == null, it is treated as GREY_CHECKED.
*/
public void setState(State state) {
getModel().setState(state);
}
/**
* Return the current state, which is determined by the selection status
* of the model.
*/
public State getState() {
return getModel().getState();
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.manufacturing\src\main\java\it\cnr\imaa\essi\lablib\gui\checkboxtree\QuadristateCheckbox.java
| 1
|
请完成以下Java代码
|
public void handleEvent(@NonNull final PPOrderCandidateRequestedEvent event)
{
final I_PP_Order_Candidate createdCandidate = createProductionOrderCandidate(event);
if (event.isDirectlyCreatePPOrder())
{
final ImmutableList<PPOrderCandidateId> ppOrderCandidateIds = ImmutableList.of(PPOrderCandidateId.ofRepoId(createdCandidate.getPP_Order_Candidate_ID()));
final PPOrderCandidateEnqueuer.Result result = ppOrderCandidateEnqueuer.enqueueCandidateIds(ppOrderCandidateIds);
Check.errorIf(result.getEnqueuedPackagesCount() != 1, "Couldn't enqueue workpackage for PPOrder creation!, event: {}", event);
}
}
/**
* Creates a production order candidate.
*/
@VisibleForTesting
I_PP_Order_Candidate createProductionOrderCandidate(@NonNull final PPOrderCandidateRequestedEvent ppOrderCandidateRequestedEvent)
{
final PPOrderData ppOrderData = ppOrderCandidateRequestedEvent.getPpOrderCandidate().getPpOrderData();
final ProductId productId = ProductId.ofRepoId(ppOrderData.getProductDescriptor().getProductId());
final Quantity qtyRequired = Quantity.of(ppOrderData.getQtyRequired(), productBL.getStockUOM(productId));
final String traceId = ppOrderCandidateRequestedEvent.getTraceId();
|
final boolean isSimulated = ppOrderCandidateRequestedEvent.getPpOrderCandidate().isSimulated();
return ppOrderCandidateService.createUpdateCandidate(PPOrderCandidateCreateUpdateRequest.builder()
.clientAndOrgId(ppOrderData.getClientAndOrgId())
.productPlanningId(ProductPlanningId.ofRepoIdOrNull(ppOrderData.getProductPlanningId()))
.materialDispoGroupId(ppOrderData.getMaterialDispoGroupId())
.plantId(ppOrderData.getPlantId())
.warehouseId(ppOrderData.getWarehouseId())
.productId(productId)
.attributeSetInstanceId(AttributeSetInstanceId.ofRepoIdOrNone(ppOrderData.getProductDescriptor().getAttributeSetInstanceId()))
.qtyRequired(qtyRequired)
.datePromised(ppOrderData.getDatePromised())
.dateStartSchedule(ppOrderData.getDateStartSchedule())
.salesOrderLineId(OrderLineId.ofRepoIdOrNull(ppOrderData.getOrderLineIdAsRepoId()))
.shipmentScheduleId(ShipmentScheduleId.ofRepoIdOrNull(ppOrderData.getShipmentScheduleIdAsRepoId()))
.simulated(isSimulated)
.traceId(traceId)
.packingMaterialId(ppOrderData.getPackingMaterialId())
.build());
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.manufacturing\src\main\java\org\eevolution\event\PPOrderCandidateRequestedEventHandler.java
| 1
|
请完成以下Java代码
|
public Map<String, Object> process(Map<String, Object> inputParams) {
// inputParams: {"bizData":"/xxxx/xxxx/xxxx/xxxx.xls"}
try {
String filePath = (String) inputParams.get("bizData");
if (filePath == null || filePath.isEmpty()) {
throw new IllegalArgumentException("File path is empty");
}
File excelFile = new File(filePath);
if (!excelFile.exists() || !excelFile.isFile()) {
throw new IllegalArgumentException("File not found: " + filePath);
}
// Since we don't know the target entity class, we'll read the Excel generically
return readExcelData(excelFile);
} catch (Exception e) {
log.error("Error processing Excel file", e);
throw new JeecgBootBizTipException("调用java增强失败", e);
}
}
/**
* Excel导入工具方法,基于ExcelImportUtil
*
* @param file Excel文件
* @return Excel读取结果,包含字段和数据
* @throws Exception 导入过程中的异常
*/
public static Map<String, Object> readExcelData(File file) throws Exception {
Map<String, Object> result = new HashMap<>();
|
// 设置导入参数
ImportParams params = new ImportParams();
params.setTitleRows(0); // 没有标题
params.setHeadRows(1); // 第一行是表头
// 读取Excel数据
List<Map<String, Object>> dataList = ExcelImportUtil.importExcel(file, Map.class, params);
// 如果没有数据,返回空结果
if (dataList == null || dataList.isEmpty()) {
result.put("fields", new ArrayList<>());
result.put("datas", new ArrayList<>());
return result;
}
// 从第一行数据中获取字段名
List<String> fieldNames = new ArrayList<>(dataList.get(0).keySet());
result.put("fields", fieldNames);
result.put("datas", dataList);
return result;
}
}
|
repos\JeecgBoot-main\jeecg-boot\jeecg-boot-module\jeecg-boot-module-airag\src\main\java\org\jeecg\modules\airag\demo\JimuDataReader.java
| 1
|
请完成以下Java代码
|
public boolean isCreateNewRecord()
{
boolean createNewRecord = true;
for (final IGridTabRowBuilder builder : builders)
{
if (!builder.isValid())
{
createNewRecord = false;
continue;
}
if (!builder.isCreateNewRecord())
{
createNewRecord = false;
}
}
return createNewRecord;
}
/**
* @return true if at least one builder is valid
*/
@Override
public boolean isValid()
{
for (final IGridTabRowBuilder builder : builders)
{
if (builder.isValid())
{
return true;
}
}
|
return false;
}
@Override
public void setSource(Object model)
{
for (final IGridTabRowBuilder builder : builders)
{
builder.setSource(model);
}
}
@Override
public String toString()
{
return ObjectUtils.toString(this);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\org\compiere\apps\search\impl\CompositeGridTabRowBuilder.java
| 1
|
请完成以下Java代码
|
public String getViewIdPart()
{
return parts.get(1);
}
/**
* @return other parts (those which come after viewId part)
*/
@JsonIgnore // IMPORTANT: for some reason, without this annotation the json deserialization does not work even if we have toJson() method annotated with @JsonValue
public ImmutableList<String> getOtherParts()
{
return parts.size() > 2 ? parts.subList(2, parts.size()) : ImmutableList.of();
}
public ViewId withWindowId(@NonNull final WindowId newWindowId)
{
if (windowId.equals(newWindowId))
{
return this;
}
final ImmutableList<String> newParts = ImmutableList.<String>builder()
.add(newWindowId.toJson())
.addAll(parts.subList(1, parts.size()))
.build();
|
final String newViewId = JOINER.join(newParts);
return new ViewId(newViewId, newParts, newWindowId);
}
public void assertWindowId(@NonNull final WindowId expectedWindowId)
{
if (!windowId.equals(expectedWindowId))
{
throw new AdempiereException("" + this + " does not have expected windowId: " + expectedWindowId);
}
}
public static boolean equals(@Nullable final ViewId id1, @Nullable final ViewId id2)
{
return Objects.equals(id1, id2);
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.ui.web.base\src\main\java\de\metas\ui\web\view\ViewId.java
| 1
|
请完成以下Java代码
|
protected DmnDecisionLogicEvaluationHandler getDecisionEvaluationHandler(DmnDecision decision) {
Class<? extends DmnDecisionLogic> key = decision.getDecisionLogic().getClass();
if (evaluationHandlers.containsKey(key)) {
return evaluationHandlers.get(key);
} else {
throw LOG.decisionLogicTypeNotSupported(decision.getDecisionLogic());
}
}
protected void addResultToVariableContext(DmnDecisionResult evaluatedResult, VariableMap variableMap, DmnDecision evaluatedDecision) {
List<Map<String, Object>> resultList = evaluatedResult.getResultList();
if (resultList.isEmpty()) {
return;
} else if (resultList.size() == 1 && !isDecisionTableWithCollectOrRuleOrderHitPolicy(evaluatedDecision)) {
variableMap.putAll(evaluatedResult.getSingleResult());
} else {
Set<String> outputs = new HashSet<String>();
for (Map<String, Object> resultMap : resultList) {
outputs.addAll(resultMap.keySet());
}
for (String output : outputs) {
List<Object> values = evaluatedResult.collectEntries(output);
variableMap.put(output, values);
}
}
}
protected boolean isDecisionTableWithCollectOrRuleOrderHitPolicy(DmnDecision evaluatedDecision) {
boolean isDecisionTableWithCollectHitPolicy = false;
if (evaluatedDecision.isDecisionTable()) {
DmnDecisionTableImpl decisionTable = (DmnDecisionTableImpl) evaluatedDecision.getDecisionLogic();
isDecisionTableWithCollectHitPolicy = COLLECT_HIT_POLICY.equals(decisionTable.getHitPolicyHandler().getHitPolicyEntry())
|| RULE_ORDER_HIT_POLICY.equals(decisionTable.getHitPolicyHandler().getHitPolicyEntry());
}
return isDecisionTableWithCollectHitPolicy;
}
protected void generateDecisionEvaluationEvent(List<DmnDecisionLogicEvaluationEvent> evaluatedEvents) {
|
DmnDecisionLogicEvaluationEvent rootEvaluatedEvent = null;
DmnDecisionEvaluationEventImpl decisionEvaluationEvent = new DmnDecisionEvaluationEventImpl();
long executedDecisionElements = 0L;
for(DmnDecisionLogicEvaluationEvent evaluatedEvent: evaluatedEvents) {
executedDecisionElements += evaluatedEvent.getExecutedDecisionElements();
rootEvaluatedEvent = evaluatedEvent;
}
decisionEvaluationEvent.setDecisionResult(rootEvaluatedEvent);
decisionEvaluationEvent.setExecutedDecisionInstances(evaluatedEvents.size());
decisionEvaluationEvent.setExecutedDecisionElements(executedDecisionElements);
evaluatedEvents.remove(rootEvaluatedEvent);
decisionEvaluationEvent.setRequiredDecisionResults(evaluatedEvents);
for (DmnDecisionEvaluationListener evaluationListener : evaluationListeners) {
evaluationListener.notify(decisionEvaluationEvent);
}
}
}
|
repos\camunda-bpm-platform-master\engine-dmn\engine\src\main\java\org\camunda\bpm\dmn\engine\impl\DefaultDmnDecisionContext.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
public class BookstoreService {
private final AuthorRepository authorRepository;
private final BookRepository bookRepository;
public BookstoreService(AuthorRepository authorRepository,
BookRepository bookRepository) {
this.authorRepository = authorRepository;
this.bookRepository = bookRepository;
}
@Transactional
public void softDeleteBook() {
Author author = authorRepository.findById(4L).get();
Book book = author.getBooks().get(0);
author.removeBook(book);
}
@Transactional
public void softDeleteAuthor() {
Author author = authorRepository.findById(1L).get();
authorRepository.delete(author);
}
@Transactional
public void restoreBook() {
bookRepository.restoreById(1L);
}
@Transactional
public void restoreAuthor() {
authorRepository.restoreById(1L);
bookRepository.restoreByAuthorId(1L);
}
public void displayAllExceptDeletedAuthors() {
List<Author> authors = authorRepository.findAll();
System.out.println("\nAll authors except deleted:");
authors.forEach(a -> System.out.println("Author name: " + a.getName()));
System.out.println();
|
}
public void displayAllIncludeDeletedAuthors() {
List<Author> authors = authorRepository.findAllIncludingDeleted();
System.out.println("\nAll authors including deleted:");
authors.forEach(a -> System.out.println("Author name: " + a.getName()));
System.out.println();
}
public void displayAllOnlyDeletedAuthors() {
List<Author> authors = authorRepository.findAllOnlyDeleted();
System.out.println("\nAll deleted authors:");
authors.forEach(a -> System.out.println("Author name: " + a.getName()));
System.out.println();
}
public void displayAllExceptDeletedBooks() {
List<Book> books = bookRepository.findAll();
System.out.println("\nAll books except deleted:");
books.forEach(b -> System.out.println("Book title: " + b.getTitle()));
System.out.println();
}
public void displayAllIncludeDeletedBooks() {
List<Book> books = bookRepository.findAllIncludingDeleted();
System.out.println("\nAll books including deleted:");
books.forEach(b -> System.out.println("Book title: " + b.getTitle()));
System.out.println();
}
public void displayAllOnlyDeletedBooks() {
List<Book> books = bookRepository.findAllOnlyDeleted();
System.out.println("\nAll deleted books:");
books.forEach(b -> System.out.println("Book title: " + b.getTitle()));
System.out.println();
}
}
|
repos\Hibernate-SpringBoot-master\HibernateSpringBootSoftDeletes\src\main\java\com\bookstore\service\BookstoreService.java
| 2
|
请完成以下Java代码
|
public void useResource() {
// using the resource here
resource.use();
}
@Override
public void close() {
// perform actions to close all underlying resources
this.cleanable.clean();
}
static class CleaningState implements Runnable {
CleaningState() {
// constructor
}
@Override
|
public void run() {
// some cleanup action
System.out.println("Cleanup done");
}
}
static class Resource {
void use() {
System.out.println("Using the resource");
}
void close() {
System.out.println("Cleanup done");
}
}
}
|
repos\tutorials-master\core-java-modules\core-java-18\src\main\java\com\baeldung\finalization_closeable_cleaner\MyCleanerResourceClass.java
| 1
|
请完成以下Java代码
|
public String getProcessDefinitionId() {
return processDefinitionId;
}
public void setProcessDefinitionId(String processDefinitionId) {
this.processDefinitionId = processDefinitionId;
}
@Override
public String getActivityId() {
return activityId;
}
public void setActivityId(String activityId) {
this.activityId = activityId;
}
@Override
public String getJobType() {
return jobType;
}
public void setJobType(String jobType) {
this.jobType = jobType;
}
@Override
public String getJobConfiguration() {
return jobConfiguration;
}
public void setJobConfiguration(String jobConfiguration) {
this.jobConfiguration = jobConfiguration;
}
@Override
public String getProcessDefinitionKey() {
return processDefinitionKey;
}
public void setProcessDefinitionKey(String processDefinitionKey) {
this.processDefinitionKey = processDefinitionKey;
}
public int getSuspensionState() {
return suspensionState;
}
public void setSuspensionState(int state) {
this.suspensionState = state;
}
public Long getOverridingJobPriority() {
return jobPriority;
}
public void setJobPriority(Long jobPriority) {
this.jobPriority = jobPriority;
|
}
public String getTenantId() {
return tenantId;
}
public void setTenantId(String tenantId) {
this.tenantId = tenantId;
}
public String getDeploymentId() {
return deploymentId;
}
public void setDeploymentId(String deploymentId) {
this.deploymentId = deploymentId;
}
@Override
public Set<String> getReferencedEntityIds() {
Set<String> referencedEntityIds = new HashSet<>();
return referencedEntityIds;
}
@Override
public Map<String, Class> getReferencedEntitiesIdAndClass() {
Map<String, Class> referenceIdAndClass = new HashMap<>();
return referenceIdAndClass;
}
}
|
repos\camunda-bpm-platform-master\engine\src\main\java\org\camunda\bpm\engine\impl\persistence\entity\JobDefinitionEntity.java
| 1
|
请完成以下Java代码
|
public class TbProtoQueueMsg<T extends com.google.protobuf.GeneratedMessageV3> implements TbQueueMsg {
private final UUID key;
protected final T value;
private final TbQueueMsgHeaders headers;
public TbProtoQueueMsg(UUID key, T value) {
this(key, value, new DefaultTbQueueMsgHeaders());
}
public TbProtoQueueMsg(UUID key, T value, TbQueueMsgHeaders headers) {
this.key = key;
this.value = value;
this.headers = headers;
}
@Override
|
public UUID getKey() {
return key;
}
@Override
public TbQueueMsgHeaders getHeaders() {
return headers;
}
@Override
public byte[] getData() {
return value != null ? value.toByteArray() : null;
}
}
|
repos\thingsboard-master\common\queue\src\main\java\org\thingsboard\server\queue\common\TbProtoQueueMsg.java
| 1
|
请完成以下Java代码
|
public static DetailId fromAD_Tab_ID(@NonNull final AdTabId adTabId)
{
return new DetailId(PREFIX_AD_TAB_ID, adTabId.getRepoId());
}
public static DetailId fromPrefixAndId(final String prefix, final int id)
{
return new DetailId(prefix, id);
}
@JsonCreator
@Nullable
public static DetailId fromJson(@Nullable final String json)
{
if (json == null)
{
return null;
}
final String jsonToUse = json.trim();
if (jsonToUse.isEmpty())
{
return null;
}
final String[] prefixAndId = jsonToUse.split(PARTS_SEPARATOR);
Check.assume(prefixAndId.length == 2, "The given json needs to consist of a prefix and the actual ID, separated by {}; json={}", PARTS_SEPARATOR, json);
final String prefix = prefixAndId[0];
final int idInt = Integer.parseInt(prefixAndId[1]);
return DetailId.fromPrefixAndId(prefix, idInt);
}
@Nullable
public static String toJson(@Nullable final DetailId detailId)
{
return detailId == null ? null : (detailId.idPrefix + PARTS_SEPARATOR + detailId.idInt);
}
public static Set<String> toJson(@Nullable final Collection<DetailId> detailIds)
{
if (detailIds == null || detailIds.isEmpty())
{
return ImmutableSet.of();
}
return detailIds.stream().map(detailId -> detailId.toJson()).collect(GuavaCollectors.toImmutableSet());
}
@Getter
private final String idPrefix;
@Getter
private final int idInt;
private transient String _tableAlias = null; // lazy
private DetailId(@NonNull final String idPrefix, final int idInt)
{
assumeNotEmpty(idPrefix, "idPrefix");
Check.assume(!idPrefix.contains(PARTS_SEPARATOR), "The given prefix may not contain the the parts-separator={}; prefix={}", PARTS_SEPARATOR, idPrefix);
this.idPrefix = idPrefix;
this.idInt = idInt;
}
@Override
public String toString()
{
return toJson(this);
}
@JsonValue
public String toJson()
{
return toJson(this);
}
public String getTableAlias()
{
String tableAlias = this._tableAlias;
if (tableAlias == null)
{
tableAlias = this._tableAlias = "d" + idInt;
}
return tableAlias;
|
}
@Nullable
public AdTabId toAdTabId()
{
if (PREFIX_AD_TAB_ID.equals(idPrefix))
{
return AdTabId.ofRepoId(idInt);
}
return null;
}
@Override
public int compareTo(@Nullable final DetailId o)
{
if (o == null)
{
return 1;
}
return Objects.compare(toJson(), o.toJson(), Comparator.naturalOrder());
}
public static boolean equals(@Nullable final DetailId o1, @Nullable final DetailId o2)
{
return Objects.equals(o1, o2);
}
public int getIdIntAssumingPrefix(@NonNull final String expectedPrefix)
{
assertIdPrefix(expectedPrefix);
return getIdInt();
}
private void assertIdPrefix(@NonNull final String expectedPrefix)
{
if (!expectedPrefix.equals(idPrefix))
{
throw new AdempiereException("Expected id prefix `" + expectedPrefix + "` for " + this);
}
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.ui.web.base\src\main\java\de\metas\ui\web\window\descriptor\DetailId.java
| 1
|
请完成以下Java代码
|
public void setLogoutHandlers(LogoutHandler[] handlers) {
this.handlers = new CompositeLogoutHandler(handlers);
}
/**
* Set list of {@link LogoutHandler}
* @param handlers list of {@link LogoutHandler}
* @since 5.2.0
*/
public void setLogoutHandlers(List<LogoutHandler> handlers) {
this.handlers = new CompositeLogoutHandler(handlers);
}
/**
* Sets the {@link RedirectStrategy} used with
* {@link #ConcurrentSessionFilter(SessionRegistry, String)}
* @param redirectStrategy the {@link RedirectStrategy} to use
* @deprecated use
* {@link #ConcurrentSessionFilter(SessionRegistry, SessionInformationExpiredStrategy)}
* instead.
*/
@Deprecated
public void setRedirectStrategy(RedirectStrategy redirectStrategy) {
Assert.notNull(redirectStrategy, "redirectStrategy cannot be null");
this.redirectStrategy = redirectStrategy;
}
/**
* A {@link SessionInformationExpiredStrategy} that writes an error message to the
* response body.
|
*
* @author Rob Winch
* @since 4.2
*/
private static final class ResponseBodySessionInformationExpiredStrategy
implements SessionInformationExpiredStrategy {
@Override
public void onExpiredSessionDetected(SessionInformationExpiredEvent event) throws IOException {
HttpServletResponse response = event.getResponse();
response.getWriter()
.print("This session has been expired (possibly due to multiple concurrent "
+ "logins being attempted as the same user).");
response.flushBuffer();
}
}
}
|
repos\spring-security-main\web\src\main\java\org\springframework\security\web\session\ConcurrentSessionFilter.java
| 1
|
请完成以下Java代码
|
private static @Nullable String getTokenValue(String actualToken, String token) {
byte[] actualBytes;
try {
actualBytes = Base64.getUrlDecoder().decode(actualToken);
}
catch (Exception ex) {
logger.trace(LogMessage.format("Not returning the CSRF token since it's not Base64-encoded"), ex);
return null;
}
byte[] tokenBytes = Utf8.encode(token);
int tokenSize = tokenBytes.length;
if (actualBytes.length != tokenSize * 2) {
logger.trace(LogMessage.format(
"Not returning the CSRF token since its Base64-decoded length (%d) is not equal to (%d)",
actualBytes.length, tokenSize * 2));
return null;
}
// extract token and random bytes
byte[] xoredCsrf = new byte[tokenSize];
byte[] randomBytes = new byte[tokenSize];
System.arraycopy(actualBytes, 0, randomBytes, 0, tokenSize);
System.arraycopy(actualBytes, tokenSize, xoredCsrf, 0, tokenSize);
byte[] csrfBytes = xorCsrf(randomBytes, xoredCsrf);
return Utf8.decode(csrfBytes);
}
private static String createXoredCsrfToken(SecureRandom secureRandom, String token) {
byte[] tokenBytes = Utf8.encode(token);
byte[] randomBytes = new byte[tokenBytes.length];
secureRandom.nextBytes(randomBytes);
byte[] xoredBytes = xorCsrf(randomBytes, tokenBytes);
byte[] combinedBytes = new byte[tokenBytes.length + randomBytes.length];
System.arraycopy(randomBytes, 0, combinedBytes, 0, randomBytes.length);
System.arraycopy(xoredBytes, 0, combinedBytes, randomBytes.length, xoredBytes.length);
return Base64.getUrlEncoder().encodeToString(combinedBytes);
}
|
private static byte[] xorCsrf(byte[] randomBytes, byte[] csrfBytes) {
Assert.isTrue(randomBytes.length == csrfBytes.length, "arrays must be equal length");
int len = csrfBytes.length;
byte[] xoredCsrf = new byte[len];
System.arraycopy(csrfBytes, 0, xoredCsrf, 0, len);
for (int i = 0; i < len; i++) {
xoredCsrf[i] ^= randomBytes[i];
}
return xoredCsrf;
}
private static final class CachedCsrfTokenSupplier implements Supplier<CsrfToken> {
private final Supplier<CsrfToken> delegate;
private @Nullable CsrfToken csrfToken;
private CachedCsrfTokenSupplier(Supplier<CsrfToken> delegate) {
this.delegate = delegate;
}
@Override
public CsrfToken get() {
if (this.csrfToken == null) {
this.csrfToken = this.delegate.get();
}
return this.csrfToken;
}
}
}
|
repos\spring-security-main\web\src\main\java\org\springframework\security\web\csrf\XorCsrfTokenRequestAttributeHandler.java
| 1
|
请完成以下Java代码
|
public class RunnableCompletionCheckerWithThreadPoolExecutor {
private static final Logger LOGGER = LoggerFactory.getLogger(RunnableCompletionCheckerWithThreadPoolExecutor.class);
private static final int NUMBER_OF_RUNNABLES = 5;
private static final int PAUSE_MILLIS = 1000;
private static final int NUMBER_OF_THREADS = 5;
private static Runnable RUNNABLE = () -> {
try {
LOGGER.info("launching runnable");
Thread.sleep(PAUSE_MILLIS);
} catch (InterruptedException e) {
}
};
public static void main(String args[]) throws InterruptedException {
List<Runnable> runnables = IntStream.range(0, NUMBER_OF_RUNNABLES)
.mapToObj(x -> RUNNABLE)
.collect(Collectors.toList());
ThreadPoolExecutor executor = createThreadPoolExecutor(runnables);
executor.shutdown();
LOGGER.info("After a timeout of 0 seconds, every Runnable is done: {}", isEveryRunnableDone(executor, 0));
|
Thread.sleep(100);
LOGGER.info("After a timeout of 100 milliseconds, every Runnable is done: {}", isEveryRunnableDone(executor, 100));
Thread.sleep(2000);
LOGGER.info("After a timeout of 2 seconds, every Runnable is done: {}", isEveryRunnableDone(executor, 1500));
}
public static ThreadPoolExecutor createThreadPoolExecutor(List<Runnable> runnables) {
ThreadPoolExecutor executor = (ThreadPoolExecutor) Executors.newFixedThreadPool(NUMBER_OF_THREADS);
runnables.forEach(executor::execute);
return executor;
}
public static boolean isEveryRunnableDone(ThreadPoolExecutor executor, int timeout) throws InterruptedException {
return executor.awaitTermination(timeout, TimeUnit.MILLISECONDS);
}
}
|
repos\tutorials-master\core-java-modules\core-java-concurrency-2\src\main\java\com\baeldung\donerunnables\RunnableCompletionCheckerWithThreadPoolExecutor.java
| 1
|
请完成以下Java代码
|
public List<VerfuegbarkeitsantwortArtikel> getArtikel() {
if (artikel == null) {
artikel = new ArrayList<VerfuegbarkeitsantwortArtikel>();
}
return this.artikel;
}
/**
* Gets the value of the id property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getId() {
return id;
}
/**
* Sets the value of the id property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setId(String value) {
this.id = value;
}
|
/**
* Gets the value of the rTyp property.
*
* @return
* possible object is
* {@link VerfuegbarkeitTyp }
*
*/
public VerfuegbarkeitTyp getRTyp() {
return rTyp;
}
/**
* Sets the value of the rTyp property.
*
* @param value
* allowed object is
* {@link VerfuegbarkeitTyp }
*
*/
public void setRTyp(VerfuegbarkeitTyp value) {
this.rTyp = value;
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.vertical.pharma.msv3.schema.v1\src\main\java-xjc\de\metas\vertical\pharma\vendor\gateway\msv3\schema\v1\VerfuegbarkeitsanfrageEinzelneAntwort.java
| 1
|
请在Spring Boot框架中完成以下Java代码
|
private static IDataScopeClient getDataScopeClient() {
if (dataScopeClient == null) {
dataScopeClient = SpringUtil.getBean(IDataScopeClient.class);
}
return dataScopeClient;
}
/**
* 获取数据权限
*
* @param mapperId 数据权限mapperId
* @param roleId 用户角色集合
* @return DataScopeModel
*/
public static DataScopeModel getDataScopeByMapper(String mapperId, String roleId) {
DataScopeModel dataScope = CacheUtil.get(SYS_CACHE, SCOPE_CACHE_CLASS, mapperId + StringPool.COLON + roleId, DataScopeModel.class);
if (dataScope == null || !dataScope.getSearched()) {
dataScope = getDataScopeClient().getDataScopeByMapper(mapperId, roleId);
CacheUtil.put(SYS_CACHE, SCOPE_CACHE_CLASS, mapperId + StringPool.COLON + roleId, dataScope);
}
return StringUtil.isNotBlank(dataScope.getResourceCode()) ? dataScope : null;
}
/**
* 获取数据权限
*
* @param code 数据权限资源编号
* @return DataScopeModel
|
*/
public static DataScopeModel getDataScopeByCode(String code) {
DataScopeModel dataScope = CacheUtil.get(SYS_CACHE, SCOPE_CACHE_CODE, code, DataScopeModel.class);
if (dataScope == null || !dataScope.getSearched()) {
dataScope = getDataScopeClient().getDataScopeByCode(code);
CacheUtil.put(SYS_CACHE, SCOPE_CACHE_CODE, code, dataScope);
}
return StringUtil.isNotBlank(dataScope.getResourceCode()) ? dataScope : null;
}
/**
* 获取部门子级
*
* @param deptId 部门id
* @return deptIds
*/
public static List<Long> getDeptAncestors(Long deptId) {
List ancestors = CacheUtil.get(SYS_CACHE, DEPT_CACHE_ANCESTORS, deptId, List.class);
if (CollectionUtil.isEmpty(ancestors)) {
ancestors = getDataScopeClient().getDeptAncestors(deptId);
CacheUtil.put(SYS_CACHE, DEPT_CACHE_ANCESTORS, deptId, ancestors);
}
return ancestors;
}
}
|
repos\SpringBlade-master\blade-service-api\blade-scope-api\src\main\java\org\springblade\system\cache\DataScopeCache.java
| 2
|
请完成以下Spring Boot application配置
|
#
# Copyright 2015-2023 the original author or authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# S
|
ee the License for the specific language governing permissions and
# limitations under the License.
#
mybatis.config-location=classpath:mybatis-config.xml
logging.level.root=WARN
logging.level.sample.mybatis.xml.mapper=TRACE
|
repos\spring-boot-starter-master\mybatis-spring-boot-samples\mybatis-spring-boot-sample-xml\src\main\resources\application.properties
| 2
|
请在Spring Boot框架中完成以下Java代码
|
public void onStart(RuleNodeId ruleNodeId) {
long currentTime = System.currentTimeMillis();
stateLock.lock();
try {
currentRuleNodeId = ruleNodeId;
stateChangeTime = currentTime;
} finally {
stateLock.unlock();
}
}
public long onEnd(RuleNodeId ruleNodeId) {
long currentTime = System.currentTimeMillis();
stateLock.lock();
try {
if (ruleNodeId.equals(currentRuleNodeId)) {
long processingTime = currentTime - stateChangeTime;
stateChangeTime = currentTime;
totalProcessingTime.addAndGet(processingTime);
currentRuleNodeId = null;
return processingTime;
} else {
log.trace("[{}] Invalid sequence of rule node processing detected. Expected [{}] but was [{}]", msgId, currentRuleNodeId, ruleNodeId);
return 0;
|
}
} finally {
stateLock.unlock();
}
}
public Map.Entry<UUID, Long> onTimeout() {
long currentTime = System.currentTimeMillis();
stateLock.lock();
try {
if (currentRuleNodeId != null && stateChangeTime > 0) {
long timeoutTime = currentTime - stateChangeTime;
totalProcessingTime.addAndGet(timeoutTime);
return new AbstractMap.SimpleEntry<>(currentRuleNodeId.getId(), timeoutTime);
}
} finally {
stateLock.unlock();
}
return null;
}
}
|
repos\thingsboard-master\application\src\main\java\org\thingsboard\server\service\queue\TbMsgProfilerInfo.java
| 2
|
请完成以下Java代码
|
public final IClientUIInvoker setInvokeLater(final boolean invokeLater)
{
this.invokeLater = invokeLater;
return this;
}
protected final boolean isInvokeLater()
{
return invokeLater;
}
@Override
public final IClientUIInvoker setLongOperation(final boolean longOperation)
{
this.longOperation = longOperation;
return this;
}
protected final boolean isLongOperation()
{
return longOperation;
}
@Override
public IClientUIInvoker setShowGlassPane(final boolean showGlassPane)
{
this.showGlassPane = showGlassPane;
return this;
}
protected final boolean isShowGlassPane()
{
return showGlassPane;
}
@Override
public final IClientUIInvoker setOnFail(OnFail onFail)
{
Check.assumeNotNull(onFail, "onFail not null");
this.onFail = onFail;
return this;
}
private final OnFail getOnFail()
{
return onFail;
}
@Override
public final IClientUIInvoker setExceptionHandler(IExceptionHandler exceptionHandler)
{
Check.assumeNotNull(exceptionHandler, "exceptionHandler not null");
this.exceptionHandler = exceptionHandler;
return this;
}
private final IExceptionHandler getExceptionHandler()
{
return exceptionHandler;
}
@Override
public abstract IClientUIInvoker setParentComponent(final Object parentComponent);
|
@Override
public abstract IClientUIInvoker setParentComponentByWindowNo(final int windowNo);
protected final void setParentComponent(final int windowNo, final Object component)
{
this.parentWindowNo = windowNo;
this.parentComponent = component;
}
protected final Object getParentComponent()
{
return parentComponent;
}
protected final int getParentWindowNo()
{
return parentWindowNo;
}
@Override
public final IClientUIInvoker setRunnable(final Runnable runnable)
{
this.runnable = runnable;
return this;
}
private final Runnable getRunnable()
{
return runnable;
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\de\metas\adempiere\form\AbstractClientUIInvoker.java
| 1
|
请完成以下Java代码
|
String getTrxName()
{
return _trxName;
}
@Override
public IInvoiceCandRecomputeTagger setRecomputeTag(final InvoiceCandRecomputeTag recomputeTag)
{
this._recomputeTagToUseForTagging = recomputeTag;
return this;
}
private void generateRecomputeTagIfNotSet()
{
// Do nothing if the recompute tag was already generated
if (!InvoiceCandRecomputeTag.isNull(_recomputeTag))
{
return;
}
// Use the recompute tag which was suggested
if (!InvoiceCandRecomputeTag.isNull(_recomputeTagToUseForTagging))
{
_recomputeTag = _recomputeTagToUseForTagging;
return;
}
// Generate a new recompute tag
_recomputeTag = invoiceCandDAO.generateNewRecomputeTag();
}
/**
* @return recompute tag; never returns null
*/
final InvoiceCandRecomputeTag getRecomputeTag()
{
Check.assumeNotNull(_recomputeTag, "_recomputeTag not null");
return _recomputeTag;
}
@Override
public InvoiceCandRecomputeTagger setLockedBy(final ILock lockedBy)
{
this._lockedBy = lockedBy;
return this;
}
/* package */ILock getLockedBy()
{
return _lockedBy;
}
@Override
public InvoiceCandRecomputeTagger setTaggedWith(@Nullable final InvoiceCandRecomputeTag tag)
{
_taggedWith = tag;
return this;
}
@Override
public InvoiceCandRecomputeTagger setTaggedWithNoTag()
{
|
return setTaggedWith(InvoiceCandRecomputeTag.NULL);
}
@Override
public IInvoiceCandRecomputeTagger setTaggedWithAnyTag()
{
return setTaggedWith(null);
}
/* package */
@Nullable
InvoiceCandRecomputeTag getTaggedWith()
{
return _taggedWith;
}
@Override
public InvoiceCandRecomputeTagger setLimit(final int limit)
{
this._limit = limit;
return this;
}
/* package */int getLimit()
{
return _limit;
}
@Override
public void setOnlyInvoiceCandidateIds(@NonNull final InvoiceCandidateIdsSelection onlyInvoiceCandidateIds)
{
this.onlyInvoiceCandidateIds = onlyInvoiceCandidateIds;
}
@Override
@Nullable
public final InvoiceCandidateIdsSelection getOnlyInvoiceCandidateIds()
{
return onlyInvoiceCandidateIds;
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.swat\de.metas.swat.base\src\main\java\de\metas\invoicecandidate\api\impl\InvoiceCandRecomputeTagger.java
| 1
|
请完成以下Java代码
|
public void setConverter(HttpMessageConverter<Object> converter) {
Assert.notNull(converter, "converter cannot be null");
this.converter = converter;
}
/**
* Sets the {@link PublicKeyCredentialCreationOptionsRepository} to use. The default
* is {@link HttpSessionPublicKeyCredentialCreationOptionsRepository}.
* @param creationOptionsRepository the
* {@link PublicKeyCredentialCreationOptionsRepository} to use. Cannot be null.
*/
public void setCreationOptionsRepository(PublicKeyCredentialCreationOptionsRepository creationOptionsRepository) {
Assert.notNull(creationOptionsRepository, "creationOptionsRepository cannot be null");
this.creationOptionsRepository = creationOptionsRepository;
}
private void registerCredential(HttpServletRequest request, HttpServletResponse response) throws IOException {
WebAuthnRegistrationRequest registrationRequest = readRegistrationRequest(request);
if (registrationRequest == null) {
response.setStatus(HttpStatus.BAD_REQUEST.value());
return;
}
PublicKeyCredentialCreationOptions options = this.creationOptionsRepository.load(request);
if (options == null) {
response.setStatus(HttpStatus.BAD_REQUEST.value());
return;
}
this.creationOptionsRepository.save(request, response, null);
CredentialRecord credentialRecord = this.rpOptions.registerCredential(
new ImmutableRelyingPartyRegistrationRequest(options, registrationRequest.getPublicKey()));
SuccessfulUserRegistrationResponse registrationResponse = new SuccessfulUserRegistrationResponse(
credentialRecord);
ServletServerHttpResponse outputMessage = new ServletServerHttpResponse(response);
this.converter.write(registrationResponse, MediaType.APPLICATION_JSON, outputMessage);
}
private @Nullable WebAuthnRegistrationRequest readRegistrationRequest(HttpServletRequest request) {
HttpInputMessage inputMessage = new ServletServerHttpRequest(request);
try {
return (WebAuthnRegistrationRequest) this.converter.read(WebAuthnRegistrationRequest.class, inputMessage);
}
catch (Exception ex) {
logger.debug("Unable to parse WebAuthnRegistrationRequest", ex);
return null;
}
}
private void removeCredential(HttpServletRequest request, HttpServletResponse response, @Nullable String id)
throws IOException {
this.userCredentials.delete(Bytes.fromBase64(id));
response.setStatus(HttpStatus.NO_CONTENT.value());
}
|
static class WebAuthnRegistrationRequest {
private @Nullable RelyingPartyPublicKey publicKey;
@Nullable RelyingPartyPublicKey getPublicKey() {
return this.publicKey;
}
void setPublicKey(RelyingPartyPublicKey publicKey) {
this.publicKey = publicKey;
}
}
public static class SuccessfulUserRegistrationResponse {
private final CredentialRecord credentialRecord;
SuccessfulUserRegistrationResponse(CredentialRecord credentialRecord) {
this.credentialRecord = credentialRecord;
}
public boolean isSuccess() {
return true;
}
}
}
|
repos\spring-security-main\webauthn\src\main\java\org\springframework\security\web\webauthn\registration\WebAuthnRegistrationFilter.java
| 1
|
请完成以下Java代码
|
public Long getId() {
return authorId;
}
public void setId(Long authorId) {
this.authorId = authorId;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public int getAge() {
return age;
}
|
public void setAge(int age) {
this.age = age;
}
public List<BookDto> getBooks() {
return books;
}
public void setBooks(List<BookDto> books) {
this.books = books;
}
public void addBook(BookDto book) {
books.add(book);
}
@Override
public String toString() {
return "AuthorDto{" + "authorId=" + authorId + ", name=" + name + ", age=" + age + '}';
}
}
|
repos\Hibernate-SpringBoot-master\HibernateSpringBootDtoCustomResultTransformer\src\main\java\com\bookstore\dto\AuthorDto.java
| 1
|
请完成以下Java代码
|
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 getUsertype() {
return usertype;
}
public void setUsertype(String usertype) {
this.usertype = usertype;
}
public Integer getEnabled() {
return enabled;
}
public void setEnabled(Integer enabled) {
|
this.enabled = enabled;
}
public String getQq() {
return qq;
}
public void setQq(String qq) {
this.qq = qq;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public String getTel() {
return tel;
}
public void setTel(String tel) {
this.tel = tel;
}
}
|
repos\MyBatis-Spring-Boot-master\src\main\java\tk\mybatis\springboot\model\UserInfo.java
| 1
|
请完成以下Java代码
|
public boolean isAllowOverflow() { //
return m_allowOverflow;
}
/**
* Paint Element
* @param g2D graphics
* @param pageNo page no
* @param pageStart page start
* @param ctx context
* @param isView view
*/
public void paint (Graphics2D g2D, int pageNo, Point2D pageStart,
Properties ctx, boolean isView)
{
if (!m_valid || m_barcode == null)
return;
// Position
Point2D.Double location = getAbsoluteLocation(pageStart);
int x = (int)location.x;
if (MPrintFormatItem.FIELDALIGNMENTTYPE_TrailingRight.equals(p_FieldAlignmentType))
x += p_maxWidth - p_width;
else if (MPrintFormatItem.FIELDALIGNMENTTYPE_Center.equals(p_FieldAlignmentType))
x += (p_maxWidth - p_width) / 2;
int y = (int)location.y;
try {
int w = m_barcode.getWidth();
int h = m_barcode.getHeight();
// draw barcode to buffer
BufferedImage image = new BufferedImage(w, h, BufferedImage.TYPE_INT_ARGB);
Graphics2D temp = (Graphics2D) image.getGraphics();
m_barcode.draw(temp, 0, 0);
// scale barcode and paint
AffineTransform transform = new AffineTransform();
transform.translate(x,y);
transform.scale(m_scaleFactor, m_scaleFactor);
|
g2D.drawImage(image, transform, this);
} catch (OutputException e) {
}
} // paint
/**
* String Representation
* @return info
*/
public String toString ()
{
if (m_barcode == null)
return super.toString();
return super.toString() + " " + m_barcode.getData();
} // toString
} // BarcodeElement
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-legacy\org\compiere\print\layout\BarcodeElement.java
| 1
|
请完成以下Java代码
|
private Map<String, String> processKvEntryMappingPatterns(TbMsg msg) {
var mappingsMap = new HashMap<String, String>();
config.getDataMapping().forEach((sourceKey, targetKey) -> {
String patternProcessedSourceKey = TbNodeUtils.processPattern(sourceKey, msg);
String patternProcessedTargetKey = TbNodeUtils.processPattern(targetKey, msg);
mappingsMap.put(patternProcessedSourceKey, patternProcessedTargetKey);
});
return mappingsMap;
}
private ListenableFuture<Map<String, String>> getEntityFieldsAsync(TbContext ctx, EntityId entityId, Map<String, String> mappingsMap, boolean ignoreNullStrings) {
return Futures.transform(EntitiesFieldsAsyncLoader.findAsync(ctx, entityId),
fieldsData -> {
var targetKeysToSourceValuesMap = new HashMap<String, String>();
for (var mappingEntry : mappingsMap.entrySet()) {
var sourceFieldName = mappingEntry.getKey();
var targetKeyName = mappingEntry.getValue();
var sourceFieldValue = fieldsData.getFieldValue(sourceFieldName, ignoreNullStrings);
if (sourceFieldValue != null) {
targetKeysToSourceValuesMap.put(targetKeyName, sourceFieldValue);
}
}
return targetKeysToSourceValuesMap;
}, ctx.getDbCallbackExecutor()
|
);
}
private ListenableFuture<List<KvEntry>> getAttributesAsync(TbContext ctx, EntityId entityId, List<String> attrKeys) {
var latest = ctx.getAttributesService().find(ctx.getTenantId(), entityId, AttributeScope.SERVER_SCOPE, attrKeys);
return Futures.transform(latest, l ->
l.stream()
.map(i -> (KvEntry) i)
.collect(Collectors.toList()),
ctx.getDbCallbackExecutor());
}
private ListenableFuture<List<KvEntry>> getLatestTelemetryAsync(TbContext ctx, EntityId entityId, List<String> timeseriesKeys) {
var latest = ctx.getTimeseriesService().findLatest(ctx.getTenantId(), entityId, timeseriesKeys);
return Futures.transform(latest, l ->
l.stream()
.map(i -> (KvEntry) i)
.collect(Collectors.toList()),
ctx.getDbCallbackExecutor());
}
}
|
repos\thingsboard-master\rule-engine\rule-engine-components\src\main\java\org\thingsboard\rule\engine\metadata\TbAbstractGetMappedDataNode.java
| 1
|
请完成以下Spring Boot application配置
|
spring.datasource.driverClassName=org.postgresql.Driver
spring.datasource.maxActive=10
spring.datasource.maxIdle=5
spring.datasource.minIdle=2
spring.datasource.initialSize=5
spring.datasource.removeAbandoned=true
spring.jpa.proper
|
ties.hibernate.dialect=org.hibernate.dialect.PostgreSQLDialect
spring.jpa.hibernate.ddl-auto=update
|
repos\tutorials-master\spring-cloud-modules\spring-cloud-connectors-heroku\src\main\resources\application.properties
| 2
|
请完成以下Java代码
|
protected List<I_M_InOutLine> retrieveDocumentLines(final I_M_InOut document)
{
final IInOutDAO inoutDAO = Services.get(IInOutDAO.class);
final List<I_M_InOutLine> documentLines = new ArrayList<I_M_InOutLine>();
for (final I_M_InOutLine iol : inoutDAO.retrieveLines(document, I_M_InOutLine.class))
{
documentLines.add(iol);
}
return documentLines;
}
@Override
protected I_M_Material_Tracking getMaterialTrackingFromDocumentLineASI(final I_M_InOutLine documentLine)
{
final de.metas.materialtracking.model.I_M_InOutLine iolExt = InterfaceWrapperHelper.create(documentLine, de.metas.materialtracking.model.I_M_InOutLine.class);
if (iolExt.getM_Material_Tracking_ID() > 0)
{
|
return iolExt.getM_Material_Tracking();
}
// fall-back in case the M_Material_Tracking_ID is not (yet) set
final IMaterialTrackingAttributeBL materialTrackingAttributeBL = Services.get(IMaterialTrackingAttributeBL.class);
final AttributeSetInstanceId asiId = AttributeSetInstanceId.ofRepoIdOrNone(iolExt.getM_AttributeSetInstance_ID());
final I_M_Material_Tracking materialTracking = materialTrackingAttributeBL.getMaterialTrackingOrNull(asiId);
return materialTracking;
}
@Override
protected AttributeSetInstanceId getM_AttributeSetInstance(final I_M_InOutLine documentLine)
{
// shall not be called because we implement "getMaterialTrackingFromDocumentLineASI"
throw new IllegalStateException("shall not be called");
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.materialtracking\src\main\java\de\metas\materialtracking\model\validator\M_InOut.java
| 1
|
请完成以下Java代码
|
public ISqlQueryFilter asPartialSqlQueryFilter()
{
return partialSqlQueryFilter;
}
@Override
public IQueryFilter<T> asPartialNonSqlFilterOrNull()
{
final List<IQueryFilter<T>> nonSqlFilters = getNonSqlFiltersToUse();
if (nonSqlFilters == null || nonSqlFilters.isEmpty())
{
return null;
}
return partialNonSqlQueryFilter;
|
}
@Override
public CompositeQueryFilter<T> allowSqlFilters(final boolean allowSqlFilters)
{
if (this._allowSqlFilters == allowSqlFilters)
{
return this;
}
this._allowSqlFilters = allowSqlFilters;
_compiled = false;
return this;
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\org\adempiere\ad\dao\impl\CompositeQueryFilter.java
| 1
|
请完成以下Java代码
|
public class RulesDeployer implements EngineDeployer {
private static final Logger LOGGER = LoggerFactory.getLogger(RulesDeployer.class);
@Override
public void deploy(EngineDeployment deployment, Map<String, Object> deploymentSettings) {
LOGGER.debug("Processing rules deployment {}", deployment.getName());
KnowledgeBuilder knowledgeBuilder = null;
DeploymentManager deploymentManager = CommandContextUtil.getProcessEngineConfiguration().getDeploymentManager();
Map<String, EngineResource> resources = deployment.getResources();
for (String resourceName : resources.keySet()) {
if (resourceName.endsWith(".drl")) { // is only parsing .drls sufficient? what about other rule dsl's? (@see ResourceType)
LOGGER.info("Processing rules resource {}", resourceName);
if (knowledgeBuilder == null) {
knowledgeBuilder = KnowledgeBuilderFactory.newKnowledgeBuilder();
}
EngineResource resourceEntity = resources.get(resourceName);
byte[] resourceBytes = resourceEntity.getBytes();
Resource droolsResource = ResourceFactory.newByteArrayResource(resourceBytes);
|
knowledgeBuilder.add(droolsResource, ResourceType.DRL);
}
}
if (knowledgeBuilder != null) {
KieBase kieBase = knowledgeBuilder.newKieBase();
deploymentManager.getKnowledgeBaseCache().add(deployment.getId(), kieBase);
}
}
@Override
public void undeploy(EngineDeployment parentDeployment, boolean cascade) {
// Nothing to do
}
}
|
repos\flowable-engine-main\modules\flowable-engine\src\main\java\org\flowable\engine\impl\rules\RulesDeployer.java
| 1
|
请完成以下Java代码
|
public Collection<Documentation> getDocumentations() {
return documentationCollection.get(this);
}
public ExtensionElements getExtensionElements() {
return extensionElementsChild.getChild(this);
}
public void setExtensionElements(ExtensionElements extensionElements) {
extensionElementsChild.setChild(this, extensionElements);
}
protected boolean isCmmn11() {
return CmmnModelConstants.CMMN11_NS.equals(getDomElement().getNamespaceURI());
}
public static void registerType(ModelBuilder modelBuilder) {
ModelElementTypeBuilder typeBuilder = modelBuilder.defineType(CmmnElement.class, CMMN_ELEMENT)
.abstractType()
.namespaceUri(CMMN11_NS);
|
idAttribute = typeBuilder.stringAttribute(CMMN_ATTRIBUTE_ID)
.idAttribute()
.build();
descriptionAttribute = typeBuilder.stringAttribute(CMMN_ATTRIBUTE_DESCRIPTION)
.namespace(CMMN10_NS)
.build();
SequenceBuilder sequenceBuilder = typeBuilder.sequence();
documentationCollection = sequenceBuilder.elementCollection(Documentation.class)
.build();
extensionElementsChild = sequenceBuilder.element(ExtensionElements.class)
.build();
typeBuilder.build();
}
}
|
repos\camunda-bpm-platform-master\model-api\cmmn-model\src\main\java\org\camunda\bpm\model\cmmn\impl\instance\CmmnElementImpl.java
| 1
|
请完成以下Java代码
|
public static ZonedDateTime fromObjectToZonedDateTime(final Object valueObj)
{
return fromObjectTo(valueObj,
ZonedDateTime.class,
de.metas.util.converter.DateTimeConverters::fromJsonToZonedDateTime,
TimeUtil::asZonedDateTime);
}
public static Instant fromObjectToInstant(final Object valueObj)
{
return fromObjectTo(valueObj,
Instant.class,
de.metas.util.converter.DateTimeConverters::fromJsonToInstant,
TimeUtil::asInstant);
}
@Nullable
private static <T> T fromObjectTo(
final Object valueObj,
@NonNull final Class<T> type,
@NonNull final Function<String, T> fromJsonConverer,
@NonNull final Function<Object, T> fromObjectConverter)
{
if (valueObj == null
|| JSONNullValue.isNull(valueObj))
{
return null;
}
else if (type.isInstance(valueObj))
{
return type.cast(valueObj);
}
else if (valueObj instanceof CharSequence)
{
final String json = valueObj.toString().trim();
if (json.isEmpty())
{
return null;
}
if (isPossibleJdbcTimestamp(json))
{
try
{
final Timestamp timestamp = fromPossibleJdbcTimestamp(json);
return fromObjectConverter.apply(timestamp);
}
catch (final Exception e)
{
logger.warn("Error while converting possible JDBC Timestamp `{}` to java.sql.Timestamp", json, e);
return fromJsonConverer.apply(json);
}
|
}
else
{
return fromJsonConverer.apply(json);
}
}
else if (valueObj instanceof StringLookupValue)
{
final String key = ((StringLookupValue)valueObj).getIdAsString();
if (Check.isEmpty(key))
{
return null;
}
else
{
return fromJsonConverer.apply(key);
}
}
else
{
return fromObjectConverter.apply(valueObj);
}
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.ui.web.base\src\main\java\de\metas\ui\web\window\datatypes\json\DateTimeConverters.java
| 1
|
请完成以下Java代码
|
public void processSourceAndItsCandidates(
@NonNull final I_C_DunningDoc dunningDoc,
@NonNull final I_C_DunningDoc_Line_Source source)
{
final IDunningDAO dao = Services.get(IDunningDAO.class);
final I_C_Dunning_Candidate candidate = source.getC_Dunning_Candidate();
candidate.setProcessed(true); // make sure the Processed flag is set
candidate.setIsDunningDocProcessed(true); // IsDunningDocProcessed
candidate.setDunningDateEffective(dunningDoc.getDunningDate());
dao.save(candidate);
source.setProcessed(true);
InterfaceWrapperHelper.save(source);
}
@Override
public void makeDeliveryStopIfNeeded(@NonNull final I_C_DunningDoc dunningDoc)
{
final org.compiere.model.I_C_DunningLevel dunningLevel = dunningDoc.getC_DunningLevel();
if (!dunningLevel.isDeliveryStop())
{
return;
}
final IShipmentConstraintsBL shipmentConstraintsBL = Services.get(IShipmentConstraintsBL.class);
shipmentConstraintsBL.createConstraint(ShipmentConstraintCreateRequest.builder()
.billPartnerId(dunningDoc.getC_BPartner_ID())
.sourceDocRef(TableRecordReference.of(dunningDoc))
.deliveryStop(true)
.build());
}
@Override
public String getSummary(final I_C_Dunning_Candidate candidate)
{
if (candidate == null)
{
return null;
}
return "#" + candidate.getC_Dunning_Candidate_ID();
}
@Override
public boolean isExpired(final I_C_Dunning_Candidate candidate, final Timestamp dunningGraceDate)
|
{
Check.assumeNotNull(candidate, "candidate not null");
if (candidate.isProcessed())
{
// candidate already processed => not expired
return false;
}
if (dunningGraceDate == null)
{
// no dunning grace date => not expired
return false;
}
final Timestamp dunningDate = candidate.getDunningDate();
if (dunningDate.compareTo(dunningGraceDate) >= 0)
{
// DunningDate >= DunningGrace => candidate is perfectly valid. It's date is after dunningGrace date
return false;
}
// DunningDate < DunningGrace => candidate is no longer valid
return true;
}
@Override
public I_C_Dunning_Candidate getLastLevelCandidate(final List<I_C_Dunning_Candidate> candidates)
{
Check.errorIf(candidates.isEmpty(), "Error: No candidates selected.");
I_C_Dunning_Candidate result = candidates.get(0);
BigDecimal maxDaysAfterDue = result.getC_DunningLevel().getDaysAfterDue();
for (final I_C_Dunning_Candidate candidate : candidates)
{
if (maxDaysAfterDue.compareTo(candidate.getC_DunningLevel().getDaysAfterDue()) < 0)
{
result = candidate;
maxDaysAfterDue = candidate.getC_DunningLevel().getDaysAfterDue();
}
}
return result;
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.dunning\src\main\java\de\metas\dunning\api\impl\DunningBL.java
| 1
|
请完成以下Java代码
|
private int findSmallestValue(Node root) {
return root.left == null ? root.value : findSmallestValue(root.left);
}
public void traverseInOrder(Node node) {
if (node != null) {
traverseInOrder(node.left);
visit(node.value);
traverseInOrder(node.right);
}
}
public void traversePreOrder(Node node) {
if (node != null) {
visit(node.value);
traversePreOrder(node.left);
traversePreOrder(node.right);
}
}
public void traversePostOrder(Node node) {
if (node != null) {
traversePostOrder(node.left);
traversePostOrder(node.right);
visit(node.value);
}
}
public void traverseInOrderWithoutRecursion() {
Stack<Node> stack = new Stack<>();
Node current = root;
while (current != null || !stack.isEmpty()) {
while (current != null) {
stack.push(current);
current = current.left;
}
Node top = stack.pop();
visit(top.value);
current = top.right;
}
}
public void traversePreOrderWithoutRecursion() {
Stack<Node> stack = new Stack<>();
Node current;
stack.push(root);
while(! stack.isEmpty()) {
current = stack.pop();
visit(current.value);
if(current.right != null)
stack.push(current.right);
|
if(current.left != null)
stack.push(current.left);
}
}
public void traversePostOrderWithoutRecursion() {
Stack<Node> stack = new Stack<>();
Node prev = root;
Node current;
stack.push(root);
while (!stack.isEmpty()) {
current = stack.peek();
boolean hasChild = (current.left != null || current.right != null);
boolean isPrevLastChild = (prev == current.right || (prev == current.left && current.right == null));
if (!hasChild || isPrevLastChild) {
current = stack.pop();
visit(current.value);
prev = current;
} else {
if (current.right != null) {
stack.push(current.right);
}
if (current.left != null) {
stack.push(current.left);
}
}
}
}
private void visit(int value) {
System.out.print(" " + value);
}
static class Node {
int value;
Node left;
Node right;
Node(int value) {
this.value = value;
right = null;
left = null;
}
}
}
|
repos\tutorials-master\algorithms-modules\algorithms-searching\src\main\java\com\baeldung\algorithms\dfs\BinaryTree.java
| 1
|
请完成以下Java代码
|
public void onRemoteSessionCloseCommand(UUID sessionId, TransportProtos.SessionCloseNotificationProto sessionCloseNotification) {
}
@Override
public void onDeviceDeleted(DeviceId deviceId) {
}
@Override
public void onToDeviceRpcRequest(UUID sessionId, TransportProtos.ToDeviceRpcRequestMsg toDeviceRequest) {
logUnsupportedCommandMessage(toDeviceRequest);
}
@Override
public void onToServerRpcResponse(TransportProtos.ToServerRpcResponseMsg toServerResponse) {
logUnsupportedCommandMessage(toServerResponse);
}
private void logUnsupportedCommandMessage(Object update) {
log.trace("[{}] Ignore unsupported update: {}", state.getDeviceId(), update);
}
|
public static boolean isConRequest(TbCoapObservationState state) {
if (state != null) {
return state.getExchange().advanced().getRequest().isConfirmable();
} else {
return false;
}
}
public static boolean isMulticastRequest(TbCoapObservationState state) {
if (state != null) {
return state.getExchange().advanced().getRequest().isMulticast();
}
return false;
}
protected void respond(Response response) {
response.getOptions().setContentFormat(TbCoapContentFormatUtil.getContentFormat(exchange.getRequestOptions().getContentFormat(), state.getContentFormat()));
response.setConfirmable(exchange.advanced().getRequest().isConfirmable());
exchange.respond(response);
}
}
|
repos\thingsboard-master\common\transport\coap\src\main\java\org\thingsboard\server\transport\coap\callback\AbstractSyncSessionCallback.java
| 1
|
请完成以下Java代码
|
public int getSuspensionState() {
return suspensionState;
}
public void setSuspensionState(int suspensionState) {
this.suspensionState = suspensionState;
}
@Override
public boolean isSuspended() {
return suspensionState == SuspensionState.SUSPENDED.getStateCode();
}
public Set<Expression> getCandidateStarterUserIdExpressions() {
return candidateStarterUserIdExpressions;
}
public void addCandidateStarterUserIdExpression(Expression userId) {
candidateStarterUserIdExpressions.add(userId);
}
public Set<Expression> getCandidateStarterGroupIdExpressions() {
|
return candidateStarterGroupIdExpressions;
}
public void addCandidateStarterGroupIdExpression(Expression groupId) {
candidateStarterGroupIdExpressions.add(groupId);
}
@Override
public String getEngineVersion() {
return engineVersion;
}
public void setEngineVersion(String engineVersion) {
this.engineVersion = engineVersion;
}
}
|
repos\flowable-engine-main\modules\flowable5-engine\src\main\java\org\activiti\engine\impl\persistence\entity\ProcessDefinitionEntity.java
| 1
|
请完成以下Java代码
|
private final static void initData() {
Country usa = new Country();
usa.setName("USA");
usa.setCapital("Washington D.C.");
usa.setCurrency(Currency.USD);
usa.setPopulation(323947000);
countries.put(usa.getName(), usa);
Country india = new Country();
india.setName("India");
india.setCapital("New Delhi");
india.setCurrency(Currency.INR);
india.setPopulation(1295210000);
|
countries.put(india.getName(), india);
Country france = new Country();
france.setName("France");
france.setCapital("Paris");
france.setCurrency(Currency.EUR);
france.setPopulation(66710000);
countries.put(france.getName(), france);
}
public Country findCountry(String name) {
return countries.get(name);
}
}
|
repos\tutorials-master\core-java-modules\core-java-11-2\src\main\java\com\baeldung\soap\ws\server\CountryRepository.java
| 1
|
请完成以下Java代码
|
public class ComputeFunction {
public static void compute(Integer v) {
try {
System.out.println("compute integer v: " + v);
Thread.sleep(1000);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
public static void compute(List<Integer> v) {
try {
System.out.println("compute integer v: " + v);
Thread.sleep(1000);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
public static void compute(Observable<Integer> v) {
try {
v.forEach(System.out::println);
|
Thread.sleep(1000);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
public static void compute(Long v) {
try {
System.out.println("compute integer v: " + v);
Thread.sleep(1000);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
|
repos\tutorials-master\rxjava-modules\rxjava-core\src\main\java\com\baeldung\rxjava\ComputeFunction.java
| 1
|
请完成以下Java代码
|
public class ActivateTaskCmd implements Command<Void> {
protected String taskId;
protected String userId;
public ActivateTaskCmd(String taskId, String userId) {
this.taskId = taskId;
this.userId = userId;
}
@Override
public Void execute(CommandContext commandContext) {
CmmnEngineConfiguration cmmnEngineConfiguration = CommandContextUtil.getCmmnEngineConfiguration(commandContext);
if (taskId == null) {
throw new FlowableIllegalArgumentException("taskId is null");
}
TaskEntity task = cmmnEngineConfiguration.getTaskServiceConfiguration().getTaskService().getTask(taskId);
if (task == null) {
throw new FlowableObjectNotFoundException("Cannot find task with id " + taskId, Task.class);
}
if (task.isDeleted()) {
throw new FlowableException("Task " + taskId + " is already deleted");
}
if (!task.isSuspended()) {
throw new FlowableException("Task " + taskId + " is not suspended, so can't be activated");
}
Clock clock = cmmnEngineConfiguration.getClock();
Date updateTime = clock.getCurrentTime();
task.setSuspendedTime(null);
|
task.setSuspendedBy(null);
if (task.getInProgressStartTime() != null) {
task.setState(Task.IN_PROGRESS);
} else if (task.getClaimTime() != null) {
task.setState(Task.CLAIMED);
} else {
task.setState(Task.CREATED);
}
task.setSuspensionState(SuspensionState.ACTIVE.getStateCode());
HistoricTaskService historicTaskService = cmmnEngineConfiguration.getTaskServiceConfiguration().getHistoricTaskService();
historicTaskService.recordTaskInfoChange(task, updateTime, cmmnEngineConfiguration);
return null;
}
}
|
repos\flowable-engine-main\modules\flowable-cmmn-engine\src\main\java\org\flowable\cmmn\engine\impl\cmd\ActivateTaskCmd.java
| 1
|
请完成以下Java代码
|
public String getDirectorUserIds() {
return directorUserIds;
}
public void setDirectorUserIds(String directorUserIds) {
this.directorUserIds = directorUserIds;
}
public String getPositionId() {
return positionId;
}
public void setPositionId(String positionId) {
this.positionId = positionId;
}
public String getDepPostParentId() {
return depPostParentId;
}
public void setDepPostParentId(String depPostParentId) {
this.depPostParentId = depPostParentId;
}
/**
* 重写equals方法
*/
@Override
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代码
|
public class City {
/**
* 城市编号
*/
private Long id;
/**
* 省份编号
*/
private Long provinceId;
/**
* 城市名称
*/
private String cityName;
/**
* 描述
*/
private String description;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
|
public Long getProvinceId() {
return provinceId;
}
public void setProvinceId(Long provinceId) {
this.provinceId = provinceId;
}
public String getCityName() {
return cityName;
}
public void setCityName(String cityName) {
this.cityName = cityName;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
}
|
repos\springboot-learning-example-master\springboot-freemarker\src\main\java\org\spring\springboot\domain\City.java
| 1
|
请完成以下Java代码
|
private static void assertContextInjected() {
if (applicationContext == null) {
throw new IllegalStateException("applicaitonContext属性未注入, 请在applicationContext" +
".xml中定义SpringContextHolder或在SpringBoot启动类中注册SpringContextHolder.");
}
}
/**
* 清除SpringContextHolder中的ApplicationContext为Null.
*/
private static void clearHolder() {
log.debug("清除SpringContextHolder中的ApplicationContext:"
+ applicationContext);
applicationContext = null;
}
@Override
public void destroy() {
SpringBeanHolder.clearHolder();
}
@Override
public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
if (SpringBeanHolder.applicationContext != null) {
log.warn("SpringContextHolder中的ApplicationContext被覆盖, 原有ApplicationContext为:" + SpringBeanHolder.applicationContext);
}
SpringBeanHolder.applicationContext = applicationContext;
if (addCallback) {
for (SpringBeanHolder.CallBack callBack : SpringBeanHolder.CALL_BACKS) {
callBack.executor();
}
CALL_BACKS.clear();
|
}
SpringBeanHolder.addCallback = false;
}
/**
* 获取 @Service 的所有 bean 名称
* @return /
*/
public static List<String> getAllServiceBeanName() {
return new ArrayList<>(Arrays.asList(applicationContext
.getBeanNamesForAnnotation(Service.class)));
}
interface CallBack {
/**
* 回调执行方法
*/
void executor();
/**
* 本回调任务名称
* @return /
*/
default String getCallBackName() {
return Thread.currentThread().getId() + ":" + this.getClass().getName();
}
}
}
|
repos\eladmin-master\eladmin-common\src\main\java\me\zhengjie\utils\SpringBeanHolder.java
| 1
|
请完成以下Java代码
|
public I_M_ShipmentSchedule getM_ShipmentSchedule()
{
return sched;
}
@Override
public String getTableName()
{
return I_M_ShipmentSchedule.Table_Name;
}
@Override
public int getRecord_ID()
{
return sched.getM_ShipmentSchedule_ID();
}
@Override
public ZonedDateTime getDeliveryDate()
{
return shipmentScheduleDeliveryDayBL.getDeliveryDateCurrent(sched);
}
@Override
public BPartnerLocationId getBPartnerLocationId()
{
return shipmentScheduleEffectiveBL.getBPartnerLocationId(sched);
|
}
@Override
public int getM_Product_ID()
{
return sched.getM_Product_ID();
}
@Override
public boolean isToBeFetched()
{
// Shipment Schedules are about sending materials to customer
return false;
}
@Override
public int getAD_Org_ID()
{
return sched.getAD_Org_ID();
}
}
|
repos\metasfresh-new_dawn_uat\backend\de.metas.swat\de.metas.swat.base\src\main\java\de\metas\tourplanning\api\impl\ShipmentScheduleDeliveryDayAllocable.java
| 1
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.