Skip to content
This repository was archived by the owner on Jan 23, 2025. It is now read-only.

promote to master #12

Merged
merged 16 commits into from
Nov 28, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .deploy/circleci/README
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
All files and directories under this directory will be copy to tc-website root on circleci env before build
10 changes: 5 additions & 5 deletions build_distui.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<project name="topcoder" default="main" basedir=".">
<property environment="env"/>
<property name="Name" value="TopCoder"/>
<property name="build" value="build"/>
<property name="war.dir" value="${build}/wars"/>
Expand All @@ -23,11 +24,10 @@
<property name="common.jar" value="${bin}/tcwebcommon.jar"/>
<property name="tccache.jar" value="${jars.dir}/tcs/tc_cache/1.0.0/tc_cache.jar"/>
<property name="web" value="src/main/com/topcoder/web"/>
<property name="jboss_home" value="/home/distui/jboss-4.2.0.GA"/>
<property name="jboss_deploy" value="${jboss_home}/server/distui/deploy"/>
<property name="jboss_lib" value="${jboss_home}/server/distui/lib"/>
<property name="jboss_conf" value="${jboss_home}/server/distui/conf"/>
<property environment="env"/>
<property name="jboss_home" value="${env.JBOSS_HOME}"/>
<property name="jboss_deploy" value="${jboss_home}/server/all/deploy"/>
<property name="jboss_lib" value="${jboss_home}/server/all/lib"/>
<property name="jboss_conf" value="${jboss_home}/server/all/conf"/>

<property name="deprecation" value="true"/>
<property name="debug" value="true"/>
Expand Down
10 changes: 4 additions & 6 deletions build_mm.xml
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@
<property name="long.jar" value="${bin}/long.jar"/>
<property name="web" value="src/main/com/topcoder/web"/>
<property name="jboss_home" value="${env.JBOSS_HOME}"/>
<property name="jboss_deploy" value="${jboss_home}/server/mm/deploy"/>
<property name="jboss_lib" value="${jboss_home}/server/mm/lib"/>
<property name="jboss_conf" value="${jboss_home}/server/mm/conf"/>
<property name="jboss_deploy" value="${jboss_home}/server/all/deploy"/>
<property name="jboss_lib" value="${jboss_home}/server/all/lib"/>
<property name="jboss_conf" value="${jboss_home}/server/all/conf"/>

<property name="deprecation" value="true"/>
<property name="debug" value="true"/>
Expand Down Expand Up @@ -256,9 +256,7 @@ copy in the classpath

<target name="expand">
<!-- copy the libs -->
<copy todir="${jboss_lib}" file="${external.jars.dir}/ifxjdbc-3.00.JC3.jar"/>
<copy todir="${jboss_lib}" file="${jboss_home}/server/all/lib/jgroups.jar"/>
<copy todir="${jboss_lib}" file="${jboss_home}/server/all/lib/jboss-cache-jdk50.jar"/>
<copy todir="${jboss_lib}" file="${jars.dir}/ifxjdbc.jar"/>


<!-- these jars are needed by the ejb's. really we should build a web app that contains these libs -->
Expand Down
2 changes: 1 addition & 1 deletion build_tc.xml
Original file line number Diff line number Diff line change
Expand Up @@ -847,7 +847,7 @@
<fileset dir="${jars.dir}/tcs/json_object/1.0">
<include name="json_object.jar"/>
</fileset>
<fileset dir="${jars.dir}/tcs">
<fileset dir="${jars.dir}/tcs/ldap_sdk_interface/1.0.2">
<include name="ldap_sdk_interface.jar"/>
</fileset>
<fileset dir="${jars.dir}">
Expand Down
14 changes: 14 additions & 0 deletions circle.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
machine:
services:
- docker

checkout:
pre:
- git clone https://github.com/topcoder-platform/tc-website-glue glue
- git clone https://github.com/topcoder-platform/tc-website-shared shared
- git clone https://github.com/topcoder-platform/tc-website-external-artifacts external-artifacts


