├── target ├── .gitignore └── m2e-jee │ └── web-resources │ └── .gitignore ├── .settings ├── org.eclipse.wst.jsdt.ui.superType.name ├── org.eclipse.wst.jsdt.ui.superType.container ├── org.eclipse.wst.common.project.facet.core.prefs.xml ├── com.genuitec.eclipse.migration.prefs ├── org.eclipse.wst.common.project.facet.core.xml ├── org.eclipse.jdt.core.prefs ├── org.eclipse.wst.common.component └── .jsdtscope ├── README.md ├── .tern-project ├── WebRoot ├── META-INF │ └── MANIFEST.MF ├── apidocs │ ├── images │ │ ├── throbber.gif │ │ ├── logo_small.png │ │ ├── wordnik_api.png │ │ ├── pet_store_api.png │ │ └── explorer_icons.png │ ├── lib │ │ ├── jquery.slideto.min.js │ │ ├── jquery.wiggle.min.js │ │ ├── jquery.ba-bbq.min.js │ │ ├── highlight.7.3.pack.js │ │ ├── swagger-oauth.js │ │ └── shred │ │ │ └── content.js │ ├── o2c.html │ ├── css │ │ └── reset.css │ └── index.html ├── index.jsp ├── WEB-INF │ └── web.xml └── dbscript │ └── createdb_script.sql ├── src ├── com │ ├── macys │ │ ├── rest │ │ │ ├── BaseRestController.java │ │ │ └── filters │ │ │ │ ├── UserAuthenticator.java │ │ │ │ ├── UserAuthResponseFilter.java │ │ │ │ └── UserAuthRequestFilter.java │ │ ├── utils │ │ │ ├── EmailTemplateEnum.java │ │ │ ├── Constants.java │ │ │ ├── ServiceUtils.java │ │ │ ├── EncryptionUtils.java │ │ │ ├── PropertiesUtils.java │ │ │ ├── JsonUtils.java │ │ │ ├── AppUtils.java │ │ │ └── EmailUtils.java │ │ ├── dao │ │ │ ├── database │ │ │ │ ├── DBAbstractBase.java │ │ │ │ ├── pk │ │ │ │ │ ├── DBObjectMetadataJsonPK.java │ │ │ │ │ ├── DBObjectACLPK.java │ │ │ │ │ ├── DBObjectContentStorePK.java │ │ │ │ │ ├── DBObjectMetadataPK.java │ │ │ │ │ ├── DBQueuePK.java │ │ │ │ │ ├── DBObjectRelationshipPK.java │ │ │ │ │ └── DBObjectRelationshipMetadataPK.java │ │ │ │ ├── DBObjectRelationshipMetadata.java │ │ │ │ ├── DBObjectACL.java │ │ │ │ ├── DBObjectContentStore.java │ │ │ │ ├── DBObjectRelationship.java │ │ │ │ ├── DBObjectMetadata.java │ │ │ │ ├── DBObjectMetadataJson.java │ │ │ │ └── DBObject.java │ │ │ ├── DAOUtils.java │ │ │ ├── repository │ │ │ │ ├── DBObjectRepository.java │ │ │ │ ├── DBObjectMetadataRepository.java │ │ │ │ ├── DBObjectRelationshipRepository.java │ │ │ │ └── JdbcTemplateRepostiory.java │ │ │ ├── DAO.java │ │ │ ├── BaseDAOImpl.java │ │ │ └── ReflectionUtils.java │ │ ├── valuesobjects │ │ │ ├── containers │ │ │ │ ├── BaseContainerVo.java │ │ │ │ ├── UserContainerVo.java │ │ │ │ ├── LabContainerVo.java │ │ │ │ ├── ReleaseContainerVo.java │ │ │ │ ├── ReleaseCupContainerVo.java │ │ │ │ └── SystemComponentContainerVo.java │ │ │ ├── ReleaseVo.java │ │ │ ├── SystemComponentVo.java │ │ │ ├── LabVo.java │ │ │ ├── ReleaseCupVo.java │ │ │ ├── IPMTreeVo.java │ │ │ ├── MetaVo.java │ │ │ ├── BaseDTO.java │ │ │ ├── UserVo.java │ │ │ └── MatrixVo.java │ │ ├── domain │ │ │ ├── SystemComponent.java │ │ │ ├── business │ │ │ │ ├── common │ │ │ │ │ ├── annotations │ │ │ │ │ │ ├── PersistentMetadata.java │ │ │ │ │ │ ├── PersistentMetadataJson.java │ │ │ │ │ │ └── PersistentBusinessObject.java │ │ │ │ │ ├── RelationshipTypeEnum.java │ │ │ │ │ ├── Relationship.java │ │ │ │ │ └── BusinessObjectTypeEnum.java │ │ │ │ ├── BusinessObject.java │ │ │ │ └── BusinessObjectImpl.java │ │ │ ├── Lab.java │ │ │ ├── Release.java │ │ │ ├── User.java │ │ │ ├── ReleaseCup.java │ │ │ └── impl │ │ │ │ ├── SystemComponentImpl.java │ │ │ │ ├── LabImpl.java │ │ │ │ ├── ReleaseImpl.java │ │ │ │ ├── ReleaseCupImpl.java │ │ │ │ └── UserImpl.java │ │ ├── exceptions │ │ │ ├── ServiceException.java │ │ │ ├── GeneralExceptionMapper.java │ │ │ └── ErrorCodeEnum.java │ │ └── services │ │ │ ├── BaseService.java │ │ │ └── UserService.java │ └── main │ │ ├── HibernateTest.java │ │ └── Test.java ├── readme.txt ├── log4j.properties ├── application.properties └── applicationContext.xml ├── .classpath ├── .project └── pom.xml /target/.gitignore: -------------------------------------------------------------------------------- 1 | /classes/ 2 | -------------------------------------------------------------------------------- /.settings/org.eclipse.wst.jsdt.ui.superType.name: -------------------------------------------------------------------------------- 1 | Window -------------------------------------------------------------------------------- /target/m2e-jee/web-resources/.gitignore: -------------------------------------------------------------------------------- 1 | /META-INF/ 2 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # fillthecupserver 2 | server to handle labs data 3 | -------------------------------------------------------------------------------- /.tern-project: -------------------------------------------------------------------------------- 1 | {"ide":{},"libs":["ecma5","browser"],"plugins":{"guess-types":{}}} -------------------------------------------------------------------------------- /WebRoot/META-INF/MANIFEST.MF: -------------------------------------------------------------------------------- 1 | Manifest-Version: 1.0 2 | Class-Path: 3 | 4 | -------------------------------------------------------------------------------- /.settings/org.eclipse.wst.jsdt.ui.superType.container: -------------------------------------------------------------------------------- 1 | org.eclipse.wst.jsdt.launching.baseBrowserLibrary -------------------------------------------------------------------------------- /WebRoot/apidocs/images/throbber.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abbasikov/fillthecupserver/HEAD/WebRoot/apidocs/images/throbber.gif -------------------------------------------------------------------------------- /src/com/macys/rest/BaseRestController.java: -------------------------------------------------------------------------------- 1 | package com.macys.rest; 2 | 3 | public abstract class BaseRestController { 4 | 5 | } 6 | -------------------------------------------------------------------------------- /WebRoot/apidocs/images/logo_small.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abbasikov/fillthecupserver/HEAD/WebRoot/apidocs/images/logo_small.png -------------------------------------------------------------------------------- /WebRoot/apidocs/images/wordnik_api.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abbasikov/fillthecupserver/HEAD/WebRoot/apidocs/images/wordnik_api.png -------------------------------------------------------------------------------- /WebRoot/apidocs/images/pet_store_api.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abbasikov/fillthecupserver/HEAD/WebRoot/apidocs/images/pet_store_api.png -------------------------------------------------------------------------------- /WebRoot/apidocs/images/explorer_icons.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abbasikov/fillthecupserver/HEAD/WebRoot/apidocs/images/explorer_icons.png -------------------------------------------------------------------------------- /src/com/macys/utils/EmailTemplateEnum.java: -------------------------------------------------------------------------------- 1 | package com.macys.utils; 2 | 3 | public enum EmailTemplateEnum { 4 | NEW_REGISTRATION, 5 | PASSWORD_RESET, 6 | PASSWORD_CHANGE 7 | } 8 | -------------------------------------------------------------------------------- /.settings/org.eclipse.wst.common.project.facet.core.prefs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /.settings/com.genuitec.eclipse.migration.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | performed.operation.install.java=1.0 3 | performed.operation.me.configure.js=1.0 4 | performed.operation.me.install.mavenfacet=1.0 5 | performed.operation.me.migrate.jsnature=1.0 6 | -------------------------------------------------------------------------------- /src/com/macys/dao/database/DBAbstractBase.java: -------------------------------------------------------------------------------- 1 | package com.macys.dao.database; 2 | 3 | import java.io.Serializable; 4 | 5 | public class DBAbstractBase implements Serializable { 6 | 7 | private static final long serialVersionUID = 1L; 8 | 9 | } 10 | -------------------------------------------------------------------------------- /src/readme.txt: -------------------------------------------------------------------------------- 1 | before deploying this application to server please change following path. 2 | 3 | 1-base path in applicationContext.xml for swagger. 4 | 2-db credentials in application.properties file 5 | 3-change logs path in log4j.properties 6 | 4-base path in index.html in apidocs for swagger 7 | 8 | -------------------------------------------------------------------------------- /src/com/macys/valuesobjects/containers/BaseContainerVo.java: -------------------------------------------------------------------------------- 1 | package com.macys.valuesobjects.containers; 2 | 3 | import org.codehaus.jackson.annotate.JsonProperty; 4 | 5 | import com.macys.valuesobjects.MetaVo; 6 | 7 | public class BaseContainerVo { 8 | 9 | @JsonProperty("meta") 10 | public MetaVo meta = new MetaVo(); 11 | 12 | } 13 | -------------------------------------------------------------------------------- /.settings/org.eclipse.wst.common.project.facet.core.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /WebRoot/apidocs/lib/jquery.slideto.min.js: -------------------------------------------------------------------------------- 1 | (function(b){b.fn.slideto=function(a){a=b.extend({slide_duration:"slow",highlight_duration:3E3,highlight:true,highlight_color:"#FFFF99"},a);return this.each(function(){obj=b(this);b("body").animate({scrollTop:obj.offset().top},a.slide_duration,function(){a.highlight&&b.ui.version&&obj.effect("highlight",{color:a.highlight_color},a.highlight_duration)})})}})(jQuery); 2 | -------------------------------------------------------------------------------- /.settings/org.eclipse.jdt.core.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled 3 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7 4 | org.eclipse.jdt.core.compiler.compliance=1.7 5 | org.eclipse.jdt.core.compiler.problem.assertIdentifier=error 6 | org.eclipse.jdt.core.compiler.problem.enumIdentifier=error 7 | org.eclipse.jdt.core.compiler.source=1.7 8 | -------------------------------------------------------------------------------- /src/com/macys/valuesobjects/ReleaseVo.java: -------------------------------------------------------------------------------- 1 | package com.macys.valuesobjects; 2 | 3 | public class ReleaseVo extends BaseDTO{ 4 | 5 | public String branchCutDate; 6 | 7 | public String branchHardLockDate; 8 | 9 | public String mcomDate; 10 | 11 | public String bcomDate; 12 | 13 | public String branchFreezeDate; 14 | 15 | public String branchProductionDate; 16 | 17 | public String isActivated; 18 | 19 | } 20 | -------------------------------------------------------------------------------- /WebRoot/apidocs/o2c.html: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/com/macys/domain/SystemComponent.java: -------------------------------------------------------------------------------- 1 | package com.macys.domain; 2 | 3 | import com.macys.domain.business.BusinessObject; 4 | 5 | public interface SystemComponent extends BusinessObject{ 6 | 7 | public abstract void setDescription(String description); 8 | 9 | public abstract String getDescription(); 10 | 11 | public abstract void setDisplayName(String displayName); 12 | 13 | public abstract String getDisplayName(); 14 | 15 | } 16 | -------------------------------------------------------------------------------- /src/com/macys/valuesobjects/containers/UserContainerVo.java: -------------------------------------------------------------------------------- 1 | package com.macys.valuesobjects.containers; 2 | 3 | import java.util.List; 4 | 5 | import org.codehaus.jackson.annotate.JsonProperty; 6 | 7 | import com.macys.valuesobjects.UserVo; 8 | 9 | public class UserContainerVo extends BaseContainerVo{ 10 | 11 | @JsonProperty("data") 12 | public UserVo data; 13 | 14 | @JsonProperty("dataList") 15 | public List dataList; 16 | 17 | } 18 | -------------------------------------------------------------------------------- /src/com/macys/domain/business/common/annotations/PersistentMetadata.java: -------------------------------------------------------------------------------- 1 | package com.macys.domain.business.common.annotations; 2 | 3 | import java.lang.annotation.ElementType; 4 | import java.lang.annotation.Retention; 5 | import java.lang.annotation.RetentionPolicy; 6 | import java.lang.annotation.Target; 7 | 8 | @Retention(RetentionPolicy.RUNTIME) 9 | @Target(value = { ElementType.FIELD }) 10 | public @interface PersistentMetadata { 11 | 12 | 13 | 14 | } -------------------------------------------------------------------------------- /src/com/macys/utils/Constants.java: -------------------------------------------------------------------------------- 1 | package com.macys.utils; 2 | 3 | public class Constants { 4 | 5 | public static int SUCCESS = 200; 6 | public static String KEY_COMPANY_TYPES = "company_types"; 7 | public static String KEY_REGISTRATION_ALERT = "boolean.registration_alert"; 8 | public static String DATE_FORMAT_ISO8601 = "yyyy-MM-dd'T'HH:mm:ss.SSZZ"; 9 | public static String SYSTEM_USER = "FillTheCup"; 10 | 11 | 12 | 13 | } 14 | -------------------------------------------------------------------------------- /src/com/macys/domain/business/common/annotations/PersistentMetadataJson.java: -------------------------------------------------------------------------------- 1 | package com.macys.domain.business.common.annotations; 2 | 3 | import java.lang.annotation.ElementType; 4 | import java.lang.annotation.Retention; 5 | import java.lang.annotation.RetentionPolicy; 6 | import java.lang.annotation.Target; 7 | 8 | @Retention(RetentionPolicy.RUNTIME) 9 | @Target(value = { ElementType.FIELD }) 10 | public @interface PersistentMetadataJson { 11 | 12 | 13 | 14 | } -------------------------------------------------------------------------------- /src/com/macys/valuesobjects/SystemComponentVo.java: -------------------------------------------------------------------------------- 1 | package com.macys.valuesobjects; 2 | 3 | public class SystemComponentVo extends BaseDTO{ 4 | 5 | public SystemComponentVo(){ 6 | 7 | } 8 | 9 | public SystemComponentVo(String uuid,String name,String type){ 10 | super.uuid = uuid; 11 | super.name = name; 12 | super.type = type; 13 | this.displayName = name; 14 | } 15 | 16 | public String displayName; 17 | public String description; 18 | 19 | } 20 | -------------------------------------------------------------------------------- /src/com/macys/valuesobjects/LabVo.java: -------------------------------------------------------------------------------- 1 | package com.macys.valuesobjects; 2 | 3 | import java.util.List; 4 | 5 | public class LabVo extends BaseDTO{ 6 | 7 | public String pdmName; 8 | 9 | public String managerName; 10 | 11 | public String description; 12 | 13 | public String location; 14 | 15 | public String lastClicked; 16 | 17 | public String isActivated; 18 | 19 | public List users; 20 | 21 | public List releaseCups; 22 | 23 | } 24 | -------------------------------------------------------------------------------- /src/com/macys/dao/DAOUtils.java: -------------------------------------------------------------------------------- 1 | package com.macys.dao; 2 | 3 | import java.util.ArrayList; 4 | import java.util.List; 5 | 6 | public class DAOUtils { 7 | 8 | @SafeVarargs 9 | public static List asListOfStrings(T... a) { 10 | 11 | if(a == null) { 12 | return null; 13 | } 14 | 15 | List list = new ArrayList(a.length); 16 | 17 | for (int i = 0; i < a.length; i++) { 18 | list.add(a[i].toString()); 19 | } 20 | 21 | return list; 22 | } 23 | 24 | } 25 | -------------------------------------------------------------------------------- /src/com/macys/valuesobjects/ReleaseCupVo.java: -------------------------------------------------------------------------------- 1 | package com.macys.valuesobjects; 2 | 3 | import java.util.List; 4 | 5 | public class ReleaseCupVo extends BaseDTO { 6 | 7 | public ReleaseVo release; 8 | 9 | public LabVo lab; 10 | 11 | public String availableDevDays; 12 | 13 | public String devDays; 14 | 15 | public String regressionDays; 16 | 17 | public List sysComponents; 18 | 19 | public String matrix; 20 | 21 | public String lastClicked; 22 | 23 | public String ipmTree; 24 | } 25 | -------------------------------------------------------------------------------- /src/com/macys/utils/ServiceUtils.java: -------------------------------------------------------------------------------- 1 | package com.macys.utils; 2 | 3 | import org.apache.commons.lang3.StringUtils; 4 | 5 | import com.macys.exceptions.ErrorCodeEnum; 6 | import com.macys.exceptions.ServiceException; 7 | 8 | public class ServiceUtils { 9 | 10 | public static void verifyNotBlank(String value, String fieldName) throws ServiceException { 11 | 12 | if(StringUtils.isBlank(value)) { 13 | throw new ServiceException(fieldName + " must not be blank", ErrorCodeEnum.BLANK_FIELD); 14 | } 15 | 16 | } 17 | 18 | 19 | 20 | } -------------------------------------------------------------------------------- /.settings/org.eclipse.wst.common.component: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /src/com/macys/domain/business/common/annotations/PersistentBusinessObject.java: -------------------------------------------------------------------------------- 1 | package com.macys.domain.business.common.annotations; 2 | 3 | import java.lang.annotation.ElementType; 4 | import java.lang.annotation.Retention; 5 | import java.lang.annotation.RetentionPolicy; 6 | import java.lang.annotation.Target; 7 | 8 | import com.macys.domain.business.common.BusinessObjectTypeEnum; 9 | 10 | @Retention(RetentionPolicy.RUNTIME) 11 | @Target(ElementType.TYPE) 12 | public @interface PersistentBusinessObject { 13 | 14 | BusinessObjectTypeEnum type(); 15 | 16 | } -------------------------------------------------------------------------------- /.settings/.jsdtscope: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /src/com/macys/valuesobjects/IPMTreeVo.java: -------------------------------------------------------------------------------- 1 | package com.macys.valuesobjects; 2 | 3 | import java.util.HashMap; 4 | import java.util.Map; 5 | 6 | import flexjson.JSON; 7 | 8 | public class IPMTreeVo { 9 | 10 | Map ipms = null; 11 | 12 | public IPMTreeVo() { 13 | ipms = new HashMap(); 14 | ipms.put("IPM1", null); 15 | ipms.put("IPM2", null); 16 | ipms.put("IPM3", null); 17 | ipms.put("IPM4", null); 18 | } 19 | 20 | @JSON(include=true) 21 | public Map getIpms() { 22 | return ipms; 23 | } 24 | 25 | } 26 | -------------------------------------------------------------------------------- /src/com/macys/valuesobjects/MetaVo.java: -------------------------------------------------------------------------------- 1 | package com.macys.valuesobjects; 2 | 3 | import org.codehaus.jackson.annotate.JsonProperty; 4 | import org.codehaus.jackson.map.annotate.JsonSerialize; 5 | import org.codehaus.jackson.map.annotate.JsonSerialize.Inclusion; 6 | 7 | public class MetaVo { 8 | 9 | @JsonProperty("code") 10 | public int code; 11 | 12 | @JsonProperty("error") 13 | @JsonSerialize(include=Inclusion.NON_NULL) 14 | public String error; 15 | 16 | @JsonProperty("details") 17 | @JsonSerialize(include=Inclusion.NON_NULL) 18 | public String details; 19 | } 20 | -------------------------------------------------------------------------------- /src/com/macys/valuesobjects/BaseDTO.java: -------------------------------------------------------------------------------- 1 | package com.macys.valuesobjects; 2 | 3 | import org.apache.commons.lang3.builder.ReflectionToStringBuilder; 4 | import org.apache.commons.lang3.builder.ToStringStyle; 5 | 6 | public abstract class BaseDTO { 7 | 8 | public String uuid; 9 | 10 | public String type; 11 | 12 | public String name; 13 | 14 | public String createdOnISO8601; 15 | 16 | public String createdBy; 17 | 18 | @Override 19 | public String toString() { 20 | return ReflectionToStringBuilder.toString(this, ToStringStyle.SHORT_PREFIX_STYLE); 21 | } 22 | 23 | } 24 | -------------------------------------------------------------------------------- /src/log4j.properties: -------------------------------------------------------------------------------- 1 | # Root logger option 2 | log4j.rootLogger=ERROR, file 3 | 4 | # Direct log messages to a log file 5 | log4j.appender.file=org.apache.log4j.RollingFileAppender 6 | 7 | 8 | #log4j.appender.file.File=/var/lib/openshift/5497788a5973ca3ce20000e0/jbossews/logs/rolling.log 9 | log4j.appender.file.File=/Users/umairabbasi/Tools/apache-tomcat-8.0.11/webapps/quoteshare/logs/rolling.log 10 | log4j.appender.file.MaxFileSize=10MB 11 | log4j.appender.file.MaxBackupIndex=10 12 | log4j.appender.file.layout=org.apache.log4j.PatternLayout 13 | log4j.appender.file.layout.ConversionPattern=%d{yyyy-MM-dd HH\:mm\:ss} %-5p %c{1}\:%L - %m%n -------------------------------------------------------------------------------- /src/application.properties: -------------------------------------------------------------------------------- 1 | #MACYS DB Properties 2 | #db.driver=com.mysql.jdbc.Driver 3 | #db.url=jdbc:mysql://172.17.0.44:3306/objectdb 4 | #db.username=root 5 | #db.password=4OjhqNvNNBbMNYia 6 | 7 | #Local DB Properties 8 | db.driver=com.mysql.jdbc.Driver 9 | db.url=jdbc:mysql://localhost:3306/objectdb 10 | db.username=root 11 | db.password=root 12 | 13 | #Cloud DB Properties 14 | #db.driver=com.mysql.jdbc.Driver 15 | #db.url=jdbc:mysql://127.13.32.130:3306/objectdb 16 | #db.username=admina2USMU1 17 | #db.password=fKI_jZJBuhzB 18 | 19 | swagger.base.path=https://jbossews-abbasikov.rhcloud.com/fillthecupserver 20 | 21 | -------------------------------------------------------------------------------- /src/com/macys/exceptions/ServiceException.java: -------------------------------------------------------------------------------- 1 | package com.macys.exceptions; 2 | 3 | public class ServiceException extends Exception{ 4 | 5 | private static final long serialVersionUID = 1L; 6 | 7 | private ErrorCodeEnum errorCodeEnum; 8 | 9 | public ServiceException(String message, ErrorCodeEnum code) { 10 | super(message); 11 | this.errorCodeEnum = code; 12 | } 13 | 14 | public ServiceException(String message, Throwable cause,ErrorCodeEnum code) { 15 | super(message, cause); 16 | this.errorCodeEnum = code; 17 | } 18 | 19 | public ErrorCodeEnum getErrorCodeEnum(){ 20 | return errorCodeEnum; 21 | } 22 | 23 | } 24 | -------------------------------------------------------------------------------- /src/com/macys/utils/EncryptionUtils.java: -------------------------------------------------------------------------------- 1 | package com.macys.utils; 2 | 3 | import org.jasypt.util.password.*; 4 | 5 | public class EncryptionUtils { 6 | 7 | 8 | public static String encryptPassword(String plainPassword){ 9 | StrongPasswordEncryptor passwordEncryptor = new StrongPasswordEncryptor(); 10 | return passwordEncryptor.encryptPassword(plainPassword); 11 | } 12 | 13 | public static Boolean checkPassword(String plainPassword, String encryptedPassword){ 14 | StrongPasswordEncryptor passwordEncryptor = new StrongPasswordEncryptor(); 15 | return passwordEncryptor.checkPassword(plainPassword, encryptedPassword); 16 | } 17 | 18 | } 19 | -------------------------------------------------------------------------------- /src/com/macys/valuesobjects/containers/LabContainerVo.java: -------------------------------------------------------------------------------- 1 | package com.macys.valuesobjects.containers; 2 | 3 | import java.util.List; 4 | 5 | import org.codehaus.jackson.annotate.JsonProperty; 6 | import org.codehaus.jackson.map.annotate.JsonSerialize; 7 | import org.codehaus.jackson.map.annotate.JsonSerialize.Inclusion; 8 | 9 | import com.macys.valuesobjects.LabVo; 10 | 11 | public class LabContainerVo extends BaseContainerVo{ 12 | 13 | @JsonProperty("data") 14 | @JsonSerialize(include=Inclusion.NON_NULL) 15 | public LabVo data; 16 | 17 | @JsonProperty("dataList") 18 | @JsonSerialize(include=Inclusion.NON_NULL) 19 | public List dataList; 20 | } 21 | -------------------------------------------------------------------------------- /src/com/macys/valuesobjects/containers/ReleaseContainerVo.java: -------------------------------------------------------------------------------- 1 | package com.macys.valuesobjects.containers; 2 | 3 | import java.util.List; 4 | import org.codehaus.jackson.annotate.JsonProperty; 5 | import org.codehaus.jackson.map.annotate.JsonSerialize; 6 | import org.codehaus.jackson.map.annotate.JsonSerialize.Inclusion; 7 | import com.macys.valuesobjects.ReleaseVo; 8 | 9 | public class ReleaseContainerVo extends BaseContainerVo{ 10 | 11 | @JsonProperty("data") 12 | @JsonSerialize(include=Inclusion.NON_NULL) 13 | public ReleaseVo data; 14 | 15 | @JsonProperty("dataList") 16 | @JsonSerialize(include=Inclusion.NON_NULL) 17 | public List dataList; 18 | 19 | } 20 | -------------------------------------------------------------------------------- /src/com/macys/valuesobjects/containers/ReleaseCupContainerVo.java: -------------------------------------------------------------------------------- 1 | package com.macys.valuesobjects.containers; 2 | 3 | import java.util.List; 4 | 5 | import org.codehaus.jackson.annotate.JsonProperty; 6 | import org.codehaus.jackson.map.annotate.JsonSerialize; 7 | import org.codehaus.jackson.map.annotate.JsonSerialize.Inclusion; 8 | import com.macys.valuesobjects.ReleaseCupVo; 9 | 10 | public class ReleaseCupContainerVo extends BaseContainerVo{ 11 | 12 | @JsonProperty("data") 13 | @JsonSerialize(include=Inclusion.NON_NULL) 14 | public ReleaseCupVo data; 15 | 16 | @JsonProperty("dataList") 17 | @JsonSerialize(include=Inclusion.NON_NULL) 18 | public List dataList; 19 | } 20 | -------------------------------------------------------------------------------- /src/com/macys/valuesobjects/containers/SystemComponentContainerVo.java: -------------------------------------------------------------------------------- 1 | package com.macys.valuesobjects.containers; 2 | 3 | import java.util.List; 4 | import org.codehaus.jackson.annotate.JsonProperty; 5 | import org.codehaus.jackson.map.annotate.JsonSerialize; 6 | import org.codehaus.jackson.map.annotate.JsonSerialize.Inclusion; 7 | import com.macys.valuesobjects.SystemComponentVo; 8 | 9 | public class SystemComponentContainerVo extends BaseContainerVo{ 10 | 11 | @JsonProperty("data") 12 | @JsonSerialize(include=Inclusion.NON_NULL) 13 | public SystemComponentVo data; 14 | 15 | @JsonProperty("dataList") 16 | @JsonSerialize(include=Inclusion.NON_NULL) 17 | public List dataList; 18 | } 19 | -------------------------------------------------------------------------------- /src/com/macys/rest/filters/UserAuthenticator.java: -------------------------------------------------------------------------------- 1 | package com.macys.rest.filters; 2 | 3 | 4 | public final class UserAuthenticator { 5 | 6 | // public EmployeeSessionService employeeSessionService; 7 | 8 | // public EmployeeSession isSessionIdValid( String sessionId ) throws GeneralSecurityException { 9 | // try{ 10 | // return employeeSessionService.fetchSessionById(sessionId); 11 | // } 12 | // catch(ServiceException exc){ 13 | // throw new GeneralSecurityException(exc.getMessage(),exc); 14 | // } 15 | // } 16 | 17 | // public void setEmployeeSessionService( 18 | // EmployeeSessionService employeeSessionService) { 19 | // this.employeeSessionService = employeeSessionService; 20 | // } 21 | // 22 | } 23 | -------------------------------------------------------------------------------- /WebRoot/apidocs/lib/jquery.wiggle.min.js: -------------------------------------------------------------------------------- 1 | /* 2 | jQuery Wiggle 3 | Author: WonderGroup, Jordan Thomas 4 | URL: http://labs.wondergroup.com/demos/mini-ui/index.html 5 | License: MIT (http://en.wikipedia.org/wiki/MIT_License) 6 | */ 7 | jQuery.fn.wiggle=function(o){var d={speed:50,wiggles:3,travel:5,callback:null};var o=jQuery.extend(d,o);return this.each(function(){var cache=this;var wrap=jQuery(this).wrap('
').css("position","relative");var calls=0;for(i=1;i<=o.wiggles;i++){jQuery(this).animate({left:"-="+o.travel},o.speed).animate({left:"+="+o.travel*2},o.speed*2).animate({left:"-="+o.travel},o.speed,function(){calls++;if(jQuery(cache).parent().hasClass('wiggle-wrap')){jQuery(cache).parent().replaceWith(cache);} 8 | if(calls==o.wiggles&&jQuery.isFunction(o.callback)){o.callback();}});}});}; -------------------------------------------------------------------------------- /src/com/macys/exceptions/GeneralExceptionMapper.java: -------------------------------------------------------------------------------- 1 | package com.macys.exceptions; 2 | 3 | import javax.ws.rs.ClientErrorException; 4 | import javax.ws.rs.core.Response; 5 | import javax.ws.rs.ext.ExceptionMapper; 6 | 7 | public class GeneralExceptionMapper implements ExceptionMapper{ 8 | 9 | @Override 10 | public Response toResponse(ClientErrorException exception) { 11 | String jsonString = "{meta:{"+ 12 | "code:"+ErrorCodeEnum.INVALID_REQUEST.getCode()+","+ 13 | "error:"+ErrorCodeEnum.INVALID_REQUEST.getMessage()+","+ 14 | "details:"+exception.getMessage()+ 15 | "}"+ 16 | "}"; 17 | 18 | Response response = Response.status(Response.Status.BAD_REQUEST) .entity(jsonString) .build(); 19 | return response; 20 | } 21 | 22 | } 23 | -------------------------------------------------------------------------------- /src/com/macys/domain/Lab.java: -------------------------------------------------------------------------------- 1 | package com.macys.domain; 2 | 3 | import com.macys.domain.business.BusinessObject; 4 | 5 | public interface Lab extends BusinessObject{ 6 | 7 | public abstract void setLocation(String location); 8 | 9 | public abstract String getLocation(); 10 | 11 | public abstract void setDescription(String description); 12 | 13 | public abstract String getDescription(); 14 | 15 | public abstract void setPdmName(String pdmName); 16 | 17 | public abstract String getPdmName(); 18 | 19 | public abstract void setManagerName(String managerName); 20 | 21 | public abstract String getManagerName(); 22 | 23 | public abstract void setLastClicked(String lastClicked); 24 | 25 | public abstract String getLastClicked(); 26 | 27 | public abstract void setIsActivated(String isActivated); 28 | 29 | public abstract String getIsActivated(); 30 | 31 | } 32 | -------------------------------------------------------------------------------- /src/com/macys/dao/repository/DBObjectRepository.java: -------------------------------------------------------------------------------- 1 | package com.macys.dao.repository; 2 | 3 | import java.util.List; 4 | 5 | import javax.transaction.Transactional; 6 | 7 | import org.springframework.data.jpa.repository.Query; 8 | import org.springframework.data.repository.CrudRepository; 9 | import org.springframework.stereotype.Repository; 10 | 11 | import com.macys.dao.database.DBObject; 12 | 13 | @Repository 14 | @Transactional 15 | public interface DBObjectRepository extends CrudRepository { 16 | 17 | DBObject findByUuid(String uuid); 18 | 19 | List findByTypeAndName(String type, String name); 20 | 21 | @Query("select u from DBObject u where u.uuid = ?1") 22 | DBObject findUsingPK(String uuid); 23 | 24 | @Query("select u from DBObject u where u.uuid in ?1") 25 | List findUsingUuids(List uuids); 26 | 27 | 28 | } 29 | -------------------------------------------------------------------------------- /src/com/macys/domain/business/common/RelationshipTypeEnum.java: -------------------------------------------------------------------------------- 1 | package com.macys.domain.business.common; 2 | 3 | public enum RelationshipTypeEnum { 4 | 5 | LAB_USER("Lab_User",0), 6 | LAB_SYSTEMCOMPONENT("Lab_SystemComponent",1), 7 | RELEASECUP_IPM("RELEASECUP_IPM",2), 8 | USER_ROLE("USER_ROLE",3); 9 | 10 | String relationshipName; 11 | int code; 12 | 13 | RelationshipTypeEnum(String relationshipName, int code) { 14 | this.relationshipName = relationshipName; 15 | this.code = code; 16 | } 17 | 18 | public String getRelationshipName() { 19 | return relationshipName; 20 | } 21 | 22 | public static RelationshipTypeEnum enumFromName(String name) { 23 | 24 | for(RelationshipTypeEnum enum1:RelationshipTypeEnum.values()) { 25 | if(enum1.relationshipName.equals(name)) { 26 | return enum1; 27 | } 28 | } 29 | 30 | return null; 31 | } 32 | 33 | } 34 | -------------------------------------------------------------------------------- /src/com/macys/utils/PropertiesUtils.java: -------------------------------------------------------------------------------- 1 | package com.macys.utils; 2 | 3 | import java.io.IOException; 4 | import java.io.InputStream; 5 | import java.util.Properties; 6 | 7 | public class PropertiesUtils { 8 | 9 | 10 | private Properties props; 11 | private static PropertiesUtils instance = new PropertiesUtils(); 12 | 13 | 14 | private PropertiesUtils(){ 15 | InputStream is = null; 16 | try { 17 | props = new Properties(); 18 | is = this.getClass().getResourceAsStream("/application.properties"); 19 | props.load(is); 20 | System.err.println("===Properties File loaded==="); 21 | System.out.println(props); 22 | 23 | } catch (IOException e) { 24 | e.printStackTrace(); 25 | } 26 | 27 | 28 | } 29 | 30 | public static PropertiesUtils getInstance(){ 31 | return instance; 32 | } 33 | 34 | public String getProperty(String key){ 35 | return props.getProperty(key); 36 | } 37 | 38 | } 39 | -------------------------------------------------------------------------------- /.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /WebRoot/index.jsp: -------------------------------------------------------------------------------- 1 | <%@ page language="java" import="java.util.*" pageEncoding="US-ASCII"%> 2 | <% 3 | String path = request.getContextPath(); 4 | String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/"; 5 | %> 6 | 7 | 8 | 9 | 10 | 11 | 12 | My JSP 'index.jsp' starting page 13 | 14 | 15 | 16 | 17 | 18 | 21 | 22 | 23 | 24 | This is my JSP page.
25 | 26 | 27 | -------------------------------------------------------------------------------- /src/com/macys/utils/JsonUtils.java: -------------------------------------------------------------------------------- 1 | package com.macys.utils; 2 | 3 | import java.util.HashMap; 4 | import java.util.Map; 5 | import com.google.gson.Gson; 6 | import flexjson.JSONDeserializer; 7 | import flexjson.JSONSerializer; 8 | 9 | public class JsonUtils { 10 | 11 | public static String toJson(Object object) { 12 | String json = new JSONSerializer().serialize(object); 13 | return json; 14 | } 15 | 16 | public static Map mapFromJson(String json) { 17 | Map jsonMap = new JSONDeserializer>().use(null, new HashMap().getClass()).deserialize(json); 18 | return jsonMap; 19 | } 20 | 21 | public static T fromJson(String jsonString, Class clazz) { 22 | try{ 23 | Gson gson = new Gson(); 24 | T object = gson.fromJson(jsonString, clazz); 25 | return object; 26 | } 27 | catch(Exception exc){ 28 | exc.printStackTrace(System.err); 29 | return null; 30 | } 31 | 32 | } 33 | 34 | } -------------------------------------------------------------------------------- /src/com/macys/domain/Release.java: -------------------------------------------------------------------------------- 1 | package com.macys.domain; 2 | 3 | import com.macys.domain.business.BusinessObject; 4 | 5 | public interface Release extends BusinessObject { 6 | 7 | public abstract void setBcomDate(String bcomDate); 8 | 9 | public abstract String getBcomDate(); 10 | 11 | public abstract void setMcomDate(String mcomDate); 12 | 13 | public abstract String getMcomDate(); 14 | 15 | public abstract void setBranchHardLockDate(String branchHardLockDate); 16 | 17 | public abstract String getBranchHardLockDate(); 18 | 19 | public abstract void setBranchCutDate(String branchCutDate); 20 | 21 | public abstract String getBranchCutDate(); 22 | 23 | public abstract void setBranchProductionDate(String branchProductionDate); 24 | 25 | public abstract String getBranchProductionDate(); 26 | 27 | public abstract void setBranchFreezeDate(String branchFreezeDate); 28 | 29 | public abstract String getBranchFreezeDate(); 30 | 31 | public abstract void setIsActivated(String isActivated); 32 | 33 | public abstract String getIsActivated(); 34 | 35 | } 36 | -------------------------------------------------------------------------------- /WebRoot/WEB-INF/web.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | fillthecupserver 4 | 5 | contextConfigLocation 6 | classpath:applicationContext.xml 7 | 8 | 9 | org.springframework.web.context.ContextLoaderListener 10 | 11 | 12 | CXFServlet 13 | org.apache.cxf.transport.servlet.CXFServlet 14 | 1 15 | 16 | 17 | CXFServlet 18 | /rest/* 19 | 20 | 21 | index.jsp 22 | 23 | -------------------------------------------------------------------------------- /src/com/macys/domain/business/BusinessObject.java: -------------------------------------------------------------------------------- 1 | package com.macys.domain.business; 2 | 3 | import java.util.Date; 4 | 5 | import com.macys.dao.database.DBObject; 6 | import com.macys.valuesobjects.BaseDTO; 7 | 8 | public interface BusinessObject { 9 | 10 | public abstract DBObject getDbObject(); 11 | 12 | public abstract void setStatusModifiedOn(Date statusModifiedOn); 13 | 14 | public abstract Date getStatusModifiedOn(); 15 | 16 | public abstract void setStatus(Short status); 17 | 18 | public abstract Short getStatus(); 19 | 20 | public abstract Date getModifiedOn(); 21 | 22 | public abstract void setModifiedBy(String modifiedBy); 23 | 24 | public abstract String getModifiedBy(); 25 | 26 | public abstract Date getCreatedOn(); 27 | 28 | public abstract void setCreatedBy(String createdBy); 29 | 30 | public abstract String getCreatedBy(); 31 | 32 | public abstract void setName(String name); 33 | 34 | public abstract String getName(); 35 | 36 | public abstract Integer getVersion(); 37 | 38 | public abstract String getUuid(); 39 | 40 | public abstract String getType(); 41 | 42 | public abstract Integer getCounter(); 43 | 44 | public abstract BaseDTO createDTO(); 45 | 46 | } 47 | -------------------------------------------------------------------------------- /src/com/macys/domain/User.java: -------------------------------------------------------------------------------- 1 | package com.macys.domain; 2 | 3 | import com.macys.domain.business.BusinessObject; 4 | 5 | public interface User extends BusinessObject{ 6 | 7 | public abstract void setIsSuperAdmin(String isSuperAdmin); 8 | 9 | public abstract String getIsSuperAdmin(); 10 | 11 | public abstract void setPassword(String password); 12 | 13 | public abstract String getPassword(); 14 | 15 | public abstract void setUserName(String userName); 16 | 17 | public abstract String getUserName(); 18 | 19 | public abstract void setUserEmail(String userEmail); 20 | 21 | public abstract String getUserEmail(); 22 | 23 | public abstract void setLastName(String lastName); 24 | 25 | public abstract String getLastName(); 26 | 27 | public abstract void setFirstName(String firstName); 28 | 29 | public abstract String getFirstName(); 30 | 31 | public abstract void setIsLabUser(String isLabUser); 32 | 33 | public abstract String getIsLabUser(); 34 | 35 | public abstract void setIsLabManager(String isLabManager); 36 | 37 | public abstract String getIsLabManager(); 38 | 39 | public abstract void setIsPasswordReset(String isPasswordReset); 40 | 41 | public abstract String getIsPasswordReset(); 42 | 43 | } 44 | -------------------------------------------------------------------------------- /src/com/macys/rest/filters/UserAuthResponseFilter.java: -------------------------------------------------------------------------------- 1 | package com.macys.rest.filters; 2 | 3 | import java.io.IOException; 4 | 5 | import javax.ws.rs.container.ContainerRequestContext; 6 | import javax.ws.rs.container.ContainerResponseContext; 7 | import javax.ws.rs.container.ContainerResponseFilter; 8 | 9 | import org.apache.log4j.Logger; 10 | 11 | 12 | public class UserAuthResponseFilter implements ContainerResponseFilter { 13 | 14 | private final static Logger log = Logger.getLogger( UserAuthResponseFilter.class.getName() ); 15 | 16 | @Override 17 | public void filter( ContainerRequestContext requestCtx, ContainerResponseContext responseCtx ) throws IOException { 18 | 19 | log.info( "Filtering REST Response" ); 20 | 21 | ///responseCtx.getHeaders().add( "Access-Control-Allow-Origin", "*" ); // You may further limit certain client IPs with Access-Control-Allow-Origin instead of '*' 22 | responseCtx.getHeaders().add( "Access-Control-Allow-Credentials", "true" ); 23 | responseCtx.getHeaders().add( "Access-Control-Allow-Methods", "GET, POST, DELETE, PUT" ); 24 | //responseCtx.getHeaders().add( "Access-Control-Allow-Headers", HttpHeaderNames.SESSION_ID); 25 | } 26 | 27 | 28 | } 29 | -------------------------------------------------------------------------------- /src/com/macys/domain/ReleaseCup.java: -------------------------------------------------------------------------------- 1 | package com.macys.domain; 2 | 3 | import com.macys.domain.business.BusinessObject; 4 | 5 | public interface ReleaseCup extends BusinessObject{ 6 | 7 | public abstract void setRegressionDays(String regressionDays); 8 | 9 | public abstract String getRegressionDays(); 10 | 11 | public abstract void setDevDays(String devDays); 12 | 13 | public abstract String getDevDays(); 14 | 15 | public abstract void setAvailableDevDays(String availableDevDays); 16 | 17 | public abstract String getAvailableDevDays(); 18 | 19 | public abstract void setLabUuid(String labUuid); 20 | 21 | public abstract String getLabUuid(); 22 | 23 | public abstract void setReleaseUuid(String releaseUuid); 24 | 25 | public abstract String getReleaseUuid(); 26 | 27 | public abstract void setSysComponents(String sysComponents); 28 | 29 | public abstract String getSysComponents(); 30 | 31 | public abstract void setMatrixJson(String matrixJson); 32 | 33 | public abstract String getMatrixJson(); 34 | 35 | public abstract void setLastClicked(String lastClicked); 36 | 37 | public abstract String getLastClicked(); 38 | 39 | public abstract void setIpmTree(String ipmTree); 40 | 41 | public abstract String getIpmTree(); 42 | 43 | } 44 | -------------------------------------------------------------------------------- /src/com/macys/dao/repository/DBObjectMetadataRepository.java: -------------------------------------------------------------------------------- 1 | package com.macys.dao.repository; 2 | 3 | import java.util.List; 4 | 5 | import javax.transaction.Transactional; 6 | 7 | import org.springframework.data.jpa.repository.Modifying; 8 | import org.springframework.data.jpa.repository.Query; 9 | import org.springframework.data.repository.CrudRepository; 10 | import org.springframework.stereotype.Repository; 11 | 12 | import com.macys.dao.database.DBObjectMetadata; 13 | import com.macys.dao.database.pk.DBObjectMetadataPK; 14 | 15 | @Repository 16 | @Transactional 17 | public interface DBObjectMetadataRepository extends CrudRepository { 18 | 19 | DBObjectMetadata findByPK(DBObjectMetadataPK pk); 20 | 21 | @Query(name="findByNameAndValue", value="from DBObjectMetadata o where o.pk.name=?1 and o.value=?2") 22 | List findByNameAndValue(String name, String value); 23 | 24 | @Query(name="findMetadatasByUuid", value="from DBObjectMetadata o where o.pk.uuid=?1") 25 | List findMetadatasByUuid(String uuid); 26 | 27 | @Modifying 28 | @Query(name="deleteMetadatasByUuid", value="delete DBObjectMetadata o where o.pk.uuid=?1") 29 | void deleteMetadatasByUuid(String uuid); 30 | 31 | } 32 | -------------------------------------------------------------------------------- /src/com/macys/valuesobjects/UserVo.java: -------------------------------------------------------------------------------- 1 | package com.macys.valuesobjects; 2 | 3 | import java.util.List; 4 | 5 | import org.codehaus.jackson.annotate.JsonProperty; 6 | import org.codehaus.jackson.map.annotate.JsonSerialize; 7 | import org.codehaus.jackson.map.annotate.JsonSerialize.Inclusion; 8 | 9 | public class UserVo extends BaseDTO{ 10 | 11 | @JsonSerialize(include=Inclusion.NON_NULL) 12 | @JsonProperty("firstName") 13 | public String firstName; 14 | 15 | @JsonSerialize(include=Inclusion.NON_NULL) 16 | @JsonProperty("lastName") 17 | public String lastName; 18 | 19 | @JsonSerialize(include=Inclusion.NON_NULL) 20 | @JsonProperty("userEmail") 21 | public String userEmail; 22 | 23 | @JsonSerialize(include=Inclusion.NON_NULL) 24 | @JsonProperty("username") 25 | public String username; 26 | 27 | @JsonProperty("isSuperAdmin") 28 | @JsonSerialize(include=Inclusion.NON_NULL) 29 | public String isSuperAdmin; 30 | 31 | @JsonProperty("isLabManager") 32 | @JsonSerialize(include=Inclusion.NON_NULL) 33 | public String isLabManager; 34 | 35 | @JsonProperty("isLabUser") 36 | @JsonSerialize(include=Inclusion.NON_NULL) 37 | public String isLabUser; 38 | 39 | @JsonProperty("isPasswordReset") 40 | @JsonSerialize(include=Inclusion.NON_NULL) 41 | public String isPasswordReset; 42 | 43 | @JsonProperty("labs") 44 | @JsonSerialize(include=Inclusion.NON_NULL) 45 | public List labs; 46 | 47 | } 48 | -------------------------------------------------------------------------------- /src/com/macys/domain/business/common/Relationship.java: -------------------------------------------------------------------------------- 1 | package com.macys.domain.business.common; 2 | 3 | 4 | import org.springframework.util.ObjectUtils; 5 | 6 | import com.macys.dao.database.DBObjectRelationship; 7 | import com.macys.dao.database.pk.DBObjectRelationshipPK; 8 | 9 | public class Relationship { 10 | 11 | private DBObjectRelationship relationship; 12 | 13 | public Relationship(String parentUuid, String childUuid, String type, String createdBy) { 14 | this.relationship = new DBObjectRelationship(new DBObjectRelationshipPK(parentUuid, childUuid, type), createdBy); 15 | } 16 | 17 | public Relationship(DBObjectRelationship relationship) { 18 | this.relationship = relationship; 19 | } 20 | 21 | @Override 22 | public boolean equals(Object obj) { 23 | if(obj instanceof Relationship) { 24 | Relationship that = (Relationship) obj; 25 | return ObjectUtils.nullSafeEquals(this.relationship, that.relationship); 26 | } 27 | return super.equals(obj); 28 | } 29 | 30 | @Override 31 | public int hashCode() { 32 | return ObjectUtils.nullSafeHashCode(this.relationship); 33 | } 34 | 35 | public String getParentUuid() { 36 | return this.relationship.getPk().getPUuid(); 37 | } 38 | 39 | public String getChildUuid() { 40 | return this.relationship.getPk().getCUuid(); 41 | } 42 | 43 | public String getType() { 44 | return this.relationship.getPk().getRelationshipType(); 45 | } 46 | 47 | 48 | } 49 | -------------------------------------------------------------------------------- /src/com/macys/services/BaseService.java: -------------------------------------------------------------------------------- 1 | package com.macys.services; 2 | 3 | import org.apache.commons.lang3.StringUtils; 4 | 5 | import com.macys.dao.DAO; 6 | import com.macys.domain.business.BusinessObject; 7 | import com.macys.exceptions.ErrorCodeEnum; 8 | import com.macys.exceptions.ServiceException; 9 | import com.macys.utils.ServiceUtils; 10 | 11 | public class BaseService { 12 | 13 | protected DAO dao; 14 | 15 | public BusinessObject updateBusinessObject(String uuid, String names, String values,String delimiter) throws ServiceException { 16 | try{ 17 | ServiceUtils.verifyNotBlank(uuid, "uuid"); 18 | ServiceUtils.verifyNotBlank(names, "names"); 19 | ServiceUtils.verifyNotBlank(values, "values"); 20 | 21 | if(StringUtils.isBlank(delimiter)){ 22 | delimiter = ";"; 23 | } 24 | 25 | String[] namesArray = names.split(delimiter); 26 | String[] valuesArray= values.split(delimiter); 27 | 28 | BusinessObject businessObject = dao.updatedBusinessObjectByMetadata(uuid, namesArray, valuesArray); 29 | if(businessObject == null) 30 | throw new ServiceException("Business object not found", ErrorCodeEnum.BUSINESS_OBJECT_NOT_FOUND); 31 | 32 | return businessObject; 33 | 34 | } 35 | catch(ServiceException exc){ 36 | throw exc; 37 | } 38 | catch (Exception e) { 39 | throw new ServiceException(e.getMessage(), e, ErrorCodeEnum.INTERNAL_SERVER_ERROR); 40 | } 41 | } 42 | 43 | public void setDao(DAO dao) { 44 | this.dao = dao; 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /src/com/macys/valuesobjects/MatrixVo.java: -------------------------------------------------------------------------------- 1 | package com.macys.valuesobjects; 2 | 3 | import java.util.ArrayList; 4 | import java.util.List; 5 | 6 | import com.macys.domain.business.common.BusinessObjectTypeEnum; 7 | import com.macys.utils.AppUtils; 8 | 9 | import flexjson.JSON; 10 | 11 | public class MatrixVo { 12 | 13 | public final int INITIAL_ROWS = 6; 14 | 15 | public MatrixVo() { 16 | this.columns = new ArrayList(); 17 | this.data = new ArrayList(); 18 | for(int i=0;i columns; 28 | private List data;; 29 | 30 | public void updateColums(List uColums){ 31 | this.columns.addAll(uColums); 32 | } 33 | 34 | @JSON(include=true) 35 | public List getData(){ 36 | return data; 37 | } 38 | 39 | @JSON(include=true) 40 | public List getColumns(){ 41 | return columns; 42 | } 43 | 44 | public class MatrixRow { 45 | 46 | } 47 | 48 | public class MatrixCol{ 49 | public String name; 50 | } 51 | } 52 | 53 | 54 | -------------------------------------------------------------------------------- /src/com/macys/dao/repository/DBObjectRelationshipRepository.java: -------------------------------------------------------------------------------- 1 | package com.macys.dao.repository; 2 | 3 | import java.util.List; 4 | 5 | import javax.transaction.Transactional; 6 | 7 | import org.springframework.data.jpa.repository.Modifying; 8 | import org.springframework.data.jpa.repository.Query; 9 | import org.springframework.data.repository.CrudRepository; 10 | import org.springframework.stereotype.Repository; 11 | 12 | import com.macys.dao.database.DBObjectRelationship; 13 | import com.macys.dao.database.pk.DBObjectRelationshipPK; 14 | 15 | @Repository 16 | @Transactional 17 | public interface DBObjectRelationshipRepository extends CrudRepository { 18 | 19 | DBObjectRelationship findByPK(DBObjectRelationshipPK pk); 20 | 21 | @Query("select u from DBObjectRelationship u where u.pk.pUuid = ?1") 22 | List findChildren(String parentUuid); 23 | 24 | @Query("select u from DBObjectRelationship u where u.pk.cUuid = ?1 and u.pk.relationshipType = ?2") 25 | List findRelationshipByChildUuidAndType(String childUuid,String type); 26 | 27 | 28 | @Query("select u from DBObjectRelationship u where u.pk.pUuid = ?1 and u.pk.relationshipType = ?2") 29 | List findChildrenWithRelationshipType(String parentUuid, String relationshipType); 30 | 31 | @Modifying 32 | @Query(name="deleteRelationshipByChildUuid", value="delete DBObjectRelationship u where u.pk.cUuid = ?1 and u.pk.relationshipType = ?2") 33 | void deleteRelationshipByChildUuid(String childUuid,String relationshipType); 34 | 35 | } 36 | -------------------------------------------------------------------------------- /src/com/macys/exceptions/ErrorCodeEnum.java: -------------------------------------------------------------------------------- 1 | package com.macys.exceptions; 2 | 3 | 4 | public enum ErrorCodeEnum { 5 | 6 | EMAIL_ALREADY_EXISTS (1000,"EMAIL_ALREADY_EXISTS"), 7 | BLANK_FIELD (1001,"BLANK_FIELD"), 8 | USER_NOT_FOUND (1002,"USER_NOT_FOUND"), 9 | INVALID_CREDENTIALS (1003,"INVALID_CREDENTIALS"), 10 | INTERNAL_SERVER_ERROR (1004,"INTERNAL_SERVER_ERROR"), 11 | INVALID_BUSINESS_OBJECT_TYPE(1005,"INVALID_BUSINESS_OBJECT_TYPE"), 12 | MISSING_ANNOTATION (1006,"MISSING_ANNOTATION"), 13 | INVALID_REQUEST (1007,"INVALID_REQUEST"), 14 | LENGTH_NOT_EQUAL (1008,"LENGTH_NOT_EQUAL"), 15 | BUSINESS_OBJECT_NOT_FOUND (1009,"BUSINESS_OBJECT_NOT_FOUND"), 16 | INVALID_PATH_KEY (1010,"INVALID_PATH_KEY"), 17 | SAME_FILES_NAME (1011,"SAME_FILES_NAME"), 18 | INVALID_MESSAGE_STATUS (1012,"INVALID_MESSAGE_STATUS"), 19 | INVALID_MESSAGE_TYPE (1013,"INVALID_MESSAGE_TYPE"), 20 | INVALID_BUSINESS_OBJECT_ID (1014, "INVALID_BUSINESS_OBJECT_ID"), 21 | USERNAME_ALREADY_EXISTS (1015, "USERNAME_ALREADY_EXISTS"), 22 | LABNAME_ALREADY_EXISTS (1016, "LABNAME_ALREADY_EXISTS"), 23 | RELEASE_NOT_FOUND (1017, "RELEASE_NOT_FOUND"), 24 | LAB_NOT_FOUND (1017, "LAB_NOT_FOUND"), 25 | RELEASE_CUP_NOT_FOUND (1017, "RELEASE_CUP_NOT_FOUND"); 26 | 27 | 28 | private Integer code; 29 | private String message; 30 | 31 | private ErrorCodeEnum(Integer code,String codeMsg) { 32 | this.code = code; 33 | this.message = codeMsg; 34 | } 35 | 36 | public Integer getCode() { 37 | return code; 38 | } 39 | 40 | public String getMessage() { 41 | return message; 42 | } 43 | 44 | 45 | 46 | } 47 | -------------------------------------------------------------------------------- /.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | fillthecupserver 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.wst.jsdt.core.javascriptValidator 10 | 11 | 12 | 13 | 14 | org.eclipse.jdt.core.javabuilder 15 | 16 | 17 | 18 | 19 | org.eclipse.wst.common.project.facet.core.builder 20 | 21 | 22 | 23 | 24 | org.eclipse.wst.validation.validationbuilder 25 | 26 | 27 | 28 | 29 | com.genuitec.eclipse.j2eedt.core.DeploymentDescriptorValidator 30 | 31 | 32 | 33 | 34 | org.eclipse.m2e.core.maven2Builder 35 | 36 | 37 | 38 | 39 | com.genuitec.eclipse.ast.deploy.core.DeploymentBuilder 40 | 41 | 42 | 43 | 44 | 45 | org.eclipse.m2e.core.maven2Nature 46 | org.eclipse.jem.workbench.JavaEMFNature 47 | org.eclipse.wst.common.modulecore.ModuleCoreNature 48 | org.eclipse.wst.common.project.facet.core.nature 49 | org.eclipse.jdt.core.javanature 50 | org.eclipse.wst.jsdt.core.jsNature 51 | 52 | 53 | -------------------------------------------------------------------------------- /WebRoot/apidocs/css/reset.css: -------------------------------------------------------------------------------- 1 | /* http://meyerweb.com/eric/tools/css/reset/ v2.0 | 20110126 */ 2 | html, 3 | body, 4 | div, 5 | span, 6 | applet, 7 | object, 8 | iframe, 9 | h1, 10 | h2, 11 | h3, 12 | h4, 13 | h5, 14 | h6, 15 | p, 16 | blockquote, 17 | pre, 18 | a, 19 | abbr, 20 | acronym, 21 | address, 22 | big, 23 | cite, 24 | code, 25 | del, 26 | dfn, 27 | em, 28 | img, 29 | ins, 30 | kbd, 31 | q, 32 | s, 33 | samp, 34 | small, 35 | strike, 36 | strong, 37 | sub, 38 | sup, 39 | tt, 40 | var, 41 | b, 42 | u, 43 | i, 44 | center, 45 | dl, 46 | dt, 47 | dd, 48 | ol, 49 | ul, 50 | li, 51 | fieldset, 52 | form, 53 | label, 54 | legend, 55 | table, 56 | caption, 57 | tbody, 58 | tfoot, 59 | thead, 60 | tr, 61 | th, 62 | td, 63 | article, 64 | aside, 65 | canvas, 66 | details, 67 | embed, 68 | figure, 69 | figcaption, 70 | footer, 71 | header, 72 | hgroup, 73 | menu, 74 | nav, 75 | output, 76 | ruby, 77 | section, 78 | summary, 79 | time, 80 | mark, 81 | audio, 82 | video { 83 | margin: 0; 84 | padding: 0; 85 | border: 0; 86 | font-size: 100%; 87 | font: inherit; 88 | vertical-align: baseline; 89 | } 90 | /* HTML5 display-role reset for older browsers */ 91 | article, 92 | aside, 93 | details, 94 | figcaption, 95 | figure, 96 | footer, 97 | header, 98 | hgroup, 99 | menu, 100 | nav, 101 | section { 102 | display: block; 103 | } 104 | body { 105 | line-height: 1; 106 | } 107 | ol, 108 | ul { 109 | list-style: none; 110 | } 111 | blockquote, 112 | q { 113 | quotes: none; 114 | } 115 | blockquote:before, 116 | blockquote:after, 117 | q:before, 118 | q:after { 119 | content: ''; 120 | content: none; 121 | } 122 | table { 123 | border-collapse: collapse; 124 | border-spacing: 0; 125 | } 126 | -------------------------------------------------------------------------------- /src/com/macys/domain/impl/SystemComponentImpl.java: -------------------------------------------------------------------------------- 1 | package com.macys.domain.impl; 2 | 3 | import com.macys.dao.database.DBObject; 4 | import com.macys.domain.SystemComponent; 5 | import com.macys.domain.business.BusinessObjectImpl; 6 | import com.macys.domain.business.common.BusinessObjectTypeEnum; 7 | import com.macys.domain.business.common.annotations.PersistentBusinessObject; 8 | import com.macys.domain.business.common.annotations.PersistentMetadata; 9 | import com.macys.utils.AppUtils; 10 | import com.macys.valuesobjects.BaseDTO; 11 | import com.macys.valuesobjects.SystemComponentVo; 12 | 13 | @PersistentBusinessObject(type=BusinessObjectTypeEnum.SYSTEM_COMPONENT) 14 | public class SystemComponentImpl extends BusinessObjectImpl implements SystemComponent{ 15 | 16 | public SystemComponentImpl(DBObject dbObject) { 17 | super(dbObject); 18 | } 19 | 20 | @PersistentMetadata 21 | private String description; 22 | 23 | @PersistentMetadata 24 | private String displayName; 25 | 26 | @Override 27 | public String getDescription() { 28 | return description; 29 | } 30 | 31 | @Override 32 | public void setDescription(String description) { 33 | this.description = description; 34 | } 35 | 36 | @Override 37 | public String getDisplayName() { 38 | return displayName; 39 | } 40 | 41 | @Override 42 | public void setDisplayName(String displayName) { 43 | this.displayName = displayName; 44 | } 45 | 46 | @Override 47 | public BaseDTO createDTO() { 48 | SystemComponentVo vo = new SystemComponentVo(); 49 | vo.name = this.getName(); 50 | vo.type = this.getType(); 51 | vo.uuid = this.getUuid(); 52 | vo.createdOnISO8601 = AppUtils.getDateISO8601(this.getCreatedOn()); 53 | 54 | vo.description = this.getDescription(); 55 | vo.displayName = this.getName(); 56 | 57 | return vo; 58 | } 59 | 60 | 61 | } 62 | -------------------------------------------------------------------------------- /src/com/macys/dao/database/pk/DBObjectMetadataJsonPK.java: -------------------------------------------------------------------------------- 1 | package com.macys.dao.database.pk; 2 | import java.io.Serializable; 3 | 4 | import javax.persistence.Column; 5 | import javax.persistence.Embeddable; 6 | 7 | import org.apache.commons.lang3.builder.ToStringBuilder; 8 | import org.apache.commons.lang3.builder.ToStringStyle; 9 | import org.springframework.util.ObjectUtils; 10 | 11 | import flexjson.JSONSerializer; 12 | 13 | 14 | @Embeddable 15 | public final class DBObjectMetadataJsonPK implements Serializable { 16 | 17 | private static final long serialVersionUID = 1L; 18 | 19 | @Column(name = "uuid", nullable = false, length=32) 20 | private String uuid; 21 | 22 | @Column(name = "property_name", nullable = false, length = 255) 23 | private String property_name; 24 | 25 | public DBObjectMetadataJsonPK() { 26 | } 27 | 28 | public DBObjectMetadataJsonPK(String uuid, String propertyName) { 29 | super(); 30 | this.uuid = uuid; 31 | this.property_name = propertyName; 32 | } 33 | 34 | @Override 35 | public boolean equals(Object obj) { 36 | 37 | if(obj instanceof DBObjectMetadataJsonPK) { 38 | DBObjectMetadataJsonPK that = (DBObjectMetadataJsonPK) obj; 39 | return ObjectUtils.nullSafeEquals(this.uuid, that.uuid) && ObjectUtils.nullSafeEquals(this.property_name, that.property_name); 40 | } 41 | 42 | return super.equals(obj); 43 | } 44 | 45 | @Override 46 | public int hashCode() { 47 | return ObjectUtils.nullSafeHashCode(this.uuid) + ObjectUtils.nullSafeHashCode(this.property_name); 48 | } 49 | 50 | public String getUuid() { 51 | return uuid; 52 | } 53 | 54 | public String getProperty_name() { 55 | return property_name; 56 | } 57 | 58 | public String toString() { 59 | return ToStringBuilder.reflectionToString(this, ToStringStyle.SHORT_PREFIX_STYLE); 60 | } 61 | 62 | public String toJson() { 63 | return new JSONSerializer() 64 | .exclude("*.class").serialize(this); 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /src/com/macys/utils/AppUtils.java: -------------------------------------------------------------------------------- 1 | package com.macys.utils; 2 | 3 | import java.text.SimpleDateFormat; 4 | import java.util.Date; 5 | import java.util.TimeZone; 6 | import java.util.UUID; 7 | import java.util.regex.Matcher; 8 | import java.util.regex.Pattern; 9 | import org.apache.commons.lang3.math.NumberUtils; 10 | 11 | public class AppUtils { 12 | 13 | public static final String SYSTEM_USER = "system"; 14 | 15 | public static String randomUuid() { 16 | String random = UUID.randomUUID().toString(); 17 | return random.substring(0, 13); 18 | } 19 | 20 | public static boolean isValidUSPhoneNumber(String number) { 21 | 22 | if(NumberUtils.isDigits(number)) { 23 | if(number.length() == 10) { 24 | return true; 25 | } 26 | } 27 | 28 | return false; 29 | 30 | } 31 | 32 | public static boolean isPhoneValid(String phoneNumber) { 33 | String expression = "^\\(\\d{3}\\)\\d{3}-\\d{4}$"; 34 | CharSequence inputStr = phoneNumber; 35 | Pattern pattern = Pattern.compile(expression); 36 | Matcher matcher = pattern.matcher(inputStr); 37 | if(matcher.matches()){ 38 | return true; 39 | } 40 | 41 | return false; 42 | } 43 | 44 | public static String getCreateOnByTimeZone(Date createdOn, String timezone, String dateFormat){ 45 | try{ 46 | TimeZone tz = TimeZone.getTimeZone(timezone); 47 | SimpleDateFormat sdf = new SimpleDateFormat(dateFormat); 48 | sdf.setTimeZone(tz); 49 | return sdf.format(createdOn); 50 | } 51 | catch(Exception exc){ 52 | return createdOn.toString(); 53 | } 54 | 55 | } 56 | 57 | public static String getDateISO8601(Date date){ 58 | 59 | try{ 60 | SimpleDateFormat sdf = new SimpleDateFormat(Constants.DATE_FORMAT_ISO8601); 61 | return sdf.format(date); 62 | } 63 | catch(Exception exc){ 64 | return date.toString(); 65 | } 66 | 67 | } 68 | 69 | 70 | 71 | public static String getRandomResetPassword() { 72 | return UUID.randomUUID().toString().substring(0,8); 73 | } 74 | 75 | 76 | } 77 | -------------------------------------------------------------------------------- /src/com/macys/rest/filters/UserAuthRequestFilter.java: -------------------------------------------------------------------------------- 1 | package com.macys.rest.filters; 2 | 3 | import java.io.IOException; 4 | 5 | import javax.servlet.http.HttpServletRequest; 6 | import javax.ws.rs.container.ContainerRequestContext; 7 | import javax.ws.rs.container.ContainerRequestFilter; 8 | import javax.ws.rs.core.Context; 9 | 10 | import org.apache.log4j.Logger; 11 | 12 | public class UserAuthRequestFilter implements ContainerRequestFilter { 13 | 14 | final static Logger log = Logger.getLogger(UserAuthRequestFilter.class); 15 | 16 | //private UserAuthenticator userAuthenticator; 17 | 18 | @Context 19 | private transient HttpServletRequest servletRequest; 20 | 21 | @Override 22 | public void filter( ContainerRequestContext requestCtx ) throws IOException { 23 | 24 | String path = requestCtx.getUriInfo().getPath(); 25 | log.info( "Filtering request path: " + path ); 26 | 27 | 28 | 29 | // For any other methods besides login and register, the session_id must be verified 30 | // if ( !path.contains( "login" ) && !path.contains( "register" ) && !path.contains( "logout" )) { 31 | // String sessionId = requestCtx.getHeaderString( HttpHeaderNames.SESSION_ID ); 32 | // 33 | // try{ 34 | //// EmployeeSession session = userAuthenticator.isSessionIdValid(sessionId); 35 | //// if(session==null || session.isExpired == true) 36 | //// requestCtx.abortWith( Response.status( Response.Status.UNAUTHORIZED ).build() ); 37 | //// else 38 | //// servletRequest.setAttribute(HttpHeaderNames.EMPLOYEE_SESSION_OBJECT, session); 39 | // 40 | // } 41 | // catch(Exception exc){ 42 | // exc.printStackTrace(System.out); 43 | // requestCtx.abortWith( Response.status( Response.Status.UNAUTHORIZED ).build() ); 44 | // } 45 | // 46 | // } 47 | } 48 | 49 | // public void setServletRequest(HttpServletRequest servletRequest) { 50 | // this.servletRequest = servletRequest; 51 | // } 52 | // 53 | // public void setUserAuthenticator(UserAuthenticator userAuthenticator) { 54 | // this.userAuthenticator = userAuthenticator; 55 | // } 56 | // 57 | 58 | } 59 | 60 | 61 | -------------------------------------------------------------------------------- /src/com/main/HibernateTest.java: -------------------------------------------------------------------------------- 1 | package com.main; 2 | 3 | 4 | public class HibernateTest { 5 | 6 | public static void main(String[] args) { 7 | try{ 8 | 9 | // UserDAO userDao = new UserDAO(); 10 | // //FeedDAO feedDao = new FeedDAO(); 11 | // //FeedService feedService = new FeedService(); 12 | // //System.out.println(feedService.getFeeds(0, 5)); 13 | // 14 | // //ChannelDAO channelDao = new ChannelDAO(); 15 | // //Channel channel = channelDao.findById(1); 16 | // 17 | // Channel channel = new Channel(); 18 | // channel.channelId = 1; 19 | // 20 | // 21 | // System.out.println("##Begin Transaction##"); 22 | // User user = new User(); 23 | // user.userId = UUID.randomUUID().toString(); 24 | // user.firstName = "New"; 25 | // user.lastName = "Abbasi"; 26 | // user.screenName = "Terry"; 27 | // user.email = "terry@gmail.com"; 28 | // user.password = EncryptionUtils.encryptPassword("P@ssw0rd"); 29 | // user.address = "35995 Fremont Blvd, Apt130, Fremont CA"; 30 | // user.phone = "510-304-7410"; 31 | // user.channels = new HashSet(); 32 | // user.channels.add(channel); 33 | // userDao.save(user); 34 | // 35 | // //Feed feed1 = new Feed(); 36 | // //feed1.feedId = UUID.randomUUID().toString(); 37 | // //feed1.user = new User("cdabcaec-c326-47a0-8830-baa62850a9ab"); 38 | // //feed1.text = "Mistakes are a part of being human. Appreciate your mistakes for what they are: precious life lessons that can only be learned the hard way. Unless it's a fatal mistake, which, at least, others can learn from"; 39 | // //feed1.language = "en"; 40 | // 41 | // //Feed feed2 = new Feed(); 42 | // //feed2.feedId = UUID.randomUUID().toString(); 43 | // //feed2.user = new User("cdabcaec-c326-47a0-8830-baa62850a9ab"); 44 | // //feed2.text = "Do not fear mistakes. You will know failure. Continue to reach out"; 45 | // //feed2.language = "en"; 46 | // 47 | // //feedDao.save(feed1); 48 | // 49 | // //feedDao.save(feed2); 50 | // 51 | // System.out.println("##Commit Transaction##"); 52 | 53 | //String pwd = EncryptionUtils.encryptPassword("P@ssw0rd"); 54 | //System.out.println(pwd); 55 | 56 | //System.out.println(EncryptionUtils.checkPassword("P@ssw0rd", pwd)); 57 | 58 | } 59 | catch(Exception exc){ 60 | exc.printStackTrace(System.err); 61 | 62 | } 63 | 64 | 65 | } 66 | 67 | } 68 | -------------------------------------------------------------------------------- /src/com/macys/dao/database/pk/DBObjectACLPK.java: -------------------------------------------------------------------------------- 1 | package com.macys.dao.database.pk; 2 | 3 | import java.io.Serializable; 4 | import java.util.Collection; 5 | import java.util.List; 6 | import javax.persistence.Column; 7 | import org.springframework.util.ObjectUtils; 8 | import flexjson.JSONDeserializer; 9 | import flexjson.JSONSerializer; 10 | 11 | public final class DBObjectACLPK implements Serializable { 12 | 13 | private static final long serialVersionUID = 1L; 14 | 15 | @Column(name = "principal_uuid", nullable = false, length=32) 16 | private String principalUuid; 17 | 18 | @Column(name = "uuid", nullable = false, length=32) 19 | private String uuid; 20 | 21 | public DBObjectACLPK() { 22 | } 23 | 24 | public DBObjectACLPK(String principalUuid, String uuid) { 25 | super(); 26 | this.principalUuid = principalUuid; 27 | this.uuid = uuid; 28 | } 29 | 30 | @Override 31 | public boolean equals(Object obj) { 32 | 33 | if(obj instanceof DBObjectACLPK) { 34 | DBObjectACLPK that = (DBObjectACLPK) obj; 35 | return ObjectUtils.nullSafeEquals(this.principalUuid, that.principalUuid) && ObjectUtils.nullSafeEquals(this.uuid, that.uuid); 36 | } 37 | 38 | return super.equals(obj); 39 | } 40 | 41 | @Override 42 | public int hashCode() { 43 | return ObjectUtils.nullSafeHashCode(this.principalUuid) + ObjectUtils.nullSafeHashCode(this.uuid); 44 | 45 | } 46 | 47 | public String getPrincipalUuid() { 48 | return principalUuid; 49 | } 50 | 51 | public String getUuid() { 52 | return uuid; 53 | } 54 | 55 | public String toJson() { 56 | return new JSONSerializer().exclude("*.class").serialize(this); 57 | } 58 | 59 | public String toJson(String[] fields) { 60 | return new JSONSerializer().include(fields).exclude("*.class") 61 | .serialize(this); 62 | } 63 | 64 | public static DBObjectACLPK fromJsonToDbobjectAclPK(String json) { 65 | return new JSONDeserializer().use(null, 66 | DBObjectACLPK.class).deserialize(json); 67 | } 68 | 69 | public static String toJsonArray(Collection collection) { 70 | return new JSONSerializer().exclude("*.class").serialize(collection); 71 | } 72 | 73 | public static String toJsonArray(Collection collection, 74 | String[] fields) { 75 | return new JSONSerializer().include(fields).exclude("*.class") 76 | .serialize(collection); 77 | } 78 | 79 | public static Collection fromJsonArrayToDbobjectAclPKs( 80 | String json) { 81 | return new JSONDeserializer>().use("values", 82 | DBObjectACLPK.class).deserialize(json); 83 | } 84 | } 85 | -------------------------------------------------------------------------------- /src/com/macys/dao/DAO.java: -------------------------------------------------------------------------------- 1 | package com.macys.dao; 2 | 3 | import java.util.List; 4 | 5 | import com.macys.domain.business.BusinessObject; 6 | import com.macys.domain.business.common.BusinessObjectTypeEnum; 7 | import com.macys.domain.business.common.Relationship; 8 | import com.macys.domain.business.common.RelationshipTypeEnum; 9 | import com.macys.exceptions.ServiceException; 10 | 11 | public interface DAO { 12 | 13 | public BusinessObject emptyBusinessObject(BusinessObjectTypeEnum type, String name, String createdBy) throws ServiceException; 14 | 15 | public BusinessObject getBusinessObjectByUuid(String uuid) throws ServiceException; 16 | 17 | public List getBusinessObjectByUuids(String[] uuids); 18 | 19 | public BusinessObject saveBusinessObject(BusinessObject businessObject) throws ServiceException; 20 | 21 | public List findByTypeAndNameLite(BusinessObjectTypeEnum type, String name) throws ServiceException; 22 | 23 | public BusinessObject findByTypeAndNameLiteSingle(BusinessObjectTypeEnum type, String name) throws ServiceException; 24 | 25 | public Relationship saveRelationship(String parentUuid, String childUuid, String type, String createdBy); 26 | 27 | public List findUuidsByMetadata(BusinessObjectTypeEnum type, String name, String value); 28 | 29 | public List findChildren(String parentUuid); 30 | 31 | public List findRelationshipByChildUuidAndType(String childUuid, String type); 32 | 33 | public BusinessObject findBusinessObjectByMetadata(BusinessObjectTypeEnum type,String metadataName, String metadataValue) throws ServiceException; 34 | 35 | public List findBusinessObjectsByMetadata(BusinessObjectTypeEnum type,String metadataName, String metadataValue) throws ServiceException; 36 | 37 | public List findChildrenWithRelationshipType(String parentUuid,RelationshipTypeEnum relationshipTypeEnum); 38 | 39 | public List findChildBusinessObjects(String parentUuid, BusinessObjectTypeEnum[] objectTypeEnums)throws ServiceException; 40 | 41 | public List getBusinessObjectByName(BusinessObjectTypeEnum type, String nameValue) throws ServiceException; 42 | 43 | public void deleteBusinessObjectByUuid(String uuid) throws ServiceException; 44 | 45 | public BusinessObject updatedBusinessObjectByMetadata(String uuid, String[] names, String[] values) throws ServiceException; 46 | 47 | public List findBusinessObjectsByType(BusinessObjectTypeEnum type) throws ServiceException; 48 | 49 | public void deleteRelationShip(String pUuid, String cUuid, RelationshipTypeEnum relationshipType) throws ServiceException; 50 | 51 | public void deleteRelationShipByChildUuid(String cUuid, RelationshipTypeEnum relationshipType) throws ServiceException; 52 | } 53 | -------------------------------------------------------------------------------- /src/com/macys/dao/database/pk/DBObjectContentStorePK.java: -------------------------------------------------------------------------------- 1 | package com.macys.dao.database.pk; 2 | import java.io.Serializable; 3 | import java.util.Collection; 4 | import java.util.List; 5 | 6 | import javax.persistence.Column; 7 | 8 | import org.springframework.util.ObjectUtils; 9 | 10 | import flexjson.JSONDeserializer; 11 | import flexjson.JSONSerializer; 12 | 13 | //@Configurable 14 | //@Embeddable 15 | public final class DBObjectContentStorePK implements Serializable { 16 | 17 | private static final long serialVersionUID = 1L; 18 | 19 | @Column(name = "uuid", nullable = false, length=32) 20 | private String uuid; 21 | 22 | @Column(name = "content_type", nullable = false, length=32) 23 | private String contentType; 24 | 25 | public DBObjectContentStorePK() { 26 | } 27 | 28 | public DBObjectContentStorePK(String uuid, String contentType) { 29 | super(); 30 | this.uuid = uuid; 31 | this.contentType = contentType; 32 | } 33 | 34 | @Override 35 | public boolean equals(Object obj) { 36 | if(obj instanceof DBObjectContentStorePK) { 37 | DBObjectContentStorePK that = (DBObjectContentStorePK) obj; 38 | return ObjectUtils.nullSafeEquals(this.uuid, that.uuid) && ObjectUtils.nullSafeEquals(this.contentType, that.contentType); 39 | } 40 | return super.equals(obj); 41 | } 42 | 43 | @Override 44 | public int hashCode() { 45 | return ObjectUtils.nullSafeHashCode(this.uuid); 46 | } 47 | 48 | public String getUuid() { 49 | return uuid; 50 | } 51 | 52 | public String getContentType() { 53 | return contentType; 54 | } 55 | 56 | public String toJson() { 57 | return new JSONSerializer() 58 | .exclude("*.class").serialize(this); 59 | } 60 | 61 | public String toJson(String[] fields) { 62 | return new JSONSerializer() 63 | .include(fields).exclude("*.class").serialize(this); 64 | } 65 | 66 | public static DBObjectContentStorePK fromJsonToDbobjectContentStorePK(String json) { 67 | return new JSONDeserializer() 68 | .use(null, DBObjectContentStorePK.class).deserialize(json); 69 | } 70 | 71 | public static String toJsonArray(Collection collection) { 72 | return new JSONSerializer() 73 | .exclude("*.class").serialize(collection); 74 | } 75 | 76 | public static String toJsonArray(Collection collection, String[] fields) { 77 | return new JSONSerializer() 78 | .include(fields).exclude("*.class").serialize(collection); 79 | } 80 | 81 | public static Collection fromJsonArrayToDbobjectContentStorePKs(String json) { 82 | return new JSONDeserializer>() 83 | .use("values", DBObjectContentStorePK.class).deserialize(json); 84 | } 85 | } 86 | -------------------------------------------------------------------------------- /src/com/macys/domain/business/common/BusinessObjectTypeEnum.java: -------------------------------------------------------------------------------- 1 | package com.macys.domain.business.common; 2 | 3 | import java.util.ArrayList; 4 | import java.util.List; 5 | 6 | import com.macys.utils.AppUtils; 7 | 8 | public enum BusinessObjectTypeEnum { 9 | 10 | USER("USER1","User"), 11 | LAB("LLAB1","LLab"), 12 | SYSTEM_COMPONENT("SYSCO","SystemComponent"), 13 | RELEASE("RELSE","Release"), 14 | RELEASECUP("RELCP","ReleaseCup"), 15 | IPM("IPMVO","IPM"); 16 | 17 | String type; 18 | String interfaceName; 19 | 20 | BusinessObjectTypeEnum(String type, String interfaceName) { 21 | this.type = type; 22 | this.interfaceName = interfaceName; 23 | 24 | if(type.length() > 5) { 25 | throw new IllegalArgumentException("invalid type size:" + type); 26 | } 27 | } 28 | 29 | public String getType() { 30 | return type; 31 | } 32 | 33 | public String getInterfaceName() { 34 | return interfaceName; 35 | } 36 | 37 | public String toString() { 38 | return type; 39 | } 40 | 41 | public String newRandomUuid() { 42 | String uuid = new StringBuilder(type).append("-").append(AppUtils.randomUuid().toUpperCase()).toString(); 43 | return uuid; 44 | } 45 | 46 | public static BusinessObjectTypeEnum enumFromType(String typeName) { 47 | 48 | for(BusinessObjectTypeEnum en:BusinessObjectTypeEnum.values()) { 49 | if(en.getType().equals(typeName)) { 50 | return en; 51 | } 52 | } 53 | 54 | return null; 55 | } 56 | 57 | public static BusinessObjectTypeEnum enumFromUuid(String uuid) { 58 | 59 | if(uuid == null) { 60 | return null; 61 | } 62 | 63 | for(BusinessObjectTypeEnum en:BusinessObjectTypeEnum.values()) { 64 | if(uuid.startsWith(en.getType())) { 65 | return en; 66 | } 67 | } 68 | 69 | return null; 70 | } 71 | 72 | public static BusinessObjectTypeEnum[] enumsFromNames(List names) { 73 | 74 | if(names == null || names.size() == 0) { 75 | return null; 76 | } 77 | 78 | List types = new ArrayList(names.size()); 79 | 80 | for(String name : names) { 81 | BusinessObjectTypeEnum enum1 = enumFromString(name); 82 | 83 | if(enum1 != null) { 84 | types.add(enum1); 85 | } 86 | } 87 | 88 | return types.toArray(new BusinessObjectTypeEnum[]{}); 89 | } 90 | 91 | public static BusinessObjectTypeEnum enumFromString(String name) { 92 | for(BusinessObjectTypeEnum enum1:BusinessObjectTypeEnum.values()) { 93 | if(enum1.type.equals(name)) { 94 | return enum1; 95 | } 96 | } 97 | 98 | return null; 99 | } 100 | 101 | public static List listOfStrings(BusinessObjectTypeEnum[] enums) { 102 | 103 | //return OTUtils.asListOfStrings(enums); 104 | return null; 105 | 106 | } 107 | 108 | 109 | } 110 | -------------------------------------------------------------------------------- /src/com/macys/dao/database/DBObjectRelationshipMetadata.java: -------------------------------------------------------------------------------- 1 | package com.macys.dao.database; 2 | 3 | import java.util.Date; 4 | 5 | import javax.persistence.Column; 6 | import javax.persistence.EmbeddedId; 7 | import javax.persistence.Entity; 8 | import javax.persistence.Table; 9 | import javax.persistence.Temporal; 10 | import javax.persistence.TemporalType; 11 | import javax.validation.constraints.NotNull; 12 | 13 | import org.apache.commons.lang3.builder.ReflectionToStringBuilder; 14 | import org.apache.commons.lang3.builder.ToStringStyle; 15 | import org.springframework.util.ObjectUtils; 16 | 17 | import com.macys.dao.database.pk.DBObjectRelationshipMetadataPK; 18 | 19 | @Entity 20 | @Table(name = "dbobject_relationship_metadata") 21 | public class DBObjectRelationshipMetadata extends DBAbstractBase { 22 | 23 | private static final long serialVersionUID = 1L; 24 | 25 | // @Column(name="id", unique=true, insertable=false, updatable=false) 26 | // private Integer counter; 27 | 28 | @EmbeddedId 29 | private DBObjectRelationshipMetadataPK pk; 30 | 31 | @Column(name = "value") 32 | private String value; 33 | 34 | @Column(name = "created_by", length=32) 35 | @NotNull 36 | private String createdBy; 37 | 38 | @Column(name = "created_on_") 39 | @NotNull 40 | @Temporal(TemporalType.TIMESTAMP) 41 | private Date createdOn; 42 | 43 | public DBObjectRelationshipMetadata() { 44 | this(null); 45 | this.createdOn = new Date(); 46 | } 47 | 48 | public DBObjectRelationshipMetadata(DBObjectRelationshipMetadataPK id) { 49 | this.pk = id; 50 | this.createdOn = new Date(); 51 | } 52 | 53 | @Override 54 | public boolean equals(Object obj) { 55 | 56 | if (obj instanceof DBObjectRelationshipMetadata) { 57 | DBObjectRelationshipMetadata that = (DBObjectRelationshipMetadata) obj; 58 | 59 | return ObjectUtils.nullSafeEquals(this.pk, that.pk); 60 | } 61 | 62 | return super.equals(obj); 63 | } 64 | 65 | @Override 66 | public int hashCode() { 67 | return ObjectUtils.nullSafeHashCode(this.pk); 68 | } 69 | 70 | public DBObjectRelationshipMetadataPK getPk() { 71 | return pk; 72 | } 73 | 74 | public void setPk(DBObjectRelationshipMetadataPK pk) { 75 | this.pk = pk; 76 | } 77 | 78 | public String getValue() { 79 | return value; 80 | } 81 | 82 | public void setValue(String value) { 83 | this.value = value; 84 | } 85 | 86 | public String getCreatedBy() { 87 | return createdBy; 88 | } 89 | 90 | public void setCreatedBy(String createdBy) { 91 | this.createdBy = createdBy; 92 | } 93 | 94 | public Date getCreatedOn() { 95 | return createdOn; 96 | } 97 | 98 | public void setCreatedOn(Date createdOn) { 99 | this.createdOn = createdOn; 100 | } 101 | 102 | public String toString() { 103 | return ReflectionToStringBuilder.toString(this, 104 | ToStringStyle.SHORT_PREFIX_STYLE); 105 | } 106 | 107 | } -------------------------------------------------------------------------------- /src/com/main/Test.java: -------------------------------------------------------------------------------- 1 | package com.main; 2 | 3 | import java.text.SimpleDateFormat; 4 | import java.util.Date; 5 | import java.util.HashMap; 6 | import java.util.List; 7 | import java.util.Map; 8 | import java.util.UUID; 9 | 10 | import org.apache.commons.lang3.StringUtils; 11 | 12 | import com.macys.utils.JsonUtils; 13 | import com.macys.valuesobjects.MatrixVo; 14 | 15 | public class Test { 16 | 17 | private int i; 18 | 19 | public static void main(String[] args) { 20 | 21 | String path = "null"; 22 | 23 | if(StringUtils.isBlank(path)) 24 | System.out.println("Path is Blank"); 25 | else 26 | System.out.println("Path is not Blank"); 27 | 28 | //long time = 1426550971000L; 29 | 30 | Date date = new Date(); 31 | 32 | System.err.println(date); 33 | 34 | //System.out.println("ENum: "+(MessageStatusEnum.enumFromName("RdEAD") == null)); 35 | 36 | // TimeZone tz = TimeZone.getTimeZone("Asia/Dubai"); 37 | // 38 | // SimpleDateFormat sdf = new SimpleDateFormat(); 39 | // 40 | // sdf.setTimeZone(tz); 41 | // 42 | // System.err.println(sdf.format(date)); 43 | 44 | String iso8601 = "yyyy-MM-dd'T'HH:mm:ss.SSZZ"; 45 | SimpleDateFormat sdf1 = new SimpleDateFormat(iso8601); 46 | //sdf1.setTimeZone(TimeZone.getTimeZone("GMT")); 47 | System.out.println(sdf1.format(date)); 48 | //cUaugEsXTYojW/7YZxN/LrH6c6Vy7uA3hYjfwk/qvyxP8p1AI0Mu9pVo/ZqyhCDx 49 | 50 | //System.out.println(AppUtils.getCreateOnByTimeZone(date, Constants.TIME_ZONE_DUBAI)); 51 | //String json = "[{\"areaType\":\"Offices\",\"description\":\"Front Door\",\"serviceTypes\":[{\"name\":\"Facade Cleaning\",\"serviceAreas\":[{\"name\":\"Car Parking Canopy\",\"length\":\"12\",\"width\":\"12\",\"quantity\":\"\",\"cleaningItems\":[]}]}]}]"; 52 | 53 | // SurveyEntryVo[] vo = JsonUtils.fromJson(json, SurveyEntryVo[].class); 54 | // int h = 9; 55 | //System.out.println(EncryptionUtils.encryptPassword("a")); 56 | String random = UUID.randomUUID().toString(); 57 | 58 | System.out.println(random.substring(0,8)); 59 | MatrixVo mat = new MatrixVo(); 60 | //mat.settings = new SettingVo(); 61 | Map map = new HashMap(); 62 | String s = "{ \"SmartPrompt\" : [{\"Controller\": \"3\",\"QE\":\"3\", \"SDP\":\"5\"} , {\"Controller\": \"3\",\"QE\":\"3\", \"SDP\":\"5\"}] }"; 63 | Map m =JsonUtils.mapFromJson(s); 64 | List fff = (List)m.get("SmartPrompt"); 65 | Map hh = (Map)fff.get(0); 66 | System.out.println(hh); 67 | } 68 | 69 | @Override 70 | public int hashCode() { 71 | final int prime = 31; 72 | int result = 1; 73 | result = prime * result + i; 74 | return result; 75 | } 76 | 77 | @Override 78 | public boolean equals(Object obj) { 79 | if (this == obj) 80 | return true; 81 | if (obj == null) 82 | return false; 83 | if (getClass() != obj.getClass()) 84 | return false; 85 | Test other = (Test) obj; 86 | if (i != other.i) 87 | return false; 88 | return true; 89 | } 90 | 91 | } 92 | -------------------------------------------------------------------------------- /src/com/macys/dao/database/pk/DBObjectMetadataPK.java: -------------------------------------------------------------------------------- 1 | package com.macys.dao.database.pk; 2 | import java.io.Serializable; 3 | import java.util.Collection; 4 | import java.util.List; 5 | 6 | import javax.persistence.Column; 7 | import javax.persistence.Embeddable; 8 | 9 | import org.apache.commons.lang3.builder.ToStringBuilder; 10 | import org.apache.commons.lang3.builder.ToStringStyle; 11 | import org.springframework.util.ObjectUtils; 12 | 13 | import flexjson.JSONDeserializer; 14 | import flexjson.JSONSerializer; 15 | 16 | 17 | @Embeddable 18 | public final class DBObjectMetadataPK implements Serializable { 19 | 20 | private static final long serialVersionUID = 1L; 21 | 22 | @Column(name = "uuid", nullable = false, length=32) 23 | private String uuid; 24 | 25 | @Column(name = "name", nullable = false, length = 255) 26 | private String name; 27 | 28 | public DBObjectMetadataPK() { 29 | } 30 | 31 | public DBObjectMetadataPK(String uuid, String name) { 32 | super(); 33 | this.uuid = uuid; 34 | this.name = name; 35 | } 36 | 37 | @Override 38 | public boolean equals(Object obj) { 39 | 40 | if(obj instanceof DBObjectMetadataPK) { 41 | DBObjectMetadataPK that = (DBObjectMetadataPK) obj; 42 | return ObjectUtils.nullSafeEquals(this.uuid, that.uuid) && ObjectUtils.nullSafeEquals(this.name, that.name); 43 | } 44 | 45 | return super.equals(obj); 46 | } 47 | 48 | @Override 49 | public int hashCode() { 50 | return ObjectUtils.nullSafeHashCode(this.uuid) + ObjectUtils.nullSafeHashCode(this.name); 51 | } 52 | 53 | public String getUuid() { 54 | return uuid; 55 | } 56 | 57 | public String getName() { 58 | return name; 59 | } 60 | 61 | public String toString() { 62 | return ToStringBuilder.reflectionToString(this, ToStringStyle.SHORT_PREFIX_STYLE); 63 | } 64 | 65 | public String toJson() { 66 | return new JSONSerializer() 67 | .exclude("*.class").serialize(this); 68 | } 69 | 70 | public String toJson(String[] fields) { 71 | return new JSONSerializer() 72 | .include(fields).exclude("*.class").serialize(this); 73 | } 74 | 75 | public static DBObjectMetadataPK fromJsonToDbobjectMetadataPK(String json) { 76 | return new JSONDeserializer() 77 | .use(null, DBObjectMetadataPK.class).deserialize(json); 78 | } 79 | 80 | public static String toJsonArray(Collection collection) { 81 | return new JSONSerializer() 82 | .exclude("*.class").serialize(collection); 83 | } 84 | 85 | public static String toJsonArray(Collection collection, String[] fields) { 86 | return new JSONSerializer() 87 | .include(fields).exclude("*.class").serialize(collection); 88 | } 89 | 90 | public static Collection fromJsonArrayToDbobjectMetadataPKs(String json) { 91 | return new JSONDeserializer>() 92 | .use("values", DBObjectMetadataPK.class).deserialize(json); 93 | } 94 | } 95 | -------------------------------------------------------------------------------- /src/com/macys/dao/database/pk/DBQueuePK.java: -------------------------------------------------------------------------------- 1 | package com.macys.dao.database.pk; 2 | 3 | import java.io.Serializable; 4 | import java.util.Collection; 5 | import java.util.List; 6 | 7 | import javax.persistence.Column; 8 | 9 | import org.apache.commons.lang3.builder.ReflectionToStringBuilder; 10 | import org.apache.commons.lang3.builder.ToStringStyle; 11 | import org.springframework.util.ObjectUtils; 12 | 13 | import flexjson.JSONDeserializer; 14 | import flexjson.JSONSerializer; 15 | 16 | //@Embeddable 17 | //@Configurable 18 | public final class DBQueuePK implements Serializable { 19 | 20 | private static final long serialVersionUID = 1L; 21 | 22 | @Column(name = "reference_uuid", nullable = false, length=32) 23 | private String referenceUuid; 24 | 25 | @Column(name = "state", nullable = false, length=32) 26 | private String state; 27 | 28 | public DBQueuePK() { 29 | } 30 | 31 | public DBQueuePK(String uuid, String state) { 32 | super(); 33 | this.referenceUuid = uuid; 34 | this.state = state; 35 | } 36 | 37 | @Override 38 | public boolean equals(Object obj) { 39 | 40 | if(obj instanceof DBQueuePK) { 41 | DBQueuePK that = (DBQueuePK) obj; 42 | return ObjectUtils.nullSafeEquals(this.referenceUuid, that.referenceUuid) && ObjectUtils.nullSafeEquals(this.state, that.state); 43 | } 44 | 45 | return super.equals(obj); 46 | } 47 | 48 | @Override 49 | public int hashCode() { 50 | return ObjectUtils.nullSafeHashCode(this.referenceUuid); 51 | 52 | } 53 | 54 | @Override 55 | public String toString() { 56 | return ReflectionToStringBuilder.toString(this, ToStringStyle.SHORT_PREFIX_STYLE); 57 | } 58 | 59 | public String getReferenceUuid() { 60 | return referenceUuid; 61 | } 62 | 63 | public void setReferenceUuid(String uuid) { 64 | this.referenceUuid = uuid; 65 | } 66 | 67 | public String getState() { 68 | return state; 69 | } 70 | 71 | public void setState(String state) { 72 | this.state = state; 73 | } 74 | 75 | public String toJson() { 76 | return new JSONSerializer().exclude("*.class").serialize(this); 77 | } 78 | 79 | public String toJson(String[] fields) { 80 | return new JSONSerializer().include(fields).exclude("*.class") 81 | .serialize(this); 82 | } 83 | 84 | public static DBQueuePK fromJsonToDbobjectAclPK(String json) { 85 | return new JSONDeserializer().use(null, 86 | DBQueuePK.class).deserialize(json); 87 | } 88 | 89 | public static String toJsonArray(Collection collection) { 90 | return new JSONSerializer().exclude("*.class").serialize(collection); 91 | } 92 | 93 | public static String toJsonArray(Collection collection, 94 | String[] fields) { 95 | return new JSONSerializer().include(fields).exclude("*.class") 96 | .serialize(collection); 97 | } 98 | 99 | public static Collection fromJsonArrayToDbobjectAclPKs( 100 | String json) { 101 | return new JSONDeserializer>().use("values", 102 | DBQueuePK.class).deserialize(json); 103 | } 104 | } 105 | -------------------------------------------------------------------------------- /src/com/macys/domain/impl/LabImpl.java: -------------------------------------------------------------------------------- 1 | package com.macys.domain.impl; 2 | 3 | import com.macys.dao.database.DBObject; 4 | import com.macys.domain.Lab; 5 | import com.macys.domain.business.BusinessObjectImpl; 6 | import com.macys.domain.business.common.BusinessObjectTypeEnum; 7 | import com.macys.domain.business.common.annotations.PersistentBusinessObject; 8 | import com.macys.domain.business.common.annotations.PersistentMetadata; 9 | import com.macys.utils.AppUtils; 10 | import com.macys.valuesobjects.BaseDTO; 11 | import com.macys.valuesobjects.LabVo; 12 | 13 | @PersistentBusinessObject(type=BusinessObjectTypeEnum.LAB) 14 | public class LabImpl extends BusinessObjectImpl implements Lab { 15 | 16 | public LabImpl(DBObject dbObject) { 17 | super(dbObject); 18 | // TODO Auto-generated constructor stub 19 | } 20 | 21 | @PersistentMetadata 22 | private String managerName; 23 | 24 | @PersistentMetadata 25 | private String pdmName; 26 | 27 | @PersistentMetadata 28 | private String description; 29 | 30 | @PersistentMetadata 31 | private String location; 32 | 33 | @PersistentMetadata 34 | private String lastClicked; 35 | 36 | @PersistentMetadata 37 | private String isActivated; 38 | 39 | @Override 40 | public String getDescription() { 41 | return description; 42 | } 43 | 44 | @Override 45 | public void setDescription(String description) { 46 | this.description = description; 47 | } 48 | 49 | @Override 50 | public String getLocation() { 51 | return location; 52 | } 53 | 54 | @Override 55 | public void setLocation(String location) { 56 | this.location = location; 57 | } 58 | 59 | @Override 60 | public String getManagerName() { 61 | return managerName; 62 | } 63 | 64 | @Override 65 | public void setManagerName(String managerName) { 66 | this.managerName = managerName; 67 | } 68 | 69 | @Override 70 | public String getPdmName() { 71 | return pdmName; 72 | } 73 | 74 | @Override 75 | public void setPdmName(String pdmName) { 76 | this.pdmName = pdmName; 77 | } 78 | 79 | @Override 80 | public String getLastClicked() { 81 | return lastClicked; 82 | } 83 | 84 | @Override 85 | public void setLastClicked(String lastClicked) { 86 | this.lastClicked = lastClicked; 87 | } 88 | 89 | @Override 90 | public String getIsActivated() { 91 | return isActivated; 92 | } 93 | 94 | @Override 95 | public void setIsActivated(String isActivated) { 96 | this.isActivated = isActivated; 97 | } 98 | 99 | @Override 100 | public BaseDTO createDTO(){ 101 | LabVo vo = new LabVo(); 102 | vo.name = this.getName(); 103 | vo.type = this.getType(); 104 | vo.uuid = this.getUuid(); 105 | vo.createdOnISO8601 = AppUtils.getDateISO8601(this.getCreatedOn()); 106 | vo.createdBy = this.getCreatedBy(); 107 | 108 | vo.description = this.getDescription(); 109 | vo.location = this.getLocation(); 110 | vo.pdmName = this.getPdmName(); 111 | vo.managerName = this.getManagerName(); 112 | vo.lastClicked = this.getLastClicked(); 113 | vo.isActivated = this.getIsActivated(); 114 | 115 | return vo; 116 | } 117 | 118 | 119 | 120 | } 121 | -------------------------------------------------------------------------------- /src/com/macys/dao/database/DBObjectACL.java: -------------------------------------------------------------------------------- 1 | package com.macys.dao.database; 2 | import java.util.Date; 3 | 4 | import javax.persistence.Column; 5 | import javax.persistence.EmbeddedId; 6 | import javax.persistence.Entity; 7 | import javax.persistence.NamedQuery; 8 | import javax.persistence.Table; 9 | import javax.persistence.Temporal; 10 | import javax.persistence.TemporalType; 11 | import javax.validation.constraints.NotNull; 12 | 13 | import org.apache.commons.lang3.builder.ReflectionToStringBuilder; 14 | import org.apache.commons.lang3.builder.ToStringStyle; 15 | import org.springframework.util.ObjectUtils; 16 | 17 | import com.macys.dao.database.pk.DBObjectACLPK; 18 | 19 | @Entity 20 | @Table(name = "dbobject_acl") 21 | @NamedQuery(name = "DBObjectACL.findByPK", query = "from DBObjectACL o where o.pk = ?1") 22 | public class DBObjectACL extends DBAbstractBase { 23 | 24 | private static final long serialVersionUID = 1L; 25 | 26 | // @Column(name="id", unique=true, insertable=false, updatable=false) 27 | // private Integer counter; 28 | 29 | @EmbeddedId 30 | private DBObjectACLPK pk; 31 | 32 | // @ManyToOne 33 | // @JoinColumn(name = "uuid", referencedColumnName = "uuid", nullable = false, insertable = false, updatable = false) 34 | // private DBObject object; 35 | 36 | @Column(name = "permission", length=32) 37 | @NotNull 38 | private String permission; 39 | 40 | @Column(name = "created_by", length=32) 41 | @NotNull 42 | private String createdBy; 43 | 44 | @Column(name = "created_on") 45 | @NotNull 46 | @Temporal(TemporalType.TIMESTAMP) 47 | private Date createdOn; 48 | 49 | public DBObjectACL() { 50 | this(null); 51 | this.createdOn = new Date(); 52 | } 53 | 54 | public DBObjectACL(DBObjectACLPK id) { 55 | this.pk = id; 56 | this.createdOn = new Date(); 57 | } 58 | 59 | @Override 60 | public boolean equals(Object obj) { 61 | 62 | if(obj instanceof DBObjectACL) { 63 | DBObjectACL that = (DBObjectACL) obj; 64 | return ObjectUtils.nullSafeEquals(this.pk, that.pk); 65 | } 66 | 67 | return super.equals(obj); 68 | } 69 | 70 | @Override 71 | public int hashCode() { 72 | return ObjectUtils.nullSafeHashCode(this.pk); 73 | } 74 | 75 | public DBObjectACLPK getPk() { 76 | return pk; 77 | } 78 | 79 | public void setPk(DBObjectACLPK pk) { 80 | this.pk = pk; 81 | } 82 | 83 | // public DBObject getObject() { 84 | // return object; 85 | // } 86 | // 87 | // public void setObject(DBObject object) { 88 | // this.object = object; 89 | // } 90 | 91 | public String getPermission() { 92 | return permission; 93 | } 94 | 95 | public void setPermission(String permission) { 96 | this.permission = permission; 97 | } 98 | 99 | public String getCreatedBy() { 100 | return createdBy; 101 | } 102 | 103 | public void setCreatedBy(String createdBy) { 104 | this.createdBy = createdBy; 105 | } 106 | 107 | public Date getCreatedOn() { 108 | return createdOn; 109 | } 110 | 111 | public void setCreatedOn(Date createdOn) { 112 | this.createdOn = createdOn; 113 | } 114 | 115 | public String toString() { 116 | return new ReflectionToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE).setExcludeFieldNames(new String[]{"uuid"}).toString(); 117 | } 118 | 119 | } 120 | -------------------------------------------------------------------------------- /WebRoot/apidocs/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Macys-FillTheCup Server 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 64 | 65 | 66 | 67 | 78 | 79 |
 
80 |
81 | 82 | 83 | -------------------------------------------------------------------------------- /src/com/macys/dao/database/DBObjectContentStore.java: -------------------------------------------------------------------------------- 1 | package com.macys.dao.database; 2 | 3 | import java.util.Date; 4 | 5 | import javax.persistence.Column; 6 | import javax.persistence.EmbeddedId; 7 | import javax.persistence.Entity; 8 | import javax.persistence.Table; 9 | import javax.persistence.Temporal; 10 | import javax.persistence.TemporalType; 11 | import javax.validation.constraints.NotNull; 12 | 13 | import org.apache.commons.lang3.builder.ReflectionToStringBuilder; 14 | import org.apache.commons.lang3.builder.ToStringStyle; 15 | 16 | import com.macys.dao.database.pk.DBObjectContentStorePK; 17 | 18 | @Entity 19 | @Table(name = "dbobject_content_store") 20 | public class DBObjectContentStore extends DBAbstractBase { 21 | 22 | private static final long serialVersionUID = 1L; 23 | 24 | // @Column(name="id", unique=true, insertable=false, updatable=false) 25 | // private Integer counter; 26 | 27 | @EmbeddedId 28 | private DBObjectContentStorePK pk; 29 | 30 | @Column(name = "uri", length = 255) 31 | private String uri; 32 | 33 | @Column(name = "data") 34 | private byte[] data; 35 | 36 | @Column(name = "created_by", length=32) 37 | @NotNull 38 | private String createdBy; 39 | 40 | @Column(name = "created_on") 41 | @NotNull 42 | @Temporal(TemporalType.TIMESTAMP) 43 | private Date createdOn; 44 | 45 | @Column(name = "extension", length=32) 46 | private String extension; 47 | 48 | @Column(name = "content_size") 49 | private Integer contentSize; 50 | 51 | @Column(name = "content_size_enc") 52 | private Integer contentSizeEnc; 53 | 54 | @Column(name = "checksum", length=32, nullable=true) 55 | private String checksum; 56 | 57 | public DBObjectContentStore() { 58 | this(null); 59 | this.createdOn = new Date(); 60 | } 61 | 62 | public DBObjectContentStore(DBObjectContentStorePK id) { 63 | this.pk = id; 64 | this.createdOn = new Date(); 65 | } 66 | 67 | public DBObjectContentStorePK getPk() { 68 | return pk; 69 | } 70 | 71 | public void setPk(DBObjectContentStorePK pk) { 72 | this.pk = pk; 73 | } 74 | 75 | public String getUri() { 76 | return uri; 77 | } 78 | 79 | public void setUri(String uri) { 80 | this.uri = uri; 81 | } 82 | 83 | public byte[] getData() { 84 | return data; 85 | } 86 | 87 | public void setData(byte[] data) { 88 | this.data = data; 89 | } 90 | 91 | public String getCreatedBy() { 92 | return createdBy; 93 | } 94 | 95 | public void setCreatedBy(String createdBy) { 96 | this.createdBy = createdBy; 97 | } 98 | 99 | public Date getCreatedOn() { 100 | return createdOn; 101 | } 102 | 103 | public void setCreatedOn(Date createdOn) { 104 | this.createdOn = createdOn; 105 | } 106 | 107 | public String getExtension() { 108 | return extension; 109 | } 110 | 111 | public void setExtension(String extension) { 112 | this.extension = extension; 113 | } 114 | 115 | public Integer getContentSize() { 116 | return contentSize; 117 | } 118 | 119 | public void setContentSize(Integer contentSize) { 120 | this.contentSize = contentSize; 121 | } 122 | 123 | public Integer getContentSizeEnc() { 124 | return contentSizeEnc; 125 | } 126 | 127 | public void setContentSizeEnc(Integer contentSizeEnc) { 128 | this.contentSizeEnc = contentSizeEnc; 129 | } 130 | 131 | public String getChecksum() { 132 | return checksum; 133 | } 134 | 135 | public void setChecksum(String checksum) { 136 | this.checksum = checksum; 137 | } 138 | 139 | public String toString() { 140 | return ReflectionToStringBuilder.toString(this, ToStringStyle.SHORT_PREFIX_STYLE); 141 | } 142 | 143 | } 144 | -------------------------------------------------------------------------------- /src/com/macys/dao/database/pk/DBObjectRelationshipPK.java: -------------------------------------------------------------------------------- 1 | package com.macys.dao.database.pk; 2 | import java.io.Serializable; 3 | import java.util.Collection; 4 | import java.util.List; 5 | 6 | import javax.persistence.Column; 7 | import javax.persistence.Embeddable; 8 | 9 | import org.apache.commons.lang3.builder.ReflectionToStringBuilder; 10 | import org.apache.commons.lang3.builder.ToStringStyle; 11 | import org.springframework.util.ObjectUtils; 12 | 13 | import flexjson.JSONDeserializer; 14 | import flexjson.JSONSerializer; 15 | 16 | @Embeddable 17 | //@Configurable 18 | public final class DBObjectRelationshipPK implements Serializable { 19 | 20 | private static final long serialVersionUID = 1L; 21 | 22 | @Column(name = "p_uuid", nullable = false, length=32) 23 | private String pUuid; 24 | 25 | @Column(name = "c_uuid", nullable = false, length=32) 26 | private String cUuid; 27 | 28 | @Column(name = "relationship_type", nullable = false, length=32) 29 | private String relationshipType; 30 | 31 | public DBObjectRelationshipPK() { 32 | } 33 | 34 | public DBObjectRelationshipPK(String pUuid, String cUuid, String relationshipType) { 35 | super(); 36 | this.pUuid = pUuid; 37 | this.cUuid = cUuid; 38 | this.relationshipType = relationshipType; 39 | } 40 | 41 | @Override 42 | public boolean equals(Object obj) { 43 | 44 | if(obj instanceof DBObjectRelationshipPK) { 45 | DBObjectRelationshipPK that = (DBObjectRelationshipPK) obj; 46 | return ObjectUtils.nullSafeEquals(this.pUuid, that.pUuid) && 47 | ObjectUtils.nullSafeEquals(this.cUuid, that.cUuid) && 48 | ObjectUtils.nullSafeEquals(this.relationshipType, that.relationshipType); 49 | } 50 | 51 | return super.equals(obj); 52 | } 53 | 54 | @Override 55 | public int hashCode() { 56 | return ObjectUtils.nullSafeHashCode(this.pUuid) + 57 | ObjectUtils.nullSafeHashCode(this.cUuid) + 58 | ObjectUtils.nullSafeHashCode(this.relationshipType); 59 | } 60 | 61 | @Override 62 | public String toString() { 63 | return ReflectionToStringBuilder.toString(this, ToStringStyle.SHORT_PREFIX_STYLE); 64 | } 65 | 66 | public String getPUuid() { 67 | return pUuid; 68 | } 69 | 70 | public String getCUuid() { 71 | return cUuid; 72 | } 73 | 74 | public String getRelationshipType() { 75 | return relationshipType; 76 | } 77 | 78 | 79 | public String toJson() { 80 | return new JSONSerializer() 81 | .exclude("*.class").serialize(this); 82 | } 83 | 84 | public String toJson(String[] fields) { 85 | return new JSONSerializer() 86 | .include(fields).exclude("*.class").serialize(this); 87 | } 88 | 89 | public static DBObjectRelationshipPK fromJsonToDbobjectRelationshipPK(String json) { 90 | return new JSONDeserializer() 91 | .use(null, DBObjectRelationshipPK.class).deserialize(json); 92 | } 93 | 94 | public static String toJsonArray(Collection collection) { 95 | return new JSONSerializer() 96 | .exclude("*.class").serialize(collection); 97 | } 98 | 99 | public static String toJsonArray(Collection collection, String[] fields) { 100 | return new JSONSerializer() 101 | .include(fields).exclude("*.class").serialize(collection); 102 | } 103 | 104 | public static Collection fromJsonArrayToDbobjectRelationshipPKs(String json) { 105 | return new JSONDeserializer>() 106 | .use("values", DBObjectRelationshipPK.class).deserialize(json); 107 | } 108 | } 109 | -------------------------------------------------------------------------------- /src/com/macys/dao/database/pk/DBObjectRelationshipMetadataPK.java: -------------------------------------------------------------------------------- 1 | package com.macys.dao.database.pk; 2 | import java.io.Serializable; 3 | import java.util.Collection; 4 | import java.util.List; 5 | 6 | import javax.persistence.Column; 7 | 8 | import org.springframework.util.ObjectUtils; 9 | 10 | import flexjson.JSONDeserializer; 11 | import flexjson.JSONSerializer; 12 | 13 | //@Embeddable 14 | //@Configurable 15 | public final class DBObjectRelationshipMetadataPK implements Serializable { 16 | 17 | private static final long serialVersionUID = 1L; 18 | 19 | @Column(name = "p_uuid", nullable = false, length=32) 20 | private String pUuid; 21 | 22 | @Column(name = "c_uuid", nullable = false, length=32) 23 | private String cUuid; 24 | 25 | @Column(name = "name", nullable = false, length = 255) 26 | private String name; 27 | 28 | @Column(name = "relationship_type", nullable = false, length=32) 29 | private String relationshipType; 30 | 31 | public DBObjectRelationshipMetadataPK() { 32 | } 33 | 34 | public DBObjectRelationshipMetadataPK(String pUuid, String cUuid, String name, String relationshipType) { 35 | super(); 36 | this.pUuid = pUuid; 37 | this.cUuid = cUuid; 38 | this.name = name; 39 | this.relationshipType = relationshipType; 40 | } 41 | 42 | @Override 43 | public boolean equals(Object obj) { 44 | 45 | if(obj instanceof DBObjectRelationshipMetadataPK) { 46 | DBObjectRelationshipMetadataPK that = (DBObjectRelationshipMetadataPK) obj; 47 | 48 | return ObjectUtils.nullSafeEquals(this.pUuid, that.pUuid) && 49 | ObjectUtils.nullSafeEquals(this.cUuid, that.cUuid) && 50 | ObjectUtils.nullSafeEquals(this.name, that.name) && 51 | ObjectUtils.nullSafeEquals(this.relationshipType, that.relationshipType); 52 | } 53 | 54 | return super.equals(obj); 55 | } 56 | 57 | @Override 58 | public int hashCode() { 59 | return ObjectUtils.nullSafeHashCode(this.pUuid) + ObjectUtils.nullSafeHashCode(this.cUuid); 60 | } 61 | 62 | public String getPUuid() { 63 | return pUuid; 64 | } 65 | 66 | public String getCUuid() { 67 | return cUuid; 68 | } 69 | 70 | public String getName() { 71 | return name; 72 | } 73 | 74 | public String getRelationshipType() { 75 | return relationshipType; 76 | } 77 | 78 | public String toJson() { 79 | return new JSONSerializer() 80 | .exclude("*.class").serialize(this); 81 | } 82 | 83 | public String toJson(String[] fields) { 84 | return new JSONSerializer() 85 | .include(fields).exclude("*.class").serialize(this); 86 | } 87 | 88 | public static DBObjectRelationshipMetadataPK fromJsonToDbobjectRelationshipMetadataPK(String json) { 89 | return new JSONDeserializer() 90 | .use(null, DBObjectRelationshipMetadataPK.class).deserialize(json); 91 | } 92 | 93 | public static String toJsonArray(Collection collection) { 94 | return new JSONSerializer() 95 | .exclude("*.class").serialize(collection); 96 | } 97 | 98 | public static String toJsonArray(Collection collection, String[] fields) { 99 | return new JSONSerializer() 100 | .include(fields).exclude("*.class").serialize(collection); 101 | } 102 | 103 | public static Collection fromJsonArrayToDbobjectRelationshipMetadataPKs(String json) { 104 | return new JSONDeserializer>() 105 | .use("values", DBObjectRelationshipMetadataPK.class).deserialize(json); 106 | } 107 | 108 | } 109 | -------------------------------------------------------------------------------- /src/com/macys/domain/impl/ReleaseImpl.java: -------------------------------------------------------------------------------- 1 | package com.macys.domain.impl; 2 | 3 | import org.apache.commons.lang3.StringUtils; 4 | 5 | import com.macys.dao.database.DBObject; 6 | import com.macys.domain.Release; 7 | import com.macys.domain.business.BusinessObjectImpl; 8 | import com.macys.domain.business.common.BusinessObjectTypeEnum; 9 | import com.macys.domain.business.common.annotations.PersistentBusinessObject; 10 | import com.macys.domain.business.common.annotations.PersistentMetadata; 11 | import com.macys.utils.AppUtils; 12 | import com.macys.valuesobjects.BaseDTO; 13 | import com.macys.valuesobjects.ReleaseVo; 14 | 15 | @PersistentBusinessObject(type=BusinessObjectTypeEnum.RELEASE) 16 | public class ReleaseImpl extends BusinessObjectImpl implements Release{ 17 | 18 | public ReleaseImpl(DBObject dbObject) { 19 | super(dbObject); 20 | // TODO Auto-generated constructor stub 21 | } 22 | 23 | @PersistentMetadata 24 | private String branchCutDate; 25 | 26 | @PersistentMetadata 27 | private String branchHardLockDate; 28 | 29 | @PersistentMetadata 30 | private String branchFreezeDate; 31 | 32 | @PersistentMetadata 33 | private String branchProductionDate; 34 | 35 | @PersistentMetadata 36 | private String mcomDate; 37 | 38 | @PersistentMetadata 39 | private String bcomDate; 40 | 41 | @PersistentMetadata 42 | private String isActivated; 43 | 44 | @Override 45 | public String getBranchCutDate() { 46 | return branchCutDate; 47 | } 48 | 49 | @Override 50 | public void setBranchCutDate(String branchCutDate) { 51 | this.branchCutDate = branchCutDate; 52 | } 53 | 54 | @Override 55 | public String getBranchHardLockDate() { 56 | return branchHardLockDate; 57 | } 58 | 59 | @Override 60 | public void setBranchHardLockDate(String branchHardLockDate) { 61 | this.branchHardLockDate = branchHardLockDate; 62 | } 63 | 64 | @Override 65 | public String getMcomDate() { 66 | return mcomDate; 67 | } 68 | 69 | @Override 70 | public void setMcomDate(String mcomDate) { 71 | this.mcomDate = mcomDate; 72 | } 73 | 74 | @Override 75 | public String getBcomDate() { 76 | return bcomDate; 77 | } 78 | 79 | @Override 80 | public void setBcomDate(String bcomDate) { 81 | this.bcomDate = bcomDate; 82 | } 83 | 84 | @Override 85 | public String getBranchFreezeDate() { 86 | return branchFreezeDate; 87 | } 88 | 89 | @Override 90 | public void setBranchFreezeDate(String branchFreezeDate) { 91 | this.branchFreezeDate = branchFreezeDate; 92 | } 93 | 94 | @Override 95 | public String getBranchProductionDate() { 96 | return branchProductionDate; 97 | } 98 | 99 | @Override 100 | public void setBranchProductionDate(String branchProductionDate) { 101 | this.branchProductionDate = branchProductionDate; 102 | } 103 | 104 | @Override 105 | public String getIsActivated() { 106 | return isActivated; 107 | } 108 | 109 | @Override 110 | public void setIsActivated(String isActivated) { 111 | this.isActivated = isActivated; 112 | } 113 | 114 | @Override 115 | public BaseDTO createDTO() { 116 | 117 | ReleaseVo vo = new ReleaseVo(); 118 | vo.name = this.getName(); 119 | vo.type = this.getType(); 120 | vo.uuid = this.getUuid(); 121 | vo.createdOnISO8601 = AppUtils.getDateISO8601(this.getCreatedOn()); 122 | 123 | vo.branchCutDate = this.getBranchCutDate(); 124 | vo.branchHardLockDate = this.getBranchHardLockDate(); 125 | vo.mcomDate = this.getMcomDate(); 126 | vo.bcomDate = this.getBcomDate(); 127 | vo.branchFreezeDate = this.getBranchFreezeDate(); 128 | vo.branchProductionDate = this.getBranchProductionDate(); 129 | vo.isActivated = StringUtils.isBlank(this.getIsActivated()) ? "false" : this.getIsActivated() ; 130 | 131 | return vo; 132 | } 133 | 134 | 135 | 136 | 137 | } 138 | -------------------------------------------------------------------------------- /src/com/macys/utils/EmailUtils.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this license header, choose License Headers in Project Properties. 3 | * To change this template file, choose Tools | Templates 4 | * and open the template in the editor. 5 | */ 6 | package com.macys.utils; 7 | 8 | import java.util.Properties; 9 | import javax.mail.Message; 10 | import javax.mail.PasswordAuthentication; 11 | import javax.mail.Session; 12 | import javax.mail.Transport; 13 | import javax.mail.internet.InternetAddress; 14 | import javax.mail.internet.MimeMessage; 15 | 16 | 17 | 18 | public class EmailUtils { 19 | 20 | 21 | 22 | private static void sendEmail(String subject,String messageBody,String toEmail){ 23 | Properties props = new Properties(); 24 | props.put("mail.smtp.host", "smtp.gmail.com"); 25 | props.put("mail.smtp.socketFactory.port", "465"); 26 | props.put("mail.smtp.socketFactory.class","javax.net.ssl.SSLSocketFactory"); 27 | props.put("mail.smtp.auth", "true"); 28 | props.put("mail.smtp.port", "465"); 29 | 30 | Session session = Session.getDefaultInstance(props, 31 | new javax.mail.Authenticator() { 32 | protected PasswordAuthentication getPasswordAuthentication() { 33 | return new PasswordAuthentication("cleanestimatex@gmail.com","abcd9876"); 34 | } 35 | }); 36 | 37 | try { 38 | 39 | Message message = new MimeMessage(session); 40 | message.setFrom(new InternetAddress("cleanestimatex@gmail.com","CleanEstimateX")); 41 | message.setRecipients(Message.RecipientType.TO,InternetAddress.parse(toEmail)); 42 | message.setSubject(subject); 43 | message.setText(messageBody); 44 | Transport.send(message); 45 | System.out.println("Email sent successully."); 46 | 47 | } catch (Exception e) { 48 | e.printStackTrace(); 49 | } 50 | } 51 | 52 | public static void sendEmail(String recipentFullName,String recipentEmail,String recipentPassword, EmailTemplateEnum emailTemplate){ 53 | 54 | switch(emailTemplate){ 55 | case NEW_REGISTRATION:{ 56 | String subject = "Registered Successfully"; 57 | String messageBody = "Dear "+recipentFullName.toUpperCase()+"\n\n"+ 58 | "You have been registered successfully. Following are your credentials.\n\n"+ 59 | "Email: "+recipentEmail+"\n"+ 60 | "Password: "+recipentPassword+"\n\n"+ 61 | "Thank you for using CleanEstimateX System"; 62 | sendEmail(subject, messageBody, recipentEmail); 63 | break; 64 | } 65 | 66 | case PASSWORD_RESET:{ 67 | String subject = "Password Reset"; 68 | String messageBody = "Dear "+recipentFullName.toUpperCase()+"\n\n"+ 69 | "Your password has been reset. Following is your new password.\n\n"+ 70 | "Password: "+recipentPassword+"\n\n"+ 71 | "Thank you for using CleanEstimateX System"; 72 | sendEmail(subject, messageBody, recipentEmail); 73 | break; 74 | 75 | } 76 | 77 | case PASSWORD_CHANGE:{ 78 | String subject = "Password Change"; 79 | String messageBody = "Dear "+recipentFullName.toUpperCase()+"\n\n"+ 80 | "Your password has been changed successfully. Following are your new credentials.\n\n"+ 81 | "Email: "+recipentEmail+"\n"+ 82 | "Password: "+recipentPassword+"\n\n"+ 83 | "Thank you for using CleanEstimateX System"; 84 | sendEmail(subject, messageBody, recipentEmail); 85 | break; 86 | 87 | } 88 | 89 | } 90 | 91 | } 92 | 93 | 94 | } 95 | -------------------------------------------------------------------------------- /src/com/macys/dao/BaseDAOImpl.java: -------------------------------------------------------------------------------- 1 | package com.macys.dao; 2 | 3 | import java.util.ArrayList; 4 | import java.util.List; 5 | 6 | import javax.annotation.Resource; 7 | import javax.transaction.Transactional; 8 | 9 | import org.springframework.dao.EmptyResultDataAccessException; 10 | 11 | import com.macys.dao.database.DBObject; 12 | import com.macys.dao.repository.DBObjectMetadataRepository; 13 | import com.macys.dao.repository.DBObjectRelationshipRepository; 14 | import com.macys.dao.repository.DBObjectRepository; 15 | import com.macys.dao.repository.JdbcTemplateRepostiory; 16 | import com.macys.domain.business.BusinessObject; 17 | import com.macys.domain.business.common.BusinessObjectTypeEnum; 18 | import com.macys.exceptions.ErrorCodeEnum; 19 | import com.macys.exceptions.ServiceException; 20 | 21 | public class BaseDAOImpl { 22 | 23 | @Resource 24 | protected DBObjectRepository dbObjectRepository; 25 | 26 | @Resource 27 | protected DBObjectMetadataRepository dbObjectMetadataRepository; 28 | 29 | @Resource 30 | protected DBObjectRelationshipRepository dbObjectRelationshipRepository; 31 | 32 | 33 | protected JdbcTemplateRepostiory jdbcTemplateRepostiory; 34 | 35 | @Transactional 36 | public BusinessObject constructBusinessObjectUsingDBObject(DBObject dbObject) throws ServiceException { 37 | 38 | BusinessObjectTypeEnum type = BusinessObjectTypeEnum.enumFromType(dbObject.getType()); 39 | 40 | if(type == null) { 41 | throw new ServiceException("Invalid businessObjectType:" + dbObject.getType(),ErrorCodeEnum.INVALID_BUSINESS_OBJECT_TYPE); 42 | } 43 | 44 | BusinessObject businessObject = ReflectionUtils.constructBusinessObject(type, dbObject); 45 | 46 | ReflectionUtils.setMetadataToBusinessObject(dbObject.getMetadatas(), businessObject, true); 47 | 48 | return businessObject; 49 | 50 | } 51 | 52 | @Transactional 53 | public BusinessObject getBusinessObjectByUuid(String uuid) throws ServiceException { 54 | 55 | DBObject dbObject = dbObjectRepository.findByUuid(uuid); 56 | 57 | if(dbObject == null) { 58 | return null; 59 | } 60 | 61 | return constructBusinessObjectUsingDBObject(dbObject); 62 | } 63 | 64 | @Transactional 65 | public void deleteBusinessObjectByUuid(String uuid) throws ServiceException { 66 | try{ 67 | dbObjectRepository.delete(uuid); 68 | dbObjectMetadataRepository.deleteMetadatasByUuid(uuid); 69 | } 70 | catch(EmptyResultDataAccessException exc){ 71 | //Occurs when no record found. No need to re-throw 72 | } 73 | } 74 | 75 | @Transactional 76 | public List getBusinessObjectByName(BusinessObjectTypeEnum type,String nameValue) throws ServiceException{ 77 | 78 | List list = new ArrayList(); 79 | 80 | List dbObjectList = dbObjectRepository.findByTypeAndName(type.getType(),nameValue); 81 | 82 | if(dbObjectList != null && dbObjectList.size()>0){ 83 | for(DBObject dbObj:dbObjectList){ 84 | list.add(constructBusinessObjectUsingDBObject(dbObj)); 85 | } 86 | } 87 | 88 | return list; 89 | } 90 | 91 | public void setDbObjectRepository(DBObjectRepository dbObjectRepository) { 92 | this.dbObjectRepository = dbObjectRepository; 93 | } 94 | 95 | public void setDbObjectMetadataRepository( 96 | DBObjectMetadataRepository dbObjectMetadataRepository) { 97 | this.dbObjectMetadataRepository = dbObjectMetadataRepository; 98 | } 99 | 100 | public void setDbObjectRelationshipRepository( 101 | DBObjectRelationshipRepository dbObjectRelationshipRepository) { 102 | this.dbObjectRelationshipRepository = dbObjectRelationshipRepository; 103 | } 104 | 105 | public void setJdbcTemplateRepostiory( 106 | JdbcTemplateRepostiory jdbcTemplateRepostiory) { 107 | this.jdbcTemplateRepostiory = jdbcTemplateRepostiory; 108 | } 109 | 110 | 111 | 112 | 113 | 114 | 115 | } 116 | -------------------------------------------------------------------------------- /src/com/macys/domain/impl/ReleaseCupImpl.java: -------------------------------------------------------------------------------- 1 | package com.macys.domain.impl; 2 | 3 | import com.macys.dao.database.DBObject; 4 | import com.macys.domain.ReleaseCup; 5 | import com.macys.domain.business.BusinessObjectImpl; 6 | import com.macys.domain.business.common.BusinessObjectTypeEnum; 7 | import com.macys.domain.business.common.annotations.PersistentBusinessObject; 8 | import com.macys.domain.business.common.annotations.PersistentMetadata; 9 | import com.macys.utils.AppUtils; 10 | import com.macys.valuesobjects.BaseDTO; 11 | import com.macys.valuesobjects.ReleaseCupVo; 12 | 13 | @PersistentBusinessObject(type=BusinessObjectTypeEnum.RELEASECUP) 14 | public class ReleaseCupImpl extends BusinessObjectImpl implements ReleaseCup{ 15 | 16 | public ReleaseCupImpl(DBObject dbObject) { 17 | super(dbObject); 18 | // TODO Auto-generated constructor stub 19 | } 20 | 21 | @PersistentMetadata 22 | private String releaseUuid; 23 | 24 | @PersistentMetadata 25 | private String labUuid; 26 | 27 | @PersistentMetadata 28 | private String availableDevDays; 29 | 30 | @PersistentMetadata 31 | private String devDays; 32 | 33 | @PersistentMetadata 34 | private String regressionDays; 35 | 36 | @PersistentMetadata 37 | private String sysComponents; 38 | 39 | @PersistentMetadata 40 | private String matrixJson; 41 | 42 | @PersistentMetadata 43 | private String ipmTree; 44 | 45 | @PersistentMetadata 46 | private String lastClicked; 47 | 48 | @Override 49 | public String getReleaseUuid() { 50 | return releaseUuid; 51 | } 52 | 53 | @Override 54 | public void setReleaseUuid(String releaseUuid) { 55 | this.releaseUuid = releaseUuid; 56 | } 57 | 58 | @Override 59 | public String getLabUuid() { 60 | return labUuid; 61 | } 62 | 63 | @Override 64 | public void setLabUuid(String labUuid) { 65 | this.labUuid = labUuid; 66 | } 67 | 68 | @Override 69 | public String getAvailableDevDays() { 70 | return availableDevDays; 71 | } 72 | 73 | @Override 74 | public void setAvailableDevDays(String availableDevDays) { 75 | this.availableDevDays = availableDevDays; 76 | } 77 | 78 | @Override 79 | public String getDevDays() { 80 | return devDays; 81 | } 82 | 83 | @Override 84 | public void setDevDays(String devDays) { 85 | this.devDays = devDays; 86 | } 87 | 88 | @Override 89 | public String getRegressionDays() { 90 | return regressionDays; 91 | } 92 | 93 | @Override 94 | public void setRegressionDays(String regressionDays) { 95 | this.regressionDays = regressionDays; 96 | } 97 | 98 | @Override 99 | public String getSysComponents() { 100 | return sysComponents; 101 | } 102 | 103 | @Override 104 | public void setSysComponents(String sysComponents) { 105 | this.sysComponents = sysComponents; 106 | } 107 | 108 | @Override 109 | public String getMatrixJson() { 110 | return matrixJson; 111 | } 112 | 113 | @Override 114 | public void setMatrixJson(String matrixJson) { 115 | this.matrixJson = matrixJson; 116 | } 117 | 118 | @Override 119 | public String getLastClicked() { 120 | return lastClicked; 121 | } 122 | 123 | @Override 124 | public void setLastClicked(String lastClicked) { 125 | this.lastClicked = lastClicked; 126 | } 127 | 128 | @Override 129 | public String getIpmTree() { 130 | return ipmTree; 131 | } 132 | 133 | @Override 134 | public void setIpmTree(String ipmTree) { 135 | this.ipmTree = ipmTree; 136 | } 137 | 138 | @Override 139 | public BaseDTO createDTO() { 140 | ReleaseCupVo vo = new ReleaseCupVo(); 141 | vo.name = this.getName(); 142 | vo.type = this.getType(); 143 | vo.uuid = this.getUuid(); 144 | vo.createdOnISO8601 = AppUtils.getDateISO8601(this.getCreatedOn()); 145 | 146 | vo.availableDevDays = this.getAvailableDevDays(); 147 | vo.devDays = this.getDevDays(); 148 | vo.regressionDays = this.getRegressionDays(); 149 | vo.lastClicked = this.getLastClicked(); 150 | return vo; 151 | } 152 | 153 | 154 | 155 | } 156 | -------------------------------------------------------------------------------- /src/com/macys/dao/repository/JdbcTemplateRepostiory.java: -------------------------------------------------------------------------------- 1 | package com.macys.dao.repository; 2 | 3 | import java.util.Arrays; 4 | import java.util.HashMap; 5 | import java.util.List; 6 | import java.util.Map; 7 | import javax.transaction.Transactional; 8 | import org.springframework.jdbc.core.BeanPropertyRowMapper; 9 | import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate; 10 | import org.springframework.jdbc.core.support.JdbcDaoSupport; 11 | import com.macys.dao.DAOUtils; 12 | import com.macys.dao.database.DBObject; 13 | import com.macys.domain.business.common.BusinessObjectTypeEnum; 14 | 15 | 16 | public class JdbcTemplateRepostiory extends JdbcDaoSupport { 17 | 18 | private NamedParameterJdbcTemplate namedParameterJdbcTemplate; 19 | 20 | public JdbcTemplateRepostiory(){ 21 | 22 | } 23 | 24 | public DBObject findByUuid(String uuid) { 25 | 26 | String sql = "select * from dbobject where uuid = ?"; 27 | 28 | DBObject dbObject = this.getJdbcTemplate().queryForObject(sql, new Object[]{uuid}, new BeanPropertyRowMapper(DBObject.class)); 29 | 30 | return dbObject; 31 | } 32 | 33 | public DBObject findByTypeAndName(BusinessObjectTypeEnum type,String name){ 34 | 35 | String sql = "select * from dbobjecct where type=? and name=?"; 36 | 37 | DBObject dbObject = this.getJdbcTemplate().queryForObject(sql, new Object[]{type.getType(),name}, new BeanPropertyRowMapper(DBObject.class)); 38 | 39 | return dbObject; 40 | } 41 | 42 | public List findUuidsByType(BusinessObjectTypeEnum type){ 43 | String sql = "select distinct uuid from dbobject where type=?"; 44 | 45 | List uuids = this.getJdbcTemplate().queryForList(sql, new Object[]{type.getType()}, String.class); 46 | 47 | return uuids; 48 | } 49 | 50 | public List findUuidsByMetadata(BusinessObjectTypeEnum type, String name, String value) { 51 | 52 | String sql = "select distinct uuid from dbobject_metadata where type=? and name = ? and value = ?"; 53 | 54 | List uuids = this.getJdbcTemplate().queryForList(sql, new Object[]{type.getType(), name, value}, String.class); 55 | 56 | return uuids; 57 | 58 | } 59 | 60 | @Transactional 61 | public int updateMetadataByUuid(String uuid, String type, String name, String value){ 62 | 63 | try{ 64 | // String selectCheck = "select dbobject_metadata where type=? and uuid = ? and name = ?"; 65 | // List> list = this.getJdbcTemplate().queryForList(selectCheck, new Object[]{value,type,uuid,name}); 66 | // if(list==null || list.size() <1){ 67 | // String insertSql = 68 | // } 69 | // else{ 70 | String sql = "update dbobject_metadata set value=? where type=? and uuid = ? and name = ?"; 71 | 72 | int rowsEffected = this.getJdbcTemplate().update(sql, new Object[]{value,type,uuid,name}); 73 | 74 | return rowsEffected; 75 | //} 76 | 77 | } 78 | catch(Exception exc){ 79 | //ignore expcetion 80 | } 81 | 82 | return -1; 83 | 84 | } 85 | 86 | public List findChildUuids(String parentUuid, BusinessObjectTypeEnum[] objectTypeEnums) { 87 | 88 | if(objectTypeEnums == null) { 89 | String sql = "select c_uuid from dbobject_relationship where p_uuid = ? "; 90 | 91 | List uuids = this.getJdbcTemplate().queryForList(sql, new Object[]{parentUuid}, String.class); 92 | 93 | return uuids; 94 | } else { 95 | 96 | String sql = "select c_uuid from dbobject_relationship where p_uuid = :pUuid and substring(c_uuid, 1, 5) in (:types) "; 97 | List types = DAOUtils.asListOfStrings(objectTypeEnums); 98 | 99 | 100 | Map> paramMap = new HashMap>(); 101 | paramMap.put("pUuid", Arrays.asList(new String[]{parentUuid})); 102 | paramMap.put("types", types); 103 | 104 | List uuids = this.namedParameterJdbcTemplate.queryForList(sql, paramMap, String.class); 105 | 106 | return uuids; 107 | 108 | } 109 | 110 | } 111 | 112 | } 113 | -------------------------------------------------------------------------------- /WebRoot/apidocs/lib/jquery.ba-bbq.min.js: -------------------------------------------------------------------------------- 1 | /* 2 | * jQuery BBQ: Back Button & Query Library - v1.2.1 - 2/17/2010 3 | * http://benalman.com/projects/jquery-bbq-plugin/ 4 | * 5 | * Copyright (c) 2010 "Cowboy" Ben Alman 6 | * Dual licensed under the MIT and GPL licenses. 7 | * http://benalman.com/about/license/ 8 | */ 9 | (function($,p){var i,m=Array.prototype.slice,r=decodeURIComponent,a=$.param,c,l,v,b=$.bbq=$.bbq||{},q,u,j,e=$.event.special,d="hashchange",A="querystring",D="fragment",y="elemUrlAttr",g="location",k="href",t="src",x=/^.*\?|#.*$/g,w=/^.*\#/,h,C={};function E(F){return typeof F==="string"}function B(G){var F=m.call(arguments,1);return function(){return G.apply(this,F.concat(m.call(arguments)))}}function n(F){return F.replace(/^[^#]*#?(.*)$/,"$1")}function o(F){return F.replace(/(?:^[^?#]*\?([^#]*).*$)?.*/,"$1")}function f(H,M,F,I,G){var O,L,K,N,J;if(I!==i){K=F.match(H?/^([^#]*)\#?(.*)$/:/^([^#?]*)\??([^#]*)(#?.*)/);J=K[3]||"";if(G===2&&E(I)){L=I.replace(H?w:x,"")}else{N=l(K[2]);I=E(I)?l[H?D:A](I):I;L=G===2?I:G===1?$.extend({},I,N):$.extend({},N,I);L=a(L);if(H){L=L.replace(h,r)}}O=K[1]+(H?"#":L||!K[1]?"?":"")+L+J}else{O=M(F!==i?F:p[g][k])}return O}a[A]=B(f,0,o);a[D]=c=B(f,1,n);c.noEscape=function(G){G=G||"";var F=$.map(G.split(""),encodeURIComponent);h=new RegExp(F.join("|"),"g")};c.noEscape(",/");$.deparam=l=function(I,F){var H={},G={"true":!0,"false":!1,"null":null};$.each(I.replace(/\+/g," ").split("&"),function(L,Q){var K=Q.split("="),P=r(K[0]),J,O=H,M=0,R=P.split("]["),N=R.length-1;if(/\[/.test(R[0])&&/\]$/.test(R[N])){R[N]=R[N].replace(/\]$/,"");R=R.shift().split("[").concat(R);N=R.length-1}else{N=0}if(K.length===2){J=r(K[1]);if(F){J=J&&!isNaN(J)?+J:J==="undefined"?i:G[J]!==i?G[J]:J}if(N){for(;M<=N;M++){P=R[M]===""?O.length:R[M];O=O[P]=M').hide().insertAfter("body")[0].contentWindow;q=function(){return a(n.document[c][l])};o=function(u,s){if(u!==s){var t=n.document;t.open().close();t[c].hash="#"+u}};o(a())}}m.start=function(){if(r){return}var t=a();o||p();(function s(){var v=a(),u=q(t);if(v!==t){o(t=v,u);$(i).trigger(d)}else{if(u!==t){i[c][l]=i[c][l].replace(/#.*/,"")+"#"+u}}r=setTimeout(s,$[d+"Delay"])})()};m.stop=function(){if(!n){r&&clearTimeout(r);r=0}};return m})()})(jQuery,this); -------------------------------------------------------------------------------- /src/com/macys/domain/business/BusinessObjectImpl.java: -------------------------------------------------------------------------------- 1 | package com.macys.domain.business; 2 | 3 | import java.util.Date; 4 | 5 | import org.apache.commons.lang3.builder.ReflectionToStringBuilder; 6 | import org.apache.commons.lang3.builder.ToStringStyle; 7 | import org.springframework.util.ObjectUtils; 8 | 9 | import com.macys.dao.database.DBObject; 10 | import com.macys.valuesobjects.BaseDTO; 11 | 12 | public abstract class BusinessObjectImpl implements BusinessObject { 13 | 14 | transient private DBObject dbObject; 15 | 16 | public BusinessObjectImpl(DBObject dbObject) { 17 | this.dbObject = dbObject; 18 | } 19 | 20 | @Override 21 | public boolean equals(Object obj) { 22 | 23 | if(obj instanceof BusinessObject) { 24 | BusinessObject that = (BusinessObject) obj; 25 | 26 | return ObjectUtils.nullSafeEquals(this.getUuid(), that.getUuid()); 27 | 28 | } 29 | 30 | return super.equals(obj); 31 | } 32 | 33 | @Override 34 | public int hashCode() { 35 | 36 | return ObjectUtils.nullSafeHashCode(getUuid()); 37 | 38 | } 39 | 40 | public void setDbObject(DBObject dbObject) { 41 | this.dbObject = dbObject; 42 | } 43 | 44 | @Override 45 | public DBObject getDbObject() { 46 | if(dbObject == null) { 47 | dbObject = new DBObject(); 48 | } 49 | return dbObject; 50 | } 51 | 52 | @Override 53 | public Integer getCounter() { 54 | return getDbObject().getCounter(); 55 | } 56 | 57 | @Override 58 | public String getType() { 59 | return getDbObject().getType(); 60 | } 61 | 62 | public void setType(String type) { 63 | this.getDbObject().setType(type); 64 | } 65 | 66 | @Override 67 | public String getUuid() { 68 | return this.getDbObject().getUuid(); 69 | } 70 | 71 | // public void setUuid(String uuid) { 72 | // this.getDbObject().setUuid(uuid); 73 | // } 74 | 75 | @Override 76 | public Integer getVersion() { 77 | return getDbObject().getVersion(); 78 | } 79 | 80 | // public void setVersion(Integer version) { 81 | // this.version = version; 82 | // } 83 | 84 | @Override 85 | public String getName() { 86 | return getDbObject().getName(); 87 | } 88 | 89 | @Override 90 | public void setName(String name) { 91 | this.getDbObject().setName(name); 92 | } 93 | 94 | @Override 95 | public String getCreatedBy() { 96 | return getDbObject().getCreatedBy(); 97 | } 98 | 99 | @Override 100 | public void setCreatedBy(String createdBy) { 101 | this.getDbObject().setCreatedBy(createdBy); 102 | } 103 | 104 | @Override 105 | public Date getCreatedOn() { 106 | return this.getDbObject().getCreatedOn(); 107 | } 108 | 109 | // public void setCreatedOn(Date createdOn) { 110 | // this.createdOn = createdOn; 111 | // } 112 | 113 | @Override 114 | public String getModifiedBy() { 115 | return this.getDbObject().getModifiedBy(); 116 | } 117 | 118 | @Override 119 | public void setModifiedBy(String modifiedBy) { 120 | this.getDbObject().setModifiedBy(modifiedBy); 121 | } 122 | 123 | @Override 124 | public Date getModifiedOn() { 125 | return this.getDbObject().getModifiedOn(); 126 | } 127 | 128 | /* 129 | public void setModifiedOn(Date modifiedOn) { 130 | this.getDbObject().setModifiedOn(modifiedOn); 131 | } 132 | */ 133 | 134 | @Override 135 | public Short getStatus() { 136 | return this.getDbObject().getStatus(); 137 | } 138 | 139 | @Override 140 | public void setStatus(Short status) { 141 | this.getDbObject().setStatus(status); 142 | } 143 | 144 | @Override 145 | public Date getStatusModifiedOn() { 146 | return this.getDbObject().getStatusModifiedOn(); 147 | } 148 | 149 | @Override 150 | public void setStatusModifiedOn(Date statusModifiedOn) { 151 | this.getDbObject().setStatusModifiedOn(statusModifiedOn); 152 | } 153 | 154 | public String toString() { 155 | if(dbObject != null) { 156 | return "uuid=" + dbObject.getUuid() + ", name=" + dbObject.getName(); 157 | } 158 | return ReflectionToStringBuilder.toString(this, ToStringStyle.SHORT_PREFIX_STYLE); 159 | } 160 | 161 | public BaseDTO createDTO() { 162 | return null; 163 | } 164 | 165 | } 166 | -------------------------------------------------------------------------------- /src/com/macys/dao/database/DBObjectRelationship.java: -------------------------------------------------------------------------------- 1 | package com.macys.dao.database; 2 | import java.util.Date; 3 | 4 | import javax.persistence.Column; 5 | import javax.persistence.EmbeddedId; 6 | import javax.persistence.Entity; 7 | import javax.persistence.NamedQuery; 8 | import javax.persistence.Table; 9 | import javax.persistence.Temporal; 10 | import javax.persistence.TemporalType; 11 | import javax.validation.constraints.NotNull; 12 | 13 | import org.apache.commons.lang3.builder.ReflectionToStringBuilder; 14 | import org.apache.commons.lang3.builder.ToStringStyle; 15 | import org.springframework.util.ObjectUtils; 16 | 17 | import com.macys.dao.database.pk.DBObjectRelationshipPK; 18 | 19 | @Entity 20 | @Table(name = "dbobject_relationship") 21 | @NamedQuery(name = "DBObjectRelationship.findByPK", query = "from DBObjectRelationship a where a.pk = ?1") 22 | public class DBObjectRelationship extends DBAbstractBase { 23 | 24 | private static final long serialVersionUID = 1L; 25 | 26 | // @Id 27 | // @Column(name="id", unique=true, insertable=false, updatable=false) 28 | // private Integer counter; 29 | 30 | @Column(name = "client_id") 31 | @NotNull 32 | private Short clientId = 0; 33 | 34 | @EmbeddedId 35 | private DBObjectRelationshipPK pk; 36 | 37 | @Column(name = "sortorder") 38 | private Short sortorder; 39 | 40 | @Column(name = "created_by", length=32) 41 | @NotNull 42 | private String createdBy; 43 | 44 | @Column(name = "created_on") 45 | @Temporal(TemporalType.TIMESTAMP) 46 | private Date createdOn; 47 | 48 | @Column(name = "status") 49 | private Short status = 0; 50 | 51 | @Column(name = "status_modified_on") 52 | @Temporal(TemporalType.TIMESTAMP) 53 | private Date statusModifiedOn; 54 | 55 | public DBObjectRelationship() { 56 | this.createdOn = new Date(); 57 | } 58 | 59 | public DBObjectRelationship(DBObjectRelationshipPK id) { 60 | this.pk = id; 61 | this.createdOn = new Date(); 62 | } 63 | 64 | public DBObjectRelationship(DBObjectRelationshipPK id, String createdBy) { 65 | this.pk = id; 66 | this.createdBy = createdBy; 67 | this.createdOn = new Date(); 68 | } 69 | 70 | // @Override 71 | // public DBObjectRelationshipPK getId() { 72 | // return this.pk; 73 | // } 74 | // 75 | // @Override 76 | // protected void setId(DBObjectRelationshipPK id) { 77 | // this.pk = (DBObjectRelationshipPK) id; 78 | // } 79 | 80 | @Override 81 | public boolean equals(Object obj) { 82 | 83 | if(obj instanceof DBObjectRelationship) { 84 | DBObjectRelationship that = (DBObjectRelationship) obj; 85 | return ObjectUtils.nullSafeEquals(this.pk, that.pk); 86 | } 87 | 88 | return super.equals(obj); 89 | } 90 | 91 | @Override 92 | public int hashCode() { 93 | return ObjectUtils.nullSafeHashCode(this.pk); 94 | } 95 | 96 | // @ManyToOne 97 | // @JoinColumn(name = "p_uuid", referencedColumnName = "uuid", nullable = false, insertable = false, updatable = false) 98 | // private DBObject pUuid; 99 | // 100 | // @ManyToOne 101 | // @JoinColumn(name = "c_uuid", referencedColumnName = "uuid", nullable = false, insertable = false, updatable = false) 102 | // private DBObject cUuid; 103 | 104 | 105 | public Short getSortorder() { 106 | return sortorder; 107 | } 108 | 109 | public void setSortorder(Short sortorder) { 110 | this.sortorder = sortorder; 111 | } 112 | 113 | public String getCreatedBy() { 114 | return createdBy; 115 | } 116 | 117 | public void setCreatedBy(String createdBy) { 118 | this.createdBy = createdBy; 119 | } 120 | 121 | public Date getCreatedOn() { 122 | return createdOn; 123 | } 124 | 125 | public void setCreatedOn(Date createdOn) { 126 | this.createdOn = createdOn; 127 | } 128 | 129 | public DBObjectRelationshipPK getPk() { 130 | return pk; 131 | } 132 | 133 | public void setPk(DBObjectRelationshipPK pk) { 134 | this.pk = pk; 135 | } 136 | 137 | public String toString() { 138 | return new ReflectionToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE).setExcludeFieldNames(new String[]{"pUuid", "cUuid"}).toString(); 139 | } 140 | } 141 | -------------------------------------------------------------------------------- /src/com/macys/domain/impl/UserImpl.java: -------------------------------------------------------------------------------- 1 | package com.macys.domain.impl; 2 | 3 | import org.apache.commons.lang3.StringUtils; 4 | 5 | import com.macys.dao.database.DBObject; 6 | import com.macys.domain.User; 7 | import com.macys.domain.business.BusinessObjectImpl; 8 | import com.macys.domain.business.common.BusinessObjectTypeEnum; 9 | import com.macys.domain.business.common.annotations.PersistentBusinessObject; 10 | import com.macys.domain.business.common.annotations.PersistentMetadata; 11 | import com.macys.utils.AppUtils; 12 | import com.macys.valuesobjects.BaseDTO; 13 | import com.macys.valuesobjects.UserVo; 14 | 15 | @PersistentBusinessObject(type=BusinessObjectTypeEnum.USER) 16 | public class UserImpl extends BusinessObjectImpl implements User{ 17 | 18 | public UserImpl(DBObject dbObject) { 19 | super(dbObject); 20 | } 21 | 22 | @PersistentMetadata 23 | private String firstName; 24 | 25 | @PersistentMetadata 26 | private String lastName; 27 | 28 | @PersistentMetadata 29 | private String userEmail; 30 | 31 | @PersistentMetadata 32 | private String userName; 33 | 34 | @PersistentMetadata 35 | private String password; 36 | 37 | @PersistentMetadata 38 | private String isPasswordReset; 39 | 40 | @PersistentMetadata 41 | private String isSuperAdmin; 42 | 43 | @PersistentMetadata 44 | private String isLabManager; 45 | 46 | @PersistentMetadata 47 | private String isLabUser; 48 | 49 | @Override 50 | public String getUserName() { 51 | return userName; 52 | } 53 | 54 | @Override 55 | public void setUserName(String userName) { 56 | this.userName = userName; 57 | } 58 | 59 | @Override 60 | public String getPassword() { 61 | return password; 62 | } 63 | 64 | @Override 65 | public void setPassword(String password) { 66 | this.password = password; 67 | } 68 | 69 | @Override 70 | public String getIsSuperAdmin() { 71 | return isSuperAdmin; 72 | } 73 | 74 | @Override 75 | public void setIsSuperAdmin(String isSuperAdmin) { 76 | this.isSuperAdmin = isSuperAdmin; 77 | } 78 | 79 | @Override 80 | public String getFirstName() { 81 | return firstName; 82 | } 83 | 84 | @Override 85 | public void setFirstName(String firstName) { 86 | this.firstName = firstName; 87 | } 88 | 89 | @Override 90 | public String getLastName() { 91 | return lastName; 92 | } 93 | 94 | @Override 95 | public void setLastName(String lastName) { 96 | this.lastName = lastName; 97 | } 98 | 99 | @Override 100 | public String getUserEmail() { 101 | return userEmail; 102 | } 103 | 104 | @Override 105 | public void setUserEmail(String userEmail) { 106 | this.userEmail = userEmail; 107 | } 108 | 109 | @Override 110 | public String getIsLabManager() { 111 | return isLabManager; 112 | } 113 | 114 | @Override 115 | public void setIsLabManager(String isLabManager) { 116 | this.isLabManager = isLabManager; 117 | } 118 | 119 | @Override 120 | public String getIsLabUser() { 121 | return isLabUser; 122 | } 123 | 124 | @Override 125 | public void setIsLabUser(String isLabUser) { 126 | this.isLabUser = isLabUser; 127 | } 128 | 129 | @Override 130 | public String getIsPasswordReset() { 131 | return isPasswordReset; 132 | } 133 | 134 | @Override 135 | public void setIsPasswordReset(String isPasswordReset) { 136 | this.isPasswordReset = isPasswordReset; 137 | } 138 | 139 | @Override 140 | public BaseDTO createDTO(){ 141 | UserVo vo = new UserVo(); 142 | 143 | vo.name = this.getName(); 144 | vo.type = this.getType(); 145 | vo.uuid = this.getUuid(); 146 | vo.createdOnISO8601 = AppUtils.getDateISO8601(this.getCreatedOn()); 147 | vo.createdBy = this.getCreatedBy(); 148 | 149 | vo.username = this.getUserName(); 150 | vo.isSuperAdmin = StringUtils.isBlank(this.getIsSuperAdmin()) ? "false":this.getIsSuperAdmin(); 151 | vo.isLabManager = StringUtils.isBlank(this.getIsLabManager()) ? "false":this.getIsLabManager(); 152 | vo.isLabUser = StringUtils.isBlank(this.getIsLabUser()) ? "false":this.getIsLabUser(); 153 | vo.isPasswordReset = StringUtils.isBlank(this.getIsPasswordReset())? "false":this.getIsPasswordReset(); 154 | 155 | vo.firstName = this.getFirstName(); 156 | vo.lastName = this.getLastName(); 157 | vo.userEmail = this.getUserEmail(); 158 | 159 | return vo; 160 | } 161 | 162 | 163 | 164 | } 165 | -------------------------------------------------------------------------------- /src/com/macys/dao/database/DBObjectMetadata.java: -------------------------------------------------------------------------------- 1 | package com.macys.dao.database; 2 | 3 | import java.util.Date; 4 | 5 | import javax.persistence.Column; 6 | import javax.persistence.EmbeddedId; 7 | import javax.persistence.Entity; 8 | import javax.persistence.FetchType; 9 | import javax.persistence.JoinColumn; 10 | import javax.persistence.ManyToOne; 11 | import javax.persistence.NamedQuery; 12 | import javax.persistence.Table; 13 | import javax.persistence.Temporal; 14 | import javax.persistence.TemporalType; 15 | import javax.validation.constraints.NotNull; 16 | 17 | import org.apache.commons.lang3.builder.ReflectionToStringBuilder; 18 | import org.apache.commons.lang3.builder.ToStringStyle; 19 | import org.hibernate.annotations.NotFound; 20 | import org.hibernate.annotations.NotFoundAction; 21 | import org.springframework.util.ObjectUtils; 22 | 23 | import com.macys.dao.database.pk.DBObjectMetadataPK; 24 | import com.macys.domain.business.common.BusinessObjectTypeEnum; 25 | 26 | @Entity 27 | @Table(name = "dbobject_metadata") 28 | @NamedQuery(name="DBObjectMetadata.findByPK", query="from DBObjectMetadata o where o.pk = ?1") 29 | public class DBObjectMetadata extends DBAbstractBase { 30 | 31 | private static final long serialVersionUID = 1L; 32 | 33 | // @Column(name="id", unique=true, insertable=false, updatable=false) 34 | // private Integer counter; 35 | 36 | @Column(name = "client_id") 37 | @NotNull 38 | private Short clientId = 0; 39 | 40 | @Column(name = "type", length=5) 41 | private String type; 42 | 43 | @EmbeddedId 44 | private DBObjectMetadataPK pk; 45 | 46 | @ManyToOne(optional=true, fetch=FetchType.LAZY) 47 | @JoinColumn(name = "uuid", nullable = true, insertable = false, updatable = false) 48 | @NotFound(action=NotFoundAction.IGNORE) 49 | private DBObject object; 50 | 51 | @Column(name = "value") 52 | private String value; 53 | 54 | @Column(name = "created_by", length=32) 55 | @NotNull 56 | private String createdBy; 57 | 58 | @Column(name = "created_on") 59 | @Temporal(TemporalType.TIMESTAMP) 60 | private Date createdOn; 61 | 62 | public DBObjectMetadata() { 63 | this(null); 64 | this.createdOn = new Date(); 65 | } 66 | 67 | public DBObjectMetadata(DBObjectMetadataPK id) { 68 | this.pk = id; 69 | this.type = clipTypeFromUuid(); 70 | this.createdOn = new Date(); 71 | } 72 | 73 | public DBObjectMetadata(DBObjectMetadataPK id, String value, String createdBy) { 74 | this.pk = id; 75 | this.value = value; 76 | this.createdBy = createdBy; 77 | this.type = clipTypeFromUuid(); 78 | this.createdOn = new Date(); 79 | } 80 | 81 | private String clipTypeFromUuid() { 82 | 83 | if(this.pk != null && this.getPk().getUuid() != null) { 84 | for(BusinessObjectTypeEnum enum1:BusinessObjectTypeEnum.values()) { 85 | if(this.getPk().getUuid().startsWith(enum1.getType())) { 86 | return enum1.getType(); 87 | } 88 | } 89 | } 90 | 91 | return null; 92 | } 93 | 94 | @Override 95 | public boolean equals(Object obj) { 96 | 97 | if (obj instanceof DBObjectMetadata) { 98 | DBObjectMetadata that = (DBObjectMetadata) obj; 99 | return ObjectUtils.nullSafeEquals(this.pk, that.pk) && ObjectUtils.nullSafeEquals(this.value, that.value); 100 | } 101 | 102 | return super.equals(obj); 103 | } 104 | 105 | @Override 106 | public int hashCode() { 107 | return ObjectUtils.nullSafeHashCode(this.pk); 108 | } 109 | 110 | public DBObject getObject() { 111 | return object; 112 | } 113 | 114 | public void setObject(DBObject object) { 115 | this.object = object; 116 | } 117 | 118 | public Short getClientId() { 119 | return clientId; 120 | } 121 | 122 | public DBObjectMetadataPK getPk() { 123 | return pk; 124 | } 125 | 126 | public void setPk(DBObjectMetadataPK pk) { 127 | this.pk = pk; 128 | } 129 | 130 | public String getValue() { 131 | return value; 132 | } 133 | 134 | public void setValue(String value) { 135 | this.value = value; 136 | } 137 | 138 | public String getCreatedBy() { 139 | return createdBy; 140 | } 141 | 142 | public void setCreatedBy(String createdBy) { 143 | this.createdBy = createdBy; 144 | } 145 | 146 | public Date getCreatedOn() { 147 | return createdOn; 148 | } 149 | 150 | public void setCreatedOn(Date createdOn) { 151 | this.createdOn = createdOn; 152 | } 153 | 154 | public String getType() { 155 | return type; 156 | } 157 | 158 | public String toString() { 159 | return new ReflectionToStringBuilder(this, 160 | ToStringStyle.SHORT_PREFIX_STYLE).setExcludeFieldNames( 161 | new String[] { "uuid" }).toString(); 162 | } 163 | } 164 | -------------------------------------------------------------------------------- /src/com/macys/dao/database/DBObjectMetadataJson.java: -------------------------------------------------------------------------------- 1 | package com.macys.dao.database; 2 | 3 | import java.util.Date; 4 | 5 | import javax.persistence.Column; 6 | import javax.persistence.EmbeddedId; 7 | import javax.persistence.Entity; 8 | import javax.persistence.FetchType; 9 | import javax.persistence.JoinColumn; 10 | import javax.persistence.ManyToOne; 11 | import javax.persistence.NamedQuery; 12 | import javax.persistence.Table; 13 | import javax.persistence.Temporal; 14 | import javax.persistence.TemporalType; 15 | import javax.validation.constraints.NotNull; 16 | 17 | import org.apache.commons.lang3.builder.ReflectionToStringBuilder; 18 | import org.apache.commons.lang3.builder.ToStringStyle; 19 | import org.hibernate.annotations.NotFound; 20 | import org.hibernate.annotations.NotFoundAction; 21 | import org.springframework.util.ObjectUtils; 22 | 23 | import com.macys.dao.database.pk.DBObjectMetadataJsonPK; 24 | import com.macys.domain.business.common.BusinessObjectTypeEnum; 25 | 26 | @Entity 27 | @Table(name = "dbobject_metadata_json") 28 | @NamedQuery(name="DBObjectMetadataJson.findByPK", query="from DBObjectMetadataJson o where o.pk = ?1") 29 | public class DBObjectMetadataJson extends DBAbstractBase { 30 | 31 | private static final long serialVersionUID = 1L; 32 | 33 | // @Column(name="id", unique=true, insertable=false, updatable=false) 34 | // private Integer counter; 35 | 36 | @Column(name = "client_id") 37 | @NotNull 38 | private Short clientId = 0; 39 | 40 | @Column(name = "type", length=5) 41 | private String type; 42 | 43 | @Column(name = "name", length=20) 44 | private String name; 45 | 46 | @EmbeddedId 47 | private DBObjectMetadataJsonPK pk; 48 | 49 | @ManyToOne(optional=true, fetch=FetchType.LAZY) 50 | @JoinColumn(name = "uuid", nullable = true, insertable = false, updatable = false) 51 | @NotFound(action=NotFoundAction.IGNORE) 52 | private DBObject object; 53 | 54 | @Column(name = "value") 55 | private String value; 56 | 57 | @Column(name = "created_by", length=32) 58 | @NotNull 59 | private String createdBy; 60 | 61 | @Column(name = "created_on") 62 | @Temporal(TemporalType.TIMESTAMP) 63 | private Date createdOn; 64 | 65 | public DBObjectMetadataJson() { 66 | this(null); 67 | this.createdOn = new Date(); 68 | } 69 | 70 | public DBObjectMetadataJson(DBObjectMetadataJsonPK id) { 71 | this.pk = id; 72 | this.type = clipTypeFromUuid(); 73 | this.createdOn = new Date(); 74 | } 75 | 76 | public DBObjectMetadataJson(DBObjectMetadataJsonPK id, String value, String createdBy) { 77 | this.pk = id; 78 | this.value = value; 79 | this.createdBy = createdBy; 80 | this.type = clipTypeFromUuid(); 81 | this.createdOn = new Date(); 82 | } 83 | 84 | private String clipTypeFromUuid() { 85 | 86 | if(this.pk != null && this.getPk().getUuid() != null) { 87 | for(BusinessObjectTypeEnum enum1:BusinessObjectTypeEnum.values()) { 88 | if(this.getPk().getUuid().startsWith(enum1.getType())) { 89 | return enum1.getType(); 90 | } 91 | } 92 | } 93 | 94 | return null; 95 | } 96 | 97 | @Override 98 | public boolean equals(Object obj) { 99 | 100 | if (obj instanceof DBObjectMetadataJson) { 101 | DBObjectMetadataJson that = (DBObjectMetadataJson) obj; 102 | return ObjectUtils.nullSafeEquals(this.pk, that.pk) && ObjectUtils.nullSafeEquals(this.value, that.value); 103 | } 104 | 105 | return super.equals(obj); 106 | } 107 | 108 | @Override 109 | public int hashCode() { 110 | return ObjectUtils.nullSafeHashCode(this.pk); 111 | } 112 | 113 | public DBObject getObject() { 114 | return object; 115 | } 116 | 117 | public void setObject(DBObject object) { 118 | this.object = object; 119 | } 120 | 121 | public Short getClientId() { 122 | return clientId; 123 | } 124 | 125 | public DBObjectMetadataJsonPK getPk() { 126 | return pk; 127 | } 128 | 129 | public void setPk(DBObjectMetadataJsonPK pk) { 130 | this.pk = pk; 131 | } 132 | 133 | public String getValue() { 134 | return value; 135 | } 136 | 137 | public void setValue(String value) { 138 | this.value = value; 139 | } 140 | 141 | public String getCreatedBy() { 142 | return createdBy; 143 | } 144 | 145 | public void setCreatedBy(String createdBy) { 146 | this.createdBy = createdBy; 147 | } 148 | 149 | public Date getCreatedOn() { 150 | return createdOn; 151 | } 152 | 153 | public void setCreatedOn(Date createdOn) { 154 | this.createdOn = createdOn; 155 | } 156 | 157 | public String getType() { 158 | return type; 159 | } 160 | 161 | public String toString() { 162 | return new ReflectionToStringBuilder(this, 163 | ToStringStyle.SHORT_PREFIX_STYLE).setExcludeFieldNames( 164 | new String[] { "uuid" }).toString(); 165 | } 166 | } 167 | -------------------------------------------------------------------------------- /src/com/macys/dao/database/DBObject.java: -------------------------------------------------------------------------------- 1 | package com.macys.dao.database; 2 | 3 | import java.util.Date; 4 | import java.util.Set; 5 | 6 | import javax.persistence.Column; 7 | import javax.persistence.Entity; 8 | import javax.persistence.FetchType; 9 | import javax.persistence.Id; 10 | import javax.persistence.OneToMany; 11 | import javax.persistence.Table; 12 | import javax.persistence.Temporal; 13 | import javax.persistence.TemporalType; 14 | import javax.persistence.Version; 15 | import javax.validation.constraints.NotNull; 16 | 17 | import org.apache.commons.lang3.builder.ReflectionToStringBuilder; 18 | import org.apache.commons.lang3.builder.ToStringStyle; 19 | import org.springframework.util.ObjectUtils; 20 | 21 | import com.macys.domain.business.common.BusinessObjectTypeEnum; 22 | 23 | @Entity 24 | @Table(name = "dbobject") 25 | public class DBObject extends DBAbstractBase { 26 | 27 | private static final long serialVersionUID = 1L; 28 | 29 | @Column(name="counter", unique=true, insertable=false, updatable=false) 30 | private Integer counter; 31 | 32 | @Column(name = "client_id") 33 | @NotNull 34 | private Short clientId = 0; //default value is 0 35 | 36 | @Column(name = "type", length=5) 37 | @NotNull 38 | private String type; 39 | 40 | @Id 41 | @Column(name="uuid", unique=true, updatable=false, length=32) 42 | @NotNull 43 | private String uuid; 44 | 45 | @Version 46 | @Column(name = "version") 47 | private Integer version = 0; //default value is 0 48 | 49 | @Column(name = "name", length = 255) 50 | private String name; 51 | 52 | @Column(name = "created_by", length=32) 53 | @NotNull 54 | private String createdBy; 55 | 56 | @Column(name = "created_on") 57 | @Temporal(TemporalType.TIMESTAMP) 58 | private Date createdOn; 59 | 60 | @Column(name = "modified_by", length=32) 61 | private String modifiedBy; 62 | 63 | @Column(name = "modified_on") 64 | @Temporal(TemporalType.TIMESTAMP) 65 | private Date modifiedOn; 66 | 67 | @Column(name = "status") 68 | private Short status; 69 | 70 | @Column(name = "status_modified_on") 71 | @Temporal(TemporalType.TIMESTAMP) 72 | private Date statusModifiedOn; 73 | 74 | @OneToMany(mappedBy="object", fetch=FetchType.EAGER) 75 | private Set metadatas; 76 | 77 | public DBObject() { 78 | this.createdOn = new Date(); 79 | } 80 | 81 | public DBObject(BusinessObjectTypeEnum type) { 82 | this.type = type.getType(); 83 | setUuid(type.newRandomUuid()); 84 | this.createdOn = new Date(); 85 | } 86 | 87 | public DBObject(BusinessObjectTypeEnum type, String name, String createdBy) { 88 | setUuid(type.newRandomUuid()); 89 | // this.clientId = 0; 90 | this.type = type.getType(); 91 | this.name = name; 92 | this.createdBy = createdBy; 93 | this.status = 0; 94 | this.createdOn = new Date(); 95 | } 96 | 97 | @Override 98 | public boolean equals(Object obj) { 99 | 100 | if(obj instanceof DBObject) { 101 | return ObjectUtils.nullSafeEquals(this.uuid, ((DBObject)obj).uuid); 102 | } 103 | 104 | return super.equals(obj); 105 | } 106 | 107 | @Override 108 | public int hashCode() { 109 | return ObjectUtils.nullSafeHashCode(this.uuid); 110 | } 111 | 112 | public Integer getCounter() { 113 | return counter; 114 | } 115 | 116 | public void setCounter(Integer counter) { 117 | this.counter = counter; 118 | } 119 | 120 | public String getType() { 121 | return type; 122 | } 123 | 124 | public void setType(String type) { 125 | this.type = type; 126 | } 127 | 128 | public String getUuid() { 129 | return uuid; 130 | } 131 | 132 | public void setUuid(String uuid) { 133 | this.uuid = uuid; 134 | } 135 | 136 | public Integer getVersion() { 137 | return version; 138 | } 139 | 140 | public void setVersion(Integer version) { 141 | this.version = version; 142 | } 143 | 144 | public String getName() { 145 | return name; 146 | } 147 | 148 | public void setName(String name) { 149 | this.name = name; 150 | } 151 | 152 | public String getCreatedBy() { 153 | return createdBy; 154 | } 155 | 156 | public void setCreatedBy(String createdBy) { 157 | this.createdBy = createdBy; 158 | } 159 | 160 | public Date getCreatedOn() { 161 | return createdOn; 162 | } 163 | 164 | public void setCreatedOn(Date createdOn) { 165 | this.createdOn = createdOn; 166 | } 167 | 168 | public String getModifiedBy() { 169 | return modifiedBy; 170 | } 171 | 172 | public void setModifiedBy(String modifiedBy) { 173 | this.modifiedBy = modifiedBy; 174 | } 175 | 176 | public Date getModifiedOn() { 177 | return modifiedOn; 178 | } 179 | 180 | public void setModifiedOn(Date modifiedOn) { 181 | this.modifiedOn = modifiedOn; 182 | } 183 | 184 | public Short getStatus() { 185 | return status; 186 | } 187 | 188 | public void setStatus(Short status) { 189 | this.status = status; 190 | } 191 | 192 | public Date getStatusModifiedOn() { 193 | return statusModifiedOn; 194 | } 195 | 196 | public void setStatusModifiedOn(Date statusModifiedOn) { 197 | this.statusModifiedOn = statusModifiedOn; 198 | } 199 | 200 | public Set getMetadatas() { 201 | return metadatas; 202 | } 203 | 204 | public void setMetadatas(Set metadatas) { 205 | this.metadatas = metadatas; 206 | } 207 | 208 | public String toString() { 209 | return new ReflectionToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE).setExcludeFieldNames(new String[]{""}).toString(); 210 | } 211 | 212 | } 213 | -------------------------------------------------------------------------------- /src/applicationContext.xml: -------------------------------------------------------------------------------- 1 | 2 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | org.hibernate.dialect.MySQLDialect 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | -------------------------------------------------------------------------------- /pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4.0.0 3 | fillthecupserver 4 | ${project.version} 5 | war 6 | 7 | src 8 | 9 | 10 | maven-compiler-plugin 11 | 3.1 12 | 13 | 1.7 14 | 1.7 15 | 16 | 17 | 18 | maven-war-plugin 19 | 2.3 20 | 21 | WebRoot 22 | false 23 | 3.1 24 | 25 | 26 | 27 | 28 | 29 | 30 | javax.ws.rs 31 | javax.ws.rs-api 32 | ${jaxrs.api.version} 33 | 34 | 35 | org.apache.cxf 36 | cxf-rt-frontend-jaxws 37 | ${cxf.version} 38 | 39 | 40 | org.apache.cxf 41 | cxf-rt-frontend-jaxrs 42 | ${cxf.version} 43 | 44 | 45 | org.apache.cxf 46 | cxf-rt-transports-http 47 | ${cxf.version} 48 | 49 | 50 | org.apache.cxf 51 | cxf-rt-rs-extension-providers 52 | ${cxf.version} 53 | compile 54 | 55 | 56 | 57 | 58 | 59 | 60 | org.slf4j 61 | slf4j-log4j12 62 | 1.7.10 63 | 64 | 65 | 66 | org.springframework 67 | spring-core 68 | ${spring.version} 69 | 70 | 71 | org.springframework 72 | spring-web 73 | ${spring.version} 74 | 75 | 76 | org.springframework 77 | spring-context 78 | ${spring.version} 79 | 80 | 81 | 82 | commons-logging 83 | commons-logging 84 | 85 | 86 | 87 | 88 | 89 | org.codehaus.jackson 90 | jackson-jaxrs 91 | 1.9.13 92 | 93 | 94 | 95 | net.sf.flexjson 96 | flexjson 97 | 2.1 98 | 99 | 100 | 101 | 102 | org.codehaus.jettison 103 | jettison 104 | 1.3.7 105 | 106 | 107 | mysql 108 | mysql-connector-java 109 | 5.1.34 110 | 111 | 112 | javax.mail 113 | mail 114 | 1.4 115 | 116 | 117 | javax.activation 118 | activation 119 | 1.1.1 120 | 121 | 122 | 123 | 130 | 131 | 132 | 133 | org.jasypt 134 | jasypt 135 | 1.9.2 136 | 137 | 138 | org.apache.commons 139 | commons-lang3 140 | 3.3.2 141 | 142 | 143 | 144 | com.wordnik 145 | swagger-annotations_2.10 146 | 1.3.0 147 | 148 | 149 | com.wordnik 150 | swagger-core_2.10 151 | 1.3.0 152 | 153 | 154 | com.wordnik 155 | swagger-jaxrs_2.10 156 | 1.3.0 157 | 158 | 159 | 160 | javax.servlet 161 | servlet-api 162 | 2.5 163 | 164 | 165 | javax.validation 166 | validation-api 167 | 1.0.0.GA 168 | 169 | 170 | org.hibernate 171 | hibernate-entitymanager 172 | ${hibernate.version} 173 | 174 | 175 | org.springframework.data 176 | spring-data-jpa 177 | 1.7.2.RELEASE 178 | 179 | 180 | com.google.code.gson 181 | gson 182 | 2.3.1 183 | 184 | 185 | 186 | 1.0 187 | 2.0.1 188 | 3.0.2 189 | 4.1.3.RELEASE 190 | 4.3.1.Final 191 | 192 | fillthecupserver 193 | -------------------------------------------------------------------------------- /src/com/macys/dao/ReflectionUtils.java: -------------------------------------------------------------------------------- 1 | package com.macys.dao; 2 | 3 | import java.beans.IntrospectionException; 4 | import java.beans.PropertyDescriptor; 5 | import java.lang.annotation.Annotation; 6 | import java.lang.reflect.Constructor; 7 | import java.lang.reflect.Field; 8 | import java.lang.reflect.InvocationTargetException; 9 | import java.lang.reflect.Method; 10 | import java.util.ArrayList; 11 | import java.util.Collections; 12 | import java.util.HashMap; 13 | import java.util.List; 14 | import java.util.Map; 15 | import java.util.Set; 16 | 17 | import org.reflections.Reflections; 18 | 19 | import com.macys.dao.database.DBObject; 20 | import com.macys.dao.database.DBObjectMetadata; 21 | import com.macys.dao.database.pk.DBObjectMetadataPK; 22 | import com.macys.domain.business.BusinessObject; 23 | import com.macys.domain.business.BusinessObjectImpl; 24 | import com.macys.domain.business.common.BusinessObjectTypeEnum; 25 | import com.macys.domain.business.common.annotations.PersistentBusinessObject; 26 | import com.macys.domain.business.common.annotations.PersistentMetadata; 27 | import com.macys.exceptions.ErrorCodeEnum; 28 | import com.macys.exceptions.ServiceException; 29 | 30 | 31 | public class ReflectionUtils { 32 | 33 | static Reflections reflections = new Reflections("com.macys"); 34 | 35 | static Set> subTypesOfBusinessObjectImpl = reflections.getSubTypesOf(BusinessObjectImpl.class); 36 | 37 | public static BusinessObject constructBusinessObject(BusinessObjectTypeEnum type) throws ServiceException { 38 | return constructBusinessObject(type, new DBObject(type)); 39 | } 40 | 41 | public static BusinessObject constructBusinessObject(BusinessObjectTypeEnum type, DBObject dbObject) throws ServiceException { 42 | 43 | Set> classes = reflections.getTypesAnnotatedWith(PersistentBusinessObject.class); 44 | 45 | Class clazzOfBO = null; 46 | for(Class clazz:classes) { 47 | for(Annotation annotation:clazz.getAnnotations()) { 48 | if(annotation instanceof PersistentBusinessObject) { 49 | PersistentBusinessObject annotation2 = (PersistentBusinessObject) annotation; 50 | if(annotation2.type() == type) { 51 | clazzOfBO = clazz; 52 | break; 53 | } 54 | } 55 | } 56 | 57 | if(clazzOfBO != null) { 58 | break; 59 | } 60 | } 61 | 62 | if(clazzOfBO == null) { 63 | //clazzOfBO = TestBOImpl.class; 64 | return null; 65 | } 66 | 67 | BusinessObject bo = null; 68 | try { 69 | Constructor ctor = clazzOfBO.getDeclaredConstructor(DBObject.class); 70 | ctor.setAccessible(true); 71 | bo = (BusinessObject) ctor.newInstance(dbObject); 72 | ((BusinessObjectImpl)bo).setType(type.getType()); 73 | 74 | } catch (InstantiationException | NoSuchMethodException | SecurityException | IllegalAccessException | IllegalArgumentException | InvocationTargetException e) { 75 | e.printStackTrace(); 76 | } 77 | 78 | if(bo == null) { 79 | throw new ServiceException("Error init BusinessObject type=" + type+ ". Make Sure the BusinessObject is annotated with OTPersistentBusinessObject",ErrorCodeEnum.MISSING_ANNOTATION); 80 | } 81 | 82 | return bo; 83 | } 84 | 85 | public static List beanPropertyDescriptorsWithPersistentMetadataAnnotation(BusinessObject businessObject) throws IntrospectionException { 86 | 87 | List getterSettorMethodDescriptors = new ArrayList(); 88 | 89 | Field[] fields = businessObject.getClass().getDeclaredFields(); 90 | 91 | for(Field field:fields) { 92 | if(field.isAnnotationPresent(PersistentMetadata.class)) { 93 | if(String.class.equals(field.getType())) { 94 | String name = field.getName(); 95 | getterSettorMethodDescriptors.add(new PropertyDescriptor(name, businessObject.getClass())); 96 | 97 | } 98 | } 99 | } 100 | 101 | return getterSettorMethodDescriptors; 102 | 103 | } 104 | 105 | public static List annotatedMetadata(BusinessObject businessObject) throws ServiceException { 106 | 107 | try { 108 | List metadataPropertyDescriptors = beanPropertyDescriptorsWithPersistentMetadataAnnotation(businessObject); 109 | 110 | List metadata = new ArrayList(); 111 | 112 | for(PropertyDescriptor propertyDescriptor:metadataPropertyDescriptors) { 113 | 114 | String name = propertyDescriptor.getName(); 115 | 116 | try { 117 | Method getter = propertyDescriptor.getReadMethod(); 118 | 119 | Object object = getter.invoke(businessObject); 120 | 121 | String value = (String) object; 122 | if(value != null) { 123 | 124 | DBObjectMetadataPK pk = new DBObjectMetadataPK(businessObject.getUuid(), name); 125 | DBObjectMetadata md = new DBObjectMetadata(pk, value, ""); 126 | metadata.add(md); 127 | } 128 | 129 | } catch (Exception e) { 130 | e.printStackTrace(); 131 | throw new ServiceException("Make sure field " + name + " has public getter and setter", e, ErrorCodeEnum.INTERNAL_SERVER_ERROR); 132 | } 133 | 134 | } 135 | 136 | return metadata; 137 | } catch (IntrospectionException e) { 138 | e.printStackTrace(); 139 | throw new ServiceException(e.getMessage(), e, ErrorCodeEnum.INTERNAL_SERVER_ERROR); 140 | } 141 | 142 | 143 | } 144 | 145 | /** 146 | * 147 | * @param metadatas 148 | * @param targetBusinessObject 149 | * @param setMissingMetadataToNull 150 | * @return 151 | * @throws ServiceException 152 | */ 153 | public static BusinessObject setMetadataToBusinessObject(Set metadatas, BusinessObject targetBusinessObject, boolean setMissingMetadataToNull) throws ServiceException { 154 | 155 | if(metadatas == null) { 156 | metadatas = Collections.emptySet(); 157 | } 158 | 159 | Map nameValueMap = new HashMap(); 160 | 161 | for(DBObjectMetadata md:metadatas) { 162 | nameValueMap.put(md.getPk().getName(), md); 163 | } 164 | 165 | try { 166 | List metadataPropertyDescriptors = beanPropertyDescriptorsWithPersistentMetadataAnnotation(targetBusinessObject); 167 | 168 | for(PropertyDescriptor propertyDescriptor:metadataPropertyDescriptors) { 169 | String name = propertyDescriptor.getName(); 170 | DBObjectMetadata metadata = nameValueMap.get(name); 171 | Method setter = propertyDescriptor.getWriteMethod(); 172 | 173 | String value = null; 174 | if(metadata != null) { 175 | value = metadata.getValue(); 176 | } else { 177 | if(setMissingMetadataToNull == false) { 178 | continue; 179 | } 180 | } 181 | 182 | setter.invoke(targetBusinessObject, value); 183 | } 184 | 185 | } catch (IntrospectionException | IllegalAccessException | IllegalArgumentException | InvocationTargetException e) { 186 | e.printStackTrace(); 187 | throw new ServiceException(e.getMessage(), e, ErrorCodeEnum.INTERNAL_SERVER_ERROR); 188 | } 189 | 190 | 191 | return targetBusinessObject; 192 | } 193 | 194 | } 195 | -------------------------------------------------------------------------------- /WebRoot/apidocs/lib/highlight.7.3.pack.js: -------------------------------------------------------------------------------- 1 | var hljs=new function(){function l(o){return o.replace(/&/gm,"&").replace(//gm,">")}function b(p){for(var o=p.firstChild;o;o=o.nextSibling){if(o.nodeName=="CODE"){return o}if(!(o.nodeType==3&&o.nodeValue.match(/\s+/))){break}}}function h(p,o){return Array.prototype.map.call(p.childNodes,function(q){if(q.nodeType==3){return o?q.nodeValue.replace(/\n/g,""):q.nodeValue}if(q.nodeName=="BR"){return"\n"}return h(q,o)}).join("")}function a(q){var p=(q.className+" "+q.parentNode.className).split(/\s+/);p=p.map(function(r){return r.replace(/^language-/,"")});for(var o=0;o"}while(x.length||v.length){var u=t().splice(0,1)[0];y+=l(w.substr(p,u.offset-p));p=u.offset;if(u.event=="start"){y+=s(u.node);r.push(u.node)}else{if(u.event=="stop"){var o,q=r.length;do{q--;o=r[q];y+=("")}while(o!=u.node);r.splice(q,1);while(q'+L[0]+""}else{r+=L[0]}N=A.lR.lastIndex;L=A.lR.exec(K)}return r+K.substr(N)}function z(){if(A.sL&&!e[A.sL]){return l(w)}var r=A.sL?d(A.sL,w):g(w);if(A.r>0){v+=r.keyword_count;B+=r.r}return''+r.value+""}function J(){return A.sL!==undefined?z():G()}function I(L,r){var K=L.cN?'':"";if(L.rB){x+=K;w=""}else{if(L.eB){x+=l(r)+K;w=""}else{x+=K;w=r}}A=Object.create(L,{parent:{value:A}});B+=L.r}function C(K,r){w+=K;if(r===undefined){x+=J();return 0}var L=o(r,A);if(L){x+=J();I(L,r);return L.rB?0:r.length}var M=s(A,r);if(M){if(!(M.rE||M.eE)){w+=r}x+=J();do{if(A.cN){x+=""}A=A.parent}while(A!=M.parent);if(M.eE){x+=l(r)}w="";if(M.starts){I(M.starts,"")}return M.rE?0:r.length}if(t(r,A)){throw"Illegal"}w+=r;return r.length||1}var F=e[D];f(F);var A=F;var w="";var B=0;var v=0;var x="";try{var u,q,p=0;while(true){A.t.lastIndex=p;u=A.t.exec(E);if(!u){break}q=C(E.substr(p,u.index-p),u[0]);p=u.index+q}C(E.substr(p));return{r:B,keyword_count:v,value:x,language:D}}catch(H){if(H=="Illegal"){return{r:0,keyword_count:0,value:l(E)}}else{throw H}}}function g(s){var o={keyword_count:0,r:0,value:l(s)};var q=o;for(var p in e){if(!e.hasOwnProperty(p)){continue}var r=d(p,s);r.language=p;if(r.keyword_count+r.r>q.keyword_count+q.r){q=r}if(r.keyword_count+r.r>o.keyword_count+o.r){q=o;o=r}}if(q.language){o.second_best=q}return o}function i(q,p,o){if(p){q=q.replace(/^((<[^>]+>|\t)+)/gm,function(r,v,u,t){return v.replace(/\t/g,p)})}if(o){q=q.replace(/\n/g,"
")}return q}function m(r,u,p){var v=h(r,p);var t=a(r);if(t=="no-highlight"){return}var w=t?d(t,v):g(v);t=w.language;var o=c(r);if(o.length){var q=document.createElement("pre");q.innerHTML=w.value;w.value=j(o,c(q),v)}w.value=i(w.value,u,p);var s=r.className;if(!s.match("(\\s|^)(language-)?"+t+"(\\s|$)")){s=s?(s+" "+t):t}r.innerHTML=w.value;r.className=s;r.result={language:t,kw:w.keyword_count,re:w.r};if(w.second_best){r.second_best={language:w.second_best.language,kw:w.second_best.keyword_count,re:w.second_best.r}}}function n(){if(n.called){return}n.called=true;Array.prototype.map.call(document.getElementsByTagName("pre"),b).filter(Boolean).forEach(function(o){m(o,hljs.tabReplace)})}function k(){window.addEventListener("DOMContentLoaded",n,false);window.addEventListener("load",n,false)}var e={};this.LANGUAGES=e;this.highlight=d;this.highlightAuto=g;this.fixMarkup=i;this.highlightBlock=m;this.initHighlighting=n;this.initHighlightingOnLoad=k;this.IR="[a-zA-Z][a-zA-Z0-9_]*";this.UIR="[a-zA-Z_][a-zA-Z0-9_]*";this.NR="\\b\\d+(\\.\\d+)?";this.CNR="(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)";this.BNR="\\b(0b[01]+)";this.RSR="!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|\\.|-|-=|/|/=|:|;|<|<<|<<=|<=|=|==|===|>|>=|>>|>>=|>>>|>>>=|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~";this.BE={b:"\\\\[\\s\\S]",r:0};this.ASM={cN:"string",b:"'",e:"'",i:"\\n",c:[this.BE],r:0};this.QSM={cN:"string",b:'"',e:'"',i:"\\n",c:[this.BE],r:0};this.CLCM={cN:"comment",b:"//",e:"$"};this.CBLCLM={cN:"comment",b:"/\\*",e:"\\*/"};this.HCM={cN:"comment",b:"#",e:"$"};this.NM={cN:"number",b:this.NR,r:0};this.CNM={cN:"number",b:this.CNR,r:0};this.BNM={cN:"number",b:this.BNR,r:0};this.inherit=function(q,r){var o={};for(var p in q){o[p]=q[p]}if(r){for(var p in r){o[p]=r[p]}}return o}}();hljs.LANGUAGES.xml=function(a){var c="[A-Za-z0-9\\._:-]+";var b={eW:true,c:[{cN:"attribute",b:c,r:0},{b:'="',rB:true,e:'"',c:[{cN:"value",b:'"',eW:true}]},{b:"='",rB:true,e:"'",c:[{cN:"value",b:"'",eW:true}]},{b:"=",c:[{cN:"value",b:"[^\\s/>]+"}]}]};return{cI:true,c:[{cN:"pi",b:"<\\?",e:"\\?>",r:10},{cN:"doctype",b:"",r:10,c:[{b:"\\[",e:"\\]"}]},{cN:"comment",b:"",r:10},{cN:"cdata",b:"<\\!\\[CDATA\\[",e:"\\]\\]>",r:10},{cN:"tag",b:"|$)",e:">",k:{title:"style"},c:[b],starts:{e:"",rE:true,sL:"css"}},{cN:"tag",b:"|$)",e:">",k:{title:"script"},c:[b],starts:{e:"<\/script>",rE:true,sL:"javascript"}},{b:"<%",e:"%>",sL:"vbscript"},{cN:"tag",b:"",c:[{cN:"title",b:"[^ />]+"},b]}]}}(hljs);hljs.LANGUAGES.json=function(a){var e={literal:"true false null"};var d=[a.QSM,a.CNM];var c={cN:"value",e:",",eW:true,eE:true,c:d,k:e};var b={b:"{",e:"}",c:[{cN:"attribute",b:'\\s*"',e:'"\\s*:\\s*',eB:true,eE:true,c:[a.BE],i:"\\n",starts:c}],i:"\\S"};var f={b:"\\[",e:"\\]",c:[a.inherit(c,{cN:null})],i:"\\S"};d.splice(d.length,0,b,f);return{c:d,k:e,i:"\\S"}}(hljs); -------------------------------------------------------------------------------- /WebRoot/apidocs/lib/swagger-oauth.js: -------------------------------------------------------------------------------- 1 | var appName; 2 | var popupMask; 3 | var popupDialog; 4 | var clientId; 5 | var realm; 6 | 7 | function handleLogin() { 8 | var scopes = []; 9 | 10 | if(window.swaggerUi.api.authSchemes 11 | && window.swaggerUi.api.authSchemes.oauth2 12 | && window.swaggerUi.api.authSchemes.oauth2.scopes) { 13 | scopes = window.swaggerUi.api.authSchemes.oauth2.scopes; 14 | } 15 | 16 | if(window.swaggerUi.api 17 | && window.swaggerUi.api.info) { 18 | appName = window.swaggerUi.api.info.title; 19 | } 20 | 21 | if(popupDialog.length > 0) 22 | popupDialog = popupDialog.last(); 23 | else { 24 | popupDialog = $( 25 | [ 26 | '
', 27 | '
Select OAuth2.0 Scopes
', 28 | '
', 29 | '

Scopes are used to grant an application different levels of access to data on behalf of the end user. Each API may declare one or more scopes.', 30 | 'Learn how to use', 31 | '

', 32 | '

' + appName + ' API requires the following scopes. Select which ones you want to grant to Swagger UI.

', 33 | '
    ', 34 | '
', 35 | '

', 36 | '
', 37 | '
', 38 | '
'].join('')); 39 | $(document.body).append(popupDialog); 40 | 41 | popup = popupDialog.find('ul.api-popup-scopes').empty(); 42 | for (i = 0; i < scopes.length; i ++) { 43 | scope = scopes[i]; 44 | str = '
  • ' + '
  • '; 49 | popup.append(str); 50 | } 51 | } 52 | 53 | var $win = $(window), 54 | dw = $win.width(), 55 | dh = $win.height(), 56 | st = $win.scrollTop(), 57 | dlgWd = popupDialog.outerWidth(), 58 | dlgHt = popupDialog.outerHeight(), 59 | top = (dh -dlgHt)/2 + st, 60 | left = (dw - dlgWd)/2; 61 | 62 | popupDialog.css({ 63 | top: (top < 0? 0 : top) + 'px', 64 | left: (left < 0? 0 : left) + 'px' 65 | }); 66 | 67 | popupDialog.find('button.api-popup-cancel').click(function() { 68 | popupMask.hide(); 69 | popupDialog.hide(); 70 | }); 71 | popupDialog.find('button.api-popup-authbtn').click(function() { 72 | popupMask.hide(); 73 | popupDialog.hide(); 74 | 75 | var authSchemes = window.swaggerUi.api.authSchemes; 76 | var host = window.location; 77 | var redirectUrl = host.protocol + '//' + host.host + "/o2c.html"; 78 | var url = null; 79 | 80 | var p = window.swaggerUi.api.authSchemes; 81 | for (var key in p) { 82 | if (p.hasOwnProperty(key)) { 83 | var o = p[key].grantTypes; 84 | for(var t in o) { 85 | if(o.hasOwnProperty(t) && t === 'implicit') { 86 | var dets = o[t]; 87 | url = dets.loginEndpoint.url + "?response_type=token"; 88 | window.swaggerUi.tokenName = dets.tokenName; 89 | } 90 | } 91 | } 92 | } 93 | var scopes = [] 94 | var o = $('.api-popup-scopes').find('input:checked'); 95 | 96 | for(k =0; k < o.length; k++) { 97 | scopes.push($(o[k]).attr("scope")); 98 | } 99 | 100 | window.enabledScopes=scopes; 101 | 102 | url += '&redirect_uri=' + encodeURIComponent(redirectUrl); 103 | url += '&realm=' + encodeURIComponent(realm); 104 | url += '&client_id=' + encodeURIComponent(clientId); 105 | url += '&scope=' + encodeURIComponent(scopes); 106 | 107 | window.open(url); 108 | }); 109 | 110 | popupMask.show(); 111 | popupDialog.show(); 112 | return; 113 | } 114 | 115 | 116 | function handleLogout() { 117 | for(key in window.authorizations.authz){ 118 | window.authorizations.remove(key) 119 | } 120 | window.enabledScopes = null; 121 | $('.api-ic.ic-on').addClass('ic-off'); 122 | $('.api-ic.ic-on').removeClass('ic-on'); 123 | 124 | // set the info box 125 | $('.api-ic.ic-warning').addClass('ic-error'); 126 | $('.api-ic.ic-warning').removeClass('ic-warning'); 127 | } 128 | 129 | function initOAuth(opts) { 130 | var o = (opts||{}); 131 | var errors = []; 132 | 133 | appName = (o.appName||errors.push("missing appName")); 134 | popupMask = (o.popupMask||$('#api-common-mask')); 135 | popupDialog = (o.popupDialog||$('.api-popup-dialog')); 136 | clientId = (o.clientId||errors.push("missing client id")); 137 | realm = (o.realm||errors.push("missing realm")); 138 | 139 | if(errors.length > 0){ 140 | log("auth unable initialize oauth: " + errors); 141 | return; 142 | } 143 | 144 | $('pre code').each(function(i, e) {hljs.highlightBlock(e)}); 145 | $('.api-ic').click(function(s) { 146 | if($(s.target).hasClass('ic-off')) 147 | handleLogin(); 148 | else { 149 | handleLogout(); 150 | } 151 | false; 152 | }); 153 | } 154 | 155 | function onOAuthComplete(token) { 156 | if(token) { 157 | if(token.error) { 158 | var checkbox = $('input[type=checkbox],.secured') 159 | checkbox.each(function(pos){ 160 | checkbox[pos].checked = false; 161 | }); 162 | alert(token.error); 163 | } 164 | else { 165 | var b = token[window.swaggerUi.tokenName]; 166 | if(b){ 167 | // if all roles are satisfied 168 | var o = null; 169 | $.each($('.auth #api_information_panel'), function(k, v) { 170 | var children = v; 171 | if(children && children.childNodes) { 172 | var requiredScopes = []; 173 | $.each((children.childNodes), function (k1, v1){ 174 | var inner = v1.innerHTML; 175 | if(inner) 176 | requiredScopes.push(inner); 177 | }); 178 | var diff = []; 179 | for(var i=0; i < requiredScopes.length; i++) { 180 | var s = requiredScopes[i]; 181 | if(window.enabledScopes && window.enabledScopes.indexOf(s) == -1) { 182 | diff.push(s); 183 | } 184 | } 185 | if(diff.length > 0){ 186 | o = v.parentNode; 187 | $(o.parentNode).find('.api-ic.ic-on').addClass('ic-off'); 188 | $(o.parentNode).find('.api-ic.ic-on').removeClass('ic-on'); 189 | 190 | // sorry, not all scopes are satisfied 191 | $(o).find('.api-ic').addClass('ic-warning'); 192 | $(o).find('.api-ic').removeClass('ic-error'); 193 | } 194 | else { 195 | o = v.parentNode; 196 | $(o.parentNode).find('.api-ic.ic-off').addClass('ic-on'); 197 | $(o.parentNode).find('.api-ic.ic-off').removeClass('ic-off'); 198 | 199 | // all scopes are satisfied 200 | $(o).find('.api-ic').addClass('ic-info'); 201 | $(o).find('.api-ic').removeClass('ic-warning'); 202 | $(o).find('.api-ic').removeClass('ic-error'); 203 | } 204 | } 205 | }); 206 | 207 | window.authorizations.add("key", new ApiKeyAuthorization("Authorization", "Bearer " + b, "header")); 208 | } 209 | } 210 | } 211 | } -------------------------------------------------------------------------------- /src/com/macys/services/UserService.java: -------------------------------------------------------------------------------- 1 | package com.macys.services; 2 | 3 | import java.util.ArrayList; 4 | import java.util.List; 5 | 6 | import org.apache.commons.lang3.StringUtils; 7 | import org.apache.log4j.Logger; 8 | 9 | import com.macys.domain.Lab; 10 | import com.macys.domain.User; 11 | import com.macys.domain.business.BusinessObject; 12 | import com.macys.domain.business.common.BusinessObjectTypeEnum; 13 | import com.macys.domain.business.common.Relationship; 14 | import com.macys.domain.business.common.RelationshipTypeEnum; 15 | import com.macys.exceptions.ErrorCodeEnum; 16 | import com.macys.exceptions.ServiceException; 17 | import com.macys.utils.Constants; 18 | import com.macys.utils.EncryptionUtils; 19 | import com.macys.utils.ServiceUtils; 20 | import com.macys.valuesobjects.LabVo; 21 | import com.macys.valuesobjects.UserVo; 22 | 23 | /** 24 | * @author Umair ABBASI 25 | * 26 | */ 27 | public class UserService extends BaseService{ 28 | 29 | protected final Logger log = Logger.getLogger(UserService.class); 30 | 31 | private LabService labService; 32 | 33 | public UserVo login(String userName, String password) throws ServiceException{ 34 | try{ 35 | ServiceUtils.verifyNotBlank(userName, "UserName"); 36 | ServiceUtils.verifyNotBlank(password, "Password"); 37 | 38 | List userUuids = dao.findUuidsByMetadata(BusinessObjectTypeEnum.USER, "userName", userName); 39 | if(userUuids == null || userUuids.size() < 1) { 40 | throw new ServiceException("User with userName:"+userName+" not found.",ErrorCodeEnum.USER_NOT_FOUND); 41 | } 42 | 43 | User user = (User) dao.getBusinessObjectByUuid(userUuids.get(0)); 44 | 45 | if(!EncryptionUtils.checkPassword(password, user.getPassword())){ 46 | throw new ServiceException("Invalid credentials.", ErrorCodeEnum.INVALID_CREDENTIALS); 47 | } 48 | 49 | UserVo userVo = (UserVo)user.createDTO(); 50 | userVo.labs = new ArrayList(); 51 | 52 | //Get Labs of user 53 | List relationsLabUsers = dao.findRelationshipByChildUuidAndType(user.getUuid(),RelationshipTypeEnum.LAB_USER.toString()); 54 | for (Relationship relationship : relationsLabUsers) { 55 | Lab lab = (Lab)dao.getBusinessObjectByUuid( relationship.getParentUuid() ); 56 | if(lab !=null && lab.getIsActivated().equals("true")){ 57 | LabVo labVo = (LabVo)lab.createDTO(); 58 | //labVo.releaseCups = labService.getAllReleaseCupsByLabUuid(lab.getUuid()); 59 | userVo.labs.add(labVo); 60 | } 61 | } 62 | 63 | return userVo; 64 | } 65 | catch(ServiceException exc){ 66 | throw exc; 67 | } 68 | catch(Exception exc){ 69 | throw new ServiceException(exc.getMessage(), exc, ErrorCodeEnum.INTERNAL_SERVER_ERROR); 70 | } 71 | } 72 | 73 | public UserVo createUser(String firstName, String lastName, String userEmail, String userName, String password, String isSuperAdmin, String isLabManager, String isLabUser,String isPasswordReset,String createdBy) throws ServiceException{ 74 | ServiceUtils.verifyNotBlank(userName, "userName"); 75 | ServiceUtils.verifyNotBlank(password, "password"); 76 | ServiceUtils.verifyNotBlank(firstName, "firstName"); 77 | 78 | //check if a user with this username already exists 79 | List userUuids = dao.findUuidsByMetadata(BusinessObjectTypeEnum.USER, "userName", userName); 80 | 81 | //if a user with this username already exists, then dont create a new one 82 | if(userUuids.size() > 0) { 83 | throw new ServiceException("Username:"+userName+" already exists.",ErrorCodeEnum.USERNAME_ALREADY_EXISTS); 84 | } 85 | 86 | User user = (User)dao.emptyBusinessObject(BusinessObjectTypeEnum.USER, userName, createdBy); 87 | user.setUserName(userName); 88 | user.setPassword(EncryptionUtils.encryptPassword( password )); 89 | user.setFirstName(firstName); 90 | user.setLastName(lastName); 91 | user.setUserEmail(userEmail); 92 | user.setIsPasswordReset(isPasswordReset); 93 | user.setIsSuperAdmin( StringUtils.isBlank(isSuperAdmin) ? "false" : isSuperAdmin ); 94 | user.setIsLabManager( StringUtils.isBlank(isLabManager) ? "false" : isLabManager ); 95 | user.setIsLabUser( StringUtils.isBlank(isLabUser) ? "false" : isLabUser ); 96 | 97 | user = (User)dao.saveBusinessObject(user); 98 | 99 | return (UserVo)user.createDTO(); 100 | } 101 | 102 | 103 | public UserVo createLabAndUser(String firstName, String lastName, String userEmail, String labName, String managerName, String pdmName,String userName,String password, String isSuperAdmin,String isLabManager, String isLabUser) throws ServiceException { 104 | 105 | //First Create The User 106 | UserVo userVo = createUser(firstName,lastName,userEmail,userName, password, isSuperAdmin, isLabManager, isLabUser,"false",firstName+" "+lastName); 107 | 108 | //Second Create The Lab 109 | LabVo labVo = labService.createLab(labName, managerName, pdmName,firstName+" "+lastName); 110 | 111 | //Save the relationship b/w lab and user 112 | dao.saveRelationship(labVo.uuid, userVo.uuid, RelationshipTypeEnum.LAB_USER.toString(), Constants.SYSTEM_USER); 113 | 114 | userVo.labs = new ArrayList(); 115 | userVo.labs.add(labVo); 116 | 117 | return userVo; 118 | 119 | } 120 | 121 | public void setLabService(LabService labService) { 122 | this.labService = labService; 123 | } 124 | 125 | public List getAllUsersByLabUuid(String labUuid) throws ServiceException { 126 | List listToReturn = new ArrayList(); 127 | 128 | List relations = dao.findChildrenWithRelationshipType(labUuid, RelationshipTypeEnum.LAB_USER); 129 | for (Relationship relationship : relations) { 130 | User user = (User)dao.getBusinessObjectByUuid( relationship.getChildUuid() ); 131 | if(user !=null){ 132 | UserVo userVo = (UserVo)user.createDTO(); 133 | listToReturn.add(userVo); 134 | } 135 | } 136 | return listToReturn; 137 | } 138 | 139 | public List getAllUsers() throws ServiceException { 140 | List users = new ArrayList(); 141 | 142 | List businessObjects = dao.findBusinessObjectsByType(BusinessObjectTypeEnum.USER); 143 | if(businessObjects != null){ 144 | for (BusinessObject businessObject : businessObjects) { 145 | User user = (User) businessObject; 146 | users.add((UserVo)user.createDTO()); 147 | } 148 | } 149 | return users; 150 | } 151 | 152 | public void passwordReset(String username) throws ServiceException { 153 | 154 | ServiceUtils.verifyNotBlank(username, "username"); 155 | 156 | User user = (User)dao.findBusinessObjectByMetadata(BusinessObjectTypeEnum.USER, "userName", username); 157 | if(user == null) 158 | throw new ServiceException("User not found.", ErrorCodeEnum.USER_NOT_FOUND); 159 | 160 | String randomPassword = "temp123"; 161 | user.setPassword(EncryptionUtils.encryptPassword(randomPassword)); 162 | user.setIsPasswordReset("true"); 163 | dao.saveBusinessObject(user); 164 | } 165 | 166 | public void passwordChange(String username, String newpassword) throws ServiceException { 167 | ServiceUtils.verifyNotBlank(username, "username"); 168 | ServiceUtils.verifyNotBlank(newpassword, "newpassword"); 169 | 170 | User user = (User)dao.findBusinessObjectByMetadata(BusinessObjectTypeEnum.USER, "userName", username); 171 | if(user == null) 172 | throw new ServiceException("User not found.", ErrorCodeEnum.USER_NOT_FOUND); 173 | 174 | user.setPassword(EncryptionUtils.encryptPassword(newpassword)); 175 | user.setIsPasswordReset("false"); 176 | dao.saveBusinessObject(user); 177 | } 178 | 179 | 180 | } 181 | 182 | -------------------------------------------------------------------------------- /WebRoot/apidocs/lib/shred/content.js: -------------------------------------------------------------------------------- 1 | 2 | // The purpose of the `Content` object is to abstract away the data conversions 3 | // to and from raw content entities as strings. For example, you want to be able 4 | // to pass in a Javascript object and have it be automatically converted into a 5 | // JSON string if the `content-type` is set to a JSON-based media type. 6 | // Conversely, you want to be able to transparently get back a Javascript object 7 | // in the response if the `content-type` is a JSON-based media-type. 8 | 9 | // One limitation of the current implementation is that it [assumes the `charset` is UTF-8](https://github.com/spire-io/shred/issues/5). 10 | 11 | // The `Content` constructor takes an options object, which *must* have either a 12 | // `body` or `data` property and *may* have a `type` property indicating the 13 | // media type. If there is no `type` attribute, a default will be inferred. 14 | var Content = function(options) { 15 | this.body = options.body; 16 | this.data = options.data; 17 | this.type = options.type; 18 | }; 19 | 20 | Content.prototype = { 21 | // Treat `toString()` as asking for the `content.body`. That is, the raw content entity. 22 | // 23 | // toString: function() { return this.body; } 24 | // 25 | // Commented out, but I've forgotten why. :/ 26 | }; 27 | 28 | 29 | // `Content` objects have the following attributes: 30 | Object.defineProperties(Content.prototype,{ 31 | 32 | // - **type**. Typically accessed as `content.type`, reflects the `content-type` 33 | // header associated with the request or response. If not passed as an options 34 | // to the constructor or set explicitly, it will infer the type the `data` 35 | // attribute, if possible, and, failing that, will default to `text/plain`. 36 | type: { 37 | get: function() { 38 | if (this._type) { 39 | return this._type; 40 | } else { 41 | if (this._data) { 42 | switch(typeof this._data) { 43 | case "string": return "text/plain"; 44 | case "object": return "application/json"; 45 | } 46 | } 47 | } 48 | return "text/plain"; 49 | }, 50 | set: function(value) { 51 | this._type = value; 52 | return this; 53 | }, 54 | enumerable: true 55 | }, 56 | 57 | // - **data**. Typically accessed as `content.data`, reflects the content entity 58 | // converted into Javascript data. This can be a string, if the `type` is, say, 59 | // `text/plain`, but can also be a Javascript object. The conversion applied is 60 | // based on the `processor` attribute. The `data` attribute can also be set 61 | // directly, in which case the conversion will be done the other way, to infer 62 | // the `body` attribute. 63 | data: { 64 | get: function() { 65 | if (this._body) { 66 | return this.processor.parser(this._body); 67 | } else { 68 | return this._data; 69 | } 70 | }, 71 | set: function(data) { 72 | if (this._body&&data) Errors.setDataWithBody(this); 73 | this._data = data; 74 | return this; 75 | }, 76 | enumerable: true 77 | }, 78 | 79 | // - **body**. Typically accessed as `content.body`, reflects the content entity 80 | // as a UTF-8 string. It is the mirror of the `data` attribute. If you set the 81 | // `data` attribute, the `body` attribute will be inferred and vice-versa. If 82 | // you attempt to set both, an exception is raised. 83 | body: { 84 | get: function() { 85 | if (this._data) { 86 | return this.processor.stringify(this._data); 87 | } else { 88 | return this._body.toString(); 89 | } 90 | }, 91 | set: function(body) { 92 | if (this._data&&body) Errors.setBodyWithData(this); 93 | this._body = body; 94 | return this; 95 | }, 96 | enumerable: true 97 | }, 98 | 99 | // - **processor**. The functions that will be used to convert to/from `data` and 100 | // `body` attributes. You can add processors. The two that are built-in are for 101 | // `text/plain`, which is basically an identity transformation and 102 | // `application/json` and other JSON-based media types (including custom media 103 | // types with `+json`). You can add your own processors. See below. 104 | processor: { 105 | get: function() { 106 | var processor = Content.processors[this.type]; 107 | if (processor) { 108 | return processor; 109 | } else { 110 | // Return the first processor that matches any part of the 111 | // content type. ex: application/vnd.foobar.baz+json will match json. 112 | var main = this.type.split(";")[0]; 113 | var parts = main.split(/\+|\//); 114 | for (var i=0, l=parts.length; i < l; i++) { 115 | processor = Content.processors[parts[i]] 116 | } 117 | return processor || {parser:identity,stringify:toString}; 118 | } 119 | }, 120 | enumerable: true 121 | }, 122 | 123 | // - **length**. Typically accessed as `content.length`, returns the length in 124 | // bytes of the raw content entity. 125 | length: { 126 | get: function() { 127 | if (typeof Buffer !== 'undefined') { 128 | return Buffer.byteLength(this.body); 129 | } 130 | return this.body.length; 131 | } 132 | } 133 | }); 134 | 135 | Content.processors = {}; 136 | 137 | // The `registerProcessor` function allows you to add your own processors to 138 | // convert content entities. Each processor consists of a Javascript object with 139 | // two properties: 140 | // - **parser**. The function used to parse a raw content entity and convert it 141 | // into a Javascript data type. 142 | // - **stringify**. The function used to convert a Javascript data type into a 143 | // raw content entity. 144 | Content.registerProcessor = function(types,processor) { 145 | 146 | // You can pass an array of types that will trigger this processor, or just one. 147 | // We determine the array via duck-typing here. 148 | if (types.forEach) { 149 | types.forEach(function(type) { 150 | Content.processors[type] = processor; 151 | }); 152 | } else { 153 | // If you didn't pass an array, we just use what you pass in. 154 | Content.processors[types] = processor; 155 | } 156 | }; 157 | 158 | // Register the identity processor, which is used for text-based media types. 159 | var identity = function(x) { return x; } 160 | , toString = function(x) { return x.toString(); } 161 | Content.registerProcessor( 162 | ["text/html","text/plain","text"], 163 | { parser: identity, stringify: toString }); 164 | 165 | // Register the JSON processor, which is used for JSON-based media types. 166 | Content.registerProcessor( 167 | ["application/json; charset=utf-8","application/json","json"], 168 | { 169 | parser: function(string) { 170 | return JSON.parse(string); 171 | }, 172 | stringify: function(data) { 173 | return JSON.stringify(data); }}); 174 | 175 | var qs = require('querystring'); 176 | // Register the post processor, which is used for JSON-based media types. 177 | Content.registerProcessor( 178 | ["application/x-www-form-urlencoded"], 179 | { parser : qs.parse, stringify : qs.stringify }); 180 | 181 | // Error functions are defined separately here in an attempt to make the code 182 | // easier to read. 183 | var Errors = { 184 | setDataWithBody: function(object) { 185 | throw new Error("Attempt to set data attribute of a content object " + 186 | "when the body attributes was already set."); 187 | }, 188 | setBodyWithData: function(object) { 189 | throw new Error("Attempt to set body attribute of a content object " + 190 | "when the data attributes was already set."); 191 | } 192 | } 193 | module.exports = Content; -------------------------------------------------------------------------------- /WebRoot/dbscript/createdb_script.sql: -------------------------------------------------------------------------------- 1 | SET FOREIGN_KEY_CHECKS=0; 2 | 3 | create database objectdb; 4 | use objectdb; 5 | 6 | CREATE 7 | TABLE `dbobject` 8 | ( 9 | `counter` INT not null AUTO_INCREMENT UNIQUE, 10 | `client_id` smallint NOT NULL default 0, 11 | `type` varchar(5) NOT NULL, 12 | `uuid` varchar(32) NOT NULL, 13 | `version` smallint default 0, 14 | `name` varchar(255) default NULL, 15 | `created_by` varchar(32) NOT NULL, 16 | `created_on` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, 17 | `modified_by` varchar(32), 18 | `modified_on` timestamp null, 19 | `status` smallint default 0, 20 | `status_modified_on` timestamp null, 21 | PRIMARY KEY (`uuid`), 22 | KEY `idx_dbobject_client_id` (`client_id`), 23 | KEY `idx_dbobject_type` (`type`), 24 | KEY `idx_dbobject_status` (`status`) 25 | ) 26 | ENGINE= InnoDB DEFAULT CHARSET=utf8; 27 | 28 | CREATE 29 | TABLE `dbobject_metadata` 30 | ( 31 | `client_id` smallint NOT NULL default 0, 32 | `type` varchar(5), 33 | `uuid` varchar(32) NOT NULL, 34 | `name` varchar(255) NOT NULL, 35 | `value` mediumtext, 36 | `created_by` varchar(32) NOT NULL, 37 | `created_on` timestamp NOT NULL default CURRENT_TIMESTAMP, 38 | `status` smallint default 0, 39 | `status_modified_on` timestamp null, 40 | PRIMARY KEY (`uuid`,`name`), 41 | KEY `idx_dbobject_object_metadata_type` (`type`), 42 | KEY `idx_dbobject_object_metadata_client_id` (`client_id`) 43 | ) 44 | ENGINE= InnoDB DEFAULT CHARSET=utf8; 45 | 46 | CREATE 47 | TABLE `dbobject_relationship` 48 | ( 49 | `client_id` smallint NOT NULL default 0, 50 | `p_uuid` varchar(32) NOT NULL, 51 | `c_uuid` varchar(32) NOT NULL, 52 | `relationship_type` varchar(32) NOT NULL default '', 53 | `sortorder` smallint default '0', 54 | `created_by` varchar(32) NOT NULL, 55 | `created_on` timestamp NOT NULL default CURRENT_TIMESTAMP, 56 | `status` smallint default 0, 57 | `status_modified_on` timestamp null, 58 | PRIMARY KEY (`p_uuid`,`c_uuid`,`relationship_type`), 59 | KEY `idx_dbobject_relationship_client_id` (`client_id`), 60 | KEY `fk_dbobject_relationship_parent` (`p_uuid`), 61 | KEY `fk_dbobject_relationship_child` (`c_uuid`), 62 | KEY `idx_dbobject_relationship_type` (`relationship_type`) 63 | ) 64 | ENGINE= InnoDB DEFAULT CHARSET=utf8; 65 | 66 | CREATE 67 | TABLE `dbobject_acl` 68 | ( 69 | `client_id` smallint NOT NULL default 0, 70 | `principal_uuid` varchar(32) NOT NULL, 71 | `uuid` varchar(32) NOT NULL, 72 | `permission` varchar(32) NOT NULL, 73 | `created_by` varchar(32) NOT NULL, 74 | `created_on` timestamp NOT NULL default CURRENT_TIMESTAMP, 75 | `status` smallint default 0, 76 | `status_modified_on` timestamp null, 77 | PRIMARY KEY (`principal_uuid`,`uuid`), 78 | KEY `idx_dbobject_acl_client_id` (`client_id`), 79 | KEY `idx_dbobject_acl_pricipal_object_permission` (`principal_uuid`, `uuid`,`permission`) 80 | ) 81 | ENGINE= InnoDB DEFAULT CHARSET=utf8; 82 | 83 | CREATE 84 | TABLE `dbobject_content_store` 85 | ( 86 | `client_id` smallint NOT NULL default 0, 87 | `uuid` varchar(32) NOT NULL, 88 | `content_type` varchar(32) NOT NULL, 89 | `uri` varchar(255) default NULL, 90 | `data` longblob, 91 | `created_by` varchar(32) NOT NULL, 92 | `created_on` timestamp NOT NULL default CURRENT_TIMESTAMP, 93 | `extension` varchar(32) default NULL, 94 | `content_size` int default NULL, 95 | `content_size_enc` int default NULL, 96 | `checksum` varchar(32) default null, 97 | `status` smallint default 0, 98 | `status_modified_on` timestamp null, 99 | PRIMARY KEY (`uuid`,`content_type`), 100 | KEY `idx_dbobject_content_store_client_id` (`client_id`) 101 | ) 102 | ENGINE= InnoDB DEFAULT CHARSET=utf8; 103 | 104 | 105 | CREATE 106 | TABLE `dbobject_relationship_metadata` 107 | ( 108 | `client_id` smallint NOT NULL default 0, 109 | `p_uuid` varchar(32) NOT NULL, 110 | `c_uuid` varchar(32) NOT NULL, 111 | `name` varchar(255) NOT NULL, 112 | `value` mediumtext, 113 | `created_by` varchar(32) NOT NULL default '', 114 | `created_on_` timestamp NOT NULL default CURRENT_TIMESTAMP, 115 | `relationship_type` varchar(32) NOT NULL default '0', 116 | `status` smallint default 0, 117 | `status_modified_on` timestamp null, 118 | PRIMARY KEY (`p_uuid`,`c_uuid`,`relationship_type`,`name`), 119 | KEY `idx_dbobject_relationship_metadata_client_id` (`client_id`) 120 | ) 121 | ENGINE= InnoDB DEFAULT CHARSET=utf8; 122 | 123 | CREATE 124 | TABLE `dbobject_metadata_json` 125 | ( 126 | `client_id` smallint NOT NULL default 0, 127 | `type` varchar(5), 128 | `uuid` varchar(32) NOT NULL, 129 | `property_name` varchar(20) NOT NULL, 130 | `name` varchar(255) NOT NULL, 131 | `value` mediumtext, 132 | `created_by` varchar(32) NOT NULL, 133 | `created_on` timestamp NOT NULL default CURRENT_TIMESTAMP, 134 | `status` smallint default 0, 135 | `status_modified_on` timestamp null, 136 | PRIMARY KEY (`uuid`,`name`), 137 | KEY `idx_dbobject_object_metadata_json_type` (`type`), 138 | KEY `idx_dbobject_object_metadata_json_client_id` (`client_id`) 139 | ) 140 | ENGINE= InnoDB DEFAULT CHARSET=utf8; 141 | 142 | SET FOREIGN_KEY_CHECKS=1; 143 | 144 | INSERT INTO `objectdb`.`dbobject` (`counter`, `client_id`, `type`, `uuid`, `version`, `name`, `created_by`, `created_on`, `modified_by`, `modified_on`, `status`) VALUES ('1', '0', 'USER1', 'USER1-SUPADMIN-FTC1', '0', 'ftcadmin', 'Macys', '2015-09-24 22:02:56', 'null', '2015-09-24 22:02:56', '0'); 145 | INSERT INTO `objectdb`.`dbobject_metadata` (`client_id`, `type`, `uuid`, `name`, `value`, `created_by`, `created_on`, `status`, `status_modified_on`) VALUES ('0', 'USER1', 'USER1-SUPADMIN-FTC1', 'isSuperAdmin', 'true', 'MACYS', '2015-09-24 22:02:57', '0', '2015-09-24 22:02:57'); 146 | INSERT INTO `objectdb`.`dbobject_metadata` (`client_id`, `type`, `uuid`, `name`, `value`, `created_by`, `created_on`, `status`, `status_modified_on`) VALUES ('0', 'USER1', 'USER1-SUPADMIN-FTC1', 'password','fZG1Cw1FMeVZQCOcbNaAlRtLDaRA6A5ZVpXkkwIWcF5CkNRaahuKOGEcg2f8SeIP', 'MACYS', '2015-09-24 22:02:57', '0', '2015-09-24 22:02:57'); 147 | INSERT INTO `objectdb`.`dbobject_metadata` (`client_id`, `type`, `uuid`, `name`, `value`, `created_by`, `created_on`, `status`, `status_modified_on`) VALUES ('0', 'USER1', 'USER1-SUPADMIN-FTC1', 'userName','ftcadmin', 'MACYS', '2015-09-24 22:02:57', '0', '2015-09-24 22:02:57'); 148 | 149 | INSERT INTO `objectdb`.`dbobject` (`counter`, `client_id`, `type`, `uuid`, `version`, `name`, `created_by`, `created_on`) VALUES ('0', '0', 'RELSE', 'RELSE-57B91307-A8E6', '0', '15I', 'Macys', '2015-10-01 14:00:17'); 150 | INSERT INTO `objectdb`.`dbobject_metadata` (`client_id`, `type`, `uuid`, `name`, `value`, `created_by`, `created_on`, `status`) VALUES ('0', 'RELSE', 'RELSE-57B91307-A8E6', 'bcomDate', '9/10', '', '2015-10-01 14:00:17', '0'); 151 | INSERT INTO `objectdb`.`dbobject_metadata` (`client_id`, `type`, `uuid`, `name`, `value`, `created_by`, `created_on`, `status`) VALUES ('0', 'RELSE', 'RELSE-57B91307-A8E6', 'branchCutDate', '8/26', '', '2015-10-01 14:00:17', '0'); 152 | INSERT INTO `objectdb`.`dbobject_metadata` (`client_id`, `type`, `uuid`, `name`, `value`, `created_by`, `created_on`, `status`) VALUES ('0', 'RELSE', 'RELSE-57B91307-A8E6', 'branchFreezeDate', '9/10', '', '2015-10-01 14:00:17', '0'); 153 | INSERT INTO `objectdb`.`dbobject_metadata` (`client_id`, `type`, `uuid`, `name`, `value`, `created_by`, `created_on`, `status`) VALUES ('0', 'RELSE', 'RELSE-57B91307-A8E6', 'branchHardLockDate', '9/7', '', '2015-10-01 14:00:17', '0'); 154 | INSERT INTO `objectdb`.`dbobject_metadata` (`client_id`, `type`, `uuid`, `name`, `value`, `created_by`, `created_on`, `status`) VALUES ('0', 'RELSE', 'RELSE-57B91307-A8E6', 'branchProductionDate', '9/10', '', '2015-10-01 14:00:17', '0'); 155 | INSERT INTO `objectdb`.`dbobject_metadata` (`client_id`, `type`, `uuid`, `name`, `value`, `created_by`, `created_on`, `status`) VALUES ('0', 'RELSE', 'RELSE-57B91307-A8E6', 'mcomDate', '9/10', '', '2015-10-01 14:00:17', '0'); 156 | 157 | 158 | 159 | 160 | --------------------------------------------------------------------------------