text
stringlengths
10
2.72M
package com.citibank.ods.persistence.pl.dao.rdb.oracle; import java.math.BigInteger; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Timestamp; import java.util.ArrayList; import com.citibank.ods.common.connection.rdb.ManagedRdbConnection; import com.citibank.ods.common.dataset.DataSet; import com.citibank.ods.common.dataset.ResultSetDataSet; import com.citibank.ods.common.exception.NoRowsReturnedException; import com.citibank.ods.common.exception.UnexpectedException; import com.citibank.ods.common.util.ODSConstraintDecoder; import com.citibank.ods.entity.pl.BaseTplProductEntity; import com.citibank.ods.entity.pl.TplProductMovEntity; import com.citibank.ods.entity.pl.valueobject.TplProductMovEntityVO; import com.citibank.ods.persistence.pl.dao.TplProductMovDAO; import com.citibank.ods.persistence.pl.dao.rdb.oracle.factory.OracleODSDAOFactory; import com.citibank.ods.persistence.util.CitiStatement; /** * * @author acacio.domingos,Apr 14, 2007 * */ public class OracleTplProductMovDAO extends BaseOracleTplProductDAO implements TplProductMovDAO { /* * Nome da tabela */ private static final String C_TPL_PRODUCT_MOV = C_PL_SCHEMA + "TPL_PRODUCT_MOV"; /* * Campos específicos da tabela */ private String C_OPERN_CODE = "OPERN_CODE"; protected String C_OPERN_TEXT = "OPERN_TEXT"; private static final String C_TPL_PRODUCT = C_PL_SCHEMA + "TPL_PRODUCT"; private static final String C_TPL_PROD_FAML = C_PL_SCHEMA + "TPL_PRODUCT_FAMILY_PRVT"; private String ALIAS_PRODUCT = "PROD"; private String ALIAS_PROD_FAML = "PROD_FAML"; private static final String C_TPL_PROD_SUB_FAML = C_PL_SCHEMA + "TPL_PRODUCT_SUB_FAMILY_PRVT"; private String ALIAS_PROD_SUB_FAML = "SUB"; private String C_PROD_SUB_FAML_NAME = "PROD_SUB_FAML_NAME"; private String C_PROD_FAML_NAME = "PROD_FAML_NAME"; /** * Este método insere um registro * @see com.citibank.ods.persistence.pl.dao.TplProductDAO#insert(com.citibank.ods.entity.pl.TplProductEntity) */ public TplProductMovEntity insert( TplProductMovEntity tplProductMovEntity_ ) { ManagedRdbConnection connection = null; CitiStatement preparedStatement = null; StringBuffer query = new StringBuffer(); try { connection = OracleODSDAOFactory.getConnection(); query.append( "INSERT INTO " + C_TPL_PRODUCT_MOV + " ( " ); query.append( C_PROD_CODE + ", " ); query.append( C_SYS_CODE + ", " ); query.append( C_SYS_SEG_CODE + ", " ); query.append( C_PROD_NAME + ", " ); query.append( C_PROD_TEXT + ", " ); query.append( C_PROD_CCY_CODE + ", " ); query.append( C_PROD_ISO_CODE + ", " ); query.append( C_PROD_ANBID_CODE + ", " ); query.append( C_PROD_CETIP_CODE + ", " ); query.append( C_PROD_SELIC_CODE + ", " ); query.append( C_PROD_BOVESPA_CODE + ", " ); query.append( C_PROD_BMF_CODE + ", " ); query.append( C_PROD_CREATE_DATE + ", " ); query.append( C_PROD_STAT_CODE + ", " ); query.append( C_PRVT_PROD_AGGR_CODE + ", " ); query.append( C_PROD_CR_TYPE_CLASS_CODE + ", " ); query.append( C_PROD_PROC_SYS_CODE + ", " ); query.append( C_PROD_PROC_SYS_SEG_CODE + ", " ); query.append( C_PROD_APPRV_DATE + ", " ); query.append( C_PROD_OPERN_STA_DATE + ", " ); query.append( C_PROD_CSTDY_CNPJ_NBR + ", " ); query.append( C_PROD_AUDIT_CNPJ_NBR + ", " ); query.append( C_PROD_MGMT_CNPJ_NBR + ", " ); query.append( C_PROD_CTL_CNPJ_NBR + ", " ); query.append( C_PROD_ADMIN_CNPJ_NBR + ", " ); query.append( C_CITI_GRP_TIE_RELTN_PLCY_IND + ", " ); query.append( C_CITI_GRP_TIE_RSTRN_PLCY_IND + ", " ); //ISIN - fase 3 query.append( C_PROD_ISIN_CODE + ", " ); query.append( C_PROD_INVST_RISK_CODE + ", " ); query.append( C_PROD_QLFY_CODE + ", " ); query.append( C_PROD_SUB_FAML_CODE + ", " ); query.append( C_PROD_LEGAL_CLASS_CODE + ", " ); query.append( C_LAST_UPD_USER_ID + ", " ); query.append( C_LAST_UPD_DATE + ", " ); query.append( C_PROD_ACCT_CODE + ", " ); query.append( C_ASSET_TYPE_CODE + ", " ); query.append( C_OPERN_CODE + ", " ); query.append( C_PROD_SENT_IND + ", " ); query.append( C_PRCLAS_PROD_ASSET_CLASS_CODE + ", " ); query.append( C_PRCLAS_PROD_STYP_CODE + ", " ); query.append( " PROD_ONESRC_ASSET_CLASS_CODE, " ); query.append( C_PRCLAS_PROD_TYPE_CODE + " ) " ); query.append( " VALUES ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, " ); query.append( " ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?,?,?,?,?,?, ? )" ); //TODO incluir os novos campos preparedStatement = new CitiStatement(connection.prepareStatement( query.toString() )); TplProductMovEntityVO tplProductMovEntityVO = ( TplProductMovEntityVO ) tplProductMovEntity_.getData(); int count = 1; if ( tplProductMovEntityVO.getProdCode() != null && !tplProductMovEntityVO.getProdCode().equals( "" ) ) { preparedStatement.setString( count++, tplProductMovEntityVO.getProdCode() ); } else { throw new UnexpectedException( C_ERROR_EXECUTING_STATEMENT, null ); } if ( tplProductMovEntityVO.getSysCode() != null && !tplProductMovEntityVO.getSysCode().equals( "" ) ) { preparedStatement.setString( count++, tplProductMovEntityVO.getSysCode() ); } else { throw new UnexpectedException( C_ERROR_EXECUTING_STATEMENT, null ); } if ( tplProductMovEntityVO.getSysSegCode() != null && !tplProductMovEntityVO.getSysSegCode().equals( "" ) ) { preparedStatement.setLong( count++, tplProductMovEntityVO.getSysSegCode().longValue() ); } else { throw new UnexpectedException( C_ERROR_EXECUTING_STATEMENT, null ); } if ( tplProductMovEntityVO.getProdName() != null && !tplProductMovEntityVO.getProdName().equals( "" ) ) { preparedStatement.setString( count++, tplProductMovEntityVO.getProdName() ); } else { preparedStatement.setString( count++, null ); } if ( tplProductMovEntityVO.getProdText() != null && !tplProductMovEntityVO.getProdText().equals( "" ) ) { preparedStatement.setString( count++, tplProductMovEntityVO.getProdText() ); } else { preparedStatement.setString( count++, null ); } if ( tplProductMovEntityVO.getProdCcyCode() != null && !tplProductMovEntityVO.getProdCcyCode().equals( "" ) ) { preparedStatement.setString( count++, tplProductMovEntityVO.getProdCcyCode() ); } else { preparedStatement.setString( count++, null ); } if ( tplProductMovEntityVO.getProdIsoCode() != null && !tplProductMovEntityVO.getProdIsoCode().equals( "" ) ) { preparedStatement.setString( count++, tplProductMovEntityVO.getProdIsoCode() ); } else { preparedStatement.setString( count++, null ); } if ( tplProductMovEntityVO.getProdAnbidCode() != null && !tplProductMovEntityVO.getProdAnbidCode().equals( "" ) ) { preparedStatement.setString( count++, tplProductMovEntityVO.getProdAnbidCode() ); } else { preparedStatement.setString( count++, null ); } if ( tplProductMovEntityVO.getProdCetipCode() != null && !tplProductMovEntityVO.getProdCetipCode().equals( "" ) ) { preparedStatement.setString( count++, tplProductMovEntityVO.getProdCetipCode() ); } else { preparedStatement.setString( count++, null ); } if ( tplProductMovEntityVO.getProdSelicCode() != null && !tplProductMovEntityVO.getProdSelicCode().equals( "" ) ) { preparedStatement.setString( count++, tplProductMovEntityVO.getProdSelicCode() ); } else { preparedStatement.setString( count++, null ); } if ( tplProductMovEntityVO.getProdBovespaCode() != null && !tplProductMovEntityVO.getProdBovespaCode().equals( "" ) ) { preparedStatement.setString( count++, tplProductMovEntityVO.getProdBovespaCode() ); } else { preparedStatement.setString( count++, null ); } if ( tplProductMovEntityVO.getProdBmfCode() != null && !tplProductMovEntityVO.getProdBmfCode().equals( "" ) ) { preparedStatement.setString( count++, tplProductMovEntityVO.getProdBmfCode() ); } else { preparedStatement.setString( count++, null ); } if ( tplProductMovEntityVO.getProdCreateDate() != null && !tplProductMovEntityVO.getProdCreateDate().equals( "" ) ) { preparedStatement.setTimestamp( count++, new Timestamp( tplProductMovEntityVO.getProdCreateDate().getTime() ) ); } else { preparedStatement.setTimestamp( count++, null ); } if ( tplProductMovEntityVO.getProdStatCode() != null && !tplProductMovEntityVO.getProdStatCode().equals( "" ) ) { preparedStatement.setString( count++, tplProductMovEntityVO.getProdStatCode() ); } else { preparedStatement.setString( count++, null ); } if ( tplProductMovEntityVO.getPrvtProdAggrCode() != null && !tplProductMovEntityVO.getPrvtProdAggrCode().equals( "" ) ) { preparedStatement.setString( count++, tplProductMovEntityVO.getPrvtProdAggrCode() ); } else { preparedStatement.setString( count++, null ); } if ( tplProductMovEntityVO.getProdCrTypeClassCode() != null && !tplProductMovEntityVO.getProdCrTypeClassCode().equals( "" ) ) { preparedStatement.setString( count++, tplProductMovEntityVO.getProdCrTypeClassCode() ); } else { preparedStatement.setString( count++, null ); } if ( tplProductMovEntityVO.getProdProcSysCode() != null && !tplProductMovEntityVO.getProdProcSysCode().equals( "" ) ) { preparedStatement.setString( count++, tplProductMovEntityVO.getProdProcSysCode() ); } else { preparedStatement.setString( count++, null ); } if ( tplProductMovEntityVO.getProdProcSysSegCode() != null && !tplProductMovEntityVO.getProdProcSysSegCode().equals( "" ) ) { preparedStatement.setLong( count++, tplProductMovEntityVO.getProdProcSysSegCode().longValue() ); } else { preparedStatement.setString( count++, null ); } if ( tplProductMovEntityVO.getProdApprvDate() != null && !tplProductMovEntityVO.getProdApprvDate().equals( "" ) ) { preparedStatement.setTimestamp( count++, new Timestamp( tplProductMovEntityVO.getProdApprvDate().getTime() ) ); } else { preparedStatement.setTimestamp( count++, null ); } if ( tplProductMovEntityVO.getProdOpernStaDate() != null && !tplProductMovEntityVO.getProdOpernStaDate().equals( "" ) ) { preparedStatement.setTimestamp( count++, new Timestamp( tplProductMovEntityVO.getProdOpernStaDate().getTime() ) ); } else { preparedStatement.setTimestamp( count++, null ); } if ( tplProductMovEntityVO.getProdCstdyCnpjNbr() != null && !tplProductMovEntityVO.getProdCstdyCnpjNbr().equals( "" ) ) { preparedStatement.setString( count++, tplProductMovEntityVO.getProdCstdyCnpjNbr() ); } else { preparedStatement.setString( count++, null ); } if ( tplProductMovEntityVO.getProdAuditCnpjNbr() != null && !tplProductMovEntityVO.getProdAuditCnpjNbr().equals( "" ) ) { preparedStatement.setString( count++, tplProductMovEntityVO.getProdAuditCnpjNbr() ); } else { preparedStatement.setString( count++, null ); } if ( tplProductMovEntityVO.getProdMgmtCnpjNbr() != null && !tplProductMovEntityVO.getProdMgmtCnpjNbr().equals( "" ) ) { preparedStatement.setString( count++, tplProductMovEntityVO.getProdMgmtCnpjNbr() ); } else { preparedStatement.setString( count++, null ); } if ( tplProductMovEntityVO.getProdCtlCnpjNbr() != null && !tplProductMovEntityVO.getProdCtlCnpjNbr().equals( "" ) ) { preparedStatement.setString( count++, tplProductMovEntityVO.getProdCtlCnpjNbr() ); } else { preparedStatement.setString( count++, null ); } if ( tplProductMovEntityVO.getProdAdminCnpjNbr() != null && !tplProductMovEntityVO.getProdAdminCnpjNbr().equals( "" ) ) { preparedStatement.setString( count++, tplProductMovEntityVO.getProdAdminCnpjNbr() ); } else { preparedStatement.setString( count++, null ); } if ( tplProductMovEntityVO.getCitiGrpTieReltnPlcyInd() != null && !tplProductMovEntityVO.getCitiGrpTieReltnPlcyInd().equals( "" ) ) { preparedStatement.setString( count++, tplProductMovEntityVO.getCitiGrpTieReltnPlcyInd() ); } else { preparedStatement.setString( count++, null ); } if ( tplProductMovEntityVO.getCitiGrpTieRstrnPlcyInd() != null && !tplProductMovEntityVO.getCitiGrpTieRstrnPlcyInd().equals( "" ) ) { preparedStatement.setString( count++, tplProductMovEntityVO.getCitiGrpTieRstrnPlcyInd() ); } else { preparedStatement.setString( count++, null ); } //ISIN - Fase 3 if ( tplProductMovEntityVO.getProdIsinCode() != null && !tplProductMovEntityVO.getProdIsinCode().equals( "" ) ) { preparedStatement.setString( count++, tplProductMovEntityVO.getProdIsinCode() ); } else { preparedStatement.setString( count++, null ); } if ( tplProductMovEntityVO.getProdRiskCatCode() != null && !tplProductMovEntityVO.getProdRiskCatCode().equals( "" ) ) { preparedStatement.setLong( count++, tplProductMovEntityVO.getProdRiskCatCode().longValue() ); } else { preparedStatement.setString( count++, null ); } if ( tplProductMovEntityVO.getProdQlfyCode() != null && !tplProductMovEntityVO.getProdQlfyCode().equals( "" ) ) { preparedStatement.setLong( count++, tplProductMovEntityVO.getProdQlfyCode().longValue() ); } else { preparedStatement.setString( count++, null ); } if ( tplProductMovEntityVO.getProdSubFamlCode() != null && !tplProductMovEntityVO.getProdSubFamlCode().equals( "" ) ) { preparedStatement.setLong( count++, tplProductMovEntityVO.getProdSubFamlCode().longValue() ); } else { preparedStatement.setString( count++, null ); } if ( tplProductMovEntityVO.getProdLegalClassCode() != null && !tplProductMovEntityVO.getProdLegalClassCode().equals( "" ) ) { preparedStatement.setString( count++, tplProductMovEntityVO.getProdLegalClassCode() ); } else { preparedStatement.setString( count++, null ); } if ( tplProductMovEntityVO.getLastUpdUserId() != null && !tplProductMovEntityVO.getLastUpdUserId().equals( "" ) ) { preparedStatement.setString( count++, tplProductMovEntityVO.getLastUpdUserId() ); } else { preparedStatement.setString( count++, null ); } if ( tplProductMovEntityVO.getLastUpdDate() != null && !tplProductMovEntityVO.getLastUpdDate().equals( "" ) ) { preparedStatement.setTimestamp( count++, new Timestamp( tplProductMovEntityVO.getLastUpdDate().getTime() ) ); } else { preparedStatement.setString( count++, null ); } if ( tplProductMovEntityVO.getProdAcctCode() != null && !tplProductMovEntityVO.getProdAcctCode().equals( "" ) ) { preparedStatement.setString( count++, tplProductMovEntityVO.getProdAcctCode() ); } else { preparedStatement.setString( count++, null ); } if ( tplProductMovEntityVO.getAssetTypeCode() != null && !tplProductMovEntityVO.getAssetTypeCode().equals( "" ) ) { preparedStatement.setLong( count++, tplProductMovEntityVO.getAssetTypeCode().longValue() ); }else { preparedStatement.setString( count++, null ); } if ( tplProductMovEntityVO.getOpernCode() != null && !tplProductMovEntityVO.getOpernCode().equals( "" ) ) { preparedStatement.setString( count++, tplProductMovEntityVO.getOpernCode() ); } else { preparedStatement.setString( count++, null ); } //Novos campos Fase2 if ( tplProductMovEntityVO.getProdSentIaInd() != null ) { preparedStatement.setString( count++, tplProductMovEntityVO.getProdSentIaInd() ); } else { preparedStatement.setString( count++, null ); } if ( tplProductMovEntityVO.getPrclasProdAssetClassCode() != null && !tplProductMovEntityVO.getPrclasProdAssetClassCode().trim().equals("")) { preparedStatement.setLong( count++, new BigInteger(tplProductMovEntityVO.getPrclasProdAssetClassCode()).longValue() ); } else { preparedStatement.setString( count++, null ); } if ( tplProductMovEntityVO.getPrclasProdStypCode() != null && !tplProductMovEntityVO.getPrclasProdStypCode().trim().equals("")) { preparedStatement.setLong( count++, new BigInteger(tplProductMovEntityVO.getPrclasProdStypCode()).longValue()); } else { preparedStatement.setString( count++, null ); } //Classificacao do produto no Onesource if (tplProductMovEntityVO.getAssetClassOnesrc() != null && !tplProductMovEntityVO.getAssetClassOnesrc().trim().equals("")) { preparedStatement.setString( count++, tplProductMovEntityVO.getAssetClassOnesrc()); } else { preparedStatement.setString( count++, null ); } if (tplProductMovEntityVO.getPrclasProdTypeCode() != null && !tplProductMovEntityVO.getPrclasProdTypeCode().trim().equals("")) { preparedStatement.setLong( count++, new BigInteger(tplProductMovEntityVO.getPrclasProdTypeCode()).longValue()); } else { preparedStatement.setString( count++, null ); } preparedStatement.execute(); preparedStatement.replaceParametersInQuery(query.toString()); } catch ( SQLException e ) { throw new UnexpectedException( e.getErrorCode(), C_ERROR_EXECUTING_STATEMENT, e ); } finally { closeStatement( preparedStatement ); closeConnection( connection ); } return tplProductMovEntity_; } /** * Este método atualiza um registro com base nos criterios informados * @see com.citibank.ods.persistence.pl.dao.TplProductDAO#update(com.citibank.ods.entity.pl.TplProductEntity) */ public TplProductMovEntity update( TplProductMovEntity tplProductMovEntity_ ) { ManagedRdbConnection connection = null; CitiStatement preparedStatement = null; StringBuffer query = new StringBuffer(); try { connection = OracleODSDAOFactory.getConnection(); query.append( "UPDATE " + C_TPL_PRODUCT_MOV + " SET " ); query.append( C_PROD_NAME + "= ?," ); query.append( C_PROD_TEXT + "= ?," ); query.append( C_PROD_CCY_CODE + "= ?," ); query.append( C_PROD_ISO_CODE + "= ?," ); query.append( C_PROD_ANBID_CODE + "= ?," ); query.append( C_PROD_CETIP_CODE + "= ?," ); query.append( C_PROD_SELIC_CODE + "= ?," ); query.append( C_PROD_BOVESPA_CODE + "= ?," ); query.append( C_PROD_BMF_CODE + "= ?," ); query.append( C_PROD_CREATE_DATE + "= ?," ); query.append( C_PROD_STAT_CODE + "= ?," ); query.append( C_PRVT_PROD_AGGR_CODE + "= ?," ); query.append( C_PROD_CR_TYPE_CLASS_CODE + "= ?," ); query.append( C_PROD_PROC_SYS_CODE + "= ?," ); query.append( C_PROD_PROC_SYS_SEG_CODE + "= ?," ); query.append( C_PROD_APPRV_DATE + "= ?," ); query.append( C_PROD_OPERN_STA_DATE + "= ?," ); query.append( C_PROD_CSTDY_CNPJ_NBR + "= ?," ); query.append( C_PROD_AUDIT_CNPJ_NBR + "= ?," ); query.append( C_PROD_MGMT_CNPJ_NBR + "= ?," ); query.append( C_PROD_CTL_CNPJ_NBR + "= ?," ); query.append( C_PROD_ADMIN_CNPJ_NBR + "= ?," ); query.append( C_CITI_GRP_TIE_RELTN_PLCY_IND + "= ?," ); query.append( C_CITI_GRP_TIE_RSTRN_PLCY_IND + "= ?," ); //ISIN - Fase 3 query.append( C_PROD_ISIN_CODE + "= ?," ); query.append( C_PROD_INVST_RISK_CODE + "= ?," ); query.append( C_PROD_QLFY_CODE + "= ?," ); query.append( C_PROD_SUB_FAML_CODE + "= ?," ); query.append( C_PROD_LEGAL_CLASS_CODE + "= ?," ); query.append( C_LAST_UPD_USER_ID + "= ?," ); query.append( C_LAST_UPD_DATE + "= ?," ); query.append( C_PROD_ACCT_CODE + " = ?," ); query.append( C_OPERN_CODE + "= ?, " ); query.append( C_ASSET_TYPE_CODE +" = ?, " ); query.append( C_PROD_SENT_IND+ " = ?, " ); query.append( C_PRCLAS_PROD_ASSET_CLASS_CODE+ " = ?, " ); query.append( C_PRCLAS_PROD_STYP_CODE+ " = ?, " ); query.append( C_PRCLAS_PROD_TYPE_CODE+ " = ?, " ); query.append( "PROD_ONESRC_ASSET_CLASS_CODE = ? "); query.append( " WHERE " + C_PROD_CODE + "= ? " ); query.append( " AND " + C_SYS_CODE + "= ? " ); query.append( " AND " + C_SYS_SEG_CODE + "= ? " ); preparedStatement = new CitiStatement(connection.prepareStatement( query.toString() )); TplProductMovEntityVO tplProductMovEntityVO = ( TplProductMovEntityVO ) tplProductMovEntity_.getData(); int count = 1; if ( tplProductMovEntityVO.getProdName() != null && !tplProductMovEntityVO.getProdName().equals( "" ) ) { preparedStatement.setString( count++, tplProductMovEntityVO.getProdName() ); } else { preparedStatement.setString( count++, null ); } if ( tplProductMovEntityVO.getProdText() != null && !tplProductMovEntityVO.getProdText().equals( "" ) ) { preparedStatement.setString( count++, tplProductMovEntityVO.getProdText() ); } else { preparedStatement.setString( count++, null ); } if ( tplProductMovEntityVO.getProdCcyCode() != null && !tplProductMovEntityVO.getProdCcyCode().equals( "" ) ) { preparedStatement.setString( count++, tplProductMovEntityVO.getProdCcyCode() ); } else { preparedStatement.setString( count++, null ); } if ( tplProductMovEntityVO.getProdIsoCode() != null && !tplProductMovEntityVO.getProdIsoCode().equals( "" ) ) { preparedStatement.setString( count++, tplProductMovEntityVO.getProdIsoCode() ); } else { preparedStatement.setString( count++, null ); } if ( tplProductMovEntityVO.getProdAnbidCode() != null && !tplProductMovEntityVO.getProdAnbidCode().equals( "" ) ) { preparedStatement.setString( count++, tplProductMovEntityVO.getProdAnbidCode() ); } else { preparedStatement.setString( count++, null ); } if ( tplProductMovEntityVO.getProdCetipCode() != null && !tplProductMovEntityVO.getProdCetipCode().equals( "" ) ) { preparedStatement.setString( count++, tplProductMovEntityVO.getProdCetipCode() ); } else { preparedStatement.setString( count++, null ); } if ( tplProductMovEntityVO.getProdSelicCode() != null && !tplProductMovEntityVO.getProdSelicCode().equals( "" ) ) { preparedStatement.setString( count++, tplProductMovEntityVO.getProdSelicCode() ); } else { preparedStatement.setString( count++, null ); } if ( tplProductMovEntityVO.getProdBovespaCode() != null && !tplProductMovEntityVO.getProdBovespaCode().equals( "" ) ) { preparedStatement.setString( count++, tplProductMovEntityVO.getProdBovespaCode() ); } else { preparedStatement.setString( count++, null ); } if ( tplProductMovEntityVO.getProdBmfCode() != null && !tplProductMovEntityVO.getProdBmfCode().equals( "" ) ) { preparedStatement.setString( count++, tplProductMovEntityVO.getProdBmfCode() ); } else { preparedStatement.setString( count++, null ); } if ( tplProductMovEntityVO.getProdCreateDate() != null && !tplProductMovEntityVO.getProdCreateDate().equals( "" ) ) { preparedStatement.setTimestamp( count++, new Timestamp( tplProductMovEntityVO.getProdCreateDate().getTime() ) ); } else { preparedStatement.setTimestamp( count++, null ); } if ( tplProductMovEntityVO.getProdStatCode() != null && !tplProductMovEntityVO.getProdStatCode().equals( "" ) ) { preparedStatement.setString( count++, tplProductMovEntityVO.getProdStatCode() ); } else { preparedStatement.setString( count++, null ); } if ( tplProductMovEntityVO.getPrvtProdAggrCode() != null && !tplProductMovEntityVO.getPrvtProdAggrCode().equals( "" ) ) { preparedStatement.setString( count++, tplProductMovEntityVO.getPrvtProdAggrCode() ); } else { preparedStatement.setString( count++, null ); } if ( tplProductMovEntityVO.getProdCrTypeClassCode() != null && !tplProductMovEntityVO.getProdCrTypeClassCode().equals( "" ) ) { preparedStatement.setString( count++, tplProductMovEntityVO.getProdCrTypeClassCode() ); } else { preparedStatement.setString( count++, null ); } if ( tplProductMovEntityVO.getProdProcSysCode() != null && !tplProductMovEntityVO.getProdProcSysCode().equals( "" ) ) { preparedStatement.setString( count++, tplProductMovEntityVO.getProdProcSysCode() ); } else { preparedStatement.setString( count++, null ); } if ( tplProductMovEntityVO.getProdProcSysSegCode() != null && !tplProductMovEntityVO.getProdProcSysSegCode().equals( "" ) ) { preparedStatement.setLong( count++, tplProductMovEntityVO.getProdProcSysSegCode().longValue() ); } else { preparedStatement.setString( count++, null ); } if ( tplProductMovEntityVO.getProdApprvDate() != null && !tplProductMovEntityVO.getProdApprvDate().equals( "" ) ) { preparedStatement.setTimestamp( count++, new Timestamp( tplProductMovEntityVO.getProdApprvDate().getTime() ) ); } else { preparedStatement.setTimestamp( count++, null ); } if ( tplProductMovEntityVO.getProdOpernStaDate() != null && !tplProductMovEntityVO.getProdOpernStaDate().equals( "" ) ) { preparedStatement.setTimestamp( count++, new Timestamp( tplProductMovEntityVO.getProdOpernStaDate().getTime() ) ); } else { preparedStatement.setTimestamp( count++, null ); } if ( tplProductMovEntityVO.getProdCstdyCnpjNbr() != null && !tplProductMovEntityVO.getProdCstdyCnpjNbr().equals( "" ) ) { preparedStatement.setString( count++, tplProductMovEntityVO.getProdCstdyCnpjNbr() ); } else { preparedStatement.setString( count++, null ); } if ( tplProductMovEntityVO.getProdAuditCnpjNbr() != null && !tplProductMovEntityVO.getProdAuditCnpjNbr().equals( "" ) ) { preparedStatement.setString( count++, tplProductMovEntityVO.getProdAuditCnpjNbr() ); } else { preparedStatement.setString( count++, null ); } if ( tplProductMovEntityVO.getProdMgmtCnpjNbr() != null && !tplProductMovEntityVO.getProdMgmtCnpjNbr().equals( "" ) ) { preparedStatement.setString( count++, tplProductMovEntityVO.getProdMgmtCnpjNbr() ); } else { preparedStatement.setString( count++, null ); } if ( tplProductMovEntityVO.getProdCtlCnpjNbr() != null && !tplProductMovEntityVO.getProdCtlCnpjNbr().equals( "" ) ) { preparedStatement.setString( count++, tplProductMovEntityVO.getProdCtlCnpjNbr() ); } else { preparedStatement.setString( count++, null ); } if ( tplProductMovEntityVO.getProdAdminCnpjNbr() != null && !tplProductMovEntityVO.getProdAdminCnpjNbr().equals( "" ) ) { preparedStatement.setString( count++, tplProductMovEntityVO.getProdAdminCnpjNbr() ); } else { preparedStatement.setString( count++, null ); } if ( tplProductMovEntityVO.getCitiGrpTieReltnPlcyInd() != null && !tplProductMovEntityVO.getCitiGrpTieReltnPlcyInd().equals( "" ) ) { preparedStatement.setString( count++, tplProductMovEntityVO.getCitiGrpTieReltnPlcyInd() ); } else { preparedStatement.setString( count++, null ); } if ( tplProductMovEntityVO.getCitiGrpTieRstrnPlcyInd() != null && !tplProductMovEntityVO.getCitiGrpTieRstrnPlcyInd().equals( "" ) ) { preparedStatement.setString( count++, tplProductMovEntityVO.getCitiGrpTieRstrnPlcyInd() ); } else { preparedStatement.setString( count++, null ); } //ISIN - Fase 3 if ( tplProductMovEntityVO.getProdIsinCode() != null && !tplProductMovEntityVO.getProdIsinCode().equals( "" ) ) { preparedStatement.setString( count++, tplProductMovEntityVO.getProdIsinCode() ); } else { preparedStatement.setString( count++, null ); } if ( tplProductMovEntityVO.getProdRiskCatCode() != null && !tplProductMovEntityVO.getProdRiskCatCode().equals( "" ) ) { preparedStatement.setLong( count++, tplProductMovEntityVO.getProdRiskCatCode().longValue() ); } else { preparedStatement.setString( count++, null ); } if ( tplProductMovEntityVO.getProdQlfyCode() != null && !tplProductMovEntityVO.getProdQlfyCode().equals( "" ) ) { preparedStatement.setLong( count++, tplProductMovEntityVO.getProdQlfyCode().longValue() ); } else { preparedStatement.setString( count++, null ); } if ( tplProductMovEntityVO.getProdSubFamlCode() != null && !tplProductMovEntityVO.getProdSubFamlCode().equals( "" ) ) { preparedStatement.setLong( count++, tplProductMovEntityVO.getProdSubFamlCode().longValue() ); } else { preparedStatement.setString( count++, null ); } if ( tplProductMovEntityVO.getProdLegalClassCode() != null && !tplProductMovEntityVO.getProdLegalClassCode().equals( "" ) ) { preparedStatement.setString( count++, tplProductMovEntityVO.getProdLegalClassCode() ); } else { preparedStatement.setString( count++, null ); } if ( tplProductMovEntityVO.getLastUpdUserId() != null && !tplProductMovEntityVO.getLastUpdUserId().equals( "" ) ) { preparedStatement.setString( count++, tplProductMovEntityVO.getLastUpdUserId() ); } else { throw new UnexpectedException( C_ERROR_EXECUTING_STATEMENT, null ); } if ( tplProductMovEntityVO.getLastUpdDate() != null && !tplProductMovEntityVO.getLastUpdDate().equals( "" ) ) { preparedStatement.setTimestamp( count++, new Timestamp( tplProductMovEntityVO.getLastUpdDate().getTime() ) ); } else { throw new UnexpectedException( C_ERROR_EXECUTING_STATEMENT, null ); } if ( tplProductMovEntityVO.getProdAcctCode() != null && !tplProductMovEntityVO.getProdAcctCode().equals( "" ) ) { preparedStatement.setString( count++, tplProductMovEntityVO.getProdAcctCode() ); } else { preparedStatement.setString( count++, null ); } if ( tplProductMovEntityVO.getOpernCode() != null && !tplProductMovEntityVO.getOpernCode().equals( "" ) ) { preparedStatement.setString( count++, tplProductMovEntityVO.getOpernCode() ); } else { throw new UnexpectedException( C_ERROR_EXECUTING_STATEMENT, null ); } if ( tplProductMovEntityVO.getAssetTypeCode() != null && !tplProductMovEntityVO.getAssetTypeCode().equals( "" ) ) { preparedStatement.setLong( count++, tplProductMovEntityVO.getAssetTypeCode().longValue() ); }else { preparedStatement.setString( count++, null ); } //Novos campos Fase2 if ( tplProductMovEntityVO.getProdSentIaInd() != null ) { preparedStatement.setString( count++, tplProductMovEntityVO.getProdSentIaInd() ); } else { preparedStatement.setString( count++, null ); } if ( tplProductMovEntityVO.getPrclasProdAssetClassCode() != null && !tplProductMovEntityVO.getPrclasProdAssetClassCode().trim().equals("")) { preparedStatement.setLong( count++, new BigInteger(tplProductMovEntityVO.getPrclasProdAssetClassCode()).longValue() ); } else { preparedStatement.setString( count++, null ); } if ( tplProductMovEntityVO.getPrclasProdStypCode() != null && !tplProductMovEntityVO.getPrclasProdStypCode().trim().equals("")) { preparedStatement.setLong( count++, new BigInteger(tplProductMovEntityVO.getPrclasProdStypCode()).longValue()); } else { preparedStatement.setString( count++, null ); } if (tplProductMovEntityVO.getPrclasProdTypeCode() != null && !tplProductMovEntityVO.getPrclasProdTypeCode().trim().equals("")) { preparedStatement.setLong( count++, new BigInteger(tplProductMovEntityVO.getPrclasProdTypeCode()).longValue()); } else { preparedStatement.setString( count++, null ); } //Classificacao do produto no Onesource if (tplProductMovEntityVO.getAssetClassOnesrc() != null && !tplProductMovEntityVO.getAssetClassOnesrc().trim().equals("")) { preparedStatement.setString( count++, tplProductMovEntityVO.getAssetClassOnesrc()); } else { preparedStatement.setString( count++, null ); } //where if ( tplProductMovEntityVO.getProdCode() != null && !tplProductMovEntityVO.getProdCode().equals( "" ) ) { preparedStatement.setString( count++, tplProductMovEntityVO.getProdCode() ); } else { throw new UnexpectedException( C_ERROR_EXECUTING_STATEMENT, null ); } if ( tplProductMovEntityVO.getSysCode() != null && !tplProductMovEntityVO.getSysCode().equals( "" ) ) { preparedStatement.setString( count++, tplProductMovEntityVO.getSysCode() ); } else { throw new UnexpectedException( C_ERROR_EXECUTING_STATEMENT, null ); } if ( tplProductMovEntityVO.getSysSegCode() != null && !tplProductMovEntityVO.getSysSegCode().equals( "" ) ) { preparedStatement.setLong( count++, tplProductMovEntityVO.getSysSegCode().longValue() ); } else { throw new UnexpectedException( C_ERROR_EXECUTING_STATEMENT, null ); } preparedStatement.executeUpdate(); preparedStatement.replaceParametersInQuery(query.toString()); return tplProductMovEntity_; } catch ( SQLException e ) { throw new UnexpectedException( e.getErrorCode(), C_ERROR_EXECUTING_STATEMENT, e ); } finally { closeStatement( preparedStatement ); closeConnection( connection ); } } /** * Remove um registro Logicamente com base nas chaves fornecidas * @see com.citibank.ods.persistence.pl.dao.TplProductDAO#delete(java.math.BigInteger) */ public TplProductMovEntity delete( TplProductMovEntity tplProductMovEntity_ ) throws UnexpectedException { ManagedRdbConnection connection = null; CitiStatement preparedStatement = null; StringBuffer query = new StringBuffer(); try { connection = OracleODSDAOFactory.getConnection(); query.append( "DELETE FROM " ); query.append( C_TPL_PRODUCT_MOV ); query.append( " WHERE " ); query.append( C_PROD_CODE + " = ?" ); query.append( " AND " + C_SYS_CODE + " = ?" ); query.append( " AND " + C_SYS_SEG_CODE + " = ?" ); preparedStatement = new CitiStatement(connection.prepareStatement( query.toString() )); int count = 1; preparedStatement.setString( count++, tplProductMovEntity_.getData().getProdCode() ); preparedStatement.setString( count++, tplProductMovEntity_.getData().getSysCode() ); preparedStatement.setLong( count++, tplProductMovEntity_.getData().getSysSegCode().longValue() ); preparedStatement.executeUpdate(); preparedStatement.replaceParametersInQuery(query.toString()); return tplProductMovEntity_; } catch ( SQLException e ) { throw new UnexpectedException( e.getErrorCode(), C_ERROR_EXECUTING_STATEMENT, e ); } finally { closeStatement( preparedStatement ); closeConnection( connection ); } } /** * Lista os produtos de acordo com os argumentos informados * @see com.citibank.ods.persistence.pl.dao.TplProductDAO#list(java.lang.String, * java.lang.String, java.lang.String, java.math.BigInteger, * java.math.BigInteger, java.math.BigInteger) */ public DataSet list( String prodCode_, BigInteger prodFamlCode_, String prodName_, BigInteger prodQlfyCode_, BigInteger prodRiskCatCode_, BigInteger prodSubFamlCode_, String lastUpdUserId_ ) { ManagedRdbConnection connection = null; CitiStatement preparedStatement = null; ResultSet resultSet = null; ResultSetDataSet rsds = null; StringBuffer query = new StringBuffer(); try { connection = OracleODSDAOFactory.getConnection(); query.append( "SELECT " ); query.append( ALIAS_PRODUCT + "." + C_PROD_CODE + ", " ); query.append( ALIAS_PRODUCT + "." + C_SYS_CODE + ", " ); query.append( ALIAS_PRODUCT + "." + C_SYS_SEG_CODE + ", " ); query.append( ALIAS_PRODUCT + "." + C_PROD_NAME + ", " ); query.append( ALIAS_PRODUCT + "." + C_PROD_TEXT + ", " ); query.append( ALIAS_PRODUCT + "." + C_PROD_FAML_CODE + ", " ); query.append( ALIAS_PRODUCT + "." + C_PROD_CCY_CODE + ", " ); query.append( ALIAS_PRODUCT + "." + C_PROD_ISO_CODE + ", " ); query.append( ALIAS_PRODUCT + "." + C_PROD_ANBID_CODE + ", " ); query.append( ALIAS_PRODUCT + "." + C_PROD_CETIP_CODE + ", " ); query.append( ALIAS_PRODUCT + "." + C_PROD_SELIC_CODE + ", " ); query.append( ALIAS_PRODUCT + "." + C_PROD_BOVESPA_CODE + ", " ); query.append( ALIAS_PRODUCT + "." + C_PROD_BMF_CODE + ", " ); query.append( ALIAS_PRODUCT + "." + C_PROD_CREATE_DATE + ", " ); query.append( ALIAS_PRODUCT + "." + C_PROD_STAT_CODE + ", " ); query.append( ALIAS_PRODUCT + "." + C_PRVT_PROD_AGGR_CODE + ", " ); query.append( ALIAS_PRODUCT + "." + C_PROD_CR_TYPE_CLASS_CODE + ", " ); query.append( ALIAS_PRODUCT + "." + C_PROD_PROC_SYS_CODE + ", " ); query.append( ALIAS_PRODUCT + "." + C_PROD_PROC_SYS_SEG_CODE + ", " ); query.append( ALIAS_PRODUCT + "." + C_PROD_APPRV_DATE + ", " ); query.append( ALIAS_PRODUCT + "." + C_PROD_OPERN_STA_DATE + ", " ); query.append( ALIAS_PRODUCT + "." + C_PROD_CSTDY_CNPJ_NBR + ", " ); query.append( ALIAS_PRODUCT + "." + C_PROD_AUDIT_CNPJ_NBR + ", " ); query.append( ALIAS_PRODUCT + "." + C_PROD_MGMT_CNPJ_NBR + ", " ); query.append( ALIAS_PRODUCT + "." + C_PROD_CTL_CNPJ_NBR + ", " ); query.append( ALIAS_PRODUCT + "." + C_PROD_ADMIN_CNPJ_NBR + ", " ); query.append( ALIAS_PRODUCT + "." + C_CITI_GRP_TIE_RELTN_PLCY_IND + ", " ); query.append( ALIAS_PRODUCT + "." + C_CITI_GRP_TIE_RSTRN_PLCY_IND + ", " ); query.append( ALIAS_PRODUCT + "." + C_PROD_ISIN_CODE + ", " ); query.append( ALIAS_PRODUCT + "." + C_PROD_INVST_RISK_CODE + ", " ); query.append( ALIAS_PRODUCT + "." + C_PROD_QLFY_CODE + ", " ); query.append( ALIAS_PRODUCT + "." + C_PROD_SUB_FAML_CODE + ", " ); query.append( ALIAS_PRODUCT + "." + C_PROD_LEGAL_CLASS_CODE + ", " ); query.append( ALIAS_PROD_SUB_FAML + "." + C_PROD_SUB_FAML_NAME + ", " ); query.append( ALIAS_PROD_FAML + "." + C_PROD_FAML_NAME + ", " ); query.append( ALIAS_PRODUCT + "." + C_LAST_UPD_USER_ID + ", " ); query.append( ALIAS_PRODUCT + "." + C_OPERN_CODE + ", " ); query.append( ALIAS_PRODUCT + "." + C_LAST_UPD_DATE + " FROM " ); query.append( C_TPL_PRODUCT_MOV + " " + ALIAS_PRODUCT + "," + C_TPL_PROD_SUB_FAML + " " + ALIAS_PROD_SUB_FAML + "," + C_TPL_PROD_FAML + " " + ALIAS_PROD_FAML ); String criteria = ALIAS_PRODUCT + "." + C_PROD_SUB_FAML_CODE + "=" + ALIAS_PROD_SUB_FAML + "." + C_PROD_SUB_FAML_CODE + " (+) AND " + ALIAS_PROD_SUB_FAML + "." + C_PROD_FAML_CODE + "=" + ALIAS_PROD_FAML + "." + C_PROD_FAML_CODE + " (+) AND "; if ( prodCode_ != null && !prodCode_.equals( "" ) ) { criteria = criteria + "UPPER(TRIM(" + C_PROD_CODE + ")) = ? AND "; } if ( prodFamlCode_ != null && !prodFamlCode_.equals( "" ) ) { criteria = criteria + ALIAS_PROD_FAML + "." + C_PROD_FAML_CODE + " = ? AND "; } if ( prodQlfyCode_ != null && !prodQlfyCode_.equals( "" ) ) { criteria = criteria + "UPPER(TRIM(" + C_PROD_QLFY_CODE + ")) = ? AND "; } if ( prodRiskCatCode_ != null && !prodRiskCatCode_.equals( "" ) ) { criteria = criteria + "UPPER(TRIM(" + C_PROD_INVST_RISK_CODE + ")) = ? AND "; } if ( prodSubFamlCode_ != null && !prodSubFamlCode_.equals( "" ) ) { criteria = criteria + "UPPER(TRIM(" + ALIAS_PRODUCT + "." + C_PROD_SUB_FAML_CODE + ")) = ? AND "; } if ( lastUpdUserId_ != null && !lastUpdUserId_.equals( "" ) ) { criteria = criteria + "UPPER(TRIM(" + ALIAS_PRODUCT + "." + C_LAST_UPD_USER_ID + ")) LIKE ? AND "; } if ( criteria.length() > 0 ) { criteria = criteria.substring( 0, criteria.length() - 5 ); query.append( " WHERE " + criteria ); } preparedStatement = new CitiStatement(connection.prepareStatement( query.toString() )); int count = 1; if ( prodCode_ != null && !prodCode_.equals( "" ) ) { preparedStatement.setString( count++, prodCode_ ); } if ( prodFamlCode_ != null && !prodFamlCode_.equals( "" ) ) { preparedStatement.setLong( count++, prodFamlCode_.intValue() ); } if ( prodQlfyCode_ != null ) { preparedStatement.setLong( count++, prodQlfyCode_.longValue() ); } if ( prodRiskCatCode_ != null ) { preparedStatement.setLong( count++, prodRiskCatCode_.longValue() ); } if ( prodSubFamlCode_ != null ) { preparedStatement.setLong( count++, prodSubFamlCode_.longValue() ); } if ( lastUpdUserId_ != null && !lastUpdUserId_.equals( "" ) ) { preparedStatement.setString( count++, "%" + lastUpdUserId_.toUpperCase() + "%" ); } resultSet = preparedStatement.executeQuery(); preparedStatement.replaceParametersInQuery(query.toString()); rsds = new ResultSetDataSet( resultSet ); resultSet.close(); } catch ( SQLException e ) { throw new UnexpectedException( e.getErrorCode(), C_ERROR_EXECUTING_STATEMENT, e ); } finally { closeStatement( preparedStatement ); closeConnection( connection ); } String[] codeColumn = { C_OPERN_CODE }; String[] nameColumn = { C_OPERN_TEXT }; rsds.outerJoin( ODSConstraintDecoder.decodeOpern(), codeColumn, codeColumn, nameColumn ); return rsds; } /** * Este metodo busca um produto com base nos criterios informados * @see com.citibank.ods.persistence.pl.dao.BaseTplProductDAO#find(com.citibank.ods.entity.pl.BaseTplProductEntity) */ public BaseTplProductEntity find( BaseTplProductEntity tplProductEntity_ ) { ManagedRdbConnection connection = null; CitiStatement preparedStatement = null; ResultSet resultSet = null; ResultSetDataSet rsds = null; StringBuffer query = new StringBuffer(); ArrayList tplProductEntities; TplProductMovEntity tplProductEntity = null; try { connection = OracleODSDAOFactory.getConnection(); query.append( "SELECT " ); query.append( ALIAS_PRODUCT + "." + C_PROD_CODE + ", " ); query.append( ALIAS_PRODUCT + "." + C_SYS_CODE + ", " ); query.append( ALIAS_PRODUCT + "." + C_SYS_SEG_CODE + ", " ); query.append( ALIAS_PRODUCT + "." + C_PROD_NAME + ", " ); query.append( ALIAS_PRODUCT + "." + C_PROD_TEXT + ", " ); query.append( ALIAS_PRODUCT + "." + C_PROD_FAML_CODE + ", " ); query.append( ALIAS_PRODUCT + "." + C_PROD_CCY_CODE + ", " ); query.append( ALIAS_PRODUCT + "." + C_PROD_ISO_CODE + ", " ); query.append( ALIAS_PRODUCT + "." + C_PROD_ANBID_CODE + ", " ); query.append( ALIAS_PRODUCT + "." + C_PROD_CETIP_CODE + ", " ); query.append( ALIAS_PRODUCT + "." + C_PROD_SELIC_CODE + ", " ); query.append( ALIAS_PRODUCT + "." + C_PROD_BOVESPA_CODE + ", " ); query.append( ALIAS_PRODUCT + "." + C_PROD_BMF_CODE + ", " ); query.append( ALIAS_PRODUCT + "." + C_PROD_CREATE_DATE + ", " ); query.append( ALIAS_PRODUCT + "." + C_PROD_STAT_CODE + ", " ); query.append( ALIAS_PRODUCT + "." + C_PRVT_PROD_AGGR_CODE + ", " ); query.append( ALIAS_PRODUCT + "." + C_PROD_CR_TYPE_CLASS_CODE + ", " ); query.append( ALIAS_PRODUCT + "." + C_PROD_PROC_SYS_CODE + ", " ); query.append( ALIAS_PRODUCT + "." + C_PROD_PROC_SYS_SEG_CODE + ", " ); query.append( ALIAS_PRODUCT + "." + C_PROD_APPRV_DATE + ", " ); query.append( ALIAS_PRODUCT + "." + C_PROD_OPERN_STA_DATE + ", " ); query.append( ALIAS_PRODUCT + "." + C_PROD_CSTDY_CNPJ_NBR + ", " ); query.append( ALIAS_PRODUCT + "." + C_PROD_AUDIT_CNPJ_NBR + ", " ); query.append( ALIAS_PRODUCT + "." + C_PROD_MGMT_CNPJ_NBR + ", " ); query.append( ALIAS_PRODUCT + "." + C_PROD_CTL_CNPJ_NBR + ", " ); query.append( ALIAS_PRODUCT + "." + C_PROD_ADMIN_CNPJ_NBR + ", " ); query.append( ALIAS_PRODUCT + "." + C_CITI_GRP_TIE_RELTN_PLCY_IND + ", " ); query.append( ALIAS_PRODUCT + "." + C_CITI_GRP_TIE_RSTRN_PLCY_IND + ", " ); //ISIN - Fase 3 query.append( ALIAS_PRODUCT + "." + C_PROD_ISIN_CODE + ", " ); query.append( ALIAS_PRODUCT + "." + C_PROD_INVST_RISK_CODE + ", " ); query.append( ALIAS_PRODUCT + "." + C_PROD_QLFY_CODE + ", " ); query.append( ALIAS_PRODUCT + "." + C_PROD_SUB_FAML_CODE + ", " ); query.append( ALIAS_PRODUCT + "." + C_PROD_LEGAL_CLASS_CODE + ", " ); query.append( ALIAS_PROD_SUB_FAML + "." + C_PROD_SUB_FAML_NAME + ", " ); query.append( ALIAS_PROD_FAML + "." + C_PROD_FAML_NAME + ", " ); query.append( ALIAS_PRODUCT + "." + C_LAST_UPD_USER_ID + ", " ); query.append( ALIAS_PRODUCT + "." + C_OPERN_CODE + ", " ); query.append( ALIAS_PRODUCT + "." + C_PROD_ACCT_CODE + ", " ); query.append( "PROD.ASSET_TYPE_CODE , " ); query.append( ALIAS_PRODUCT + "." + C_LAST_UPD_DATE + ", " ); //Fase 3 query.append( ALIAS_PRODUCT + "." + C_PROD_ISIN_CODE + ", " ); query.append( ALIAS_PRODUCT + "." + C_PROD_SENT_IND + ", " ); query.append( ALIAS_PRODUCT + "." + C_PRCLAS_PROD_ASSET_CLASS_CODE + ", " ); query.append( ALIAS_PRODUCT + "." + C_PRCLAS_PROD_STYP_CODE + ", " ); query.append( ALIAS_PRODUCT + "." + C_PRCLAS_PROD_TYPE_CODE + ", "); //Classificacao do produto no onesource query.append( ALIAS_PRODUCT + ".PROD_ONESRC_ASSET_CLASS_CODE "); query.append(" FROM " ); query.append( C_TPL_PRODUCT_MOV + " " + ALIAS_PRODUCT + "," + C_TPL_PROD_SUB_FAML + " " + ALIAS_PROD_SUB_FAML + "," + C_TPL_PROD_FAML + " " + ALIAS_PROD_FAML ); String criteria = ALIAS_PRODUCT + "." + C_PROD_SUB_FAML_CODE + "=" + ALIAS_PROD_SUB_FAML + "." + C_PROD_SUB_FAML_CODE + " (+) AND " + ALIAS_PROD_SUB_FAML + "." + C_PROD_FAML_CODE + "=" + ALIAS_PROD_FAML + "." + C_PROD_FAML_CODE + " (+) AND "; TplProductMovEntityVO tplProductMovEntityVO = ( TplProductMovEntityVO ) tplProductEntity_.getData(); if ( tplProductMovEntityVO.getProdCode() != null && !tplProductMovEntityVO.getProdCode().equals( "" ) ) { criteria = criteria + "UPPER(TRIM(" + C_PROD_CODE + ")) = ? AND "; } if ( tplProductMovEntityVO.getSysCode() != null && !tplProductMovEntityVO.getSysCode().equals( "" ) ) { criteria = criteria + C_SYS_CODE + " = ? AND "; } if ( tplProductMovEntityVO.getSysSegCode() != null && !tplProductMovEntityVO.getSysSegCode().equals( "" ) ) { criteria = criteria + C_SYS_SEG_CODE + " = ? AND "; } if ( criteria.length() > 0 ) { criteria = criteria.substring( 0, criteria.length() - 5 ); query.append( " WHERE " + criteria ); } preparedStatement = new CitiStatement(connection.prepareStatement( query.toString() )); int count = 1; if ( tplProductMovEntityVO.getProdCode() != null && !tplProductMovEntityVO.getProdCode().equals( "" ) ) { preparedStatement.setString( count++, tplProductMovEntityVO.getProdCode().toUpperCase().trim() ); } if ( tplProductMovEntityVO.getSysCode() != null && !tplProductMovEntityVO.getSysCode().equals( "" ) ) { preparedStatement.setString( count++, tplProductMovEntityVO.getSysCode() ); } if ( tplProductMovEntityVO.getSysSegCode() != null && tplProductMovEntityVO.getSysSegCode().longValue() != 0 ) { preparedStatement.setLong( count++, tplProductMovEntityVO.getSysSegCode().longValue() ); } resultSet = preparedStatement.executeQuery(); preparedStatement.replaceParametersInQuery(query.toString()); tplProductEntities = instantiateFromResultSet( resultSet ); if ( tplProductEntities.size() == 0 ) { throw new NoRowsReturnedException(); } else if ( tplProductEntities.size() > 1 ) { throw new UnexpectedException( C_ERROR_TOO_MANY_ROWS_RETURNED ); } else { tplProductEntity = ( TplProductMovEntity ) tplProductEntities.get( 0 ); } return tplProductEntity; } catch ( SQLException e ) { throw new UnexpectedException( e.getErrorCode(), C_ERROR_EXECUTING_STATEMENT, e ); } finally { closeStatement( preparedStatement ); closeConnection( connection ); } } // public BaseTplProductEntity find( BaseTplProductEntity tplProductMovEntity_ // ) // throws UnexpectedException // // { // ManagedRdbConnection connection = null; // CitiStatement preparedStatement = null; // ResultSet resultSet = null; // StringBuffer query = new StringBuffer(); // ArrayList tplProductMovEntities; // BaseTplProductEntity tplProductEntity = null; // // try // { // connection = OracleODSDAOFactory.getConnection(); // query.append( "SELECT " ); // query.append( C_PROD_CODE + ", " ); // query.append( C_SYS_CODE + ", " ); // query.append( C_SYS_SEG_CODE + ", " ); // query.append( C_PROD_NAME + ", " ); // query.append( C_PROD_TEXT + ", " ); // query.append( C_PROD_FAML_CODE + ", " ); // query.append( C_PROD_CCY_CODE + ", " ); // query.append( C_PROD_ISO_CODE + ", " ); // query.append( C_PROD_ANBID_CODE + ", " ); // query.append( C_PROD_CETIP_CODE + ", " ); // query.append( C_PROD_SELIC_CODE + ", " ); // query.append( C_PROD_BOVESPA_CODE + ", " ); // query.append( C_PROD_BMF_CODE + ", " ); // query.append( C_PROD_CREATE_DATE + ", " ); // query.append( C_PROD_STAT_CODE + ", " ); // query.append( C_PRVT_PROD_AGGR_CODE + ", " ); // query.append( C_PROD_CR_TYPE_CLASS_CODE + ", " ); // query.append( C_PROD_PROC_SYS_CODE + ", " ); // query.append( C_PROD_PROC_SYS_SEG_CODE + ", " ); // query.append( C_PROD_APPRV_DATE + ", " ); // query.append( C_PROD_OPERN_STA_DATE + ", " ); // query.append( C_PROD_CSTDY_CNPJ_NBR + ", " ); // query.append( C_PROD_AUDIT_CNPJ_NBR + ", " ); // query.append( C_PROD_MGMT_CNPJ_NBR + ", " ); // query.append( C_PROD_CTL_CNPJ_NBR + ", " ); // query.append( C_PROD_ADMIN_CNPJ_NBR + ", " ); // query.append( C_CITI_GRP_TIE_RELTN_PLCY_IND + ", " ); // query.append( C_CITI_GRP_TIE_RSTRN_PLCY_IND + ", " ); // query.append( C_PROD_INVST_RISK_CODE + ", " ); // query.append( C_PROD_QLFY_CODE + ", " ); // query.append( C_PROD_SUB_FAML_CODE + ", " ); // query.append( C_PROD_LEGAL_CLASS_CODE + ", " ); // query.append( C_LAST_UPD_USER_ID + ", " ); // query.append( C_LAST_UPD_DATE + ", " ); // query.append( C_OPERN_CODE ); // query.append( " FROM " + C_TPL_PRODUCT_MOV ); // query.append( " WHERE " ); // query.append( C_PROD_CODE + " = ?" + " AND " ); // query.append( C_SYS_CODE + " = ?" + " AND " ); // query.append( C_SYS_SEG_CODE + " = ?" ); // // preparedStatement = new CitiStatement(connection.prepareStatement( query.toString() )); // int count = 1; // // preparedStatement.setString( count++, // tplProductMovEntity_.getData().getProdCode() ); // // preparedStatement.setString( count++, tplProductMovEntity_.getData().getSysCode() // ); // // preparedStatement.setLong( // count++, // tplProductMovEntity_.getData().getSysSegCode().longValue() ); // // resultSet = preparedStatement.executeQuery(); // // tplProductMovEntities = instantiateFromResultSet( resultSet ); // // if ( tplProductMovEntities.size() == 0 ) // { // throw new NoRowsReturnedException(); // } // else if ( tplProductMovEntities.size() > 1 ) // { // throw new UnexpectedException( C_ERROR_TOO_MANY_ROWS_RETURNED ); // } // else // { // tplProductEntity = ( BaseTplProductEntity ) tplProductMovEntities.get( 0 ); // } // // return tplProductEntity; // } // catch ( SQLException e ) // { // throw new UnexpectedException( C_ERROR_EXECUTING_STATEMENT, e ); // } // } /* * Retorna uma coleção de entities a partir do rs */ private ArrayList instantiateFromResultSet( ResultSet resultSet_ ) { TplProductMovEntity tplProductMovEntity; TplProductMovEntityVO tplProductMovEntityVO; ArrayList tplProductEntities = new ArrayList(); try { while ( resultSet_.next() ) { tplProductMovEntity = new TplProductMovEntity(); tplProductMovEntityVO = ( TplProductMovEntityVO ) tplProductMovEntity.getData(); tplProductMovEntity.getData().setProdCode( resultSet_.getString( C_PROD_CODE ) ); tplProductMovEntity.getData().setSysCode( resultSet_.getString( C_SYS_CODE ) ); if ( resultSet_.getString( C_SYS_SEG_CODE ) != null && !resultSet_.getString( C_SYS_SEG_CODE ).equals( "" ) ) { tplProductMovEntity.getData().setSysSegCode( new BigInteger( resultSet_.getString( C_SYS_SEG_CODE ) ) ); } else { tplProductMovEntity.getData().setSysSegCode( null ); } tplProductMovEntity.getData().setProdName( resultSet_.getString( C_PROD_NAME ) ); tplProductMovEntity.getData().setProdText( resultSet_.getString( C_PROD_TEXT ) ); tplProductMovEntity.getData().setProdFamlCode( resultSet_.getString( C_PROD_FAML_CODE ) ); tplProductMovEntity.getData().setProdCcyCode( resultSet_.getString( C_PROD_CCY_CODE ) ); tplProductMovEntity.getData().setProdIsoCode( resultSet_.getString( C_PROD_ISO_CODE ) ); tplProductMovEntity.getData().setProdAnbidCode( resultSet_.getString( C_PROD_ANBID_CODE ) ); tplProductMovEntity.getData().setProdCetipCode( resultSet_.getString( C_PROD_CETIP_CODE ) ); tplProductMovEntity.getData().setProdSelicCode( resultSet_.getString( C_PROD_SELIC_CODE ) ); tplProductMovEntity.getData().setProdBovespaCode( resultSet_.getString( C_PROD_BOVESPA_CODE ) ); tplProductMovEntity.getData().setProdBmfCode( resultSet_.getString( C_PROD_BMF_CODE ) ); tplProductMovEntity.getData().setProdCreateDate( resultSet_.getDate( C_PROD_CREATE_DATE ) ); tplProductMovEntity.getData().setProdStatCode( resultSet_.getString( C_PROD_STAT_CODE ) ); tplProductMovEntity.getData().setPrvtProdAggrCode( resultSet_.getString( C_PRVT_PROD_AGGR_CODE ) ); tplProductMovEntity.getData().setProdCrTypeClassCode( resultSet_.getString( C_PROD_CR_TYPE_CLASS_CODE ) ); tplProductMovEntity.getData().setProdProcSysCode( resultSet_.getString( C_PROD_PROC_SYS_CODE ) ); if ( resultSet_.getString( C_PROD_PROC_SYS_SEG_CODE ) != null && !resultSet_.getString( C_PROD_PROC_SYS_SEG_CODE ).equals( "" ) ) { tplProductMovEntity.getData().setProdProcSysSegCode( new BigInteger( resultSet_.getString( C_PROD_PROC_SYS_SEG_CODE ) ) ); } else { tplProductMovEntity.getData().setProdProcSysSegCode( null ); } tplProductMovEntity.getData().setProdApprvDate( resultSet_.getTimestamp( C_PROD_APPRV_DATE ) ); tplProductMovEntity.getData().setProdOpernStaDate( resultSet_.getTimestamp( C_PROD_OPERN_STA_DATE ) ); tplProductMovEntity.getData().setProdCstdyCnpjNbr( resultSet_.getString( C_PROD_CSTDY_CNPJ_NBR ) ); tplProductMovEntity.getData().setProdAuditCnpjNbr( resultSet_.getString( C_PROD_AUDIT_CNPJ_NBR ) ); tplProductMovEntity.getData().setProdMgmtCnpjNbr( resultSet_.getString( C_PROD_MGMT_CNPJ_NBR ) ); tplProductMovEntity.getData().setProdCtlCnpjNbr( resultSet_.getString( C_PROD_CTL_CNPJ_NBR ) ); tplProductMovEntity.getData().setProdAdminCnpjNbr( resultSet_.getString( C_PROD_ADMIN_CNPJ_NBR ) ); tplProductMovEntity.getData().setCitiGrpTieReltnPlcyInd( resultSet_.getString( C_CITI_GRP_TIE_RELTN_PLCY_IND ) ); tplProductMovEntity.getData().setCitiGrpTieRstrnPlcyInd( resultSet_.getString( C_CITI_GRP_TIE_RSTRN_PLCY_IND ) ); if ( resultSet_.getString( C_PROD_INVST_RISK_CODE ) != null && !resultSet_.getString( C_PROD_INVST_RISK_CODE ).equals( "" ) ) { tplProductMovEntity.getData().setProdRiskCatCode( new BigInteger( resultSet_.getString( C_PROD_INVST_RISK_CODE ) ) ); } else { tplProductMovEntity.getData().setProdRiskCatCode( null ); } if ( resultSet_.getString( C_PROD_QLFY_CODE ) != null && !resultSet_.getString( C_PROD_QLFY_CODE ).equals( "" ) ) { tplProductMovEntity.getData().setProdQlfyCode( new BigInteger( resultSet_.getString( C_PROD_QLFY_CODE ) ) ); } else { tplProductMovEntity.getData().setProdQlfyCode( null ); } if ( resultSet_.getString( C_PROD_SUB_FAML_CODE ) != null && !resultSet_.getString( C_PROD_SUB_FAML_CODE ).equals( "" ) ) { tplProductMovEntity.getData().setProdSubFamlCode( new BigInteger( resultSet_.getString( C_PROD_SUB_FAML_CODE ) ) ); } else { tplProductMovEntity.getData().setProdSubFamlCode( null ); } tplProductMovEntity.getData().setProdLegalClassCode( resultSet_.getString( C_PROD_LEGAL_CLASS_CODE ) ); tplProductMovEntity.getData().setLastUpdUserId( resultSet_.getString( C_LAST_UPD_USER_ID ) ); tplProductMovEntity.getData().setLastUpdDate( resultSet_.getTimestamp( C_LAST_UPD_DATE ) ); if ( resultSet_.getString( C_PROD_ACCT_CODE ) != null ) { tplProductMovEntity.getData().setProdAcctCode( resultSet_.getString( C_PROD_ACCT_CODE ) ); } else { tplProductMovEntity.getData().setProdAcctCode( null ); } if(resultSet_.getString("ASSET_TYPE_CODE") != null){ tplProductMovEntity.getData().setAssetTypeCode(new BigInteger(resultSet_.getString("ASSET_TYPE_CODE"))); } else{ tplProductMovEntity.getData().setAssetTypeCode(null); } tplProductMovEntityVO.setOpernCode( resultSet_.getString( C_OPERN_CODE ) ); //Novos campos fase2 if (resultSet_.getString(C_PROD_SENT_IND) != null) { tplProductMovEntity.getData().setProdSentIaInd(resultSet_.getString(C_PROD_SENT_IND)); } else { tplProductMovEntity.getData().setProdSentIaInd(null); } //Formato do valor do campo Classificacao Global = 1_2_3 String classGlobalCode = ""; if (resultSet_.getString(C_PRCLAS_PROD_ASSET_CLASS_CODE) != null) { String valor = resultSet_.getString(C_PRCLAS_PROD_ASSET_CLASS_CODE); tplProductMovEntity.getData().setPrclasProdAssetClassCode(valor); classGlobalCode = valor; } else { tplProductMovEntity.getData().setPrclasProdAssetClassCode(null); } if (resultSet_.getString(C_PRCLAS_PROD_STYP_CODE) != null) { String valor = resultSet_.getString(C_PRCLAS_PROD_STYP_CODE); tplProductMovEntity.getData().setPrclasProdStypCode(valor); classGlobalCode = classGlobalCode + "_" + valor; } else { tplProductMovEntity.getData().setPrclasProdStypCode(null); } if (resultSet_.getString(C_PRCLAS_PROD_TYPE_CODE) != null) { String valor = resultSet_.getString(C_PRCLAS_PROD_TYPE_CODE); tplProductMovEntity.getData().setPrclasProdTypeCode(valor); classGlobalCode = classGlobalCode + "_" + valor; } else { tplProductMovEntity.getData().setPrclasProdTypeCode(null); } tplProductMovEntity.getData().setAssocClassProdCode(classGlobalCode); //Novos campos fase 3 if (resultSet_.getString(C_PROD_ISIN_CODE) != null) { tplProductMovEntity.getData().setProdIsinCode(resultSet_.getString(C_PROD_ISIN_CODE)); } else { tplProductMovEntity.getData().setProdIsinCode(null); } tplProductMovEntity.getData().setAssetClassOnesrc(resultSet_.getString("PROD_ONESRC_ASSET_CLASS_CODE")); tplProductEntities.add( tplProductMovEntity ); } } catch ( SQLException e ) { throw new UnexpectedException( e.getErrorCode(), C_ERROR_INSTANTIATE_FROM_RESULT_SET, e ); } return tplProductEntities; } /** * Verifica se existe um registro com o código passado */ public boolean exists( TplProductMovEntity TplProductMovEntity_ ) { boolean exists = true; try { this.find( TplProductMovEntity_ ); } catch ( NoRowsReturnedException exception ) { exists = false; } return exists; } }
package com.zenwerx.findierock.data; import android.content.Context; public class FindieDbHelper { private static FindieDbHelper mInstance = null; private static Object mLock = new Object(); private FindieDbAdapter mDbAdapter = null; private FindieDbHelper() { } public static FindieDbHelper getInstance() { synchronized(mLock) { if (mInstance == null) { mInstance = new FindieDbHelper(); } return mInstance; } } public void setContext(Context context) { /** * I am going to assume, since I'm the only one writing this... nobody will * hold a reference to the db adapter other than this class. Meaning when * I do this, the old instance will be gc'd. */ if (context == null && mDbAdapter != null) { mDbAdapter.close(); } else { mDbAdapter = new FindieDbAdapter(context); mDbAdapter.open(); } } public EventsHelper getEventsHelper() { return mDbAdapter.getEventsHelper(); } public ArtistHelper getArtistHelper() { return mDbAdapter.getArtistHelper(); } public VenueHelper getVenueHelper() { return mDbAdapter.getVenueHelper(); } public StatusHelper getStatusHelper() { return mDbAdapter.getStatusHelper(); } public AlbumHelper getAlbumHelper() { return mDbAdapter.getAlbumHelper(); } public AlbumTrackHelper getAlbumTrackHelper() { return mDbAdapter.getAlbumTrackHelper(); } public FavouriteHelper getFavouriteHelper() { return mDbAdapter.getFavouriteHelper(); } }
package com.bruce.factory.simplefactory.pizzastore.improve.pizza; public class CheesPizza extends Pizza { public void prepare() { System.out.println(name+" : preparing"); } }
package com.application.db.dto; import javax.persistence.Entity; public class Directory { private int id; private int is_active; private String directory; private String searchData; public int getId() { return id; } public void setId(int id) { this.id = id; } public int getIs_active() { return is_active; } public void setIs_active(int is_active) { this.is_active = is_active; } public String getSearchData() { return searchData; } public void setSearchData(String searchData) { this.searchData = searchData; } public String getDirectory() { return directory; } public void setDirectory(String directory) { this.directory = directory; } }
package com.sinodynamic.hkgta.dao.crm; import java.io.Serializable; import java.util.ArrayList; import java.util.List; import org.springframework.stereotype.Repository; import com.sinodynamic.hkgta.dao.GenericDao; import com.sinodynamic.hkgta.entity.crm.CorporateAdditionContact; @Repository public class CorporateAdditionContactDaoImpl extends GenericDao<CorporateAdditionContact> implements CorporateAdditionContactDao { public List<CorporateAdditionContact> getCorporateAdditionContactByCorporateId(Long corporateId){ String hql = " from CorporateAdditionContact contact where contact.corporateId = ? "; List<Serializable> param = new ArrayList<Serializable>(); param.add(corporateId); return getByHql(hql, param); } public CorporateAdditionContact getByContactId(Long contactId){ String hql = " from CorporateAdditionContact contact where contact.contactId = ? "; List<Serializable> param = new ArrayList<Serializable>(); param.add(contactId); return (CorporateAdditionContact) getUniqueByHql(hql, param); } }
package pp; /** * @author alexander.sokolovsky.a@gmail.com */ public interface ModelMergerFactory { }
package edu.harvard.seas.synthesis; import java.io.File; import java.io.IOException; import java.lang.management.ManagementFactory; import java.nio.charset.Charset; import java.util.*; import java.util.ArrayList; import java.util.HashMap; import java.util.HashSet; import java.util.LinkedHashMap; import java.util.List; import edu.harvard.seas.synthesis.sample.*; import org.apache.commons.io.FileUtils; public class ResnaxRunner { public static String resnax_path = "lib"; public static int timeout = 1; // 1 second private String java_class_path; private String z3_lib_path; private String example_file_path = "input"; private String program_file_path = "program"; private String pause_file_path = "pause"; private String stop_file_path = "stop"; private String log_dir_path = "resnax_log" + File.separator; private String temp_dir_path = "resnax_temp" + File.separator; private String log_dir_path2 = "resnax_enumerate" + File.separator; private static ResnaxRunner single_instance = null; public HashMap<String, String> dsl_to_automaton_regex = new HashMap<String, String>(); public Process process = null; public int counter = 0; private HashMap<String, Summary> SemanticCoverageSummary = new HashMap<>(), SyntaxCoverageSummary = new HashMap<>(); private ResnaxRunner() { if(!log_dir_path.endsWith(File.separator)) { log_dir_path += File.separator; } if(!temp_dir_path.endsWith(File.separator)) { temp_dir_path += File.separator; } if(!log_dir_path2.endsWith(File.separator)) { log_dir_path2 += File.separator; } File log_dir = new File(log_dir_path); if(log_dir.exists()) { log_dir.delete(); } log_dir.mkdir(); File temp_dir = new File(temp_dir_path); if(temp_dir.exists()) { temp_dir.delete(); } temp_dir.mkdir(); File log_dir2 = new File(log_dir_path2); if(log_dir2.exists()) { log_dir2.delete(); } log_dir2.mkdir(); // remove temporary files in case the previous synthesis iteration does not terminate normally File f1 = new File(example_file_path); if(f1.exists()) { f1.delete(); } File f2 = new File(program_file_path); if(f2.exists()) { f2.delete(); } File f3 = new File(pause_file_path); if(f3.exists()) { f3.delete(); } File f4 = new File(stop_file_path); if(f4.exists()) { f4.delete(); } // By default z3_lib_path = resnax_path; String os = System.getProperty("os.name").toLowerCase(); String jvmBitVersion = System.getProperty("sun.arch.data.model"); if(os.indexOf("win") >= 0) { if(jvmBitVersion.equals("32")) { z3_lib_path = resnax_path + File.separator + "win32"; } else if(jvmBitVersion.equals("64")) { z3_lib_path = resnax_path + File.separator + "win64"; } } // enumerate all jar files in the classpath java_class_path = resnax_path + File.separator + "resnax.jar" + File.pathSeparator + resnax_path + File.separator + "antlr-4.7.1-complete.jar" + File.pathSeparator + resnax_path + File.separator + "automaton.jar" + File.pathSeparator + resnax_path + File.separator + "com.microsoft.z3.jar" + File.pathSeparator + resnax_path + File.separator + "javatuples-1.2.jar" + File.pathSeparator + resnax_path + File.separator + "libz3java.dylib" + File.pathSeparator + resnax_path + File.separator + "libz3java.so"; } public static ResnaxRunner getInstance() { if(single_instance == null) { single_instance = new ResnaxRunner(); } return single_instance; } public static void reset() { if(single_instance == null) { return; } // kill the current synthesis process if(single_instance.process != null && single_instance.process.isAlive()) { single_instance.process.destroy(); try { Thread.sleep(2000); } catch (InterruptedException e) { e.printStackTrace(); } if(single_instance.process.isAlive()) { single_instance.process.destroyForcibly(); } } // remove the temporary files File f1 = new File(single_instance.example_file_path); f1.delete(); File f2 = new File(single_instance.program_file_path); f2.delete(); File f3 = new File(single_instance.pause_file_path); f3.delete(); File f4 = new File(single_instance.stop_file_path); f4.delete(); // remove log files if any File fError = new File("resnax-error"); if(fError.exists()) { fError.delete(); } File fOutput = new File("resnax-output"); if(fOutput.exists()) { fOutput.delete(); } File fLog1 = new File(single_instance.log_dir_path); fLog1.delete(); File fLog2 = new File(single_instance.log_dir_path2); fLog2.delete(); File fTemp = new File(single_instance.temp_dir_path); fTemp.delete(); single_instance = null; } private String prev_sketch = ""; private String prev_excludes = ""; private String prev_branches_to_priotize = ""; private String prev_branches_to_avoid = ""; private HashSet<String> prev_examples = new HashSet<String>(); public List<String> run(Example[] examples, Regex[] regexes, String branches_to_priotize, String branches_to_avoid) { // reset the previous mapping between DSL regexes and automaton regexes dsl_to_automaton_regex.clear(); // remove any left-over pause or stop files if any File f1 = new File(pause_file_path); if(f1.exists()) { f1.delete(); } File f2 = new File(stop_file_path); if(f2.exists()) { f2.delete(); } // write the input examples to the example file File f = new File(example_file_path); String s = ""; HashSet<String> example_set = new HashSet<String>(); for(Example example : examples) { s += "\"" + example.input + "\"," + (example.output ? "+" : "-") + System.lineSeparator(); example_set.add(example.input + "," + example.output); } s+= System.lineSeparator(); // use a random ground truth, it does not matter, just a requirement by the synthesizer s += "repeatatleast(or(<A>,or(<B>,<C>)),1)"; s += System.lineSeparator(); // parse the annotations to sketches String sketch = parseAnnotationToSketch(examples, regexes); HashSet<String> exclude_set = new HashSet<String>(); for(Regex regex : regexes) { if(regex.exclude.length == 0) continue; for(String exclude : regex.exclude) { exclude_set.add(exclude); } } String excludes = ""; for(String e : exclude_set) { excludes += e + "&&"; } if(!excludes.isEmpty()) { excludes = excludes.substring(0, excludes.length() - 2); } else { excludes = ","; } String must_includes = ""; for(Regex regex : regexes) { if(regex.include.length == 0) continue; for(String must : regex.include) { if(!must_includes.contains(must)) { must_includes += must + "&&"; } } } if(!must_includes.isEmpty()) { must_includes = must_includes.substring(0, must_includes.length() - 2); } else { must_includes = ","; } boolean restart; HashSet<String> copy = new HashSet<String>(prev_examples); copy.removeAll(example_set); if(process == null) { // this is the first iteration counter = 0; restart = true; } else if(!sketch.equals(prev_sketch) || !excludes.equals(prev_excludes) || !branches_to_priotize.equals(prev_branches_to_priotize) || !branches_to_avoid.equals(prev_branches_to_avoid) || !copy.isEmpty()) { // user intent may have changed, redo the synthesis from scratch counter = 0; restart = true; } else if(process != null && !process.isAlive()) { // the synthesis process has crashed due to error such as out of memory // have to restart counter = 0; restart = true; } else { restart = false; } if(restart) { // remove previous log files File log_dir = new File(log_dir_path2); if(log_dir.exists()) { for(File log_file : log_dir.listFiles()) { log_file.delete(); } } // reset the other global variables prev_sketch = ""; prev_excludes = ""; prev_branches_to_priotize = ""; prev_branches_to_avoid = ""; regex_map.clear(); parent_map.clear(); } // set the signal s += "READY-" + counter; try { // write the examples to the example file FileUtils.write(f, s, Charset.defaultCharset(), false); } catch (IOException e) { e.printStackTrace(); } try { invokeResnax(sketch, excludes, must_includes, branches_to_priotize, branches_to_avoid, restart, examples.length); } catch (IOException e1) { e1.printStackTrace(); } catch (InterruptedException e1) { e1.printStackTrace(); } // get the new synthesized programs ArrayList<String> new_regexes = new ArrayList<String>(); try { File log_file = new File(program_file_path); if(log_file.exists()) { List<String> lines = FileUtils.readLines(log_file, Charset.defaultCharset()); for(int i = 0; i < lines.size()-1; i+=2) { String curr_dsl_regex = lines.get(i).trim(); String curr_automaton_regex = lines.get(i+1).trim(); if(!new_regexes.contains(curr_dsl_regex)) { // avoid duplication new_regexes.add(curr_dsl_regex); dsl_to_automaton_regex.put(curr_dsl_regex, curr_automaton_regex); } } if(new_regexes.isEmpty()) { System.err.println("Synthesis timeout. No program is generated."); } log_file.delete(); } else { System.err.println("No resnax log file exists. The synthesizer crashed."); } } catch (IOException e) { e.printStackTrace(); } // check if there is a stop signal File stopFile = new File(stop_file_path); if(stopFile.exists()) { String data; try { data = FileUtils.readFileToString(stopFile, Charset.defaultCharset()); if (data.contains("stop-" + counter)) { // kill the process if(process != null && process.isAlive()) { process.destroy(); } } } catch (IOException e) { e.printStackTrace(); } // delete it after reading stopFile.delete(); } // delete the pause file if it exists File pauseFile = new File(pause_file_path); if(pauseFile.exists()) { pauseFile.delete(); } prev_sketch = sketch; prev_excludes = excludes; prev_branches_to_priotize = branches_to_priotize; prev_branches_to_avoid = branches_to_avoid; prev_examples = example_set; counter++; return new_regexes; } public void invokeResnax(String sketch, String excludes, String must_includes, String branches_to_priotize, String branches_to_avoid, boolean restart, int example_num) throws IOException, InterruptedException { File fError = new File("resnax-error"); if(fError.exists()) { fError.delete(); } File fOutput = new File("resnax-output"); if(fOutput.exists()) { fOutput.delete(); } if(restart) { // check if the process is still alive, if it is , then kill it. if(process != null && process.isAlive()) { process.destroy(); Thread.sleep(2000); if(process.isAlive()) { process.destroyForcibly(); } } int maxMem; try { // This is specific to Oracle JVM long memorySize = ((com.sun.management.OperatingSystemMXBean) ManagementFactory .getOperatingSystemMXBean()).getTotalPhysicalMemorySize(); maxMem = (int) (memorySize / (1024 * 1024 * 1024)); } catch(Exception e) { // catch any exceptions that arise in other JVMs // if any exception occurs, make a conversative choice of only allocating a max of 8G memory maxMem = 8; } String jvmBitVersion = System.getProperty("sun.arch.data.model"); if(jvmBitVersion.equals("32")) { // If the JVM is 32-bit, we can only allocate a max of 4G memory. maxMem = 4; // If it is a Windows system, be more conservative and only allocate 1G memory String os = System.getProperty("os.name").toLowerCase(); if(os.indexOf("win") >= 0) { maxMem = 1; } } // invoke resnax in a separate thread and set a timeout String[] cmd = {"java", "-Xmx" + maxMem + "G", "-Djava.library.path=" + z3_lib_path, "-cp", java_class_path, "-ea", "MRGA.Main", //"resnax.Main", "0", // dataset : 0 - so, 1 - deepregex, 2 - kb13 example_file_path, // file path to the input-output examples log_dir_path, // path to the log directory sketch, "1", "2", // mode : 1 - normal, 2 - prune, 3 - forgot, 4 - pure-enumeration, 5 - example-only "0", // extended mode, what is this? temp_dir_path, "5", excludes, example_file_path, program_file_path, timeout * 1000 + "", must_includes, branches_to_priotize, branches_to_avoid}; ProcessBuilder processBuilder = new ProcessBuilder(cmd); processBuilder.redirectError(fError); processBuilder.redirectOutput(fOutput); process = processBuilder.start(); } ArrayList<Heartbeat> prev_arr = new ArrayList<Heartbeat>(); while(true) { // read the log file File log_file = new File(log_dir_path2 + counter); if(log_file.exists()) { ArrayList<Heartbeat> arr = LogFileUtils.readLogFileToHeartbeat(log_file, dsl_to_automaton_regex); if(prev_arr.size() != arr.size() && arr.size() > prev_arr.size()) { List<Heartbeat> sublist = arr.subList(prev_arr.size(), arr.size()); // sample if the array size is too large if(sublist.size() > 100) { int counter = 0; List<Heartbeat> new_subList = new ArrayList<Heartbeat>(); for(int i = 0; i < sublist.size(); i++) { Heartbeat ht = sublist.get(i); double ratio = ((double) ht.example_num) / example_num; if(ratio > 0.7) { // a regex that satisfies at least 70% of user-given examples // keep it as it may be useful new_subList.add(ht); } else { // only sample one of three regexes if(counter % 5 == 0) { new_subList.add(ht); } counter++; } } sublist = new_subList; // comment out the ineffective old sampling method // // sample 10% of programs if more than 10 programs have unchanged number of satisfied examples // // in a row // int unchanged_len = 0; // int prev = arr.get(0).example_num; // for(int i = 0; i < sublist.size(); i++) { // int x = arr.get(i).example_num; // if(x != prev) { // if(unchanged_len > 10) { // // only pick 1% of these unchanged data points // for(int j = i-unchanged_len; j < i; j=j+10) { // new_subList.add(sublist.get(j)); // } // } else { // // add the previous unchanged data points // new_subList.addAll(sublist.subList(i-unchanged_len, i)); // } // // unchanged_len = 1; // } else { // unchanged_len++; // } // // prev = x; // } // // sublist = new_subList; } // only send this array to the front end to update the chart // when new data has been logged SynthesisServerHandler.sendObjectAsJSONMessage(sublist, "heartbeat"); prev_arr = arr; } } // wait till the signal is there File f = new File(program_file_path); if(f.exists()) { String data = FileUtils.readFileToString(f, Charset.defaultCharset()); if (data.contains("READY-" + counter)) { break; } } if (fError.exists()) { String errorMessage = FileUtils.readFileToString(fError, Charset.defaultCharset()); if(!errorMessage.trim().isEmpty() && errorMessage.contains("Exception in thread")) { // an error occurs if(fOutput.exists()) { System.out.println(FileUtils.readFileToString(fOutput, Charset.defaultCharset())); fOutput.delete(); } System.out.println("Error occurs during program synthesis"); System.out.println(errorMessage); fError.delete(); return; } } // sleep 1 seconds Thread.sleep(1000); } if(fError.exists()) { System.out.println(FileUtils.readFileToString(fError, Charset.defaultCharset())); fError.delete(); } if(fOutput.exists()) { System.out.println(FileUtils.readFileToString(fOutput, Charset.defaultCharset())); fOutput.delete(); } } public boolean isConcreteProgramReached() { File log_file = new File(log_dir_path2 + (counter - 1)); if(log_file.exists()){ // check if the log file is empty String content; try { content = FileUtils.readFileToString(log_file, Charset.defaultCharset()); if(content.trim().isEmpty()) { // the log file is empty, meaning the synthesizer has been busy with // expanding sketches and haven't reached to a concrete program yet // in the 20 seconds return false; } else { return true; } } catch (IOException e) { e.printStackTrace(); } } return false; } public Summary GetSynthesisSummary(SamplerType samplerType, int continuous) { // Check if synthesis complete List<String> log_files = new ArrayList<String>(); if(continuous > 0) { // need to read previous n log files since the user has chosen to continue the synthesis for more than one // iterations for(int i = continuous; i >= 0; i--) { String path = log_dir_path2 + (counter - 1 - i); File f = new File(path); if(f.exists()) { log_files.add(f.getPath()); } } } else { String path = log_dir_path2 + (counter - 1); File f = new File(path); if(f.exists()) { log_files.add(f.getPath()); } } if(!log_files.isEmpty()){ // Run the sampler and return the results as JSON // RegexSampler sampler = new SemanticCoverageSampler("src/test/resources/0"); RegexSampler sampler; switch (samplerType){ case Semantic: sampler = new SemanticCoverageSampler(log_files); break; case Syntax: return null; // sampler = new SyntaxCoverageSampler(log_file_path); // break;s case MaxExamples: default: sampler = new MaxExamplesSampler(log_files); break; case Unique: sampler = initializeUniqueSampler(log_files, continuous); break; } sampler.processLogFile(); Set<String> sample_set = sampler.sample(); ArrayList<String> example_list = new ArrayList<>(this.prev_examples); HashMap<String, ExampleStat> exampleMap = new HashMap<>(); ArrayList<ExampleStat> exampleStats = new ArrayList<>(); for(String ex: example_list){ String ex_str = convertPrevExampleString(ex); ExampleStat exampleStat = parseExampleString(ex_str); exampleStat.stat = sampler.GetTotalSatisfiedPrograms(ex_str); exampleMap.put(ex_str, exampleStat); exampleStats.add(exampleStat); } ArrayList<ProgramStat> programStats = new ArrayList<>(); //for all the sample programs, update the example stat and satisfies for(String sample: sample_set){ ProgramStat programStat = new ProgramStat(); programStat.program = sample; programStat.satisfies = new ArrayList<>(); // Get all the examples - update the stats and program satisfies ArrayList<String> satisfiedExamples = sampler.GetExamplesForRegex(sample); for(String se: satisfiedExamples){ ExampleStat es = exampleMap.get(se); programStat.satisfies.add(exampleStats.indexOf(es)); } programStats.add(programStat); } Summary summary = new Summary(); summary.programs = programStats; summary.examples = exampleStats; summary.total_programs = sampler.GetTotalProgramCount(); summary.sampler_type = samplerType.toString(); if(samplerType == SamplerType.Semantic){ SemanticCoverageSummary.put(log_files.toString(), summary); } else if(samplerType == SamplerType.Syntax){ SyntaxCoverageSummary.put(log_files.toString(), summary); } return summary; } return null; } private UniqueSampler initializeUniqueSampler (List<String> logfile, int continuous) { if(counter == 1 && !regex_map.isEmpty()) { regex_map.clear(); parent_map.clear(); } LinkedHashMap<String, ArrayList<String>> tree = readTreeLog(continuous); TreeObject treeRoot = LogFileUtils.convertTreeBasedLogToTreeObject(tree); return new UniqueSampler(logfile, treeRoot); } public ExampleStat parseExampleString(String exString) { if(exString.endsWith("---------true")){ ExampleStat example = new ExampleStat(); example.input = exString.substring(0,exString.length() - "---------true".length()); example.positive = true; example.stat = 0; return example; } else{ ExampleStat example = new ExampleStat(); example.input = exString.substring(0,exString.length() - "---------false".length()); example.positive = false; example.stat = 0; return example; } } public String convertPrevExampleString(String exString) { if(exString.endsWith(",true")){ return "" + exString.substring(0,exString.length() - ",true".length()) + "---------true"; } else{ return "" + exString.substring(0,exString.length() - ",false".length()) + "---------false"; } } public String parseAnnotationToSketch(Example[] examples, Regex[] regexes) { HashSet<String> exact_matches = new HashSet<String>(); HashSet<String> not_matches = new HashSet<String>(); HashSet<String> char_families = new HashSet<String>(); HashSet<String> includes = new HashSet<String>(); for(Example example : examples) { if(example.output) { // only consider exact match in positive examples for(String s : example.exact) { exact_matches.add(s); } } if(!example.output) { // only consider unmatch in negative examples for(String s : example.unmatch) { not_matches.add(s); } } for(String s : example.generalize) { String char_family = s.substring(s.lastIndexOf("@@@") + 3); if(char_family.equals("any")) { // handle it outside continue; } char_families.add('<' + char_family + '>'); // comment out this heuristic, seems not so helpful // if(!example.output) { // char_families.add("not(contain(<" + char_family + ">))"); // } } } for(Regex regex : regexes) { for(String s : regex.include) { includes.add(s); } } for(Regex regex : regexes) { for(String s : regex.maybe) { includes.add(s); } } String sketch = "?"; String sketch_includes = ""; HashSet<String> single_chars = new HashSet<String>(); HashSet<String> sequences = new HashSet<String>(); for(String match : exact_matches) { if(match.length() == 1) { // a single character single_chars.add("<" + match + ">"); } else { char[] chars = match.toCharArray(); // Option 1: treat multiple characters as a sequence String s = ""; for(int i = 0; i < chars.length - 1; i++) { s += "concat(<" + chars[i] + ">,"; } s+= "<" + chars[chars.length - 1] + ">"; for(int i = 0; i < chars.length - 1; i++) { s+= ")"; } sequences.add(s); // Option 2: treat multiple characters separately, not as a sequence for(char c : chars) { single_chars.add("<" + c + ">"); } } } for(String unmatch : not_matches) { if(unmatch.length() == 1) { // a single character single_chars.add("<" + unmatch + ">"); } else { char[] chars = unmatch.toCharArray(); // Option 1: treat multiple characters as a sequence String s = ""; for(int i = 0; i < chars.length - 1; i++) { s += "concat(<" + chars[i] + ">,"; } s+= "<" + chars[chars.length - 1] + ">"; for(int i = 0; i < chars.length - 1; i++) { s+= ")"; } sequences.add(s); // Option 2: treat multiple characters separately, not as a sequence for(char c : chars) { single_chars.add("<" + c + ">"); } } } for(String char_family : char_families) { sequences.add(char_family); } for(String include : includes) { if(include.equals("repeatatleast")) { include = "repeatatleast(?,-1)"; } else if (include.equals("contain")) { include = "contain(?)"; } else if (include.equals("or")) { include = "or(?,?)"; } else if (include.equals("startwith")) { include = "startwith(?)"; } else if (include.equals("endwith")) { include = "endwith(?)"; } else if (include.equals("optional")) { include = "optional(?)"; } else if (include.equals("star")) { include = "star(?)"; } else if (include.equals("kleenestar")) { include = "kleenestar(?)"; } else if (include.equals("repeat")) { include = "repeat(?,-1)"; } else if (include.equals("repeatrange")) { include = "repeatrange(?,-1,-1)"; } else if (include.equals("concat")) { include = "concat(?,?)"; } else if (include.equals("not")) { include = "not(?)"; } else if (include.equals("notcc")) { include = "notcc(?)"; } else if (include.equals("and")) { include = "and(?,?)"; } else if (include.equals("or")) { include = "or(?,?)"; } else if (include.equals("sep")) { include = "sep(?,?)"; } sketch_includes += include + ","; } ArrayList<String> l = new ArrayList<String>(single_chars); if(l.size() > 1) { sketch += "{"; // add a disjunction of all single chars for(int i = 0; i < l.size() - 1; i++) { sketch += "or(" + l.get(i)+ ","; } sketch += l.get(l.size() - 1) ; for(int i = 0; i < l.size() - 1; i++) { sketch += ")"; } // then add individual chars for(int i = 0; i < l.size(); i++) { sketch += "," + l.get(i); } } else if (l.size() == 1) { sketch += "{" + l.get(0); } if(sequences.size() > 0) { if(sketch.contains("{")) { sketch += ","; } else { sketch += "{"; } for(String sequence : sequences) { sketch += sequence + ","; } if(sketch.endsWith(",")) { sketch = sketch.substring(0, sketch.length() - 1); } } if(!sketch_includes.isEmpty()) { if(sketch.contains("{")) { sketch += "," + sketch_includes; } else { sketch += "{" + sketch_includes; } } if(sketch.contains("{")) { if(sketch.endsWith(",")) { sketch = sketch.substring(0, sketch.length() - 1); } sketch += "}"; } return sketch; } public HashMap<String, String> regex_map = new HashMap<String, String>(); // id -> regex public HashMap<String, String> parent_map = new HashMap<String, String>(); // child -> parent public String getTreeVisualizationData(int continuous) { if(counter == 1 && !regex_map.isEmpty()) { regex_map.clear(); parent_map.clear(); } LinkedHashMap<String, ArrayList<String>> tree = readTreeLog(continuous); String json = LogFileUtils.convertTreeBasedLogToJSON(tree); return json; } private LinkedHashMap<String, ArrayList<String>> readTreeLog(int continuous) { LinkedHashMap<String, ArrayList<String>> tree = new LinkedHashMap<String, ArrayList<String>>(); if(continuous > 0) { // need to read previous n log files since the user has chosen to continue the synthesis for more than one // iterations for(int i = continuous; i >= 0; i--) { File log_file = new File(log_dir_path2 + (counter - 1 - i) + "_tree"); LinkedHashMap<String, ArrayList<String>> new_tree = LogFileUtils.readTreeBasedLogFile(log_file, regex_map, parent_map); for(String parent : new_tree.keySet()) { ArrayList<String> children = new_tree.get(parent); if(tree.containsKey(parent)) { ArrayList<String> l = tree.get(parent); for(String child : children) { if(!l.contains(child)) { // merge l.add(child); } } tree.put(parent, l); } else { tree.put(parent, children); } } } } else { File log_file = new File(log_dir_path2 + (counter - 1) + "_tree"); tree = LogFileUtils.readTreeBasedLogFile(log_file, regex_map, parent_map); } return tree; } public void pause() { // write the signal to the pause file File f = new File(pause_file_path); try { FileUtils.writeStringToFile(f, "pause-" + (counter - 1), Charset.defaultCharset(), false); } catch (IOException e) { e.printStackTrace(); } } }
package com.mycompany.myapp.repository; import com.mycompany.myapp.domain.Person; import com.mycompany.myapp.service.dto.PersonDTO; import org.springframework.data.domain.Page; import org.springframework.stereotype.Repository; import org.springframework.data.jpa.repository.*; import org.springframework.data.domain.Pageable; import java.util.List; /** * Spring Data JPA repository for the Person entity. */ @SuppressWarnings("unused") @Repository public interface PersonRepository extends JpaRepository<Person, Long> { Page<Person> findAllByIsDentistIsTrue(Pageable pageable); Page<Person> findAllByIsPatientIsTrue(Pageable pageable); Page<Person> findAllByIsEmployeeIsTrue(Pageable pageable); }
interface AI { String get(); default String getDefault() { return "Default AI"; } static String getStatic() { return "Static AI"; } } interface BI extends AI { //int getDefault(); // Compilation fails. It is redeclaring getDefault() of AI as abstract. But return type has to be covariant. String getDefault(); //It is redeclaring getDefault() of AI as abstract. static int getStatic() { //It is not overriding getStatic() in A. So return type can be anything. return 1; } } class B implements BI { @Override public String get() { return "B"; } @Override public String getDefault() { return "Default B"; } /*@Override public String getStatic() { //Compilation fails. The method getStatic() of type B must override or implement a supertype method return "Default B"; }*/ } interface CI extends AI { //default int getDefault() { return 0;} //It is overriding the getDefault() of AI. So, return type has to be covariant. default String getDefault() { //It is overriding the getDefault() of AI. return "Default CI"; } } class C implements CI { @Override public String get() { return "C"; } } interface DI extends AI { } class D implements DI { @Override public String get() { return "D"; } } public class Main { public static void main(String[] args) { AI b = new B(); System.out.println(b.get()); System.out.println(b.getDefault()); //System.out.println(b.getStatic());//Compilation fails. This static method of interface AI can only be accessed as AI.getStatic System.out.println(AI.getStatic()); System.out.println(BI.getStatic()); //BI doesn't inherit getStatic() of AI. It redefines its own getStatic(); //System.out.println(CI.getStatic());//Compilation fails. CI doesn't inherit getStatic() of AI. AI c = new C(); System.out.println(c.get()); System.out.println(c.getDefault()); AI d = new D(); System.out.println(d.get()); System.out.println(d.getDefault()); } } interface one { default void go() {} } interface two { default void go() {} } //interface three extends one, two{} //Compilation fails. Duplicate default methods named go with the parameters () and () are inherited from the types two and one //class X implements one, two {} //Compilation fails. Duplicate default methods named go with the parameters () and () are inherited from the types two and one class X implements one, two { public void go() {} }
package cn.auto.core.webdriver; import cn.auto.core.webdriver.app.AndroidEngine; import cn.auto.core.webdriver.app.IOSEngine; import cn.auto.core.webdriver.emulation.EmulationEngine; import cn.auto.core.webdriver.web.WebEngine; import org.openqa.selenium.WebDriver; /** * Created by chenmeng on 2018/1/16. */ public class EngineFactory { public static WebDriver engine(DriverRequest request) throws Exception { switch (request.engineType()) { case Web: return new WebEngine(request).driver(); case Emulation: return new EmulationEngine(request).driver(); case Android: return new AndroidEngine(request).driver(); case iOS: return new IOSEngine(request).driver(); default: return new WebEngine(request).driver(); } } }
class Dog extends Canine { Dog(String name) { name_ = new String("Dog: " + name); } public String MakeNoise() { return name_ + ": Woof!"; } }
package gov.nih.mipav.model.scripting.parameters; import gov.nih.mipav.model.scripting.*; import gov.nih.mipav.model.structures.ModelImage; import gov.nih.mipav.view.ViewJFrameImage; /** * A image placeholder variable parameter used in either the recording or execution of a script action. */ public class ParameterImage extends ParameterString { // ~ Constructors // --------------------------------------------------------------------------------------------------- /** * Creates a new ParameterImage object. * * @param paramLabel The label/name to give to this parameter. * * @throws ParserException If there is a problem creating the parameter. */ public ParameterImage(final String paramLabel) throws ParserException { super(paramLabel, Parameter.PARAM_IMAGE); } /** * Creates a new ParameterImage object. * * @param paramLabel The label/name to give to this parameter. * @param paramType The type of this parameter (should be PARAM_IMAGE). * * @throws ParserException If there is a problem creating the parameter. */ public ParameterImage(final String paramLabel, final int paramType) throws ParserException { super(paramLabel, paramType); } /** * Creates a new ParameterImage object. * * @param paramLabel The label/name to give to this parameter. * @param paramTypeString The type of this parameter, in string form. * @param paramValueString The new parameter value. * * @throws ParserException If there is a problem creating the parameter. */ public ParameterImage(final String paramLabel, final String paramTypeString, final String paramValueString) throws ParserException { super(paramLabel, paramTypeString, paramValueString); } /** * Creates a new ParameterImage object. * * @param paramLabel The label/name to give to this parameter. * @param paramType The type of this parameter (should be PARAM_IMAGE). * @param paramValueString The new parameter value. * * @throws ParserException If there is a problem creating the parameter. */ public ParameterImage(final String paramLabel, final int paramType, final String paramValueString) throws ParserException { super(paramLabel, paramType, paramValueString); } // ~ Methods // -------------------------------------------------------------------------------------------------------- /** * Return the frame containing the image that this image placeholder refers to. * * @return The frame containing the image assigned to this image placeholder variable. */ public ViewJFrameImage getFrame() { return getImage().getParentFrame(); } /** * Return the image that this image placeholder refers to. * * @return The image assigned to this image placeholder variable. */ public ModelImage getImage() { return ScriptRunner.getReference().getImage(getValue()); } /** * Checks to see if this image placeholder variable is the same as another image placeholder (e.g., '$image1' == * '$image1'; does not check image name). * * @param secondImageParam Another image variable parameter. * * @return <code>True</code> if the parameters have the same image placeholder, <code>false</code> otherwise. */ public boolean isSameImageAs(final ParameterImage secondImageParam) { return getValue().equals(secondImageParam.getValue()); } }
package com.cdkj.model.system.pojo; import com.cdkj.common.base.model.pojo.BaseModel; /** * PackageName:com.cdkj.model.system.pojo * Descript:角色权限<br/> * date: 2018-6-19 <br/> * @author: yw * version 1.0 */ public class SysRolePermission extends BaseModel { private String roleId; private String permissionId; public String getRoleId() { return roleId; } public void setRoleId(String roleId) { this.roleId = roleId == null ? null : roleId.trim(); } public String getPermissionId() { return permissionId; } public void setPermissionId(String permissionId) { this.permissionId = permissionId == null ? null : permissionId.trim(); } }
package org.reactome.web.nursa.client.details.tabs.dataset; import com.google.gwt.event.shared.GwtEvent; public class AnalysisResultFilterChangedEvent extends GwtEvent<AnalysisResultFilterChangedHandler> { public static Type<AnalysisResultFilterChangedHandler> TYPE = new GwtEvent.Type<AnalysisResultFilterChangedHandler>(); private double filter; public AnalysisResultFilterChangedEvent(double filter) { this.filter = filter; } @Override public Type<AnalysisResultFilterChangedHandler> getAssociatedType() { return TYPE; } @Override protected void dispatch(AnalysisResultFilterChangedHandler handler) { handler.onFilterChanged(filter); } }
package com.beike.common.exception; /** * <p> * Title:乐观锁异常(DAO层) * </p> * <p> * Description: * </p> * <p> * Copyright: Copyright (c) 2011 * </p> * <p> * Company: Sinobo * </p> * * @date 2011-11-16 14:14:07 * @author wenhua.cheng * @version 1.0 */ public class StaleObjectStateException extends BaseException { private static final long serialVersionUID = 4039314423110012567L; public StaleObjectStateException() { super(); } public StaleObjectStateException(int code) { super(code); } public StaleObjectStateException(String errorMsg) { super(errorMsg); } }
package xyz.asassecreations.voxel.world.chunk; import static xyz.asassecreations.voxel.world.chunk.ChunkSection.SECTION_SIZE; import xyz.asassecreations.voxel.shaders.ChunkShader; public final class Chunk { public final ChunkSection[] sections = new ChunkSection[SECTION_SIZE]; public final int x, z; public Chunk(final int x, final int z) { this.x = x; this.z = z; for (int i = 0; i < sections.length; i++) sections[i] = new ChunkSection(this, i); } public final void generate() { ChunkGenerator.generate(this); } public final void render(final ChunkShader shader) { for (final ChunkSection section : sections) section.render(shader); } public final void delete() { for (final ChunkSection section : sections) section.delete(); } }
package payments.service; import java.util.concurrent.ExecutorService; import javax.ws.rs.client.Client; import javax.ws.rs.client.ClientBuilder; import javax.ws.rs.client.Entity; import javax.ws.rs.client.Invocation; import javax.ws.rs.client.WebTarget; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import payments.model.AccountingResponse; import payments.model.PaymentRequest; import rx.Observable; public class AccountingServiceAdapter { private static final Logger LOG = LoggerFactory.getLogger(AccountingServiceAdapter.class); private Client accountingServiceClient; private WebTarget accountingServiceTarget; public AccountingServiceAdapter(){ initializeRestClients(); } public void initializeRestClients() { accountingServiceClient = ClientBuilder.newClient(); accountingServiceTarget = accountingServiceClient.target("http://localhost:9095/accounting-service"); LOG.info("Initiakized clients and targets..."); } public Observable<AccountingResponse> updatePaymentForAccounting( PaymentRequest paymentRequest, ExecutorService executor){ LOG.info("called updatePaymentForAccounting...."); if(null == accountingServiceTarget) { LOG.info("Reinitalizing clients"); initializeRestClients(); } return Observable .create((Observable.OnSubscribe<AccountingResponse>) subscriber -> { Runnable r = () -> { Invocation.Builder invocationBuilder = accountingServiceTarget.request(MediaType.APPLICATION_JSON); Response response = invocationBuilder.post(Entity.entity(paymentRequest, MediaType.APPLICATION_JSON)); LOG.info(""+response.getStatus()); LOG.info(response.readEntity(String.class)); subscriber.onNext(response.readEntity(AccountingResponse.class)); subscriber.onCompleted(); }; executor.execute(r); }); } }
package com.aqacourses.test.student; import com.aqacourses.test.interfaces.ParseFileInterface; import com.aqacourses.test.interfaces.WriteToDbInterface; import java.io.*; import java.util.ArrayList; import java.util.List; import java.util.Scanner; public class StudentPedin extends Student implements WriteToDbInterface, ParseFileInterface { private File file; private BufferedWriter bufferedWriter; /** * Parse file to ArrayList * * @param pathToFile * @return ArrayList with student data */ @Override public ArrayList parseFile(String pathToFile) { Scanner scanner = null; try { scanner = new Scanner(new File(pathToFile)); } catch (FileNotFoundException e) { e.printStackTrace(); } ArrayList<String> data = new ArrayList<>(); while (scanner.hasNext()) { data.add(scanner.next()); } scanner.close(); return data; } /** * Write student data to MS SQL DB * * @param data */ @Override public void writeToDb(List<String> data) { try { openConnection(); if (validateData((ArrayList<String>) data)) { for (String datum : data) { bufferedWriter.write(getDate() + " - " + datum); bufferedWriter.newLine(); } bufferedWriter.write("==================\n"); System.out.println("All data is written to MS SQL DB"); closeConnection(); } } catch (IOException e) { System.err.println("ERROR!!!"); e.printStackTrace(); } } /** * Open connection to MS SQL DB */ private void openConnection() throws IOException { String path = "D:/MSSQL-DB.txt"; file = new File(path); bufferedWriter = new BufferedWriter(new FileWriter(file, true)); } /** * Close connection to MS SQL DB */ private void closeConnection() { try { bufferedWriter.close(); } catch (IOException e) { System.err.println("Cannot close connection to MS SQL DB"); e.printStackTrace(); } System.out.println("Close connection to MS SQL DB"); } }
package com.practice.mybatistest; import java.util.List; import com.practice.mybatistest.dto.MyBatisTestDto; public class MyBatisTestDeleteMain { public static void main(String[] args) { MyBatisTestDao<MyBatisTestDto> dao = new MyBatisTestDao<MyBatisTestDto>(); List<MyBatisTestDto> list = dao.select(null); if (list.get(0) == null) { System.out.println("未登録です"); } else { int id = list.get(0).getId(); MyBatisTestDto dto = new MyBatisTestDto(); dto.setId(id); dao.delete(dto); System.out.println("id : " + id + " を削除しました"); } } }
public class Productor extends Thread { private Buffer buffer; public Productor(Buffer buffer) { this.buffer = buffer; } public void run() { Character lletra; for (int i = 1; i <= 10; i++) { lletra = (char) (Math.random() * 26 + 65); buffer.posar(lletra); System.out.println("Productor: " + lletra); try { Thread.sleep(100); } catch (InterruptedException e) { e.printStackTrace(); } } } }
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package net.maizegenetics.analysis.gbs.pana; import java.io.File; import net.maizegenetics.analysis.gbs.MergeMultipleTagCountPlugin; /** * * @author Fei Lu */ public class PanAUsageExample { public PanAUsageExample () { //this.h5ToAnchorPlugin(); //this.splitTBTPlugin(); //this.buildTagBlockPositionPlugin(); //this.splitTagBlockPositionPlugin(); //this.GWASMappingPlugin(); //this.mergeMappingResultPlugin(); //this.mappingResultToTagGWASMapPlugin(); //this.tagMapToFastaPlugin(); //this.alignmentWithBowtie2(); //this.samToMultiPositionTOPMPlugin(); //this.addPosToTagMapPlugin(); //this.buildTrainingSetPlugin(); //this.modelTrainingPlugin(); //this.predictionPlugin(); //this.filterTagMapPlugin(); //this.readDigestPlugin(); //this.mergeMultipleTagCountPlugin(); //this.buildPivotTBTPlugin(); } public void readDigestPlugin () { String rawSeqDirS = "M:\\pipelineTest\\PanA\\Illumina\\fastq\\"; String keyFileS = "M:\\pipelineTest\\PanA\\key\\keyFastq.txt"; String recSeq = "GCTG"; int customTagLength = 96; String outputDirS = "M:\\pipelineTest\\PanA\\tagCount\\"; String arguments = "-i " + rawSeqDirS + " -k " + keyFileS + " -s " + recSeq + " -l " + String.valueOf(customTagLength)+ " -o " + outputDirS; String[] args = arguments.split(" "); PanAReadDigestPlugin rdp = new PanAReadDigestPlugin(); rdp.setParameters(args); rdp.performFunction(null); } public void mergeMultipleTagCountPlugin () { String tagCountDirectory = "M:\\pipelineTest\\PanA\\tagCount\\"; String masterTagCount = "M:\\pipelineTest\\PanA\\masterTagCount\\master.cnt"; int minCount = 1; String arguments = "-i " + tagCountDirectory + " -o " + masterTagCount + " -c " + String.valueOf(minCount); String[] args = arguments.split(" "); MergeMultipleTagCountPlugin p = new MergeMultipleTagCountPlugin(); p.setParameters(args); p.performFunction(null); } public void buildPivotTBTPlugin () { String masterTagCountFileS = "M:\\pipelineTest\\PanA\\masterTagCount\\master.cnt"; String tagCountDirS = "M:\\pipelineTest\\PanA\\tagCount"; String tbtFileS = "M:\\pipelineTest\\PanA\\tbt\\TBT_shotgun_pivot.h5"; String arguments = "-m " + masterTagCountFileS + " -d " + tagCountDirS + " -o " + tbtFileS; String[] args = arguments.split(" "); PanABuildPivotTBTPlugin p = new PanABuildPivotTBTPlugin(); p.setParameters(args); p.performFunction(null); } public void h5ToAnchorPlugin () { String h5GentoypeFileS = "M:\\pipelineTest\\PanA\\genotype\\GBS27.1024sites.T5.imp.hmp.h5"; String sBitGenotypeFileS = "M:\\pipelineTest\\PanA\\genotype\\GBS27.1024sites.sBit.h5"; String arguments = "-i " + h5GentoypeFileS + " -o " + sBitGenotypeFileS; String[] args = arguments.split(" "); PanAH5ToAnchorPlugin hta = new PanAH5ToAnchorPlugin(); hta.setParameters(args); hta.performFunction(null); } public void splitTBTPlugin () { String inputTBTS = "M:\\pipelineTest\\PanA\\tbt\\TBTHDF5_4096_tags_mergedtaxa_pivot_20120921.h5"; String outputDirS = "M:\\pipelineTest\\PanA\\tbt\\subTBT\\"; String chunkSize = "1000"; String arguments = "-i " + inputTBTS + " -s " + chunkSize + " -o " + outputDirS; String[] args = arguments.split(" "); PanASplitTBTPlugin sbp = new PanASplitTBTPlugin(); sbp.setParameters(args); sbp.performFunction(null); } public void buildTagBlockPositionPlugin () { String tbtHDF5 = "M:\\pipelineTest\\PanA\\tbt\\TBTHDF5_4096_tags_mergedtaxa_pivot_20120921.h5"; String topmFileS = "M:\\production\\geneticMapping\\tagBlock\\AllZeaGBSv2.6ProdTOPM_20130605.topm.h5"; String blockFileS = "M:\\pipelineTest\\PanA\\tbp\\tagBlock.tbp"; int TOPMVersionValue = 1; String arguments = "-t " + tbtHDF5 + " -p " + topmFileS + " -v " + String.valueOf(TOPMVersionValue) + " -o " + blockFileS; String[] args = arguments.split(" "); PanABuildTagBlockPosPlugin tbp = new PanABuildTagBlockPosPlugin(); tbp.setParameters(args); tbp.performFunction(null); } public void splitTagBlockPositionPlugin () { String blockFileS = "M:\\pipelineTest\\PanA\\tbp\\tagBlock.tbp"; String outputDirS = "M:\\pipelineTest\\PanA\\tbp\\subTBP"; String chunkSize = "1000"; String arguments = "-i " + blockFileS + " -s " + chunkSize + " -o " + outputDirS; String[] args = arguments.split(" "); PanASplitTagBlockPosPlugin stb = new PanASplitTagBlockPosPlugin(); stb.setParameters(args); stb.performFunction(null); } public void GWASMappingPlugin () { String sBitGenotypeFileS = "M:\\pipelineTest\\PanA\\genotype\\GBS27.1024sites.sBit.h5"; String outDirS = "M:\\pipelineTest\\PanA\\gwasResult\\sub\\"; String tbtDirS = "M:\\pipelineTest\\PanA\\tbt\\subTBT\\"; String tbpDirS = "M:\\pipelineTest\\PanA\\tbp\\subTBP\\"; File[] tbts = new File (tbtDirS).listFiles(); File[] tbps = new File (tbpDirS).listFiles(); for (int i = 0; i < tbts.length; i++) { String arguments = "-g " + sBitGenotypeFileS + " -t " + tbts[i].getAbsolutePath() + " -b " + tbps[i].getAbsolutePath() + " -o " + outDirS + " -c max -s 1000 -cs 0 -ce 1"; String[] args = arguments.split(" "); PanATagGWASMappingPlugin tgm = new PanATagGWASMappingPlugin(); tgm.setParameters(args); tgm.performFunction(null); } } public void mergeMappingResultPlugin () { String subResultDirS = "M:\\pipelineTest\\PanA\\gwasResult\\sub\\"; String mergedResultFileS = "M:\\pipelineTest\\PanA\\gwasResult\\pivotTBT.gwas.txt"; String arguments = "-i " + subResultDirS + " -o " + mergedResultFileS; String[] args = arguments.split(" "); PanAMergeMappingResultPlugin mmr = new PanAMergeMappingResultPlugin(); mmr.setParameters(args); mmr.performFunction(null); } public void mappingResultToTagGWASMapPlugin () { String mappingResultFileS = "M:\\pipelineTest\\PanA\\gwasResult\\pivotTBT.gwas.txt"; String tagCountFileS = "M:/production/v3gbs/tagCount/AllZeaMasterTags_c10_20120606.cnt"; String tagGWASMapFileS = "M:\\pipelineTest\\PanA\\tagMap\\tagGWASMap.h5"; String arguments = "-i " + mappingResultFileS + " -t " + tagCountFileS + " -o " + tagGWASMapFileS; String[] args = arguments.split(" "); PanAMappingResultToTagGWASMapPlugin mrtg = new PanAMappingResultToTagGWASMapPlugin(); mrtg.setParameters(args); mrtg.performFunction(null); } public void tagMapToFastaPlugin () { String tagGWASMapFileS = "M:\\pipelineTest\\PanA\\tagMap\\tagGWASMap.h5"; String fastaFileS = "M:\\pipelineTest\\PanA\\alignment\\tagGWASMap.fa"; String arguments = "-i " + tagGWASMapFileS + " -o " + fastaFileS; String[] args = arguments.split(" "); PanATagMapToFastaPlugin tmtf = new PanATagMapToFastaPlugin(); tmtf.setParameters(args); tmtf.performFunction(null); } public void alignmentWithBowtie2 () { String command = "bowtie2 -x ZmB73_RefGen_v2.fa -f tagGWASMap.fa -k 2 --very-sensitive-local -p 8 -S tagGWASMap.sam"; } public void samToMultiPositionTOPMPlugin () { String samFileS = "M:\\pipelineTest\\PanA\\alignment\\tagGWASMap.sam"; String tagGWASMapFileS = "M:\\pipelineTest\\PanA\\tagMap\\tagGWASMap.h5"; String topmV3FileS = "M:\\pipelineTest\\PanA\\alignment\\tagGWASMap.v3.topm.h5"; String arguments = "-i " + samFileS + " -t " + tagGWASMapFileS + " -o " + topmV3FileS; String[] args = arguments.split(" "); PanASamToMultiPositionTOPMPlugin stt = new PanASamToMultiPositionTOPMPlugin(); stt.setParameters(args); stt.performFunction(null); } public void addPosToTagMapPlugin () { String tagGWASMapFileS = "M:\\pipelineTest\\PanA\\tagMap\\tagGWASMap.h5"; String topmV3FileS = "M:\\pipelineTest\\PanA\\alignment\\tagGWASMap.v3.topm.h5"; String arguments = "-i " + tagGWASMapFileS + " -t " + topmV3FileS; String[] args = arguments.split(" "); PanAAddPosToTagMapPlugin p = new PanAAddPosToTagMapPlugin(); p.setParameters(args); p.performFunction(null); } public void buildTrainingSetPlugin () { String tagGWASMapFileS = "M:\\pipelineTest\\PanA\\tagMap\\tagGWASMap.h5"; String trainingSetFileS = "M:\\pipelineTest\\PanA\\training\\uniqueRefTrain.arff"; String rScriptPath = "C:\\Users\\fl262\\Documents\\R\\R-3.0.2\\bin\\Rscript.exe"; String boxcoxParemeterFileS = "M:\\pipelineTest\\PanA\\training\\boxcoxParemeter.txt"; String arguments = "-m " + tagGWASMapFileS + " -t " + trainingSetFileS + " -r " + rScriptPath + " -b " + boxcoxParemeterFileS; String[] args = arguments.split(" "); PanABuildTrainingSetPlugin p = new PanABuildTrainingSetPlugin(); p.setParameters(args); p.performFunction(null); } public void modelTrainingPlugin () { String trainingSetFileS = "M:\\pipelineTest\\PanA\\training\\uniqueRefTrain.arff"; String wekaPath = "E:\\Database\\Weka-3-6\\weka.jar"; String modelFileS = "M:\\pipelineTest\\PanA\\training\\m5.mod"; String trainingReportDirS = "M:\\pipelineTest\\PanA\\training\\report\\"; String arguments = "-t " + trainingSetFileS + " -w " + wekaPath + " -m " + modelFileS + " -r " + trainingReportDirS; String[] args = arguments.split(" "); PanAModelTrainingPlugin p = new PanAModelTrainingPlugin(); p.setParameters(args); p.performFunction(null); } public void predictionPlugin () { String wekaPath = "E:\\Database\\Weka-3-6\\weka.jar"; String tagGWASMapFileS = "M:\\pipelineTest\\PanA\\tagMap\\tagGWASMap.h5"; String modelFileS = "M:\\pipelineTest\\PanA\\training\\m5.mod"; String boxcoxParemeterFileS = "M:\\pipelineTest\\PanA\\training\\boxcoxParemeter.txt"; String arguments = "-t " + tagGWASMapFileS + " -w " + wekaPath + " -m " + modelFileS + " -b " + boxcoxParemeterFileS; String[] args = arguments.split(" "); PanAPredictionPlugin p = new PanAPredictionPlugin(); p.setParameters(args); p.performFunction(null); } public void filterTagMapPlugin () { String tagGWASMapFileS = "M:\\pipelineTest\\PanA\\tagMap\\tagGWASMap.h5"; int distanceCutoff = Integer.MAX_VALUE; String anchorFileS = "M:\\pipelineTest\\PanA\\togm\\anchor.txt" ; String arguments = "-t " + tagGWASMapFileS + " -a " + anchorFileS + " -c " + String.valueOf(distanceCutoff); String[] args = arguments.split(" "); PanAFilteringTagMapPlugin p = new PanAFilteringTagMapPlugin(); p.setParameters(args); p.performFunction(null); } public static void main (String[] args) { new PanAUsageExample(); } }
package dubstep; ////@Author - Apoorva Biseria import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.FileReader; import java.io.FileWriter; import java.io.IOException; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Collections; import java.util.Comparator; import java.util.Date; import java.util.HashMap; import java.util.List; import net.sf.jsqlparser.statement.create.table.ColDataType; import net.sf.jsqlparser.statement.create.table.ColumnDefinition; import net.sf.jsqlparser.statement.select.OrderByElement; import net.sf.jsqlparser.statement.select.SelectItem; public class Orderbymem { public static ArrayList<String> orderby(ArrayList<String> listLast,ArrayList<ColumnDefinition> groupbycd,List<OrderByElement> order ) throws IOException { String blocks="inmemfile"; //int blocksize =2; ArrayList<String> ColumnNames =new ArrayList<>(); ArrayList<ColDataType> datatypes =new ArrayList(); ArrayList<ColumnDefinition> columns =groupbycd; ArrayList<Integer> indexes = new ArrayList<>(); ArrayList<MyTable> tables = new ArrayList(); HashMap<Integer,MyTable> tableinfo = new HashMap(); for (int i=0;i<columns.size();i++) { String colName = columns.get(i).getColumnName().toLowerCase(); ColumnNames.add(colName); ColDataType colDataType = columns.get(i).getColDataType(); datatypes.add(colDataType); } //System.out.println(order+"ORDER!!"); //System.out.println(ColumnNames+"ColNames!!!"); for (OrderByElement o : order) { int k = 0; for(String s : ColumnNames) { if(o.toString().toLowerCase().contains(s.toLowerCase())) { indexes.add(k); } else if(ConfigureVariables.testselect.get(k).toString().toLowerCase().contains(o.toString().toLowerCase())) { indexes.add(k); } k++; } } //System.out.println(indexes); for(OrderByElement o:order) { if(o.toString().contains("DESC")) { ConfigureVariables.desc =true; } } /* for(String s:ColumnNames) System.out.println(s); for(ColDataType s:datatypes) System.out.println(s); for(Integer s:indexes) System.out.println(s); */ Compare comparison = new Compare(ColumnNames,datatypes,indexes); Collections.sort(listLast,comparison); return listLast; } } class Compare implements Comparator<String>{ public int increase( int i) { i++; return i; } int i=0 ; ArrayList<String> ColumnNames; ArrayList<ColDataType> datatypes; ArrayList<Integer> indexes; public Compare(ArrayList<String> ColumnNames,ArrayList<ColDataType> datatypes,ArrayList<Integer> indexes) { this.ColumnNames = ColumnNames; this.datatypes = datatypes; this.indexes = indexes; } int returnval; @Override public int compare(String s1, String s2) { //System.out.println(s1); //int i =0; String first []; String second []; first = s1.split("\\|"); second = s2.split("\\|"); //for(String s:first) // System.out.println(s); //for(String s:second) // System.out.println(s); //System.out.println(indexes.get(i)); //System.out.println(datatypes.get(indexes.get(i)).toString()); //System.out.println(Integer.parseInt(first[indexes.get(i)])); //System.out.println(Integer.parseInt(second[indexes.get(i)])); //if(Integer.parseInt(first[indexes.get(i)])>Integer.parseInt(second[indexes.get(i)])) //{ System.out.println("done");} if((datatypes.get(indexes.get(i)).toString().equalsIgnoreCase("String"))||(datatypes.get(indexes.get(i)).toString().contains("CHAR"))||(datatypes.get(indexes.get(i)).toString().equalsIgnoreCase("varchar"))) { if(ConfigureVariables.desc) { if(first[indexes.get(i)].compareTo(second[indexes.get(i)])<0) { returnval = 1; } if(first[indexes.get(i)].compareTo(second[indexes.get(i)])>0) { returnval = -1;} if(first[indexes.get(i)].compareTo(second[indexes.get(i)])==0) { if(i<indexes.size()-1) {i=increase(i); //System.out.println(i+"ii"); compare(s1,s2);} else {// i =0; returnval = 0; } } } else { if(first[indexes.get(i)].compareTo(second[indexes.get(i)])>0) { returnval = 1; } if(first[indexes.get(i)].compareTo(second[indexes.get(i)])<0) { returnval = -1;} if(first[indexes.get(i)].compareTo(second[indexes.get(i)])==0) { if(i<indexes.size()-1) {i=increase(i); //System.out.println(i+"ii"); compare(s1,s2);} else {// i =0; returnval = 0; } } } } if(datatypes.get(indexes.get(i)).toString().equalsIgnoreCase( "int" ) ) { if(!ConfigureVariables.desc) { if(Integer.parseInt(first[indexes.get(i)])>Integer.parseInt(second[indexes.get(i)])) { returnval = 1; } else if(Integer.parseInt(first[indexes.get(i)])<Integer.parseInt(second[indexes.get(i)])) { returnval = -1;} else { if(i<indexes.size()-1) {i=increase(i); //System.out.println(i+"ii"); compare(s1,s2);} else {// i =0; returnval = 0; } } } else { if(Integer.parseInt(first[indexes.get(i)])<Integer.parseInt(second[indexes.get(i)])) returnval= 1; else if(Integer.parseInt(first[indexes.get(i)])>Integer.parseInt(second[indexes.get(i)])) returnval = -1; else { if(i<indexes.size()-1) {i=increase(i); //System.out.println(i+"ii"); compare(s1,s2);} else {// i =0; returnval = 0; } } } } if(datatypes.get(indexes.get(i)).toString().equalsIgnoreCase( "decimal" )) {if(!ConfigureVariables.desc) { if(Double.parseDouble(first[indexes.get(i)])>Double.parseDouble(second[indexes.get(i)])) { returnval = 1; } else if(Double.parseDouble(first[indexes.get(i)])<Double.parseDouble(second[indexes.get(i)])) { returnval = -1;} else { if(i<indexes.size()-1) {i=increase(i); //System.out.println(i+"ii"); compare(s1,s2);} else {// i =0; returnval = 0; } } } else { if(Double.parseDouble(first[indexes.get(i)])<Double.parseDouble(second[indexes.get(i)])) returnval= 1; else if(Double.parseDouble(first[indexes.get(i)])>Double.parseDouble(second[indexes.get(i)])) returnval = -1; else { if(i<indexes.size()-1) {i=increase(i); //System.out.println(i+"ii"); compare(s1,s2);} else {// i =0; returnval = 0; } } } } if(datatypes.get(indexes.get(i)).toString().equalsIgnoreCase( "DATE" )) { try{SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); Date date1 = sdf.parse(first[indexes.get(i)]); Date date2= sdf.parse(second[indexes.get(i)]); //System.out.println("date1 : " + sdf.format(date1)); // System.out.println("date2 : " + sdf.format(date2)); i = 0; if (date1.compareTo(date2) > 0) { returnval= 1; } else if (date1.compareTo(date2) < 0) { returnval = -1; } else if (date1.compareTo(date2) == 0) { returnval = 0; } } catch(ParseException e) { //System.out.println(e.getMessage()); } } // TODO Auto-generated method stub i =0 ; return returnval; } } //class SortComparator implements Comparator<>()
package io.cde.account.service; import java.util.List; import io.cde.account.domain.Mobile; import io.cde.account.exception.BizException; /** * @author lcl */ public interface MobileService { /** * 获取指定用户的电话信息. * * @param accountId 用户id * @return 返回用户的电话信息 * @throws BizException 如果用户id错误则抛异常 */ List<Mobile> getMobiles(String accountId) throws BizException; /** * 给指定用户添加电话信息. * * @param accountId 用户id * @param mobile 要添加的电话信息 * @throws BizException 若用户id错误则抛异常,若电话号码已经被使用过抛异常 */ void addMobile(String accountId, Mobile mobile) throws BizException; /** * 修改指定用户的电话信息. * * @param accountId 用户id * @param mobileId 邮箱id * @param isVerified 要修改的字段,是否认证 * @throws BizException 如果用户id或邮箱id错误则抛异常 */ void updateMobile(String accountId, String mobileId, boolean isVerified) throws BizException; /** * 修改默认电话是否公开. * * @param accountId 用户id * @param isPublic 是否公开 * @throws BizException 修改出现问题抛修改失败异常 */ void updatePublicMobile(String accountId, boolean isPublic) throws BizException; /** * 删除指定用户的指定电话. * * @param accountId 用户id * @param mobileId 电话id * @throws BizException 如果用户id或邮箱id错误则抛异常 */ void deleteMobile(String accountId, String mobileId) throws BizException; }
package main.saving; import java.util.HashMap; import block.Rock; import entity.Chest; import entity.mob.Angel; import entity.mob.Character; public class IDManager { private static HashMap<Integer, Class> classes = new HashMap() { { put(1, Character.class); put(2, Angel.class); put(65, Chest.class); } }; private static HashMap<Class, Integer> ids = new HashMap() { { put(Character.class, 1); put(Angel.class, 2); put(Chest.class, 65); } }; public static int getID(Class cl) { return ids.get(cl); } public static Class getClass(int id) { return classes.get(id); } private static HashMap<Byte, Class> blocks = new HashMap() { { put((byte) 2, Rock.class); } }; private static HashMap<Class, Byte> blockIDs = new HashMap() { { put(Rock.class, (byte) 2); } }; public static byte getBlockID(Class cl) { return blockIDs.get(cl); } public static Class getBlockClass(byte id) { return blocks.get(id); } }
package in.co.web; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; @SpringBootApplication public class JavaProject1Application { public static void main(String[] args) { SpringApplication.run(JavaProject1Application.class, args); System.out.println("hello jenkins build is here"); } }
package com.example.arti_scream.sqllaws; public class Laws { int _id; int _numrozd; String _rozd; int _numstat; String _stat; public Laws(){} public Laws(int id, int numrozd, String rozd, int numstat, String stat){ this._id = id; this._numrozd = numrozd; this._rozd = rozd; this._numstat = numstat; this._stat = stat; } // getting ID public int getID(){ return this._id; } // setting id public void setID(int id){ this._id = id; } }
package generic; import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; import org.apache.commons.collections4.FactoryUtils; import org.apache.commons.io.FileUtils; import org.apache.poi.ss.usermodel.Workbook; import org.apache.poi.ss.usermodel.WorkbookFactory; import org.openqa.selenium.OutputType; import org.openqa.selenium.TakesScreenshot; import org.openqa.selenium.WebDriver; import com.google.common.io.Files; public class FWUtil { public static String getXLData(String path, String sheet, int row, int cell) { String v = ""; try { Workbook w = WorkbookFactory.create(new FileInputStream(path)); v = w.getSheet(sheet).getRow(row).getCell(cell).toString(); } catch (Exception e) { e.printStackTrace(); } return v; } public static void setXLData(String path, String sheet, int row, int cell, String value) { try { Workbook w = WorkbookFactory.create(new FileInputStream(path)); w.getSheet(sheet).getRow(row).getCell(cell).setCellValue(value); w.write(new FileOutputStream(path)); } catch (Exception e) { e.printStackTrace(); } } public static void setXLData(String path, String sheet, int row, int cell, int value) { try { Workbook w = WorkbookFactory.create(new FileInputStream(path)); w.getSheet(sheet).getRow(row).getCell(cell).setCellValue(value); w.write(new FileOutputStream(path)); } catch (Exception e) { e.printStackTrace(); } } public static int getXLRowCount(String path, String sheet) { int count = 0; try { Workbook w = WorkbookFactory.create(new FileInputStream(path)); count = w.getSheet(sheet).getLastRowNum(); } catch (Exception e) { e.printStackTrace(); } return count; } public static void getPhoto(WebDriver driver, String path) { try { TakesScreenshot t =(TakesScreenshot)driver; File srcFile = t.getScreenshotAs(OutputType.FILE); File disFile = new File(path); FileUtils.copyFile(srcFile,disFile); } catch (Exception e) { e.printStackTrace(); } } }
package com.cpro.rxjavaretrofit.views.adapter; import android.support.v7.widget.RecyclerView; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.TextView; import com.cpro.rxjavaretrofit.R; import com.cpro.rxjavaretrofit.constant.InterfaceUrl; import com.cpro.rxjavaretrofit.entity.GroupDetailEntity; import com.nostra13.universalimageloader.core.ImageLoader; import java.util.List; import butterknife.BindView; import butterknife.ButterKnife; /** * Created by lx on 2016/6/15. */ public class GroupAdapter extends RecyclerView.Adapter { List<GroupDetailEntity> list; public void setList(List<GroupDetailEntity> list) { this.list = list; notifyDataSetChanged(); } @Override public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.item_group, parent, false); return new GroupViewHolder(view); } @Override public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) { GroupViewHolder groupViewHolder = (GroupViewHolder) holder; if (null == list.get(position).getImageId()) { ImageLoader.getInstance().displayImage(InterfaceUrl.URL_GET_JSON_HOST_139 + "/resources/images/logo_foot.jpg", groupViewHolder.img_group_photo); } else { ImageLoader.getInstance().displayImage(list.get(position).getImageId(), groupViewHolder.img_group_photo); } groupViewHolder.tv_group_school_name.setText(list.get(position).getGroupNameSchool()); groupViewHolder.tv_group_name.setText(list.get(position).getGroupName()); groupViewHolder.grouId = list.get(position).getGroupId(); } @Override public int getItemCount() { return list == null ? 0 : list.size(); } public static class GroupViewHolder extends RecyclerView.ViewHolder { @BindView(R.id.img_group_photo) ImageView img_group_photo; @BindView(R.id.tv_group_school_name) TextView tv_group_school_name; @BindView(R.id.tv_group_name) TextView tv_group_name; @BindView(R.id.ll_group_base_data) LinearLayout ll_group_base_data; public int grouId; public GroupViewHolder(View itemView) { super(itemView); ButterKnife.bind(this, itemView); ll_group_base_data.getBackground().setAlpha(100); } } }
package Task_2; import java.io.*; import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap; import java.util.concurrent.atomic.AtomicInteger; import java.util.stream.Stream; import static java.util.Arrays.stream; public class Main { public static void main(String[] args) { File file = new File("D:\\Библиотека\\Программирование"); Stream<File> stream = Arrays.stream(file.listFiles()); try(OutputStream outputStream = new FileOutputStream("text.txt")) { for (int i = 0; i < 5; i++) { new Thread(()->{ stream.forEach((file1) -> { String string = file.getName(); for (char char1 : string) outputStream.write(char); }); }).start(); } } catch (IOException e) { e.printStackTrace(); } } }
package com.atakan.app.service; import java.util.List; import javax.transaction.Transactional; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.atakan.app.auth.model.User; import com.atakan.app.dao.CartRepository; import com.atakan.app.store.model.CartItems; import com.atakan.app.store.model.Tshirt; @Service public class CartServiceImpl implements CartService{ @Autowired private CartRepository cartRepository; @Override @Transactional public void save(CartItems cartItem) { cartRepository.save(cartItem); } @Override @Transactional public List<Integer> getItemsByUserId(User user) { return cartRepository.getItemsByUserId(user); } @Override @Transactional public int getTshirtByCartId(int id) { return cartRepository.getTshirtByCartId(id); } @Override @Transactional public CartItems getItem(int id) { return cartRepository.getItem(id); } }
package pe.edu.tecsup.reportesmodasa; import androidx.annotation.NonNull; import androidx.appcompat.app.AppCompatActivity; import androidx.fragment.app.FragmentManager; import androidx.fragment.app.FragmentTransaction; import android.content.Context; import android.content.Intent; import android.content.SharedPreferences; import android.os.Bundle; import android.view.View; import android.widget.Button; import android.widget.EditText; import android.widget.Toast; import com.google.firebase.database.DataSnapshot; import com.google.firebase.database.DatabaseError; import com.google.firebase.database.DatabaseReference; import com.google.firebase.database.FirebaseDatabase; import com.google.firebase.database.ValueEventListener; public class RegistroAccidente extends AppCompatActivity { Button btnSiguiente,btnBuscar; EditText txtDNI,txtEdad,txtNombres,txtArea,txtPuesto,txtSexo,txtContrato,txtExperiencia,nroRegistro,txtTurno,txtHoras_trabajo; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_registro_accidente); getSupportActionBar().hide(); txtDNI=findViewById(R.id.txtDNI); txtEdad=findViewById(R.id.txtEdad); txtNombres=findViewById(R.id.txtNombres); txtArea=findViewById(R.id.txtArea); txtPuesto=findViewById(R.id.txtPuesto); txtSexo=findViewById(R.id.txtSexo); txtContrato=findViewById(R.id.txtContrato); txtExperiencia=findViewById(R.id.txtExperiencia); nroRegistro=findViewById(R.id.nroRegistro); txtTurno=findViewById(R.id.txtTurno); txtHoras_trabajo=findViewById(R.id.txtHoras_trabajo); btnSiguiente=findViewById(R.id.btnSiguiente); btnBuscar=findViewById(R.id.btnBuscar); DatabaseReference databaseReference; databaseReference= FirebaseDatabase.getInstance().getReference(); SharedPreferences preferences=getSharedPreferences("Accidente", Context.MODE_PRIVATE); SharedPreferences.Editor editor=preferences.edit(); btnBuscar.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { databaseReference.child("trabajadores").child(txtDNI.getText().toString()).addValueEventListener(new ValueEventListener() { @Override public void onDataChange(@NonNull DataSnapshot snapshot) { if(snapshot.exists()){ String edad=snapshot.child("EDAD").getValue().toString(); String nombres=snapshot.child("APELLIDOS Y NOMBRES").getValue().toString(); String area=snapshot.child("AREA").getValue().toString(); String puesto=snapshot.child("CARGO").getValue().toString(); String sexo=snapshot.child("SEXO").getValue().toString(); String contrato=snapshot.child("TIPO CONT").getValue().toString(); String experiencia=snapshot.child("TIEMPO SERV").getValue().toString(); txtEdad.setText(edad); txtNombres.setText(nombres); txtArea.setText(area); txtPuesto.setText(puesto); txtSexo.setText(sexo); txtContrato.setText(contrato); txtExperiencia.setText(experiencia); editor.putString("dni",txtDNI.getText().toString()); editor.putString("edad",edad); editor.putString("nombres",nombres); editor.putString("area",area); editor.putString("puesto",puesto); editor.putString("sexo",sexo); editor.putString("contrato",contrato); editor.putString("experiencia",experiencia); editor.commit(); } } @Override public void onCancelled(@NonNull DatabaseError error) { } }); } }); btnSiguiente.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { editor.putString("turno",txtTurno.getText().toString()); editor.putString("horas",txtHoras_trabajo.getText().toString()); editor.putString("codigo",nroRegistro.getText().toString()); editor.commit(); if (txtTurno.getText().toString().isEmpty() || txtHoras_trabajo.getText().toString().isEmpty()|| nroRegistro.getText().toString().isEmpty()) { Toast.makeText(RegistroAccidente.this, "Rellene los datos", Toast.LENGTH_SHORT).show(); }else{ startActivity(new Intent(getApplicationContext(),RegistroAccidente2.class)); finish(); } } }); } }
/** * project name:cdds * file name:FeiginConfiguration * package name:com.cdkj.feign.config * date:2018/7/6 14:30 * author:ywshow * Copyright (c) CD Technology Co.,Ltd. All rights reserved. */ package com.cdkj.config.feign; import feign.Feign; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Scope; /** * description: 接口config <br> * date: 2018/7/6 14:30 * * @author ywshow * @version 1.0 * @since JDK 1.8 */ @Configuration public class FeiginConfiguration { @Bean @Scope("prototype") public Feign.Builder feignBuilder() { return Feign.builder(); } }
package com.hello; public class Test { public static void add() { System.out.println("hello partha"); } }
package org.example.vo; import com.google.gson.annotations.SerializedName; import lombok.Builder; import lombok.Getter; import lombok.ToString; @ToString @Getter public class MemberVO { @SerializedName(value = "MEMBER_SEQ", alternate = {"memberSeq", "memberNo"}) private final String memberSeq; @SerializedName(value = "MEMBER_NAME", alternate = {"memberName", "name"}) private final String memberName; @SerializedName(value = "memberTeam", alternate = "member_team") private final String memberTeam; @Builder public MemberVO(String memberSeq, String memberName, String memberTeam) { this.memberSeq = memberSeq; this.memberName = memberName; this.memberTeam = memberTeam; } }
package ec.edu.upse.modelo; import java.io.Serializable; import javax.persistence.*; import java.util.List; /** * The persistent class for the tbl_sga_periodolectivo database table. * */ @Entity @Table(name="tbl_sga_periodolectivo") @NamedQuery(name="TblSgaPeriodolectivo.findAll", query="SELECT t FROM TblSgaPeriodolectivo t") public class TblSgaPeriodolectivo implements Serializable { private static final long serialVersionUID = 1L; @Id @GeneratedValue(strategy=GenerationType.IDENTITY) @Column(name="per_id") private Integer perId; @Column(name="per_desc") private String perDesc; @Column(name="per_estado") private String perEstado; @Column(name="per_fin") private String perFin; @Column(name="per_inicio") private String perInicio; //bi-directional many-to-one association to TblSgaPeriodonivel @OneToMany(mappedBy="tblSgaPeriodolectivo") private List<TblSgaPeriodonivel> tblSgaPeriodonivels; public TblSgaPeriodolectivo() { } public Integer getPerId() { return this.perId; } public void setPerId(Integer perId) { this.perId = perId; } public String getPerDesc() { return this.perDesc; } public void setPerDesc(String perDesc) { this.perDesc = perDesc; } public String getPerEstado() { return this.perEstado; } public void setPerEstado(String perEstado) { this.perEstado = perEstado; } public String getPerFin() { return this.perFin; } public void setPerFin(String perFin) { this.perFin = perFin; } public String getPerInicio() { return this.perInicio; } public void setPerInicio(String perInicio) { this.perInicio = perInicio; } public List<TblSgaPeriodonivel> getTblSgaPeriodonivels() { return this.tblSgaPeriodonivels; } public void setTblSgaPeriodonivels(List<TblSgaPeriodonivel> tblSgaPeriodonivels) { this.tblSgaPeriodonivels = tblSgaPeriodonivels; } public TblSgaPeriodonivel addTblSgaPeriodonivel(TblSgaPeriodonivel tblSgaPeriodonivel) { getTblSgaPeriodonivels().add(tblSgaPeriodonivel); tblSgaPeriodonivel.setTblSgaPeriodolectivo(this); return tblSgaPeriodonivel; } public TblSgaPeriodonivel removeTblSgaPeriodonivel(TblSgaPeriodonivel tblSgaPeriodonivel) { getTblSgaPeriodonivels().remove(tblSgaPeriodonivel); tblSgaPeriodonivel.setTblSgaPeriodolectivo(null); return tblSgaPeriodonivel; } }
package org.wuxinshui.boosters.concurrent.masterWorker; /** * Copyright [2017$] [Wuxinshui] * <p> * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * <p> * http://www.apache.org/licenses/LICENSE-2.0 * <p> * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ import java.util.Map; import java.util.Queue; /** * Created by wuxinshui on 2017/3/1. */ public class Worker implements Runnable{ //子任务队列,用于取得任务 protected Queue<Object> workQueue; //子任务结果集 protected Map<String,Object> resultMap; public void setWorkQueue(Queue<Object> workQueue) { this.workQueue = workQueue; } public void setResultMap(Map<String, Object> resultMap) { this.resultMap = resultMap; } //子任务的处理逻辑,在子类中实现具体逻辑 public Object handle(Object input){ return input; } @Override public void run() { while (true){ Object input=workQueue.poll(); if (input==null) break;; Object re=handle(input); resultMap.put(Integer.toString(input.hashCode()),re); } } }
package com.jixin.factory.abstract1; public class Client { public static void main(String[] args) { System.out.println("==============小米系列产品=============="); IProductFactory xiaomiFactory = new xiaomiFactory(); IphoneProduct iphoneProduct = xiaomiFactory.iphoenProduct(); iphoneProduct.callup(); iphoneProduct.sendSMS(); IRouterProduct iRouterProduct = xiaomiFactory.routerProduct(); iRouterProduct.openWifi(); iRouterProduct.seting(); System.out.println("===============华为系列产品============="); IProductFactory huaweiFacotry = new HuaweiFactory(); IphoneProduct huaweiProduct1 = huaweiFacotry.iphoenProduct(); huaweiProduct1.sendSMS(); huaweiProduct1.callup(); IphoneProduct huaweiProduct2 = huaweiFacotry.iphoenProduct(); huaweiProduct2.callup(); huaweiProduct2.shutdown(); } }
package br.com.belezanaweb.repository; import br.com.belezanaweb.domain.Produto; import org.springframework.data.mongodb.repository.MongoRepository; public interface ProdutoRepository extends MongoRepository<Produto, Long> { }
package servlets; import java.io.IOException; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.annotation.WebServlet; /** * @author A.Kozinov * date: Oct 15 2020 */ @WebServlet( name = "servlets.WelcomeServlet", description = "description", urlPatterns = {"/loginPageMain"} ) public class WelcomeServlet extends HttpServlet { @Override protected void doGet(HttpServletRequest request, HttpServletResponse response) { try { getServletContext().getRequestDispatcher("/loginPage.jsp").forward(request, response); } catch (ServletException | IOException exception){ System.out.println(exception); } } @Override protected void doPost(HttpServletRequest request, HttpServletResponse response) { //getServletContext().getRequestDispatcher("/old_login.jsp").forward(request, response); } }
// Based on SixGenEngine version b1 // Created by SixKeyStudios package SixGen.Texture; import SixGen.SixUI.Animation.Animation; import java.awt.Graphics; import java.awt.Rectangle; import java.awt.image.BufferedImage; /** * * @author Filip */ public class Background{ public BufferedImage texture; public Animation animation; public int layer; public float multyX; public float multyY; public int width; public int height; public Background(BufferedImage texture ,int width , int height, int layer , float multy) { this(texture , width , height , layer , multy , multy); } public Background(BufferedImage texture , int width , int height , int layer , float multyX , float multyY) { this.texture = texture; this.layer = layer; this.multyX = multyX; this.multyY = multyY; this.width = width; this.height = height; } public void render(int x , int y , int width , int height, Graphics g) { if(animation!=null) { animation.render(g, new Rectangle((int)(x * multyX) , (int)(y * multyY), width , height)); } else { g.drawImage(texture, (int)(x * multyX) , (int)(y * multyY), width , height , null); } } public BufferedImage getTexture() { return texture; } public void setTexture(BufferedImage texture) { this.texture = texture; } public int getLayer() { return layer; } public void setLayer(int layer) { this.layer = layer; } public float getMultyX() { return multyX; } public void setMultyX(float multy) { this.multyX = multy; } public float getMultyY() { return multyY; } public void setMultyY(float multyY) { this.multyY = multyY; } public int getWidth() { return width; } public void setWidth(int width) { this.width = width; } public int getHeight() { return height; } public void setHeight(int height) { this.height = height; } }
public class maroto { public static void main(String[] args) { System.out.println("Maceta"); System.out.println("Maroto"); System.out.println("Comandaxpto1"); System.out.println("Comanda1.0.1"); System.out.println("Comanda-1.0.1"); System.out.println("Comanda 1.0.2"); } }
package com.example.demo.entity; import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; import lombok.Data; import lombok.EqualsAndHashCode; import java.io.Serializable; import java.time.LocalDateTime; /** * <p> * * </p> * * @author zjp * @since 2020-07-28 */ @Data @EqualsAndHashCode(callSuper = false) @TableName("pub_project") public class PubProject implements Serializable { private static final long serialVersionUID = 1L; @TableId(value = "id", type = IdType.AUTO) private Integer id; /** * project_approval表的id */ @TableField("project_approval_id") private Integer projectApprovalId; /** * 单册的编号 */ @TableField("pub_project_num") private String pubProjectNum; /** * 单册名称 */ @TableField("pub_project_name") private String pubProjectName; /** * 出版文件的状态 */ @TableField("state") private String state; /** * 单点的id集合 */ @TableField("single_project_ids") private String singleProjectIds; /** * 月度报表预估产值 */ @TableField("sum_design_money") private Double sumDesignMoney; /** * 出版勘察设计费(降点含税) */ @TableField("publish_money") private Double publishMoney; /** * 偏差/误差 */ @TableField("deviation") private Double deviation; /** * 创建人id */ @TableField("creator_id") private String creatorId; /** * 创建人姓名 */ @TableField("creator_name") private String creatorName; @TableField("change_time") private LocalDateTime changeTime; }
/* * (C) Copyright 2010 Marvell International Ltd. * All Rights Reserved * * MARVELL CONFIDENTIAL * Copyright 2008 ~ 2010 Marvell International Ltd All Rights Reserved. * The source code contained or described herein and all documents related to * the source code ("Material") are owned by Marvell International Ltd or its * suppliers or licensors. Title to the Material remains with Marvell International Ltd * or its suppliers and licensors. The Material contains trade secrets and * proprietary and confidential information of Marvell or its suppliers and * licensors. The Material is protected by worldwide copyright and trade secret * laws and treaty provisions. No part of the Material may be used, copied, * reproduced, modified, published, uploaded, posted, transmitted, distributed, * or disclosed in any way without Marvell's prior express written permission. * * No license under any patent, copyright, trade secret or other intellectual * property right is granted to or conferred upon you by disclosure or delivery * of the Materials, either expressly, by implication, inducement, estoppel or * otherwise. Any license under such intellectual property rights must be * express and approved by Marvell in writing. * */ package com.marvell.cmmb.view.adapter; import java.util.ArrayList; import android.content.Context; import android.view.Gravity; import android.view.View; import android.view.ViewGroup; import android.widget.BaseAdapter; import android.widget.Gallery; import android.widget.TextView; import com.marvell.cmmb.R; import com.marvell.cmmb.resolver.ChannelItem; public class ChannelAdapter extends BaseAdapter { private Context mContext; private int mCurrentPosition = -1; private static final int galleryItemWidth = 120; private static final int galleryItemHeight = 35; ArrayList<ChannelItem> mChannelList; public ChannelAdapter(Context c) { mContext = c; } public int getCount() { return mChannelList == null ? 0 : mChannelList.size(); } public Object getItem(int position) { return position; } public long getItemId(int position) { return position; } public View getView(int position, View convertView, ViewGroup parent) { TextView channelTextView = new TextView(mContext); if (mChannelList != null && mChannelList.size() > position) { channelTextView.setText(mChannelList.get(position).getChannelName()); channelTextView.setId(position); channelTextView.setLayoutParams(new Gallery.LayoutParams( galleryItemWidth, galleryItemHeight)); channelTextView.setGravity(Gravity.CENTER); if (mCurrentPosition == position) { channelTextView.setTextColor(mContext.getResources().getColor(R.color.solid_white)); channelTextView.setBackgroundResource(R.drawable.channel_selected); } else { channelTextView.setTextColor(mContext.getResources().getColor(R.color.solid_gray)); channelTextView.setBackgroundResource(R.drawable.channel_default); } } return channelTextView; } public void setCurrentPosition(int position) { this.mCurrentPosition = position; } public void setData(ArrayList<ChannelItem> channelList) { this.mChannelList = channelList; } }
package com.example.model; import org.springframework.data.domain.Persistable; public class Project implements Persistable<Long>{ private static final long serialVersionUID = 8691351324070609515L; private long pid; private String projectName; private String projectOwner; public Project() { } public Project(long pid, String projectName, String projectOwner) { this.pid = pid; this.projectName = projectName; this.projectOwner = projectOwner; } @Override public Long getId() { return pid; } public String getProjectName() { return projectName; } public void setProjectName(String projectName) { this.projectName = projectName; } public String getProjectOwner() { return projectOwner; } public void setProjectOwner(String projectOwner) { this.projectOwner = projectOwner; } @Override public boolean isNew() { // TODO Handle this in the future in the controller return true; } }
package com.example.administrator.coolweather; import android.content.Intent; import android.content.SharedPreferences; import android.graphics.Color; import android.os.Build; import android.os.Bundle; import android.preference.PreferenceManager; import android.support.v4.view.GravityCompat; import android.support.v4.widget.DrawerLayout; import android.support.v4.widget.SwipeRefreshLayout; import android.support.v7.app.AppCompatActivity; import android.view.LayoutInflater; import android.view.View; import android.widget.Button; import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.ScrollView; import android.widget.TextView; import android.widget.Toast; import com.example.administrator.coolweather.gson.Forecast; import com.example.administrator.coolweather.gson.Weather; import com.example.administrator.coolweather.service.AutoUpdateService; import com.example.administrator.coolweather.util.HttpUtil; import com.example.administrator.coolweather.util.Utility; import java.io.IOException; import okhttp3.Call; import okhttp3.Callback; import okhttp3.Response; // TODO 返回键可以返回选择城市列表,而不是直接退出程序。drawer的标题栏太高,不美观 public class WeatherActivity extends AppCompatActivity { public SwipeRefreshLayout swipeRefreshLayout; private String mWeatherId; private Weather mWeather; private ScrollView weatherLayout; private TextView titleCity; private TextView titleUpdateTime; private TextView degreeText; private TextView weatherInfoText; // 预报子项的布局,在forecast.xml中引入的LinearLayout private LinearLayout forecastLayout; private TextView aqiText; private TextView pm25Text; private TextView comfortText; private TextView carWashText; private TextView sportText; private ImageView picView; private ImageView weatherImgView; public DrawerLayout drawerLayout; private Button navButton; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); if (Build.VERSION.SDK_INT >= 21) { View decorView = getWindow().getDecorView(); decorView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_STABLE // 防止系统栏隐藏时内容区域大小发生变化 | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN); getWindow().setStatusBarColor(Color.TRANSPARENT); } setContentView(R.layout.activity_weather); // 初始化各个控件 drawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout); navButton = (Button) findViewById(R.id.nav_button); picView = (ImageView) findViewById(R.id.pic_img_view); weatherImgView = (ImageView) findViewById(R.id.weather_img); weatherLayout = (ScrollView) findViewById(R.id.weather_scroll_view); titleCity = (TextView) findViewById(R.id.city_title); titleUpdateTime = (TextView) findViewById(R.id.title_update_time); degreeText = (TextView) findViewById(R.id.degree_text); weatherInfoText = (TextView) findViewById(R.id.weather_info_text); forecastLayout = (LinearLayout) findViewById(R.id.forecast_layout); aqiText = (TextView) findViewById(R.id.aqi_text); pm25Text = (TextView) findViewById(R.id.pm25_text); comfortText = (TextView) findViewById(R.id.comfort_text); carWashText = (TextView) findViewById(R.id.carwash_text); sportText = (TextView) findViewById(R.id.sport_text); swipeRefreshLayout = (SwipeRefreshLayout) findViewById(R.id.swipe_refresh); swipeRefreshLayout.setColorSchemeResources(R.color.colorPrimary); SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(this); // 没有该键,就返回null String weatherString = preferences.getString("weather", null); if (weatherString != null) { // 有缓存时直接解析天气数据,每次打开程序就自动更新 mWeather = Utility.handleWeatherResponse(weatherString); mWeatherId = mWeather.basic.weatherId; // 这里会开启服务,这时开始更新数据 showWeatherInfo(mWeather); // 服务随时可能被kill掉,若不加这句,每次进入应用可能都需要手动刷新 // requestWeather(mWeatherId); // 无法缓存时去服务器查询 } else { // 只有第一次选择城市的时候回进入这个条件,之后都会从SharedPreferences读取最新选择的城市 mWeatherId = getIntent().getStringExtra("weather_id"); // 请求数据过程中,讲ScrollView设置为不可见。因为还没数据,显示无用 weatherLayout.setVisibility(View.INVISIBLE); requestWeather(mWeatherId); } navButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { drawerLayout.openDrawer(GravityCompat.START); } }); swipeRefreshLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() { @Override public void onRefresh() { // 上次请求已经保存了最新的weatherId.若没有切换城市每次刷新都是刷新当前 requestWeather(mWeatherId); } }); // // 先试着从本地加载图片 // String bingPic = preferences.getString("bing_pic", null); // if (bingPic != null) { // } else { // loadBingPic(); // } drawerLayout.addDrawerListener(new DrawerLayout.SimpleDrawerListener() { @Override public void onDrawerOpened(View drawerView) { if (Build.VERSION.SDK_INT >= 21) { View decorView = getWindow().getDecorView(); decorView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | View.SYSTEM_UI_FLAG_FULLSCREEN); getWindow().setStatusBarColor(Color.TRANSPARENT); } } @Override public void onDrawerClosed(View drawerView) { if (Build.VERSION.SDK_INT >= 21) { View decorView = getWindow().getDecorView(); decorView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_STABLE // 防止系统栏隐藏时内容区域大小发生变化 | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN); getWindow().setStatusBarColor(Color.TRANSPARENT); } } }); } /** * 重写返回键监听 * 当drawer打开时候,功能和上面的返回键一样。不过当前等级为省份时候,关闭drawer回到天气界面 * 当drawer已经关闭的状态,再次按下返回键,退出程序 */ @Override public void onBackPressed() { ChooseAreaFragment drawerFragment = (ChooseAreaFragment) getSupportFragmentManager().findFragmentById(R.id.drawer_choose_area_fragment); if (drawerLayout.isDrawerOpen(R.id.drawer_choose_area_fragment)) { if (ChooseAreaFragment.currentLevel == ChooseAreaFragment.LEVEL_COUNTRY) { drawerFragment.queryCities(); } else if (ChooseAreaFragment.currentLevel == ChooseAreaFragment.LEVEL_CITY) { drawerFragment.queryProvinces(); } else if (ChooseAreaFragment.currentLevel == ChooseAreaFragment.LEVEL_PROVINCE) { drawerLayout.closeDrawers(); } } else { super.onBackPressed(); } } private void loadPic(Weather weather) { String info = weather.now.more.info; if (info.substring(info.length() - 1, info.length()).equals("晴")) { picView.setImageResource(R.drawable.sunny10); weatherImgView.setImageResource(R.drawable.sunny20); } else if (info.substring(info.length() - 1, info.length()).equals("云")) { picView.setImageResource(R.drawable.clondy10); weatherImgView.setImageResource(R.drawable.cloundy20); } else if (info.substring(info.length() - 1, info.length()).equals("雨")) { picView.setImageResource(R.drawable.rainy10); weatherImgView.setImageResource(R.drawable.rainy20); } else if (info.substring(info.length() - 1, info.length()).equals("阴")) { picView.setImageResource(R.drawable.overcast10); weatherImgView.setImageResource(R.drawable.overcast20); } else if (info.substring(info.length() - 1, info.length()).equals("霾")) { picView.setImageResource(R.drawable.haze10); weatherImgView.setImageResource(R.drawable.haze20); } else if (info.substring(info.length() - 1, info.length()).equals("雪")) { picView.setImageResource(R.drawable.snowy10); weatherImgView.setImageResource(R.drawable.snow20); } else if (info.substring(info.length() - 1, info.length()).equals("雾")) { picView.setImageResource(R.drawable.fog10); weatherImgView.setImageResource(R.drawable.fog20); } else if (info.substring(info.length() - 1, info.length()).equals("风")) { picView.setImageResource(R.drawable.windy10); weatherImgView.setImageResource(R.drawable.windy20); } else if (info.contains("沙") || info.contains("尘")) { picView.setImageResource(R.drawable.sand10); weatherImgView.setImageResource(R.drawable.sand20); } else if (info.contains("冰")) { picView.setImageResource(R.drawable.snowy10); weatherImgView.setImageResource(R.drawable.ice20); } else { picView.setImageResource(R.drawable.default_pic10); } } // /** // * 加载Bing每日一图 // */ // // private void loadBingPic() { // String requestBingPicUrl = "http://guolin.tech/api/bing_pic"; // HttpUtil.sendOkHttpRequest(requestBingPicUrl, new Callback() { // @Override // public void onFailure(Call call, IOException e) { // e.printStackTrace(); // } // // @Override // public void onResponse(Call call, Response response) throws IOException { // final String bingPic = response.body().string(); // SharedPreferences.Editor editor = PreferenceManager.getDefaultSharedPreferences(WeatherActivity.this).edit(); // editor.putString("bing_pic", bingPic); // editor.apply(); // runOnUiThread(new Runnable() { // @Override // public void run() { // Glide.with(WeatherActivity.this).load(bingPic).into(picView); // } // }); // } // }); // } /** * 根据天气id来请求天气数据 * * @param weatherId 天气id */ public void requestWeather(String weatherId) { String weatherUrl = "http://guolin.tech/api/weather?cityid=" + weatherId + "&key=b4a2ae648cc34289a145471385286b95"; HttpUtil.sendOkHttpRequest(weatherUrl, new Callback() { @Override public void onFailure(Call call, IOException e) { e.printStackTrace(); runOnUiThread(new Runnable() { @Override public void run() { Toast.makeText(WeatherActivity.this, "获取天气信息失败", Toast.LENGTH_SHORT).show(); swipeRefreshLayout.setRefreshing(false); } }); } @Override public void onResponse(Call call, Response response) throws IOException { final String responseText = response.body().string(); // responseText是从服务器返回的,上面那个weatherString是从preference里读取的 mWeather = Utility.handleWeatherResponse(responseText); // 显示天气,牵涉到UI操作,切换到主线程 runOnUiThread(new Runnable() { @Override public void run() { if (mWeather != null && "ok".equals(mWeather.status)) { SharedPreferences.Editor editor = PreferenceManager.getDefaultSharedPreferences(WeatherActivity.this).edit(); editor.putString("weather", responseText); editor.apply(); // 每请求一次就保存当前城市的ID mWeatherId = mWeather.basic.weatherId; showWeatherInfo(mWeather); } else { Toast.makeText(WeatherActivity.this, "获取天气信息失败", Toast.LENGTH_SHORT).show(); } swipeRefreshLayout.setRefreshing(false); } }); } }); // 每次请求天气数据的时候,也请求图片 } /** * 显示天气信息到 * * @param weather Weather实例 */ private void showWeatherInfo(Weather weather) { if (weather != null && weather.status.equals("ok")) { // title.xml now.xml中的内容 String cityName = weather.basic.cityName; // 只取时间不取日期,2017.3.23 15:03,以空格分割,取第二个 String updateTime = "更新于" + weather.basic.update.updateTime.split(" ")[1]; String degree = weather.now.temperature + "℃"; String weatherInfo = weather.now.more.info; titleCity.setText(cityName); titleUpdateTime.setText(updateTime); degreeText.setText(degree); weatherInfoText.setText(weatherInfo); // forecast.xml中的内容 forecastLayout.removeAllViews(); // 更新预报时先清空所有view for (Forecast forecast : weather.forecastList) { View view = LayoutInflater.from(this).inflate(R.layout.forecast_item, forecastLayout, false); TextView dateText = (TextView) view.findViewById(R.id.item_data_text); TextView infoText = (TextView) view.findViewById(R.id.item_info_text); TextView maxAndMinText = (TextView) view.findViewById(R.id.item_min_max_text); String date = forecast.date.split("-")[1] + "月" + forecast.date.split("-")[2] + "日"; dateText.setText(date); infoText.setText(forecast.more.info); String maxAndMinDegree = forecast.temperature.max + "℃ / " + forecast.temperature.min + "℃"; maxAndMinText.setText(maxAndMinDegree); forecastLayout.addView(view); } if (weather.aqi != null) { aqiText.setTextSize(40); pm25Text.setTextSize(40); aqiText.setText(weather.aqi.city.aqi); pm25Text.setText(weather.aqi.city.pm25); } else { aqiText.setTextSize(24); pm25Text.setTextSize(24); aqiText.setText("暂无"); pm25Text.setText("暂无"); } String comfort = "舒适度:" + weather.suggestion.comfort.info; String carWash = "洗车指数:" + weather.suggestion.carWash.info; String sport = "运动指数:" + weather.suggestion.sport.info; comfortText.setText(comfort); carWashText.setText(carWash); sportText.setText(sport); // 加载图片 loadPic(mWeather); // 天气信息加载好后显示 weatherLayout.setVisibility(View.VISIBLE); // 每次应用启动会调用showWeatherInfo方法,在这里启动服务,保证每次进来都是更新过的数据 Intent intent = new Intent(this, AutoUpdateService.class); startService(intent); } else { Toast.makeText(WeatherActivity.this, "获取天气信息失败", Toast.LENGTH_SHORT).show(); } } }
package com.itheima.exam.Test_01; import java.io.*; import java.net.ServerSocket; import java.net.Socket; public class UpServer { public static void main(String[] args) throws IOException { ServerSocket ss = new ServerSocket(10010); while (true) { Socket s = ss.accept(); new Thread() { @Override public void run() { try { BufferedInputStream bis = new BufferedInputStream(s.getInputStream()); BufferedOutputStream bos = new BufferedOutputStream( new FileOutputStream(System.currentTimeMillis() + ".txt")); byte[] bytes = new byte[1024 * 8]; int len; while ((len = bis.read(bytes))!= -1) { bos.write(bytes, 0, len); bos.flush(); } BufferedWriter bwServer = new BufferedWriter( new OutputStreamWriter(s.getOutputStream())); bwServer.write("上传成功"); bwServer.newLine(); bwServer.flush(); bos.close(); bis.close(); } catch (IOException e) { e.printStackTrace(); }finally { try { s.close(); } catch (IOException e) { e.printStackTrace(); } } } }.start(); } } }
package Controllers; import javax.validation.Valid; import org.springframework.stereotype.Controller; import org.springframework.validation.BindingResult; import org.springframework.web.bind.annotation.ModelAttribute; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.servlet.ModelAndView; import Model.student; @Controller public class mycontroller { @RequestMapping(value="/aform.html", method=RequestMethod.GET) public ModelAndView show(){ ModelAndView mobj = new ModelAndView("admissionform"); return mobj; } @RequestMapping(value="/submitform.html",method=RequestMethod.POST) public ModelAndView storeform(@Valid @ModelAttribute("objx") student obj, BindingResult br){ //@Valid annotation is used to valid the properties of model variable,if value is not validated then it creates binding result error which will be caught in below if-else if(br.hasErrors()){ ModelAndView mvobj = new ModelAndView("admissionform"); return mvobj; } System.out.println("id: "+obj.getSid()+" and name:"+obj.getSname()); ModelAndView mvobj = new ModelAndView("submitresponse"); return mvobj; } }
package hilosDelJuego; import interfazDelJuego.JVentanaGrafica; import logicaJuego.Bomberman; import logicaJuego.Mapa; import logicaJuego.Bloque; import java.util.ArrayList; import hilosDelJuego.Bombita; import logicaJuego.Bomba; public class IA extends Thread { private Bomberman bomber; private Mapa mapa; private Bombita hiloBomba; private int posXVieja; private int posYVieja; private ArrayList<Bomba> bombas; private int cont; private AlejarseBomba hiloAlejarse; private boolean andando; public IA(JVentanaGrafica ventana) { this.bomber = ventana.getNuevo().getJugadoresLocal().get(1); this.mapa = ventana.getNuevo(); cont = 0; andando = true; } public void run() { while (andando == true) { bombas = new ArrayList<Bomba>(); bomber.setNombre("tomi"); if (bomber.isVivo() == false) { bomber.setVelX(0); bomber.setVelY(0); } if (mapa.getPosicionMapa(bomber.getPosX(), bomber.getPosY()).esBomba()) { bombas.add(((Bomba) mapa.getPosicionMapa(bomber.getPosX(), bomber.getPosY()))); } for (int i = -4; i < 5; i++) { if (i != 0) { if ((bomber.getPosX() + i) <= 9 && (bomber.getPosX() + i) >= 1) { if (mapa.getPosicionMapa(bomber.getPosX() + i, bomber.getPosY()).esBomba()) { if (((Bomba) mapa.getPosicionMapa(bomber.getPosX() + i, bomber.getPosY())) .getRango() >= Math.abs(i)) bombas.add(((Bomba) mapa.getPosicionMapa(bomber.getPosX() + i, bomber.getPosY()))); } } if ((bomber.getPosY() + i) <= 13 && (bomber.getPosY() + i) >= 1) { if (mapa.getPosicionMapa(bomber.getPosX(), bomber.getPosY() + i).esBomba()) { if (((Bomba) mapa.getPosicionMapa(bomber.getPosX(), bomber.getPosY() + i)) .getRango() >= Math.abs(i)) bombas.add(((Bomba) mapa.getPosicionMapa(bomber.getPosX(), bomber.getPosY() + i))); } } } } if (bombas.size() == 0) this.perseguir(); for (int i = 0; i < bombas.size(); i++) { int posXVieja = bomber.getPosX(); int posYVieja = bomber.getPosY(); int x = bombas.get(i).getX(); int y = bombas.get(i).getY(); int xB = bomber.getPosX(); int yB = bomber.getPosY(); // int posiblesMovDer[][] = { { xB + 1, yB }, { xB + 2, yB }, { xB + 2, yB + 1 }, { xB + 2, yB - 1 } }; // int posiblesMovIzq[][] = { { xB - 1, yB }, { xB - 2, yB }, { xB - 2, yB + 1 }, { xB - 2, yB - 1 } }; // int posibleMovAbajo[][] = { { xB, yB + 1 }, { xB, yB + 2 }, { xB - 1, yB + 2 }, { xB + 1, yB + 2 } }; // int posiblesMovArriba[][] = { { xB, yB - 1 }, { xB, yB - 2 }, { xB - 1, yB - 2 }, { xB + 1, yB - 2 } }; // boolean banderin=false; // if (y == bomber.getPosY() && x == bomber.getPosX()) { // if (xB + 2 <= 9 && yB + 1 <= 13) { // if (mapa.getPosicionMapa(xB + 1, yB).esBloque() && mapa.getPosicionMapa(xB + 2, yB).esBloque() // && mapa.getPosicionMapa(xB + 2, yB + 1).esBloque()) { // // if (((Bloque) mapa.getPosicionMapa(xB + 1, yB)).queTipo().equals("transitable") // && ((Bloque) mapa.getPosicionMapa(xB + 2, yB)).queTipo().equals("transitable") // && ((Bloque) mapa.getPosicionMapa(xB + 2, yB + 1)).queTipo() // .equals("transitable")) { // this.moverse(2, 1, "der", "abajo"); // banderin = true; // } // } // } // // if (xB + 2 <= 9 && yB - 1 >= 0 && banderin == false) { // if (mapa.getPosicionMapa(xB + 1, yB).esBloque() && mapa.getPosicionMapa(xB + 2, yB).esBloque() // && mapa.getPosicionMapa(xB + 2, yB - 1).esBloque()) { // if (((Bloque) mapa.getPosicionMapa(xB + 1, yB)).queTipo().equals("transitable") // && ((Bloque) mapa.getPosicionMapa(xB + 2, yB)).queTipo().equals("transitable") // && ((Bloque) mapa.getPosicionMapa(xB + 2, yB - 1)).queTipo() // .equals("transitable")) { // this.moverse(2, 1, "der", "arriba"); // banderin = true; // } // } // } // } if (y == bomber.getPosY()) { if (mapa.getPosicionMapa(bomber.getPosX(), bomber.getPosY() - 1).esBloque()) if (((Bloque) mapa.getPosicionMapa(bomber.getPosX(), bomber.getPosY() - 1)).queTipo() .equals("transitable")) bomber.setVelY(-bomber.getVelocidad()); else { if (mapa.getPosicionMapa(bomber.getPosX(), bomber.getPosY() + 1).esBloque()) if (((Bloque) mapa.getPosicionMapa(bomber.getPosX(), bomber.getPosY() + 1)).queTipo() .equals("transitable")) bomber.setVelY(+bomber.getVelocidad()); else { if (bombas.get(i).getX() > bomber.getPosX()) { hiloAlejarse = new AlejarseBomba(bomber, bombas.get(i), "izq", this, mapa); hiloAlejarse.start(); } else { hiloAlejarse = new AlejarseBomba(bomber, bombas.get(i), "der", this, mapa); hiloAlejarse.start(); } } } } if (x == bomber.getPosX()) { if (mapa.getPosicionMapa(bomber.getPosX() - 1, bomber.getPosY()).esBloque()) if (((Bloque) mapa.getPosicionMapa(bomber.getPosX() - 1, bomber.getPosY())).queTipo() .equals("transitable")) bomber.setVelX(-bomber.getVelocidad()); else { if (mapa.getPosicionMapa(bomber.getPosX() + 1, bomber.getPosY()).esBloque()) if (((Bloque) mapa.getPosicionMapa(bomber.getPosX() + 1, bomber.getPosY())).queTipo() .equals("transitable")) bomber.setVelX(+bomber.getVelocidad()); else { if (bombas.get(i).getY() > bomber.getPosY()) { hiloAlejarse = new AlejarseBomba(bomber, bombas.get(i), "arriba", this, mapa); hiloAlejarse.start(); } else { hiloAlejarse = new AlejarseBomba(bomber, bombas.get(i), "abajo", this, mapa); hiloAlejarse.start(); } } } } try { Thread.sleep(300); } catch (InterruptedException e) { e.printStackTrace(); } if (bomber.getPosX() != posXVieja) bomber.setVelX(0); if (bomber.getPosY() != posYVieja) bomber.setVelY(0); } if (mapa.getPosicionMapa(bomber.getPosX(), bomber.getPosY() - 1).esBloque()) {// si hay fuego arriba // para if (((Bloque) mapa.getPosicionMapa(bomber.getPosX(), bomber.getPosY() - 1)).queTipo().equals("fuego") || ((Bloque) mapa.getPosicionMapa(bomber.getPosX(), bomber.getPosY() - 1)).queTipo() .equals("fuegoPiedra")) { bomber.setVelY(0); } } if (mapa.getPosicionMapa(bomber.getPosX(), bomber.getPosY() - 1).esBloque()) { if (((Bloque) mapa.getPosicionMapa(bomber.getPosX(), bomber.getPosY() - 1)).queTipo() .equals("piedra")) { // si choca con una piedra arriba : hiloBomba = new Bombita(bomber, mapa); hiloBomba.start();// pone una bomba posXVieja = bomber.getPosX(); posYVieja = bomber.getPosY(); } } try { Thread.sleep(100); } catch (InterruptedException e) { e.printStackTrace(); } } } public void moverse(int x, int y, String dir1, String dir2) { int xDeseada = bomber.getPosX() + x; int yDeseada = bomber.getPosY() + y; while (bomber.getPosY() != yDeseada && bomber.getPosX() != xDeseada) { switch (dir1) { case "arriba": while (bomber.getPosY() != yDeseada) bomber.setVelY(-bomber.getVelocidad()); break; case "abajo": while (bomber.getPosY() != yDeseada) bomber.setVelY(+bomber.getVelocidad()); break; case "izq": while (bomber.getPosX() != xDeseada) bomber.setVelX(-bomber.getVelocidad()); break; case "der": while (bomber.getPosX() != xDeseada) bomber.setVelX(+bomber.getVelocidad()); break; } ; switch (dir2) { case "arriba": while (bomber.getPosY() != yDeseada) bomber.setVelY(-bomber.getVelocidad()); break; case "abajo": while (bomber.getPosY() != yDeseada) bomber.setVelY(+bomber.getVelocidad()); break; case "izq": while (bomber.getPosX() != xDeseada) bomber.setVelX(-bomber.getVelocidad()); break; case "der": while (bomber.getPosX() != xDeseada) bomber.setVelX(+bomber.getVelocidad()); break; } ; } } public void perseguir() { Bomberman bomber2 = mapa.getJugadoresLocal().get(0); System.out.println("estoy persiguiendo"); ArrayList<Bomba> bombasas = new ArrayList<Bomba>(); bomber.setVelX(0); bomber.setVelY(0); double posYVieja=-111; while (bomber.getPosGrafY() != bomber2.getPosGrafY() && bombasas.isEmpty() == true && posYVieja!=bomber.getPosGrafY()) { posYVieja=bomber.getPosGrafY(); if (mapa.getPosicionMapa(bomber.getPosX(), bomber.getPosY()).esBomba()) { bombasas.add(((Bomba) mapa.getPosicionMapa(bomber.getPosX(), bomber.getPosY()))); } for (int i = -4; i < 5; i++) { if (i != 0) { if ((bomber.getPosX() + i) <= 9 && (bomber.getPosX() + i) >= 1) { if (mapa.getPosicionMapa(bomber.getPosX() + i, bomber.getPosY()).esBomba()) { if (((Bomba) mapa.getPosicionMapa(bomber.getPosX() + i, bomber.getPosY())) .getRango() >= Math.abs(i)) bombasas.add(((Bomba) mapa.getPosicionMapa(bomber.getPosX() + i, bomber.getPosY()))); } } if ((bomber.getPosY() + i) <= 13 && (bomber.getPosY() + i) >= 1) { if (mapa.getPosicionMapa(bomber.getPosX(), bomber.getPosY() + i).esBomba()) { if (((Bomba) mapa.getPosicionMapa(bomber.getPosX(), bomber.getPosY() + i)) .getRango() >= Math.abs(i)) bombasas.add(((Bomba) mapa.getPosicionMapa(bomber.getPosX(), bomber.getPosY() + i))); } } } } try { Thread.sleep(20); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } if (bomber.getPosGrafY() < bomber2.getPosGrafY()) { if (mapa.getPosicionMapa(bomber.getPosX(), bomber.getPosY() + 1).esBloque()) { if (((Bloque) mapa.getPosicionMapa(bomber.getPosX(), bomber.getPosY() + 1)).queTipo() .equals("transitable")) { bomber.setVelY(bomber.getVelocidad()); } else { if(bomber.getPosX()==bomber2.getPosX()) { if(mapa.getPosicionMapa(bomber.getPosX()-1, bomber.getPosY()).esBloque()) { if(((Bloque)mapa.getPosicionMapa(bomber.getPosX()-1, bomber.getPosY())).queTipo().equals("transitable")) { if(mapa.getPosicionMapa(bomber.getPosX()-1, bomber.getPosY()+1).esBloque()) { if(((Bloque)mapa.getPosicionMapa(bomber.getPosX()-1, bomber.getPosY()+1)).queTipo().equals("transitable")){ int posXviejarda=bomber.getPosX(); int posYviejarda=bomber.getPosY(); while(((posXviejarda*40) -(40)) <= (bomber.getPosX()*40) && ((posYviejarda*40)+40) >= (bomber.getPosY()*40) ) { if(posYviejarda!=bomber.getPosY()) { bomber.setVelX(0); } else bomber.setVelX(-bomber.getVelocidad()); bomber.setVelY(bomber.getVelocidad()); try { Thread.sleep(20); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } } } } } } else if(mapa.getPosicionMapa(bomber.getPosX()+1, bomber.getPosY()).esBloque()) { if(((Bloque)mapa.getPosicionMapa(bomber.getPosX()+1, bomber.getPosY())).queTipo().equals("transitable")) { if(mapa.getPosicionMapa(bomber.getPosX()+1, bomber.getPosY()+1).esBloque()) { if(((Bloque)mapa.getPosicionMapa(bomber.getPosX()+1, bomber.getPosY()+1)).queTipo().equals("transitable")){ int posXviejarda=bomber.getPosX(); int posYviejarda=bomber.getPosY(); while(((posXviejarda*40) +(40)) >=(bomber.getPosX()*40) && ((posYviejarda*40)+40) >= (bomber.getPosY()*40) ) { if(posYviejarda!=bomber.getPosY()) { bomber.setVelX(0); } else bomber.setVelX(+bomber.getVelocidad()); bomber.setVelY(bomber.getVelocidad()); try { Thread.sleep(20); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } } } } } } } } } } if (bomber.getPosGrafY() > bomber2.getPosGrafY()) { if (mapa.getPosicionMapa(bomber.getPosX(), bomber.getPosY() - 1).esBloque()) if (((Bloque) mapa.getPosicionMapa(bomber.getPosX(), bomber.getPosY() - 1)).queTipo() .equals("transitable")) { bomber.setVelY(-bomber.getVelocidad()); } else { if(bomber.getPosX()==bomber2.getPosX()) { if(mapa.getPosicionMapa(bomber.getPosX()-1, bomber.getPosY()).esBloque()) { if(((Bloque)mapa.getPosicionMapa(bomber.getPosX()-1, bomber.getPosY())).queTipo().equals("transitable")) { if(mapa.getPosicionMapa(bomber.getPosX()-1, bomber.getPosY()-1).esBloque()) { if(((Bloque)mapa.getPosicionMapa(bomber.getPosX()-1, bomber.getPosY()-1)).queTipo().equals("transitable")){ int posXviejarda=bomber.getPosX(); int posYviejarda=bomber.getPosY(); while(((posXviejarda*40) -(40)) <= (bomber.getPosX()*40) && ((posYviejarda*40)-40) <= (bomber.getPosY()*40) ) { if(posYviejarda!=bomber.getPosY()) { bomber.setVelX(0); } else bomber.setVelX(-bomber.getVelocidad()); bomber.setVelY(-bomber.getVelocidad()); try { Thread.sleep(20); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } } } } } } else if(mapa.getPosicionMapa(bomber.getPosX()+1, bomber.getPosY()).esBloque()) { if(((Bloque)mapa.getPosicionMapa(bomber.getPosX()+1, bomber.getPosY())).queTipo().equals("transitable")) { if(mapa.getPosicionMapa(bomber.getPosX()+1, bomber.getPosY()-1).esBloque()) { if(((Bloque)mapa.getPosicionMapa(bomber.getPosX()+1, bomber.getPosY()-1)).queTipo().equals("transitable")){ int posXviejarda=bomber.getPosX(); int posYviejarda=bomber.getPosY(); while(((posXviejarda*40) +(40)) >=(bomber.getPosX()*40) && ((posYviejarda*40)-40) <= (bomber.getPosY()*40) ) { if(posYviejarda!=bomber.getPosY()) { bomber.setVelX(0); } else bomber.setVelX(+bomber.getVelocidad()); bomber.setVelY(-bomber.getVelocidad()); try { Thread.sleep(20); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } } } } } } } } } try { Thread.sleep(20); } catch (InterruptedException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } } bomber.setVelX(0); bomber.setVelY(0); bombasas.clear(); double posXVieja=-11; while (bomber.getPosGrafX() != bomber2.getPosGrafX() && bombasas.isEmpty() == true && posXVieja!=bomber.getPosGrafX()) { posXVieja=bomber.getPosGrafX(); if (mapa.getPosicionMapa(bomber.getPosX(), bomber.getPosY()).esBomba()) { bombasas.add(((Bomba) mapa.getPosicionMapa(bomber.getPosX(), bomber.getPosY()))); } for (int i = -4; i < 5; i++) { if (i != 0) { if ((bomber.getPosX() + i) <= 9 && (bomber.getPosX() + i) >= 1) { if (mapa.getPosicionMapa(bomber.getPosX() + i, bomber.getPosY()).esBomba()) { if (((Bomba) mapa.getPosicionMapa(bomber.getPosX() + i, bomber.getPosY())) .getRango() >= Math.abs(i)) bombasas.add(((Bomba) mapa.getPosicionMapa(bomber.getPosX() + i, bomber.getPosY()))); } } if ((bomber.getPosY() + i) <= 13 && (bomber.getPosY() + i) >= 1) { if (mapa.getPosicionMapa(bomber.getPosX(), bomber.getPosY() + i).esBomba()) { if (((Bomba) mapa.getPosicionMapa(bomber.getPosX(), bomber.getPosY() + i)) .getRango() >= Math.abs(i)) bombasas.add(((Bomba) mapa.getPosicionMapa(bomber.getPosX(), bomber.getPosY() + i))); } } } } try { Thread.sleep(20); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } if (bomber.getPosGrafX() < bomber2.getPosGrafX()) { if (mapa.getPosicionMapa(bomber.getPosX() + 1, bomber.getPosY()).esBloque()) if (((Bloque) mapa.getPosicionMapa(bomber.getPosX() + 1, bomber.getPosY())).queTipo() .equals("transitable")) { bomber.setVelX(bomber.getVelocidad()); } else { if(bomber.getPosY()==bomber2.getPosY()) { if(mapa.getPosicionMapa(bomber.getPosX(), bomber.getPosY()-1).esBloque()) { if(((Bloque)mapa.getPosicionMapa(bomber.getPosX()+1, bomber.getPosY()-1)).queTipo().equals("transitable")) { if(mapa.getPosicionMapa(bomber.getPosX()+1, bomber.getPosY()-1).esBloque()) { if(((Bloque)mapa.getPosicionMapa(bomber.getPosX()+1, bomber.getPosY()-1)).queTipo().equals("transitable")){ int posXviejarda=bomber.getPosX(); int posYviejarda=bomber.getPosY(); while(((posYviejarda*40) -(40)) <= (bomber.getPosY()*40) && ((posXviejarda*40)+40) >= (bomber.getPosX()*40) ) { if(posXviejarda!=bomber.getPosX()) { bomber.setVelY(0); } else bomber.setVelY(-bomber.getVelocidad()); bomber.setVelX(bomber.getVelocidad()); try { Thread.sleep(20); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } } } } } } else if(((Bloque)mapa.getPosicionMapa(bomber.getPosX()+1, bomber.getPosY()+1)).queTipo().equals("transitable")) { if(mapa.getPosicionMapa(bomber.getPosX()+1, bomber.getPosY()+1).esBloque()) { if(((Bloque)mapa.getPosicionMapa(bomber.getPosX()+1, bomber.getPosY()+1)).queTipo().equals("transitable")){ int posXviejarda=bomber.getPosX(); int posYviejarda=bomber.getPosY(); while(((posYviejarda*40) +(40)) >= (bomber.getPosY()*40) && ((posXviejarda*40)+40) >= (bomber.getPosX()*40) ) { if(posXviejarda!=bomber.getPosX()) { bomber.setVelY(0); } else bomber.setVelY(+bomber.getVelocidad()); bomber.setVelX(bomber.getVelocidad()); try { Thread.sleep(20); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } } } } } } } } if (bomber.getPosGrafX() > bomber2.getPosGrafX()) { if (mapa.getPosicionMapa(bomber.getPosX() - 1, bomber.getPosY()).esBloque()) { if (((Bloque) mapa.getPosicionMapa(bomber.getPosX() - 1, bomber.getPosY())).queTipo() .equals("transitable")) { bomber.setVelX(-bomber.getVelocidad()); } else { if(bomber.getPosY()==bomber2.getPosY()) { if(mapa.getPosicionMapa(bomber.getPosX(), bomber.getPosY()-1).esBloque()) { if(((Bloque)mapa.getPosicionMapa(bomber.getPosX()-1, bomber.getPosY()-1)).queTipo().equals("transitable")) { if(mapa.getPosicionMapa(bomber.getPosX()-1, bomber.getPosY()-1).esBloque()) { if(((Bloque)mapa.getPosicionMapa(bomber.getPosX()-1, bomber.getPosY()-1)).queTipo().equals("transitable")){ int posXviejarda=bomber.getPosX(); int posYviejarda=bomber.getPosY(); while(((posYviejarda*40) -(40)) <= (bomber.getPosY()*40) && ((posXviejarda*40)-40) <= (bomber.getPosX()*40) ) { if(posXviejarda!=bomber.getPosX()) { bomber.setVelY(0); } else bomber.setVelY(-bomber.getVelocidad()); bomber.setVelX(-bomber.getVelocidad()); try { Thread.sleep(20); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } } } } } } else if(((Bloque)mapa.getPosicionMapa(bomber.getPosX()-1, bomber.getPosY()+1)).queTipo().equals("transitable")) { if(mapa.getPosicionMapa(bomber.getPosX()-1, bomber.getPosY()+1).esBloque()) { if(((Bloque)mapa.getPosicionMapa(bomber.getPosX()-1, bomber.getPosY()+1)).queTipo().equals("transitable")){ int posXviejarda=bomber.getPosX(); int posYviejarda=bomber.getPosY(); while(((posYviejarda*40) +(40)) >= (bomber.getPosY()*40) && ((posXviejarda*40)-40) <= (bomber.getPosX()*40) ) { if(posXviejarda!=bomber.getPosX()) { bomber.setVelY(0); } else bomber.setVelY(+bomber.getVelocidad()); bomber.setVelX(-bomber.getVelocidad()); try { Thread.sleep(20); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } } } } } } } } } try { Thread.sleep(20); } catch (InterruptedException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } } bomber.setVelX(0); bomber.setVelY(0); } public boolean isAndando() { return andando; } public void setAndando(boolean andando) { this.andando = andando; } }
package com.citibank.newcpb.persistence.dao; import java.sql.ResultSet; import java.sql.SQLException; import java.text.ParseException; import java.util.ArrayList; import java.util.Date; import org.apache.commons.lang.StringUtils; import com.citibank.newcpb.enums.TableTypeEnum; import com.citibank.newcpb.exception.UnexpectedException; import com.citibank.newcpb.util.FormatUtils; import com.citibank.newcpb.vo.AuthorizationPersonVO; import com.citibank.ods.common.connection.rdb.ManagedRdbConnection; import com.citibank.ods.common.persistence.dao.rdb.oracle.BaseOracleDAO; import com.citibank.ods.persistence.pl.dao.rdb.oracle.factory.OracleODSDAOFactory; import com.citibank.ods.persistence.util.CitiStatement; public class TplPrvtAuthPersnMovDAO extends BaseOracleDAO { public ArrayList<AuthorizationPersonVO> list(String filterNumberEM, String filterCpfCnpj, String filterName, boolean isLike) throws ParseException { ManagedRdbConnection connection = null; CitiStatement preparedStatement = null; ResultSet rs = null; StringBuffer query = new StringBuffer(); ArrayList<AuthorizationPersonVO> resultList = null; try { connection = OracleODSDAOFactory.getConnection(); query.append(" SELECT EM_NBR, "); query.append(" AUTH_PERSN_NAME, "); query.append(" DOC_ID, "); query.append(" BIRTH_DATE, "); query.append(" CPF_CNPJ_NBR, "); query.append(" PROF_TEXT, "); query.append(" LAST_AUTH_DATE, "); query.append(" LAST_AUTH_USER_ID, "); query.append(" LAST_UPD_DATE, "); query.append(" LAST_UPD_USER_ID, "); query.append(" REC_STAT_CODE, "); query.append(" ADDR_NAME_TEXT, "); query.append(" ADDR_NEIGHB_TEXT, "); query.append(" ADDR_CITY_TEXT, "); query.append(" ADDR_STATE_CODE, "); query.append(" ADDR_CNTRY_CODE, "); query.append(" ZIP_CODE "); query.append(" FROM " + C_PL_SCHEMA + "TPL_PRVT_AUTH_PERSN_MOV "); query.append(" WHERE 1=1 "); if (filterNumberEM != null && !filterNumberEM.equals("")) { if(isLike){ query.append(" AND UPPER(TPL_PRVT_AUTH_PERSN_MOV.EM_NBR) LIKE TRIM(?) "); }else{ query.append(" AND UPPER(TPL_PRVT_AUTH_PERSN_MOV.EM_NBR) = TRIM(?) "); } } if (filterCpfCnpj != null && !filterCpfCnpj.equals("")) { if(isLike){ query.append(" AND UPPER(TPL_PRVT_AUTH_PERSN_MOV.CPF_CNPJ_NBR) LIKE TRIM(?) "); }else{ query.append(" AND UPPER(TPL_PRVT_AUTH_PERSN_MOV.CPF_CNPJ_NBR) = TRIM(?) "); } } if (filterName != null && !filterName.equals("")) { if(isLike){ query.append(" AND UPPER(TPL_PRVT_AUTH_PERSN_MOV.AUTH_PERSN_NAME) LIKE TRIM(?) "); }else{ query.append(" AND UPPER(TPL_PRVT_AUTH_PERSN_MOV.AUTH_PERSN_NAME) = TRIM(?) "); } } preparedStatement = new CitiStatement(connection.prepareStatement( query.toString() )); int count = 1; if (filterNumberEM != null && !StringUtils.isBlank(filterNumberEM)) { if(isLike){ preparedStatement.setString(count++, "%" + filterNumberEM.toUpperCase() + "%"); }else{ preparedStatement.setString(count++, filterNumberEM.toUpperCase()); } } if (filterCpfCnpj != null && !StringUtils.isBlank(filterCpfCnpj)) { if(isLike){ preparedStatement.setString(count++, "%" + FormatUtils.unformatterDoc(filterCpfCnpj).toUpperCase() + "%"); }else{ preparedStatement.setString(count++, FormatUtils.unformatterDoc(filterCpfCnpj).toUpperCase()); } } if (filterName != null && !StringUtils.isBlank(filterName)) { if(isLike){ preparedStatement.setString(count++, "%" + filterName.toUpperCase() + "%"); }else{ preparedStatement.setString(count++, filterName.toUpperCase()); } } preparedStatement.replaceParametersInQuery(query.toString()); rs = preparedStatement.executeQuery(); if(rs!=null){ resultList = new ArrayList<AuthorizationPersonVO>(); while (rs.next()){ AuthorizationPersonVO result = new AuthorizationPersonVO(); result.setEmNbr(rs.getString("EM_NBR") != null ? rs.getString("EM_NBR").toString() : null); result.setAuthPersnName(rs.getString("AUTH_PERSN_NAME") != null ? rs.getString("AUTH_PERSN_NAME").toString() : null); result.setDocId(rs.getString("DOC_ID") != null ? rs.getString("DOC_ID").toString() : null); result.setBirthDate(rs.getTimestamp("BIRTH_DATE") != null ? FormatUtils.dateToStringFormated(rs.getTimestamp("BIRTH_DATE"), FormatUtils.C_FORMAT_DATE_DD_MM_YYYY) : null); result.setCpfCnpjNbr(rs.getString("CPF_CNPJ_NBR") != null ? FormatUtils.formatterDoc(rs.getString("CPF_CNPJ_NBR").toString()) : null); result.setProfText(rs.getString("PROF_TEXT") != null ? rs.getString("PROF_TEXT").toString() : null); result.setLastAuthDate(rs.getTimestamp("LAST_AUTH_DATE") != null ? rs.getTimestamp("LAST_AUTH_DATE") : null); result.setLastAuthUser(rs.getString("LAST_AUTH_USER_ID") != null ? rs.getString("LAST_AUTH_USER_ID").toString() : null); result.setLastUpdDate(rs.getTimestamp("LAST_UPD_DATE") != null ? rs.getTimestamp("LAST_UPD_DATE") : null); result.setLastUpdUser(rs.getString("LAST_UPD_USER_ID") != null ? rs.getString("LAST_UPD_USER_ID").toString() : null); result.setRecStatCode(rs.getString("REC_STAT_CODE") != null ? rs.getString("REC_STAT_CODE").toString() : null); result.setStreet(rs.getString("ADDR_NAME_TEXT")!= null ? rs.getString("ADDR_NAME_TEXT").toString() : null); result.setNeighborhood(rs.getString("ADDR_NEIGHB_TEXT")!= null ? rs.getString("ADDR_NEIGHB_TEXT").toString() : null); result.setCity(rs.getString("ADDR_CITY_TEXT")!= null ? rs.getString("ADDR_CITY_TEXT").toString() : null); result.setUf(rs.getString("ADDR_STATE_CODE")!= null ? rs.getString("ADDR_STATE_CODE").toString() : null); result.setAddrCntryCode(rs.getString("ADDR_CNTRY_CODE")!= null ? rs.getString("ADDR_CNTRY_CODE").toString() : null); result.setZipCode(rs.getString("ZIP_CODE")!= null ? rs.getString("ZIP_CODE").toString() : null); result.setTableOrigin(TableTypeEnum.MOVEMENT); resultList.add(result); } } rs.close(); } catch (SQLException e) { throw new UnexpectedException(e.getErrorCode(), C_ERROR_EXECUTING_STATEMENT, e); } finally { closeStatement(preparedStatement); closeConnection(connection); } return resultList; } public AuthorizationPersonVO insert(AuthorizationPersonVO vo) { ManagedRdbConnection connection = null; CitiStatement preparedStatement = null; StringBuffer sqlQuery = new StringBuffer(); try { connection = OracleODSDAOFactory.getConnection(); sqlQuery.append(" INSERT INTO " + C_PL_SCHEMA + "TPL_PRVT_AUTH_PERSN_MOV ( " ); sqlQuery.append(" EM_NBR, "); sqlQuery.append(" AUTH_PERSN_NAME, "); sqlQuery.append(" DOC_ID, "); sqlQuery.append(" BIRTH_DATE, "); sqlQuery.append(" CPF_CNPJ_NBR, "); sqlQuery.append(" PROF_TEXT, "); sqlQuery.append(" LAST_UPD_DATE, "); sqlQuery.append(" LAST_UPD_USER_ID, "); sqlQuery.append(" REC_STAT_CODE, "); sqlQuery.append(" ADDR_NAME_TEXT, "); sqlQuery.append(" ADDR_NEIGHB_TEXT, "); sqlQuery.append(" ADDR_CITY_TEXT, "); sqlQuery.append(" ADDR_STATE_CODE, "); sqlQuery.append(" ADDR_CNTRY_CODE, "); sqlQuery.append(" ZIP_CODE "); sqlQuery.append( ") VALUES ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ); preparedStatement = new CitiStatement(connection.prepareStatement(sqlQuery.toString())); int count = 1; if (!StringUtils.isBlank(vo.getEmNbr())) { preparedStatement.setString(count++, FormatUtils.unformatterDoc(vo.getEmNbr())); } else { throw new UnexpectedException(C_ERROR_EXECUTING_STATEMENT); } if (!StringUtils.isBlank(vo.getAuthPersnName())) { preparedStatement.setString(count++, vo.getAuthPersnName()); } else { preparedStatement.setString(count++, null); } if (!StringUtils.isBlank(vo.getDocId())) { preparedStatement.setString(count++, vo.getDocId()); } else { preparedStatement.setString(count++, null); } if (!StringUtils.isBlank(vo.getBirthDate())) { Date lastIosRevDate = FormatUtils.formatToDate(vo.getBirthDate(),FormatUtils.C_FORMAT_DATE_DD_MM_YYYY); preparedStatement.setDate(count++, new java.sql.Date(lastIosRevDate.getTime())); } else { preparedStatement.setString(count++, null); } if (!StringUtils.isBlank(vo.getCpfCnpjNbr())) { preparedStatement.setString(count++, FormatUtils.unformatterDoc(vo.getCpfCnpjNbr())); } else { preparedStatement.setString(count++, null); } if (!StringUtils.isBlank(vo.getProfText())) { preparedStatement.setString(count++, vo.getProfText()); } else { preparedStatement.setString(count++, null); } if (vo.getLastUpdDate()!=null) { preparedStatement.setTimestamp(count++, new java.sql.Timestamp(vo.getLastUpdDate().getTime())); } else { preparedStatement.setString(count++, null); } if (!StringUtils.isBlank(vo.getLastUpdUser())) { preparedStatement.setString(count++, vo.getLastUpdUser()); } else { preparedStatement.setString(count++, null); } if (!StringUtils.isBlank(vo.getRecStatCode())) { preparedStatement.setString(count++, vo.getRecStatCode()); } else { preparedStatement.setString(count++, null); } if (!StringUtils.isBlank(vo.getStreet())) { preparedStatement.setString(count++, vo.getStreet()); } else { preparedStatement.setString(count++, null); } if (!StringUtils.isBlank(vo.getNeighborhood())) { preparedStatement.setString(count++, vo.getNeighborhood()); } else { preparedStatement.setString(count++, null); } if (!StringUtils.isBlank(vo.getCity())) { preparedStatement.setString(count++, vo.getCity()); } else { preparedStatement.setString(count++, null); } if (!StringUtils.isBlank(vo.getUf())) { preparedStatement.setString(count++, vo.getUf()); } else { preparedStatement.setString(count++, null); } if (!StringUtils.isBlank(vo.getAddrCntryCode())) { preparedStatement.setString(count++, vo.getAddrCntryCode()); } else { preparedStatement.setString(count++, null); } if (!StringUtils.isBlank(vo.getZipCode())) { preparedStatement.setString(count++, vo.getZipCode()); } else { preparedStatement.setString(count++, null); } // if (!StringUtils.isBlank(vo.getEffectiveDate())) { // Date effectiveDate = FormatUtils.formatToDate(vo.getEffectiveDate(),FormatUtils.C_FORMAT_DATE_DD_MM_YYYY); // preparedStatement.setDate(count++, new java.sql.Date(effectiveDate.getTime())); // } else { // preparedStatement.setString(count++, null); // } preparedStatement.replaceParametersInQuery(sqlQuery.toString()); preparedStatement.execute(); } catch (SQLException e) { throw new UnexpectedException(e.getErrorCode(), C_ERROR_EXECUTING_STATEMENT, e); } catch (ParseException a) { throw new UnexpectedException(a.getErrorOffset(), C_ERROR_EXECUTING_STATEMENT, a); } finally { closeStatement(preparedStatement); closeConnection(connection); } return vo; } public AuthorizationPersonVO update(AuthorizationPersonVO vo) { ManagedRdbConnection connection = null; CitiStatement preparedStatement = null; StringBuffer sqlQuery = new StringBuffer(); try { connection = OracleODSDAOFactory.getConnection(); sqlQuery.append(" UPDATE " + C_PL_SCHEMA + "TPL_PRVT_AUTH_PERSN_MOV SET " ); sqlQuery.append(" AUTH_PERSN_NAME = ?, "); sqlQuery.append(" DOC_ID = ?, "); sqlQuery.append(" BIRTH_DATE = ?, "); sqlQuery.append(" CPF_CNPJ_NBR = ?, "); sqlQuery.append(" PROF_TEXT = ?, "); sqlQuery.append(" LAST_UPD_DATE = ?, "); sqlQuery.append(" LAST_UPD_USER_ID = ?, "); sqlQuery.append(" REC_STAT_CODE = ?, "); sqlQuery.append(" ADDR_NAME_TEXT = ?, "); sqlQuery.append(" ADDR_NEIGHB_TEXT = ?, "); sqlQuery.append(" ADDR_CITY_TEXT = ?, "); sqlQuery.append(" ADDR_STATE_CODE = ?, "); sqlQuery.append(" ADDR_CNTRY_CODE = ?, "); sqlQuery.append(" ZIP_CODE = ? "); sqlQuery.append("WHERE TPL_PRVT_AUTH_PERSN_MOV.EM_NBR = ? "); preparedStatement = new CitiStatement(connection.prepareStatement(sqlQuery.toString())); int count = 1; if (!StringUtils.isBlank(vo.getAuthPersnName())) { preparedStatement.setString(count++, vo.getAuthPersnName()); } else { preparedStatement.setString(count++, null); } if (!StringUtils.isBlank(vo.getDocId())) { preparedStatement.setString(count++, vo.getDocId()); } else { preparedStatement.setString(count++, null); } if (!StringUtils.isBlank(vo.getBirthDate())) { Date lastIosRevDate = FormatUtils.formatToDate(vo.getBirthDate(),FormatUtils.C_FORMAT_DATE_DD_MM_YYYY); preparedStatement.setDate(count++, new java.sql.Date(lastIosRevDate.getTime())); } else { preparedStatement.setString(count++, null); } if (!StringUtils.isBlank(vo.getCpfCnpjNbr())) { preparedStatement.setString(count++, FormatUtils.unformatterDoc(vo.getCpfCnpjNbr())); } else { preparedStatement.setString(count++, null); } if (!StringUtils.isBlank(vo.getProfText())) { preparedStatement.setString(count++, vo.getProfText()); } else { preparedStatement.setString(count++, null); } if (vo.getLastUpdDate()!=null) { preparedStatement.setTimestamp(count++, new java.sql.Timestamp(vo.getLastUpdDate().getTime())); } else { preparedStatement.setString(count++, null); } if (!StringUtils.isBlank(vo.getLastUpdUser())) { preparedStatement.setString(count++, vo.getLastUpdUser()); } else { preparedStatement.setString(count++, null); } if (!StringUtils.isBlank(vo.getRecStatCode())) { preparedStatement.setString(count++, vo.getRecStatCode()); } else { preparedStatement.setString(count++, null); } if (!StringUtils.isBlank(vo.getStreet())) { preparedStatement.setString(count++, vo.getStreet()); } else { preparedStatement.setString(count++, null); } if (!StringUtils.isBlank(vo.getNeighborhood())) { preparedStatement.setString(count++, vo.getNeighborhood()); } else { preparedStatement.setString(count++, null); } if (!StringUtils.isBlank(vo.getCity())) { preparedStatement.setString(count++, vo.getCity()); } else { preparedStatement.setString(count++, null); } if (!StringUtils.isBlank(vo.getUf())) { preparedStatement.setString(count++, vo.getUf()); } else { preparedStatement.setString(count++, null); } if (!StringUtils.isBlank(vo.getAddrCntryCode())) { preparedStatement.setString(count++, vo.getAddrCntryCode()); } else { preparedStatement.setString(count++, null); } if (!StringUtils.isBlank(vo.getZipCode())) { preparedStatement.setString(count++, vo.getZipCode()); } else { preparedStatement.setString(count++, null); } if (!StringUtils.isBlank(vo.getEmNbr())) { preparedStatement.setString(count++, FormatUtils.unformatterDoc(vo.getEmNbr())); } else { throw new UnexpectedException(C_ERROR_EXECUTING_STATEMENT); } preparedStatement.replaceParametersInQuery(sqlQuery.toString()); preparedStatement.execute(); } catch (SQLException e) { throw new UnexpectedException(e.getErrorCode(), C_ERROR_EXECUTING_STATEMENT, e); } catch (ParseException a) { throw new UnexpectedException(a.getErrorOffset(), C_ERROR_EXECUTING_STATEMENT, a); } finally { closeStatement(preparedStatement); closeConnection(connection); } return vo; } public void delete(String emNbr) { ManagedRdbConnection connection = null; CitiStatement preparedStatement = null; StringBuffer query = new StringBuffer(); try { connection = OracleODSDAOFactory.getConnection(); query.append(" DELETE FROM " + C_PL_SCHEMA + "TPL_PRVT_AUTH_PERSN_MOV WHERE EM_NBR = ? "); preparedStatement = new CitiStatement(connection.prepareStatement(query.toString())); if (!StringUtils.isBlank(emNbr)) { preparedStatement.setString(1, emNbr); } else { throw new UnexpectedException(C_ERROR_EXECUTING_STATEMENT, null); } preparedStatement.replaceParametersInQuery(query.toString()); preparedStatement.executeUpdate(); } catch (SQLException e) { throw new UnexpectedException(e.getErrorCode(), C_ERROR_EXECUTING_STATEMENT, e); } finally { closeStatement(preparedStatement); closeConnection(connection); } } }
package com.lenovohit.hcp.odws.manager; import java.io.OutputStream; import java.util.List; import java.util.Map; import com.lenovohit.hcp.base.model.HcpUser; import com.lenovohit.hcp.onws.moddel.PhaPatLis; /** * * 类描述: 保管执行单 *@author GW *@date 2017年6月17日 * */ public interface PatLisManager { public PhaPatLis savePatLis(PhaPatLis record, HcpUser user); public void saveResultList(List<Map<String, Object>> mapList); public Map<String,Object> findLisResult(String exambarcode); public void writeExcel(List<Object> tmpList, OutputStream out); }
package com.zc.pivas.scans.repository; import com.zc.base.orm.mybatis.annotation.MyBatisRepository; import com.zc.base.sc.modules.batch.entity.Batch; import com.zc.pivas.docteradvice.bean.BLabelWithPrescription; import com.zc.pivas.scans.bean.*; import org.apache.ibatis.annotations.Param; import java.util.List; import java.util.Map; /** * * 扫描接口dao类 * */ @MyBatisRepository("scansDao") public interface ScansDao { /** * * 获取扫码批次信息 * @return */ public List<BottleLabelBean> queryScansCountList(); /** * * 根据瓶签号获取挂水信息 * @param btSn * @return */ public BottleLabelBean queryBottleLabelInfo(@Param("btSn") String btSn, @Param("batchID") String batchID, @Param("qryRQ") String qryRQ); /** * * 按医嘱 和类型查询扫描结果 * @param parENTNo * @param scansType * @return */ public BottleLabelResult queryBottleLabelResult(@Param("parentNo") String parENTNo, @Param("scansType") String scansType, @Param("zxbc") Integer zxbc); /** * * 插入扫描结果 */ public void insertBottleLabelRst(@Param("bottleLabelRst") BottleLabelResult bottleLabelRst); /** * * 更新扫描结果 */ public void updateBottleLabelRst(@Param("bottleLabelRst") BottleLabelResult bottleLabelRst); /** * * 根据父医嘱ID,查询药单信息 * @param parentNo 父医嘱编码或组编码 * @param batch 批次 * @param useDate 使用日期 * @return */ public List<MedicineBean> queryMedicineList(@Param("parentNo") String parentNo, @Param("batch") Integer batch, @Param("useDate") String useDate); /** * * 按病区统计结果 * @param scansSearch * @return */ public List<BottleLabelBean> queryScansCountByDeptList(@Param("scansSearch") ScansSearchBean scansSearch); /** * * 查询瓶签列表 * <功能详细描述> * @param scansSearch * @return */ public List<BottleLabelBean> queryBottleLabelList(@Param("scansSearch") ScansSearchBean scansSearch); public List<BottleLabelBean> queryBottleLabelListWidthOutMid(@Param("scansSearch") ScansSearchBean scansSearch); /** * * 改变瓶签状态 * <功能详细描述> * @param yDZTDesc * @param bottleLabelBean */ public void changePQState(@Param("yDZTDesc") Integer yDZTDesc, @Param("bottleLabelBean") BottleLabelBean bottleLabelBean); /** * * 获取配置费用规则ID * @param medicamentsCode * @return */ public Integer getConfigFeeRuleId(@Param("medicamentsCode") String medicamentsCode); /** * * 插入药单配置费收取、退费数据表 */ public void insertConfigFee(@Param("configFee") ScansConfigFeeBean configFee); /** * * 查询配置费明细 * @param detailCode * @return */ public List<String> queryConfigfeeDetailList(@Param("detailCode") String detailCode); /** * * 改变瓶签状态 * @param yzMap 医嘱信息 */ public void changePQStateByParentNo(Map<String, Object> yzMap); /** * * 改变瓶签床号 * @param yzMap 医嘱信息 */ public void changePQBedno(Map<String, Object> yzMap); /** * * 保存瓶签和配置费的关系及结果 */ public void savePqRefFee(@Param("pqRefFee") PqRefFee pqRefFee); /** * * 查询瓶签条码号对应病人的床位是否有变更 * @param barcode */ public Integer queryCountbySN(@Param("barcode") String barcode); public List<Map<String, Object>> qryCountMain(@Param("map") Map<String, Object> map); public List<Map<String, Object>> qryCountMainWidthOutMid(@Param("map") Map<String, Object> map); public List<Map<String, Object>> qryCountByPcname(@Param("map") Map<String, Object> map); public List<Map<String, Object>> qryCountByPcnameWidthOutMid(@Param("map") Map<String, Object> map); public List<BLabelWithPrescription> queryPQYDListByMap(@Param("map") Map<String, Object> map); public List<BLabelWithPrescription> queryPQYDListByBottNum(@Param("map") Map<String, Object> map); public List<MedicineBean> queryMedicineList2(@Param("pidsj") String pidsj); public int changePQYdzt(@Param("ydzt") Integer ydzt, @Param("pidsj") String pidsj); public BottleLabelResult queryBottleLabelResult2(@Param("pidsj") String pidsj); /** * 查询瓶签和配置费的关系及结果 */ public List<PqRefFee> qryPqRefFee(@Param("pqRefFee") PqRefFee pqRefFee); /** * 修改瓶签和配置费的关系及结果 */ public void updatePqRefFee(PqRefFee pqRefFee); public List<BottleLabelBean> getPQList(@Param("param") Map<String, Object> param); public List<ScanResult> getSMResultList(@Param("account") String account, @Param("yyrqStart") String yyrqStart, @Param("yyrqEnd") String yyrqEnd); public List<BLabelWithPrescription> getYdDetailList(@Param("pqstr") String pqStr); public List<BottleLabelBean> getStopList(@Param("param") Map<String, Object> param); public List<ScanPcNum> getBatchList(@Param("param") Map<String, Object> param); public List<Map<String, Object>> getDeptList(@Param("param") Map<String, Object> param); public List<String> getPCNumber(@Param("deptcode") String deptcode,@Param("pccode") String pccode, @Param("param") Map<String, Object> param); public void addPQConfigurator(@Param("pidsj") String pidsj,@Param("ydpq") String ydpq,@Param("account") String account); public void updateCheckType(@Param("pidsj") String pq_pidsj,@Param("ydpq") String pq_ydpq,@Param("scansType") String scansType); public List<BottleLabelBean> getScanPQList(@Param("param") Map<String, Object> param,@Param("lastNo") String[] lastNo); public List<Batch> getScansBatchList(); List<Map<String, Object>> getScanRestult(@Param("param") Map<String, Object> param); }
package org.vincent.aop.cglib; import net.sf.cglib.proxy.Enhancer; import net.sf.cglib.proxy.MethodInterceptor; import net.sf.cglib.proxy.MethodProxy; import java.lang.reflect.Method; /** * @Package: org.vincent.aop.cglib <br/> * @Description: 基于Cglib代理类生成器工具类 <br/> * @author: lenovo <br/> * @Company: PLCC <br/> * @Copyright: Copyright (c) 2019 <br/> * @Version: 1.0 <br/> * @Modified By: <br/> * @Created by lenovo on 2018/12/26-17:04 <br/> */ public class CglibProxyGenerator { /** * @param targetClass 需要被代理的委托类对象的Class实例,Cglib需要继承该类生成子类 * @param aspect 切面对象,改对象方法将在切点方法之前或之后执行 * @return 返回targetClass 的代理对象 */ public static Object generatorCglibProxy(final Class targetClass, final IAspect aspect){ //3.1 new Enhancer Enhancer enhancer = new Enhancer(); //3.2 设置需要代理的父类 enhancer.setSuperclass(targetClass); //3.3 设置回调 enhancer.setCallback(new MethodInterceptor() { @Override public Object intercept(Object proxy, Method method, Object[] args, MethodProxy methodProxy) throws Throwable { // 执行切面方法 aspect.startTransaction(); // 具体逻辑代码执行,返回值为方法执行结果 Object result = methodProxy.invokeSuper(proxy, args); // 执行切面方法 aspect.endTrasaction(); // 返回方法执行结果 return result; } }); // 3.4 创建代理对象 return enhancer.create(); } }
package com.example.front_end_of_clean_up_the_camera_app.MechantFragment; import android.content.Context; import android.content.Intent; import android.content.SharedPreferences; import android.os.Bundle; import android.os.Message; import android.support.annotation.Nullable; import android.support.design.widget.TabLayout; import android.support.v4.app.Fragment; import android.support.v4.view.ViewPager; import android.support.v7.widget.Toolbar; import android.util.Log; import android.view.LayoutInflater; import android.view.Menu; import android.view.MenuInflater; import android.view.MenuItem; import android.view.View; import android.view.ViewGroup; import android.widget.CompoundButton; import android.widget.Switch; import android.widget.TextView; import android.widget.Toast; import com.example.front_end_of_clean_up_the_camera_app.MStoreManageSettingActivity.MStoreManageSettingActivity; import com.example.front_end_of_clean_up_the_camera_app.MechantAdapter.MStoreManageContentFragmentAdapter; import com.example.front_end_of_clean_up_the_camera_app.R; import com.example.front_end_of_clean_up_the_camera_app.Tools.ServerConnection; import org.json.JSONObject; import java.io.BufferedReader; import java.io.InputStream; import java.io.InputStreamReader; import java.io.OutputStream; import java.net.HttpURLConnection; import java.util.ArrayList; import java.util.List; import butterknife.BindView; import butterknife.ButterKnife; //商家店铺管理页面 public class MStoreManageFragment extends Fragment { private Toolbar toolbar; @BindView(R.id.tab_layout) TabLayout tabLayout; @BindView(R.id.view_pager) ViewPager viewPager; @BindView(R.id.switch_mechantStoreConditionControl) Switch mStoreConditionControl; @BindView(R.id.tv_mechantStoreCondition) TextView mStoreCondition; @BindView(R.id.tv_mStoreIncomeTotal) TextView mStoreIncomeTotal; @BindView(R.id.tv_mechantName) TextView mechantName; private List<String> titles; private MStoreManageContentFragmentAdapter adapter; private Toolbar.OnMenuItemClickListener onMenuItemClick = new Toolbar.OnMenuItemClickListener() { @Override public boolean onMenuItemClick(MenuItem menuItem) { String msg = ""; switch (menuItem.getItemId()) { case R.id.item_mechantStoreManageSetting: msg += "Click setting"; Intent intent = new Intent(getActivity(), MStoreManageSettingActivity.class); startActivity(intent); break; } return true; } }; public MStoreManageFragment() { } @Override public void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); SharedPreferences sharedPreferences = getActivity().getSharedPreferences("user", Context.MODE_PRIVATE); String id = sharedPreferences.getString("userId", ""); String userName = sharedPreferences.getString("userName", ""); Toast.makeText(getContext(), "userId: " + id +"userName: " + userName, Toast.LENGTH_SHORT).show(); setHasOptionsMenu(true); initData(); } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.fragment_mstore_manage, container, false); //绑定页面 ButterKnife.bind(this, view); Toolbar toolbar = (Toolbar)view.findViewById(R.id.toolbar_mechantStoreManage); toolbar.getMenu().clear(); toolbar.inflateMenu(R.menu.mechant_store_manage); toolbar.setOnMenuItemClickListener(onMenuItemClick); toolbar.setTitle("店铺管理"); adapter = new MStoreManageContentFragmentAdapter(getChildFragmentManager()); viewPager.setAdapter(adapter); tabLayout.setupWithViewPager(viewPager); // 更新适配器数据 //给switch设置点击监控 mStoreConditionControl.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { if (isChecked){ mStoreCondition.setText("营业中"); }else { mStoreCondition.setText("暂停营业"); } } }); mStoreIncomeTotal.setText("2422¥"); adapter.setList(titles); sendMechantMessage(); return view; } @Override public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { menu.clear(); inflater.inflate(R.menu.mechant_store_manage, menu); MenuItem item=menu.findItem(R.id.item_mechantStoreManageSetting); super.onCreateOptionsMenu(menu, inflater); } private void initData() { titles = new ArrayList<>(); titles.add("用户评价"); titles.add("收入记录"); } // send login message private void sendMechantMessage(){ // create new thread new Thread(new Runnable() { @Override public void run() { HttpURLConnection connection = null; BufferedReader reader = null; try{ connection = new ServerConnection("getShopInfo", "POST").getConnection(); connection.setDoInput(true); connection.setDoOutput(true); connection.connect(); SharedPreferences sharedPreferences = getActivity().getSharedPreferences("user", Context.MODE_PRIVATE); String userId = sharedPreferences.getString("userId", null); OutputStream outputStream = connection.getOutputStream(); String loginMsg = "id=" + userId; outputStream.write(loginMsg.getBytes()); outputStream.flush(); outputStream.close(); InputStream inputStream = connection.getInputStream(); reader = new BufferedReader(new InputStreamReader(inputStream)); StringBuilder respond = new StringBuilder(); String line; while((line = reader.readLine()) != null){ respond.append(line); } JSONObject jsonObject = new JSONObject(respond.toString()); Log.d("jsonObj2", respond.toString()); String result = jsonObject.getString("result"); if(result!=null){ Message msg = new Message(); switch (result){ case "200": mechantName.setText(jsonObject.getString("name")); // userType = jsonObject.getInt("flag"); // userName = username_editText.getText().toString(); break; case "404": break; case "401": break; default: } } }catch (Exception e){ e.printStackTrace(); Log.d("Login_Activity", e + e.getMessage()); } } }).start(); } }
/* * Copyright (c) 2013-2014, Neuro4j.org * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.neuro4j.studio.core.diagram.sheet; import org.eclipse.jface.text.TextViewer; import org.eclipse.jface.viewers.CellEditor.LayoutData; import org.eclipse.swt.SWT; import org.eclipse.swt.custom.ViewForm; import org.eclipse.swt.graphics.Rectangle; import org.eclipse.swt.layout.FillLayout; import org.eclipse.swt.layout.FormAttachment; import org.eclipse.swt.layout.FormData; import org.eclipse.swt.layout.FormLayout; import org.eclipse.swt.layout.GridData; import org.eclipse.swt.layout.RowLayout; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Control; import org.eclipse.swt.widgets.Shell; import org.eclipse.ui.views.properties.PropertySheetPage; import org.eclipse.ui.views.properties.tabbed.ITabbedPropertyConstants; public class FlowPropertySheetPage extends PropertySheetPage { public FlowPropertySheetPage() { super(); setSorter(new FlowPropertySheetSorter()); } }
package com.gsccs.sme.plat.site.service; import java.util.List; import com.gsccs.sme.plat.site.model.LinkT; public interface LinkService { public String add(LinkT link); public void update(LinkT link); public void del(String id); public LinkT findById(String id); public List<LinkT> find(LinkT link,String orderstr, int page, int pagesize); public List<LinkT> findAll(LinkT link,String order); public int count(LinkT link); }
package TestCase; import java.util.ArrayList; public class TestCase { public ArrayList<TestCaseFragment> testCaseFragments = new ArrayList<>(); public ArrayList<TestCaseFragment> getTestCaseFragments() { return testCaseFragments; } public void setTestCaseFragments(ArrayList<TestCaseFragment> testCaseFragments) { this.testCaseFragments = testCaseFragments; } }
package com.metoo.manage.admin.action; import java.io.File; import java.io.IOException; import java.io.PrintWriter; import java.lang.reflect.Field; import java.math.BigDecimal; import java.text.ParseException; import java.util.ArrayList; import java.util.Date; import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Set; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.nutz.json.Json; import org.nutz.json.JsonFormat; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.expression.EvaluationContext; import org.springframework.expression.Expression; import org.springframework.expression.ExpressionParser; import org.springframework.expression.spel.standard.SpelExpressionParser; import org.springframework.expression.spel.support.StandardEvaluationContext; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.servlet.ModelAndView; import com.metoo.core.annotation.SecurityMapping; import com.metoo.core.beans.BeanUtils; import com.metoo.core.beans.BeanWrapper; import com.metoo.core.domain.virtual.SysMap; import com.metoo.core.mv.JModelAndView; import com.metoo.core.query.support.IPageList; import com.metoo.core.tools.CommUtil; import com.metoo.core.tools.WebForm; import com.metoo.core.tools.database.DatabaseTools; import com.metoo.foundation.domain.Accessory; import com.metoo.foundation.domain.Album; import com.metoo.foundation.domain.Area; import com.metoo.foundation.domain.GoodsSku; import com.metoo.foundation.domain.ComplaintGoods; import com.metoo.foundation.domain.Coupon; import com.metoo.foundation.domain.CouponInfo; import com.metoo.foundation.domain.Evaluate; import com.metoo.foundation.domain.GoldLog; import com.metoo.foundation.domain.GoldRecord; import com.metoo.foundation.domain.Goods; import com.metoo.foundation.domain.GoodsCart; import com.metoo.foundation.domain.GoodsClass; import com.metoo.foundation.domain.GoodsSpecProperty; import com.metoo.foundation.domain.GoodsSpecification; import com.metoo.foundation.domain.GroupInfo; import com.metoo.foundation.domain.GroupLifeGoods; import com.metoo.foundation.domain.Message; import com.metoo.foundation.domain.PayoffLog; import com.metoo.foundation.domain.Role; import com.metoo.foundation.domain.Store; import com.metoo.foundation.domain.StoreGrade; import com.metoo.foundation.domain.StorePoint; import com.metoo.foundation.domain.SysConfig; import com.metoo.foundation.domain.Template; import com.metoo.foundation.domain.User; import com.metoo.foundation.domain.WaterMark; import com.metoo.foundation.domain.ZTCGoldLog; import com.metoo.foundation.domain.query.StoreQueryObject; import com.metoo.foundation.service.IAccessoryService; import com.metoo.foundation.service.IAlbumService; import com.metoo.foundation.service.IAreaService; import com.metoo.foundation.service.IComplaintGoodsService; import com.metoo.foundation.service.IConsultService; import com.metoo.foundation.service.ICouponInfoService; import com.metoo.foundation.service.ICouponService; import com.metoo.foundation.service.IEvaluateService; import com.metoo.foundation.service.IFavoriteService; import com.metoo.foundation.service.IGoldLogService; import com.metoo.foundation.service.IGoldRecordService; import com.metoo.foundation.service.IGoodsCartService; import com.metoo.foundation.service.IGoodsClassService; import com.metoo.foundation.service.IGoodsService; import com.metoo.foundation.service.IGoodsSkuService; import com.metoo.foundation.service.IGoodsSpecPropertyService; import com.metoo.foundation.service.IGoodsSpecificationService; import com.metoo.foundation.service.IGroupInfoService; import com.metoo.foundation.service.IGroupLifeGoodsService; import com.metoo.foundation.service.IMessageService; import com.metoo.foundation.service.IOrderFormLogService; import com.metoo.foundation.service.IOrderFormService; import com.metoo.foundation.service.IPayoffLogService; import com.metoo.foundation.service.IPredepositService; import com.metoo.foundation.service.IRoleService; import com.metoo.foundation.service.IStoreGradeService; import com.metoo.foundation.service.IStorePointService; import com.metoo.foundation.service.IStoreService; import com.metoo.foundation.service.ISysConfigService; import com.metoo.foundation.service.ITemplateService; import com.metoo.foundation.service.IUserConfigService; import com.metoo.foundation.service.IUserService; import com.metoo.foundation.service.IWaterMarkService; import com.metoo.foundation.service.IZTCGoldLogService; import com.metoo.manage.admin.tools.AreaManageTools; import com.metoo.manage.admin.tools.StoreTools; import com.metoo.msg.email.SpelTemplate; /** * * <p> * Title: StoreManageAction.java * </p> * * <p> * Description: 运营商店铺管理控制器,用来管理店铺,可以添加、修改、删除店铺,运营商所有对店铺的操作均通过该管理控制器完成 * </p> * * <p> * Copyright: Copyright (c) 2015 * </p> * * <p> * Company: 沈阳网之商科技有限公司 www.koala.com * </p> * * @author erikzhang * * @date 2014-5-12 * * @version koala_b2b2c v2.0 2015版 */ @Controller public class StoreManageAction { @Autowired private ISysConfigService configService; @Autowired private IUserConfigService userConfigService; @Autowired private IStoreService storeService; @Autowired private IStoreGradeService storeGradeService; @Autowired private IAreaService areaService; @Autowired private IUserService userService; @Autowired private IRoleService roleService; @Autowired private IGoodsService goodsService; @Autowired private IConsultService consultService; @Autowired private AreaManageTools areaManageTools; @Autowired private StoreTools storeTools; @Autowired private DatabaseTools databaseTools; @Autowired private ITemplateService templateService; @Autowired private IMessageService messageService; @Autowired private IEvaluateService evaluateService; @Autowired private IGoodsCartService goodsCartService; @Autowired private IOrderFormService orderFormService; @Autowired private IOrderFormLogService orderFormLogService; @Autowired private IAccessoryService accessoryService; @Autowired private IAlbumService albumService; @Autowired private IGoodsClassService goodsclassService; @Autowired private IStorePointService storePointService; @Autowired private IFavoriteService favoriteService; @Autowired private IComplaintGoodsService complaintGoodsService; @Autowired private IPredepositService predepositService; @Autowired private IGroupLifeGoodsService grouplifegoodsService; @Autowired private IGroupInfoService groupinfoService; @Autowired private ICouponInfoService couponInfoService; @Autowired private IPayoffLogService paylogService; @Autowired private IGoodsSpecPropertyService specpropertyService; @Autowired private IGoodsSpecificationService specService; @Autowired private IGoldRecordService grService; @Autowired private IZTCGoldLogService ztcglService; @Autowired private IGoldLogService glService; @Autowired private ICouponService couponService; @Autowired private IWaterMarkService waterMarkService; @Autowired private IGoodsSkuService goodsSkuService; /** * Store列表页 * * @param currentPage * @param orderBy * @param orderType * @param request * @return */ @SecurityMapping(title = "店铺列表", value = "/admin/store_list.htm*", rtype = "admin", rname = "店铺管理", rcode = "admin_store_set", rgroup = "店铺") @RequestMapping("/admin/store_list.htm") public ModelAndView store_list(HttpServletRequest request, HttpServletResponse response, String currentPage, String orderBy, String orderType, String store_status, String store_name, String grade_id) { ModelAndView mv = new JModelAndView("admin/blue/store_list.html", configService.getSysConfig(), this.userConfigService.getUserConfig(), 0, request, response); StoreQueryObject qo = new StoreQueryObject(currentPage, mv, orderBy, orderType); qo.addQuery("obj.deleteStatus", new SysMap("deleteStatus", 0), "="); if (store_status != null && !store_status.equals("")) { qo.addQuery( "obj.store_status", new SysMap("store_status", CommUtil.null2Int(store_status)), "="); mv.addObject("store_status", store_status); } if (store_name != null && !store_name.equals("")) { qo.addQuery("obj.store_name", new SysMap("store_name", "%" + CommUtil.null2String(store_name) + "%"), "like"); mv.addObject("store_name", store_name); } if (grade_id != null && !grade_id.equals("")) { qo.addQuery("obj.grade.id", new SysMap("grade_id", CommUtil.null2Long(grade_id)), "="); mv.addObject("grade_id", grade_id); } IPageList pList = this.storeService.list(qo); CommUtil.saveIPageList2ModelAndView("", "", null, pList, mv); List<StoreGrade> grades = this.storeGradeService.query( "select obj from StoreGrade obj order by obj.sequence asc", null, -1, -1); mv.addObject("grades", grades); return mv; } /** * store添加管理 * * @param request * @return * @throws ParseException */ @SecurityMapping(title = "店铺添加1", value = "/admin/store_add.htm*", rtype = "admin", rname = "店铺管理", rcode = "admin_store_set", rgroup = "店铺") @RequestMapping("/admin/store_add.htm") public ModelAndView store_add(HttpServletRequest request, HttpServletResponse response, String currentPage) { ModelAndView mv = new JModelAndView("admin/blue/store_add.html", configService.getSysConfig(), this.userConfigService.getUserConfig(), 0, request, response); mv.addObject("currentPage", currentPage); return mv; } /** * * @param request * @param response * @param currentPage * @return */ @SecurityMapping(title = "店铺添加2", value = "/admin/store_new.htm*", rtype = "admin", rname = "店铺管理", rcode = "admin_store_set", rgroup = "店铺") @RequestMapping("/admin/store_new.htm") public ModelAndView store_new(HttpServletRequest request, HttpServletResponse response, String currentPage, String userName, String list_url, String add_url) { ModelAndView mv = new JModelAndView("admin/blue/store_new.html", configService.getSysConfig(), this.userConfigService.getUserConfig(), 0, request, response); User user = this.userService.getObjByProperty(null, "userName", userName); Store store = null; if (user != null) store = this.storeService.getObjByProperty(null, "user.id", user.getId()); if (user == null) { mv = new JModelAndView("admin/blue/tip.html", configService.getSysConfig(), this.userConfigService.getUserConfig(), 0, request, response); mv.addObject("op_tip", "不存在该用户"); mv.addObject("list_url", list_url); } else { if (store == null) { List<Area> areas = this.areaService.query( "select obj from Area obj where obj.parent.id is null", null, -1, -1); List<StoreGrade> grades = this.storeGradeService .query("select obj from StoreGrade obj order by obj.sequence asc", null, -1, -1); mv.addObject("grades", grades); mv.addObject("areas", areas); mv.addObject("currentPage", currentPage); mv.addObject("user", user); List<GoodsClass> gcs = this.goodsclassService .query("select obj from GoodsClass obj where obj.parent.id is null ", null, -1, -1); mv.addObject("goodsClass", gcs); } else { mv = new JModelAndView("admin/blue/tip.html", configService.getSysConfig(), this.userConfigService.getUserConfig(), 0, request, response); mv.addObject("op_tip", "该用户已经开通店铺"); mv.addObject("list_url", add_url); } } return mv; } /** * 店铺经营类目Ajax加载 * * @param request * @param response * @param cid * @return */ @SecurityMapping(title = "店铺添加2", value = "/admin/store_gc_ajax.htm*", rtype = "admin", rname = "店铺管理", rcode = "admin_store_set", rgroup = "店铺") @RequestMapping("/admin/store_gc_ajax.htm") public ModelAndView store_goodsclass_dialog(HttpServletRequest request, HttpServletResponse response, String cid) { ModelAndView mv = new JModelAndView("admin/blue/store_gc_ajax.html", configService.getSysConfig(), this.userConfigService.getUserConfig(), 0, request, response); if (cid != null && !cid.equals("")) { GoodsClass goodsClass = this.goodsclassService.getObjById(CommUtil .null2Long(cid)); Set<GoodsClass> gcs = goodsClass.getChilds(); mv.addObject("gcs", gcs); } return mv; } /** * store公司信息查看 * * @param id * @param request * @param response * @return * @throws ParseException */ @SecurityMapping(title = "店铺公司信息查看", value = "/admin/store_company.htm*", rtype = "admin", rname = "店铺管理", rcode = "admin_store_set", rgroup = "店铺") @RequestMapping("/admin/store_company.htm") public ModelAndView store_company(HttpServletRequest request, HttpServletResponse response, String id, String currentPage) { ModelAndView mv = new JModelAndView("admin/blue/store_company.html", configService.getSysConfig(), this.userConfigService.getUserConfig(), 0, request, response); Store store = this.storeService.getObjById(CommUtil.null2Long(id)); mv.addObject("store", store); Area area1 = store.getLicense_area(); mv.addObject("license_area_info", this.areaManageTools.generic_area_info(area1)); Area area2 = store.getLicense_c_area(); mv.addObject("license_c_area_info", this.areaManageTools.generic_area_info(area2)); Area area3 = store.getBank_area(); mv.addObject("bank_area_info", this.areaManageTools.generic_area_info(area3)); return mv; } /** * store编辑管理 * * @param id * @param request * @return * @throws ParseException */ @SecurityMapping(title = "店铺编辑", value = "/admin/store_edit.htm*", rtype = "admin", rname = "店铺管理", rcode = "admin_store_set", rgroup = "店铺") @RequestMapping("/admin/store_edit.htm") public ModelAndView store_edit(HttpServletRequest request, HttpServletResponse response, String id, String currentPage) { ModelAndView mv = new JModelAndView("admin/blue/store_edit.html", configService.getSysConfig(), this.userConfigService.getUserConfig(), 0, request, response); if (id != null && !id.equals("")) { Store store = this.storeService.getObjById(Long.parseLong(id)); List<Area> areas = this.areaService.query( "select obj from Area obj where obj.parent.id is null", null, -1, -1); mv.addObject("areas", areas); mv.addObject("obj", store); mv.addObject("currentPage", currentPage); mv.addObject("edit", true); mv.addObject("goodsClass_main", this.goodsclassService.getObjById(store.getGc_main_id())); mv.addObject("goodsClass_detail", this.storeTools .query_store_DetailGc(store.getGc_detail_info())); if (store.getArea() != null) { String info = this.areaManageTools.generic_area_info(store .getArea()); mv.addObject("area_info", info); } } return mv; } /** * store保存管理 * * @param id * @param gc_main_id * :主营类目id * @param gc_detail_ids * :详细类目id * @param id * @param id * @return * @throws Exception */ @SecurityMapping(title = "店铺保存", value = "/admin/store_save.htm*", rtype = "admin", rname = "店铺管理", rcode = "admin_store_set", rgroup = "店铺") @RequestMapping("/admin/store_save.htm") public ModelAndView store_save(HttpServletRequest request, HttpServletResponse response, String id, String store_status, String currentPage, String cmd, String list_url, String add_url, String user_id, String grade_id, String area_id, String validity, String gc_main_id_clone, String gc_detail_ids, String gc_detail_info) throws Exception { WebForm wf = new WebForm(); Store store = null; if (id.equals("")) { store = wf.toPo(request, Store.class); store.setAddTime(new Date()); } else { Store obj = this.storeService.getObjById(Long.parseLong(id)); store = (Store) wf.toPo(request, obj); } if (store_status != null && !store_status.equals("")) { if (store_status.equals("5") || store_status.equals("10")) {// 入驻审核中 store.setStore_status(CommUtil.null2Int(store_status)); } else if (store_status.equals("6") || store_status.equals("11")) {// 入驻审核失败 store.setStore_status(CommUtil.null2Int(store_status)); this.send_site_msg(request, "msg_toseller_store_update_refuse_notify", store); } else if (store_status.equals("15")) {// 入驻成功,给用户赋予卖家权限 if (user_id != null && !user_id.equals("")) {// 平台为用户新增店铺 User user = this.userService.getObjById(CommUtil .null2Long(user_id)); store.setUser(user); Area area = this.areaService.getObjById(CommUtil .null2Long(area_id)); store.setArea(area); StoreGrade grade = this.storeGradeService .getObjById(CommUtil.null2Long(grade_id)); store.setGrade(grade); store.setGc_main_id(CommUtil.null2Long(gc_main_id_clone)); store.setValidity(CommUtil.formatDate(validity)); // if (gc_detail_ids != null && !gc_detail_ids.equals("")) { // String[] gc_detail = gc_detail_ids.split(","); // Map map = new HashMap(); // for (int i = 0; i < gc_detail.length; i++) { // map.put("id" + i, gc_detail[i]); // } // System.out.println(Json.toJson(map, // JsonFormat.compact())); // store.setGc_detail_info(Json.toJson(map, // JsonFormat.compact())); // } store.setGc_detail_info(gc_detail_info); this.storeService.save(store); if (store.getPoint() == null) { StorePoint sp = new StorePoint(); sp.setAddTime(new Date()); sp.setStore(store); sp.setStore_evaluate(BigDecimal.valueOf(0)); sp.setDescription_evaluate(BigDecimal.valueOf(0)); sp.setService_evaluate(BigDecimal.valueOf(0)); sp.setShip_evaluate(BigDecimal.valueOf(0)); this.storePointService.save(sp); } } String store_user_id = CommUtil.null2String(store.getUser() .getId()); if (store_user_id != null && !store_user_id.equals("")) { User store_user = this.userService.getObjById(Long .parseLong(store_user_id)); store_user.setStore(store); if (!store_user.getUserRole().equalsIgnoreCase("admin")) {// 非admin该表用户为seller角色 store_user.setUserRole("SELLER"); } else { store_user.setUserRole("ADMIN_SELLER"); } // 给用户赋予卖家权限 Map params = new HashMap(); params.put("type", "SELLER"); List<Role> roles = this.roleService.query( "select obj from Role obj where obj.type=:type", params, -1, -1); for (Role role : roles) { store_user.getRoles().add(role); } store_user.getRoles().addAll(roles); this.userService.update(store_user); if (store.getStore_start_time() == null) {// 开店时间为空,意味着入驻审核通过,成功开店 store.setStore_start_time(new Date()); this.send_site_msg(request, "msg_toseller_store_update_allow_notify", store); this.storeTools.build(store.getStore_name(), "add"); } } store.setStore_status(CommUtil.null2Int(store_status)); } else if (store_status.equals("20")) {// 关闭违规店铺发送站内信提醒 store.setStore_status(CommUtil.null2Int(store_status)); if (!id.equals("") && store.getStore_status() == 20) { this.send_site_msg(request, "msg_toseller_store_closed_notify", store); this.storeTools.build(store.getStore_name(), "del"); } } } if (store.isStore_recommend()) { store.setStore_recommend_time(new Date()); } else store.setStore_recommend_time(null); this.storeService.update(store); ModelAndView mv = new JModelAndView("admin/blue/success.html", configService.getSysConfig(), this.userConfigService.getUserConfig(), 0, request, response); mv.addObject("list_url", list_url); mv.addObject("op_title", "保存店铺成功"); if (add_url != null) { mv.addObject("add_url", add_url + "?currentPage=" + currentPage); } return mv; } private void send_site_msg(HttpServletRequest request, String mark, Store store) throws Exception { Template template = this.templateService.getObjByProperty(null, "mark", mark); if (template != null && template.isOpen()) { if (store.getUser() != null) { ExpressionParser exp = new SpelExpressionParser(); EvaluationContext context = new StandardEvaluationContext(); context.setVariable("reason", store.getViolation_reseaon()); context.setVariable("user", store.getUser()); context.setVariable("store", store); context.setVariable("config", this.configService.getSysConfig()); context.setVariable("send_time", CommUtil.formatLongDate(new Date())); Expression ex = exp.parseExpression(template.getContent(), new SpelTemplate()); String content = ex.getValue(context, String.class); Map params = new HashMap(); params.put("userName", "admin"); params.put("userRole", "ADMIN"); List<User> fromUsers = this.userService .query("select obj from User obj where obj.userName=:userName and obj.userRole=:userRole", params, -0, 1); if (fromUsers.size() > 0) { Message msg = new Message(); msg.setAddTime(new Date()); msg.setContent(content); msg.setFromUser(fromUsers.get(0)); msg.setTitle(template.getTitle()); msg.setToUser(store.getUser()); msg.setType(0); this.messageService.save(msg); } } } } @SecurityMapping(title = "店铺删除", value = "/admin/store_del.htm*", rtype = "admin", rname = "店铺管理", rcode = "admin_store_set", rgroup = "店铺") @RequestMapping("/admin/store_del.htm") public String store_del(HttpServletRequest request, String mulitId) throws Exception { String[] ids = mulitId.split(","); for (String id : ids) { if (!id.equals("")) { Store store = this.storeService.getObjById(CommUtil .null2Long(id)); Map params = new HashMap(); if (store.getUser() != null) { store.getUser().setStore(null); User user = store.getUser(); if (user != null) { Set<Role> roles = user.getRoles(); Set<Role> new_roles = new HashSet<Role>(); for (Role role : roles) { if (!role.getType().equals("SELLER")) { new_roles.add(role); } } user.getRoles().clear();// 清除所有权限,重新添加不含商家的权限信息 user.getRoles().addAll(new_roles);// user.setStore_apply_step(0); this.userService.update(user); for (User u : user.getChilds()) {// 清除子账户所有权限信息 roles = u.getRoles(); Set<Role> new_roles2 = new HashSet<Role>(); for (Role role : roles) { if (!role.getType().equals("SELLER")) { new_roles2.add(role); } } u.getRoles().clear();// 清除所有权限,重新添加不含商家的权限信息 u.getRoles().addAll(new_roles2);// u.setStore_apply_step(0); this.userService.update(u); } } params.clear();// 删除商家优惠券 params.put("store_id", store.getId()); List<Coupon> coupons = this.couponService .query("select obj from Coupon obj where obj.store.id=:store_id", params, -1, -1); for (Coupon coupon : coupons) { for (CouponInfo couponInfo : coupon.getCouponinfos()) { this.couponInfoService.delete(couponInfo.getId()); } this.couponService.delete(coupon.getId()); } for (GoldRecord gr : user.getGold_record()) {// 商家充值记录 this.grService.delete(gr.getId()); } params.clear(); params.put("uid", user.getId()); List<GoldLog> gls = this.glService .query("select obj from GoldLog obj where obj.gl_user.id=:uid", params, -1, -1); for (GoldLog gl : gls) { this.glService.delete(gl.getId()); } for (GoldRecord gr : user.getGold_record()) { this.grService.delete(gr.getId()); } for (GroupLifeGoods glg : user.getGrouplifegoods()) {// 商家发布的生活购 for (GroupInfo gi : glg.getGroupInfos()) { this.groupinfoService.delete(gi.getId()); } glg.getGroupInfos().removeAll(glg.getGroupInfos()); this.grouplifegoodsService.delete(CommUtil .null2Long(glg.getId())); } for (PayoffLog log : user.getPaylogs()) {// 商家结算日志 this.paylogService.delete(log.getId()); } for (Album album : user.getAlbums()) {// 商家相册删除 album.setAlbum_cover(null); this.albumService.update(album); params.clear(); params.put("album_id", album.getId()); List<Accessory> accs = this.accessoryService .query("select obj from Accessory obj where obj.album.id=:album_id", params, -1, -1); for (Accessory acc : accs) { CommUtil.del_acc(request, acc); this.accessoryService.delete(acc.getId()); } this.albumService.delete(album.getId()); } } for (Goods goods : store.getGoods_list()) {// 店铺内的商品 goods.setGoods_main_photo(null); goods.setGoods_brand(null); this.goodsService.update(goods); goods.getGoods_photos().clear(); goods.getGoods_specs().clear(); goods.getGoods_ugcs().clear(); } for (Goods goods : store.getGoods_list()) {// 删除店铺内的商品 for (GoodsCart gc : goods.getCarts()) { this.goodsCartService.delete(gc.getId()); } List<Evaluate> evaluates = goods.getEvaluates(); for (Evaluate e : evaluates) { this.evaluateService.delete(e.getId()); } for (ComplaintGoods cg : goods.getCgs()) { this.complaintGoodsService.delete(cg.getId()); } List<GoodsSku> cgoodses = goods.getGoodsSkuList(); for(GoodsSku cgs : cgoodses){ this.goodsSkuService.delete(cgs.getId()); } goods.getCarts().removeAll(goods.getCarts());// 移除对象中的购物车 goods.getEvaluates().removeAll(goods.getEvaluates()); goods.getCgs().removeAll(goods.getCgs()); goods.getGoodsSkuList().removeAll(goods.getGoodsSkuList()); params.clear();// 直通车商品记录 params.put("gid", goods.getId()); List<ZTCGoldLog> ztcgls = this.ztcglService .query("select obj from ZTCGoldLog obj where obj.zgl_goods_id=:gid", params, -1, -1); for (ZTCGoldLog ztc : ztcgls) { this.ztcglService.delete(ztc.getId()); } this.goodsService.delete(goods.getId()); } store.getGoods_list().removeAll(store.getGoods_list()); store.setTransport(null); for (GoodsSpecification spec : store.getSpecs()) {// 店铺规格 for (GoodsSpecProperty pro : spec.getProperties()) { this.specpropertyService.delete(pro.getId()); } spec.getProperties().removeAll(spec.getProperties()); } String path = request.getSession().getServletContext() .getRealPath("/") + this.configService.getSysConfig().getUploadFilePath() + File.separator + "store" + File.separator + store.getId(); CommUtil.deleteFolder(path); //删除店铺之前删除店铺的水印 params.clear(); params.put("sid", CommUtil.null2Long(id)); List<WaterMark> wm = this.waterMarkService .query("select obj from WaterMark obj where obj.store.id=:sid", params, 0, 1); if(wm.size()>0){ this.waterMarkService.delete(wm.get(0).getId()); } this.storeService.delete(CommUtil.null2Long(id)); this.send_site_msg(request, "msg_toseller_store_delete_notify", store); } } return "redirect:store_list.htm"; } @SecurityMapping(title = "店铺AJAX更新", value = "/admin/store_ajax.htm*", rtype = "admin", rname = "店铺管理", rcode = "admin_store_set", rgroup = "店铺") @RequestMapping("/admin/store_ajax.htm") public void store_ajax(HttpServletRequest request, HttpServletResponse response, String id, String fieldName, String value) throws ClassNotFoundException { Store obj = this.storeService.getObjById(Long.parseLong(id)); Field[] fields = Store.class.getDeclaredFields(); BeanWrapper wrapper = new BeanWrapper(obj); Object val = null; for (Field field : fields) { // System.out.println(field.getName()); if (field.getName().equals(fieldName)) { Class clz = Class.forName("java.lang.String"); if (field.getType().getName().equals("int")) { clz = Class.forName("java.lang.Integer"); } if (field.getType().getName().equals("boolean")) { clz = Class.forName("java.lang.Boolean"); } if (!value.equals("")) { val = BeanUtils.convertType(value, clz); } else { val = !CommUtil.null2Boolean(wrapper .getPropertyValue(fieldName)); } wrapper.setPropertyValue(fieldName, val); } } if (fieldName.equals("store_recommend")) { if (obj.isStore_recommend()) { obj.setStore_recommend_time(new Date()); } else { obj.setStore_recommend_time(null); } } this.storeService.update(obj); response.setContentType("text/plain"); response.setHeader("Cache-Control", "no-cache"); response.setCharacterEncoding("UTF-8"); PrintWriter writer; try { writer = response.getWriter(); writer.print(val.toString()); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } @SecurityMapping(title = "入驻管理", value = "/admin/store_base.htm*", rtype = "admin", rname = "入驻管理", rcode = "admin_store_base", rgroup = "店铺") @RequestMapping("/admin/store_base.htm") public ModelAndView store_base(HttpServletRequest request, HttpServletResponse response) { ModelAndView mv = new JModelAndView("admin/blue/store_base_set.html", configService.getSysConfig(), this.userConfigService.getUserConfig(), 0, request, response); return mv; } @SecurityMapping(title = "卖家信用保存", value = "/admin/store_set_save.htm*", rtype = "admin", rname = "入驻管理", rcode = "admin_store_base", rgroup = "店铺") @RequestMapping("/admin/store_set_save.htm") public ModelAndView store_set_save(HttpServletRequest request, HttpServletResponse response, String id, String list_url, String store_allow) { ModelAndView mv = new JModelAndView("admin/blue/success.html", configService.getSysConfig(), this.userConfigService.getUserConfig(), 0, request, response); SysConfig sc = this.configService.getSysConfig(); sc.setStore_allow(CommUtil.null2Boolean(store_allow)); if (id.equals("")) { this.configService.save(sc); } else this.configService.update(sc); mv.addObject("list_url", list_url); mv.addObject("op_title", "保存店铺设置成功"); return mv; } @SecurityMapping(title = "开店申请Ajax更新", value = "/admin/store_base_ajax.htm*", rtype = "admin", rname = "入驻管理", rcode = "admin_store_base", rgroup = "店铺") @RequestMapping("/admin/store_base_ajax.htm") public void integral_goods_ajax(HttpServletRequest request, HttpServletResponse response, String fieldName) throws ClassNotFoundException { SysConfig sc = this.configService.getSysConfig(); Field[] fields = SysConfig.class.getDeclaredFields(); BeanWrapper wrapper = new BeanWrapper(sc); Object val = null; for (Field field : fields) { if (field.getName().equals(fieldName)) { Class clz = Class.forName("java.lang.Boolean"); val = !CommUtil.null2Boolean(wrapper .getPropertyValue(fieldName)); wrapper.setPropertyValue(fieldName, val); } } this.configService.update(sc); response.setContentType("text/plain"); response.setHeader("Cache-Control", "no-cache"); response.setCharacterEncoding("UTF-8"); PrintWriter writer; try { writer = response.getWriter(); writer.print(val.toString()); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } // 店铺模板管理 // @SecurityMapping(title = "店铺模板", value = "/admin/store_template.htm*", // rtype = "admin", rname = "店铺模板", rcode = "admin_store_template", rgroup = // "店铺") // @RequestMapping("/admin/store_template.htm") public ModelAndView store_template(HttpServletRequest request, HttpServletResponse response) { ModelAndView mv = new JModelAndView("admin/blue/store_template.html", configService.getSysConfig(), this.userConfigService.getUserConfig(), 0, request, response); mv.addObject("path", request.getSession().getServletContext() .getRealPath("/")); mv.addObject("separator", File.separator); return mv; } @SecurityMapping(title = "等级限制时可选的类目", value = "/admin/sg_limit_gc.htm*", rtype = "admin", rname = "店铺管理", rcode = "admin_store_set", rgroup = "店铺") @RequestMapping("/admin/sg_limit_gc.htm") public void storeGrade_limit_goodsClass(HttpServletRequest request, HttpServletResponse response, String storeGrade_id, String goodsClass_id) { String jsonList = ""; StoreGrade storeGrade = this.storeGradeService.getObjById(CommUtil .null2Long(storeGrade_id)); if (storeGrade != null && storeGrade.getMain_limit() != 0) { GoodsClass goodsClass = this.goodsclassService.getObjById(CommUtil .null2Long(goodsClass_id)); if (goodsClass != null) { List<Map<String, String>> gcList = new ArrayList<Map<String, String>>(); for (GoodsClass gc : goodsClass.getChilds()) { Map map = new HashMap(); map.put("gc_id", gc.getId()); map.put("gc_name", gc.getClassName()); gcList.add(map); } jsonList = Json.toJson(gcList, JsonFormat.compact()); } } response.setContentType("text/plain"); response.setHeader("Cache-Control", "no-cache"); response.setCharacterEncoding("UTF-8"); PrintWriter writer; try { writer = response.getWriter(); writer.print(jsonList); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } @SecurityMapping(title = "新增详细经营类目", value = "/admin/add_gc_detail.htm*", rtype = "admin", rname = "店铺管理", rcode = "admin_store_set", rgroup = "店铺") @RequestMapping("/admin/add_gc_detail.htm") public ModelAndView addStore_GoodsClass_detail(HttpServletRequest request, HttpServletResponse response, String did, String gc_detail_info) { ModelAndView mv = new JModelAndView( "admin/blue/store_detailgc_ajax.html", configService.getSysConfig(), this.userConfigService.getUserConfig(), 0, request, response); GoodsClass gc = this.goodsclassService.getObjById(CommUtil .null2Long(did)); List<Map> list = null;// 用于转换成店铺中的详细经营类目json if (gc != null) { GoodsClass parent = gc.getParent(); if (gc_detail_info != null && !gc_detail_info.equals("")) { if (storeTools.query_MainGc_Map(parent.getId().toString(), gc_detail_info) == null) {// 不在一个大分类下 list = Json.fromJson(ArrayList.class, gc_detail_info); List<Integer> gc_list = new ArrayList(); Map map = new HashMap(); gc_list.add(CommUtil.null2Int(did)); map.put("gc_list", gc_list); map.put("m_id", parent.getId()); list.add(map); String listJson = Json.toJson(list, JsonFormat.compact()); mv.addObject("gc_detail_info", listJson); mv.addObject("gcs", storeTools.query_store_DetailGc(listJson)); } else {// 在一个大分类下 List<Map> oldList = Json.fromJson(ArrayList.class, gc_detail_info); list = new ArrayList<Map>(); for (Map map : oldList) { if (CommUtil.null2Long(map.get("m_id")).equals( parent.getId())) { List<Integer> gc_list = (List<Integer>) map .get("gc_list"); gc_list.add(CommUtil.null2Int(did)); Map map2 = new HashMap(); HashSet set = new HashSet(gc_list); gc_list = new ArrayList<Integer>(set); System.out.println(gc_list); map2.put("gc_list", gc_list); map2.put("m_id", parent.getId()); list.add(map2); } else { list.add(map); } } String listJson = Json.toJson(list, JsonFormat.compact()); mv.addObject("gc_detail_info", listJson); mv.addObject("gcs", storeTools.query_store_DetailGc(listJson)); } ; } else { list = new ArrayList<Map>(); Map map = new HashMap(); List<Integer> gc_list = new ArrayList(); gc_list.add(CommUtil.null2Int(did)); map.put("gc_list", gc_list); map.put("m_id", parent.getId()); list.add(map); String listJson = Json.toJson(list, JsonFormat.compact()); mv.addObject("gc_detail_info", listJson); mv.addObject("gcs", storeTools.query_store_DetailGc(listJson)); } } return mv; } @SecurityMapping(title = "删除详细经营类目", value = "/admin/del_gc_detail.htm*", rtype = "admin", rname = "店铺管理", rcode = "admin_store_set", rgroup = "店铺") @RequestMapping("/admin/del_gc_detail.htm") public ModelAndView delStore_GoodsClass_detail(HttpServletRequest request, HttpServletResponse response, String did, String gc_detail_info) { ModelAndView mv = new JModelAndView( "admin/blue/store_detailgc_ajax.html", configService.getSysConfig(), this.userConfigService.getUserConfig(), 0, request, response); GoodsClass gc = this.goodsclassService.getObjById(CommUtil .null2Long(did)); if (gc_detail_info != null && !gc_detail_info.equals("") && gc != null) { GoodsClass parent = gc.getParent(); List<Map> oldList = Json.fromJson(ArrayList.class, gc_detail_info); List<Map> list = new ArrayList<Map>(); for (Map oldMap : oldList) { if (!CommUtil.null2Long(oldMap.get("m_id")).equals( parent.getId())) { list.add(oldMap); } else { List<Integer> gc_list = (List<Integer>) oldMap .get("gc_list"); for (Integer integer : gc_list) { if (integer.equals(CommUtil.null2Int(did))) { gc_list.remove(integer); break; } } if (gc_list.size() > 0) { Map map = new HashMap(); map.put("gc_list", gc_list); map.put("m_id", parent.getId()); list.add(oldMap); } } } if (list.size() > 0) { String listJson = Json.toJson(list, JsonFormat.compact()); mv.addObject("gc_detail_info", listJson); mv.addObject("gcs", storeTools.query_store_DetailGc(listJson)); } } return mv; } }
/* ModificationException.java Purpose: Description: History: Thu Aug 8 19:59:53 2002, Created by tomyeh Copyright (C) 2002 Potix Corporation. All Rights Reserved. {{IS_RIGHT This program is distributed under LGPL Version 2.1 in the hope that it will be useful, but WITHOUT ANY WARRANTY. }}IS_RIGHT */ package org.zkoss.util; import org.zkoss.lang.CommonException; import org.zkoss.lang.Exceptions; import org.zkoss.lang.Expectable; /** * Denotes a modification fails. It is considered as * a program bug, while {@link InvalidValueException} is considered as * an operational error of user. * * <p>The create, remove and setter method of peristent beans (i3pb) must * declare this exception. Besides this exception and, * {@link InvalidValueException}, * org.zkoss.i3.pb.RemoveException and org.zkoss.i3.pb.CreateException, * who derive from this class, might be thrown * * @author tomyeh */ public class ModificationException extends CommonException { /** Utilities. * * <p>The reason to use a class to hold static utilities is we can * override the method's return type later. */ public static class Aide { /** Converts an exception to ModificationException or InvalidValueException * depending on whether t implements {@link Expectable}. * @see Exceptions#wrap */ public static ModificationException wrap(Throwable t) { t = Exceptions.unwrap(t); if (t instanceof Expectable) return (InvalidValueException) Exceptions.wrap(t, InvalidValueException.class); return (ModificationException) Exceptions.wrap(t, ModificationException.class); } /** Converts an exception to ModificationException or InvalidValueException * depending on whether t implements {@link Expectable}. * @see Exceptions#wrap */ public static ModificationException wrap(Throwable t, String msg) { t = Exceptions.unwrap(t); if (t instanceof Expectable) return (InvalidValueException) Exceptions.wrap(t, InvalidValueException.class, msg); return (ModificationException) Exceptions.wrap(t, ModificationException.class, msg); } /** Converts an exception to ModificationException or InvalidValueException * depending on whether t implements {@link Expectable}. * @see Exceptions#wrap */ public static ModificationException wrap(Throwable t, int code, Object[] fmtArgs) { t = Exceptions.unwrap(t); if (t instanceof Expectable) return (InvalidValueException) Exceptions.wrap(t, InvalidValueException.class, code, fmtArgs); return (ModificationException) Exceptions.wrap(t, ModificationException.class, code, fmtArgs); } /** Converts an exception to ModificationException or InvalidValueException * depending on whether t implements {@link Expectable}. * @see Exceptions#wrap */ public static ModificationException wrap(Throwable t, int code, Object fmtArg) { t = Exceptions.unwrap(t); if (t instanceof Expectable) return (InvalidValueException) Exceptions.wrap(t, InvalidValueException.class, code, fmtArg); return (ModificationException) Exceptions.wrap(t, ModificationException.class, code, fmtArg); } /** Converts an exception to ModificationException or InvalidValueException * depending on whether t implements {@link Expectable}. * @see Exceptions#wrap */ public static ModificationException wrap(Throwable t, int code) { t = Exceptions.unwrap(t); if (t instanceof Expectable) return (InvalidValueException) Exceptions.wrap(t, InvalidValueException.class, code); return (ModificationException) Exceptions.wrap(t, ModificationException.class, code); } } public ModificationException(String msg, Throwable cause) { super(msg, cause); } public ModificationException(String s) { super(s); } public ModificationException(Throwable cause) { super(cause); } public ModificationException() { } public ModificationException(int code, Object[] fmtArgs, Throwable cause) { super(code, fmtArgs, cause); } public ModificationException(int code, Object fmtArg, Throwable cause) { super(code, fmtArg, cause); } public ModificationException(int code, Object[] fmtArgs) { super(code, fmtArgs); } public ModificationException(int code, Object fmtArg) { super(code, fmtArg); } public ModificationException(int code, Throwable cause) { super(code, cause); } public ModificationException(int code) { super(code); } }
package com.akka.iot; import java.util.Optional; public class Protocol { public static final class ReadTemperature { long requestId; public ReadTemperature(long requestId) { this.requestId = requestId; } } public static final class RespondTemperature { long requestId; Optional<Double> value; public RespondTemperature(long requestId, Optional<Double> value) { this.requestId = requestId; this.value = value; } } public static final class RecordTemperature { final long requestId; final double value; public RecordTemperature(long requestId, double value) { this.requestId = requestId; this.value = value; } } public static final class TemperatureRecorded { final long requestId; public TemperatureRecorded(long requestId) { this.requestId = requestId; } } }
package com.ahu.service; import com.ahu.constant.MessageConstant; import com.ahu.constant.RedisConstant; import com.ahu.dao.SetmealDao; import com.ahu.entity.PageResult; import com.ahu.entity.QueryPageBean; import com.ahu.pojo.Setmeal; import com.alibaba.dubbo.config.annotation.Service; import com.github.pagehelper.Page; import com.github.pagehelper.PageHelper; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.transaction.annotation.Transactional; import redis.clients.jedis.Jedis; import redis.clients.jedis.JedisPool; import java.util.HashMap; import java.util.List; import java.util.Map; /** * @author :hodor007 * @date :Created in 2020/11/23 * @description : * @version: 1.0 */ @Service @Transactional public class SetmealServiceImpl implements SetmealService { @Autowired private SetmealDao setmealDao; @Autowired private JedisPool jedisPool; @Override public void add(Setmeal setmeal, Integer[] ids) { //保存检查套餐 setmealDao.add(setmeal); //保存对应关系 setSetmealAndCheckGroupIds(setmeal.getId(),ids); //图片名字存入数据库之后顺便存入redis以便清理垃圾图片 Jedis jedis = jedisPool.getResource(); jedis.sadd(RedisConstant.SETMEAL_PIC_DB_RESOURCES,setmeal.getImg()); jedis.close(); } private void setSetmealAndCheckGroupIds(Integer setMealId,Integer[] ids){ if(ids != null && ids.length > 0){ for (Integer id : ids) { Map map = new HashMap<>(); map.put("setMealId",setMealId); map.put("checkGroupId",id); setmealDao.setSetmealAndCheckGroupIds(map); } } } @Override public PageResult findPage(QueryPageBean queryPageBean) { PageHelper.startPage(queryPageBean.getCurrentPage(),queryPageBean.getPageSize()); Page<Setmeal> page = setmealDao.findPage(queryPageBean.getQueryString()); return new PageResult(page.getTotal(),page.getResult()); } @Override public List<Setmeal> findAll() { List<Setmeal> setmealList = setmealDao.findAll(); return setmealList; } //级联查询 @Override public Setmeal findById(Integer id) { Setmeal setmeal = setmealDao.findById(id); return setmeal; } @Override public List<Map<String, Object>> findSetmealCount() { List<Map<String, Object>> setmealCount = setmealDao.findSetmealCount(); return setmealCount; } }
package com.nationwide; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.stereotype.Repository; @Repository public interface ESRrepo extends JpaRepository<ESR,Integer> { }
package com.SearchHouse.action; import java.util.List; import java.util.Map; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.apache.struts2.interceptor.ServletRequestAware; import org.apache.struts2.interceptor.ServletResponseAware; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Scope; import org.springframework.stereotype.Controller; import com.SearchHouse.pojo.Administrator; import com.SearchHouse.pojo.House; import com.SearchHouse.pojo.HouseStatus; import com.SearchHouse.pojo.Quality; import com.SearchHouse.pojo.User1; import com.SearchHouse.service.QualityService; import com.SearchHouse.service.UserService; import com.opensymphony.xwork2.ActionContext; import com.opensymphony.xwork2.ModelDriven; @Controller @Scope("prototype") public class QualityAction implements ModelDriven<Quality>,ServletRequestAware,ServletResponseAware { @Autowired QualityService qualityservice; HttpServletRequest request; HttpServletResponse response; Quality quality; @Autowired UserService userService; public UserService getUserService() { return userService; } public void setUserService(UserService userService) { this.userService = userService; } public QualityService getQualityservice() { return qualityservice; } public void setQualityservice(QualityService qualityservice) { this.qualityservice = qualityservice; } public HttpServletRequest getRequest() { return request; } public void setRequest(HttpServletRequest request) { this.request = request; } public HttpServletResponse getResponse() { return response; } public void setResponse(HttpServletResponse response) { this.response = response; } public Quality getQuality() { return quality; } public void setQuality(Quality quality) { this.quality = quality; } @Override public void setServletRequest(HttpServletRequest request) { // TODO Auto-generated method stub this.request=request; } @Override public Quality getModel() { if(quality==null){ quality=new Quality(); } return quality; } @Override public void setServletResponse(HttpServletResponse response) { // TODO Auto-generated method stub this.response=response; } public String queryAllQualities(){ List<Quality> qualities=qualityservice.queryAllQualities(); Map<String,Object> request=(Map<String, Object>) ActionContext.getContext().get("request"); request.put("qualities", qualities); System.out.println(qualities); return "listqualities"; } public String updateQuality(){ Integer qualityId=(Integer) request.getAttribute("qualityId"); Quality quality=qualityservice.getQualityById(qualityId); quality.setQualitResult(1); qualityservice.updateQuality(quality); if(quality.getQualityNum().equals("")){ User1 user=userService.getUserById(quality.getUser().getUserId()); user.setQualityRating("¸öÈË"); userService.updateUserInfo(user); }else{ User1 user=userService.getUserById(quality.getUser().getUserId()); user.setQualityRating("ÉÌ»§"); userService.updateUserInfo(user); } return "updatequality"; } }
package com.demo.springboot.controller; import com.demo.springboot.service.impl.ESServiceImpl; import io.netty.util.internal.StringUtil; import io.swagger.annotations.Api; import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParams; import io.swagger.annotations.ApiOperation; import org.elasticsearch.action.admin.indices.create.CreateIndexResponse; import org.elasticsearch.action.admin.indices.delete.DeleteIndexResponse; import org.elasticsearch.action.bulk.BulkResponse; import org.elasticsearch.action.index.IndexResponse; import org.elasticsearch.action.search.SearchResponse; import org.elasticsearch.rest.RestStatus; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; import java.util.List; import java.util.Map; @RestController @RequestMapping(value = "/es") @Api(value="ESController",description = "ElasticSearch Api") public class ESController { @Autowired ESServiceImpl esService; @ApiOperation(value="创建Index", notes="create Index") @ApiImplicitParams({ @ApiImplicitParam(name = "index", value = "索引名称", required = true ,dataType = "string") }) @RequestMapping(method = RequestMethod.POST,value = "/{index}") public CreateIndexResponse crate(@PathVariable String index){ return esService.createIndex(index); } @ApiOperation(value="写Document", notes="write a document in index") @ApiImplicitParams({ @ApiImplicitParam(name = "index", value = "索引名称", required = true ,dataType = "string") }) @RequestMapping(method = RequestMethod.PUT,value = "/{index}") public IndexResponse put(@PathVariable String index){ return esService.write(index); } @ApiOperation(value="删除Index", notes="delete Index") @ApiImplicitParams({ @ApiImplicitParam(name = "index", value = "索引名称", required = true ,dataType = "string") }) @RequestMapping(method = RequestMethod.DELETE,value = "/{index}") public DeleteIndexResponse delete(@PathVariable String index){ return esService.deleteIndex(index); } @ApiOperation(value="批量写Document", notes="相当于jdbc的batch提交insert语句") @ApiImplicitParams({ @ApiImplicitParam(name = "index", value = "索引名称", required = true ,dataType = "string") }) @RequestMapping(method = RequestMethod.PUT,value = "/bulk/{index}") public BulkResponse bulk(@PathVariable String index){ return esService.bulkWrite(index); } @ApiOperation(value="即时分页查询Index", notes="基础分页查询,适应多数场景,此方法ES默认不能超过10000行数据,可配置,但不建议") @ApiImplicitParams({ @ApiImplicitParam(name = "index", value = "索引名称", required = true ,dataType = "string"), @ApiImplicitParam(name = "from", value = "查询起点",dataType = "integer"), @ApiImplicitParam(name = "size", value = "单页条数", dataType = "integer") }) @RequestMapping(method = RequestMethod.GET,value = "/{index}") public SearchResponse search(@PathVariable String index, @RequestParam(name="from",required = false) Integer from, @RequestParam(name="size",required = false) Integer size){ return esService.search(index,from,size); } @ApiOperation(value="发起滚动逐页查询Index(非即时)", notes="适用大数据量的业务需求,非实时,增删改对于其查询结果不起作用") @ApiImplicitParams({ @ApiImplicitParam(name = "index", value = "索引名称", required = true ,dataType = "string"), @ApiImplicitParam(name = "size", value = "单页条数",dataType = "integer") }) @RequestMapping(method = RequestMethod.GET,value = "scroll/{index}") public SearchResponse scroll(@PathVariable String index, @RequestParam(name="size") Integer size){ return esService.searchScroll(index,size); } @ApiOperation(value="滚动逐页查询Index下一页", notes="调用scroll后得到scrollId进行逐行查询") @ApiImplicitParams({ @ApiImplicitParam(name = "scrollId", value = "scroll接口返回的scrollId", required = true ,dataType = "string") }) @RequestMapping(method = RequestMethod.GET,value = "scroll/next/{scrollId}") public SearchResponse scrollNext(@PathVariable String scrollId){ return esService.searchScrollNext(scrollId); } }
/* ==================================================================== * * Copyright (c) Atos Origin INFORMATION TECHNOLOGY All rights reserved. * * ==================================================================== * */ package com.aof.webapp.action.prm.bill; import java.util.Locale; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.apache.log4j.Logger; import org.apache.struts.action.ActionForm; import org.apache.struts.action.ActionForward; import org.apache.struts.action.ActionMapping; import org.apache.struts.util.MessageResources; import com.aof.component.domain.party.UserLogin; import com.aof.component.prm.Bill.BillInstructionService; import com.aof.component.prm.Bill.InvoiceService; import com.aof.component.prm.Bill.ProjectInvoice; import com.aof.util.Constants; import com.aof.util.UtilDateTime; import com.aof.webapp.action.BaseAction; import com.aof.webapp.form.prm.bill.EditInvoiceForm; /** * @author Jackey Ding * @version 2005-03-31 * */ public class EditInvoiceAction extends BaseAction { private Logger log = Logger.getLogger(EditInvoiceAction.class); public ActionForward perform(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) { Locale locale = getLocale(request); MessageResources messages = getResources(); InvoiceService service = new InvoiceService(); try { EditInvoiceForm eiForm = (EditInvoiceForm)form; String action = request.getParameter("action"); String dataId = request.getParameter("DataId"); if(action == null) action = ""; if(dataId == null) dataId = ""; if(action.equalsIgnoreCase("dialogView") && !dataId.trim().equals("")){ request.setAttribute("Currency", service.getAllCurrency()); request.setAttribute("ProjectInvoice", service.viewInvoice(dataId)); return mapping.findForward("dialogView"); } if (eiForm.getFormAction().equals("view")) { if (eiForm.getBillId() != null) { BillInstructionService biService = new BillInstructionService(); request.setAttribute("ProjectBill", biService.viewBillingInstruction(eiForm.getBillId())); } request.setAttribute("Currency", service.getAllCurrency()); request.setAttribute("ProjectInvoice", service.viewInvoice(eiForm.getInvoiceId())); } if (eiForm.getFormAction().equals("dialogView")) { request.setAttribute("Currency", service.getAllCurrency()); request.setAttribute("ProjectInvoice", service.viewInvoice(eiForm.getInvoiceId())); return mapping.findForward("dialogView"); } if (eiForm.getFormAction().equals("new")) { ProjectInvoice pi = convertFormToModel(service, eiForm); UserLogin ul = (UserLogin)request.getSession().getAttribute(Constants.USERLOGIN_KEY); if (service.checkAmount(pi)) { Long invoiceId = service.newInvoice(pi, ul); } else { service.setProject(pi); service.setBillAddress(pi); service.setCurrency(pi); service.setBilling(pi); request.setAttribute("ErrorMessage", "Entry Amount can not be large than Remaining Amount!!!"); } request.setAttribute("Currency", service.getAllCurrency()); request.setAttribute("ProjectInvoice", pi); } if (eiForm.getFormAction().equals("update")) { ProjectInvoice pi = convertFormToModel(service, eiForm); if (service.checkAmount(pi)) { service.updateInvoice(pi); } else { service.setBillAddress(pi); service.setCurrency(pi); service.setEms(pi); request.setAttribute("ErrorMessage", "Entry Amount can not be large than Remaining Amount!!!"); } request.setAttribute("Currency", service.getAllCurrency()); request.setAttribute("ProjectInvoice", pi); } if (eiForm.getFormAction().equals("delete")) { ProjectInvoice pi = convertFormToModel(service, eiForm); service.deleteInvoice(pi.getId()); return mapping.findForward("list"); } if (eiForm.getFormAction().equals("cancel")) { service.cancelInvoice(eiForm.getInvoiceId()); request.setAttribute("Currency", service.getAllCurrency()); request.setAttribute("ProjectInvoice", service.viewInvoice(eiForm.getInvoiceId())); //return mapping.findForward("list"); } if (eiForm.getFormAction().equals("confirm")) { service.confirmInvoice(eiForm.getInvoiceId()); request.setAttribute("Currency", service.getAllCurrency()); request.setAttribute("ProjectInvoice", service.viewInvoice(eiForm.getInvoiceId())); } if (eiForm.getFormAction().equals("add") || eiForm.getFormAction().equals("OK")) { String[] invoiceIdStr = request.getParameterValues("invoiceId"); Long[] invoiceIdL = null; if (invoiceIdStr != null) { invoiceIdL = new Long[invoiceIdStr.length]; for (int i0 = 0; i0 < invoiceIdStr.length; i0++) { invoiceIdL[i0] = new Long(invoiceIdStr[i0]); } } service.addToEMS(invoiceIdL, eiForm.getEmsId()); return mapping.findForward("list"); } if (eiForm.getFormAction().equals("deleteConfirm")) { ProjectInvoice pi = convertFormToModel(service, eiForm); service.deleteConfirmation(pi, eiForm.getConfirmId()); request.setAttribute("Currency", service.getAllCurrency()); request.setAttribute("ProjectInvoice", service.viewInvoice(eiForm.getInvoiceId())); } if (eiForm.getFormAction().equals("deleteReceipt")) { ProjectInvoice pi = convertFormToModel(service, eiForm); service.deleteReceipt(pi, eiForm.getReceiptId()); request.setAttribute("Currency", service.getAllCurrency()); request.setAttribute("ProjectInvoice", service.viewInvoice(eiForm.getInvoiceId())); } } catch (Exception e) { log.error(e.getMessage()); e.printStackTrace(); } finally { service.closeSession(); } return mapping.findForward("success"); } private ProjectInvoice convertFormToModel(InvoiceService service, EditInvoiceForm eiForm) { ProjectInvoice pi = null; if (eiForm.getInvoiceId() != null) { pi = service.viewInvoice(eiForm.getInvoiceId()); } else { pi = new ProjectInvoice(); } pi.setInvoiceType(Constants.INVOICE_TYPE_NORMAL); if (eiForm.getInvoiceCode() != null) { pi.setInvoiceCode(eiForm.getInvoiceCode()); } if (eiForm.getProjectId() != null) { pi.setProjectId(eiForm.getProjectId()); } if (eiForm.getBillAddressId() != null) { pi.setBillAddressId(eiForm.getBillAddressId()); } if (eiForm.getCurrency() != null) { pi.setCurrencyId(eiForm.getCurrency()); } if (eiForm.getCurrencyRate() != null) { pi.setCurrencyRate(eiForm.getCurrencyRate()); } if (eiForm.getAmount() != null) { pi.setAmount(eiForm.getAmount()); } if (eiForm.getInvoiceDate() != null) { java.util.Date invoiceDate = UtilDateTime.toDate2(eiForm.getInvoiceDate() + " 00:00:00.000"); pi.setInvoiceDate(invoiceDate); } if (eiForm.getNote() != null) { pi.setNote(eiForm.getNote().trim()); } if (eiForm.getBillId() != null) { pi.setBillId(eiForm.getBillId()); } if (eiForm.getEmsId() != null) { pi.setEmsId(eiForm.getEmsId()); } if (eiForm.getInvoiceType() != null) { pi.setInvoiceType(eiForm.getInvoiceType()); } return pi; } }
package it.unipi.p2p.tinycoin.protocols; import java.util.ArrayList; import java.util.Iterator; import java.util.List; import java.util.Map; import it.unipi.p2p.tinycoin.Block; import it.unipi.p2p.tinycoin.TinyCoinNode; import it.unipi.p2p.tinycoin.Transaction; import peersim.cdsim.CDProtocol; import peersim.config.Configuration; import peersim.config.FastConfig; import peersim.core.Linkable; import peersim.core.Node; import peersim.transport.Transport; public class MinerProtocol implements CDProtocol{ private static final String PAR_MAX_TRANS_BLOCK = "max_trans_block"; private static final String PAR_REWARD = "reward"; private static final String PAR_NODE_PROT = "node_protocol"; private int minedBlocks; private boolean selected; private int maxTransPerBlock; private double reward; private int nodeProtocol; public MinerProtocol(String prefix) { minedBlocks = 0; maxTransPerBlock = Configuration.getInt(prefix + "." + PAR_MAX_TRANS_BLOCK); reward = Configuration.getDouble(prefix + "." + PAR_REWARD); nodeProtocol = Configuration.getPid(prefix + "." + PAR_NODE_PROT); } @Override public Object clone() { MinerProtocol mp = null; try { mp = (MinerProtocol)super.clone(); mp.setMinedBlocks(0); mp.setSelected(false); mp.setMaxTransPerBlock(maxTransPerBlock); mp.setReward(reward); mp.setNodeProtocol(nodeProtocol); } catch(CloneNotSupportedException e) { System.err.println(e); } return mp; } public boolean isSelected() { return selected; } public void setSelected(boolean selected) { this.selected = selected; } public void setMaxTransPerBlock(int maxTransPerBlock) { this.maxTransPerBlock = maxTransPerBlock; } public void setReward(double reward) { this.reward = reward; } public void setNodeProtocol(int nodeProtocol) { this.nodeProtocol = nodeProtocol; } public int getMinedBlocks() { return minedBlocks; } public void setMinedBlocks(int minedBlocks) { this.minedBlocks = minedBlocks; } @Override public void nextCycle(Node node, int pid) { TinyCoinNode tnode = (TinyCoinNode)node; if (!tnode.isMiner()) return; if (isSelected()) { setSelected(false); Map<String, Transaction> transPool = tnode.getTransPool(); List<Block> blockchain = tnode.getBlockchain(); // Create a new block and announce it to all the neighbors Block b = createBlock(transPool, tnode, blockchain); blockchain.add(b); tnode.increaseBalance(b.getRevenueForBlock()); //the reward for mining the block is given to the miner tnode.increaseBalance(b.getTransactionsAmountIfRecipient(tnode)); sendBlockToNeighbors(node, nodeProtocol, b); System.out.println("Mined a block!"); } } /** Sends a block b to the protocol pid of all the neighbor nodes * * @param sender The sender node * @param pid The id of the protocol the message is directed to * @param b The block to be sent */ public void sendBlockToNeighbors(Node sender, int pid, Block b) { int linkableID = FastConfig.getLinkable(pid); Linkable linkable = (Linkable) sender.getProtocol(linkableID); for (int i =0; i<linkable.degree(); i++) { Node peer = linkable.getNeighbor(i); ((Transport)sender.getProtocol(FastConfig.getTransport(pid))) .send(sender, peer, b, pid); } } private Block createBlock(Map<String, Transaction> transPool, TinyCoinNode tnode, List<Block> blockchain) { minedBlocks++; int transInBlock = Math.min(transPool.size(), maxTransPerBlock); String bid = "B" + tnode.getID() + minedBlocks; String parent = blockchain.size()== 0 ? null : blockchain.get(blockchain.size()-1).getBid(); List<Transaction> trans = new ArrayList<>(transInBlock); Iterator<String> iter = tnode.getTransPool().keySet().iterator(); for (int i=0; i< transInBlock; i++) { String key = iter.next(); Transaction t = transPool.get(key); iter.remove(); trans.add(t); } return new Block(bid, parent, tnode, trans, reward); } }
package com.company; public class Main { public static void main(String[] args) { Car name = new Car(3.2, 1997); name.zvuk(" Пип") ; name.PrintInfo(); System.out.println(name.PrintInfo()); System.out.println(" "); Tayota tayota = new Tayota("tayota", Collor.BLACK, 2019, 3.5); tayota.PrintInfo(); tayota.zvuk(" пап"); System.out.println(tayota.PrintInfo()); Tayota ron = new Tayota("bmw", Collor.RED, 2018, 3.2); ron.zvuk(" Дан ",3); ron.PrintInfo(); System.out.println(ron.PrintInfo()); } }
package com.mycompany.clusterjtestapp; import com.mysql.clusterj.ClusterJHelper; import com.mysql.clusterj.SessionFactory; import com.mysql.clusterj.Session; import com.mysql.clusterj.Query; import com.mysql.clusterj.query.QueryBuilder; import com.mysql.clusterj.query.QueryDomainType; import java.io.File; import java.io.InputStream; import java.io.FileInputStream; import java.io.*; import java.util.Properties; import java.util.List; import java.util.Random; public class App { public static void main(String[] args) throws java.io.FileNotFoundException, java.io.IOException { // Load the properties from the clusterj.properties file File propsFile = new File("clusterj.properties"); InputStream inStream = new FileInputStream(propsFile); Properties props = new Properties(); props.load(inStream); //Used later to get userinput BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); // Create a session (connection to the database) SessionFactory factory = ClusterJHelper.getSessionFactory(props); Session session = factory.getSession(); // Create and initialise an Employee Employee newEmployee = session.newInstance(Employee.class); Random rand = new Random(); rand.setSeed(System.currentTimeMillis()); int id = rand.nextInt(); newEmployee.setId(id); newEmployee.setFirst("John"); newEmployee.setLast("Jones"); newEmployee.setStarted("1 February 2009"); newEmployee.setDepartment(666); // Write the Employee to the database session.persist(newEmployee); //Fetch the Employee from the database Employee theEmployee = session.find(Employee.class, id); if (theEmployee == null) { System.out.println("Could not find employee"); } else { System.out.println("ID: " + theEmployee.getId() + "; Name: " + theEmployee.getFirst() + " " + theEmployee.getLast()); System.out.println("Location: " + theEmployee.getCity()); System.out.println("Department: " + theEmployee.getDepartment()); System.out.println("Started: " + theEmployee.getStarted()); System.out.println("Left: " + theEmployee.getEnded()); } } }
package com.roundarch.entity; import com.annconia.api.entity.AbstractEntity; public class Signal extends AbstractEntity { private double weight; private String name; public Signal() { } public Signal(String name) { this.name = name; } public double getWeight() { return weight; } public void setWeight(double weight) { this.weight = weight; } public String getName() { return name; } public void setName(String name) { this.name = name; } }
package com.zp.integration.pojo.dataobject; import lombok.Data; import java.io.Serializable; import java.util.Date; @Data public class UserDO implements Serializable { private Integer id; private String username; private String password; private Date birthday; private Integer age; private String sex; private String phone; private String address; private String role; public UserDO(){ super(); } public UserDO(Integer id, String username) { this.id = id; this.username = username; } public UserDO(Integer id, String username, String password) { this.id = id; this.username = username; this.password = password; } }
package com.project.personaddress.exceptions; import lombok.Getter; import java.util.List; import java.util.Map; import java.util.UUID; @Getter public class PersonAddressError { private String apiVersion; private ErrorBlock errorBlock; public PersonAddressError(String apiVersion, String code, String message, String domain, String reason, String errorMessage, String errorReportUri) { this.apiVersion = apiVersion; this.errorBlock = new ErrorBlock(code, message, domain, reason, errorMessage, errorReportUri); } public static PersonAddressError formDefaultAttibuteMap(String apiVersion, Map<String, Object> defaultErrorAttributes, String sendReportBaseurl) { return new PersonAddressError( apiVersion, ((Integer) defaultErrorAttributes.get("status")).toString(), (String) defaultErrorAttributes.getOrDefault("message", "no message available"), (String) defaultErrorAttributes.getOrDefault("path", "no domain available"), (String) defaultErrorAttributes.getOrDefault("error", "no reason available"), (String) defaultErrorAttributes.get("message"), sendReportBaseurl ); } public Map<String, Object> toAttribute() { return Map.of("apiVersion", apiVersion, "error", errorBlock); } @Getter private static final class ErrorBlock { private UUID uniqueId; private String code; private String message; private List<Error> errors; public ErrorBlock(UUID uniqueId, String code, String message, List<Error> errors) { this.uniqueId = uniqueId; this.code = code; this.message = message; this.errors = errors; } private ErrorBlock(String code, String message, String domain, String reason, String errorMessage, String errorReportUri) { this.code = code; this.message = message; this.errors = List.of(new Error(domain, reason, errorMessage, errorReportUri + "?id" + this.uniqueId)); } public static ErrorBlock copyWithMessage(final ErrorBlock s, final String message) { return new ErrorBlock(s.uniqueId, s.code, message, s.errors); } } @Getter private static final class Error { private final String domain; private final String reason; private final String message; private final String sendReport; public Error(String domain, String reason, String message, String sendReport) { this.domain = domain; this.reason = reason; this.message = message; this.sendReport = sendReport; } } }
package cqut.syntaxAnalyzer.ll_1; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import cqut.syntaxAnalyzer.ll_1.entity.FirstAndFollow; import cqut.syntaxAnalyzer.ll_1.entity.PredictionTable; /** * 生成预测分析表和first集。follow集 * * @author JiaoJian * * @date 2010-11-16 */ public class ProducePredictionTable { List<PredictionTable> pridictionTable=new ArrayList<PredictionTable>(); Map<String,FirstAndFollow> firstAndFollows=new HashMap<String, FirstAndFollow>();//存放所有的first集和follow集 public void first(String starting) { //根据产生式的开始符号,分析得到该非终结符的first集 } public void follow(String starting) { //根据提供的非终结符,分析得出该非终结符的follow集 } /** * 根据first集和follow集建立预测分析表 * * @return */ public List<PredictionTable> generate() { return null; } }
package com.gmail.filoghost.holographicdisplays.api.line; import com.gmail.filoghost.holographicdisplays.api.handler.PickupHandler; /** * A line of a Hologram that can be picked up. */ public interface CollectableLine extends HologramLine { /** * Sets the PickupHandler for this line. * * @param pickupHandler the new PickupHandler, can be null. */ public void setPickupHandler(PickupHandler pickupHandler); /** * Returns the current PickupHandler of this line. * * @return the current PickupHandler, can be null. */ public PickupHandler getPickupHandler(); }
package com.hoanganhtuan95ptit.demo.adapter; import android.app.Activity; import android.support.v7.widget.RecyclerView; import android.text.SpannableStringBuilder; import android.view.View; import android.view.ViewGroup; import android.widget.TextView; import com.hoanganhtuan95ptit.demo.R; import butterknife.BindView; import butterknife.ButterKnife; /** * Created by HOANG ANH TUAN on 7/8/2017. */ public class ChatAdapter extends BaseAdapter<SpannableStringBuilder> { public ChatAdapter(Activity activity) { super(activity); } @Override public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { View view = inflater.inflate(R.layout.item_chat, parent, false); return new ViewHolder(view); } @Override public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) { ViewHolder viewHolder = (ViewHolder) holder; viewHolder.tvInfor.setText(getDatas().get(position)); } static class ViewHolder extends RecyclerView.ViewHolder { @BindView(R.id.tv_infor) TextView tvInfor; ViewHolder(View view) { super(view); ButterKnife.bind(this, view); } } }
package com.tutorials7.java.homework04.collections; import java.util.ArrayList; import java.util.Scanner; public class Pr_03_LargestSequenceOfEqualStrings { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); String[] array = scanner.nextLine().split(" "); ArrayList<String> list = new ArrayList<>(); ArrayList<String> list2 = new ArrayList<>(); int count = 0; int maxCount = 0; for (int i = 0; i < array.length; i++) { if (!list2.contains(array[i])) { for (int j = 0; j < array.length; j++) { if (array[i].equals(array[j])) { count++; } } if (count > maxCount) { maxCount = count; list.clear(); list.add(array[i]); } count = 0; } } for (int i = 0; i < maxCount; i++) { System.out.print(list.get(0) + " "); } } }
package entity; import org.json.JSONException; import org.json.JSONObject; public class AdItem { private int ad_id; private float bid; private String image_url; private int advertiser_id; private float ad_score; private AdItem(AdItemBuilder builder) { this.ad_id = builder.ad_id; this.bid = builder.bid; this.image_url = builder.image_url; this.advertiser_id = builder.advertiser_id; this.ad_score = builder.ad_score; } public static class AdItemBuilder { private int ad_id; private float bid; private String image_url; private int advertiser_id; private float ad_score; public void setAd_id(int ad_id) { this.ad_id = ad_id; } public void setBid(float bid) { this.bid = bid; } public void setImage_url(String image_url) { this.image_url = image_url; } public void setAdvertiser_id(int advertiser_id) { this.advertiser_id = advertiser_id; } public void setAd_score(float ad_score) { this.ad_score = ad_score; } public AdItem build() { return new AdItem(this); } } public int getAd_id() { return ad_id; } public float getBid() { return bid; } public String getImage_url() { return image_url; } public int getAdvertiser_id() { return advertiser_id; } public float getAd_score() { return ad_score; } public JSONObject toJSONObject() { JSONObject obj = new JSONObject(); try { obj.put("ad_id", ad_id); obj.put("bid", bid); obj.put("image_url", image_url); obj.put("advertiser_id", advertiser_id); obj.put("ad_score", ad_score); } catch (JSONException e) { e.printStackTrace(); } return obj; } }
package Test; import cn.hutool.core.date.DateUtil; import java.text.SimpleDateFormat; import java.time.DayOfWeek; import java.time.LocalDate; import java.time.format.DateTimeFormatter; import java.time.temporal.WeekFields; import java.util.Calendar; import java.util.Date; public class DateTest { public static void main(String[] args) throws Exception { System.out.println(LocalDate.now().with(WeekFields.of(DayOfWeek.MONDAY, 1).getFirstDayOfWeek())); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); System.out.println("/**************************************************/"); Date date = sdf.parse("2020-12-26"); System.out.println(sdf.format(date) + " (周六)"); System.out.println("Calendar: " + sdf.format(getTimesWeekMorning(date))); System.out.println("Calendar: " + getWeek(date)); System.out.println("LocalDate: " + getTimesWeekLocalDate(sdf.format(date))); System.out.println("LocalDate: " + getWeekLocalDate(sdf.format(date))); System.out.println("hutool_DateUtil: " + DateUtil.beginOfWeek(date).toDateStr()); System.out.println("hutool_DateUtil: " + DateUtil.weekOfYear(date)); System.out.println("/**************************************************/"); Date date1 = sdf.parse("2020-12-27"); System.out.println(sdf.format(date1) + " (周日)"); System.out.println("Calendar: " + sdf.format(getTimesWeekMorning(date1))); System.out.println("Calendar: " + getWeek(date1)); System.out.println("LocalDate: " + getTimesWeekLocalDate(sdf.format(date1))); System.out.println("LocalDate: " + getWeekLocalDate(sdf.format(date1))); System.out.println("hutool_DateUtil: " + DateUtil.beginOfWeek(date1).toDateStr()); System.out.println("hutool_DateUtil: " + DateUtil.weekOfYear(date1)); System.out.println("/**************************************************/"); Date date2 = sdf.parse("2020-12-28"); System.out.println(sdf.format(date2) + " (周一)"); System.out.println("Calendar: " + sdf.format(getTimesWeekMorning(date2))); System.out.println("Calendar: " + getWeek(date2)); System.out.println("LocalDate: " + getTimesWeekLocalDate(sdf.format(date2))); System.out.println("LocalDate: " + getWeekLocalDate(sdf.format(date2))); System.out.println("hutool_DateUtil: " + DateUtil.beginOfWeek(date2).toDateStr()); System.out.println("hutool_DateUtil: " + DateUtil.weekOfYear(date2)); System.out.println("/**************************************************/"); Date date3 = sdf.parse("2021-01-01"); System.out.println(sdf.format(date3) + " (周五)"); System.out.println("Calendar: " + sdf.format(getTimesWeekMorning(date3))); System.out.println("Calendar: " + getWeek(date3)); System.out.println("LocalDate: " + getTimesWeekLocalDate(sdf.format(date3))); System.out.println("LocalDate: " + getWeekLocalDate(sdf.format(date3))); System.out.println("hutool_DateUtil: " + DateUtil.beginOfWeek(date3).toDateStr()); System.out.println("hutool_DateUtil: " + DateUtil.weekOfYear(date3)); System.out.println("/**************************************************/"); Date date4 = sdf.parse("2021-01-03"); System.out.println(sdf.format(date4) + " (周日)"); System.out.println("Calendar: " + sdf.format(getTimesWeekMorning(date4))); System.out.println("Calendar: " + getWeek(date4)); System.out.println("LocalDate: " + getTimesWeekLocalDate(sdf.format(date4))); System.out.println("LocalDate: " + getWeekLocalDate(sdf.format(date4))); System.out.println("hutool_DateUtil: " + DateUtil.beginOfWeek(date4).toDateStr()); System.out.println("hutool_DateUtil: " + DateUtil.weekOfYear(date4)); } public static Date getTimesWeekMorning(Date date) { Calendar cal = Calendar.getInstance(); cal.setTime(date); cal.setFirstDayOfWeek(Calendar.MONDAY); // Calendar默认每周的第一天是周日,不是周一,所以在周日时获取本周周一需要特殊处理 cal.set(cal.get(Calendar.YEAR), cal.get(Calendar.MONTH), cal.get(Calendar.DAY_OF_MONTH), 0, 0, 0); cal.set(Calendar.DAY_OF_WEEK, Calendar.MONDAY); return cal.getTime(); } public static int getWeek(Date date) { Calendar cal = Calendar.getInstance(); cal.setTime(date); cal.setFirstDayOfWeek(Calendar.MONDAY); return cal.get(Calendar.WEEK_OF_YEAR); } public static String getTimesWeekLocalDate(String dateStr) { DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd"); DateTimeFormatter weekTimeFormatter = DateTimeFormatter.ofPattern("w"); WeekFields weekFields = WeekFields.of(DayOfWeek.MONDAY,1); return LocalDate.parse(dateStr, dateTimeFormatter).with(weekFields.getFirstDayOfWeek()).toString(); } public static int getWeekLocalDate(String dateStr) { DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd"); DateTimeFormatter weekTimeFormatter = DateTimeFormatter.ofPattern("w"); WeekFields weekFields = WeekFields.of(DayOfWeek.MONDAY,1); return Integer.parseInt(LocalDate.parse(dateStr, dateTimeFormatter).with(weekFields.dayOfWeek(), 1).format(weekTimeFormatter)); } }
import org.junit.Assert; import org.junit.BeforeClass; import org.junit.Test; /** * Created by Daniel on 2/5/2017. */ public class PalindromeTest { private static Palindrome sut; @BeforeClass public static void init(){ sut = new Palindrome(); } @Test public void test1(){ String s = ""; boolean actual = sut.palindrome(s); Assert.assertEquals(true, actual); } @Test public void test2(){ String s = "a"; boolean actual = sut.palindrome(s); Assert.assertEquals(true, actual); } @Test public void test3(){ String s = "ab"; boolean actual = sut.palindrome(s); Assert.assertEquals(false, actual); } @Test public void test4(){ String s = ""; boolean actual = sut.recursive(s); Assert.assertEquals(true, actual); } @Test public void test5(){ String s = "a"; boolean actual = sut.recursive(s); Assert.assertEquals(true, actual); } @Test public void test6(){ String s = "ab"; boolean actual = sut.recursive(s); Assert.assertEquals(false, actual); } @Test public void test7(){ String s = "fdafasfefq"; boolean actual = sut.recursive(s); Assert.assertEquals(false, actual); } @Test public void test8(){ String s = "ababa"; boolean actual = sut.recursive(s); Assert.assertEquals(true, actual); } }
package hu.lamsoft.hms.androidclient.adapter; import android.app.Activity; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.BaseAdapter; import java.util.LinkedList; import java.util.List; import hu.lamsoft.hms.androidclient.restapi.common.dto.BaseDTO; /** * Created by admin on 2017. 04. 15.. */ public class PageableDTOAdapter<T extends BaseDTO, K extends ViewHolder<T>> extends BaseAdapter { private List<T> list = new LinkedList<>(); private Activity activity; private int resource; private Class<K> viewHolderType; public PageableDTOAdapter(Activity activity, int resource, Class<K> viewHolderType) { this.activity = activity; this.resource = resource; this.viewHolderType = viewHolderType; } public void add(List<T> list){ this.list.addAll(list); } @Override public int getCount() { return list.size(); } @Override public T getItem(int position) { return list.get(position); } @Override public long getItemId(int position) { return list.get(position).getId(); } @Override public View getView(int position, View convertView, ViewGroup parent) { K viewHolder; if(convertView == null){ LayoutInflater layoutInflater = LayoutInflater.from(activity); convertView = layoutInflater.inflate(resource, parent, false); viewHolder = constructorViewHolder(convertView); convertView.setTag(viewHolder); } else { viewHolder = (K) convertView.getTag(); } viewHolder.setValues(getItem(position)); return convertView; } private K constructorViewHolder(View convertView) { try { return viewHolderType.getConstructor(View.class).newInstance(convertView); } catch (Exception e) { throw new RuntimeException(e); } } }
/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package histograma; import java.util.HashMap; import java.util.Map; /** * * @author usuario */ public class Histograma { /** * @param args the command line arguments */ public static void main(String[] args) { Integer [] data = {1,2,-3,7,7,7,2}; Histogram histo = new Histogram(data); Map<Integer,Integer> histogr = new histo.getHistogram(); for(int key : histogr.keySet()){ System.out.println(key + " -->" + histogr.get(key)); } } }
/** * <p>Title: </p> * * <p>Description: </p> * * <p>Copyright: Copyright (c) 2013</p> * * <p>Company: </p> * * @author billw * @version 1.0.5 */ package com.sowrdking.imgpuzzle; /** * @author billw * */ import java.util.ArrayList; import android.content.Context; import android.view.View; import android.view.ViewGroup; import android.widget.AbsListView; import android.widget.BaseAdapter; import android.widget.ImageView; public class ImageViewAdapter extends BaseAdapter { private Context context; private ArrayList<ImageView> arraylist_imageview; private int imageviewwidth, imageviewheight; public ImageViewAdapter(Context context, ArrayList<ImageView> arraylist_imageview) { this.context = context; this.arraylist_imageview = arraylist_imageview; } @Override public int getCount() { return arraylist_imageview.size(); } @Override public Object getItem(int position) { return arraylist_imageview.get(position); } @Override public long getItemId(int position) { return position; } @Override public View getView(int position, View convertView, ViewGroup parent) { convertView = arraylist_imageview.get(position); convertView.setLayoutParams(new AbsListView.LayoutParams( imageviewwidth, imageviewheight)); return convertView; } public void setImageViewWidth(int width) { this.imageviewwidth = width; } public void setImageViewHeight(int height) { this.imageviewheight = height; } }
package com.penglai.haima.adapter; import androidx.annotation.NonNull; import androidx.annotation.Nullable; import android.view.View; import android.widget.ImageView; import android.widget.TextView; import com.chad.library.adapter.base.BaseQuickAdapter; import com.chad.library.adapter.base.BaseViewHolder; import com.penglai.haima.R; import java.util.List; /** * Created by on 2020/3/12. * 文件说明: */ public class SearchHistoryAdapter extends BaseQuickAdapter<String, BaseViewHolder> { private boolean delete_choose_statue; public SearchHistoryAdapter(@Nullable List<String> data) { super(R.layout.item_search_word, data); } @Override protected void convert(@NonNull BaseViewHolder helper, String item) { TextView tv_word = helper.getView(R.id.tv_word); ImageView img_delete = helper.getView(R.id.img_delete); View line = helper.getView(R.id.line); tv_word.setText(item); img_delete.setVisibility(delete_choose_statue ? View.VISIBLE : View.GONE); line.setVisibility(helper.getLayoutPosition() % 2 == 0 ? View.VISIBLE : View.GONE); } public void setDelete_choose_statue(boolean delete_choose_statue) { this.delete_choose_statue = delete_choose_statue; notifyDataSetChanged(); } public boolean isDelete_choose_statue() { return delete_choose_statue; } }
package com.siokagami.application.mytomato.widget; import android.os.Handler; import android.os.Message; import android.util.Log; public abstract class TomatoCountdownTimer { private static final int TOMATO_START = 1; private static final int TOMATO_PAUSE = 2; private final long mCountdownInterval; private long totalTime; private long mRemainTime; /** * @param totalTime 表示以毫秒为单位 倒计时的总数 * <p> * 例如 totalTime=1000 表示1秒 * @param tickTime 表示 间隔 多少微秒 调用一次 onTick 方法 * <p> * 例如: tickTime =1000 ; 表示每1000毫秒调用一次onTick() */ public TomatoCountdownTimer(long totalTime, long tickTime) { this.totalTime = totalTime; mCountdownInterval = tickTime; mRemainTime = totalTime; } public final void seek(int value) { synchronized (TomatoCountdownTimer.this) { mRemainTime = ((100 - value) * totalTime) / 100; } } public final void cancel() { tHandler.removeMessages(TOMATO_START); tHandler.removeMessages(TOMATO_PAUSE); } public final void resume() { tHandler.removeMessages(TOMATO_PAUSE); tHandler.sendMessageAtFrontOfQueue(tHandler.obtainMessage(TOMATO_START)); } public final void restart() { mRemainTime = totalTime; pause(); resume(); } public final void next() { pause(); resume(); } public final void changeTime2RestMode() { mRemainTime = 6000; } public final void changeTime2WorkMode() { mRemainTime = 10000; } public long getmRemainTime() { return mRemainTime; } public void setmRemainTime(long mRemainTime) { this.mRemainTime = mRemainTime; } public final void pause() { tHandler.removeMessages(TOMATO_START); tHandler.sendMessageAtFrontOfQueue(tHandler.obtainMessage(TOMATO_PAUSE)); } public synchronized final TomatoCountdownTimer start() { if (mRemainTime <= 0) { onFinish(); return this; } tHandler.sendMessageDelayed(tHandler.obtainMessage(TOMATO_START), mCountdownInterval); return this; } public abstract void onTick(long millisUntilFinished, int percent); public abstract void onFinish(); private Handler tHandler = new Handler() { @Override public void handleMessage(Message msg) { super.handleMessage(msg); synchronized (TomatoCountdownTimer.this) { switch (msg.what) { case TOMATO_START: mRemainTime = mRemainTime - mCountdownInterval; if (mRemainTime <= 0) { onFinish(); } else if (mRemainTime < mCountdownInterval) { sendMessageDelayed(obtainMessage(TOMATO_START), mRemainTime); } else { onTick(mRemainTime, new Long(100 * (totalTime - mRemainTime) / totalTime) .intValue()); Log.d("siokagami", "handleMessage: "); sendMessageDelayed(obtainMessage(TOMATO_START), mCountdownInterval); } break; case TOMATO_PAUSE: break; } } } }; }
package com.hillel.javaElementary.classes.Lesson_3; import com.hillel.javaElementary.classes.Lesson_3.Goods.Good; import java.math.BigDecimal; public class Product { private String name; private BigDecimal price = new BigDecimal(0); private long id; private int count; private Good good; public Product(String name, BigDecimal cost, long id, int count, Good good){ this.id = id; this.name = name; this.count = count; this.good = good; calculatePrice(cost); } public BigDecimal getPrice() { return price; } public int getCount() { return count; } public long getId() { return id; } public String getName() { return name; } public Good getGood() { return good; } private void calculatePrice(BigDecimal cost){ price = cost.multiply(new BigDecimal(count)); } }
package ad_ejercicio_23; /** * * @author abrandarizdominguez */ public class AD_Ejercicio_23 { /** * @param args the command line arguments */ public static void main(String[] args) { Conexion conn = new Conexion(); conn.connect(); conn.procedure(2, 5); conn.close(); } }
import org.junit.Ignore; import org.junit.Test; import java.io.ByteArrayInputStream; import static junit.framework.TestCase.assertEquals; public class UserPlayerTest { @Test public void shouldReadSingleInputFromUserForCheat(){ System.setIn(new ByteArrayInputStream("xmx,xxm,mxx".getBytes())); assertEquals("xmx,xxm,mxx", new ConsoleInputReader().readSingleInput()); } @Ignore @Test public void shouldReadSingleInputFromUserForCooperate(){ System.setIn(new ByteArrayInputStream("COOPERATE".getBytes())); assertEquals(Input.COOPERATE, new ConsoleInputReader().readSingleInput()); } }
/* * @(#) ISapifInfoDAO.java * Copyright (c) 2006 eSumTech Co., Ltd. All Rights Reserved. */ package com.esum.wp.ims.sapifinfo.dao; import java.util.List; import java.util.Map; import com.esum.appframework.dao.IBaseDAO; import com.esum.appframework.exception.ApplicationException; /** * * @author heowon@esumtech.com * @version $Revision: 1.2 $ $Date: 2009/01/16 08:22:49 $ */ public interface ISapifInfoDAO extends IBaseDAO { List sapifInfoDetail(Object object) throws ApplicationException; List sapifInfoPageList(Object object) throws ApplicationException; Map saveSapifInfoExcel(Object object) throws ApplicationException; }
package com.company; public class customer { private int custNo; private String fName,lName,addr,pCode,town,telNo,email; public customer(int newCustNo){ setCustNo(newCustNo); } public customer(int newCustNo, String newFName){ this(newCustNo); setfName(newFName); } public customer(int newCustNo, String newFName, String newLName){ this(newCustNo,newFName); setlName(newLName); } public customer(int newCustNo, String newFName, String newLName, String newAddr){ this(newCustNo,newFName, newLName); setAddr(newAddr); } public customer(int newCustNo, String newFName, String newLName, String newAddr, String newPCode){ this(newCustNo,newFName, newLName, newAddr); setpCode(newPCode); } public customer(int newCustNo, String newFName, String newLName, String newAddr, String newPCode, String newTown){ this(newCustNo,newFName, newLName, newAddr, newPCode); setTown(newTown); } public customer(int newCustNo, String newFName, String newLName, String newAddr, String newPCode, String newTown, String newTellNo){ this(newCustNo,newFName, newLName, newAddr, newPCode, newTown); setTelNo(newTellNo); } public customer(int newCustNo, String newFName, String newLName, String newAddr, String newPCode, String newTown, String newTellNo, String newEmail){ this(newCustNo,newFName, newLName, newAddr, newPCode, newTown, newTellNo); setEmail(newEmail); } public int getCustNo() { return custNo; } public void setCustNo(int custNo) { this.custNo = custNo; } public String getfName() { return fName; } public void setfName(String fName) { this.fName = fName; } public String getlName() { return lName; } public void setlName(String lName) { this.lName = lName; } public String getAddr() { return addr; } public void setAddr(String addr) { this.addr = addr; } public String getpCode() { return pCode; } public void setpCode(String pCode) { this.pCode = pCode; } public String getTown() { return town; } public void setTown(String town) { this.town = town; } public String getTelNo() { return telNo; } public void setTelNo(String telNo) { this.telNo = telNo; } public String getEmail() { return email; } public void setEmail(String email) { this.email = email; } public String toString() { return String.format("Customer %d: %s %s. Address: %s, %s, %s. Email : %s. Phone no: %s", this.getCustNo(), this.getfName(), this.getlName(), this.getAddr(),this.getTown(),this.getpCode(), this.getEmail(), this.getTelNo()); } }
package com.mygdx.renderable; import java.util.List; import com.badlogic.gdx.Gdx; import com.badlogic.gdx.graphics.Color; import com.badlogic.gdx.graphics.Texture; import com.badlogic.gdx.graphics.g2d.Animation; import com.badlogic.gdx.graphics.g2d.TextureRegion; import com.badlogic.gdx.math.Rectangle; /** * Holds the information about the spray and animation of the spray. */ public class Spray extends Renderable { /** Checks if the spray is currently active */ private Boolean isActive; /** The flame columns of the animation sheet*/ protected static final int FRAME_COLS = 2; /** The flame rows of the animation sheet*/ protected static final int FRAME_ROWS = 1; /** Animation of the spray for the player*/ protected Animation<TextureRegion> Animation; /** The color of the light of the spray for the player.*/ private Color colorLight; /** The damage/heal of the spray */ private float deltaValue; /** * The spray constructor * @param deltaValue The damage/heal the spray is able to do * @param color The color of the spray. */ public Spray(float deltaValue, Color color) { this.isActive = false; this.deltaValue = deltaValue; this.colorLight = color; start(); } /** Return the delta health value of the spray */ public float getValue() { return deltaValue; } /** Set the delta health value of the spray * @param newDeltaValue the new delta value of the spray. */ public void setValue(float newDeltaValue) { this.deltaValue = newDeltaValue; } /** * This changes the texture of the spray depending on whether or not * the boolean value is true or false. * @param value If Mouse has been clicked. */ public void setVisible(Boolean value) { if(value) { getSprite().rotate90(true); getSprite().setAlpha(1); setIsActive(true); Rectangle rect = getSprite().getBoundingRectangle().setSize(26, 26); getSprite().getBoundingRectangle().set(rect); isActive = true; } else { setIsActive(false); getSprite().setAlpha(0); Rectangle rect = getSprite().getBoundingRectangle().setSize(24, 24); getSprite().getBoundingRectangle().set(rect); isActive = false; } } /** * Checks for collisions between the spray sprite and NPC Sprite. * @param list An array of NPC characters */ public Boolean collision(List<NPC> list, float f, Player p) { for(NPC npc : list) { if(npc.getRectangle().overlaps(sprite.getBoundingRectangle())) { if(isActive) { if(npc.getStatus().equals("Dead") && f == 1) { npc.setFoodGiven(true); npc.changeHealth(deltaValue); npc.setSanity(true); } else if(npc.getStatus().equals("Sick")) { if(f == 0) { npc.changeHealth(deltaValue); if(npc.getHealed() && !npc.foodGiven()) { p.updateFood(50); npc.setFoodGiven(true); return true; } } else { if(f == 1) { npc.setFoodGiven(true); npc.changeHealth(deltaValue); npc.setSanity(true); } } } else { if(f == 1) { npc.setFoodGiven(true); npc.changeHealth(deltaValue); if(npc.getStatus().equals("Burnt")) { npc.setSanity(false); } } } } else { npc.setSanity(false); } } else { npc.setSanity(false); } } return false; } /** * Sets the animation of the spray. If the deltaValue is less than 0 then it can only be * a flamethrower type spray so the spray type is set to that if they deltaValue is greater * than 0 then it's a cure type spray and will be assigned a normally spray type. */ public void start() { if(deltaValue < 0) { Texture walksheet = new Texture(Gdx.files.internal("spray/fire.png")); TextureRegion[][] tmp = TextureRegion.split(walksheet, walksheet.getWidth() / FRAME_COLS, walksheet.getHeight() / FRAME_ROWS); TextureRegion[] walkFrames = new TextureRegion[FRAME_COLS * FRAME_ROWS]; int index = 0; for (int i = 0; i < FRAME_ROWS; i++) { for (int j = 0; j < FRAME_COLS; j++) { walkFrames[index++] = tmp[i][j]; } } Animation = new Animation<TextureRegion>(0.1f, walkFrames); super.setSprite(walkFrames[0], 0, 0); super.getSprite().setAlpha(0); } else { Texture walksheet = new Texture(Gdx.files.internal("spray/spray.png")); TextureRegion[][] tmp = TextureRegion.split(walksheet, walksheet.getWidth() / FRAME_COLS, walksheet.getHeight() / FRAME_ROWS); TextureRegion[] walkFrames = new TextureRegion[FRAME_COLS * FRAME_ROWS]; int index = 0; for (int i = 0; i < FRAME_ROWS; i++) { for (int j = 0; j < FRAME_COLS; j++) { walkFrames[index++] = tmp[i][j]; } } Animation = new Animation<TextureRegion>(0.1f, walkFrames); super.setSprite(walkFrames[0], 0, 0); super.getSprite().setAlpha(0); } } /** * Updates the sprite position. * @param rotation Used in calculations to find out correct X and Y Coordinates * @param OriginX The X Point of the centre of the Player Sprite. * @param OriginY The Y Point of the centre of the Player Sprite * @param npcs The NPC's (Villagers) within the level. * @see Math * @see NPC */ public void update(float rotation, float OriginX, float OriginY, List<NPC> npcs) { float angle = (float) Math.toRadians(rotation+11); Float x = (float) ((32) * Math.cos(angle)) + OriginX; Float y = (float) ((32) * Math.sin(angle)) + OriginY; getSprite().setPosition(x, y); } /** * Get if spray is active * @return Is spray active */ public Boolean getIsActive() { return isActive; } /** * Sets the spray as active when used * @param isActive spray is active */ public void setIsActive(Boolean isActive) { this.isActive = isActive; } /** * Add to the strength of the spray * @param deltaSpray DeltaValue of the spray */ public void addStrength(float deltaSpray) { this.deltaValue = this.deltaValue + deltaSpray; } /** * The animation of each of the sprays * @return current animation of the spray */ public Animation<TextureRegion> getAnimation() { return Animation; } /** * Return the color of the spray * @return The color of the spray. */ public Color getColor() { return this.colorLight; } }
package com.example.workstudy.jdk; public class Proxy implements StaticProxy { /** * 静态代理 * 引入第三方,代理方 * 之前只有接口和实现类,现在中间加了一层代理对象,核心还是高内聚,低耦合 * 但是这样增加代码耦合度,一次新增接口方法,涉及到的修改太多 * 动态代理 * 两种实现方式 * 代码的动态编译:1. JDK动态代理:使用Reflect类和InvocationHandler接口来实现动态代理的能力 * JDK动态代理的限制,代理对象必须实现一个或者多个接口,如果代理没有接口的实现类,需要使用Cglib 代理方式 * 1.Cglib(Code Generation Library) 第三方的代码生成类库,在运行时动态生成一个子类来实现目标对象的功能扩展 * Cglib 代理类可以坐到无侵入代理 * */ private StaticProxyImpl staticProxy; public Proxy(){ } public Proxy(StaticProxyImpl staticProxy){ this.staticProxy = staticProxy; } @Override public void say() { System.out.println("静态代理前"); staticProxy.say(); System.out.println("静态代理后"); } @Override public void eat() { } public static void main(String[] args) { new Proxy(new StaticProxyImpl()).say(); //只能转换为公共接口类 StaticProxy staticProxy = (StaticProxy) new DynamicProxy(new StaticProxyImpl()).getProxy(); staticProxy.eat(); //不需要接口也可以实现动态代理 StaticProxyImpl s = (StaticProxyImpl) new CglibProxy(new StaticProxyImpl()).getProxy(); s.eat(); } }
package org.patsimas.mongo.dto; import lombok.*; import java.util.List; @Data @Builder @NoArgsConstructor @AllArgsConstructor @ToString public class MovieDto { private Integer id; private String title; private List<String> genre; private String director; private Integer year; private Double revenue; }
package ca.brocku.cosc3p97.bigbuzzerquiz.views; import android.app.Activity; import android.content.Context; import android.net.wifi.WpsInfo; import android.net.wifi.p2p.WifiP2pConfig; import android.net.wifi.p2p.WifiP2pDevice; import android.net.wifi.p2p.WifiP2pDeviceList; import android.net.wifi.p2p.WifiP2pManager; import android.net.wifi.p2p.WifiP2pManager.Channel; import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.BaseAdapter; import android.widget.CheckBox; import android.widget.CompoundButton; import android.widget.ProgressBar; import android.widget.TextView; import android.widget.Toast; import java.util.ArrayList; import java.util.List; import ca.brocku.cosc3p97.bigbuzzerquiz.R; import ca.brocku.cosc3p97.bigbuzzerquiz.models.WifiP2pDeviceDecorator; import ca.brocku.cosc3p97.bigbuzzerquiz.models.WifiP2pHelper; /** * The Adapter for the ListView of the Devices in the WifiSetupFragment */ public class DeviceListAdapter extends BaseAdapter { private static final String TAG = "DeviceListAdapter"; private List<WifiP2pDeviceDecorator> peers; private Activity activity; private LayoutInflater inflater; WifiP2pManager manager; Channel channel; /** * Constructor * @param activity * @param manager * @param channel * @param peers */ public DeviceListAdapter(Activity activity, WifiP2pManager manager, Channel channel, List<WifiP2pDeviceDecorator> peers) { this.activity = activity; this.manager = manager; this.channel = channel; this.peers = peers; inflater = (LayoutInflater) activity.getSystemService(Context.LAYOUT_INFLATER_SERVICE); } /** * Copys all devices of the List into a new List * @param list WifiP2pDeviceList * @return List<WifiP2pDeviceDecorator> */ public static List<WifiP2pDeviceDecorator> copy (WifiP2pDeviceList list) { List<WifiP2pDeviceDecorator> result = new ArrayList<>(); for(WifiP2pDevice device : list.getDeviceList()) { result.add(new WifiP2pDeviceDecorator(device)); } return result; } @Override public int getCount() { return peers.size(); } @Override public Object getItem(int index) { return peers.get(index); } @Override public long getItemId(int index) { return index; } /** * {@inheritDoc} * * Handles how the devices are displayed * * @param index * @param view * @param viewGroup * @return */ @Override public View getView(final int index, View view, ViewGroup viewGroup) { if (view == null) { view = inflater.inflate(R.layout.peer_list_item, null); } CheckBox checkBox = (CheckBox) view.findViewById(R.id.deviceNameCheckBox); checkBox.setChecked(peers.get(index).status == WifiP2pDevice.CONNECTED); checkBox.setText(peers.get(index).deviceName); checkBox.setOnCheckedChangeListener(getOnCheckedChangeListener(index)); ((TextView) view.findViewById(R.id.statusTextView)).setText(WifiP2pHelper.convertStatus(peers.get(index).status)); ((TextView) view.findViewById(R.id.ownerTextView)).setText(peers.get(index).isGroupOwner() ? "Y" : "N"); ((ProgressBar) view.findViewById(R.id.progressBar)).setVisibility(peers.get(index).isConnecting ? View.VISIBLE : View.INVISIBLE); return view; } /** * Handles the connection to the devices * * @param index * @return */ private CompoundButton.OnCheckedChangeListener getOnCheckedChangeListener(final int index) { return new CompoundButton.OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton compoundButton, boolean isChecked) { if(peers.size() > 0) { peers.get(index).isSelected = isChecked; switch (peers.get(index).status) { case WifiP2pDevice.AVAILABLE: WifiP2pDevice device = peers.get(index); WifiP2pConfig config = new WifiP2pConfig(); config.deviceAddress = device.deviceAddress; config.wps.setup = WpsInfo.PBC; manager.connect(channel, config, new WifiP2pManager.ActionListener() { @Override public void onSuccess() { peers.get(index).isConnecting = true; notifyDataSetChanged(); Log.i(TAG, "call to connect was successful"); } @Override public void onFailure(int i) { Log.e(TAG, "call to connect failed with status: " + WifiP2pHelper.convertFailureStatus(i)); Toast.makeText(activity, "Call to connect failed with status: " + WifiP2pHelper.convertFailureStatus(i), Toast.LENGTH_SHORT).show(); peers.get(index).isConnecting = false; notifyDataSetChanged(); } }); break; } } notifyDataSetChanged(); } }; } }
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package com.innovaciones.reporte.service; import com.innovaciones.reporte.dao.ReporteDAO; import com.innovaciones.reporte.model.AsignacionReparacion; import com.innovaciones.reporte.model.Cliente; import com.innovaciones.reporte.model.ClienteSucursal; import com.innovaciones.reporte.model.DTO.DatosReporteDTO; import com.innovaciones.reporte.model.DetalleCatalogoReporte; import com.innovaciones.reporte.model.DetalleInventarioProducto; import com.innovaciones.reporte.model.DetalleReporteEcu911; import com.innovaciones.reporte.model.DetalleReporteInstalacionNueva; import com.innovaciones.reporte.model.DetalleReporteTemporal; import com.innovaciones.reporte.model.Producto; import com.innovaciones.reporte.model.ProductoClienteReporte; import com.innovaciones.reporte.model.ProductoDetalleReporte; import com.innovaciones.reporte.model.ProductoRepuestoReporte; import com.innovaciones.reporte.model.Proyectos; import com.innovaciones.reporte.model.Reporte; import com.innovaciones.reporte.model.ReporteGenericoItems; import com.innovaciones.reporte.model.ReporteMantenimiento; import com.innovaciones.reporte.model.TipoVisita; import com.innovaciones.reporte.model.Usuarios; import com.innovaciones.reporte.util.Enums; import com.innovaciones.reporte.util.ReporteTecnico; import com.innovaciones.reporte.util.Utilities; import java.io.Serializable; import java.util.ArrayList; import java.util.Date; import java.util.List; import java.util.Objects; import javax.faces.bean.ManagedBean; import javax.faces.bean.ManagedProperty; import javax.faces.bean.ViewScoped; import lombok.Getter; import lombok.Setter; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; /** * * @author pisama */ @Service @ManagedBean(name = "reporteService") @ViewScoped public class ReporteServiceImpl extends Utilities implements ReporteService, Serializable { @Setter private ReporteDAO reporteDAO; @Getter @Setter @ManagedProperty("#{reporteMantenimientoService}") private ReporteMantenimientoService reporteMantenimientoService; @Getter @Setter @ManagedProperty("#{productoDetalleReporteService}") private ProductoDetalleReporteService productoDetalleReporteService; @Getter @Setter @ManagedProperty("#{productoClienteReporteService}") private ProductoClienteReporteService productoClienteReporteService; @Getter @Setter @ManagedProperty("#{productoService}") private ProductoService productoService; @Getter @Setter @ManagedProperty("#{asignacionReparacionService}") private AsignacionReparacionService asignacionReparacionService; @Getter @Setter @ManagedProperty("#{productoRepuestoReporteService}") private ProductoRepuestoReporteService productoRepuestoReporteService; @Getter @Setter @ManagedProperty("#{detalleCatalogoReporteService}") private DetalleCatalogoReporteService detalleCatalogoReporteService; @Getter @Setter @ManagedProperty("#{detalleReporteInstalacionNuevaService}") private DetalleReporteInstalacionNuevaService detalleReporteInstalacionNuevaService; @Getter @Setter @ManagedProperty("#{detalleReporteTemporalService}") private DetalleReporteTemporalService detalleReporteTemporalService; @Getter @Setter @ManagedProperty("#{detalleInventarioProductoService}") private DetalleInventarioProductoService detalleInventarioProductoService; @Getter @Setter @ManagedProperty("#{detalleReporteEcu911Service}") private DetalleReporteEcu911Service detalleReporteEcu911Service; @Getter @Setter @ManagedProperty("#{consultasService}") private ConsultasService consultasService; @Getter @Setter @ManagedProperty("#{clienteService}") private ClienteService clienteService; @Getter @Setter @ManagedProperty("#{parametrosService}") private ParametrosService parametrosService; @Getter @Setter @ManagedProperty("#{clienteSucursalService}") private ClienteSucursalService clienteSucursalService; @Getter @Setter @ManagedProperty("#{tipoVisitaService}") private TipoVisitaService tipoVisitaService; @Getter @Setter @ManagedProperty("#{reporteGenericoItemsService}") private ReporteGenericoItemsService reporteGenericoItemsService; @Getter @Setter @ManagedProperty("#{cabeceraCatalogoReporteService}") private CabeceraCatalogoReporteService cabeceraCatalogoReporteService; private ProductoClienteReporte globalProductoClienteReporte; private ReporteMantenimiento mantenimiento; private ReporteMantenimiento mantenimientoAux; private ReporteGenericoItems reporteGenericoItem; private ReporteGenericoItems reporteGenericoItemAux; @Override @Transactional public Reporte save(Reporte reporte) { return reporteDAO.saveReporte(reporte); } @Override @Transactional public Reporte update(Reporte reporte) { return reporteDAO.updateReporte(reporte); } @Override @Transactional public Reporte geById(Integer idReporte) { return reporteDAO.getReporteById(idReporte); } @Override @Transactional public List<Reporte> getByUserByTipo(Integer idUsuario, String tipo, String subtipo) { return reporteDAO.getReporteByUserByTipo(idUsuario, tipo, subtipo); } @Override @Transactional public void saveAllReporteMobile(Reporte reporte, Cliente cliente, Producto producto, String serie, ProductoDetalleReporte productoDetalleReporte, ProductoClienteReporte productoClienteReporte, Integer idClienteSucursal, Integer idTipoVisita, Usuarios usuario, AsignacionReparacion asignacionReparacion, Integer idProyecto, List<List<DetalleCatalogoReporte>> listCorrectivos, List<List<DetalleCatalogoReporte>> listPreventivos, List<DetalleCatalogoReporte> listOtros) { globalProductoClienteReporte = new ProductoClienteReporte(); Reporte newReporte = new Reporte(); newReporte = reporte; newReporte.setIdVisita(new TipoVisita(idTipoVisita)); newReporte.setIdUsuario(usuario); newReporte.setFecha(new Date()); newReporte.setFechaCreacion(new Date()); newReporte.setUsuarioCreacion(usuario.getUsuario()); newReporte = this.save((Reporte) toUpperCaseStrings(newReporte)); DetalleInventarioProducto searchDetalleInventarioProducto = new DetalleInventarioProducto(); searchDetalleInventarioProducto = detalleInventarioProductoService.getBySerial(serie); boolean existeDetalleInventarioProducto = (searchDetalleInventarioProducto == null); ProductoClienteReporte newProductoClienteReporte = new ProductoClienteReporte(); newProductoClienteReporte = productoClienteReporte; if (existeDetalleInventarioProducto) { searchDetalleInventarioProducto = null; } newProductoClienteReporte.setIdDetalleInventarioProducto(searchDetalleInventarioProducto); newProductoClienteReporte.setIdReporte(newReporte); newProductoClienteReporte.setIdCliente(cliente); newProductoClienteReporte.setSerie(serie); newProductoClienteReporte.setIdProducto(producto); newProductoClienteReporte.setIdProductoDetalleReporte(productoDetalleReporteService.add(productoDetalleReporte)); newProductoClienteReporte.setIdClienteSucursal(new ClienteSucursal(idClienteSucursal)); if (idProyecto != null) { newProductoClienteReporte.setIdProyecto(new Proyectos(idProyecto)); } globalProductoClienteReporte = (productoClienteReporteService.save(newProductoClienteReporte)); if (asignacionReparacion != null && asignacionReparacion.getId() != null) { AsignacionReparacion newAsignacionReparacion = new AsignacionReparacion(); newAsignacionReparacion = asignacionReparacion; newAsignacionReparacion.setIdReporte(newReporte.getId()); newAsignacionReparacion.setEstado(newReporte.getEstado()); asignacionReparacionService.addAsignacionReparacion(asignacionReparacion); } this.saveRepuestosReportePreventivosMobile(globalProductoClienteReporte, listPreventivos); this.saveRepuestosReporteCorrectivosMobile(globalProductoClienteReporte, listCorrectivos); } @Override @Transactional public void updateAllReporteMobile(Reporte reporte, Cliente cliente, Producto producto, DetalleInventarioProducto detalleInventarioProducto, ProductoDetalleReporte productoDetalleReporte, ProductoClienteReporte productoClienteReporte, Integer idClienteSucursal, Integer idTipoVisita, Integer idProyecto, Usuarios usuario, List<List<DetalleCatalogoReporte>> listCorrectivos, List<List<DetalleCatalogoReporte>> listPreventivos, List<DetalleCatalogoReporte> listOtros) { globalProductoClienteReporte = new ProductoClienteReporte(); Reporte newReporte = new Reporte(); newReporte = reporte; newReporte.setIdVisita(new TipoVisita(idTipoVisita)); newReporte.setIdUsuario(usuario); newReporte.setFechaModificacion(new Date()); newReporte.setUsuarioModificacion(usuario.getUsuario()); newReporte = this.update((Reporte) toUpperCaseStrings(newReporte)); ProductoClienteReporte newProductoClienteReporte = new ProductoClienteReporte(); newProductoClienteReporte = productoClienteReporte; newProductoClienteReporte.setIdReporte(newReporte); newProductoClienteReporte.setIdProducto(producto); newProductoClienteReporte.setIdProductoDetalleReporte(productoDetalleReporteService.update(productoDetalleReporte)); newProductoClienteReporte.setIdClienteSucursal(new ClienteSucursal(idClienteSucursal)); if (idProyecto != null) { newProductoClienteReporte.setIdProyecto(new Proyectos(idProyecto)); } globalProductoClienteReporte = productoClienteReporteService.update(newProductoClienteReporte); this.updateListReporteMantenimientoPreventivoMobile(productoClienteReporte, listPreventivos); this.updateListReporteMantenimientoCorrectivoMobile(productoClienteReporte, listCorrectivos); System.out.println(" ACUALIZACION FINALIZADA "); //this.updateOtrosRepuestos(productoClienteReporte, listOtros); /* byte[] bytes = ReporteTecnico.jasperBytesReportes(productoClienteReporte, tipoVisitaService, detalleCatalogoReporteService, cabeceraCatalogoReporteService); enviarMail(parametrosService, bytes, newProductoClienteReporte.getIdCliente().getEmail(), "Edición de Reporte", "Reporte ");*/ } @Override @Transactional public void saveAllReporte(Reporte reporte, Cliente cliente, Producto producto, String serie, ProductoDetalleReporte productoDetalleReporte, ProductoClienteReporte productoClienteReporte, Integer idClienteSucursal, Integer idTipoVisita, Usuarios usuario, AsignacionReparacion asignacionReparacion, Integer idProyecto, List<List<DetalleCatalogoReporte>> listCorrectivos, List<List<DetalleCatalogoReporte>> listPreventivos, List<DetalleCatalogoReporte> listOtros) { globalProductoClienteReporte = new ProductoClienteReporte(); Reporte newReporte = new Reporte(); newReporte = reporte; newReporte.setIdVisita(new TipoVisita(idTipoVisita)); newReporte.setIdUsuario(usuario); newReporte.setFecha(new Date()); newReporte.setFechaCreacion(new Date()); newReporte.setUsuarioCreacion(usuario.getUsuario()); newReporte = this.save((Reporte) toUpperCaseStrings(newReporte)); DetalleInventarioProducto searchDetalleInventarioProducto = new DetalleInventarioProducto(); searchDetalleInventarioProducto = detalleInventarioProductoService.getBySerial(serie); boolean existeDetalleInventarioProducto = (searchDetalleInventarioProducto == null); ProductoClienteReporte newProductoClienteReporte = new ProductoClienteReporte(); newProductoClienteReporte = productoClienteReporte; if (existeDetalleInventarioProducto) { searchDetalleInventarioProducto = null; } newProductoClienteReporte.setIdDetalleInventarioProducto(searchDetalleInventarioProducto); newProductoClienteReporte.setIdReporte(newReporte); newProductoClienteReporte.setIdCliente(cliente); newProductoClienteReporte.setSerie(serie); newProductoClienteReporte.setIdProducto(producto); newProductoClienteReporte.setIdProductoDetalleReporte(productoDetalleReporteService.add(productoDetalleReporte)); newProductoClienteReporte.setIdClienteSucursal(new ClienteSucursal(idClienteSucursal)); if (idProyecto != null) { newProductoClienteReporte.setIdProyecto(new Proyectos(idProyecto)); } globalProductoClienteReporte = (productoClienteReporteService.save(newProductoClienteReporte)); if (asignacionReparacion != null && asignacionReparacion.getId() != null) { AsignacionReparacion newAsignacionReparacion = new AsignacionReparacion(); newAsignacionReparacion = asignacionReparacion; newAsignacionReparacion.setIdReporte(newReporte.getId()); newAsignacionReparacion.setEstado(newReporte.getEstado()); asignacionReparacionService.addAsignacionReparacion(asignacionReparacion); } this.saveRepuestosReportePreventivos(globalProductoClienteReporte, listPreventivos); this.saveRepuestosReporteCorrectivos(globalProductoClienteReporte, listCorrectivos); } @Override @Transactional public void updateAllReporte(Reporte reporte, Cliente cliente, Producto producto, DetalleInventarioProducto detalleInventarioProducto, ProductoDetalleReporte productoDetalleReporte, ProductoClienteReporte productoClienteReporte, Integer idClienteSucursal, Integer idTipoVisita, Integer idProyecto, Usuarios usuario, List<List<DetalleCatalogoReporte>> listCorrectivos, List<List<DetalleCatalogoReporte>> listPreventivos, List<DetalleCatalogoReporte> listOtros) { globalProductoClienteReporte = new ProductoClienteReporte(); Reporte newReporte = new Reporte(); newReporte = reporte; newReporte.setIdVisita(new TipoVisita(idTipoVisita)); newReporte.setIdUsuario(usuario); newReporte.setFechaModificacion(new Date()); newReporte.setUsuarioModificacion(usuario.getUsuario()); newReporte = this.update((Reporte) toUpperCaseStrings(newReporte)); ProductoClienteReporte newProductoClienteReporte = new ProductoClienteReporte(); newProductoClienteReporte = productoClienteReporte; newProductoClienteReporte.setIdReporte(newReporte); newProductoClienteReporte.setIdProducto(producto); newProductoClienteReporte.setIdProductoDetalleReporte(productoDetalleReporteService.update(productoDetalleReporte)); newProductoClienteReporte.setIdClienteSucursal(new ClienteSucursal(idClienteSucursal)); if (idProyecto != null) { newProductoClienteReporte.setIdProyecto(new Proyectos(idProyecto)); } globalProductoClienteReporte = productoClienteReporteService.saveOrUpdateProductoClienteReporte(newProductoClienteReporte); this.updateListReporteMantenimientoPreventivo(productoClienteReporte, listPreventivos); this.updateListReporteMantenimientoCorrectivo(productoClienteReporte, listCorrectivos); System.out.println(" ACUALIZACION FINALIZADA "); //this.updateOtrosRepuestos(productoClienteReporte, listOtros); /* byte[] bytes = ReporteTecnico.jasperBytesReportes(productoClienteReporte, tipoVisitaService, detalleCatalogoReporteService, cabeceraCatalogoReporteService); enviarMail(parametrosService, bytes, newProductoClienteReporte.getIdCliente().getEmail(), "Edición de Reporte", "Reporte ");*/ } @Override @Transactional public void saveAllReporteImpresoras(DatosReporteDTO datosReporteDTO) { List<List<DetalleCatalogoReporte>> listCorrectivos = new ArrayList<>(); List<List<DetalleCatalogoReporte>> listPreventivos = new ArrayList<>(); if (datosReporteDTO.getReporte().getSubtipo().equals(Enums.TIPO_REPORTE_DIAGNOSTICO.getValue()) || datosReporteDTO.getReporte().getSubtipo().equals(Enums.TIPO_REPORTE_REPARACION.getValue())) { if (datosReporteDTO.getLista1() != null && !datosReporteDTO.getLista1().isEmpty()) { listPreventivos.add(datosReporteDTO.getLista1()); } if (datosReporteDTO.getLista2() != null && !datosReporteDTO.getLista2().isEmpty()) { listPreventivos.add(datosReporteDTO.getLista2()); } if (datosReporteDTO.getLista3() != null && !datosReporteDTO.getLista3().isEmpty()) { listPreventivos.add(datosReporteDTO.getLista3()); } if (datosReporteDTO.getLista4() != null && !datosReporteDTO.getLista4().isEmpty()) { listPreventivos.add(datosReporteDTO.getLista4()); } if (datosReporteDTO.getLista5() != null && !datosReporteDTO.getLista5().isEmpty()) { listCorrectivos.add(datosReporteDTO.getLista5()); } if (datosReporteDTO.getLista6() != null && !datosReporteDTO.getLista6().isEmpty()) { listCorrectivos.add(datosReporteDTO.getLista6()); } if (datosReporteDTO.getLista7() != null && !datosReporteDTO.getLista7().isEmpty()) { listCorrectivos.add(datosReporteDTO.getLista7()); } if (datosReporteDTO.getLista7() != null && !datosReporteDTO.getLista7().isEmpty()) { listCorrectivos.add(datosReporteDTO.getLista7()); } if (datosReporteDTO.getLista7() != null && !datosReporteDTO.getLista7().isEmpty()) { listCorrectivos.add(datosReporteDTO.getLista7()); } if (datosReporteDTO.getLista8() != null && !datosReporteDTO.getLista8().isEmpty()) { listCorrectivos.add(datosReporteDTO.getLista8()); } if (datosReporteDTO.getLista9() != null && !datosReporteDTO.getLista9().isEmpty()) { listCorrectivos.add(datosReporteDTO.getLista9()); } } if (datosReporteDTO.getReporte().getSubtipo().equals(Enums.TIPO_REPORTE_SCANNERS.getValue())) { if (datosReporteDTO.getLista1() != null && !datosReporteDTO.getLista1().isEmpty()) { listPreventivos.add(datosReporteDTO.getLista1()); } if (datosReporteDTO.getLista2() != null && !datosReporteDTO.getLista2().isEmpty()) { listPreventivos.add(datosReporteDTO.getLista2()); } if (datosReporteDTO.getLista3() != null && !datosReporteDTO.getLista3().isEmpty()) { listPreventivos.add(datosReporteDTO.getLista3()); } if (datosReporteDTO.getLista4() != null && !datosReporteDTO.getLista4().isEmpty()) { listCorrectivos.add(datosReporteDTO.getLista4()); } if (datosReporteDTO.getLista5() != null && !datosReporteDTO.getLista5().isEmpty()) { listCorrectivos.add(datosReporteDTO.getLista5()); } if (datosReporteDTO.getLista6() != null && !datosReporteDTO.getLista6().isEmpty()) { listCorrectivos.add(datosReporteDTO.getLista6()); } } if (datosReporteDTO.getReporte().getSubtipo().equals(Enums.TIPO_REPORTE_MONITORES.getValue())) { if (datosReporteDTO.getLista1() != null && !datosReporteDTO.getLista1().isEmpty()) { listPreventivos.add(datosReporteDTO.getLista1()); } if (datosReporteDTO.getLista2() != null && !datosReporteDTO.getLista2().isEmpty()) { listPreventivos.add(datosReporteDTO.getLista2()); } if (datosReporteDTO.getLista3() != null && !datosReporteDTO.getLista3().isEmpty()) { listPreventivos.add(datosReporteDTO.getLista3()); } if (datosReporteDTO.getLista4() != null && !datosReporteDTO.getLista4().isEmpty()) { listCorrectivos.add(datosReporteDTO.getLista4()); } if (datosReporteDTO.getLista5() != null && !datosReporteDTO.getLista5().isEmpty()) { listCorrectivos.add(datosReporteDTO.getLista5()); } if (datosReporteDTO.getLista6() != null && !datosReporteDTO.getLista6().isEmpty()) { listCorrectivos.add(datosReporteDTO.getLista6()); } } if (datosReporteDTO.getReporte().getSubtipo().equals(Enums.TIPO_REPORTE_TRITURADORAS.getValue())) { if (datosReporteDTO.getLista1() != null && !datosReporteDTO.getLista1().isEmpty()) { listPreventivos.add(datosReporteDTO.getLista1()); } if (datosReporteDTO.getLista2() != null && !datosReporteDTO.getLista2().isEmpty()) { listPreventivos.add(datosReporteDTO.getLista2()); } if (datosReporteDTO.getLista3() != null && !datosReporteDTO.getLista3().isEmpty()) { listPreventivos.add(datosReporteDTO.getLista3()); } if (datosReporteDTO.getLista4() != null && !datosReporteDTO.getLista4().isEmpty()) { listCorrectivos.add(datosReporteDTO.getLista4()); } if (datosReporteDTO.getLista5() != null && !datosReporteDTO.getLista5().isEmpty()) { listCorrectivos.add(datosReporteDTO.getLista5()); } if (datosReporteDTO.getLista6() != null && !datosReporteDTO.getLista6().isEmpty()) { listCorrectivos.add(datosReporteDTO.getLista6()); } } this.saveAllReporteMobile(datosReporteDTO.getReporte(), datosReporteDTO.getCliente(), datosReporteDTO.getProducto(), datosReporteDTO.getSerie(), datosReporteDTO.getProductoDetalleReporte(), datosReporteDTO.getProductoClienteReporte(), datosReporteDTO.getIdClienteSucursal(), datosReporteDTO.getIdTipoVisita(), datosReporteDTO.getUsuarios(), datosReporteDTO.getAsignacionReparacion(), datosReporteDTO.getIdProyecto(), listCorrectivos, listPreventivos, datosReporteDTO.getLista10()); } @Override @Transactional public void updateAllReporteImpresoras(DatosReporteDTO datosReporteDTO) { List<List<DetalleCatalogoReporte>> listCorrectivos = new ArrayList<>(); List<List<DetalleCatalogoReporte>> listPreventivos = new ArrayList<>(); if (datosReporteDTO.getReporte().getSubtipo().equals(Enums.TIPO_REPORTE_DIAGNOSTICO.getValue()) || datosReporteDTO.getReporte().getSubtipo().equals(Enums.TIPO_REPORTE_REPARACION.getValue())) { if (datosReporteDTO.getLista1() != null && !datosReporteDTO.getLista1().isEmpty()) { listPreventivos.add(datosReporteDTO.getLista1()); } if (datosReporteDTO.getLista2() != null && !datosReporteDTO.getLista2().isEmpty()) { listPreventivos.add(datosReporteDTO.getLista2()); } if (datosReporteDTO.getLista3() != null && !datosReporteDTO.getLista3().isEmpty()) { listPreventivos.add(datosReporteDTO.getLista3()); } if (datosReporteDTO.getLista4() != null && !datosReporteDTO.getLista4().isEmpty()) { listPreventivos.add(datosReporteDTO.getLista4()); } if (datosReporteDTO.getLista5() != null && !datosReporteDTO.getLista5().isEmpty()) { listCorrectivos.add(datosReporteDTO.getLista5()); } if (datosReporteDTO.getLista6() != null && !datosReporteDTO.getLista6().isEmpty()) { listCorrectivos.add(datosReporteDTO.getLista6()); } if (datosReporteDTO.getLista7() != null && !datosReporteDTO.getLista7().isEmpty()) { listCorrectivos.add(datosReporteDTO.getLista7()); } if (datosReporteDTO.getLista7() != null && !datosReporteDTO.getLista7().isEmpty()) { listCorrectivos.add(datosReporteDTO.getLista7()); } if (datosReporteDTO.getLista7() != null && !datosReporteDTO.getLista7().isEmpty()) { listCorrectivos.add(datosReporteDTO.getLista7()); } if (datosReporteDTO.getLista8() != null && !datosReporteDTO.getLista8().isEmpty()) { listCorrectivos.add(datosReporteDTO.getLista8()); } if (datosReporteDTO.getLista9() != null && !datosReporteDTO.getLista9().isEmpty()) { listCorrectivos.add(datosReporteDTO.getLista9()); } } if (datosReporteDTO.getReporte().getSubtipo().equals(Enums.TIPO_REPORTE_SCANNERS.getValue())) { if (datosReporteDTO.getLista1() != null && !datosReporteDTO.getLista1().isEmpty()) { listPreventivos.add(datosReporteDTO.getLista1()); } if (datosReporteDTO.getLista2() != null && !datosReporteDTO.getLista2().isEmpty()) { listPreventivos.add(datosReporteDTO.getLista2()); } if (datosReporteDTO.getLista3() != null && !datosReporteDTO.getLista3().isEmpty()) { listPreventivos.add(datosReporteDTO.getLista3()); } if (datosReporteDTO.getLista4() != null && !datosReporteDTO.getLista4().isEmpty()) { listCorrectivos.add(datosReporteDTO.getLista4()); } if (datosReporteDTO.getLista5() != null && !datosReporteDTO.getLista5().isEmpty()) { listCorrectivos.add(datosReporteDTO.getLista5()); } if (datosReporteDTO.getLista6() != null && !datosReporteDTO.getLista6().isEmpty()) { listCorrectivos.add(datosReporteDTO.getLista6()); } } if (datosReporteDTO.getReporte().getSubtipo().equals(Enums.TIPO_REPORTE_MONITORES.getValue())) { if (datosReporteDTO.getLista1() != null && !datosReporteDTO.getLista1().isEmpty()) { listPreventivos.add(datosReporteDTO.getLista1()); } if (datosReporteDTO.getLista2() != null && !datosReporteDTO.getLista2().isEmpty()) { listPreventivos.add(datosReporteDTO.getLista2()); } if (datosReporteDTO.getLista3() != null && !datosReporteDTO.getLista3().isEmpty()) { listPreventivos.add(datosReporteDTO.getLista3()); } if (datosReporteDTO.getLista4() != null && !datosReporteDTO.getLista4().isEmpty()) { listCorrectivos.add(datosReporteDTO.getLista4()); } if (datosReporteDTO.getLista5() != null && !datosReporteDTO.getLista5().isEmpty()) { listCorrectivos.add(datosReporteDTO.getLista5()); } if (datosReporteDTO.getLista6() != null && !datosReporteDTO.getLista6().isEmpty()) { listCorrectivos.add(datosReporteDTO.getLista6()); } } if (datosReporteDTO.getReporte().getSubtipo().equals(Enums.TIPO_REPORTE_TRITURADORAS.getValue())) { if (datosReporteDTO.getLista1() != null && !datosReporteDTO.getLista1().isEmpty()) { listPreventivos.add(datosReporteDTO.getLista1()); } if (datosReporteDTO.getLista2() != null && !datosReporteDTO.getLista2().isEmpty()) { listPreventivos.add(datosReporteDTO.getLista2()); } if (datosReporteDTO.getLista3() != null && !datosReporteDTO.getLista3().isEmpty()) { listPreventivos.add(datosReporteDTO.getLista3()); } if (datosReporteDTO.getLista4() != null && !datosReporteDTO.getLista4().isEmpty()) { listCorrectivos.add(datosReporteDTO.getLista4()); } if (datosReporteDTO.getLista5() != null && !datosReporteDTO.getLista5().isEmpty()) { listCorrectivos.add(datosReporteDTO.getLista5()); } if (datosReporteDTO.getLista6() != null && !datosReporteDTO.getLista6().isEmpty()) { listCorrectivos.add(datosReporteDTO.getLista6()); } } this.updateAllReporteMobile(datosReporteDTO.getReporte(), datosReporteDTO.getCliente(), datosReporteDTO.getProducto(), new DetalleInventarioProducto(), datosReporteDTO.getProductoDetalleReporte(), datosReporteDTO.getProductoClienteReporte(), datosReporteDTO.getIdClienteSucursal(), datosReporteDTO.getIdTipoVisita(), datosReporteDTO.getIdProyecto(), datosReporteDTO.getUsuarios(), listCorrectivos, listPreventivos, datosReporteDTO.getLista10()); } @Override @Transactional public void saveAllReporteReparacion(Reporte reporte, Cliente cliente, Producto producto, DetalleInventarioProducto detalleInventarioProducto, ProductoDetalleReporte productoDetalleReporte, ProductoClienteReporte productoClienteReporte, Integer idClienteSucursal, Integer idTipoVisita, Usuarios usuario, AsignacionReparacion asignacionReparacion, Integer idProyecto, List<List<DetalleCatalogoReporte>> listCorrectivos, List<List<DetalleCatalogoReporte>> listPreventivos, List<DetalleCatalogoReporte> listOtros) { globalProductoClienteReporte = new ProductoClienteReporte(); Reporte newReporte = new Reporte(), oldReporte = new Reporte(); oldReporte = productoClienteReporteService.getByReportId(reporte.getId()).getIdReporte(); oldReporte.setEstado(Enums.ESTADO_REPORTE_FINALIADO.getValue()); oldReporte = this.save((Reporte) toUpperCaseStrings(oldReporte)); newReporte.setFactura(reporte.getFactura()); newReporte.setFirmaCliente(reporte.getFirmaCliente()); newReporte.setFirmaClienteBase64(reporte.getFirmaClienteBase64()); newReporte.setHoraFin(reporte.getHoraFin()); newReporte.setHoraInicio(reporte.getHoraInicio()); newReporte.setNombreCliente(reporte.getNombreCliente()); newReporte.setNotas(reporte.getNotas()); newReporte.setNumerofactura(reporte.getNumerofactura()); newReporte.setObservacionMantenimiento(reporte.getObservacionMantenimiento()); newReporte.setObservacionesRecomendaciones(reporte.getObservacionesRecomendaciones()); newReporte.setReferencia(reporte.getReferencia()); newReporte.setSintomasEquipo(reporte.getSintomasEquipo()); newReporte.setSubtipo(reporte.getSubtipo() + "->" + Enums.TIPO_REPORTE_REPARACION.getValue()); newReporte.setTipo(reporte.getTipo()); newReporte.setEstado(reporte.getEstado()); newReporte.setIdVisita(new TipoVisita(idTipoVisita)); newReporte.setIdUsuario(usuario); newReporte.setFecha(new Date()); newReporte.setFechaCreacion(new Date()); newReporte.setUsuarioCreacion(usuario.getUsuario()); newReporte = this.save((Reporte) toUpperCaseStrings(newReporte)); DetalleInventarioProducto searchDetalleInventarioProducto = new DetalleInventarioProducto(); searchDetalleInventarioProducto = detalleInventarioProductoService.getBySerial(detalleInventarioProducto.getSerial()); boolean existeDetalleInventarioProducto = (searchDetalleInventarioProducto == null); ProductoClienteReporte newProductoClienteReporte = new ProductoClienteReporte(); newProductoClienteReporte = productoClienteReporte; if (existeDetalleInventarioProducto) { searchDetalleInventarioProducto = null; } newProductoClienteReporte.setSerie(detalleInventarioProducto.getSerial()); newProductoClienteReporte.setIdProducto(producto); newProductoClienteReporte.setIdDetalleInventarioProducto(searchDetalleInventarioProducto); newProductoClienteReporte.setIdCliente(cliente); newProductoClienteReporte.setSerie(detalleInventarioProducto.getSerial()); newProductoClienteReporte.setIdProducto(producto); if (idProyecto != null) { newProductoClienteReporte.setIdProyecto(new Proyectos(idProyecto)); } newProductoClienteReporte.setCelularEquipo(productoClienteReporte.getCelularEquipo()); newProductoClienteReporte.setAtencion(productoClienteReporte.getAtencion()); newProductoClienteReporte.setCiudad(productoClienteReporte.getCiudad()); newProductoClienteReporte.setContactoEquipo(productoClienteReporte.getContactoEquipo()); newProductoClienteReporte.setCorreoEquipo(productoClienteReporte.getCorreoEquipo()); newProductoClienteReporte.setDepartamento(productoClienteReporte.getDepartamento()); newProductoClienteReporte.setDireccionEquipo(productoClienteReporte.getDireccionEquipo()); newProductoClienteReporte.setIpEquipo(productoClienteReporte.getIpEquipo()); newProductoClienteReporte.setPuertoUsb(productoClienteReporte.getPuertoUsb()); newProductoClienteReporte.setTelefonoEquipo(productoClienteReporte.getTelefonoEquipo()); newProductoClienteReporte.setIdReporte(newReporte); ProductoDetalleReporte newDetalleReporte = new ProductoDetalleReporte(); newDetalleReporte.setContadorBnActual(productoDetalleReporte.getContadorBnActual()); newDetalleReporte.setContadorBnAnterior(productoDetalleReporte.getContadorBnAnterior()); newDetalleReporte.setContadorBnImpReal(productoDetalleReporte.getContadorBnImpReal()); newDetalleReporte.setContadorColorActual(productoDetalleReporte.getContadorColorActual()); newDetalleReporte.setContadorColorAnterior(productoDetalleReporte.getContadorColorAnterior()); newDetalleReporte.setContadorColorImpReal(productoDetalleReporte.getContadorColorImpReal()); newDetalleReporte.setContadorTotalActual(productoDetalleReporte.getContadorTotalActual()); newDetalleReporte.setContadorTotalAnterior(productoDetalleReporte.getContadorTotalAnterior()); newDetalleReporte.setContadorTotalImpReal(productoDetalleReporte.getContadorTotalImpReal()); newDetalleReporte.setServicioFacturar(productoDetalleReporte.getServicioFacturar()); newDetalleReporte.setServicioFacturarEstado(productoDetalleReporte.getServicioFacturarEstado()); newDetalleReporte = (ProductoDetalleReporte) toUpperCaseStrings(productoDetalleReporteService.add(newDetalleReporte)); newProductoClienteReporte.setIdProductoDetalleReporte(newDetalleReporte); newProductoClienteReporte.setIdClienteSucursal(new ClienteSucursal(idClienteSucursal)); newProductoClienteReporte.setReporteMantenimientoList(new ArrayList<>()); globalProductoClienteReporte = productoClienteReporteService.save(newProductoClienteReporte); this.saveRepuestosReporteCorrectivos(globalProductoClienteReporte, listCorrectivos); this.saveRepuestosReportePreventivos(globalProductoClienteReporte, listPreventivos); // this.saveOtrosRepuestos(globalProductoClienteReporte, listOtros, usuario); } @Override @Transactional public void saveAllInstalacion(String tipoInstalacion, Reporte reporte, Cliente cliente, Producto producto, Producto producto2, String serie, String serie2, ProductoDetalleReporte productoDetalleReporte, ProductoClienteReporte productoClienteReporte, Integer idClienteSucursal, Integer idProyecto, Integer idClienteSucursal2, DetalleReporteInstalacionNueva detalleReporteInstalacionNueva, DetalleReporteTemporal detalleReporteTemporal, Usuarios usuario, AsignacionReparacion asignacionReparacion, List<DetalleCatalogoReporte> listPreguntas) { globalProductoClienteReporte = new ProductoClienteReporte(); Reporte newReporte = new Reporte(); newReporte = reporte; newReporte.setIdUsuario(usuario); newReporte.setFecha(new Date()); newReporte.setFechaCreacion(new Date()); newReporte.setUsuarioCreacion(usuario.getUsuario()); newReporte.setEstado(serie); newReporte = this.save((Reporte) toUpperCaseStrings(newReporte)); DetalleInventarioProducto searchDetalleInventarioProducto = new DetalleInventarioProducto(); searchDetalleInventarioProducto = detalleInventarioProductoService.getBySerial(serie); boolean existeDetalleInventarioProducto = (searchDetalleInventarioProducto == null); ProductoClienteReporte newProductoClienteReporte = new ProductoClienteReporte(); newProductoClienteReporte = productoClienteReporte; if (existeDetalleInventarioProducto) { searchDetalleInventarioProducto = null; } newProductoClienteReporte.setIdDetalleInventarioProducto(searchDetalleInventarioProducto); newProductoClienteReporte = productoClienteReporte; newProductoClienteReporte.setIdReporte(newReporte); newProductoClienteReporte.setSerie(serie); newProductoClienteReporte.setIdProducto(producto); newProductoClienteReporte.setIdCliente(cliente); newProductoClienteReporte.setIdProductoDetalleReporte(productoDetalleReporteService.add(productoDetalleReporte)); newProductoClienteReporte.setIdClienteSucursal(new ClienteSucursal(idClienteSucursal)); if (idProyecto != null) { newProductoClienteReporte.setIdProyecto(new Proyectos(idProyecto)); } if (tipoInstalacion.equals(Enums.INSTALACION_NUEVA.getValue())) { DetalleReporteInstalacionNueva newDetalleReporteInstalacionNueva = new DetalleReporteInstalacionNueva(); newDetalleReporteInstalacionNueva = detalleReporteInstalacionNuevaService.addDetalleReporteInstalacionNueva(detalleReporteInstalacionNueva); newProductoClienteReporte.setIdDetalleReporteInstalacionNueva(newDetalleReporteInstalacionNueva); newProductoClienteReporte.setIdClienteSucursal(new ClienteSucursal(idClienteSucursal)); newProductoClienteReporte = productoClienteReporteService.saveOrUpdateProductoClienteReporte(newProductoClienteReporte); List<List<DetalleCatalogoReporte>> catalogoReportes = new ArrayList<>(); catalogoReportes.add(listPreguntas); this.saveRepuestosReportePreventivos(productoClienteReporte, catalogoReportes); } if (tipoInstalacion.equals(Enums.INSTALACION_TEMPORAL.getValue())) { DetalleInventarioProducto searchDetalleInventarioProducto2 = new DetalleInventarioProducto(); searchDetalleInventarioProducto2 = detalleInventarioProductoService.getBySerial(serie2); boolean existeDetalleInventarioProducto2 = (searchDetalleInventarioProducto2 == null); DetalleReporteTemporal newDetalleReporteTemporal = new DetalleReporteTemporal(); newDetalleReporteTemporal = detalleReporteTemporal; if (existeDetalleInventarioProducto2) { searchDetalleInventarioProducto2 = null; } newDetalleReporteTemporal.setSerie(serie2); newDetalleReporteTemporal.setIdDetalleInventarioProducto(searchDetalleInventarioProducto2); newDetalleReporteTemporal.setNeutro(detalleReporteInstalacionNueva.getNeutro()); newDetalleReporteTemporal.setFaseNeutro(detalleReporteInstalacionNueva.getFaseNeutro()); newDetalleReporteTemporal.setFaseTierra(detalleReporteInstalacionNueva.getFaseTierra()); newDetalleReporteTemporal.setObservacionMedicion(detalleReporteInstalacionNueva.getObservacion()); newDetalleReporteTemporal.setIdClienteSucursal(new ClienteSucursal(idClienteSucursal2)); newDetalleReporteTemporal = detalleReporteTemporalService.addDetalleReporteTemporal((DetalleReporteTemporal) toUpperCaseStrings(newDetalleReporteTemporal)); newProductoClienteReporte.setIdDetalleReporteTemporal(newDetalleReporteTemporal); newProductoClienteReporte = productoClienteReporteService.saveOrUpdateProductoClienteReporte(newProductoClienteReporte); } if (asignacionReparacion != null) { AsignacionReparacion newAsignacionReparacion = new AsignacionReparacion(); newAsignacionReparacion = asignacionReparacion; newAsignacionReparacion.setIdReporte(newReporte.getId()); newAsignacionReparacion.setEstado(newReporte.getEstado()); asignacionReparacionService.addAsignacionReparacion(asignacionReparacion); } byte[] bytes = ReporteTecnico.jasperBytesReportes(productoClienteReporte, tipoVisitaService, detalleCatalogoReporteService, cabeceraCatalogoReporteService); enviarMail(parametrosService, bytes, newProductoClienteReporte.getIdCliente().getEmail(), "Nuevo Reporte", "Reporte "); } @Override @Transactional public void updateAllInstalacion(String tipoInstalacion, Reporte reporte, Cliente cliente, Producto producto1, Producto producto2, DetalleInventarioProducto detalleInventarioProducto1, DetalleInventarioProducto detalleInventarioProducto2, ProductoDetalleReporte productoDetalleReporte, ProductoClienteReporte productoClienteReporte, Integer idClienteSucursal, Integer idClienteSucursal2, Integer idProyecto, DetalleReporteInstalacionNueva detalleReporteInstalacionNueva, DetalleReporteTemporal detalleReporteTemporal, Usuarios usuario, AsignacionReparacion asignacionReparacion, List<DetalleCatalogoReporte> listPreguntas) { globalProductoClienteReporte = new ProductoClienteReporte(); Reporte newReporte = new Reporte(); newReporte = reporte; newReporte.setIdUsuario(usuario); newReporte.setFechaModificacion(new Date()); newReporte.setUsuarioModificacion(usuario.getUsuario()); newReporte = this.update((Reporte) toUpperCaseStrings(newReporte)); ProductoClienteReporte newProductoClienteReporte = new ProductoClienteReporte(); newProductoClienteReporte = productoClienteReporte; newProductoClienteReporte.setIdReporte(newReporte); newProductoClienteReporte.setIdProductoDetalleReporte(productoDetalleReporteService.add(productoDetalleReporte)); newProductoClienteReporte.setIdClienteSucursal(new ClienteSucursal(idClienteSucursal)); if (tipoInstalacion.equals(Enums.INSTALACION_NUEVA.getValue())) { DetalleReporteInstalacionNueva newDetalleReporteInstalacionNueva = new DetalleReporteInstalacionNueva(); newDetalleReporteInstalacionNueva = detalleReporteInstalacionNuevaService.update(detalleReporteInstalacionNueva); newProductoClienteReporte.setIdDetalleReporteInstalacionNueva(newDetalleReporteInstalacionNueva); newProductoClienteReporte.setIdClienteSucursal(new ClienteSucursal(idClienteSucursal)); newProductoClienteReporte = productoClienteReporteService.update(newProductoClienteReporte); List<List<DetalleCatalogoReporte>> catalogoReportes = new ArrayList<>(); catalogoReportes.add(listPreguntas); this.updateListReporteMantenimientoPreventivo(productoClienteReporte, catalogoReportes); } if (tipoInstalacion.equals(Enums.INSTALACION_TEMPORAL.getValue())) { DetalleReporteTemporal newDetalleReporteTemporal = new DetalleReporteTemporal(); newDetalleReporteTemporal = detalleReporteTemporal; newDetalleReporteTemporal.setNeutro(detalleReporteInstalacionNueva.getNeutro()); newDetalleReporteTemporal.setFaseNeutro(detalleReporteInstalacionNueva.getFaseNeutro()); newDetalleReporteTemporal.setFaseTierra(detalleReporteInstalacionNueva.getFaseTierra()); newDetalleReporteTemporal.setObservacionMedicion(detalleReporteInstalacionNueva.getObservacion()); newDetalleReporteTemporal.setIdClienteSucursal(new ClienteSucursal(idClienteSucursal2)); newDetalleReporteTemporal = detalleReporteTemporalService.addDetalleReporteTemporal((DetalleReporteTemporal) toUpperCaseStrings(newDetalleReporteTemporal)); newProductoClienteReporte.setIdDetalleReporteTemporal(newDetalleReporteTemporal); productoDetalleReporte = productoDetalleReporteService.update((ProductoDetalleReporte) toUpperCaseStrings(productoDetalleReporte)); newDetalleReporteTemporal.setNeutro(detalleReporteInstalacionNueva.getNeutro()); newDetalleReporteTemporal.setFaseNeutro(detalleReporteInstalacionNueva.getFaseNeutro()); newDetalleReporteTemporal.setFaseTierra(detalleReporteInstalacionNueva.getFaseTierra()); newDetalleReporteTemporal.setObservacionMedicion(detalleReporteInstalacionNueva.getObservacion()); DetalleReporteTemporal updateDetalleReporteTemporal = new DetalleReporteTemporal(); updateDetalleReporteTemporal.setIdClienteSucursal(new ClienteSucursal(idClienteSucursal2)); updateDetalleReporteTemporal = detalleReporteTemporalService.updateDetalleReporteTemporal((DetalleReporteTemporal) toUpperCaseStrings(newDetalleReporteTemporal)); newProductoClienteReporte = productoClienteReporteService.update(newProductoClienteReporte); } } @Override @Transactional public void saveReporteEcu911(Reporte reporte, Cliente cliente, DetalleReporteEcu911 detalleReporteEcu911, ProductoClienteReporte productoClienteReporte, Integer idSucursal, Integer idProyecto, Usuarios usuario) { globalProductoClienteReporte = new ProductoClienteReporte(); Reporte newReporte = new Reporte(); newReporte = reporte; newReporte.setIdUsuario(usuario); newReporte.setIdVisita(null); newReporte.setFecha(new Date()); newReporte.setFechaCreacion(new Date()); newReporte.setUsuarioCreacion(usuario.getUsuario()); newReporte = this.save((Reporte) toUpperCaseStrings(newReporte)); ProductoClienteReporte newProductoClienteReporte = new ProductoClienteReporte(); newProductoClienteReporte = productoClienteReporte; newProductoClienteReporte.setIdReporte(newReporte); newProductoClienteReporte.setIdCliente(cliente); newProductoClienteReporte.setIpEquipo(""); newProductoClienteReporte.setIdClienteSucursal(new ClienteSucursal(idSucursal)); if (idProyecto != null) { newProductoClienteReporte.setIdProyecto(new Proyectos(idProyecto)); } globalProductoClienteReporte = productoClienteReporteService.save(newProductoClienteReporte); DetalleReporteEcu911 newDetalleReporteEcu9111 = new DetalleReporteEcu911(); newDetalleReporteEcu9111 = detalleReporteEcu911; newDetalleReporteEcu9111.setIdReporte(newReporte); newDetalleReporteEcu9111 = detalleReporteEcu911Service.save((DetalleReporteEcu911) toUpperCaseStrings(newDetalleReporteEcu9111)); } @Override @Transactional public void updateReporteEcu911(Reporte reporte, Cliente cliente, DetalleReporteEcu911 detalleReporteEcu911, ProductoClienteReporte productoClienteReporte, Integer idSucursal, Integer idProyecto, Usuarios usuario) { globalProductoClienteReporte = new ProductoClienteReporte(); Reporte updatedReporte = new Reporte(); updatedReporte = reporte; updatedReporte.setIdUsuario(usuario); updatedReporte.setIdVisita(null); updatedReporte.setFechaModificacion(new Date()); updatedReporte.setUsuarioModificacion(usuario.getUsuario()); updatedReporte = this.update((Reporte) toUpperCaseStrings(reporte)); ProductoClienteReporte updatedProductoClienteReporte = new ProductoClienteReporte(); updatedProductoClienteReporte = productoClienteReporte; updatedProductoClienteReporte.setIdReporte(updatedReporte); updatedProductoClienteReporte.setIdCliente(cliente); updatedProductoClienteReporte.setIpEquipo(""); updatedProductoClienteReporte.setIdClienteSucursal(new ClienteSucursal(idSucursal)); if (idProyecto != null) { updatedProductoClienteReporte.setIdProyecto(new Proyectos(idProyecto)); } globalProductoClienteReporte = productoClienteReporteService.update(updatedProductoClienteReporte); DetalleReporteEcu911 updatedDetalleReporteEcu9111 = new DetalleReporteEcu911(); updatedDetalleReporteEcu9111 = detalleReporteEcu911; updatedDetalleReporteEcu9111.setIdReporte(updatedReporte); updatedDetalleReporteEcu9111 = detalleReporteEcu911Service.update((DetalleReporteEcu911) toUpperCaseStrings(updatedDetalleReporteEcu9111)); } @Override @Transactional public boolean ingresoMasivoReportesEcu(List<DetalleReporteEcu911> reportes, Usuarios usuarios) { try { Cliente cliente = clienteService.getClienteByRuc(parametrosService.getByParametro("CLIENTE_ECU911_RUC").getValor()); reportes.forEach((DetalleReporteEcu911 det) -> { ClienteSucursal clienteSucursal = clienteSucursalService.getByNombre(det.getProductoClienteReporte().getCiudad()); if (clienteSucursal == null) { return; } else { Integer numero_factura = this.getByUserByTipo(usuarios.getId(), Enums.TIPO_REPORTE_ECU911.getValue(), det.getIdReporte().getSubtipo()).size(); ProductoClienteReporte newProductoClienteReporte = new ProductoClienteReporte(); Reporte reporte = new Reporte(); reporte = det.getIdReporte(); newProductoClienteReporte = det.getProductoClienteReporte(); reporte.setIdUsuario(usuarios); reporte.setEstado(Enums.ESTADO_REPORTE_PROCESO.getValue()); reporte.setNumerofactura(numero_factura); reporte.setTipo(Enums.TIPO_REPORTE_ECU911.getValue()); reporte.setNumeroReporteTecnico(usuarios.getCodigo() + "-" + formatoNumeroFactura(numero_factura)); newProductoClienteReporte.setIdClienteSucursal(clienteSucursal); this.saveReporteEcu911(reporte, cliente, det, newProductoClienteReporte, clienteSucursal.getId(), null, usuarios); } } ); return true; } catch (Exception e) { System.out.println("ERROR " + e.getMessage() + " , " + e.getCause()); return false; } } @Override @Transactional public void saveReporteReporteGenerico(DatosReporteDTO datosReporteDTO) { this.saveReporteReporteGenerico(datosReporteDTO.getReporte(), datosReporteDTO.getCliente(), datosReporteDTO.getProducto(), datosReporteDTO.getSerie(), datosReporteDTO.getProductoDetalleReporte(), datosReporteDTO.getProductoClienteReporte(), datosReporteDTO.getIdClienteSucursal(), datosReporteDTO.getIdTipoVisita(), datosReporteDTO.getUsuarios(), datosReporteDTO.getAsignacionReparacion(), datosReporteDTO.getIdProyecto(), datosReporteDTO.getItemsReporteGenerico()); } @Override @Transactional public void updateReporteReporteGenerico(DatosReporteDTO datosReporteDTO) { this.updateReporteReporteGenerico(datosReporteDTO.getReporte(), datosReporteDTO.getCliente(), datosReporteDTO.getProducto(), datosReporteDTO.getSerie(), datosReporteDTO.getProductoDetalleReporte(), datosReporteDTO.getProductoClienteReporte(), datosReporteDTO.getIdClienteSucursal(), datosReporteDTO.getIdTipoVisita(), datosReporteDTO.getUsuarios(), datosReporteDTO.getAsignacionReparacion(), datosReporteDTO.getIdProyecto(), datosReporteDTO.getItemsReporteGenerico()); } private void saveRepuestosReporteCorrectivos(ProductoClienteReporte productoClienteReporte, List<List<DetalleCatalogoReporte>> list) { list.forEach((List<DetalleCatalogoReporte> lista) -> { lista.stream().filter((DetalleCatalogoReporte catalogoReporte) -> (catalogoReporte.isSeleccion() && !catalogoReporte.getCodigoRepuesto().isEmpty())) .forEach((DetalleCatalogoReporte catalogoReporte) -> { ReporteMantenimiento newReporteMantenimiento = new ReporteMantenimiento(); newReporteMantenimiento.setIdProductoClienteReporte(productoClienteReporte); newReporteMantenimiento.setIdProductoRepuestoReporte(new ProductoRepuestoReporte(catalogoReporte.getIdProductoRepuestoReporte())); newReporteMantenimiento.setIdDetalleCatalogoReporte(new DetalleCatalogoReporte()); newReporteMantenimiento.setCodigoRepuesto(catalogoReporte.getCodigoRepuesto()); newReporteMantenimiento.setTipoRepuesto(catalogoReporte.getTipoRepuesto()); newReporteMantenimiento.setPorcentaje(catalogoReporte.getPorcentaje()); newReporteMantenimiento.setEstado(Boolean.TRUE); newReporteMantenimiento = reporteMantenimientoService.saveOrUpdate(newReporteMantenimiento); }); }); } private void saveRepuestosReportePreventivos(ProductoClienteReporte productoClienteReporte, List<List<DetalleCatalogoReporte>> list) { list.forEach((List<DetalleCatalogoReporte> lista) -> { lista.stream().filter((DetalleCatalogoReporte catalogoReporte) -> (catalogoReporte.getId() != null && catalogoReporte.isSeleccion())) .forEach((DetalleCatalogoReporte catalogoReporte) -> { ReporteMantenimiento newReporteMantenimiento = new ReporteMantenimiento(); newReporteMantenimiento.setIdProductoClienteReporte(productoClienteReporte); newReporteMantenimiento.setIdDetalleCatalogoReporte(catalogoReporte); newReporteMantenimiento.setIdProductoRepuestoReporte(new ProductoRepuestoReporte()); newReporteMantenimiento.setEstado(Boolean.TRUE); newReporteMantenimiento = reporteMantenimientoService.save(newReporteMantenimiento); }); }); } private void updateListReporteMantenimientoPreventivo(ProductoClienteReporte productoClienteReporte, List<List<DetalleCatalogoReporte>> list) { list.forEach((List<DetalleCatalogoReporte> lista) -> { lista.stream().filter((DetalleCatalogoReporte catalogoReporte) -> catalogoReporte.isSeleccion()) .forEach((DetalleCatalogoReporte catalogoReporte) -> { mantenimientoAux = new ReporteMantenimiento(); mantenimientoAux = this.containsIdReporteMantenimiento(productoClienteReporte.getReporteMantenimientoList(), catalogoReporte.getIdReporteMantenimiento()); mantenimiento = new ReporteMantenimiento(); mantenimiento.setEstado(Boolean.TRUE); if (mantenimientoAux != null) { mantenimiento = mantenimientoAux; mantenimiento.setIdDetalleCatalogoReporte(catalogoReporte); mantenimiento.setIdProductoRepuestoReporte(new ProductoRepuestoReporte()); mantenimiento = reporteMantenimientoService.saveOrUpdate(mantenimiento); } else { mantenimiento.setIdDetalleCatalogoReporte(catalogoReporte); mantenimiento.setIdProductoClienteReporte(productoClienteReporte); mantenimiento.setIdProductoRepuestoReporte(new ProductoRepuestoReporte()); mantenimiento = reporteMantenimientoService.saveOrUpdate(mantenimiento); } }); lista.stream().filter((DetalleCatalogoReporte catalogoReporte) -> (catalogoReporte.getIdReporteMantenimiento() != null) && !catalogoReporte.isSeleccion()) .forEach((DetalleCatalogoReporte catalogoReporte) -> { mantenimiento = new ReporteMantenimiento(); mantenimientoAux = new ReporteMantenimiento(); mantenimientoAux = this.containsIdReporteMantenimiento(productoClienteReporte.getReporteMantenimientoList(), catalogoReporte.getIdReporteMantenimiento()); if (mantenimientoAux != null) { mantenimiento = mantenimientoAux; reporteMantenimientoService.eliminar(mantenimientoAux); } }); }); } private void updateListReporteMantenimientoCorrectivo(ProductoClienteReporte productoClienteReporte, List<List<DetalleCatalogoReporte>> list) { list.forEach((List<DetalleCatalogoReporte> lista) -> { lista.stream().filter((DetalleCatalogoReporte catalogoReporte) -> (catalogoReporte.getIdProductoRepuestoReporte() != null) && catalogoReporte.isSeleccion()) .forEach((DetalleCatalogoReporte catalogoReporte) -> { mantenimientoAux = mantenimiento = new ReporteMantenimiento(); mantenimientoAux = this.containsIdReporteMantenimiento(productoClienteReporte.getReporteMantenimientoList(), catalogoReporte.getIdReporteMantenimiento()); mantenimiento.setEstado(Boolean.TRUE); if (mantenimientoAux != null) { mantenimiento = mantenimientoAux; mantenimiento.setIdProductoRepuestoReporte(new ProductoRepuestoReporte(catalogoReporte.getIdProductoRepuestoReporte())); mantenimiento.setPorcentaje(catalogoReporte.getPorcentaje()); mantenimiento.setCodigoRepuesto(catalogoReporte.getCodigoRepuesto()); mantenimiento.setTipoRepuesto(catalogoReporte.getTipoRepuesto()); mantenimiento = reporteMantenimientoService.saveOrUpdate(mantenimiento); } else { mantenimiento.setIdProductoRepuestoReporte(new ProductoRepuestoReporte(catalogoReporte.getIdProductoRepuestoReporte())); mantenimiento.setIdDetalleCatalogoReporte(new DetalleCatalogoReporte()); mantenimiento.setIdProductoClienteReporte(productoClienteReporte); mantenimiento.setPorcentaje(catalogoReporte.getPorcentaje()); mantenimiento.setCodigoRepuesto(catalogoReporte.getCodigoRepuesto()); mantenimiento.setTipoRepuesto(catalogoReporte.getTipoRepuesto()); mantenimiento = reporteMantenimientoService.saveOrUpdate(mantenimiento); } }); lista.stream().filter((DetalleCatalogoReporte catalogoReporte) -> (Objects.nonNull(catalogoReporte.getIdReporteMantenimiento())) && !catalogoReporte.isSeleccion()) .forEach((DetalleCatalogoReporte catalogoReporte) -> { mantenimientoAux = mantenimiento = new ReporteMantenimiento(); mantenimientoAux = this.containsIdReporteMantenimiento(productoClienteReporte.getReporteMantenimientoList(), catalogoReporte.getIdReporteMantenimiento()); if (mantenimientoAux != null) { mantenimiento = mantenimientoAux; mantenimiento.setEstado(Boolean.FALSE); reporteMantenimientoService.eliminar(mantenimiento); } }); }); } private void saveRepuestosReporteCorrectivosMobile(ProductoClienteReporte productoClienteReporte, List<List<DetalleCatalogoReporte>> list) { list.forEach((List<DetalleCatalogoReporte> lista) -> { lista.stream().filter((DetalleCatalogoReporte catalogoReporte) -> (catalogoReporte.isSeleccion() && !catalogoReporte.getCodigoRepuesto().isEmpty())) .forEach((DetalleCatalogoReporte catalogoReporte) -> { ReporteMantenimiento newReporteMantenimiento = new ReporteMantenimiento(); newReporteMantenimiento.setIdProductoClienteReporte(productoClienteReporte); newReporteMantenimiento.setIdProductoRepuestoReporte(new ProductoRepuestoReporte(catalogoReporte.getIdProductoRepuestoReporte())); newReporteMantenimiento.setIdDetalleCatalogoReporte(new DetalleCatalogoReporte()); newReporteMantenimiento.setCodigoRepuesto(catalogoReporte.getCodigoRepuesto()); newReporteMantenimiento.setTipoRepuesto(catalogoReporte.getTipoRepuesto()); newReporteMantenimiento.setPorcentaje(catalogoReporte.getPorcentaje()); newReporteMantenimiento.setEstado(Boolean.TRUE); newReporteMantenimiento = reporteMantenimientoService.save(newReporteMantenimiento); }); }); } private void saveRepuestosReportePreventivosMobile(ProductoClienteReporte productoClienteReporte, List<List<DetalleCatalogoReporte>> list) { list.forEach((List<DetalleCatalogoReporte> lista) -> { lista.stream().filter((DetalleCatalogoReporte catalogoReporte) -> (catalogoReporte.getId() != null && catalogoReporte.isSeleccion())) .forEach((DetalleCatalogoReporte catalogoReporte) -> { ReporteMantenimiento newReporteMantenimiento = new ReporteMantenimiento(); newReporteMantenimiento.setIdProductoClienteReporte(productoClienteReporte); newReporteMantenimiento.setIdDetalleCatalogoReporte(catalogoReporte); newReporteMantenimiento.setIdProductoRepuestoReporte(new ProductoRepuestoReporte()); newReporteMantenimiento.setEstado(Boolean.TRUE); newReporteMantenimiento = reporteMantenimientoService.save(newReporteMantenimiento); }); }); } private void updateListReporteMantenimientoPreventivoMobile(ProductoClienteReporte productoClienteReporte, List<List<DetalleCatalogoReporte>> list) { list.forEach((List<DetalleCatalogoReporte> lista) -> { lista.stream().filter((DetalleCatalogoReporte catalogoReporte) -> catalogoReporte.isSeleccion()) .forEach((DetalleCatalogoReporte catalogoReporte) -> { mantenimientoAux = new ReporteMantenimiento(); mantenimientoAux = this.containsIdReporteMantenimiento(productoClienteReporte.getReporteMantenimientoList(), catalogoReporte.getIdReporteMantenimiento()); mantenimiento = new ReporteMantenimiento(); mantenimiento.setEstado(Boolean.TRUE); if (mantenimientoAux != null) { mantenimiento = mantenimientoAux; mantenimiento.setIdDetalleCatalogoReporte(catalogoReporte); mantenimiento.setIdProductoRepuestoReporte(new ProductoRepuestoReporte()); mantenimiento = reporteMantenimientoService.update(mantenimiento); } else { mantenimiento.setIdDetalleCatalogoReporte(catalogoReporte); mantenimiento.setIdProductoClienteReporte(productoClienteReporte); mantenimiento.setIdProductoRepuestoReporte(new ProductoRepuestoReporte()); mantenimiento = reporteMantenimientoService.save(mantenimiento); } }); lista.stream().filter((DetalleCatalogoReporte catalogoReporte) -> (catalogoReporte.getIdReporteMantenimiento() != null) && !catalogoReporte.isSeleccion()) .forEach((DetalleCatalogoReporte catalogoReporte) -> { mantenimiento = new ReporteMantenimiento(); mantenimientoAux = new ReporteMantenimiento(); mantenimientoAux = this.containsIdReporteMantenimiento(productoClienteReporte.getReporteMantenimientoList(), catalogoReporte.getIdReporteMantenimiento()); if (mantenimientoAux != null) { mantenimiento = mantenimientoAux; reporteMantenimientoService.eliminar(mantenimientoAux); } }); }); } private void updateListReporteMantenimientoCorrectivoMobile(ProductoClienteReporte productoClienteReporte, List<List<DetalleCatalogoReporte>> list) { list.forEach((List<DetalleCatalogoReporte> lista) -> { lista.stream().filter((DetalleCatalogoReporte catalogoReporte) -> (catalogoReporte.getIdProductoRepuestoReporte() != null) && catalogoReporte.isSeleccion()) .forEach((DetalleCatalogoReporte catalogoReporte) -> { mantenimientoAux = mantenimiento = new ReporteMantenimiento(); mantenimientoAux = this.containsIdReporteMantenimiento(productoClienteReporte.getReporteMantenimientoList(), catalogoReporte.getIdReporteMantenimiento()); mantenimiento.setEstado(Boolean.TRUE); if (mantenimientoAux != null) { mantenimiento = mantenimientoAux; mantenimiento.setIdProductoRepuestoReporte(new ProductoRepuestoReporte(catalogoReporte.getIdProductoRepuestoReporte())); mantenimiento.setPorcentaje(catalogoReporte.getPorcentaje()); mantenimiento.setCodigoRepuesto(catalogoReporte.getCodigoRepuesto()); mantenimiento.setTipoRepuesto(catalogoReporte.getTipoRepuesto()); mantenimiento = reporteMantenimientoService.update(mantenimiento); } else { mantenimiento.setIdProductoRepuestoReporte(new ProductoRepuestoReporte(catalogoReporte.getIdProductoRepuestoReporte())); mantenimiento.setIdDetalleCatalogoReporte(new DetalleCatalogoReporte()); mantenimiento.setIdProductoClienteReporte(productoClienteReporte); mantenimiento.setPorcentaje(catalogoReporte.getPorcentaje()); mantenimiento.setCodigoRepuesto(catalogoReporte.getCodigoRepuesto()); mantenimiento.setTipoRepuesto(catalogoReporte.getTipoRepuesto()); mantenimiento = reporteMantenimientoService.save(mantenimiento); } }); lista.stream().filter((DetalleCatalogoReporte catalogoReporte) -> (Objects.nonNull(catalogoReporte.getIdReporteMantenimiento())) && !catalogoReporte.isSeleccion()) .forEach((DetalleCatalogoReporte catalogoReporte) -> { mantenimientoAux = mantenimiento = new ReporteMantenimiento(); mantenimientoAux = this.containsIdReporteMantenimiento(productoClienteReporte.getReporteMantenimientoList(), catalogoReporte.getIdReporteMantenimiento()); if (mantenimientoAux != null) { mantenimiento = mantenimientoAux; mantenimiento.setEstado(Boolean.FALSE); reporteMantenimientoService.eliminar(mantenimiento); } }); }); } private void updateOtrosRepuestos(ProductoClienteReporte productoClienteReporte, List<DetalleCatalogoReporte> listOtros) { listOtros.stream().filter((DetalleCatalogoReporte catalogoReporte) -> Objects.nonNull(catalogoReporte.getProductoRepuestoReporte()) && catalogoReporte.isSeleccion()) .forEach((DetalleCatalogoReporte catalogoReporte) -> { mantenimientoAux = mantenimiento = new ReporteMantenimiento(); mantenimientoAux = this.containsIdReporteMantenimientoOtros(productoClienteReporte.getReporteMantenimientoList(), catalogoReporte.getProductoRepuestoReporte().getId()); mantenimiento.setEstado(Boolean.TRUE); if (mantenimientoAux.getId() != null) { mantenimiento = mantenimientoAux; mantenimiento.setIdProductoRepuestoReporte(catalogoReporte.getProductoRepuestoReporte()); mantenimiento.setPorcentaje(catalogoReporte.getPorcentaje()); mantenimiento.setCodigoRepuesto(catalogoReporte.getCodigoRepuesto()); mantenimiento.setTipoRepuesto(catalogoReporte.getTipoRepuesto()); mantenimiento = reporteMantenimientoService.update(mantenimiento); } else { mantenimiento.setIdProductoRepuestoReporte(catalogoReporte.getProductoRepuestoReporte()); mantenimiento.setIdProductoClienteReporte(productoClienteReporte); mantenimiento.setCodigoRepuesto(catalogoReporte.getCodigoRepuesto()); mantenimiento.setTipoRepuesto(catalogoReporte.getTipoRepuesto()); mantenimiento = reporteMantenimientoService.save(mantenimiento); } }); listOtros.stream().filter((DetalleCatalogoReporte catalogoReporte) -> Objects.nonNull(catalogoReporte.getProductoRepuestoReporte()) && !catalogoReporte.isSeleccion()) .forEach((DetalleCatalogoReporte catalogoReporte) -> { mantenimientoAux = mantenimiento = new ReporteMantenimiento(); mantenimientoAux = this.containsIdReporteMantenimientoOtros(productoClienteReporte.getReporteMantenimientoList(), catalogoReporte.getProductoRepuestoReporte().getId()); if (mantenimientoAux.getId() != null) { mantenimiento = mantenimientoAux; mantenimiento.setEstado(Boolean.FALSE); reporteMantenimientoService.eliminar(mantenimiento); } }); } private ReporteMantenimiento containsIdReporteMantenimiento(List<ReporteMantenimiento> list, Integer id) { ReporteMantenimiento mantenimiento; for (ReporteMantenimiento object : list) { if (id != null && object.getId().intValue() == id.intValue() && object.getEstado() == Boolean.TRUE) { mantenimiento = new ReporteMantenimiento(); mantenimiento = object; return mantenimiento; } } return null; } private ReporteMantenimiento containsIdReporteMantenimientoOtros(List<ReporteMantenimiento> list, Integer id) { ReporteMantenimiento mantenimiento; for (ReporteMantenimiento object : list) { if (Objects.nonNull(object.getIdProductoRepuestoReporte())) { if (object.getIdProductoRepuestoReporte().getId().intValue() == id && object.getEstado() == Boolean.TRUE) { mantenimiento = new ReporteMantenimiento(); mantenimiento = object; return mantenimiento; } } } return new ReporteMantenimiento(); } @Override @Transactional public byte[] jasperReporte(int idReporte) { ProductoClienteReporte productoClienteReporte = productoClienteReporteService.getByReportId(idReporte); byte[] bytes = ReporteTecnico.jasperBytesReportes(productoClienteReporte, tipoVisitaService, detalleCatalogoReporteService, cabeceraCatalogoReporteService); return bytes; } @Transactional public void saveReporteReporteGenerico(Reporte reporte, Cliente cliente, Producto producto, String serie, ProductoDetalleReporte productoDetalleReporte, ProductoClienteReporte productoClienteReporte, Integer idClienteSucursal, Integer idTipoVisita, Usuarios usuario, AsignacionReparacion asignacionReparacion, Integer idProyecto, List<ReporteGenericoItems> items) { Reporte newReporte = new Reporte(); newReporte = reporte; newReporte.setIdVisita(new TipoVisita(idTipoVisita)); newReporte.setIdUsuario(usuario); newReporte.setFecha(new Date()); newReporte.setFechaCreacion(new Date()); newReporte.setUsuarioCreacion(usuario.getUsuario()); newReporte = this.save((Reporte) toUpperCaseStrings(newReporte)); DetalleInventarioProducto searchDetalleInventarioProducto = new DetalleInventarioProducto(); searchDetalleInventarioProducto = detalleInventarioProductoService.getBySerial(serie); boolean existeDetalleInventarioProducto = (searchDetalleInventarioProducto == null); ProductoClienteReporte newProductoClienteReporte = new ProductoClienteReporte(); newProductoClienteReporte = productoClienteReporte; if (existeDetalleInventarioProducto) { searchDetalleInventarioProducto = null; } newProductoClienteReporte.setIdDetalleInventarioProducto(searchDetalleInventarioProducto); newProductoClienteReporte.setIdReporte(newReporte); newProductoClienteReporte.setIdCliente(cliente); newProductoClienteReporte.setSerie(serie); newProductoClienteReporte.setIdProducto(producto); newProductoClienteReporte.setIdProductoDetalleReporte(productoDetalleReporteService.add(productoDetalleReporte)); newProductoClienteReporte.setIdClienteSucursal(new ClienteSucursal(idClienteSucursal)); if (idProyecto != null) { newProductoClienteReporte.setIdProyecto(new Proyectos(idProyecto)); } globalProductoClienteReporte = (productoClienteReporteService.save(newProductoClienteReporte)); if (asignacionReparacion != null && asignacionReparacion.getId() != null) { AsignacionReparacion newAsignacionReparacion = new AsignacionReparacion(); newAsignacionReparacion = asignacionReparacion; newAsignacionReparacion.setIdReporte(newReporte.getId()); newAsignacionReparacion.setEstado(newReporte.getEstado()); asignacionReparacionService.addAsignacionReparacion(asignacionReparacion); } this.saveItemsReporteGenerico(globalProductoClienteReporte, items); } @Transactional public void updateReporteReporteGenerico(Reporte reporte, Cliente cliente, Producto producto, String serie, ProductoDetalleReporte productoDetalleReporte, ProductoClienteReporte productoClienteReporte, Integer idClienteSucursal, Integer idTipoVisita, Usuarios usuario, AsignacionReparacion asignacionReparacion, Integer idProyecto, List<ReporteGenericoItems> items) { globalProductoClienteReporte = new ProductoClienteReporte(); Reporte newReporte = new Reporte(); newReporte = reporte; newReporte.setIdVisita(new TipoVisita(idTipoVisita)); newReporte.setIdUsuario(usuario); newReporte.setFechaModificacion(new Date()); newReporte.setUsuarioModificacion(usuario.getUsuario()); newReporte = this.update((Reporte) toUpperCaseStrings(newReporte)); ProductoClienteReporte newProductoClienteReporte = new ProductoClienteReporte(); newProductoClienteReporte = productoClienteReporte; newProductoClienteReporte.setIdReporte(newReporte); newProductoClienteReporte.setIdProducto(producto); newProductoClienteReporte.setIdProductoDetalleReporte(productoDetalleReporteService.update(productoDetalleReporte)); newProductoClienteReporte.setIdClienteSucursal(new ClienteSucursal(idClienteSucursal)); if (idProyecto != null) { newProductoClienteReporte.setIdProyecto(new Proyectos(idProyecto)); } globalProductoClienteReporte = productoClienteReporteService.update(newProductoClienteReporte); this.updateItemsReporteGenericoPreventivo(globalProductoClienteReporte, items); this.updateItemsReporteGenericoCorrectivo(globalProductoClienteReporte, items); } private void saveItemsReporteGenerico(ProductoClienteReporte productoClienteReporte, List<ReporteGenericoItems> items) { items.forEach((ReporteGenericoItems reporteGenericoItem) -> { ReporteGenericoItems re = new ReporteGenericoItems(); re = reporteGenericoItem; re.setIdProductoClienteReporte(productoClienteReporte); reporteGenericoItemsService.save(re); }); } private void updateItemsReporteGenericoPreventivo(ProductoClienteReporte productoClienteReporte, List<ReporteGenericoItems> currentList) { currentList.stream().filter((ReporteGenericoItems reporteGenericoItem) -> reporteGenericoItem.isSeleccion() && reporteGenericoItem.getTipo().charValue() == 'P').forEach((ReporteGenericoItems catalogoReporte) -> { reporteGenericoItemAux = new ReporteGenericoItems(); reporteGenericoItemAux = catalogoReporte; reporteGenericoItemAux = this.containsIdReporteGenericoItems(productoClienteReporte.getReporteGenericoItemsList(), reporteGenericoItemAux.getId()); reporteGenericoItem = new ReporteGenericoItems(); reporteGenericoItem.setEstado(Boolean.TRUE); if (reporteGenericoItemAux != null) { reporteGenericoItem = reporteGenericoItemAux; reporteGenericoItem = reporteGenericoItemsService.update(reporteGenericoItem); } else { reporteGenericoItem = new ReporteGenericoItems(); reporteGenericoItem = catalogoReporte; reporteGenericoItem.setIdProductoClienteReporte(productoClienteReporte); reporteGenericoItem = reporteGenericoItemsService.save(catalogoReporte); } }); currentList.stream().filter((ReporteGenericoItems reporteGenericoItem) -> !reporteGenericoItem.isSeleccion() && reporteGenericoItem.getTipo().charValue() == 'P').forEach((ReporteGenericoItems catalogoReporte) -> { reporteGenericoItem = new ReporteGenericoItems(); reporteGenericoItemAux = new ReporteGenericoItems(); reporteGenericoItemAux = this.containsIdReporteGenericoItems(productoClienteReporte.getReporteGenericoItemsList(), catalogoReporte.getId()); if (reporteGenericoItemAux != null) { reporteGenericoItem = reporteGenericoItemAux; reporteGenericoItemsService.eliminar(reporteGenericoItem); } }); } private void updateItemsReporteGenericoCorrectivo(ProductoClienteReporte productoClienteReporte, List<ReporteGenericoItems> currentList) { currentList.stream().filter((ReporteGenericoItems reporteGenericoItem) -> reporteGenericoItem.isSeleccion() && reporteGenericoItem.getTipo().charValue() == 'C').forEach((ReporteGenericoItems catalogoReporte) -> { reporteGenericoItemAux = new ReporteGenericoItems(); reporteGenericoItemAux = catalogoReporte; reporteGenericoItemAux = this.containsIdReporteGenericoItems(productoClienteReporte.getReporteGenericoItemsList(), reporteGenericoItemAux.getId()); reporteGenericoItem = new ReporteGenericoItems(); reporteGenericoItem.setEstado(Boolean.TRUE); if (reporteGenericoItemAux != null) { reporteGenericoItem = reporteGenericoItemAux; reporteGenericoItem = reporteGenericoItemsService.update(reporteGenericoItem); } else { reporteGenericoItem = new ReporteGenericoItems(); reporteGenericoItem = catalogoReporte; reporteGenericoItem.setIdProductoClienteReporte(productoClienteReporte); reporteGenericoItem = reporteGenericoItemsService.save(catalogoReporte); } }); currentList.stream().filter((ReporteGenericoItems reporteGenericoItem) -> !reporteGenericoItem.isSeleccion() && reporteGenericoItem.getTipo().charValue() == 'C').forEach((ReporteGenericoItems catalogoReporte) -> { reporteGenericoItem = new ReporteGenericoItems(); reporteGenericoItemAux = new ReporteGenericoItems(); reporteGenericoItemAux = this.containsIdReporteGenericoItems(productoClienteReporte.getReporteGenericoItemsList(), catalogoReporte.getId()); if (reporteGenericoItemAux != null) { reporteGenericoItem = reporteGenericoItemAux; reporteGenericoItemsService.eliminar(reporteGenericoItem); } }); } private ReporteGenericoItems containsIdReporteGenericoItems(List<ReporteGenericoItems> list, Integer id) { ReporteGenericoItems mantenimiento; for (ReporteGenericoItems object : list) { if (id != null && object.getId().intValue() == id.intValue()) { mantenimiento = new ReporteGenericoItems(); mantenimiento = object; return mantenimiento; } } return null; } }
package algo3.fiuba.modelo.jugador; import algo3.fiuba.modelo.TableroJugador; import algo3.fiuba.modelo.cartas.*; import algo3.fiuba.modelo.cartas.estados_cartas.EnJuego; import java.util.LinkedList; import java.util.List; import static algo3.fiuba.modelo.jugador.AccionJugador.TERMINAR_TURNO; public class PreInvocacion implements EstadoJugador { @Override public EstadoJugador colocarCartaEnCampo(Jugador jugador, TableroJugador tableroJugador, Monstruo carta, EnJuego tipoEnJuego) { tableroJugador.colocarCartaEnCampo(carta, tipoEnJuego); jugador.sacarCartaDeMano(carta); return new PostInvocacion(); } @Override public EstadoJugador colocarCartaEnCampo(Jugador jugador, TableroJugador tableroJugador, Magica carta, EnJuego tipoEnJuego) { tableroJugador.colocarCartaEnCampo(carta, tipoEnJuego); jugador.sacarCartaDeMano(carta); return new PreInvocacion(); } @Override public EstadoJugador colocarCartaEnCampo(Jugador jugador, TableroJugador tableroJugador, Trampa carta, EnJuego tipoEnJuego) { tableroJugador.colocarCartaEnCampo(carta, tipoEnJuego); jugador.sacarCartaDeMano(carta); return new PreInvocacion(); } @Override public EstadoJugador colocarCartaEnCampo(Jugador jugador, TableroJugador tableroJugador, CartaCampo carta, EnJuego tipoEnJuego) { tableroJugador.colocarCartaEnCampo(carta, tipoEnJuego); jugador.sacarCartaDeMano(carta); return new PreInvocacion(); } @Override public EstadoJugador cambioDeTurno() { return new TurnoDelOponente(); } @Override public List<AccionJugador> accionesJugadorDisponibles() { List<AccionJugador> acciones = new LinkedList<>(); acciones.add(AccionJugador.COLOCAR_MONSTRUO); acciones.add(AccionJugador.COLOCAR_DISTINTA_A_MONSTRUO); acciones.add(AccionJugador.TERMINAR_TURNO); return acciones; } }
package com.kingshuk.json.jacksonbinding.model; import java.math.BigDecimal; import java.util.Date; import java.util.List; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import lombok.Getter; import lombok.NoArgsConstructor; import lombok.Setter; import lombok.ToString; @Getter @Setter @NoArgsConstructor @ToString(of ={"id", "name","phone", "age", "addresses" }) @JsonIgnoreProperties(ignoreUnknown =true) public class Customer { private int id; private String name; private String phone; private String about; private int age; private BigDecimal balance; private boolean active; private List<Address> addresses; private Date joined; //data item names from JSON file public static final String ID="id", NAME="name", PHONE="phone", ABOUT="about", AGE="age", BALANCE="balance", ACTIVE="active", JOINED="joined"; }
package basis.chapter01; /** * Created by Administrator on 2015/4/11. * TestThreadPoll */ public class TestThreadPoll{ public static void main (String[] args) throws InterruptedException{ // //���̳߳��д���2���߳� // ExecutorService exec = new Executors.newScheduledThreadPool(2); // //����100���߳�Ŀ����� // for (int index=0; index<5;index++){ // Runnable run = new Runner(index); // //ִ���߳�Ŀ����� // exec.execute(run); // } // // exec.shutdown(); } }
package com.jclt.data; public class Goods { private String name; private String price; private String imgfile; public String getName() { return name; } public void setName(String name) { this.name = name; } public String getPrice() { return price; } public void setPrice(String price) { this.price = price; } public String getImgfile() { return imgfile; } public void setImgfile(String imgfile) { this.imgfile = imgfile; } }
/****************************************************************************** * __ * * <-----/@@\-----> * * <-< < \\// > >-> * * <-<-\ __ /->-> * * Data / \ Crow * * ^ ^ * * info@datacrow.net * * * * This file is part of Data Crow. * * Data Crow is free software; you can redistribute it and/or * * modify it under the terms of the GNU General Public * * License as published by the Free Software Foundation; either * * version 3 of the License, or any later version. * * * * Data Crow is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * * See the GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public * * License along with this program. If not, see http://www.gnu.org/licenses * * * ******************************************************************************/ package net.datacrow.core.web.beans; import java.util.ArrayList; import java.util.List; import java.util.Map; import javax.faces.application.FacesMessage; import javax.faces.context.FacesContext; import javax.faces.el.VariableResolver; import net.datacrow.core.data.DataFilterEntry; import net.datacrow.core.resources.DcResources; import net.datacrow.core.web.model.AdvancedFilter; import net.datacrow.core.web.model.DcWebObjects; import net.datacrow.util.Utilities; import org.apache.myfaces.custom.navmenu.NavigationMenuItem; public class AdvancedFind extends DcBean { @Override public String back() { return "search"; } @Override public String current() { return "advancedfind"; } @Override public List<NavigationMenuItem> getMenuItems() { List<NavigationMenuItem> menu = new ArrayList<NavigationMenuItem>(); menu.add(getMenuItem(DcResources.getText("lblBack"), "#{advancedFind.back}", null)); addLogoffMenuItem(menu); return menu; } @Override public String getActionListener() { return "#{advancedFind.actionListener}"; } public String open() { if (!isLoggedIn()) return redirect(); FacesContext fc = FacesContext.getCurrentInstance(); VariableResolver vr = fc.getApplication().getVariableResolver(); DcWebObjects objects = (DcWebObjects) vr.resolveVariable(fc, "webObjects"); AdvancedFilter af = (AdvancedFilter) vr.resolveVariable(fc, "advancedFilter"); af.initialize(objects.getModule()); return current(); } public String addEntry() { FacesContext fc = FacesContext.getCurrentInstance(); VariableResolver vr = fc.getApplication().getVariableResolver(); AdvancedFilter af = (AdvancedFilter) vr.resolveVariable(fc, "advancedFilter"); DataFilterEntry entry = af.getEntry(); if (entry.getOperator() == null) { fc.addMessage("msg", new FacesMessage("Operator is not filled!")); } else if (entry.getOperator().needsValue() && Utilities.isEmpty(entry.getValue())) { fc.addMessage("msg", new FacesMessage("Value is not filled!")); } else { af.addCurrentEntry(); } return current(); } public String deleteEntry() { FacesContext fc = FacesContext.getCurrentInstance(); VariableResolver vr = fc.getApplication().getVariableResolver(); AdvancedFilter af = (AdvancedFilter) vr.resolveVariable(fc, "advancedFilter"); Map map = fc.getExternalContext().getRequestParameterMap(); af.deleteEntry(Integer.parseInt((String) map.get("index"))); return current(); } public String editEntry() { FacesContext fc = FacesContext.getCurrentInstance(); VariableResolver vr = fc.getApplication().getVariableResolver(); AdvancedFilter af = (AdvancedFilter) vr.resolveVariable(fc, "advancedFilter"); Map map = fc.getExternalContext().getRequestParameterMap(); af.editEntry(Integer.parseInt((String) map.get("index"))); return current(); } public String search() { FacesContext fc = FacesContext.getCurrentInstance(); VariableResolver vr = fc.getApplication().getVariableResolver(); ItemSearch is = (ItemSearch) vr.resolveVariable(fc, "itemSearch"); return is.search(true); } }
/* Copyright 2017 Stratumn SAS. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ package com.stratumn.sdk; import java.nio.ByteBuffer; import com.stratumn.sdk.model.file.FileInfo; /** * The implementation of a FileWrapper using the blob and info to represent it. */ public class FileBlobWrapper extends FileWrapper { private ByteBuffer blob; private FileInfo fileInfo; public FileBlobWrapper(ByteBuffer blob, FileInfo fileInfo) { super(fileInfo.getKey()==null,fileInfo.getKey()); this.blob = blob; this.fileInfo = fileInfo; } public FileInfo info() { return this.fileInfo; } @Override public ByteBuffer encryptedData() throws TraceSdkException { ByteBuffer data = super.encryptData(this.blob); return data; } @Override public ByteBuffer decryptedData() throws TraceSdkException { return this.blob ; } }
/* * Copyright (c) 2016 ICM Uniwersytet Warszawski All rights reserved. * See LICENCE.txt file for licensing information. */ package pl.edu.icm.unity.ldap.endpoint; import org.apache.commons.lang.ArrayUtils; import org.apache.directory.api.ldap.model.constants.SchemaConstants; import org.apache.directory.api.ldap.model.exception.LdapInvalidDnException; import org.apache.directory.api.ldap.model.filter.BranchNode; import org.apache.directory.api.ldap.model.filter.ExprNode; import org.apache.directory.api.ldap.model.filter.SimpleNode; import org.apache.directory.api.ldap.model.name.Dn; import org.apache.directory.api.ldap.model.name.Rdn; import org.apache.directory.api.ldap.model.name.Ava; import org.apache.directory.api.ldap.model.schema.SchemaManager; /** * Static utility methods helping to extract data from {@link ExprNode} */ public class LdapNodeUtils { /** * @return Whether the LDAP query a user search? */ public static boolean isUserSearch(LdapServerProperties configuration, ExprNode node) { if (node instanceof BranchNode) { BranchNode n = (BranchNode) node; for (ExprNode en : n.getChildren()) { if (isUserSearch(configuration, en)) { return true; } } } else if (node instanceof SimpleNode) { SimpleNode<?> sns = (SimpleNode<?>) node; String[] aliases = configuration.getValue( LdapServerProperties.USER_NAME_ALIASES ).split(","); if (ArrayUtils.contains(aliases, sns.getAttribute())) { return true; } } return false; } /** * @return Whether the LDAP query a groupofnames search? */ public static String parseGroupOfNamesSearch(SchemaManager schemaManager, LdapServerProperties configuration, ExprNode node) { boolean is_gofn_search = false; String user = null; // no recursion and we expect at least two children // - member // - objectClass if (node instanceof BranchNode) { BranchNode n = (BranchNode) node; for (ExprNode en : n.getChildren()) { if (!(en instanceof SimpleNode)) { continue; } SimpleNode<?> sns = (SimpleNode<?>) en; if (sns.getAttribute().equals(SchemaConstants.OBJECT_CLASS_AT) && sns.getValue().toString().toLowerCase().equals(SchemaConstants.GROUP_OF_NAMES_OC.toLowerCase())) { is_gofn_search = true; } else if (sns.getAttribute().equals(SchemaConstants.MEMBER_AT)) { try { user = getUserName( configuration, new Dn(schemaManager, sns.getValue().toString()) ); } catch (LdapInvalidDnException e) { return null; } } } } if (is_gofn_search) { return user; } return null; } public static String getUserName(LdapServerProperties configuration, Dn dn) { String[] aliases = configuration.getValue( LdapServerProperties.USER_NAME_ALIASES ).split(","); for (String alias : aliases) { String part = getPart(dn, alias); if (null != part) { return part; } } return null; } public static String getUserName(LdapServerProperties configuration, ExprNode node) { String[] aliases = configuration.getValue( LdapServerProperties.USER_NAME_ALIASES ).split(","); return getUserName(node, aliases); } // // private // private static String getUserName(ExprNode node, String attribute) { if (node instanceof BranchNode) { BranchNode n = (BranchNode) node; for (ExprNode en : n.getChildren()) { String username = getUserName(en, attribute); if (null != username) { return username; } } } else if (node instanceof SimpleNode) { try { SimpleNode<?> sns = (SimpleNode<?>) node; if (sns.getAttribute().equals(attribute)) { return sns.getValue().toString(); } } catch (Exception e) { return null; } } return null; } // User name extracted from LDAP query based on attributes private static String getUserName(ExprNode node, String[] attributes) { for (int i = 0; i < attributes.length; ++i) { String uname = getUserName(node, attributes[i]); if (null != uname) { return uname; } } return null; } // Get query value from LDAP DN. public static String getPart(Dn dn, String query) { for (Rdn rdn : dn.getRdns()) { Ava ava = rdn.getAva(); if (null == ava) { continue; } // can be e.g., 2.5.4.3 String key_name = ava.getType(); if (null != ava.getAttributeType()) { // use name from schema key_name = ava.getAttributeType().getName(); } if (key_name.equals(query)) { return ava.getValue().getString(); } } return null; } }
package msip.go.kr.share.web; import java.util.List; import javax.annotation.Resource; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.ResponseBody; import egovframework.com.cmm.EgovMessageSource; import egovframework.com.cmm.LoginVO; import egovframework.rte.fdl.security.userdetails.util.EgovUserDetailsHelper; import msip.go.kr.share.entity.ReqMaster; import msip.go.kr.share.entity.ReqOpn; import msip.go.kr.share.service.ReqMasterService; import msip.go.kr.share.service.ReqOpnService; /** * 게시판 의견 관리 Controller * @author dolte * */ @Controller public class ReqOpnController { @Resource(name = "reqOpnService") private ReqOpnService reqOpnService; @Resource(name = "reqMasterService") private ReqMasterService reqMasterService; @Resource(name="egovMessageSource") EgovMessageSource egovMessageSource; /** * 게시글의 의견 목록을 반환한다. * @param itemId 게시글 일련번호 * @param model * @return * @throws Exception */ @RequestMapping(value = "/share/req/opinion/{reqId}", method = RequestMethod.GET) @ResponseBody public List<ReqOpn> list(@PathVariable Long reqId, Model model) throws Exception { List<ReqOpn> opinions = null; try { opinions = reqOpnService.findAllByReqId(reqId); } catch(Exception e) { e.printStackTrace(); } return opinions; } /** * 게시글의 의견을 등록한다. * @param entity 의견 entity * @param model * @return * @throws Exception */ @RequestMapping(value = "/share/req/opinion/regist", method = RequestMethod.POST) @ResponseBody public String regist(ReqOpn entity, Model model) throws Exception { String message = ""; try { // 로그인VO에서 사용자 정보 가져오기 LoginVO loginVO = (LoginVO) EgovUserDetailsHelper.getAuthenticatedUser(); entity.setRegistInfo(entity, loginVO); reqOpnService.persist(entity); message = egovMessageSource.getMessage("success.common.insert"); } catch(Exception e) { e.printStackTrace(); message = egovMessageSource.getMessage("fail.common.insert"); } return message; } /** * 게시글 의견 수정 * @param entity 게시글 의견 entity * @param model * @return * @throws Exception */ @RequestMapping(value = "/share/req/opinion/update", method = RequestMethod.POST) @ResponseBody public String update(ReqOpn entity, Model model) throws Exception { String message = ""; try { // 로그인VO에서 사용자 정보 가져오기 LoginVO loginVO = (LoginVO) EgovUserDetailsHelper.getAuthenticatedUser(); //의견 수정권한 확인 ReqOpn server = reqOpnService.findById(entity.getId()); server.checkOwner(loginVO); server.setContent(entity.getContent()); server.setUpdateInfo(entity, loginVO); reqOpnService.merge(server); message = egovMessageSource.getMessage("success.common.insert"); } catch(Exception e) { message = egovMessageSource.getMessage("fail.common.insert"); } return message; } /** * 게시글 의견 삭제 * @param id 게시글 의견 일련번호 * @param model * @return * @throws Exception */ @RequestMapping(value = "/share/req/opinion/remove/{id}", method = RequestMethod.POST) @ResponseBody public String remove(@PathVariable Long id, Model model) throws Exception { String message = ""; try { // 로그인VO에서 사용자 정보 가져오기 LoginVO loginVO = (LoginVO) EgovUserDetailsHelper.getAuthenticatedUser(); //의견 삭제 권한 확인 ReqOpn entity = reqOpnService.findById(id); entity.checkOwner(loginVO); reqOpnService.remove(entity); message = egovMessageSource.getMessage("success.common.delete"); } catch(Exception e) { e.printStackTrace(); message = egovMessageSource.getMessage("fail.common.delete"); } return message; } }