test:
override:
- cp -Rf .deploy/circleci/* . && docker run -v ${HOME}:/root/tc-platform appiriodevops/tc-website:build
40 changes: 20 additions & 20 deletions resources/cache.properties
Original file line number Diff line number Diff line change
@@ -1,33 +1,33 @@
cache.primary = localhost:8501
#cache.primary = localhost:8501
#cache.secondary = 63.118.154.182:8502

# allow at most 25000 items in the cache
cache.size = 25000
#cache.size = 25000
# sync every 10 seconds
cache.synctime = 10000
#cache.synctime = 10000

# check every minute
cache.expirecheck = 60000
#cache.expirecheck = 60000
# expire after 10 hours
cache.expiretime = 3600000
#cache.expiretime = 3600000

### Use the following configurations to use JBoss Cache as cache ###

host_url = env.topcoder.com:2199
jndi_name = TCCache
cache_admin_jndi_name = TCCacheAdmin
cache_client_class=com.topcoder.web.common.cache.JbossCacheClient
#host_url = env.topcoder.com:2199
#jndi_name = TCCache
#cache_admin_jndi_name = TCCacheAdmin
#cache_client_class=com.topcoder.web.common.cache.JbossCacheClient

### Use the following configurations to use REDIS as cache ###
#cache_client_class=com.topcoder.web.common.cache.RedisCacheClient
#tc_subject_cache_address_class=com.topcoder.web.common.cache.address.TCSubjectAddress
#request_cache_address_class=com.topcoder.web.common.cache.address.RequestAddress
#
cache_client_class=com.topcoder.web.common.cache.RedisCacheClient
tc_subject_cache_address_class=com.topcoder.web.common.cache.address.TCSubjectAddress
request_cache_address_class=com.topcoder.web.common.cache.address.RequestAddress
#
#format: redis://username:password@my.host:6389
#redis.uri=redis://cache.topcoder.com:6379
#redis.maxTotalConnections=50
#redis.maxIdleConnections=30
#redis.minIdleConnections=1
redis.uri=redis://env.topcoder.com:6379
#
#
redis.maxTotalConnections=50
redis.maxIdleConnections=30
redis.minIdleConnections=1
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">

<hibernate-mapping package="com.topcoder.web.common.model">

<class name="UserSSOLogin" table="common_oltp:user_sso_login" >
<composite-id name="id" class="UserSSOLogin$Identifier">
<key-property name="userId" column="user_id" />
<key-property name="providerId" column="provider_id" />
</composite-id>

<property name="ssoUserName" column="sso_user_name" access="field"/>
<property name="ssoEmail" column="email" access="field"/>
<property name="ssoUserId" column="sso_user_id" access="field"/>
</class>
</hibernate-mapping>
4 changes: 4 additions & 0 deletions resources/reg/hibernate.cfg.xml
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,10 @@
<mapping class="com.topcoder.web.common.model.educ.ProfessorStatus"/>

<mapping resource="com/topcoder/web/common/model/UserSocialLogin.hbm.xml"/>

<!-- 2017.04.24 [SEG-42] Block adding additional social logins to account -->
<mapping resource="com/topcoder/web/common/model/UserSSOLogin.hbm.xml"/>

<mapping resource="com/topcoder/web/common/model/UserApiSpin.hbm.xml"/>

<mapping resource="com/topcoder/web/common/model/DocuSignEnvelope.hbm.xml"/>
Expand Down
5 changes: 5 additions & 0 deletions resources/taglib/tc-webtags.tld
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,11 @@
<required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
<attribute>
<name>disabled</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
</tag>

<tag>
Expand Down
7 changes: 7 additions & 0 deletions src/main/com/topcoder/web/common/dao/DAOFactory.java
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,13 @@ public interface DAOFactory {
*/
UserSocialLoginDAO getUserSocialLoginDAO();

/**
* Gets the instance of {@link UserSSOLoginDAO}.
*
* @return the dao.
*/
UserSSOLoginDAO getUserSSOLoginDAO();

/**
* Gets the instance of {@link UserApiSpinDAO}.
*
Expand Down
31 changes: 31 additions & 0 deletions src/main/com/topcoder/web/common/dao/UserSSOLoginDAO.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
/*
* Copyright (C) 2017 TopCoder Inc., All Rights Reserved.
*/
package com.topcoder.web.common.dao;

import com.topcoder.web.common.model.UserSSOLogin;

import java.util.List;

