com.denimgroup.threadfix.data.entities.ScheduledRemoteProviderImport Maven / Gradle / Ivy
////////////////////////////////////////////////////////////////////////
//
// Copyright (c) 2009-2016 Denim Group, Ltd.
//
// The contents of this file are subject to the Mozilla Public License
// Version 2.0 (the "License"); you may not use this file except in
// compliance with the License. You may obtain a copy of the License at
// http://www.mozilla.org/MPL/
//
// Software distributed under the License is distributed on an "AS IS"
// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
// License for the specific language governing rights and limitations
// under the License.
//
// The Original Code is ThreadFix.
//
// The Initial Developer of the Original Code is Denim Group, Ltd.
// Portions created by Denim Group, Ltd. are Copyright (C)
// Denim Group, Ltd. All Rights Reserved.
//
// Contributor(s): Denim Group, Ltd.
//
////////////////////////////////////////////////////////////////////////
package com.denimgroup.threadfix.data.entities;
/**
* Created by zabdisubhan on 8/14/14.
*/
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonView;
import javax.persistence.*;
import java.util.Map;
import static com.denimgroup.threadfix.CollectionUtils.map;
@Entity
@Table(name="ScheduledRemoteProviderImport")
public class ScheduledRemoteProviderImport extends ScheduledJob {
private static final long serialVersionUID = 1223869621339558275L;
private Application application;
private RemoteProviderEntity remoteProviderEntity;
public static ScheduledRemoteProviderImport getDefaultScheduledImport(){
ScheduledRemoteProviderImport defaultScheduledImport = new ScheduledRemoteProviderImport();
defaultScheduledImport.setFrequency(ScheduledFrequencyType.DAILY.getDescription());
defaultScheduledImport.setHour(6);
defaultScheduledImport.setMinute(0);
defaultScheduledImport.setPeriod("AM");
defaultScheduledImport.setDay(null);
defaultScheduledImport.setScheduleType(SELECT);
return defaultScheduledImport;
}
@ManyToOne
@JoinColumn(name = "applicationId", foreignKey = @ForeignKey(name="fk_ScheduledRPImport_Application"))
@JsonIgnore
public Application getApplication() {
return application;
}
public void setApplication(Application application) {
this.application = application;
}
@ManyToOne
@JoinColumn(name = "remoteProviderEntityId", foreignKey = @ForeignKey(name="fk_ScheduledRPImport_RPEntity"))
@JsonIgnore
public RemoteProviderEntity getRemoteProviderEntity() {
return remoteProviderEntity;
}
public void setRemoteProviderEntity(RemoteProviderEntity remoteProviderEntity) {
this.remoteProviderEntity = remoteProviderEntity;
}
@Transient
@JsonView(Object.class)
@JsonProperty("remoteProviderEntity")
public Map getRemoteProviderInfo() {
return getRemoteProviderEntity() == null ? null : map("id", getRemoteProviderEntity().getId(), "name", getRemoteProviderEntity().getName());
}
@Transient
@JsonView(Object.class)
@JsonProperty("application")
public Map getApplicationInfo() {
return getApplication() == null ? null :
map("id", getApplication().getId(), "name", getApplication().getName(),
"teamId", getApplication().getOrganization().getId(), "teamName", getApplication().getOrganization().getName());
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy