instruction
string
input
string
output
string
source_file
string
priority
int64
请完成以下Java代码
public void setPO_Help (java.lang.String PO_Help) { set_Value (COLUMNNAME_PO_Help, PO_Help); } /** Get PO Help. @return Help for PO Screens */ @Override public java.lang.String getPO_Help () { return (java.lang.String)get_Value(COLUMNNAME_PO_Help); } /** Set PO Name. @param PO_Name Name on PO Screens */ @Override public void setPO_Name (java.lang.String PO_Name) { set_Value (COLUMNNAME_PO_Name, PO_Name); } /** Get PO Name. @return Name on PO Screens */ @Override public java.lang.String getPO_Name () { return (java.lang.String)get_Value(COLUMNNAME_PO_Name); } /** Set PO Print name. @param PO_PrintName Print name on PO Screens/Reports */ @Override public void setPO_PrintName (java.lang.String PO_PrintName) { set_Value (COLUMNNAME_PO_PrintName, PO_PrintName); } /** Get PO Print name. @return Print name on PO Screens/Reports */ @Override public java.lang.String getPO_PrintName () { return (java.lang.String)get_Value(COLUMNNAME_PO_PrintName); } /** Set Drucktext. @param PrintName The label text to be printed on a document or correspondence. */ @Override public void setPrintName (java.lang.String PrintName) { set_Value (COLUMNNAME_PrintName, PrintName); }
/** Get Drucktext. @return The label text to be printed on a document or correspondence. */ @Override public java.lang.String getPrintName () { return (java.lang.String)get_Value(COLUMNNAME_PrintName); } /** Set Browse name. @param WEBUI_NameBrowse Browse name */ @Override public void setWEBUI_NameBrowse (java.lang.String WEBUI_NameBrowse) { set_Value (COLUMNNAME_WEBUI_NameBrowse, WEBUI_NameBrowse); } /** Get Browse name. @return Browse name */ @Override public java.lang.String getWEBUI_NameBrowse () { return (java.lang.String)get_Value(COLUMNNAME_WEBUI_NameBrowse); } /** Set New record name. @param WEBUI_NameNew New record name */ @Override public void setWEBUI_NameNew (java.lang.String WEBUI_NameNew) { set_Value (COLUMNNAME_WEBUI_NameNew, WEBUI_NameNew); } /** Get New record name. @return New record name */ @Override public java.lang.String getWEBUI_NameNew () { return (java.lang.String)get_Value(COLUMNNAME_WEBUI_NameNew); } /** Set New record name (breadcrumb). @param WEBUI_NameNewBreadcrumb New record name (breadcrumb) */ @Override public void setWEBUI_NameNewBreadcrumb (java.lang.String WEBUI_NameNewBreadcrumb) { set_Value (COLUMNNAME_WEBUI_NameNewBreadcrumb, WEBUI_NameNewBreadcrumb); } /** Get New record name (breadcrumb). @return New record name (breadcrumb) */ @Override public java.lang.String getWEBUI_NameNewBreadcrumb () { return (java.lang.String)get_Value(COLUMNNAME_WEBUI_NameNewBreadcrumb); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_AD_Element_Trl.java
1
请在Spring Boot框架中完成以下Java代码
public PeerSecurityProperties getPeer() { return this.peer; } public SecurityPostProcessorProperties getPostProcessor() { return this.securityPostProcessorProperties; } public String getPropertiesFile() { return this.propertiesFile; } public void setPropertiesFile(String propertiesFile) { this.propertiesFile = propertiesFile; } public ApacheShiroProperties getShiro() { return this.apacheShiroProperties; } public SslProperties getSsl() { return this.ssl; } public String getUsername() { return this.username; } public void setUsername(String username) { this.username = username; } public static class ApacheShiroProperties { private String iniResourcePath; public String getIniResourcePath() { return this.iniResourcePath; } public void setIniResourcePath(String iniResourcePath) { this.iniResourcePath = iniResourcePath; } } public static class SecurityLogProperties { private static final String DEFAULT_SECURITY_LOG_LEVEL = "config"; private String file; private String level = DEFAULT_SECURITY_LOG_LEVEL; public String getFile() { return this.file; } public void setFile(String file) { this.file = file; } public String getLevel() {
return this.level; } public void setLevel(String level) { this.level = level; } } public static class SecurityManagerProperties { private String className; public String getClassName() { return this.className; } public void setClassName(String className) { this.className = className; } } public static class SecurityPostProcessorProperties { private String className; public String getClassName() { return this.className; } public void setClassName(String className) { this.className = className; } } }
repos\spring-boot-data-geode-main\spring-geode-project\spring-geode-autoconfigure\src\main\java\org\springframework\geode\boot\autoconfigure\configuration\support\SecurityProperties.java
2
请完成以下Java代码
public void rehash() { tmpElements = new Object[size]; int count = 0; for ( int x = 0; x < elements.length; x++ ) { if( elements[x] != null ) { tmpElements[count] = elements[x]; count++; } } elements = (Object[])tmpElements.clone(); tmpElements = null; current = count; } public void setGrow(int grow) { this.grow = grow; } public void grow() { size = size+=(size/grow); rehash(); } public void add(Object o) { if( current == elements.length ) grow(); try { elements[current] = o; current++; } catch(java.lang.ArrayStoreException ase) { } } public void add(int location,Object o) { try { elements[location] = o; } catch(java.lang.ArrayStoreException ase) {
} } public void remove(int location) { elements[location] = null; } public int location(Object o) throws NoSuchObjectException { int loc = -1; for ( int x = 0; x < elements.length; x++ ) { if((elements[x] != null && elements[x] == o )|| (elements[x] != null && elements[x].equals(o))) { loc = x; break; } } if( loc == -1 ) throw new NoSuchObjectException(); return(loc); } public Object get(int location) { return elements[location]; } public java.util.Enumeration elements() { return this; } }
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\tools\src\main\java-legacy\org\apache\ecs\storage\Array.java
1
请在Spring Boot框架中完成以下Java代码
public TableRecordReference getReference() { return creditMemoPayableDoc.getReference(); } @Override public Money getAmountToAllocateInitial() { return creditMemoPayableDoc.getAmountsToAllocateInitial().getPayAmt().negate(); } @Override public Money getAmountToAllocate() { return creditMemoPayableDoc.getAmountsToAllocate().getPayAmt().negate(); } @Override public void addAllocatedAmt(final Money allocatedPayAmtToAdd) { creditMemoPayableDoc.addAllocatedAmounts(AllocationAmounts.ofPayAmt(allocatedPayAmtToAdd.negate())); } /** * Check only the payAmt as that's the only value we are allocating. see {@link CreditMemoInvoiceAsPaymentDocumentWrapper#addAllocatedAmt(Money)} */ @Override public boolean isFullyAllocated() { return creditMemoPayableDoc.getAmountsToAllocate().getPayAmt().isZero(); } /** * Computes projected over under amt taking into account discount. * * @implNote for credit memo as payment, the negated discount needs to be added to the open amount. Negated value is used * as it actually needs to increase the open amount. * * e.g. Having a credit memo with totalGrandAmount = 10 and paymentTerm.Discount=10% translates to 11 total payment amount available. */ @Override public Money calculateProjectedOverUnderAmt(@NonNull final Money payAmountToAllocate) { final Money discountAmt = creditMemoPayableDoc.getAmountsToAllocateInitial().getDiscountAmt().negate(); final Money openAmtWithDiscount = creditMemoPayableDoc.getOpenAmtInitial().add(discountAmt); final Money remainingOpenAmtWithDiscount = openAmtWithDiscount.subtract(creditMemoPayableDoc.getTotalAllocatedAmount()); final Money adjustedPayAmountToAllocate = payAmountToAllocate.negate(); return remainingOpenAmtWithDiscount.subtract(adjustedPayAmountToAllocate); } @Override public boolean canPay(@NonNull final PayableDocument payable) { if (payable.getType() != PayableDocumentType.Invoice) { return false; } if (payable.getSoTrx() != creditMemoPayableDoc.getSoTrx()) { return false; } // A credit memo cannot pay another credit memo if (payable.isCreditMemo()) { return false; } return true;
} @Override public PaymentDirection getPaymentDirection() { return PaymentDirection.ofSOTrx(creditMemoPayableDoc.getSoTrx()); } @Override public CurrencyId getCurrencyId() { return creditMemoPayableDoc.getCurrencyId(); } @Override public LocalDate getDate() { return creditMemoPayableDoc.getDate(); } @Override public PaymentCurrencyContext getPaymentCurrencyContext() { return PaymentCurrencyContext.builder() .paymentCurrencyId(creditMemoPayableDoc.getCurrencyId()) .currencyConversionTypeId(creditMemoPayableDoc.getCurrencyConversionTypeId()) .build(); } @Override public Money getPaymentDiscountAmt() { return creditMemoPayableDoc.getAmountsToAllocate().getDiscountAmt(); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.banking\de.metas.banking.base\src\main\java\de\metas\banking\payment\paymentallocation\service\CreditMemoInvoiceAsPaymentDocumentWrapper.java
2
请完成以下Java代码
public static MReportLine copy (Properties ctx, int AD_Client_ID, int AD_Org_ID, int PA_ReportLineSet_ID, MReportLine source, String trxName) { MReportLine retValue = new MReportLine (ctx, 0, trxName); MReportLine.copyValues(source, retValue, AD_Client_ID, AD_Org_ID); // retValue.setPA_ReportLineSet_ID(PA_ReportLineSet_ID); retValue.setOper_1_ID(0); retValue.setOper_2_ID(0); return retValue; } // copy public MReportLineSet getIncluded_ReportLineSet() { if (!isLineTypeIncluded() || getIncluded_ReportLineSet_ID() <= 0) { includedLineSet = null; return null; } if (includedLineSet != null) return includedLineSet; includedLineSet = new MReportLineSet(getCtx(), getIncluded_ReportLineSet_ID(), get_TrxName()); return includedLineSet; } private MReportLineSet includedLineSet = null; public static final String LINETYPE_IncludedLineSet = "I"; public boolean isLineTypeIncluded() { return LINETYPE_IncludedLineSet.equals(this.getLineType()); } public int getIncluded_ReportLineSet_ID() { return this.get_ValueAsInt("Included_ReportLineSet_ID"); } public boolean isSuppressZeroLine() { return this.get_ValueAsBoolean("IsSuppressZeroLine"); } @Override public MReportLineSet getPA_ReportLineSet() { if (parent == null) { parent = (MReportLineSet)super.getPA_ReportLineSet(); } return parent; } void setParent(MReportLineSet lineSet) { this.parent = lineSet; } private MReportLineSet parent = null; public boolean isInclInParentCalc() {
return this.get_ValueAsBoolean("IsInclInParentCalc"); } public static void checkIncludedReportLineSetCycles(MReportLine line) { checkIncludedReportLineSetCycles(line, new TreeSet<Integer>(), new StringBuffer()); } private static void checkIncludedReportLineSetCycles(MReportLine line, Collection<Integer> trace, StringBuffer traceStr) { StringBuffer traceStr2 = new StringBuffer(traceStr); if (traceStr2.length() > 0) traceStr2.append(" - "); traceStr2.append(line.getName()); if (trace.contains(line.getPA_ReportLine_ID())) { throw new AdempiereException("@PA_ReportLine_ID@ Loop Detected: "+traceStr2.toString()); // TODO: translate } Collection<Integer> trace2 = new TreeSet<Integer>(trace); trace2.add(line.getPA_ReportLine_ID()); if (line.isLineTypeIncluded() && line.getPA_ReportLineSet() != null) { MReportLineSet includedSet = line.getIncluded_ReportLineSet(); traceStr2.append("(").append(includedSet.getName()).append(")"); for (MReportLine includedLine : includedSet.getLiness()) { checkIncludedReportLineSetCycles(includedLine, trace2, traceStr2); } } } } // MReportLine
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-legacy\org\compiere\report\MReportLine.java
1
请完成以下Java代码
public org.compiere.model.I_C_Country getTo_Country() { return get_ValueAsPO(COLUMNNAME_To_Country_ID, org.compiere.model.I_C_Country.class); } @Override public void setTo_Country(final org.compiere.model.I_C_Country To_Country) { set_ValueFromPO(COLUMNNAME_To_Country_ID, org.compiere.model.I_C_Country.class, To_Country); } @Override public void setTo_Country_ID (final int To_Country_ID) { if (To_Country_ID < 1) set_Value (COLUMNNAME_To_Country_ID, null); else set_Value (COLUMNNAME_To_Country_ID, To_Country_ID); } @Override public int getTo_Country_ID() { return get_ValueAsInt(COLUMNNAME_To_Country_ID); } @Override public org.compiere.model.I_C_Region getTo_Region() { return get_ValueAsPO(COLUMNNAME_To_Region_ID, org.compiere.model.I_C_Region.class); } @Override public void setTo_Region(final org.compiere.model.I_C_Region To_Region) { set_ValueFromPO(COLUMNNAME_To_Region_ID, org.compiere.model.I_C_Region.class, To_Region); } @Override public void setTo_Region_ID (final int To_Region_ID) { if (To_Region_ID < 1) set_Value (COLUMNNAME_To_Region_ID, null); else set_Value (COLUMNNAME_To_Region_ID, To_Region_ID); } @Override public int getTo_Region_ID() { return get_ValueAsInt(COLUMNNAME_To_Region_ID); } /** * TypeOfDestCountry AD_Reference_ID=541323 * Reference name: TypeDestCountry */ public static final int TYPEOFDESTCOUNTRY_AD_Reference_ID=541323; /** Domestic = DOMESTIC */ public static final String TYPEOFDESTCOUNTRY_Domestic = "DOMESTIC"; /** EU-foreign = WITHIN_COUNTRY_AREA */
public static final String TYPEOFDESTCOUNTRY_EU_Foreign = "WITHIN_COUNTRY_AREA"; /** Non-EU country = OUTSIDE_COUNTRY_AREA */ public static final String TYPEOFDESTCOUNTRY_Non_EUCountry = "OUTSIDE_COUNTRY_AREA"; @Override public void setTypeOfDestCountry (final @Nullable java.lang.String TypeOfDestCountry) { set_Value (COLUMNNAME_TypeOfDestCountry, TypeOfDestCountry); } @Override public java.lang.String getTypeOfDestCountry() { return get_ValueAsString(COLUMNNAME_TypeOfDestCountry); } @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 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.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_C_Tax.java
1
请完成以下Java代码
public class TourBL implements ITourBL { /** * Gets Preparation Time for given Day of the Week. * * @param tourVersion * @param dayOfWeek * @return preparation time (hour/minute/sec/millis) or null if there is no preparation time for that day of the week */ private static Timestamp getPreparationTime(final I_M_TourVersion tourVersion, final int dayOfWeek) { Check.assumeNotNull(tourVersion, "tourVersion not null"); final Timestamp preparationTime; if (dayOfWeek == Calendar.MONDAY) { preparationTime = tourVersion.getPreparationTime_1(); } else if (dayOfWeek == Calendar.TUESDAY) { preparationTime = tourVersion.getPreparationTime_2(); } else if (dayOfWeek == Calendar.WEDNESDAY) { preparationTime = tourVersion.getPreparationTime_3(); } else if (dayOfWeek == Calendar.THURSDAY) { preparationTime = tourVersion.getPreparationTime_4(); } else if (dayOfWeek == Calendar.FRIDAY) { preparationTime = tourVersion.getPreparationTime_5(); } else if (dayOfWeek == Calendar.SATURDAY) { preparationTime = tourVersion.getPreparationTime_6(); } else if (dayOfWeek == Calendar.SUNDAY) { preparationTime = tourVersion.getPreparationTime_7(); } else { throw new IllegalArgumentException("Invalid day of week: " + dayOfWeek); } return preparationTime; } @Override public Timestamp getPreparationDateTime(final I_M_TourVersion tourVersion, final Date deliveryDate) { Check.assumeNotNull(tourVersion, "tourVersion not null");
Check.assumeNotNull(deliveryDate, "deliveryDate not null"); // // Get DeliveryDate's Day of the Week final GregorianCalendar deliveryDateCal = new GregorianCalendar(); deliveryDateCal.setTimeInMillis(deliveryDate.getTime()); final int deliveryDayOfWeek = deliveryDateCal.get(Calendar.DAY_OF_WEEK); final Timestamp preparationTime = getPreparationTime(tourVersion, deliveryDayOfWeek); if (preparationTime == null) { return null; } final Timestamp preparationDateTime = TimeUtil.getDayTime(deliveryDate, preparationTime); return preparationDateTime; } @Override public IDeliveryDayGenerator createDeliveryDayGenerator(final IContextAware context) { return new DeliveryDayGenerator(context); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.swat\de.metas.swat.base\src\main\java\de\metas\tourplanning\api\impl\TourBL.java
1
请完成以下Java代码
private Set<String> retrieveAllowedDocActions(final ClientId adClientId, final DocTypeId docTypeId) { final List<Object> sqlParams = new ArrayList<>(); sqlParams.add(adClientId); sqlParams.add(docTypeId); final String sql = "SELECT rl.Value FROM AD_Document_Action_Access a" + " INNER JOIN AD_Ref_List rl ON (rl.AD_Reference_ID=135 and rl.AD_Ref_List_ID=a.AD_Ref_List_ID)" + " WHERE a.IsActive='Y' AND a.AD_Client_ID=? AND a.C_DocType_ID=?" // #1,2 + " AND " + getIncludedRolesWhereClause("a.AD_Role_ID", sqlParams); PreparedStatement pstmt = null; ResultSet rs = null; try { pstmt = DB.prepareStatement(sql, ITrx.TRXNAME_None); DB.setParameters(pstmt, sqlParams); rs = pstmt.executeQuery(); final ImmutableSet.Builder<String> options = ImmutableSet.builder(); while (rs.next()) { final String op = rs.getString(1); options.add(op); } return options.build(); } catch (final SQLException e) { throw new DBException(e, sql, sqlParams); } finally { DB.close(rs, pstmt); } } @Override public void applyActionAccess(final DocActionOptionsContext optionsCtx) { retainDocActionsWithAccess(optionsCtx); final String targetDocAction = optionsCtx.getDocActionToUse(); if (targetDocAction != null && !IDocument.ACTION_None.equals(targetDocAction)) { final Set<String> options = optionsCtx.getDocActions(); final Boolean access; if (options.contains(targetDocAction)) {
access = true; } else { access = null; // legacy } if (optionsCtx.getDocTypeId() != null) { rolePermLoggingBL().logDocActionAccess(getRoleId(), optionsCtx.getDocTypeId(), targetDocAction, access); } } optionsCtx.setDocActionToUse(targetDocAction); } /** * Get Role Where Clause. * It will look something like myalias.AD_Role_ID IN (?, ?, ?). * * @param roleColumnSQL role columnname or role column SQL (e.g. myalias.AD_Role_ID) * @param params a list where the method will put SQL parameters. * If null, this method will generate a not parametrized query * @return role SQL where clause */ @Override public String getIncludedRolesWhereClause(final String roleColumnSQL, final List<Object> params) { final StringBuilder whereClause = new StringBuilder(); for (final RoleId adRoleId : allRoleIds) { if (whereClause.length() > 0) { whereClause.append(","); } if (params != null) { whereClause.append("?"); params.add(adRoleId); } else { whereClause.append(adRoleId.getRepoId()); } } // whereClause.insert(0, roleColumnSQL + " IN (").append(")"); return whereClause.toString(); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\de\metas\security\impl\UserRolePermissions.java
1
请完成以下Java代码
public class SysLog implements Serializable{ private static final long serialVersionUID = -6309732882044872298L; private Integer id; private String username; private String operation; private Integer time; private String method; private String params; private String ip; private Date createTime; public Integer getId() { return id; } public void setId(Integer id) { this.id = id; } public String getUsername() { return username; } public void setUsername(String username) { this.username = username; } public String getOperation() { return operation; } public void setOperation(String operation) { this.operation = operation; } public Integer getTime() { return time; } public void setTime(Integer time) { this.time = time;
} public String getMethod() { return method; } public void setMethod(String method) { this.method = method; } public String getParams() { return params; } public void setParams(String params) { this.params = params; } public String getIp() { return ip; } public void setIp(String ip) { this.ip = ip; } public Date getCreateTime() { return createTime; } public void setCreateTime(Date createTime) { this.createTime = createTime; } }
repos\SpringAll-master\07.Spring-Boot-AOP-Log\src\main\java\com\springboot\domain\SysLog.java
1
请完成以下Java代码
public void setIsAllowPickingAnyHU (final boolean IsAllowPickingAnyHU) { set_Value (COLUMNNAME_IsAllowPickingAnyHU, IsAllowPickingAnyHU); } @Override public boolean isAllowPickingAnyHU() { return get_ValueAsBoolean(COLUMNNAME_IsAllowPickingAnyHU); } @Override public void setIsAllowStartNextJobOnly (final boolean IsAllowStartNextJobOnly) { set_Value (COLUMNNAME_IsAllowStartNextJobOnly, IsAllowStartNextJobOnly); } @Override public boolean isAllowStartNextJobOnly() { return get_ValueAsBoolean(COLUMNNAME_IsAllowStartNextJobOnly); } @Override public void setIsCompleteJobAutomatically (final boolean IsCompleteJobAutomatically) { set_Value (COLUMNNAME_IsCompleteJobAutomatically, IsCompleteJobAutomatically); } @Override public boolean isCompleteJobAutomatically() { return get_ValueAsBoolean(COLUMNNAME_IsCompleteJobAutomatically); } @Override public void setIsNavigateToJobsListAfterPickFromComplete (final boolean IsNavigateToJobsListAfterPickFromComplete) { set_Value (COLUMNNAME_IsNavigateToJobsListAfterPickFromComplete, IsNavigateToJobsListAfterPickFromComplete); } @Override public boolean isNavigateToJobsListAfterPickFromComplete() { return get_ValueAsBoolean(COLUMNNAME_IsNavigateToJobsListAfterPickFromComplete); } @Override public void setIsRequireScanningProductCode (final boolean IsRequireScanningProductCode) { set_Value (COLUMNNAME_IsRequireScanningProductCode, IsRequireScanningProductCode); } @Override public boolean isRequireScanningProductCode() { return get_ValueAsBoolean(COLUMNNAME_IsRequireScanningProductCode); } @Override public void setIsRequireTrolley (final boolean IsRequireTrolley) { set_Value (COLUMNNAME_IsRequireTrolley, IsRequireTrolley); } @Override public boolean isRequireTrolley() { return get_ValueAsBoolean(COLUMNNAME_IsRequireTrolley);
} @Override public void setMaxLaunchers (final int MaxLaunchers) { set_Value (COLUMNNAME_MaxLaunchers, MaxLaunchers); } @Override public int getMaxLaunchers() { return get_ValueAsInt(COLUMNNAME_MaxLaunchers); } @Override public void setMaxStartedLaunchers (final int MaxStartedLaunchers) { set_Value (COLUMNNAME_MaxStartedLaunchers, MaxStartedLaunchers); } @Override public int getMaxStartedLaunchers() { return get_ValueAsInt(COLUMNNAME_MaxStartedLaunchers); } @Override public void setMobileUI_UserProfile_DD_ID (final int MobileUI_UserProfile_DD_ID) { if (MobileUI_UserProfile_DD_ID < 1) set_ValueNoCheck (COLUMNNAME_MobileUI_UserProfile_DD_ID, null); else set_ValueNoCheck (COLUMNNAME_MobileUI_UserProfile_DD_ID, MobileUI_UserProfile_DD_ID); } @Override public int getMobileUI_UserProfile_DD_ID() { return get_ValueAsInt(COLUMNNAME_MobileUI_UserProfile_DD_ID); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_MobileUI_UserProfile_DD.java
1
请完成以下Java代码
public class BPMNMessageImpl extends BPMNElementImpl implements BPMNMessage { private MessageEventPayload messagePayload; public BPMNMessageImpl() {} public BPMNMessageImpl(String elementId) { this.setElementId(elementId); } public MessageEventPayload getMessagePayload() { return messagePayload; } public void setMessagePayload(MessageEventPayload messagePayload) { this.messagePayload = messagePayload; } @Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } BPMNMessageImpl that = (BPMNMessageImpl) o; return ( Objects.equals(getElementId(), that.getElementId()) && Objects.equals(messagePayload, that.getMessagePayload()) ); } @Override public int hashCode() { final int prime = 31; int result = super.hashCode(); result = prime * result + ((messagePayload == null) ? 0 : messagePayload.hashCode());
return result; } @Override public String toString() { return ( "BPMNMessageImpl{" + ", elementId='" + getElementId() + '\'' + ", messagePayload='" + (messagePayload != null ? messagePayload.toString() : null) + '\'' + '}' ); } }
repos\Activiti-develop\activiti-core\activiti-api-impl\activiti-api-process-model-impl\src\main\java\org\activiti\api\runtime\model\impl\BPMNMessageImpl.java
1
请完成以下Java代码
public boolean load(ByteArray byteArray, V[] value) { return false; } @Override public V get(char[] key) { return get(new String(key)); } public V get(String key) { int id = exactMatchSearch(key); if (id == -1) return null; return valueArray[id]; } @Override public V[] getValueArray(V[] a) { return valueArray; } /** * 前缀查询 * @param key * @param offset * @param maxResults * @return */ public ArrayList<Pair<String, V>> commonPrefixSearch(String key, int offset, int maxResults) { byte[] keyBytes = key.getBytes(utf8); List<Pair<Integer, Integer>> pairList = commonPrefixSearch(keyBytes, offset, maxResults); ArrayList<Pair<String, V>> resultList = new ArrayList<Pair<String, V>>(pairList.size()); for (Pair<Integer, Integer> pair : pairList) { resultList.add(new Pair<String, V>(new String(keyBytes, 0, pair.first), valueArray[pair.second])); } return resultList; } public ArrayList<Pair<String, V>> commonPrefixSearch(String key) { return commonPrefixSearch(key, 0, Integer.MAX_VALUE); } @Override public V put(String key, V value) { throw new UnsupportedOperationException("双数组不支持增量式插入"); } @Override
public V remove(Object key) { throw new UnsupportedOperationException("双数组不支持删除"); } @Override public void putAll(Map<? extends String, ? extends V> m) { throw new UnsupportedOperationException("双数组不支持增量式插入"); } @Override public void clear() { throw new UnsupportedOperationException("双数组不支持"); } @Override public Set<String> keySet() { throw new UnsupportedOperationException("双数组不支持"); } @Override public Collection<V> values() { return Arrays.asList(valueArray); } @Override public Set<Entry<String, V>> entrySet() { throw new UnsupportedOperationException("双数组不支持"); } }
repos\springboot-demo-master\hanlp\src\main\java\demo\hankcs\hanlp\collection\dartsclone\DartMap.java
1
请完成以下Java代码
public int getMaxPoolPreparedStatementPerConnectionSize() { return maxPoolPreparedStatementPerConnectionSize; } public void setMaxPoolPreparedStatementPerConnectionSize(int maxPoolPreparedStatementPerConnectionSize) { this.maxPoolPreparedStatementPerConnectionSize = maxPoolPreparedStatementPerConnectionSize; } public String getFilters() { return filters; } public void setFilters(String filters) { this.filters = filters; } public boolean isUseGlobalDataSourceStat() {
return useGlobalDataSourceStat; } public void setUseGlobalDataSourceStat(boolean useGlobalDataSourceStat) { this.useGlobalDataSourceStat = useGlobalDataSourceStat; } public String getConnectionProperties() { return connectionProperties; } public void setConnectionProperties(String connectionProperties) { this.connectionProperties = connectionProperties; } }
repos\spring-boot-student-master\spring-boot-student-mybatis-druid\src\main\java\com\xiaolyuh\druid\DruidDataSourceProperty.java
1
请完成以下Java代码
public void setAD_UI_Column_ID (int AD_UI_Column_ID) { if (AD_UI_Column_ID < 1) set_ValueNoCheck (COLUMNNAME_AD_UI_Column_ID, null); else set_ValueNoCheck (COLUMNNAME_AD_UI_Column_ID, Integer.valueOf(AD_UI_Column_ID)); } /** Get UI Column. @return UI Column */ @Override public int getAD_UI_Column_ID () { Integer ii = (Integer)get_Value(COLUMNNAME_AD_UI_Column_ID); if (ii == null) return 0; return ii.intValue(); } /** Set UI Element Group. @param AD_UI_ElementGroup_ID UI Element Group */ @Override public void setAD_UI_ElementGroup_ID (int AD_UI_ElementGroup_ID) { if (AD_UI_ElementGroup_ID < 1) set_ValueNoCheck (COLUMNNAME_AD_UI_ElementGroup_ID, null); else set_ValueNoCheck (COLUMNNAME_AD_UI_ElementGroup_ID, Integer.valueOf(AD_UI_ElementGroup_ID)); } /** Get UI Element Group. @return UI Element Group */ @Override public int getAD_UI_ElementGroup_ID () { Integer ii = (Integer)get_Value(COLUMNNAME_AD_UI_ElementGroup_ID); if (ii == null) return 0; return ii.intValue(); } /** Set Name. @param Name Alphanumeric identifier of the entity */ @Override public void setName (java.lang.String Name) { set_Value (COLUMNNAME_Name, Name); } /** Get Name. @return Alphanumeric identifier of the entity */ @Override public java.lang.String getName () { return (java.lang.String)get_Value(COLUMNNAME_Name);
} /** Set Reihenfolge. @param SeqNo Zur Bestimmung der Reihenfolge der Einträge; die kleinste Zahl kommt zuerst */ @Override public void setSeqNo (int SeqNo) { set_Value (COLUMNNAME_SeqNo, Integer.valueOf(SeqNo)); } /** Get Reihenfolge. @return Zur Bestimmung der Reihenfolge der Einträge; die kleinste Zahl kommt zuerst */ @Override public int getSeqNo () { Integer ii = (Integer)get_Value(COLUMNNAME_SeqNo); if (ii == null) return 0; return ii.intValue(); } /** Set UI Style. @param UIStyle UI Style */ @Override public void setUIStyle (java.lang.String UIStyle) { set_Value (COLUMNNAME_UIStyle, UIStyle); } /** Get UI Style. @return UI Style */ @Override public java.lang.String getUIStyle () { return (java.lang.String)get_Value(COLUMNNAME_UIStyle); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_AD_UI_ElementGroup.java
1
请完成以下Java代码
private EDIDesadvQuery buildEDIDesadvQuery(@NonNull final I_M_InOut inOut) { final String poReference = Check.assumeNotNull(inOut.getPOReference(), "In the DESADV-Context, POReference is mandatory; M_InOut_ID={}", inOut.getM_InOut_ID()); final EDIDesadvQuery.EDIDesadvQueryBuilder ediDesadvQueryBuilder = EDIDesadvQuery.builder() .poReference(poReference) .ctxAware(InterfaceWrapperHelper.getContextAware(inOut)); if (isMatchUsingBPartnerId()) { ediDesadvQueryBuilder.bPartnerId(BPartnerId.ofRepoId(inOut.getC_BPartner_ID())); } return ediDesadvQueryBuilder .build(); }
private boolean isMatchUsingBPartnerId() { return sysConfigBL.getBooleanValue(SYS_CONFIG_MATCH_USING_BPARTNER_ID, false); } private static void setExternalBPartnerInfo(@NonNull final I_EDI_DesadvLine newDesadvLine, @NonNull final I_C_OrderLine orderLineRecord) { newDesadvLine.setExternalSeqNo(orderLineRecord.getExternalSeqNo()); newDesadvLine.setC_UOM_BPartner_ID(orderLineRecord.getC_UOM_BPartner_ID()); newDesadvLine.setQtyEnteredInBPartnerUOM(ZERO); newDesadvLine.setBPartner_QtyItemCapacity(orderLineRecord.getBPartner_QtyItemCapacity()); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.edi\src\main\java\de\metas\edi\api\impl\DesadvBL.java
1
请完成以下Java代码
public List<InOutId> createCustomerReturnsFromCandidates(@NonNull final List<CustomerReturnLineCandidate> candidates) { return customerReturnsWithoutHUsProducer.create(candidates); } public I_M_InOutLine createCustomerReturnLine(@NonNull final CreateCustomerReturnLineReq request) { return customerReturnsWithoutHUsProducer.createReturnLine(request); } public void assignHandlingUnitToHeaderAndLine( @NonNull final org.compiere.model.I_M_InOutLine customerReturnLine, @NonNull final I_M_HU hu) { final ImmutableList<I_M_HU> hus = ImmutableList.of(hu); assignHandlingUnitsToHeaderAndLine(customerReturnLine, hus); }
public void assignHandlingUnitsToHeaderAndLine( @NonNull final org.compiere.model.I_M_InOutLine customerReturnLine, @NonNull final List<I_M_HU> hus) { if (hus.isEmpty()) { return; } final InOutId customerReturnId = InOutId.ofRepoId(customerReturnLine.getM_InOut_ID()); final I_M_InOut customerReturn = huInOutBL.getById(customerReturnId, I_M_InOut.class); huInOutBL.addAssignedHandlingUnits(customerReturn, hus); huInOutBL.setAssignedHandlingUnits(customerReturnLine, hus); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.handlingunits.base\src\main\java\de\metas\handlingunits\inout\returns\ReturnsServiceFacade.java
1
请在Spring Boot框架中完成以下Java代码
public class Packageable { @NonNull OrgId orgId; @NonNull ShipmentScheduleId shipmentScheduleId; @NonNull Quantity qtyOrdered; @NonNull Quantity qtyToDeliver; @NonNull Quantity qtyDelivered; @NonNull Quantity qtyPickedAndDelivered; @NonNull Quantity qtyPickedNotDelivered; /** * quantity picked planned (i.e. picking candidates not already processed) */ @NonNull Quantity qtyPickedPlanned; @Nullable UomId catchWeightUomId; @NonNull BPartnerId customerId; String customerBPValue; String customerName; @NonNull BPartnerLocationId customerLocationId; String customerBPLocationName; String customerAddress; @NonNull BPartnerLocationId handoverLocationId; @NonNull WarehouseId warehouseId; String warehouseName; WarehouseTypeId warehouseTypeId; DeliveryViaRule deliveryViaRule; ShipperId shipperId; String shipperName; boolean displayed; InstantAndOrgId deliveryDate; InstantAndOrgId preparationDate; @NonNull @Default Optional<ShipmentAllocationBestBeforePolicy> bestBeforePolicy = Optional.empty(); FreightCostRule freightCostRule; @NonNull ProductId productId; String productName; @NonNull AttributeSetInstanceId asiId; @Nullable
OrderId salesOrderId; @Nullable String salesOrderDocumentNo; @Nullable String salesOrderDocSubType; @Nullable String poReference; @Nullable OrderLineId salesOrderLineIdOrNull; @Nullable Money salesOrderLineNetAmt; @Nullable PPOrderId pickFromOrderId; @NonNull @Default HUPIItemProductId packToHUPIItemProductId = HUPIItemProductId.VIRTUAL_HU; @Nullable UserId lockedBy; @Nullable public OrderAndLineId getSalesOrderAndLineIdOrNull() {return OrderAndLineId.ofNullable(salesOrderId, salesOrderLineIdOrNull);} public UomId getUomId() {return qtyOrdered.getUomId();} public I_C_UOM getUOM() {return qtyOrdered.getUOM();} public Quantity getQtyPickedOrDelivered() { // NOTE: keep in sync with M_Packageable_V.QtyPickedOrDelivered return getQtyDelivered() .add(getQtyPickedNotDelivered()) .add(getQtyPickedPlanned()); } public Quantity getQtyToPick() { return qtyToDeliver // .subtract(qtyPickedNotDelivered) don't subtract the qtyPickedNotDelivered as it was already subtracted from the qtyToDeliver // IMPORTANT: don't subtract the Qty PickedPlanned // because we will also allocate existing DRAFT picking candidates // .subtract(qtyPickedPlanned) .toZeroIfNegative(); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.swat\de.metas.swat.base\src\main\java\de\metas\picking\api\Packageable.java
2
请完成以下Java代码
public class RegisterParam { @NotEmpty(message="姓名不能为空") private String userName; @NotEmpty(message="密码不能为空") @Length(min=6,message="密码长度不能小于6位") private String password; @Email private String email; 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 getEmail() { return email; } public void setEmail(String email) { this.email = email; } @Override public String toString() { return ToStringBuilder.reflectionToString(this); } }
repos\spring-boot-leaning-master\1.x\第16课:综合实战用户管理系统\user-manage\src\main\java\com\neo\param\RegisterParam.java
1
请在Spring Boot框架中完成以下Java代码
protected <T> T checkNotNull(T reference, String notFoundMessage) throws ThingsboardException { if (reference == null) { throw new ThingsboardException(notFoundMessage, ThingsboardErrorCode.ITEM_NOT_FOUND); } return reference; } protected <T> T checkNotNull(Optional<T> reference) throws ThingsboardException { return checkNotNull(reference, "Requested item wasn't found!"); } protected <T> T checkNotNull(Optional<T> reference, String notFoundMessage) throws ThingsboardException { if (reference.isPresent()) { return reference.get(); } else { throw new ThingsboardException(notFoundMessage, ThingsboardErrorCode.ITEM_NOT_FOUND); } } protected <I extends EntityId> I emptyId(EntityType entityType) { return (I) EntityIdFactory.getByTypeAndUuid(entityType, ModelConstants.NULL_UUID); } protected ListenableFuture<UUID> autoCommit(User user, EntityId entityId) { if (vcService != null) { return vcService.autoCommit(user, entityId); } else {
// We do not support auto-commit for rule engine return Futures.immediateFailedFuture(new RuntimeException("Operation not supported!")); } } protected ListenableFuture<UUID> autoCommit(User user, EntityType entityType, List<UUID> entityIds) { if (vcService != null) { return vcService.autoCommit(user, entityType, entityIds); } else { // We do not support auto-commit for rule engine return Futures.immediateFailedFuture(new RuntimeException("Operation not supported!")); } } }
repos\thingsboard-master\application\src\main\java\org\thingsboard\server\service\entitiy\AbstractTbEntityService.java
2
请完成以下Java代码
public JaasSubjectHolder login(String username, String password) { LOG.debug("Trying to authenticate " + username + " with Kerberos"); JaasSubjectHolder result; try { LoginContext loginContext = new LoginContext("", null, new KerberosClientCallbackHandler(username, password), new LoginConfig(this.debug)); loginContext.login(); Subject jaasSubject = loginContext.getSubject(); if (LOG.isDebugEnabled()) { LOG.debug("Kerberos authenticated user: " + jaasSubject); } String validatedUsername = jaasSubject.getPrincipals().iterator().next().toString(); Subject subjectCopy = JaasUtil.copySubject(jaasSubject); result = new JaasSubjectHolder(subjectCopy, validatedUsername); if (!this.multiTier) { loginContext.logout(); } } catch (LoginException ex) { throw new BadCredentialsException("Kerberos authentication failed", ex); } return result; } public void setDebug(boolean debug) { this.debug = debug; } public void setMultiTier(boolean multiTier) { this.multiTier = multiTier; } private static final class LoginConfig extends Configuration { private boolean debug; private LoginConfig(boolean debug) { super(); this.debug = debug; } @Override public AppConfigurationEntry[] getAppConfigurationEntry(String name) { HashMap<String, String> options = new HashMap<String, String>(); options.put("storeKey", "true"); if (this.debug) { options.put("debug", "true"); } return new AppConfigurationEntry[] { new AppConfigurationEntry("com.sun.security.auth.module.Krb5LoginModule", AppConfigurationEntry.LoginModuleControlFlag.REQUIRED, options), }; } } static final class KerberosClientCallbackHandler implements CallbackHandler {
private String username; private String password; private KerberosClientCallbackHandler(String username, String password) { this.username = username; this.password = password; } @Override public void handle(Callback[] callbacks) throws IOException, UnsupportedCallbackException { for (Callback callback : callbacks) { if (callback instanceof NameCallback) { NameCallback ncb = (NameCallback) callback; ncb.setName(this.username); } else if (callback instanceof PasswordCallback) { PasswordCallback pwcb = (PasswordCallback) callback; pwcb.setPassword(this.password.toCharArray()); } else { throw new UnsupportedCallbackException(callback, "We got a " + callback.getClass().getCanonicalName() + ", but only NameCallback and PasswordCallback is supported"); } } } } }
repos\spring-security-main\kerberos\kerberos-core\src\main\java\org\springframework\security\kerberos\authentication\sun\SunJaasKerberosClient.java
1
请完成以下Java代码
public List<V> get(final Object key) { return map.get(key); } @Override public List<V> put(final K key, final List<V> value) { return map.put(key, value); } /** * Add the given single value to the current list of values for the given key. * * @param key the key * @param value the value to be added */ public void add(final K key, final V value) { List<V> values = map.get(key); if (values == null) { values = newValuesList(); map.put(key, values); } values.add(value); } protected List<V> newValuesList() { return new ArrayList<V>(); } /** * Set the given single value under the given key. * * @param key the key * @param value the value to set */ public void set(final K key, final V value) { List<V> values = map.get(key); if (values == null) { values = new ArrayList<V>(); map.put(key, values); } else {
values.clear(); } values.add(value); } @Override public List<V> remove(final Object key) { return map.remove(key); } @Override public void putAll(Map<? extends K, ? extends List<V>> m) { map.putAll(m); } @Override public void clear() { map.clear(); } @Override public Set<K> keySet() { return map.keySet(); } @Override public Collection<List<V>> values() { return map.values(); } @Override public Set<Map.Entry<K, List<V>>> entrySet() { return map.entrySet(); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.util\src\main\java\de\metas\util\collections\MultiValueMap.java
1
请完成以下Java代码
public class InputMessage { String sender; String recipient; LocalDateTime sentAt; String message; public InputMessage() { } public String getSender() { return sender; } public void setSender(String sender) { this.sender = sender; } public String getRecipient() { return recipient; } public void setRecipient(String recipient) { this.recipient = recipient; } public LocalDateTime getSentAt() { return sentAt; } public void setSentAt(LocalDateTime sentAt) { this.sentAt = sentAt; } public String getMessage() { return message; } public void setMessage(String message) { this.message = message; } public InputMessage(String sender, String recipient, LocalDateTime sentAt, String message) { this.sender = sender; this.recipient = recipient; this.sentAt = sentAt; this.message = message;
} @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; InputMessage message1 = (InputMessage) o; return Objects.equal(sender, message1.sender) && Objects.equal(recipient, message1.recipient) && Objects.equal(sentAt, message1.sentAt) && Objects.equal(message, message1.message); } @Override public int hashCode() { return Objects.hashCode(sender, recipient, sentAt, message); } }
repos\tutorials-master\apache-kafka-2\src\main\java\com\baeldung\flink\model\InputMessage.java
1
请完成以下Java代码
LocalDate computeBestBeforeDate() { if (attributesBL.isAutomaticallySetBestBeforeDate()) { final PPOrderLineRow row = getSingleSelectedRow(); final int guaranteeDaysMin = productDAO.getProductGuaranteeDaysMinFallbackProductCategory(row.getProductId()); if (guaranteeDaysMin <= 0) { return null; } final I_PP_Order ppOrderPO = huPPOrderBL.getById(row.getOrderId()); final LocalDate datePromised = TimeUtil.asLocalDate(ppOrderPO.getDatePromised()); return datePromised.plusDays(guaranteeDaysMin); } else { return null; } } private IPPOrderReceiptHUProducer newReceiptCandidatesProducer() { final PPOrderLineRow row = getSingleSelectedRow(); final PPOrderLineType type = row.getType(); if (type == PPOrderLineType.MainProduct) { final PPOrderId ppOrderId = row.getOrderId(); return huPPOrderBL.receivingMainProduct(ppOrderId); }
else if (type == PPOrderLineType.BOMLine_ByCoProduct) { final PPOrderBOMLineId ppOrderBOMLineId = row.getOrderBOMLineId(); return huPPOrderBL.receivingByOrCoProduct(ppOrderBOMLineId); } else { throw new AdempiereException("Receiving is not allowed"); } } @NonNull private Quantity getIndividualCUsCount() { if (p_NumberOfCUs <= 0) { throw new FillMandatoryException(PARAM_NumberOfCUs); } return Quantity.of(p_NumberOfCUs, getSingleSelectedRow().getUomNotNull()); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.ui.web.base\src\main\java\de\metas\ui\web\pporder\process\WEBUI_PP_Order_Receipt.java
1
请完成以下Java代码
public static TableName extractSingleTableName(final ColumnNameFQ... columnNames) { if (columnNames == null || columnNames.length == 0) { throw new AdempiereException("Cannot extract table name from null/empty column names array"); } TableName singleTableName = null; for (final ColumnNameFQ columnNameFQ : columnNames) { if (columnNameFQ == null) { continue; } else if (singleTableName == null) { singleTableName = columnNameFQ.getTableName();
} else if (!TableName.equals(singleTableName, columnNameFQ.getTableName())) { throw new AdempiereException("More than one table name found in " + Arrays.asList(columnNames)); } } if (singleTableName == null) { throw new AdempiereException("Cannot extract table name from null/empty column names array: " + Arrays.asList(columnNames)); } return singleTableName; } }
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\org\adempiere\ad\table\api\ColumnNameFQ.java
1
请完成以下Java代码
public void reconnect() { eventGroup.schedule(new Runnable() { @Override public void run() { logger.info("[reconnect][开始重连]"); try { start(); } catch (InterruptedException e) { logger.error("[reconnect][重连失败]", e); } } }, RECONNECT_SECONDS, TimeUnit.SECONDS); logger.info("[reconnect][{} 秒后将发起重连]", RECONNECT_SECONDS); } /** * 关闭 Netty Server */ @PreDestroy public void shutdown() { // 关闭 Netty Client if (channel != null) { channel.close(); }
// 优雅关闭一个 EventLoopGroup 对象 eventGroup.shutdownGracefully(); } /** * 发送消息 * * @param invocation 消息体 */ public void send(Invocation invocation) { if (channel == null) { logger.error("[send][连接不存在]"); return; } if (!channel.isActive()) { logger.error("[send][连接({})未激活]", channel.id()); return; } // 发送消息 channel.writeAndFlush(invocation); } }
repos\SpringBoot-Labs-master\lab-67\lab-67-netty-demo\lab-67-netty-demo-client\src\main\java\cn\iocoder\springboot\lab67\nettyclientdemo\client\NettyClient.java
1
请完成以下Java代码
public int getLineNo() { return configLineNo; } @Override public String getMessage() { final StringBuilder sb = new StringBuilder(); sb.append("Parse error: "); final String message = super.getMessage(); if (message != null && !message.isEmpty()) { sb.append(message); } else { sb.append("unknown");
} if (configFile != null) { sb.append("\nConfig file: ").append(configFile); } if (configLineNo > 0) { sb.append("\nLine: ").append(configLineNo); } return sb.toString(); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.migration\de.metas.migration.base\src\main\java\de\metas\migration\sql\postgresql\PgPassParseException.java
1
请完成以下Java代码
public static LockOwner newOwner() { final String ownerNamePrefix = null; return newOwner(ownerNamePrefix); } /** * Creates a new owner whose name consists of the given <code>ownerNamePrefix</code> and a unique suffix. * */ public static LockOwner newOwner(final String ownerNamePrefix) { final Object ownerNameUniquePart = UUID.randomUUID(); return newOwner(ownerNamePrefix, ownerNameUniquePart); } /** * Creates a new owner whose name consists of the given <code>ownerNamePrefix</code> and the given <code>ownerNameUniquePart</code> which is supposed to be unique. * * @param ownerNamePrefix the owner name's prefix. <code>null</code> is substituted with <code>"Unknown"</code>. */ public static LockOwner newOwner(final String ownerNamePrefix, final Object ownerNameUniquePart) { Check.assumeNotNull(ownerNameUniquePart, "ownerNameUniquePart not null"); final String ownerNamePrefixToUse; if (Check.isEmpty(ownerNamePrefix, true)) { ownerNamePrefixToUse = "Unknown"; } else { ownerNamePrefixToUse = ownerNamePrefix.trim(); } final String ownerName = ownerNamePrefixToUse + "_" + ownerNameUniquePart; return new LockOwner(ownerName, OwnerType.RealOwner); } /** * Creates a new instance with "static" name.
* * @param ownerName the name of the new owner. Other than with the <code>newOwner(...)</code> methods, nothing will be added to it. * @return */ public static final LockOwner forOwnerName(final String ownerName) { Check.assumeNotEmpty(ownerName, "ownerName not empty"); return new LockOwner(ownerName, OwnerType.RealOwner); } private final String ownerName; private final OwnerType ownerType; private LockOwner(final String ownerName, final OwnerType ownerType) { Check.assumeNotNull(ownerName, "Param ownerName is not null"); this.ownerName = ownerName; this.ownerType = ownerType; } public boolean isRealOwner() { return ownerType == OwnerType.RealOwner; } public boolean isRealOwnerOrNoOwner() { return isRealOwner() || isNoOwner(); } public boolean isNoOwner() { return ownerType == OwnerType.None; } public boolean isAnyOwner() { return ownerType == OwnerType.Any; } }
repos\metasfresh-new_dawn_uat\backend\de.metas.async\src\main\java\de\metas\lock\api\LockOwner.java
1
请完成以下Java代码
public BigDecimal getRate() { return rate; } /** * Sets the value of the rate property. * * @param value * allowed object is * {@link BigDecimal } * */ public void setRate(BigDecimal value) { this.rate = value; } /** * Gets the value of the br property. * * @return * possible object is * {@link ChargeBearerType1Code } * */ public ChargeBearerType1Code getBr() { return br; } /** * Sets the value of the br property. * * @param value * allowed object is * {@link ChargeBearerType1Code } * */ public void setBr(ChargeBearerType1Code value) { this.br = value; } /** * Gets the value of the agt property. * * @return * possible object is * {@link BranchAndFinancialInstitutionIdentification5 } * */ public BranchAndFinancialInstitutionIdentification5 getAgt() { return agt; } /** * Sets the value of the agt property. * * @param value * allowed object is * {@link BranchAndFinancialInstitutionIdentification5 } * */ public void setAgt(BranchAndFinancialInstitutionIdentification5 value) {
this.agt = value; } /** * Gets the value of the tax property. * * @return * possible object is * {@link TaxCharges2 } * */ public TaxCharges2 getTax() { return tax; } /** * Sets the value of the tax property. * * @param value * allowed object is * {@link TaxCharges2 } * */ public void setTax(TaxCharges2 value) { this.tax = value; } }
repos\metasfresh-new_dawn_uat\backend\de.metas.banking\de.metas.banking.camt53\src\main\java-xjc\de\metas\banking\camt53\jaxb\camt053_001_04\ChargesRecord2.java
1
请在Spring Boot框架中完成以下Java代码
public Optional<GolfTournament> getGolfTournament() { return Optional.ofNullable(this.golfTournament); } @Override @PreDestroy public void close() { this.golfTournament = null; } public boolean isFinished(@Nullable GolfTournament golfTournament) { return golfTournament == null || golfTournament.isFinished(); } public boolean isNotFinished(@Nullable GolfTournament golfTournament) { return !isFinished(golfTournament); } public PgaTourService manage(GolfTournament golfTournament) { GolfTournament currentGolfTournament = this.golfTournament; Assert.state(currentGolfTournament == null, () -> String.format("Can only manage 1 golf tournament at a time; currently managing [%s]", currentGolfTournament)); this.golfTournament = golfTournament; return this; } // tag::play[] @Scheduled(initialDelay = 5000L, fixedDelay = 2500L) public void play() { GolfTournament golfTournament = this.golfTournament; if (isNotFinished(golfTournament)) { playHole(golfTournament); finish(golfTournament); } } // end::play[] private synchronized void playHole(@NonNull GolfTournament golfTournament) { GolfCourse golfCourse = golfTournament.getGolfCourse(); Set<Integer> occupiedHoles = new HashSet<>(); for (GolfTournament.Pairing pairing : golfTournament) { int hole = pairing.nextHole(); if (!occupiedHoles.contains(hole)) {
if (golfCourse.isValidHoleNumber(hole)) { occupiedHoles.add(hole); pairing.setHole(hole); updateScore(this::calculateRunningScore, pairing.getPlayerOne()); updateScore(this::calculateRunningScore, pairing.getPlayerTwo()); } } } } private Golfer updateScore(@NonNull Function<Integer, Integer> scoreFunction, @NonNull Golfer player) { player.setScore(scoreFunction.apply(player.getScore())); this.golferService.update(player); return player; } private int calculateFinalScore(@Nullable Integer scoreRelativeToPar) { int finalScore = scoreRelativeToPar != null ? scoreRelativeToPar : 0; int parForCourse = getGolfTournament() .map(GolfTournament::getGolfCourse) .map(GolfCourse::getParForCourse) .orElse(GolfCourse.STANDARD_PAR_FOR_COURSE); return parForCourse + finalScore; } private int calculateRunningScore(@Nullable Integer currentScore) { int runningScore = currentScore != null ? currentScore : 0; int scoreDelta = this.random.nextInt(SCORE_DELTA_BOUND); scoreDelta *= this.random.nextBoolean() ? -1 : 1; return runningScore + scoreDelta; } private void finish(@NonNull GolfTournament golfTournament) { for (GolfTournament.Pairing pairing : golfTournament) { if (pairing.signScorecard()) { updateScore(this::calculateFinalScore, pairing.getPlayerOne()); updateScore(this::calculateFinalScore, pairing.getPlayerTwo()); } } } } // end::class[]
repos\spring-boot-data-geode-main\spring-geode-samples\caching\inline-async\src\main\java\example\app\caching\inline\async\client\service\PgaTourService.java
2
请完成以下Java代码
public class TbMsgProfilerInfo { private final UUID msgId; private AtomicLong totalProcessingTime = new AtomicLong(); private Lock stateLock = new ReentrantLock(); private RuleNodeId currentRuleNodeId; private long stateChangeTime; public TbMsgProfilerInfo(UUID msgId) { this.msgId = msgId; } 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
1
请完成以下Java代码
public ProcessPreconditionsResolution withCaptionMapper(@Nullable final ProcessCaptionMapper captionMapper) { return toBuilder().captionMapper(captionMapper).build(); } /** * Override default SortNo used with ordering related processes */ public ProcessPreconditionsResolution withSortNo(final int sortNo) { return !this.sortNo.isPresent() || this.sortNo.getAsInt() != sortNo ? toBuilder().sortNo(OptionalInt.of(sortNo)).build() : this; } public @NonNull OptionalInt getSortNo() {return this.sortNo;}
public ProcessPreconditionsResolution and(final Supplier<ProcessPreconditionsResolution> resolutionSupplier) { if (isRejected()) { return this; } return resolutionSupplier.get(); } public void throwExceptionIfRejected() { if (isRejected()) { throw new AdempiereException(getRejectReason()); } } }
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\de\metas\process\ProcessPreconditionsResolution.java
1
请在Spring Boot框架中完成以下Java代码
public static class Token { /** * Time-to-live for an authorization code. */ private Duration authorizationCodeTimeToLive = Duration.ofMinutes(5); /** * Time-to-live for an access token. */ private Duration accessTokenTimeToLive = Duration.ofMinutes(5); /** * Token format for an access token. */ private String accessTokenFormat = "self-contained"; /** * Time-to-live for a device code. */ private Duration deviceCodeTimeToLive = Duration.ofMinutes(5); /** * Whether refresh tokens are reused or a new refresh token is issued when * returning the access token response. */ private boolean reuseRefreshTokens = true; /** * Time-to-live for a refresh token. */ private Duration refreshTokenTimeToLive = Duration.ofMinutes(60); /** * JWS algorithm for signing the ID Token. */ private String idTokenSignatureAlgorithm = "RS256"; public Duration getAuthorizationCodeTimeToLive() { return this.authorizationCodeTimeToLive; } public void setAuthorizationCodeTimeToLive(Duration authorizationCodeTimeToLive) { this.authorizationCodeTimeToLive = authorizationCodeTimeToLive; } public Duration getAccessTokenTimeToLive() { return this.accessTokenTimeToLive; } public void setAccessTokenTimeToLive(Duration accessTokenTimeToLive) { this.accessTokenTimeToLive = accessTokenTimeToLive; } public String getAccessTokenFormat() { return this.accessTokenFormat; } public void setAccessTokenFormat(String accessTokenFormat) { this.accessTokenFormat = accessTokenFormat; } public Duration getDeviceCodeTimeToLive() { return this.deviceCodeTimeToLive;
} public void setDeviceCodeTimeToLive(Duration deviceCodeTimeToLive) { this.deviceCodeTimeToLive = deviceCodeTimeToLive; } public boolean isReuseRefreshTokens() { return this.reuseRefreshTokens; } public void setReuseRefreshTokens(boolean reuseRefreshTokens) { this.reuseRefreshTokens = reuseRefreshTokens; } public Duration getRefreshTokenTimeToLive() { return this.refreshTokenTimeToLive; } public void setRefreshTokenTimeToLive(Duration refreshTokenTimeToLive) { this.refreshTokenTimeToLive = refreshTokenTimeToLive; } public String getIdTokenSignatureAlgorithm() { return this.idTokenSignatureAlgorithm; } public void setIdTokenSignatureAlgorithm(String idTokenSignatureAlgorithm) { this.idTokenSignatureAlgorithm = idTokenSignatureAlgorithm; } } }
repos\spring-boot-4.0.1\module\spring-boot-security-oauth2-authorization-server\src\main\java\org\springframework\boot\security\oauth2\server\authorization\autoconfigure\servlet\OAuth2AuthorizationServerProperties.java
2
请在Spring Boot框架中完成以下Java代码
public User get(Long id) { UserSocialMedia user = (UserSocialMedia) userDaoImpl.read(id); List<Tweet> tweets = tweetDaoImpl.fetchTweets(user.getEmail()); user.setTweets(tweets); return user; } @Override public void add(User user) { userDaoImpl.create(user); } @Override public void remove(User user) { } @Override public void update(User user) { } @Override public List<Tweet> fetchTweets(User user) {
return tweetDaoImpl.fetchTweets(user.getEmail()); } @Override public User findByUserName(String userName) { return null; } @Override public User findByEmail(String email) { return null; } }
repos\tutorials-master\patterns-modules\design-patterns-architectural\src\main\java\com\baeldung\repositoryvsdaopattern\UserRepositoryImpl.java
2
请完成以下Java代码
public String getText() { return m_text; } // getText /** * Import Text from File */ private void importText() { JFileChooser jc = new JFileChooser(); jc.setDialogTitle(msgBL.getMsg(Env.getCtx(), "ImportText")); jc.setDialogType(JFileChooser.OPEN_DIALOG); jc.setFileSelectionMode(JFileChooser.FILES_ONLY); // if (jc.showOpenDialog(this) != JFileChooser.APPROVE_OPTION) return; StringBuffer sb = new StringBuffer(); try { InputStreamReader in = new InputStreamReader (new FileInputStream (jc.getSelectedFile())); char[] cbuf = new char[1024]; int count; while ((count = in.read(cbuf)) > 0) sb.append(cbuf, 0, count); in.close(); } catch (Exception e) { log.warn(e.getMessage()); return; } textArea.setText(sb.toString()); updateStatusBar(); } // importText /** * Export Text to File */ private void exportText() { JFileChooser jc = new JFileChooser(); jc.setDialogTitle(msgBL.getMsg(Env.getCtx(), "ExportText")); jc.setDialogType(JFileChooser.SAVE_DIALOG); jc.setFileSelectionMode(JFileChooser.FILES_ONLY); // if (jc.showSaveDialog(this) != JFileChooser.APPROVE_OPTION) return; try { BufferedWriter bout = new BufferedWriter (new OutputStreamWriter (new FileOutputStream (jc.getSelectedFile()))); bout.write(textArea.getText()); bout.flush(); bout.close(); } catch (Exception e) { log.warn(e.getMessage()); } } // exportText
/** * ChangeListener for TabbedPane * @param e event */ @Override public void stateChanged(ChangeEvent e) { if (tabbedPane.getSelectedIndex() == 1) // switch to HTML textPane.setText(textArea.getText()); } // stateChanged @Override public void keyTyped (KeyEvent e) { } @Override public void keyPressed (KeyEvent e) { } @Override public void keyReleased (KeyEvent e) { updateStatusBar(); } // metas: begin public Editor(Frame frame, String header, String text, boolean editable, int maxSize, GridField gridField) { this(frame, header, text, editable, maxSize); BoilerPlateMenu.createFieldMenu(textArea, null, gridField); } private static final GridField getGridField(Container c) { if (c == null) { return null; } GridField field = null; if (c instanceof VEditor) { VEditor editor = (VEditor)c; field = editor.getField(); } else { try { field = (GridField)c.getClass().getMethod("getField").invoke(c); } catch (Exception e) { final AdempiereException ex = new AdempiereException("Cannot get GridField from " + c, e); log.warn(ex.getLocalizedMessage(), ex); } } return field; } // metas: end } // Editor
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\client\src\main\java-legacy\org\compiere\grid\ed\Editor.java
1
请完成以下Java代码
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 Orders extends DateAudit { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private Long id; private String email; private String additionalPhone; @NotBlank private String address; private String name; @Lob private String comment; private Float deliveryPrice; private String paymentNumber; private String carMark; private String carModel; private String carColor; private String carNumber; private String nameDriver; private String phoneDriver; @Column(columnDefinition = "ENUM('awaitingPayment', 'inProgress', 'paid', 'transferredToDeliveryService', 'completed', 'NEW', 'canceled', 'courierSearch', 'courierFound' ,'deliveryInProgress','awaitingConfirmation', 'delivered') NOT NULL DEFAULT 'inProgress'") @Enumerated(EnumType.STRING)
private OrderStatus status; private Long taxiOrderId; /** * Buy from Online shop; * Покупатель (Customer) * */ // @ManyToOne(fetch = FetchType.EAGER, cascade = CascadeType.ALL) // @JoinColumn(name = "User", nullable = false) @ManyToOne(cascade = CascadeType.ALL) private User user; @OneToMany(mappedBy = "order", fetch = FetchType.EAGER) private List<OrderDetails> orderDetailsList; public Orders(String additionalPhone, @NotBlank String address, String name, String comment, List<Good> goodList, Float deliveryPrice) { this.additionalPhone = additionalPhone; this.address = address; this.name = name; this.comment = comment; this.deliveryPrice = deliveryPrice; } public void setOrderDetailList(List<OrderDetails> ordersList) { this.orderDetailsList = ordersList; } }
repos\SpringBoot-Projects-FullStack-master\Part-9.SpringBoot-React-Projects\Project-2.SpringBoot-React-ShoppingMall\fullstack\backend\src\main\java\com\urunov\model\Orders.java
1
请完成以下Java代码
public static abstract class Vehicle { private String make; private String model; protected Vehicle() { } protected Vehicle(String make, String model) { this.make = make; this.model = model; } public String getMake() { return make; } public void setMake(String make) { this.make = make; } public String getModel() { return model; } public void setModel(String model) { this.model = model; } } public static abstract class Car extends Vehicle { private int seatingCapacity; private double topSpeed; protected Car() { } protected Car(String make, String model, int seatingCapacity, double topSpeed) { super(make, model); this.seatingCapacity = seatingCapacity; this.topSpeed = topSpeed; } public int getSeatingCapacity() { return seatingCapacity; } public void setSeatingCapacity(int seatingCapacity) { this.seatingCapacity = seatingCapacity;
} public double getTopSpeed() { return topSpeed; } public void setTopSpeed(double topSpeed) { this.topSpeed = topSpeed; } } public static class Sedan extends Car { public Sedan() { } public Sedan(String make, String model, int seatingCapacity, double topSpeed) { super(make, model, seatingCapacity, topSpeed); } } public static class Crossover extends Car { private double towingCapacity; public Crossover() { } public Crossover(String make, String model, int seatingCapacity, double topSpeed, double towingCapacity) { super(make, model, seatingCapacity, topSpeed); this.towingCapacity = towingCapacity; } public double getTowingCapacity() { return towingCapacity; } public void setTowingCapacity(double towingCapacity) { this.towingCapacity = towingCapacity; } } }
repos\tutorials-master\jackson-modules\jackson-core\src\main\java\com\baeldung\jackson\inheritance\IgnoranceMixinOrIntrospection.java
1
请完成以下Java代码
public class SentinelVersion { private int majorVersion; private int minorVersion; private int fixVersion; private String postfix; public SentinelVersion() { this(0, 0, 0); } public SentinelVersion(int major, int minor, int fix) { this(major, minor, fix, null); } public SentinelVersion(int major, int minor, int fix, String postfix) { this.majorVersion = major; this.minorVersion = minor; this.fixVersion = fix; this.postfix = postfix; } /** * 000, 000, 000 */ public int getFullVersion() { return majorVersion * 1000000 + minorVersion * 1000 + fixVersion; } public int getMajorVersion() { return majorVersion; } public SentinelVersion setMajorVersion(int majorVersion) { this.majorVersion = majorVersion; return this; } public int getMinorVersion() { return minorVersion; } public SentinelVersion setMinorVersion(int minorVersion) { this.minorVersion = minorVersion; return this; } public int getFixVersion() { return fixVersion; } public SentinelVersion setFixVersion(int fixVersion) { this.fixVersion = fixVersion; return this; } public String getPostfix() { return postfix; } public SentinelVersion setPostfix(String postfix) {
this.postfix = postfix; return this; } public boolean greaterThan(SentinelVersion version) { if (version == null) { return true; } return getFullVersion() > version.getFullVersion(); } public boolean greaterOrEqual(SentinelVersion version) { if (version == null) { return true; } return getFullVersion() >= version.getFullVersion(); } @Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } SentinelVersion that = (SentinelVersion)o; if (getFullVersion() != that.getFullVersion()) { return false; } return postfix != null ? postfix.equals(that.postfix) : that.postfix == null; } @Override public int hashCode() { int result = majorVersion; result = 31 * result + minorVersion; result = 31 * result + fixVersion; result = 31 * result + (postfix != null ? postfix.hashCode() : 0); return result; } @Override public String toString() { return "SentinelVersion{" + "majorVersion=" + majorVersion + ", minorVersion=" + minorVersion + ", fixVersion=" + fixVersion + ", postfix='" + postfix + '\'' + '}'; } }
repos\spring-boot-student-master\spring-boot-student-sentinel-dashboard\src\main\java\com\alibaba\csp\sentinel\dashboard\datasource\entity\SentinelVersion.java
1
请在Spring Boot框架中完成以下Java代码
public Optional<User> getUserWithAuthoritiesByLogin(String login) { return userRepository.findOneWithAuthoritiesByLogin(login); } @Transactional(readOnly = true) public Optional<User> getUserWithAuthorities(Long id) { return userRepository.findOneWithAuthoritiesById(id); } @Transactional(readOnly = true) public Optional<User> getUserWithAuthorities() { return SecurityUtils.getCurrentUserLogin().flatMap(userRepository::findOneWithAuthoritiesByLogin); } /** * Not activated users should be automatically deleted after 3 days. * <p> * This is scheduled to get fired everyday, at 01:00 (am).
*/ @Scheduled(cron = "0 0 1 * * ?") public void removeNotActivatedUsers() { userRepository .findAllByActivatedIsFalseAndCreatedDateBefore(Instant.now().minus(3, ChronoUnit.DAYS)) .forEach(user -> { log.debug("Deleting not activated user {}", user.getLogin()); userRepository.delete(user); }); } /** * @return a list of all the authorities */ public List<String> getAuthorities() { return authorityRepository.findAll().stream().map(Authority::getName).collect(Collectors.toList()); } }
repos\tutorials-master\jhipster-6\bookstore-monolith\src\main\java\com\baeldung\jhipster6\service\UserService.java
2
请完成以下Java代码
public void setEditable (boolean value) { super.setReadWrite(value); } // setEditable /** * IsEditable * @return true if editable */ public boolean isEditable() { return super.isReadWrite(); } // isEditable /** * Set Editor to value * @param value */ @Override public void setValue (Object value) { boolean sel = false; if (value != null) { if (value instanceof Boolean) sel = ((Boolean)value).booleanValue(); else sel = "Y".equals(value); } setSelected(sel); } // setValue /** * Property Change Listener * @param evt */ @Override public void propertyChange (PropertyChangeEvent evt) { if (evt.getPropertyName().equals(org.compiere.model.GridField.PROPERTY)) setValue(evt.getNewValue()); } // propertyChange /** * Return Editor value * @return value */ @Override public Object getValue() { return isSelected(); } // getValue /** * Return Display Value * @return value */ @Override public String getDisplay() { String value = isSelected() ? "Y" : "N"; return Msg.translate(Env.getCtx(), value); } // getDisplay /** * Set Background (nop) */ public void setBackground()
{ } // setBackground /** * Action Listener - data binding * @param e */ @Override public void actionPerformed(ActionEvent e) { try { fireVetoableChange(m_columnName, null, getValue()); } catch (PropertyVetoException pve) { } } // actionPerformed /** * Set Field/WindowNo for ValuePreference (NOP) * @param mField */ @Override public void setField (org.compiere.model.GridField mField) { m_mField = mField; EditorContextPopupMenu.onGridFieldSet(this); } // setField @Override public GridField getField() { return m_mField; } /** * @return Returns the savedMnemonic. */ public char getSavedMnemonic () { return m_savedMnemonic; } // getSavedMnemonic /** * @param savedMnemonic The savedMnemonic to set. */ public void setSavedMnemonic (char savedMnemonic) { m_savedMnemonic = savedMnemonic; } // getSavedMnemonic @Override public boolean isAutoCommit() { return true; } } // VCheckBox
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\client\src\main\java-legacy\org\compiere\grid\ed\VCheckBox.java
1
请完成以下Java代码
protected org.compiere.model.POInfo initPO(final Properties ctx) { return org.compiere.model.POInfo.getPOInfo(Table_Name); } @Override public void setC_BP_BankAccount_ID (final int C_BP_BankAccount_ID) { if (C_BP_BankAccount_ID < 1) set_ValueNoCheck (COLUMNNAME_C_BP_BankAccount_ID, null); else set_ValueNoCheck (COLUMNNAME_C_BP_BankAccount_ID, C_BP_BankAccount_ID); } @Override public int getC_BP_BankAccount_ID() { return get_ValueAsInt(COLUMNNAME_C_BP_BankAccount_ID); } @Override public void setC_BP_BankAccount_InvoiceAutoAllocateRule_ID (final int C_BP_BankAccount_InvoiceAutoAllocateRule_ID) { if (C_BP_BankAccount_InvoiceAutoAllocateRule_ID < 1) set_ValueNoCheck (COLUMNNAME_C_BP_BankAccount_InvoiceAutoAllocateRule_ID, null); else
set_ValueNoCheck (COLUMNNAME_C_BP_BankAccount_InvoiceAutoAllocateRule_ID, C_BP_BankAccount_InvoiceAutoAllocateRule_ID); } @Override public int getC_BP_BankAccount_InvoiceAutoAllocateRule_ID() { return get_ValueAsInt(COLUMNNAME_C_BP_BankAccount_InvoiceAutoAllocateRule_ID); } @Override public void setC_DocTypeInvoice_ID (final int C_DocTypeInvoice_ID) { if (C_DocTypeInvoice_ID < 1) set_Value (COLUMNNAME_C_DocTypeInvoice_ID, null); else set_Value (COLUMNNAME_C_DocTypeInvoice_ID, C_DocTypeInvoice_ID); } @Override public int getC_DocTypeInvoice_ID() { return get_ValueAsInt(COLUMNNAME_C_DocTypeInvoice_ID); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_C_BP_BankAccount_InvoiceAutoAllocateRule.java
1
请完成以下Java代码
final class GroupByClassifierSpliterator<E> implements Spliterator<List<E>> { private final Spliterator<E> source; private final Function<E, ?> classifier; private E nextValue; private boolean hasNextValue; public GroupByClassifierSpliterator( @NonNull final Spliterator<E> source, @NonNull final Function<E, ?> classifier) { this.source = source; this.classifier = classifier; } @Override public boolean tryAdvance(Consumer<? super List<E>> action) { GroupCollector<E> groupCollector = null; E item; while ((item = nextOrNull()) != null) { final Object itemClassifierValue = classifier.apply(item); if (groupCollector != null && !groupCollector.isMatchingClassifier(itemClassifierValue)) { putBack(item); action.accept(groupCollector.finish()); return true; } if (groupCollector == null) { groupCollector = new GroupCollector<>(itemClassifierValue); } groupCollector.collect(item); } if (groupCollector != null) { action.accept(groupCollector.finish()); return true; } else { return false; } } private E nextOrNull() { if (hasNextValue) { final E value = this.nextValue; hasNextValue = false; nextValue = null; return value; } final IMutable<E> valueRef = new Mutable<>(); if (!source.tryAdvance(valueRef::setValue)) { return null; } final E value = valueRef.getValue(); if (value == null) { throw new NullPointerException("null values are not allowed in a " + GroupByClassifierSpliterator.class); } return value; } private void putBack(E value) { // shall not happen if (hasNextValue) { throw new IllegalStateException("Only one value is allowed to be put back"); } hasNextValue = true; nextValue = value; } @Override
public Spliterator<List<E>> trySplit() { return null; } @Override public long estimateSize() { return Long.MAX_VALUE; } @Override public int characteristics() { return source.characteristics(); } private static final class GroupCollector<E> { private final Object classifierValue; private final ImmutableList.Builder<E> items = ImmutableList.builder(); public GroupCollector(final Object classifierValue) { this.classifierValue = classifierValue; } public boolean isMatchingClassifier(final Object classifierValueToMatch) { return Objects.equals(this.classifierValue, classifierValueToMatch); } public void collect(final E item) { items.add(item); } public List<E> finish() { return items.build(); } } }
repos\metasfresh-new_dawn_uat\backend\de.metas.util\src\main\java\de\metas\util\GroupByClassifierSpliterator.java
1
请完成以下Java代码
public static void setMaxBodyLength(int length) { maxBodyLength = length; } public byte[] getBody() { return this.body; //NOSONAR } public MessageProperties getMessageProperties() { return this.messageProperties; } @Override public String toString() { StringBuilder buffer = new StringBuilder(); buffer.append("("); buffer.append("Body:'").append(this.getBodyContentAsString()).append("'"); buffer.append(" ").append(this.messageProperties.toString()); buffer.append(")"); return buffer.toString(); } private String getBodyContentAsString() { try { String contentType = this.messageProperties.getContentType(); if (MessageProperties.CONTENT_TYPE_SERIALIZED_OBJECT.equals(contentType)) { return "[serialized object]"; } String encoding = encoding(); if (this.body.length <= maxBodyLength // NOSONAR && (MessageProperties.CONTENT_TYPE_TEXT_PLAIN.equals(contentType) || MessageProperties.CONTENT_TYPE_JSON.equals(contentType) || MessageProperties.CONTENT_TYPE_JSON_ALT.equals(contentType) || MessageProperties.CONTENT_TYPE_XML.equals(contentType))) { return new String(this.body, encoding); } } catch (Exception e) { // ignore } // Comes out as '[B@....b' (so harmless) return this.body.toString() + "(byte[" + this.body.length + "])"; //NOSONAR } private String encoding() { String encoding = this.messageProperties.getContentEncoding(); if (encoding == null) { encoding = bodyEncoding; } return encoding;
} @Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + Arrays.hashCode(this.body); result = prime * result + ((this.messageProperties == null) ? 0 : this.messageProperties.hashCode()); return result; } @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } Message other = (Message) obj; if (!Arrays.equals(this.body, other.body)) { return false; } if (this.messageProperties == null) { return other.messageProperties == null; } return this.messageProperties.equals(other.messageProperties); } }
repos\spring-amqp-main\spring-amqp\src\main\java\org\springframework\amqp\core\Message.java
1
请完成以下Java代码
public void setR_RequestType_ID (int R_RequestType_ID) { if (R_RequestType_ID < 1) set_Value (COLUMNNAME_R_RequestType_ID, null); else set_Value (COLUMNNAME_R_RequestType_ID, Integer.valueOf(R_RequestType_ID)); } /** Get Request Type. @return Type of request (e.g. Inquiry, Complaint, ..) */ @Override public int getR_RequestType_ID () { Integer ii = (Integer)get_Value(COLUMNNAME_R_RequestType_ID); if (ii == null) return 0; return ii.intValue(); }
/** Set Nutzer-ID/Login. @param UserName Nutzer-ID/Login */ @Override public void setUserName (java.lang.String UserName) { set_Value (COLUMNNAME_UserName, UserName); } /** Get Nutzer-ID/Login. @return Nutzer-ID/Login */ @Override public java.lang.String getUserName () { return (java.lang.String)get_Value(COLUMNNAME_UserName); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.inbound.mail\src\main\java-gen\de\metas\inbound\mail\model\X_C_InboundMailConfig.java
1
请完成以下Java代码
protected org.compiere.model.POInfo initPO(final Properties ctx) { return org.compiere.model.POInfo.getPOInfo(Table_Name); } @Override public void setAD_Table_ID (final int AD_Table_ID) { if (AD_Table_ID < 1) set_Value (COLUMNNAME_AD_Table_ID, null); else set_Value (COLUMNNAME_AD_Table_ID, AD_Table_ID); } @Override public int getAD_Table_ID() { return get_ValueAsInt(COLUMNNAME_AD_Table_ID); } @Override public de.metas.inoutcandidate.model.I_M_IolCandHandler getM_IolCandHandler() { return get_ValueAsPO(COLUMNNAME_M_IolCandHandler_ID, de.metas.inoutcandidate.model.I_M_IolCandHandler.class); } @Override public void setM_IolCandHandler(final de.metas.inoutcandidate.model.I_M_IolCandHandler M_IolCandHandler) { set_ValueFromPO(COLUMNNAME_M_IolCandHandler_ID, de.metas.inoutcandidate.model.I_M_IolCandHandler.class, M_IolCandHandler); } @Override public void setM_IolCandHandler_ID (final int M_IolCandHandler_ID) { if (M_IolCandHandler_ID < 1) set_ValueNoCheck (COLUMNNAME_M_IolCandHandler_ID, null); else set_ValueNoCheck (COLUMNNAME_M_IolCandHandler_ID, M_IolCandHandler_ID); } @Override public int getM_IolCandHandler_ID() { return get_ValueAsInt(COLUMNNAME_M_IolCandHandler_ID); } @Override public void setM_IolCandHandler_Log_ID (final int M_IolCandHandler_Log_ID) { if (M_IolCandHandler_Log_ID < 1) set_ValueNoCheck (COLUMNNAME_M_IolCandHandler_Log_ID, null); else set_ValueNoCheck (COLUMNNAME_M_IolCandHandler_Log_ID, M_IolCandHandler_Log_ID); } @Override public int getM_IolCandHandler_Log_ID() { return get_ValueAsInt(COLUMNNAME_M_IolCandHandler_Log_ID); }
@Override public void setRecord_ID (final int Record_ID) { if (Record_ID < 0) set_Value (COLUMNNAME_Record_ID, null); else set_Value (COLUMNNAME_Record_ID, Record_ID); } @Override public int getRecord_ID() { return get_ValueAsInt(COLUMNNAME_Record_ID); } @Override public void setStatus (final @Nullable java.lang.String Status) { set_Value (COLUMNNAME_Status, Status); } @Override public java.lang.String getStatus() { return get_ValueAsString(COLUMNNAME_Status); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.swat\de.metas.swat.base\src\main\java-gen\de\metas\inoutcandidate\model\X_M_IolCandHandler_Log.java
1
请在Spring Boot框架中完成以下Java代码
public void changeById( @NonNull final ServiceRepairProjectTaskId taskId, @NonNull final UnaryOperator<ServiceRepairProjectTask> mapper) { final I_C_Project_Repair_Task record = getRecordById(taskId); final ServiceRepairProjectTask task = fromRecord(record); final ServiceRepairProjectTask changedTask = mapper.apply(task); if (Objects.equals(task, changedTask)) { return; } updateRecord(record, changedTask); saveRecord(record); } public void save(@NonNull final ServiceRepairProjectTask task) { final I_C_Project_Repair_Task record = getRecordById(task.getId()); updateRecord(record, task); saveRecord(record); } public ImmutableSet<ServiceRepairProjectTaskId> retainIdsOfType( @NonNull final ImmutableSet<ServiceRepairProjectTaskId> taskIds, @NonNull final ServiceRepairProjectTaskType type) { if (taskIds.isEmpty()) { return ImmutableSet.of(); } final List<Integer> eligibleRepoIds = queryBL.createQueryBuilder(I_C_Project_Repair_Task.class) .addInArrayFilter(I_C_Project_Repair_Task.COLUMNNAME_C_Project_Repair_Task_ID, taskIds) .addEqualsFilter(I_C_Project_Repair_Task.COLUMNNAME_Type, type.getCode()) .create() .listIds();
return taskIds.stream() .filter(taskId -> eligibleRepoIds.contains(taskId.getRepoId())) .collect(ImmutableSet.toImmutableSet()); } public Optional<ServiceRepairProjectTask> getTaskByRepairOrderId( @NonNull final ProjectId projectId, @NonNull final PPOrderId repairOrderId) { return getTaskIdByRepairOrderId(projectId, repairOrderId).map(this::getById); } public Optional<ServiceRepairProjectTaskId> getTaskIdByRepairOrderId( @NonNull final ProjectId projectId, @NonNull final PPOrderId repairOrderId) { return queryBL.createQueryBuilder(I_C_Project_Repair_Task.class) .addEqualsFilter(I_C_Project_Repair_Task.COLUMNNAME_Type, ServiceRepairProjectTaskType.REPAIR_ORDER.getCode()) .addEqualsFilter(I_C_Project_Repair_Task.COLUMNNAME_C_Project_ID, projectId) .addEqualsFilter(I_C_Project_Repair_Task.COLUMNNAME_Repair_Order_ID, repairOrderId) .create() .firstOnlyOptional(I_C_Project_Repair_Task.class) .map(ServiceRepairProjectTaskRepository::extractTaskId); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.servicerepair.base\src\main\java\de\metas\servicerepair\project\repository\ServiceRepairProjectTaskRepository.java
2
请完成以下Java代码
public String toString() { StringBuilder sb = new StringBuilder(); sb.append(getClass().getSimpleName()); sb.append(" ["); sb.append("Hash = ").append(hashCode()); sb.append(", id=").append(id); sb.append(", orderId=").append(orderId); sb.append(", companyAddressId=").append(companyAddressId); sb.append(", productId=").append(productId); sb.append(", orderSn=").append(orderSn); sb.append(", createTime=").append(createTime); sb.append(", memberUsername=").append(memberUsername); sb.append(", returnAmount=").append(returnAmount); sb.append(", returnName=").append(returnName); sb.append(", returnPhone=").append(returnPhone); sb.append(", status=").append(status); sb.append(", handleTime=").append(handleTime); sb.append(", productPic=").append(productPic); sb.append(", productName=").append(productName);
sb.append(", productBrand=").append(productBrand); sb.append(", productAttr=").append(productAttr); sb.append(", productCount=").append(productCount); sb.append(", productPrice=").append(productPrice); sb.append(", productRealPrice=").append(productRealPrice); sb.append(", reason=").append(reason); sb.append(", description=").append(description); sb.append(", proofPics=").append(proofPics); sb.append(", handleNote=").append(handleNote); sb.append(", handleMan=").append(handleMan); sb.append(", receiveMan=").append(receiveMan); sb.append(", receiveTime=").append(receiveTime); sb.append(", receiveNote=").append(receiveNote); sb.append(", serialVersionUID=").append(serialVersionUID); sb.append("]"); return sb.toString(); } }
repos\mall-master\mall-mbg\src\main\java\com\macro\mall\model\OmsOrderReturnApply.java
1
请完成以下Java代码
public class MybatisHistoricIdentityLinkDataManager extends AbstractDataManager<HistoricIdentityLinkEntity> implements HistoricIdentityLinkDataManager { protected CachedEntityMatcher<HistoricIdentityLinkEntity> historicIdentityLinksByProcInstMatcher = new HistoricIdentityLinksByProcInstMatcher(); public MybatisHistoricIdentityLinkDataManager(ProcessEngineConfigurationImpl processEngineConfiguration) { super(processEngineConfiguration); } @Override public Class<? extends HistoricIdentityLinkEntity> getManagedEntityClass() { return HistoricIdentityLinkEntityImpl.class; } @Override public HistoricIdentityLinkEntity create() { return new HistoricIdentityLinkEntityImpl(); }
@Override @SuppressWarnings("unchecked") public List<HistoricIdentityLinkEntity> findHistoricIdentityLinksByTaskId(String taskId) { return getDbSqlSession().selectList("selectHistoricIdentityLinksByTask", taskId); } @Override public List<HistoricIdentityLinkEntity> findHistoricIdentityLinksByProcessInstanceId( final String processInstanceId ) { return getList( "selectHistoricIdentityLinksByProcessInstance", processInstanceId, historicIdentityLinksByProcInstMatcher, true ); } }
repos\Activiti-develop\activiti-core\activiti-engine\src\main\java\org\activiti\engine\impl\persistence\entity\data\impl\MybatisHistoricIdentityLinkDataManager.java
1
请完成以下Java代码
public String getCaseDefinitionId() { return caseDefinitionId; } public boolean hasNewCaseDefinitionId() { return StringUtils.isNotBlank(newCaseDefinitionId); } public String getNewCaseDefinitionId() { return newCaseDefinitionId; } public String getTenantId() { return tenantId; } public boolean hasCorrelationParameterValues() { return correlationParameterValues.size() > 0; } public Map<String, Object> getCorrelationParameterValues() { return correlationParameterValues; }
@Override public void migrateToLatestCaseDefinition() { checkValidInformation(); cmmnRuntimeService.migrateCaseInstanceStartEventSubscriptionsToCaseDefinitionVersion(this); } @Override public void migrateToCaseDefinition(String caseDefinitionId) { this.newCaseDefinitionId = caseDefinitionId; checkValidInformation(); cmmnRuntimeService.migrateCaseInstanceStartEventSubscriptionsToCaseDefinitionVersion(this); } protected void checkValidInformation() { if (StringUtils.isEmpty(caseDefinitionId)) { throw new FlowableIllegalArgumentException("The case definition must be provided using the exact id of the version the subscription was registered for."); } } }
repos\flowable-engine-main\modules\flowable-cmmn-engine\src\main\java\org\flowable\cmmn\engine\impl\runtime\CaseInstanceStartEventSubscriptionModificationBuilderImpl.java
1
请完成以下Java代码
public boolean containsValue(Object value) { throw new UnsupportedOperationException(getClass().getName()+".containsValue() is not supported."); } @Override public Object remove(Object key) { throw new UnsupportedOperationException(getClass().getName()+".remove is unsupported. Use " + getClass().getName() + ".put(key, null)"); } @Override public void clear() { throw new UnsupportedOperationException(getClass().getName()+".clear() is not supported."); } @Override public Set<String> keySet() { throw new UnsupportedOperationException(getClass().getName()+".keySet() is not supported."); }
@Override public Collection<Object> values() { throw new UnsupportedOperationException(getClass().getName()+".values() is not supported."); } @Override public Set<java.util.Map.Entry<String, Object>> entrySet() { throw new UnsupportedOperationException(getClass().getName()+".entrySet() is not supported."); } public VariableContext asVariableContext() { throw new UnsupportedOperationException(getClass().getName()+".asVariableContext() is not supported."); } }
repos\camunda-bpm-platform-master\engine-cdi\core\src\main\java\org\camunda\bpm\engine\cdi\impl\AbstractVariableMap.java
1
请完成以下Java代码
public int getXmlRowNumber() { return xmlRowNumber; } public void setXmlRowNumber(int xmlRowNumber) { this.xmlRowNumber = xmlRowNumber; } public int getXmlColumnNumber() { return xmlColumnNumber; } public void setXmlColumnNumber(int xmlColumnNumber) { this.xmlColumnNumber = xmlColumnNumber; } public boolean equals(GraphicInfo ginfo) { if (this.getX() != ginfo.getX()) { return false; } if (this.getY() != ginfo.getY()) { return false; } if (this.getHeight() != ginfo.getHeight()) { return false; } if (this.getWidth() != ginfo.getWidth()) {
return false; } // check for zero value in case we are comparing model value to BPMN DI value // model values do not have xml location information if (0 != this.getXmlColumnNumber() && 0 != ginfo.getXmlColumnNumber() && this.getXmlColumnNumber() != ginfo.getXmlColumnNumber()) { return false; } if (0 != this.getXmlRowNumber() && 0 != ginfo.getXmlRowNumber() && this.getXmlRowNumber() != ginfo.getXmlRowNumber()) { return false; } // only check for elements that support this value if (null != this.getExpanded() && null != ginfo.getExpanded() && !this.getExpanded().equals(ginfo.getExpanded())) { return false; } return true; } }
repos\flowable-engine-main\modules\flowable-dmn-model\src\main\java\org\flowable\dmn\model\GraphicInfo.java
1
请完成以下Java代码
public String toString() { return MoreObjects.toStringHelper(this) .addValue(tabCallouts) .toString(); } @Override public void onIgnore(final ICalloutRecord calloutRecord) { for (final ITabCallout tabCallout : tabCallouts) { tabCallout.onIgnore(calloutRecord); } } @Override public void onNew(final ICalloutRecord calloutRecord) { for (final ITabCallout tabCallout : tabCallouts) { tabCallout.onNew(calloutRecord); } } @Override public void onSave(final ICalloutRecord calloutRecord) { for (final ITabCallout tabCallout : tabCallouts) { tabCallout.onSave(calloutRecord); } } @Override public void onDelete(final ICalloutRecord calloutRecord) { for (final ITabCallout tabCallout : tabCallouts) { tabCallout.onDelete(calloutRecord); } } @Override public void onRefresh(final ICalloutRecord calloutRecord) { for (final ITabCallout tabCallout : tabCallouts) { tabCallout.onRefresh(calloutRecord); } } @Override public void onRefreshAll(final ICalloutRecord calloutRecord)
{ for (final ITabCallout tabCallout : tabCallouts) { tabCallout.onRefreshAll(calloutRecord); } } @Override public void onAfterQuery(final ICalloutRecord calloutRecord) { for (final ITabCallout tabCallout : tabCallouts) { tabCallout.onAfterQuery(calloutRecord); } } public static final class Builder { private final List<ITabCallout> tabCalloutsAll = new ArrayList<>(); private Builder() { super(); } public ITabCallout build() { if (tabCalloutsAll.isEmpty()) { return ITabCallout.NULL; } else if (tabCalloutsAll.size() == 1) { return tabCalloutsAll.get(0); } else { return new CompositeTabCallout(tabCalloutsAll); } } public Builder addTabCallout(final ITabCallout tabCallout) { Check.assumeNotNull(tabCallout, "tabCallout not null"); if (tabCalloutsAll.contains(tabCallout)) { return this; } tabCalloutsAll.add(tabCallout); return this; } } }
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\org\adempiere\ad\ui\spi\impl\CompositeTabCallout.java
1
请在Spring Boot框架中完成以下Java代码
public ConditionOutcome getMatchOutcome(ConditionContext context, AnnotatedTypeMetadata metadata) { AnnotationAttributes annotationAttributes = AnnotationAttributes .fromMap(metadata.getAnnotationAttributes(ConditionalOnEnabledMetricsExport.class.getName())); Assert.state(annotationAttributes != null, "'annotationAttributes' must not be null"); String endpointName = annotationAttributes.getString("value"); ConditionOutcome outcome = getProductOutcome(context, endpointName); if (outcome != null) { return outcome; } return getDefaultOutcome(context); } private @Nullable ConditionOutcome getProductOutcome(ConditionContext context, String productName) { Environment environment = context.getEnvironment(); String enabledProperty = PROPERTY_TEMPLATE.formatted(productName); if (environment.containsProperty(enabledProperty)) { boolean match = environment.getProperty(enabledProperty, Boolean.class, true); return new ConditionOutcome(match, ConditionMessage.forCondition(ConditionalOnEnabledMetricsExport.class)
.because(enabledProperty + " is " + match)); } return null; } /** * Return the default outcome that should be used if property is not set. By default * this method will use the {@link #DEFAULT_PROPERTY_NAME} property, matching if it is * {@code true} or if it is not configured. * @param context the condition context * @return the default outcome */ private ConditionOutcome getDefaultOutcome(ConditionContext context) { boolean match = Boolean.parseBoolean(context.getEnvironment().getProperty(DEFAULT_PROPERTY_NAME, "true")); return new ConditionOutcome(match, ConditionMessage.forCondition(ConditionalOnEnabledMetricsExport.class) .because(DEFAULT_PROPERTY_NAME + " is considered " + match)); } }
repos\spring-boot-4.0.1\module\spring-boot-micrometer-metrics\src\main\java\org\springframework\boot\micrometer\metrics\autoconfigure\export\OnMetricsExportEnabledCondition.java
2
请完成以下Java代码
public void setProcessed (final boolean Processed) { set_ValueNoCheck (COLUMNNAME_Processed, Processed); } @Override public boolean isProcessed() { return get_ValueAsBoolean(COLUMNNAME_Processed); } @Override public void setRemote_Addr (final @Nullable java.lang.String Remote_Addr) { set_ValueNoCheck (COLUMNNAME_Remote_Addr, Remote_Addr); } @Override public java.lang.String getRemote_Addr() { return get_ValueAsString(COLUMNNAME_Remote_Addr); } @Override
public void setRemote_Host (final @Nullable java.lang.String Remote_Host) { set_ValueNoCheck (COLUMNNAME_Remote_Host, Remote_Host); } @Override public java.lang.String getRemote_Host() { return get_ValueAsString(COLUMNNAME_Remote_Host); } @Override public void setWebSession (final @Nullable java.lang.String WebSession) { set_ValueNoCheck (COLUMNNAME_WebSession, WebSession); } @Override public java.lang.String getWebSession() { return get_ValueAsString(COLUMNNAME_WebSession); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_AD_Session.java
1
请完成以下Java代码
private void dbUpdateInvoices(@NonNull final ImportRecordsSelection selection) { StringBuilder sql = new StringBuilder("UPDATE I_Datev_Payment i ") .append("SET C_Invoice_ID = (SELECT C_Invoice_ID FROM C_Invoice inv ") .append("WHERE i.InvoiceDocumentNo = inv.DocumentNo ") .append("AND round((i.PayAmt+i.DiscountAmt),2) = round(inv.GrandTotal,2) AND i.DateTrx = inv.DateInvoiced ") .append("AND i.AD_Client_ID=inv.AD_Client_ID AND i.AD_Org_ID=inv.AD_Org_ID ) ") .append("WHERE C_Invoice_ID IS NULL AND InvoiceDocumentNo IS NOT NULL ") .append("AND I_IsImported<>'Y' ") .append(selection.toSqlWhereClause("i")); DB.executeUpdateAndSaveErrorOnFail(sql.toString(), ITrx.TRXNAME_ThreadInherited); } private void dbUpdateIsReceipt(@NonNull final ImportRecordsSelection selection) { StringBuilder sql = new StringBuilder("UPDATE I_Datev_Payment i ") .append("SET IsReceipt = (CASE WHEN TransactionCode='H' THEN 'N' ELSE 'Y' END) ") .append("WHERE I_IsImported<>'Y' ") .append(selection.toSqlWhereClause("i")); DB.executeUpdateAndSaveErrorOnFail(sql.toString(), ITrx.TRXNAME_ThreadInherited); } private void dbUpdateErrorMessages(@NonNull final ImportRecordsSelection selection) { StringBuilder sql; int no;
sql = new StringBuilder("UPDATE I_Datev_Payment ") .append("SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||'ERR=No BPartner, ' ") .append("WHERE C_BPartner_ID IS NULL ") .append("AND I_IsImported<>'Y' ") .append(selection.toSqlWhereClause()); no = DB.executeUpdateAndSaveErrorOnFail(sql.toString(), ITrx.TRXNAME_ThreadInherited); if (no != 0) { logger.warn("No BPartner = {}", no); } sql = new StringBuilder("UPDATE I_Datev_Payment ") .append("SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||'ERR=No Invoice, ' ") .append("WHERE C_Invoice_ID IS NULL ") .append("AND I_IsImported<>'Y' ") .append(selection.toSqlWhereClause("i")); no = DB.executeUpdateAndSaveErrorOnFail(sql.toString(), ITrx.TRXNAME_ThreadInherited); if (no != 0) { logger.warn("No Invoice = {}", no); } } }
repos\metasfresh-new_dawn_uat\backend\de.metas.banking\de.metas.banking.base\src\main\java\de\metas\banking\payment\impexp\CPaymentImportTableSqlUpdater.java
1
请完成以下Java代码
public static InvoiceVerificationRunId ofRepoId(@NonNull final InvoiceVerificationSetId invoiceVerificationSetId, final int invoiceVerificationRunId) { return new InvoiceVerificationRunId(invoiceVerificationSetId, invoiceVerificationRunId); } public static InvoiceVerificationRunId ofRepoId(final int invoiceVerificationSetId, final int invoiceVerificationRunId) { return new InvoiceVerificationRunId(InvoiceVerificationSetId.ofRepoId(invoiceVerificationSetId), invoiceVerificationRunId); } @Nullable public static InvoiceVerificationRunId ofRepoIdOrNull( @Nullable final Integer invoiceVerificationSetId, @Nullable final Integer invoiceVerificationRunId) { return invoiceVerificationSetId != null && invoiceVerificationSetId > 0 && invoiceVerificationRunId != null && invoiceVerificationRunId > 0 ? ofRepoId(invoiceVerificationSetId, invoiceVerificationRunId) : null; } @Nullable public static InvoiceVerificationRunId ofRepoIdOrNull( @Nullable final InvoiceVerificationSetId bpartnerId, final int bpartnerLocationId) { return bpartnerId != null && bpartnerLocationId > 0 ? ofRepoId(bpartnerId, bpartnerLocationId) : null; } private InvoiceVerificationRunId(@NonNull final InvoiceVerificationSetId invoiceVerificationSetId, final int bpartnerLocationId) { this.repoId = Check.assumeGreaterThanZero(bpartnerLocationId, "bpartnerLocationId"); this.invoiceVerificationSetId = invoiceVerificationSetId; }
public static int toRepoId(final InvoiceVerificationRunId invoiceVerificationRunId) { return toRepoIdOr(invoiceVerificationRunId, -1); } public static int toRepoIdOr(final InvoiceVerificationRunId bpLocationId, final int defaultValue) { return bpLocationId != null ? bpLocationId.getRepoId() : defaultValue; } public static boolean equals(final InvoiceVerificationRunId id1, final InvoiceVerificationRunId id2) { return Objects.equals(id1, id2); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.business\src\main\java\de\metas\invoice\InvoiceVerificationRunId.java
1
请完成以下Java代码
public class CalloutInitException extends CalloutException { public static CalloutInitException wrapIfNeeded(final Throwable throwable) { Check.assumeNotNull(throwable, "throwable not null"); if (throwable instanceof CalloutInitException) { return (CalloutInitException)throwable; } final Throwable cause = extractCause(throwable); if(cause != throwable) { return wrapIfNeeded(cause); } return new CalloutInitException(extractMessage(throwable), cause); }
/** * */ private static final long serialVersionUID = -5929639632737615796L; public CalloutInitException(final String message) { super(message); } public CalloutInitException(final String message, final Throwable cause) { super(message, cause); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\org\adempiere\ad\callout\exceptions\CalloutInitException.java
1
请完成以下Java代码
public class CalloutEXP_Format extends CalloutEngine { public String onAD_Table_ID(Properties ctx, int WindowNo, GridTab mTab, GridField mField, Object value) { I_EXP_Format format = InterfaceWrapperHelper.create(mTab, I_EXP_Format.class); if (format.getAD_Table_ID() > 0) { String tableName = Services.get(IADTableDAO.class).retrieveTableName(format.getAD_Table_ID()); format.setValue(tableName); format.setName(tableName); } return ""; } public String setLineValueName(Properties ctx, int WindowNo, GridTab mTab, GridField mField, Object value) { I_EXP_FormatLine line = InterfaceWrapperHelper.create(mTab, I_EXP_FormatLine.class); if (line.getEXP_EmbeddedFormat_ID() > 0 && X_EXP_FormatLine.TYPE_EmbeddedEXPFormat.equals(line.getType()))
{ I_EXP_Format format = line.getEXP_EmbeddedFormat(); line.setValue(format.getValue()); line.setName(format.getName()); } else if (line.getAD_Column_ID() > 0) { MColumn column = MColumn.get(ctx, line.getAD_Column_ID()); String columnName = column.getColumnName(); line.setValue(columnName); line.setName(columnName); if (column.isMandatory()) { line.setIsMandatory(true); } } return ""; } }
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\org\compiere\model\CalloutEXP_Format.java
1
请在Spring Boot框架中完成以下Java代码
public InetAddress getRemoteAddress() { return this.remoteAddress; } public void setRemoteAddress(InetAddress remoteAddress) { this.remoteAddress = remoteAddress; } public Security getSecurity() { return this.security; } // @fold:off public static class Security { @NotEmpty
private String username; // @fold:on // getters/setters... public String getUsername() { return this.username; } public void setUsername(String username) { this.username = username; } // @fold:off } }
repos\spring-boot-4.0.1\documentation\spring-boot-docs\src\main\java\org\springframework\boot\docs\features\externalconfig\typesafeconfigurationproperties\validation\nested\MyProperties.java
2
请完成以下Java代码
public final class IncludedDocumentToInvalidate { @Getter private final String tableName; private boolean invalidateAll; private final HashSet<Integer> recordIds = new HashSet<>(); IncludedDocumentToInvalidate(@NonNull final String tableName) { this.tableName = tableName; } public void invalidateAll() { if (invalidateAll) { return; } else { invalidateAll = true; recordIds.clear(); } } public void addRecordId(final int recordId) { if (!invalidateAll) { recordIds.add(recordId); } } public DocumentIdsSelection toDocumentIdsSelection() { return invalidateAll
? DocumentIdsSelection.ALL : DocumentIdsSelection.ofIntSet(recordIds); } IncludedDocumentToInvalidate combine(@NonNull final IncludedDocumentToInvalidate other) { Check.assumeEquals(tableName, other.tableName, "tableName"); this.invalidateAll = this.invalidateAll || other.invalidateAll; if(invalidateAll) { this.recordIds.clear(); } else { this.recordIds.addAll(other.recordIds); } return this; } }
repos\metasfresh-new_dawn_uat\backend\de.metas.ui.web.base\src\main\java\de\metas\ui\web\window\invalidation\IncludedDocumentToInvalidate.java
1
请完成以下Java代码
private IOException releaseZipContent(IOException exceptionChain) { ZipContent zipContent = this.zipContent; if (zipContent != null) { try { zipContent.close(); } catch (IOException ex) { exceptionChain = addToExceptionChain(exceptionChain, ex); } finally { this.zipContent = null; } } return exceptionChain; } private IOException releaseZipContentForManifest(IOException exceptionChain) { ZipContent zipContentForManifest = this.zipContentForManifest; if (zipContentForManifest != null) { try { zipContentForManifest.close(); } catch (IOException ex) {
exceptionChain = addToExceptionChain(exceptionChain, ex); } finally { this.zipContentForManifest = null; } } return exceptionChain; } private IOException addToExceptionChain(IOException exceptionChain, IOException ex) { if (exceptionChain != null) { exceptionChain.addSuppressed(ex); return exceptionChain; } return ex; } }
repos\spring-boot-4.0.1\loader\spring-boot-loader\src\main\java\org\springframework\boot\loader\jar\NestedJarFileResources.java
1
请完成以下Java代码
public Boolean getBoolValue() { return dataType == DataType.BOOLEAN ? boolValue : null; } public void setBoolValue(Boolean boolValue) { this.dataType = DataType.BOOLEAN; this.boolValue = boolValue; } public String getStrValue() { return dataType == DataType.STRING ? strValue : null; } public void setStrValue(String strValue) { this.dataType = DataType.STRING; this.strValue = strValue; } public void setJsonValue(String jsonValue) { this.dataType = DataType.JSON; this.strValue = jsonValue; } public String getJsonValue() { return dataType == DataType.JSON ? strValue : null; } boolean isSet() { return dataType != null; } static EntityKeyValue fromString(String s) { EntityKeyValue result = new EntityKeyValue(); result.setStrValue(s); return result;
} static EntityKeyValue fromBool(boolean b) { EntityKeyValue result = new EntityKeyValue(); result.setBoolValue(b); return result; } static EntityKeyValue fromLong(long l) { EntityKeyValue result = new EntityKeyValue(); result.setLngValue(l); return result; } static EntityKeyValue fromDouble(double d) { EntityKeyValue result = new EntityKeyValue(); result.setDblValue(d); return result; } static EntityKeyValue fromJson(String s) { EntityKeyValue result = new EntityKeyValue(); result.setJsonValue(s); return result; } }
repos\thingsboard-master\rule-engine\rule-engine-components\src\main\java\org\thingsboard\rule\engine\profile\EntityKeyValue.java
1
请完成以下Java代码
private final Set<HuId> getHUIdsAndClear() { final Set<HuId> modelIds = new HashSet<>(_huIds); _huIds.clear(); return modelIds; } private final boolean hasModelsToSnapshot() { return !_huIds.isEmpty(); } @Override public ISnapshotRestorer<I_M_HU> addModelId(final int huId) {
_huIds.add(HuId.ofRepoId(huId)); return this; } @Override public ISnapshotRestorer<I_M_HU> addModelIds(@NonNull final Collection<Integer> huRepoIds) { final ImmutableSet<HuId> huIds = huRepoIds .stream() .map(HuId::ofRepoId) .collect(ImmutableSet.toImmutableSet()); _huIds.addAll(huIds); return this; } }
repos\metasfresh-new_dawn_uat\backend\de.metas.handlingunits.base\src\main\java\de\metas\handlingunits\snapshot\impl\M_HU_Snapshot_ProducerAndRestorer.java
1
请完成以下Java代码
public DDOrderMoveSchedule pickFromHU(@NonNull final DDOrderPickFromRequest request) { return DDOrderPickFromCommand.builder() .ddOrderLowLevelDAO(ddOrderLowLevelDAO) .ddOrderMoveScheduleRepository(ddOrderMoveScheduleRepository) .handlingUnitsBL(handlingUnitsBL) .request(request) .build() .execute(); } public ImmutableList<DDOrderMoveSchedule> dropTo(@NonNull final DDOrderDropToRequest request) { return DDOrderDropToCommand.builder() .ppOrderSourceHUService(ppOrderSourceHUService) .ddOrderLowLevelDAO(ddOrderLowLevelDAO) .ddOrderMoveScheduleRepository(ddOrderMoveScheduleRepository) .request(request) .build() .execute(); } public void unpick(@NonNull final DDOrderMoveScheduleId scheduleId, @Nullable final HUQRCode unpickToTargetQRCode) { DDOrderUnpickCommand.builder() .ddOrderMoveScheduleRepository(ddOrderMoveScheduleRepository) .huqrCodesService(huqrCodesService) .scheduleId(scheduleId) .unpickToTargetQRCode(unpickToTargetQRCode) .build() .execute(); }
public Set<DDOrderId> retrieveDDOrderIdsInTransit(@NonNull final LocatorId inTransitLocatorId) { return ddOrderMoveScheduleRepository.retrieveDDOrderIdsInTransit(inTransitLocatorId); } public boolean hasInTransitSchedules(@NonNull final LocatorId inTransitLocatorId) { return ddOrderMoveScheduleRepository.queryInTransitSchedules(inTransitLocatorId).anyMatch(); } public void printMaterialInTransitReport( @NonNull final LocatorId inTransitLocatorId, @NonNull String adLanguage) { MaterialInTransitReportCommand.builder() .adLanguage(adLanguage) .inTransitLocatorId(inTransitLocatorId) .build() .execute(); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.handlingunits.base\src\main\java\de\metas\distribution\ddorder\movement\schedule\DDOrderMoveScheduleService.java
1
请完成以下Java代码
public @Nullable URL findResource(String name) { final ClassLoaderFile file = this.updatedFiles.getFile(name); if (file == null) { return super.findResource(name); } if (file.getKind() == Kind.DELETED) { return null; } return createFileUrl(name, file); } @Override public Class<?> loadClass(String name, boolean resolve) throws ClassNotFoundException { String path = name.replace('.', '/').concat(".class"); ClassLoaderFile file = this.updatedFiles.getFile(path); if (file != null && file.getKind() == Kind.DELETED) { throw new ClassNotFoundException(name); } synchronized (getClassLoadingLock(name)) { Class<?> loadedClass = findLoadedClass(name); if (loadedClass == null) { try { loadedClass = findClass(name); } catch (ClassNotFoundException ex) { loadedClass = Class.forName(name, false, getParent()); } } if (resolve) { resolveClass(loadedClass); } return loadedClass; } } @Override protected Class<?> findClass(String name) throws ClassNotFoundException { String path = name.replace('.', '/').concat(".class"); final ClassLoaderFile file = this.updatedFiles.getFile(path); if (file == null) { return super.findClass(name); } if (file.getKind() == Kind.DELETED) { throw new ClassNotFoundException(name); } byte[] bytes = file.getContents(); Assert.state(bytes != null, "'bytes' must not be null"); return defineClass(name, bytes, 0, bytes.length); } @Override public Class<?> publicDefineClass(String name, byte[] b, @Nullable ProtectionDomain protectionDomain) { return defineClass(name, b, 0, b.length, protectionDomain); } @Override
public ClassLoader getOriginalClassLoader() { return getParent(); } private URL createFileUrl(String name, ClassLoaderFile file) { try { return new URL("reloaded", null, -1, "/" + name, new ClassLoaderFileURLStreamHandler(file)); } catch (MalformedURLException ex) { throw new IllegalStateException(ex); } } @Override public boolean isClassReloadable(Class<?> classType) { return (classType.getClassLoader() instanceof RestartClassLoader); } /** * Compound {@link Enumeration} that adds an item to the front. */ private static class CompoundEnumeration<E> implements Enumeration<E> { private @Nullable E firstElement; private final Enumeration<E> enumeration; CompoundEnumeration(@Nullable E firstElement, Enumeration<E> enumeration) { this.firstElement = firstElement; this.enumeration = enumeration; } @Override public boolean hasMoreElements() { return (this.firstElement != null || this.enumeration.hasMoreElements()); } @Override public E nextElement() { if (this.firstElement == null) { return this.enumeration.nextElement(); } E element = this.firstElement; this.firstElement = null; return element; } } }
repos\spring-boot-4.0.1\module\spring-boot-devtools\src\main\java\org\springframework\boot\devtools\restart\classloader\RestartClassLoader.java
1
请完成以下Java代码
default Map<String, Object> getConfigurationProperties() { throw new UnsupportedOperationException("'getConfigurationProperties()' is not supported"); } /** * Return the configured key deserializer (if provided as an object instead * of a class name in the properties). * @return the deserializer. */ @Nullable default Deserializer<K> getKeyDeserializer() { return null; } /** * Return the configured value deserializer (if provided as an object instead * of a class name in the properties). * @return the deserializer. */ @Nullable default Deserializer<V> getValueDeserializer() { return null; } /** * Remove a listener. * @param listener the listener. * @return true if removed. */ default boolean removeListener(Listener<K, V> listener) { return false; } /** * Add a listener at a specific index. * @param index the index (list position). * @param listener the listener. */ default void addListener(int index, Listener<K, V> listener) { } /** * Add a listener. * @param listener the listener. */ default void addListener(Listener<K, V> listener) { } /**
* Get the current list of listeners. * @return the listeners. */ default List<Listener<K, V>> getListeners() { return Collections.emptyList(); } /** * Listener for share consumer lifecycle events. * * @param <K> the key type. * @param <V> the value type. */ interface Listener<K, V> { /** * A new consumer was created. * @param id the consumer id (factory bean name and client.id separated by a period). * @param consumer the consumer. */ default void consumerAdded(String id, ShareConsumer<K, V> consumer) { } /** * An existing consumer was removed. * @param id the consumer id (factory bean name and client.id separated by a period). * @param consumer the consumer. */ default void consumerRemoved(@Nullable String id, ShareConsumer<K, V> consumer) { } } }
repos\spring-kafka-main\spring-kafka\src\main\java\org\springframework\kafka\core\ShareConsumerFactory.java
1
请完成以下Java代码
public List<TimerJobEntity> findTimerStartEvents() { return getDbSqlSession().selectList("selectTimerStartEvents"); } @Override @SuppressWarnings("unchecked") public List<TimerJobEntity> findJobsByTypeAndProcessDefinitionId( String jobHandlerType, String processDefinitionId ) { Map<String, String> params = new HashMap<String, String>(2); params.put("handlerType", jobHandlerType); params.put("processDefinitionId", processDefinitionId); return getDbSqlSession().selectList("selectTimerJobByTypeAndProcessDefinitionId", params); } @Override public List<TimerJobEntity> findJobsByExecutionId(final String executionId) { return getList("selectTimerJobsByExecutionId", executionId, timerJobsByExecutionIdMatcher, true); } @Override @SuppressWarnings("unchecked") public List<TimerJobEntity> findJobsByProcessInstanceId(final String processInstanceId) { return getDbSqlSession().selectList("selectTimerJobsByProcessInstanceId", processInstanceId); } @Override @SuppressWarnings("unchecked") public List<TimerJobEntity> findJobsByTypeAndProcessDefinitionKeyNoTenantId( String jobHandlerType, String processDefinitionKey ) { Map<String, String> params = new HashMap<String, String>(2); params.put("handlerType", jobHandlerType); params.put("processDefinitionKey", processDefinitionKey); return getDbSqlSession().selectList("selectTimerJobByTypeAndProcessDefinitionKeyNoTenantId", params); } @Override @SuppressWarnings("unchecked") public List<TimerJobEntity> findJobsByTypeAndProcessDefinitionKeyAndTenantId(
String jobHandlerType, String processDefinitionKey, String tenantId ) { Map<String, String> params = new HashMap<String, String>(3); params.put("handlerType", jobHandlerType); params.put("processDefinitionKey", processDefinitionKey); params.put("tenantId", tenantId); return getDbSqlSession().selectList("selectTimerJobByTypeAndProcessDefinitionKeyAndTenantId", params); } @Override public void updateJobTenantIdForDeployment(String deploymentId, String newTenantId) { HashMap<String, Object> params = new HashMap<String, Object>(); params.put("deploymentId", deploymentId); params.put("tenantId", newTenantId); getDbSqlSession().update("updateTimerJobTenantIdForDeployment", params); } }
repos\Activiti-develop\activiti-core\activiti-engine\src\main\java\org\activiti\engine\impl\persistence\entity\data\impl\MybatisTimerJobDataManager.java
1
请完成以下Java代码
public RESTApiTableInfo getByTableNameOrNull(final String tableName) { return getMap().getByTableNameOrNull(tableName); } private RESTApiTableInfoMap getMap() { return cache.getOrLoad(0, this::retrieveMap); } private RESTApiTableInfoMap retrieveMap() { final String sql = "SELECT " + " t." + I_AD_Table.COLUMNNAME_TableName + ", c." + I_AD_Column.COLUMNNAME_ColumnName + " FROM " + I_AD_Column.Table_Name + " c " + " INNER JOIN " + I_AD_Table.Table_Name + " t ON (t.AD_Table_ID=c.AD_Table_ID)" + " WHERE c." + I_AD_Column.COLUMNNAME_IsRestAPICustomColumn + "='Y'" + " AND c.IsActive='Y' AND t.IsActive='Y'" + " ORDER BY t." + I_AD_Table.COLUMNNAME_TableName + ", c." + I_AD_Column.COLUMNNAME_ColumnName; final HashMap<String, RESTApiTableInfoBuilder> builders = new HashMap<>(); DB.forEachRow(sql, null, rs -> { final String tableName = rs.getString(I_AD_Table.COLUMNNAME_TableName); final String columnName = rs.getString(I_AD_Column.COLUMNNAME_ColumnName); builders.computeIfAbsent(tableName, RESTApiTableInfo::newBuilderForTableName) .customRestAPIColumnName(columnName); }); return builders.values().stream() .map(RESTApiTableInfoBuilder::build) .collect(RESTApiTableInfoMap.collect()); }
@EqualsAndHashCode @ToString private static class RESTApiTableInfoMap { private final ImmutableMap<String, RESTApiTableInfo> byTableName; private RESTApiTableInfoMap(final List<RESTApiTableInfo> list) { this.byTableName = Maps.uniqueIndex(list, RESTApiTableInfo::getTableName); } public static Collector<RESTApiTableInfo, ?, RESTApiTableInfoMap> collect() { return GuavaCollectors.collectUsingListAccumulator(RESTApiTableInfoMap::new); } @Nullable private RESTApiTableInfo getByTableNameOrNull(final String tableName) { return this.byTableName.get(tableName); } } }
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\org\adempiere\ad\persistence\custom_columns\CustomColumnRepository.java
1
请完成以下Java代码
public float predict(int[] observation, int[] state) { final int time = observation.length; // 序列长度 final int max_s = start_probability.length; // 状态种数 float[] score = new float[max_s]; // link[t][s] := 第t个时刻在当前状态是s时,前1个状态是什么 int[][] link = new int[time][max_s]; // 第一个时刻,使用初始概率向量乘以发射概率矩阵 for (int cur_s = 0; cur_s < max_s; ++cur_s) { score[cur_s] = start_probability[cur_s] + emission_probability[cur_s][observation[0]]; } // 第二个时刻,使用前一个时刻的概率向量乘以一阶转移矩阵乘以发射概率矩阵 float[] pre = new float[max_s]; for (int t = 1; t < observation.length; t++) { // swap(now, pre) float[] buffer = pre; pre = score; score = buffer; // end of swap for (int s = 0; s < max_s; ++s) { score[s] = Integer.MIN_VALUE; for (int f = 0; f < max_s; ++f) { float p = pre[f] + transition_probability[f][s] + emission_probability[s][observation[t]]; if (p > score[s]) { score[s] = p; link[t][s] = f; } } } } float max_score = Integer.MIN_VALUE;
int best_s = 0; for (int s = 0; s < max_s; s++) { if (score[s] > max_score) { max_score = score[s]; best_s = s; } } for (int t = link.length - 1; t >= 0; --t) { state[t] = best_s; best_s = link[t][best_s]; } return max_score; } }
repos\springboot-demo-master\hanlp\src\main\java\demo\hankcs\hanlp\model\hmm\FirstOrderHiddenMarkovModel.java
1
请完成以下Java代码
public void setBytes(byte[] bytes) {} @Override public Object getCachedValue() { return null; } @Override public void setCachedValue(Object cachedValue) {} @Override public String getId() { return null; } @Override public void setId(String id) {} @Override public boolean isInserted() { return false; } @Override public void setInserted(boolean inserted) {} @Override public boolean isUpdated() { return false; } @Override public void setUpdated(boolean updated) {} @Override public boolean isDeleted() { return false; } @Override public void setDeleted(boolean deleted) {} @Override public Object getPersistentState() { return null; } @Override public void setRevision(int revision) {} @Override public int getRevision() { return 0; } @Override public int getRevisionNext() { return 0; } @Override public void setName(String name) {} @Override public void setProcessInstanceId(String processInstanceId) {} @Override public void setExecutionId(String executionId) {} @Override public Object getValue() { return variableValue;
} @Override public void setValue(Object value) { variableValue = value; } @Override public String getTypeName() { return TYPE_TRANSIENT; } @Override public void setTypeName(String typeName) {} @Override public String getProcessInstanceId() { return null; } @Override public String getTaskId() { return null; } @Override public void setTaskId(String taskId) {} @Override public String getExecutionId() { return null; } }
repos\Activiti-develop\activiti-core\activiti-engine\src\main\java\org\activiti\engine\impl\persistence\entity\TransientVariableInstance.java
1
请完成以下Java代码
public void setQtyTU_Override (final @Nullable BigDecimal QtyTU_Override) { set_Value (COLUMNNAME_QtyTU_Override, QtyTU_Override); } @Override public BigDecimal getQtyTU_Override() { final BigDecimal bd = get_ValueAsBigDecimal(COLUMNNAME_QtyTU_Override); return bd != null ? bd : BigDecimal.ZERO; } @Override public void setRecord_ID (final int Record_ID) { if (Record_ID < 0) set_ValueNoCheck (COLUMNNAME_Record_ID, null); else set_ValueNoCheck (COLUMNNAME_Record_ID, Record_ID); } @Override public int getRecord_ID() { return get_ValueAsInt(COLUMNNAME_Record_ID); } /** * ShipmentAllocation_BestBefore_Policy AD_Reference_ID=541043 * Reference name: ShipmentAllocation_BestBefore_Policy */ public static final int SHIPMENTALLOCATION_BESTBEFORE_POLICY_AD_Reference_ID=541043; /** Newest_First = N */ public static final String SHIPMENTALLOCATION_BESTBEFORE_POLICY_Newest_First = "N"; /** Expiring_First = E */ public static final String SHIPMENTALLOCATION_BESTBEFORE_POLICY_Expiring_First = "E"; @Override public void setShipmentAllocation_BestBefore_Policy (final @Nullable java.lang.String ShipmentAllocation_BestBefore_Policy) { set_Value (COLUMNNAME_ShipmentAllocation_BestBefore_Policy, ShipmentAllocation_BestBefore_Policy); } @Override public java.lang.String getShipmentAllocation_BestBefore_Policy() {
return get_ValueAsString(COLUMNNAME_ShipmentAllocation_BestBefore_Policy); } @Override public void setSinglePriceTag_ID (final @Nullable java.lang.String SinglePriceTag_ID) { set_ValueNoCheck (COLUMNNAME_SinglePriceTag_ID, SinglePriceTag_ID); } @Override public java.lang.String getSinglePriceTag_ID() { return get_ValueAsString(COLUMNNAME_SinglePriceTag_ID); } @Override public void setStatus (final @Nullable java.lang.String Status) { set_Value (COLUMNNAME_Status, Status); } @Override public java.lang.String getStatus() { return get_ValueAsString(COLUMNNAME_Status); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.swat\de.metas.swat.base\src\main\java-gen\de\metas\inoutcandidate\model\X_M_ShipmentSchedule.java
1
请完成以下Java代码
public I_C_Payment getC_Payment() throws RuntimeException { return (I_C_Payment)MTable.get(getCtx(), I_C_Payment.Table_Name) .getPO(getC_Payment_ID(), get_TrxName()); } /** Set Payment. @param C_Payment_ID Payment identifier */ public void setC_Payment_ID (int C_Payment_ID) { if (C_Payment_ID < 1) set_Value (COLUMNNAME_C_Payment_ID, null); else set_Value (COLUMNNAME_C_Payment_ID, Integer.valueOf(C_Payment_ID)); } /** Get Payment. @return Payment identifier */ public int getC_Payment_ID () { Integer ii = (Integer)get_Value(COLUMNNAME_C_Payment_ID); if (ii == null) return 0; return ii.intValue(); } /** Set Not Committed Aount.
@param NonCommittedAmt Amount not committed yet */ public void setNonCommittedAmt (BigDecimal NonCommittedAmt) { set_Value (COLUMNNAME_NonCommittedAmt, NonCommittedAmt); } /** Get Not Committed Aount. @return Amount not committed yet */ public BigDecimal getNonCommittedAmt () { BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_NonCommittedAmt); if (bd == null) return Env.ZERO; return bd; } }
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_B_SellerFunds.java
1
请完成以下Java代码
public FilterSql getSql( final DocumentFilter filter, final SqlOptions sqlOpts, final SqlDocumentFilterConverterContext context) { final DocumentFilterParam filterParameter = filter.getParameterOrNull(PARAMETERNAME_SearchText); if (filterParameter == null) { return null; } final String searchText = filterParameter.getValueAsString(); return FilterSql.ofWhereClause(SqlAndParams.builder() .append(sqlOpts.getTableNameOrAlias()) .append(getSqlCriteria(searchText)) .build()); } private SqlAndParams getSqlCriteria(final String searchText) { final String searchLikeValue = convertSearchTextToSqlLikeString(searchText); return SqlAndParams.of(BPARTNER_SEARCH_SQL_TEMPLATE, searchLikeValue, searchLikeValue, searchLikeValue); } // converts user entered strings like ' john doe ' to '%john%doe%' private static String convertSearchTextToSqlLikeString(@NonNull final String searchText) { String sql = searchText.trim()
.replaceAll("\\s+", "%") .replaceAll("%+", "%"); if (!sql.startsWith("%")) { sql = "%" + sql; } if (!sql.endsWith("%")) { sql = sql + "%"; } return sql; } }
repos\metasfresh-new_dawn_uat\backend\de.metas.ui.web.base\src\main\java\de\metas\ui\web\bpartner\filter\BPartnerSimpleFuzzySearchFilterProvider.java
1
请完成以下Java代码
protected Void execute(CommandContext commandContext, TaskEntity task) { if (userId != null) { task.setClaimTime(commandContext.getProcessEngineConfiguration().getClock().getCurrentTime()); if (task.getAssignee() != null) { if (!task.getAssignee().equals(userId)) { // When the task is already claimed by another user, throw // exception. Otherwise, ignore // this, post-conditions of method already met. throw new ActivitiTaskAlreadyClaimedException(task.getId(), task.getAssignee()); } } else { commandContext.getTaskEntityManager().changeTaskAssignee(task, userId); } } else { // Task claim time should be null task.setClaimTime(null);
// Task should be assigned to no one commandContext.getTaskEntityManager().changeTaskAssignee(task, null); } // Add claim time to historic task instance commandContext.getHistoryManager().recordTaskClaim(task); return null; } @Override protected String getSuspendedTaskException() { return "Cannot claim a suspended task"; } }
repos\Activiti-develop\activiti-core\activiti-engine\src\main\java\org\activiti\engine\impl\cmd\ClaimTaskCmd.java
1
请在Spring Boot框架中完成以下Java代码
public String getPropertiesFile() { return this.propertiesFile; } public void setPropertiesFile(String propertiesFile) { this.propertiesFile = propertiesFile; } public ApacheShiroProperties getShiro() { return this.apacheShiroProperties; } public SslProperties getSsl() { return this.ssl; } public String getUsername() { return this.username; } public void setUsername(String username) { this.username = username; } public static class ApacheShiroProperties { private String iniResourcePath; public String getIniResourcePath() { return this.iniResourcePath; } public void setIniResourcePath(String iniResourcePath) { this.iniResourcePath = iniResourcePath; } } public static class SecurityLogProperties { private static final String DEFAULT_SECURITY_LOG_LEVEL = "config"; private String file; private String level = DEFAULT_SECURITY_LOG_LEVEL; public String getFile() { return this.file; } public void setFile(String file) { this.file = file; } public String getLevel() { return this.level;
} public void setLevel(String level) { this.level = level; } } public static class SecurityManagerProperties { private String className; public String getClassName() { return this.className; } public void setClassName(String className) { this.className = className; } } public static class SecurityPostProcessorProperties { private String className; public String getClassName() { return this.className; } public void setClassName(String className) { this.className = className; } } }
repos\spring-boot-data-geode-main\spring-geode-project\spring-geode-autoconfigure\src\main\java\org\springframework\geode\boot\autoconfigure\configuration\support\SecurityProperties.java
2
请完成以下Java代码
public String getClientSoftwareKennung() { return clientSoftwareKennung; } /** * Sets the value of the clientSoftwareKennung property. * * @param value * allowed object is * {@link String } * */ public void setClientSoftwareKennung(String value) { this.clientSoftwareKennung = value; } /**
* Gets the value of the manuelleAbfrage property. * */ public boolean isManuelleAbfrage() { return manuelleAbfrage; } /** * Sets the value of the manuelleAbfrage property. * */ public void setManuelleAbfrage(boolean value) { this.manuelleAbfrage = value; } }
repos\metasfresh-new_dawn_uat\backend\de.metas.vertical.pharma.msv3.schema.v2\src\main\java-xjc\de\metas\vertical\pharma\vendor\gateway\msv3\schema\v2\VertragsdatenAbfragen.java
1
请完成以下Java代码
public class PhoneNumber { private String type; private String number; public PhoneNumber(String type, String number) { this.type = type; this.number = number; } public String getType() { return type; } public String getNumber() { return number; } @Override public String toString() {
return "PhoneNumber{" + "type='" + type + '\'' + ", number='" + number + '\'' + '}'; } @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; PhoneNumber that = (PhoneNumber) o; return Objects.equals(number, that.number); } @Override public int hashCode() { return Objects.hash(number); } }
repos\tutorials-master\core-java-modules\core-java-lang-6\src\main\java\com\baeldung\compareobjects\PhoneNumber.java
1
请完成以下Java代码
public Void execute(CommandContext commandContext) { if (executeDecisionContext == null) { throw new FlowableIllegalArgumentException("ExecuteDecisionContext is null"); } DmnEngineConfiguration engineConfiguration = CommandContextUtil.getDmnEngineConfiguration(); if (engineConfiguration.isHistoryEnabled()) { HistoricDecisionExecutionEntityManager historicDecisionExecutionEntityManager = engineConfiguration.getHistoricDecisionExecutionEntityManager(); HistoricDecisionExecutionEntity decisionExecutionEntity = historicDecisionExecutionEntityManager.create(); decisionExecutionEntity.setDecisionDefinitionId(executeDecisionContext.getDecisionId()); decisionExecutionEntity.setDeploymentId(executeDecisionContext.getDeploymentId()); decisionExecutionEntity.setStartTime(executeDecisionContext.getDecisionExecution().getStartTime()); decisionExecutionEntity.setEndTime(executeDecisionContext.getDecisionExecution().getEndTime()); decisionExecutionEntity.setInstanceId(executeDecisionContext.getInstanceId()); decisionExecutionEntity.setExecutionId(executeDecisionContext.getExecutionId()); decisionExecutionEntity.setActivityId(executeDecisionContext.getActivityId()); decisionExecutionEntity.setScopeType(executeDecisionContext.getScopeType()); decisionExecutionEntity.setTenantId(executeDecisionContext.getTenantId()); Boolean failed = executeDecisionContext.getDecisionExecution().isFailed(); if (BooleanUtils.isTrue(failed)) {
decisionExecutionEntity.setFailed(failed.booleanValue()); } ObjectMapper objectMapper = engineConfiguration.getObjectMapper(); if (objectMapper == null) { objectMapper = JsonMapper.shared(); } try { decisionExecutionEntity.setExecutionJson(objectMapper.writeValueAsString(executeDecisionContext.getDecisionExecution())); } catch (Exception e) { throw new FlowableException("Error writing execution json", e); } historicDecisionExecutionEntityManager.insert(decisionExecutionEntity); } return null; } }
repos\flowable-engine-main\modules\flowable-dmn-engine\src\main\java\org\flowable\dmn\engine\impl\cmd\PersistHistoricDecisionExecutionCmd.java
1
请完成以下Java代码
public class MovementLineHUPackingMaterialCollectorSource implements IHUPackingMaterialCollectorSource { public static final MovementLineHUPackingMaterialCollectorSource of(final I_M_MovementLine movementLine) { return builder() .movementLine(movementLine) .collectHUPipToSource(true) .build(); } private final int productId; private final int recordId; private final boolean collectHUPipToSource; @Builder private MovementLineHUPackingMaterialCollectorSource(@NonNull final I_M_MovementLine movementLine, final boolean collectHUPipToSource) { productId = movementLine.getM_Product_ID(); recordId = movementLine.getM_MovementLine_ID(); this.collectHUPipToSource = collectHUPipToSource; } @Override public int getM_Product_ID() {
return productId; } @Override public int getRecord_ID() { return recordId; } @Override public boolean isCollectHUPipToSource() { return collectHUPipToSource; } }
repos\metasfresh-new_dawn_uat\backend\de.metas.handlingunits.base\src\main\java\de\metas\handlingunits\movement\spi\impl\MovementLineHUPackingMaterialCollectorSource.java
1
请完成以下Java代码
public void setMessageSource(@NonNull MessageSource messageSource) { this.messages = new MessageSourceAccessor(messageSource); } /** * Sets the {@link GrantedAuthoritiesMapper} used for converting the authorities * loaded from storage to a new set of authorities which will be associated to the * {@link UsernamePasswordAuthenticationToken}. If not set, defaults to a * {@link NullAuthoritiesMapper}. * @param authoritiesMapper the {@link GrantedAuthoritiesMapper} used for mapping the * user's authorities */ public void setAuthoritiesMapper(GrantedAuthoritiesMapper authoritiesMapper) { this.authoritiesMapper = authoritiesMapper; } /** * Allows a custom strategy to be used for creating the <tt>UserDetails</tt> which * will be stored as the principal in the <tt>Authentication</tt> returned by the * {@link #createSuccessfulAuthentication(org.springframework.security.authentication.UsernamePasswordAuthenticationToken, org.springframework.security.core.userdetails.UserDetails)} * method. * @param userDetailsContextMapper the strategy instance. If not set, defaults to a
* simple <tt>LdapUserDetailsMapper</tt>. */ public void setUserDetailsContextMapper(UserDetailsContextMapper userDetailsContextMapper) { Assert.notNull(userDetailsContextMapper, "UserDetailsContextMapper must not be null"); this.userDetailsContextMapper = userDetailsContextMapper; } /** * Provides access to the injected {@code UserDetailsContextMapper} strategy for use * by subclasses. */ protected UserDetailsContextMapper getUserDetailsContextMapper() { return this.userDetailsContextMapper; } }
repos\spring-security-main\ldap\src\main\java\org\springframework\security\ldap\authentication\AbstractLdapAuthenticationProvider.java
1
请完成以下Java代码
public Set<ProductId> getOnlyProductIds() { return onlyProductIds != null && !onlyProductIds.isEmpty() ? onlyProductIds : null; } @Override public void setOnlyProductIds(final Collection<ProductId> productIds) { this.onlyProductIds = productIds != null ? ImmutableSet.copyOf(productIds) : null; } @Override public int getC_BPartner_ID() { return bpartnerId; } @Override public void setC_BPartner_ID(final int bpartnerId) { this.bpartnerId = bpartnerId <= 0 ? -1 : bpartnerId; } @Override public void setPriceListVersionId(final @Nullable PriceListVersionId priceListVersionId) { this.priceListVersionId = priceListVersionId; } @Nullable @Override public PriceListVersionId getPriceListVersionId() { return priceListVersionId; } @Override public void setDate(final ZonedDateTime date) { this.date = date; } @Override public ZonedDateTime getDate() { return date; } @Override public boolean isAllowAnyProduct() { return allowAnyProduct; } @Override public void setAllowAnyProduct(final boolean allowAnyProduct) { this.allowAnyProduct = allowAnyProduct; } @Override public String getHU_UnitType() { return huUnitType; } @Override public void setHU_UnitType(final String huUnitType) { this.huUnitType = huUnitType; } @Override public boolean isAllowVirtualPI() { return allowVirtualPI; } @Override public void setAllowVirtualPI(final boolean allowVirtualPI) { this.allowVirtualPI = allowVirtualPI; } @Override public void setOneConfigurationPerPI(final boolean oneConfigurationPerPI) { this.oneConfigurationPerPI = oneConfigurationPerPI; } @Override public boolean isOneConfigurationPerPI() { return oneConfigurationPerPI; } @Override
public boolean isAllowDifferentCapacities() { return allowDifferentCapacities; } @Override public void setAllowDifferentCapacities(final boolean allowDifferentCapacities) { this.allowDifferentCapacities = allowDifferentCapacities; } @Override public boolean isAllowInfiniteCapacity() { return allowInfiniteCapacity; } @Override public void setAllowInfiniteCapacity(final boolean allowInfiniteCapacity) { this.allowInfiniteCapacity = allowInfiniteCapacity; } @Override public boolean isAllowAnyPartner() { return allowAnyPartner; } @Override public void setAllowAnyPartner(final boolean allowAnyPartner) { this.allowAnyPartner = allowAnyPartner; } @Override public int getM_Product_Packaging_ID() { return packagingProductId; } @Override public void setM_Product_Packaging_ID(final int packagingProductId) { this.packagingProductId = packagingProductId > 0 ? packagingProductId : -1; } }
repos\metasfresh-new_dawn_uat\backend\de.metas.handlingunits.base\src\main\java\de\metas\handlingunits\impl\HUPIItemProductQuery.java
1
请完成以下Java代码
public class MoveDeadLetterJobToExecutableJobCmd implements Command<JobEntity>, Serializable { private static final long serialVersionUID = 1L; private static Logger log = LoggerFactory.getLogger(MoveDeadLetterJobToExecutableJobCmd.class); protected String jobId; protected int retries; public MoveDeadLetterJobToExecutableJobCmd(String jobId, int retries) { this.jobId = jobId; this.retries = retries; } public JobEntity execute(CommandContext commandContext) { if (jobId == null) { throw new ActivitiIllegalArgumentException("jobId and job is null"); }
DeadLetterJobEntity job = commandContext.getDeadLetterJobEntityManager().findById(jobId); if (job == null) { throw new JobNotFoundException(jobId); } if (log.isDebugEnabled()) { log.debug("Moving deadletter job to executable job table {}", job.getId()); } return commandContext.getJobManager().moveDeadLetterJobToExecutableJob(job, retries); } public String getJobId() { return jobId; } }
repos\Activiti-develop\activiti-core\activiti-engine\src\main\java\org\activiti\engine\impl\cmd\MoveDeadLetterJobToExecutableJobCmd.java
1
请在Spring Boot框架中完成以下Java代码
public class AD_Scheduler_Controller extends JavaProcess implements IProcessPrecondition { final SchedulerEventBusService schedulerEventBusService = SpringContextHolder.instance.getBean(SchedulerEventBusService.class); @Param(parameterName = "Action", mandatory = true) private String p_Action; @Param(parameterName = "DeactivateSupervisor") private boolean deactivateSupervisor; @Override public ProcessPreconditionsResolution checkPreconditionsApplicable(@NonNull final IProcessPreconditionsContext context) { if (!context.isSingleSelection()) { return ProcessPreconditionsResolution.rejectBecauseNotSingleSelection(); } return ProcessPreconditionsResolution.accept(); } @Override protected String doIt() { final AdSchedulerId adSchedulerId = AdSchedulerId.ofRepoId(getRecord_ID()); switch (SchedulerAction.ofCode(p_Action)) { case ENABLE: sendManageSchedulerRequest(adSchedulerId, SchedulerAction.ENABLE, ManageSchedulerRequest.SupervisorAction.ENABLE); break;
case DISABLE: final ManageSchedulerRequest.SupervisorAction supervisorAction = deactivateSupervisor ? ManageSchedulerRequest.SupervisorAction.DISABLE : null; sendManageSchedulerRequest(adSchedulerId, SchedulerAction.DISABLE, supervisorAction); break; case RUN_ONCE: sendManageSchedulerRequest(adSchedulerId, SchedulerAction.RUN_ONCE, null); break; case RESTART: sendManageSchedulerRequest(adSchedulerId, SchedulerAction.RESTART, ManageSchedulerRequest.SupervisorAction.ENABLE); break; default: throw new AdempiereException("Unsupported action!") .appendParametersToMessage() .setParameter("action", p_Action); } return MSG_OK; } private void sendManageSchedulerRequest( @NonNull final AdSchedulerId adSchedulerId, @NonNull final SchedulerAction schedulerAction, @Nullable final ManageSchedulerRequest.SupervisorAction supervisorAction) { schedulerEventBusService.postRequest(ManageSchedulerRequest.builder() .schedulerSearchKey(SchedulerSearchKey.of(adSchedulerId)) .clientId(Env.getClientId()) .schedulerAction(schedulerAction) .supervisorAction(supervisorAction) .build()); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\de\metas\scheduler\process\AD_Scheduler_Controller.java
2
请在Spring Boot框架中完成以下Java代码
public class Notification { protected int channel; @XmlElement(required = true) protected String value; protected String language; /** * Gets the value of the channel property. * */ public int getChannel() { return channel; } /** * Sets the value of the channel property. * */ public void setChannel(int value) { this.channel = value; } /** * Gets the value of the value property. * * @return * possible object is * {@link String } * */ public String getValue() { return value; } /** * Sets the value of the value property. * * @param value * allowed object is * {@link String } * */ public void setValue(String value) {
this.value = value; } /** * Gets the value of the language property. * * @return * possible object is * {@link String } * */ public String getLanguage() { return language; } /** * Sets the value of the language property. * * @param value * allowed object is * {@link String } * */ public void setLanguage(String value) { this.language = value; } }
repos\metasfresh-new_dawn_uat\backend\de.metas.shipper.gateway.dpd\src\main\java-xjc\com\dpd\common\service\types\shipmentservice\_3\Notification.java
2
请完成以下Java代码
public Long getId() { return id; } @Override public void setId(Long id) { this.id = id; } @Override public String getApp() { return app; } public AbstractRuleEntity<T> setApp(String app) { this.app = app; return this; } @Override public String getIp() { return ip; } public AbstractRuleEntity<T> setIp(String ip) { this.ip = ip; return this; } @Override public Integer getPort() { return port; } public AbstractRuleEntity<T> setPort(Integer port) { this.port = port; return this; }
public T getRule() { return rule; } public AbstractRuleEntity<T> setRule(T rule) { this.rule = rule; return this; } @Override public Date getGmtCreate() { return gmtCreate; } public AbstractRuleEntity<T> setGmtCreate(Date gmtCreate) { this.gmtCreate = gmtCreate; return this; } public Date getGmtModified() { return gmtModified; } public AbstractRuleEntity<T> setGmtModified(Date gmtModified) { this.gmtModified = gmtModified; return this; } @Override public T toRule() { return rule; } }
repos\spring-boot-student-master\spring-boot-student-sentinel-dashboard\src\main\java\com\alibaba\csp\sentinel\dashboard\datasource\entity\rule\AbstractRuleEntity.java
1
请完成以下Java代码
public static String getSummary(String document, int max_length, String sentence_separator) { List<String> sentenceList = splitSentence(document, sentence_separator); int sentence_count = sentenceList.size(); int document_length = document.length(); int sentence_length_avg = document_length / sentence_count; int size = max_length / sentence_length_avg + 1; List<List<String>> docs = convertSentenceListToDocument(sentenceList); TextRankSentence textRank = new TextRankSentence(docs); int[] topSentence = textRank.getTopSentence(size); List<String> resultList = new LinkedList<String>(); for (int i : topSentence) { resultList.add(sentenceList.get(i)); } resultList = permutation(resultList, sentenceList); resultList = pick_sentences(resultList, max_length); return TextUtility.join("。", resultList); } private static List<String> permutation(List<String> resultList, final List<String> sentenceList) { Collections.sort(resultList, new Comparator<String>() { @Override public int compare(String o1, String o2) { Integer num1 = sentenceList.indexOf(o1); Integer num2 = sentenceList.indexOf(o2); return num1.compareTo(num2); } }); return resultList;
} private static List<String> pick_sentences(List<String> resultList, int max_length) { List<String> summary = new ArrayList<String>(); int count = 0; for (String result : resultList) { if (count + result.length() <= max_length) { summary.add(result); count += result.length(); } } return summary; } }
repos\springboot-demo-master\hanlp\src\main\java\demo\hankcs\hanlp\summary\TextRankSentence.java
1
请在Spring Boot框架中完成以下Java代码
public class CityRestController { @Autowired private CityService cityService; @RequestMapping(value = "/api/city/{id}", method = RequestMethod.GET) public City findOneCity(@PathVariable("id") Long id) { return cityService.findCityById(id); } @RequestMapping(value = "/api/city", method = RequestMethod.GET) public List<City> findAllCity() { return cityService.findAllCity(); }
@RequestMapping(value = "/api/city", method = RequestMethod.POST) public void createCity(@RequestBody City city) { cityService.saveCity(city); } @RequestMapping(value = "/api/city", method = RequestMethod.PUT) public void modifyCity(@RequestBody City city) { cityService.updateCity(city); } @RequestMapping(value = "/api/city/{id}", method = RequestMethod.DELETE) public void modifyCity(@PathVariable("id") Long id) { cityService.deleteCity(id); } }
repos\springboot-learning-example-master\springboot-restful\src\main\java\org\spring\springboot\controller\CityRestController.java
2
请完成以下Java代码
public class ParallelGatewayJsonConverter extends BaseBpmnJsonConverter { public static void fillTypes( Map<String, Class<? extends BaseBpmnJsonConverter>> convertersToBpmnMap, Map<Class<? extends BaseElement>, Class<? extends BaseBpmnJsonConverter>> convertersToJsonMap ) { fillJsonTypes(convertersToBpmnMap); fillBpmnTypes(convertersToJsonMap); } public static void fillJsonTypes(Map<String, Class<? extends BaseBpmnJsonConverter>> convertersToBpmnMap) { convertersToBpmnMap.put(STENCIL_GATEWAY_PARALLEL, ParallelGatewayJsonConverter.class); } public static void fillBpmnTypes( Map<Class<? extends BaseElement>, Class<? extends BaseBpmnJsonConverter>> convertersToJsonMap ) { convertersToJsonMap.put(ParallelGateway.class, ParallelGatewayJsonConverter.class); }
protected String getStencilId(BaseElement baseElement) { return STENCIL_GATEWAY_PARALLEL; } protected void convertElementToJson(ObjectNode propertiesNode, BaseElement baseElement) {} protected FlowElement convertJsonToElement( JsonNode elementNode, JsonNode modelNode, Map<String, JsonNode> shapeMap ) { ParallelGateway gateway = new ParallelGateway(); return gateway; } }
repos\Activiti-develop\activiti-core\activiti-json-converter\src\main\java\org\activiti\editor\language\json\converter\ParallelGatewayJsonConverter.java
1
请在Spring Boot框架中完成以下Java代码
public String getServerGroup() { return this.serverGroup; } public void setServerGroup(String serverGroup) { this.serverGroup = serverGroup; } public String[] getServers() { return this.servers; } public void setServers(String[] servers) { this.servers = servers; } public int getSocketBufferSize() { return this.socketBufferSize; } public void setSocketBufferSize(int socketBufferSize) { this.socketBufferSize = socketBufferSize; } public int getStatisticInterval() { return this.statisticInterval; } public void setStatisticInterval(int statisticInterval) { this.statisticInterval = statisticInterval; } public int getSubscriptionAckInterval() { return this.subscriptionAckInterval; } public void setSubscriptionAckInterval(int subscriptionAckInterval) { this.subscriptionAckInterval = subscriptionAckInterval; } public boolean isSubscriptionEnabled() {
return this.subscriptionEnabled; } public void setSubscriptionEnabled(boolean subscriptionEnabled) { this.subscriptionEnabled = subscriptionEnabled; } public int getSubscriptionMessageTrackingTimeout() { return this.subscriptionMessageTrackingTimeout; } public void setSubscriptionMessageTrackingTimeout(int subscriptionMessageTrackingTimeout) { this.subscriptionMessageTrackingTimeout = subscriptionMessageTrackingTimeout; } public int getSubscriptionRedundancy() { return this.subscriptionRedundancy; } public void setSubscriptionRedundancy(int subscriptionRedundancy) { this.subscriptionRedundancy = subscriptionRedundancy; } public boolean isThreadLocalConnections() { return this.threadLocalConnections; } public void setThreadLocalConnections(boolean threadLocalConnections) { this.threadLocalConnections = threadLocalConnections; } }
repos\spring-boot-data-geode-main\spring-geode-project\spring-geode-autoconfigure\src\main\java\org\springframework\geode\boot\autoconfigure\configuration\support\PoolProperties.java
2
请在Spring Boot框架中完成以下Java代码
public class Application implements ApplicationRunner { @Autowired ApplicationContext applicationContext; public static void main(String[] args) { SpringApplication.run(Application.class, args); } @Override public void run(ApplicationArguments args) throws Exception { DataSource dataSourceMysql = applicationContext.getBean(DataSource.class); //模板引擎配置 生成文件配置 EngineConfig engineConfig = EngineConfig.builder() // 生成文件路径 .fileOutputDir("D://tmp/") // 打开目录 .openOutputDir(false) // 文件类型 .fileType(EngineFileType.WORD) // 生成模板实现 .produceType(EngineTemplateType.freemarker).build(); // 生成文档配置(包含以下自定义版本号、描述等配置连接),文档名称拼接:数据库名_描述_版本.扩展名 Configuration config = Configuration.builder() .title("数据库文档") // 版本号 .version("1.0.0") // 描述 .description("数据库设计文档") // 数据源 .dataSource(dataSourceMysql) // 模板引擎配置 .engineConfig(engineConfig) // 加载配置:想要生成的表、想要忽略的表 .produceConfig(getProcessConfig())
.build(); // 执行生成 new DocumentationExecute(config).execute(); } /** * 配置想要生成的表+ 配置想要忽略的表 * * @return 生成表配置 */ public static ProcessConfig getProcessConfig() { // 忽略表名 List<String> ignoreTableName = Arrays.asList(""); return ProcessConfig.builder() //根据名称指定表生成 .designatedTableName(new ArrayList<>()) //根据表前缀生成 .designatedTablePrefix(new ArrayList<>()) //根据表后缀生成 .designatedTableSuffix(new ArrayList<>()) //忽略表名 .ignoreTableName(ignoreTableName) .build(); } }
repos\springboot-demo-master\Screw\src\main\java\com\et\screw\Application.java
2
请完成以下Java代码
private AdIssueId createADIssue(@Nullable final JsonError error) { if (error == null || error.getErrors().isEmpty()) { return null; } final JsonErrorItem errorItem = error.getErrors().get(0); return errorManager.createIssue(IssueCreateRequest.builder() .summary(errorItem.getMessage() + "; " + errorItem.getDetail()) .stackTrace(errorItem.getStackTrace()) .loggerName(logger.getName()) .build()); } private static class ReceiptCandidateExportException extends AdempiereException { public ReceiptCandidateExportException(final String message) { super(message); } } private ImmutableMap<ProductId, String> getCommodityNumbersByProductId(@NonNull final Set<Product> products) { final Set<CommodityNumberId> commodityNumberIds = products.stream() .map(Product::getCommodityNumberId) .filter(Objects::nonNull) .collect(Collectors.toSet()); final List<I_M_CommodityNumber> commodityNumbers = commodityNumberDAO.getByIds(commodityNumberIds); final Map<Integer, I_M_CommodityNumber> commodityNumberById = Maps.uniqueIndex(commodityNumbers, I_M_CommodityNumber::getM_CommodityNumber_ID); final ImmutableMap.Builder<ProductId, String> commodityNumberByProductId = ImmutableMap.builder();
products.stream() .filter(product -> product.getCommodityNumberId() != null) .forEach(product -> { final I_M_CommodityNumber commodityNumber = commodityNumberById.get(product.getCommodityNumberId().getRepoId()); if (commodityNumber != null) { commodityNumberByProductId.put(product.getId(), commodityNumber.getValue()); } }); return commodityNumberByProductId.build(); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.business.rest-api-impl\src\main\java\de\metas\rest_api\v1\shipping\ReceiptCandidateAPIService.java
1
请完成以下Java代码
int getDifference() { return Capacity - Load; } void setSummary(int summary) { Summary = summary; } int getSummary() { return Summary; } void setFrom(String from) { From = from; } String getFrom()
{ return From; } void setTo(String to) { To = to; } String getTo() { return To; } } }
repos\metasfresh-new_dawn_uat\backend\de.metas.manufacturing\src\main\java\org\eevolution\process\CRPSummary.java
1
请完成以下Java代码
public ImmutableSet<ProductId> getProductIds() { return streamLines() .map(PickingJobLine::getProductId) .collect(ImmutableSet.toImmutableSet()); } @NonNull public ITranslatableString getSingleProductNameOrEmpty() { ProductId productId = null; ITranslatableString productName = TranslatableStrings.empty(); for (final PickingJobLine line : lines) { if (productId == null) { productId = line.getProductId(); } else if (!ProductId.equals(productId, line.getProductId())) { // found different products return TranslatableStrings.empty(); } productName = line.getProductName(); } return productName; } @Nullable public Quantity getSingleQtyToPickOrNull() { return extractQtyToPickOrNull(lines, PickingJobLine::getProductId, PickingJobLine::getQtyToPick); } @Nullable private static <T> Quantity extractQtyToPickOrNull( @NonNull final Collection<T> lines, @NonNull final Function<T, ProductId> extractProductId, @NonNull final Function<T, Quantity> extractQtyToPick) { ProductId productId = null; Quantity qtyToPick = null; for (final T line : lines) { final ProductId lineProductId = extractProductId.apply(line); if (productId == null) { productId = lineProductId; } else if (!ProductId.equals(productId, lineProductId)) { // found different products return null; }
final Quantity lineQtyToPick = extractQtyToPick.apply(line); if (qtyToPick == null) { qtyToPick = lineQtyToPick; } else if (UomId.equals(qtyToPick.getUomId(), lineQtyToPick.getUomId())) { qtyToPick = qtyToPick.add(lineQtyToPick); } else { // found different UOMs return null; } } return qtyToPick; } @NonNull public ImmutableSet<HuId> getPickedHuIds(@Nullable final PickingJobLineId lineId) { return lineId != null ? getLineById(lineId).getPickedHUIds() : getAllPickedHuIds(); } public ImmutableSet<HuId> getAllPickedHuIds() { return streamLines() .map(PickingJobLine::getPickedHUIds) .flatMap(Set::stream) .collect(ImmutableSet.toImmutableSet()); } public ImmutableSet<PPOrderId> getManufacturingOrderIds() { return streamLines() .map(PickingJobLine::getPickFromManufacturingOrderId) .filter(Objects::nonNull) .collect(ImmutableSet.toImmutableSet()); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.handlingunits.base\src\main\java\de\metas\handlingunits\picking\job\model\PickingJob.java
1
请完成以下Java代码
public void setDeleteImportDataProcessClass(@NonNull final Class<?> deleteImportDataProcessClass) { relatedProcessesRegistry.setDeleteImportDataProcessClass(deleteImportDataProcessClass); } @Override public <ImportRecordType> IImportProcess<ImportRecordType> newImportProcess(@NonNull final Class<ImportRecordType> modelImportClass) { final IImportProcess<ImportRecordType> importProcess = newImportProcessOrNull(modelImportClass); if (importProcess == null) { throw new AdempiereException("No import process found for " + modelImportClass); } return importProcess; } @Nullable private <ImportRecordType> IImportProcess<ImportRecordType> newImportProcessOrNull(@NonNull final Class<ImportRecordType> modelImportClass) { final Class<?> importProcessClass = importProcessDescriptorsMap.getImportProcessClassByModelImportClassOrNull(modelImportClass); if (importProcessClass == null) { return null; } return newInstance(importProcessClass); } private <ImportRecordType> IImportProcess<ImportRecordType> newInstance(final Class<?> importProcessClass) { try { @SuppressWarnings("unchecked") final IImportProcess<ImportRecordType> importProcess = (IImportProcess<ImportRecordType>)importProcessClass.newInstance(); return importProcess; } catch (final Exception e) { throw new AdempiereException("Failed instantiating " + importProcessClass, e); } } @Nullable
private <ImportRecordType> IImportProcess<ImportRecordType> newImportProcessForTableNameOrNull(@NonNull final String importTableName) { final Class<?> importProcessClass = importProcessDescriptorsMap.getImportProcessClassByImportTableNameOrNull(importTableName); if (importProcessClass == null) { return null; } return newInstance(importProcessClass); } @Override public <ImportRecordType> IImportProcess<ImportRecordType> newImportProcessForTableName(@NonNull final String importTableName) { final IImportProcess<ImportRecordType> importProcess = newImportProcessForTableNameOrNull(importTableName); if (importProcess == null) { throw new AdempiereException("No import process found for " + importTableName); } return importProcess; } }
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java\de\metas\impexp\processing\impl\ImportProcessFactory.java
1
请完成以下Spring Boot application配置
spring: mail: # 配置发送告警的邮箱 host: smtp.126.com username: wwbmlhh@126.com password: '******' default-encoding: UTF-8 boot: admin: notify: mail:
from: ${spring.mail.username} # 告警发件人 to: 7685413@qq.com # 告警收件人
repos\SpringBoot-Labs-master\lab-35\lab-35-admin-04-adminserver\src\main\resources\application.yaml
2
请完成以下Java代码
public class BestellungPosition { @XmlElement(name = "Pzn") protected long pzn; @XmlElement(name = "Menge") protected int menge; @XmlElement(name = "Liefervorgabe", required = true) @XmlSchemaType(name = "string") protected Liefervorgabe liefervorgabe; /** * Gets the value of the pzn property. * */ public long getPzn() { return pzn; } /** * Sets the value of the pzn property. * */ public void setPzn(long value) { this.pzn = value; } /** * Gets the value of the menge property. * */ public int getMenge() { return menge; } /** * Sets the value of the menge property. * */ public void setMenge(int value) { this.menge = value; } /** * Gets the value of the liefervorgabe property.
* * @return * possible object is * {@link Liefervorgabe } * */ public Liefervorgabe getLiefervorgabe() { return liefervorgabe; } /** * Sets the value of the liefervorgabe property. * * @param value * allowed object is * {@link Liefervorgabe } * */ public void setLiefervorgabe(Liefervorgabe value) { this.liefervorgabe = 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\BestellungPosition.java
1
请完成以下Java代码
public class DecisionRequirementsDefinitionCache extends ResourceDefinitionCache<DecisionRequirementsDefinitionEntity> { public DecisionRequirementsDefinitionCache(CacheFactory factory, int cacheCapacity, CacheDeployer cacheDeployer) { super(factory, cacheCapacity, cacheDeployer); } @Override protected AbstractResourceDefinitionManager<DecisionRequirementsDefinitionEntity> getManager() { return Context.getCommandContext().getDecisionRequirementsDefinitionManager(); } @Override protected void checkInvalidDefinitionId(String definitionId) { ensureNotNull("Invalid decision requirements definition id", "decisionRequirementsDefinitionId", definitionId); } @Override protected void checkDefinitionFound(String definitionId, DecisionRequirementsDefinitionEntity definition) { ensureNotNull("no deployed decision requirements definition found with id '" + definitionId + "'", "decisionRequirementsDefinition", definition); } @Override protected void checkInvalidDefinitionByKey(String definitionKey, DecisionRequirementsDefinitionEntity definition) { // not needed }
@Override protected void checkInvalidDefinitionByKeyAndTenantId(String definitionKey, String tenantId, DecisionRequirementsDefinitionEntity definition) { // not needed } @Override protected void checkInvalidDefinitionByKeyVersionAndTenantId(String definitionKey, Integer definitionVersion, String tenantId, DecisionRequirementsDefinitionEntity definition) { // not needed } @Override protected void checkInvalidDefinitionByKeyVersionTagAndTenantId(String definitionKey, String definitionVersionTag, String tenantId, DecisionRequirementsDefinitionEntity definition) { // not needed } @Override protected void checkInvalidDefinitionByDeploymentAndKey(String deploymentId, String definitionKey, DecisionRequirementsDefinitionEntity definition) { // not needed } @Override protected void checkInvalidDefinitionWasCached(String deploymentId, String definitionId, DecisionRequirementsDefinitionEntity definition) { ensureNotNull("deployment '" + deploymentId + "' didn't put decision requirements definition '" + definitionId + "' in the cache", "cachedDecisionRequirementsDefinition", definition); } }
repos\camunda-bpm-platform-master\engine\src\main\java\org\camunda\bpm\engine\impl\persistence\deploy\cache\DecisionRequirementsDefinitionCache.java
1
请完成以下Java代码
public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; NameAgeEntity other = (NameAgeEntity) obj; if (age == null) { if (other.age != null) return false; } else if (!age.equals(other.age)) return false; if (count == null) { if (other.count != null) return false;
} else if (!count.equals(other.count)) return false; if (name == null) { if (other.name != null) return false; } else if (!name.equals(other.name)) return false; return true; } @Override public String toString() { return "NameAgeEntity [age=" + age + ", count=" + count + ", name=" + name + "]"; } }
repos\tutorials-master\spring-web-modules\spring-thymeleaf-attributes\accessing-session-attributes\src\main\java\com\baeldung\accesing_session_attributes\business\entities\NameAgeEntity.java
1
请完成以下Java代码
public void setDocNoSequence(org.compiere.model.I_AD_Sequence DocNoSequence) { set_ValueFromPO(COLUMNNAME_DocNoSequence_ID, org.compiere.model.I_AD_Sequence.class, DocNoSequence); } /** Set Nummernfolgen für Belege. @param DocNoSequence_ID Document sequence determines the numbering of documents */ @Override public void setDocNoSequence_ID (int DocNoSequence_ID) { if (DocNoSequence_ID < 1) set_Value (COLUMNNAME_DocNoSequence_ID, null); else
set_Value (COLUMNNAME_DocNoSequence_ID, Integer.valueOf(DocNoSequence_ID)); } /** Get Nummernfolgen für Belege. @return Document sequence determines the numbering of documents */ @Override public int getDocNoSequence_ID () { Integer ii = (Integer)get_Value(COLUMNNAME_DocNoSequence_ID); if (ii == null) return 0; return ii.intValue(); } }
repos\metasfresh-new_dawn_uat\backend\de.metas.adempiere.adempiere\base\src\main\java-gen\org\compiere\model\X_C_DocType_Sequence.java
1
请完成以下Java代码
public static ServerWebExchangeMatcher pathMatchers(@Nullable HttpMethod method, String... patterns) { List<ServerWebExchangeMatcher> matchers = new ArrayList<>(patterns.length); for (String pattern : patterns) { matchers.add(new PathPatternParserServerWebExchangeMatcher(pattern, method)); } return new OrServerWebExchangeMatcher(matchers); } /** * Creates a matcher that matches on any of the provided patterns. * @param patterns the patterns to match on * @return the matcher to use */ public static ServerWebExchangeMatcher pathMatchers(String... patterns) { return pathMatchers(null, patterns); } /** * Creates a matcher that matches on any of the provided {@link PathPattern}s. * @param pathPatterns the {@link PathPattern}s to match on * @return the matcher to use */ public static ServerWebExchangeMatcher pathMatchers(PathPattern... pathPatterns) { return pathMatchers(null, pathPatterns); } /** * Creates a matcher that matches on the specific method and any of the provided * {@link PathPattern}s. * @param method the method to match on. If null, any method will be matched. * @param pathPatterns the {@link PathPattern}s to match on * @return the matcher to use */ public static ServerWebExchangeMatcher pathMatchers(@Nullable HttpMethod method, PathPattern... pathPatterns) { List<ServerWebExchangeMatcher> matchers = new ArrayList<>(pathPatterns.length); for (PathPattern pathPattern : pathPatterns) { matchers.add(new PathPatternParserServerWebExchangeMatcher(pathPattern, method)); } return new OrServerWebExchangeMatcher(matchers); } /** * Creates a matcher that will match on any of the provided matchers * @param matchers the matchers to match on * @return the matcher to use */
public static ServerWebExchangeMatcher matchers(ServerWebExchangeMatcher... matchers) { return new OrServerWebExchangeMatcher(matchers); } /** * Matches any exchange * @return the matcher to use */ @SuppressWarnings("Convert2Lambda") public static ServerWebExchangeMatcher anyExchange() { // we don't use a lambda to ensure a unique equals and hashcode // which otherwise can cause problems with adding multiple entries to an ordered // LinkedHashMap return new ServerWebExchangeMatcher() { @Override public Mono<MatchResult> matches(ServerWebExchange exchange) { return ServerWebExchangeMatcher.MatchResult.match(); } }; } }
repos\spring-security-main\web\src\main\java\org\springframework\security\web\server\util\matcher\ServerWebExchangeMatchers.java
1