/**
* <p>
* An interface for the UserSSOLogin DAO.
* </p>
*
* <p>
* <strong>Thread safety:</strong> This class is thread-safe.
* </p>
*
* @author kht.tc
* @version 1.0
*/
public interface UserSSOLoginDAO extends GenericDAO<UserSSOLogin, UserSSOLogin.Identifier> {
/**
* Find UserSSOLogin by user id.
*
* @param userId the user id
* @return retrieved list
*/
List<UserSSOLogin> findByUserId(long userId);
UserSSOLogin findByProviderIdAndSSOUserId(long providerId, String ssoUserId);
}
Original file line number Diff line number Diff line change
Expand Up @@ -379,6 +379,15 @@ public UserSocialLoginDAO getUserSocialLoginDAO() {
return new UserSocialLoginDAOHibernate();
}

/**
* Gets the instance of {@link UserSSOLoginDAO}.
*
* @return the dao.
*/
public UserSSOLoginDAO getUserSSOLoginDAO() {
return new UserSSOLoginDAOHibernate();
}

/**
* Gets the instance of {@link UserApiSpinDAO}.
*
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
/*
* Copyright (C) 2017 TopCoder Inc., All Rights Reserved.
*/
package com.topcoder.web.common.dao.hibernate;

import com.topcoder.web.common.dao.UserSSOLoginDAO;
import com.topcoder.web.common.model.UserSSOLogin;
import org.hibernate.Criteria;
import org.hibernate.Query;
import org.hibernate.criterion.Restrictions;

import java.util.List;

/**
* <p>
* An implementation for the UserSSOLogin DAO.
* </p>
*
* <p>
* <strong>Thread safety:</strong> This class is thread-safe.
* </p>
*
* @author kht.tc
* @version 1.0
*/
public class UserSSOLoginDAOHibernate extends GenericBase<UserSSOLogin, UserSSOLogin.Identifier>
implements UserSSOLoginDAO {

/**
* Find UserSSOLogin by user id.
*
* @param userId the user id
* @return retrieved list
*/
public List<UserSSOLogin> findByUserId(long userId) {
Query q = getSession().createQuery("from UserSSOLogin " +
" where id.userId = " + userId ).setCacheable(false);

return q.list();
}

public UserSSOLogin findByProviderIdAndSSOUserId(long providerId, String ssoUserId) {
Criteria c = getSession().createCriteria(UserSSOLogin.class)
.add(Restrictions.eq("ssoUserId", ssoUserId))
.add(Restrictions.eq("id.providerId", providerId));
List ret = c.list();
return ret.isEmpty() ? null : (UserSSOLogin) ret.get(0);

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -366,6 +366,15 @@ public UserSocialLoginDAO getUserSocialLoginDAO() {
throw new RuntimeException("Not supported");
}

/**
* Gets the instance of {@link UserSSOLoginDAO}.
*
* @return nothing, will throw exception.
*/
public UserSSOLoginDAO getUserSSOLoginDAO() {
throw new RuntimeException("Not supported");
}

/**
* Gets the instance of {@link UserApiSpinDAO}.
*
Expand Down Expand Up @@ -405,4 +414,5 @@ public EmailRequestDAO getEmailRequestDAO() {
public DocuSignEnvelopeDAO getDocuSignEnvelopeDAO() {
throw new RuntimeException("Not supported");
}

}
19 changes: 18 additions & 1 deletion src/main/com/topcoder/web/common/model/PaymentMethod.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,21 @@
/**
* A class to hold Payment Method data.
*
* @author VolodymyrK
* <p>
* Version 1.1 (Topcoder - Add New Payment Provider) Change notes:
* <ol>
* <li>Added eligible attribute to determinate whether the payment method is allowed or not.</li>
* </ol>
* </p>
*
* @author VolodymyrK, TCSCODER
* @version 1.1
*/
public class PaymentMethod extends Base {

private Long id;
private String name;
private boolean eligible = true;

public PaymentMethod() {
}
Expand All @@ -30,4 +39,12 @@ public void setName(String name) {
this.name = name;
}

public boolean isEligible() {
return eligible;
}

public void setEligible(boolean eligible) {
this.eligible = eligible;
}

}
Loading