Removed old research system
* Removed all tables, views and functions * Removed references to old system in Java code, including old import tool * Replaced XML dump code
This commit is contained in:
parent
070d55dc05
commit
96c296e9d5
22 changed files with 345 additions and 705 deletions
legacyworlds-server-beans-bt/src/main/java/com/deepclone/lw/beans/bt/es
|
@ -21,7 +21,9 @@ import com.deepclone.lw.beans.bt.es.data.MovementInformation;
|
|||
import com.deepclone.lw.beans.bt.es.data.PlanetInformation;
|
||||
import com.deepclone.lw.beans.bt.es.data.QueueInformation;
|
||||
import com.deepclone.lw.beans.bt.es.data.QueueItemInformation;
|
||||
import com.deepclone.lw.beans.bt.es.data.ResearchGraphInformation;
|
||||
import com.deepclone.lw.beans.bt.es.data.ResearchInformation;
|
||||
import com.deepclone.lw.beans.bt.es.data.ResearchLineInformation;
|
||||
import com.deepclone.lw.beans.bt.es.data.ResourceDeltaInformation;
|
||||
import com.deepclone.lw.beans.bt.es.data.ResourceProviderInformation;
|
||||
import com.deepclone.lw.beans.bt.es.data.ShipsInformation;
|
||||
|
@ -122,8 +124,8 @@ public class EmpireSummaryBean
|
|||
AccountInformation.class , AllianceInformation.class , BuildingsInformation.class ,
|
||||
DebugInformation.class , EmpireInformation.class , FleetInformation.class , MovementInformation.class ,
|
||||
PlanetInformation.class , QueueInformation.class , QueueItemInformation.class ,
|
||||
ResearchInformation.class , ResourceDeltaInformation.class , ResourceProviderInformation.class ,
|
||||
ShipsInformation.class , SystemInformation.class
|
||||
ResearchLineInformation.class , ResearchGraphInformation.class , ResourceDeltaInformation.class ,
|
||||
ResourceProviderInformation.class , ShipsInformation.class , SystemInformation.class
|
||||
} );
|
||||
|
||||
this.mMainInfo = new DebugInformationMapper( );
|
||||
|
|
|
@ -4,9 +4,12 @@ package com.deepclone.lw.beans.bt.es;
|
|||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
|
||||
import org.postgresql.util.PGobject;
|
||||
import org.springframework.jdbc.core.RowMapper;
|
||||
|
||||
import com.deepclone.lw.beans.bt.es.data.ResearchGraphInformation;
|
||||
import com.deepclone.lw.beans.bt.es.data.ResearchInformation;
|
||||
import com.deepclone.lw.beans.bt.es.data.TechnologyState;
|
||||
|
||||
|
||||
|
||||
|
@ -14,8 +17,8 @@ import com.deepclone.lw.beans.bt.es.data.ResearchInformation;
|
|||
* Research information row mapper
|
||||
*
|
||||
* <p>
|
||||
* This class maps rows from <code>bugs.dump_research_view</code> into {@link ResearchInformation}
|
||||
* instances.
|
||||
* This class maps rows from <code>bugs.dump_research_view</code> into
|
||||
* {@link ResearchGraphInformation} instances.
|
||||
*
|
||||
* @author <a href="mailto:tseeker@legacyworlds.com">E. Benoît</a>
|
||||
*
|
||||
|
@ -28,17 +31,19 @@ final class ResearchInformationMapper
|
|||
* Map a <code>bugs.dump_research_view</code> row
|
||||
*
|
||||
* <p>
|
||||
* Create a {@link ResearchInformation} instance from the row's contents.
|
||||
* Create a {@link ResearchGraphInformation} instance from the row's contents.
|
||||
*/
|
||||
@Override
|
||||
public ResearchInformation mapRow( ResultSet rs , int rowNum )
|
||||
throws SQLException
|
||||
{
|
||||
ResearchInformation ri = new ResearchInformation( );
|
||||
ri.setId( rs.getInt( "line_id" ) );
|
||||
ri.setCurrentLevel( rs.getInt( "level" ) );
|
||||
ri.setLevelName( rs.getString( "name" ) );
|
||||
ri.setAccumulated( rs.getDouble( "accumulated" ) );
|
||||
ResearchGraphInformation ri = new ResearchGraphInformation( );
|
||||
ri.setName( rs.getString( "name" ) );
|
||||
ri.setState( TechnologyState.valueOf( ( (PGobject) rs.getObject( "state" ) ).toString( ) ) );
|
||||
if ( ri.getState( ) == TechnologyState.RESEARCH ) {
|
||||
ri.setPoints( rs.getDouble( "points" ) );
|
||||
ri.setPriority( rs.getInt( "priority" ) );
|
||||
}
|
||||
return ri;
|
||||
}
|
||||
}
|
|
@ -2,7 +2,7 @@ package com.deepclone.lw.beans.bt.es.data;
|
|||
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.LinkedList;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.thoughtworks.xstream.annotations.XStreamAlias;
|
||||
|
@ -28,13 +28,13 @@ public class DebugInformation
|
|||
private EmpireInformation empire = new EmpireInformation( );
|
||||
|
||||
@XStreamAlias( "research" )
|
||||
private List< ResearchInformation > research = new LinkedList< ResearchInformation >( );
|
||||
private List< ResearchInformation > research = new ArrayList< ResearchInformation >( );
|
||||
|
||||
@XStreamAlias( "planets" )
|
||||
private List< PlanetInformation > planets = new LinkedList< PlanetInformation >( );
|
||||
private List< PlanetInformation > planets = new ArrayList< PlanetInformation >( );
|
||||
|
||||
@XStreamAlias( "fleets" )
|
||||
private List< FleetInformation > fleets = new LinkedList< FleetInformation >( );
|
||||
private List< FleetInformation > fleets = new ArrayList< FleetInformation >( );
|
||||
|
||||
|
||||
public int getVersion( )
|
||||
|
|
|
@ -2,7 +2,7 @@ package com.deepclone.lw.beans.bt.es.data;
|
|||
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.LinkedList;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.thoughtworks.xstream.annotations.XStreamAlias;
|
||||
|
@ -59,7 +59,7 @@ public class PlanetInformation
|
|||
|
||||
/** List of buildings */
|
||||
@XStreamAlias( "buildings" )
|
||||
private final List< BuildingsInformation > buildings = new LinkedList< BuildingsInformation >( );
|
||||
private final List< BuildingsInformation > buildings = new ArrayList< BuildingsInformation >( );
|
||||
|
||||
/** Civilian construction queue */
|
||||
@XStreamAlias( "civ-queue" )
|
||||
|
@ -71,11 +71,11 @@ public class PlanetInformation
|
|||
|
||||
/** Planet resource deltas */
|
||||
@XStreamImplicit
|
||||
private final LinkedList< ResourceDeltaInformation > resourceDeltas = new LinkedList< ResourceDeltaInformation >( );
|
||||
private final ArrayList< ResourceDeltaInformation > resourceDeltas = new ArrayList< ResourceDeltaInformation >( );
|
||||
|
||||
/** List of resource providers */
|
||||
@XStreamImplicit( itemFieldName = "resource-provider" )
|
||||
private final LinkedList< ResourceProviderInformation > resourceProviders = new LinkedList< ResourceProviderInformation >( );
|
||||
private final ArrayList< ResourceProviderInformation > resourceProviders = new ArrayList< ResourceProviderInformation >( );
|
||||
|
||||
|
||||
/** @return the planet's identifier */
|
||||
|
@ -195,14 +195,14 @@ public class PlanetInformation
|
|||
|
||||
|
||||
/** @return the list of resource delta records */
|
||||
public LinkedList< ResourceDeltaInformation > getResourceDeltas( )
|
||||
public ArrayList< ResourceDeltaInformation > getResourceDeltas( )
|
||||
{
|
||||
return this.resourceDeltas;
|
||||
}
|
||||
|
||||
|
||||
/** @return the list of resource provider records */
|
||||
public LinkedList< ResourceProviderInformation > getResourceProviders( )
|
||||
public ArrayList< ResourceProviderInformation > getResourceProviders( )
|
||||
{
|
||||
return this.resourceProviders;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,136 @@
|
|||
package com.deepclone.lw.beans.bt.es.data;
|
||||
|
||||
|
||||
import com.thoughtworks.xstream.annotations.XStreamAlias;
|
||||
import com.thoughtworks.xstream.annotations.XStreamAsAttribute;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Technology from the technology graph and associated state information
|
||||
*
|
||||
* <p>
|
||||
* This class represents the state of a technology from the B6M2+ technology graph for the empire
|
||||
* being dumped.
|
||||
*
|
||||
* @author <a href="mailto:tseeker@legacyworlds.com">E. Benoît</a>
|
||||
*/
|
||||
@SuppressWarnings( "serial" )
|
||||
@XStreamAlias( "technology" )
|
||||
public class ResearchGraphInformation
|
||||
extends ResearchInformation
|
||||
{
|
||||
|
||||
/** The technology's name */
|
||||
@XStreamAsAttribute
|
||||
private String name;
|
||||
|
||||
/** The technology's state */
|
||||
@XStreamAsAttribute
|
||||
private TechnologyState state;
|
||||
|
||||
/**
|
||||
* The amount of accumulated research points, or <code>null</code> if the technology has been
|
||||
* researched
|
||||
*/
|
||||
@XStreamAsAttribute
|
||||
private Double points;
|
||||
|
||||
/** The research priority, or <code>null</code> if the technology has been researched */
|
||||
@XStreamAsAttribute
|
||||
private Integer priority;
|
||||
|
||||
|
||||
/**
|
||||
* Gets the technology's name.
|
||||
*
|
||||
* @return the technology's name
|
||||
*/
|
||||
public String getName( )
|
||||
{
|
||||
return this.name;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Sets the technology's name.
|
||||
*
|
||||
* @param name
|
||||
* the technology's new name
|
||||
*/
|
||||
public void setName( String name )
|
||||
{
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets the technology's state.
|
||||
*
|
||||
* @return the technology's state
|
||||
*/
|
||||
public TechnologyState getState( )
|
||||
{
|
||||
return this.state;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Sets the technology's state.
|
||||
*
|
||||
* @param state
|
||||
* the technology's new state
|
||||
*/
|
||||
public void setState( TechnologyState state )
|
||||
{
|
||||
this.state = state;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets the amount of accumulated research points
|
||||
*
|
||||
* @return the amount of accumulated research points, or <code>null</code> if the technology has
|
||||
* been researched
|
||||
*/
|
||||
public Double getPoints( )
|
||||
{
|
||||
return this.points;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Sets the amount of accumulated research points
|
||||
*
|
||||
* @param points
|
||||
* the amount of accumulated research points
|
||||
*/
|
||||
public void setPoints( Double points )
|
||||
{
|
||||
this.points = points;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets the research priority
|
||||
*
|
||||
* @return the research priority, or <code>null</code> if the technology has been researched
|
||||
*/
|
||||
public Integer getPriority( )
|
||||
{
|
||||
return this.priority;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Sets the research priority
|
||||
*
|
||||
* @param priority
|
||||
* the new research priority
|
||||
*/
|
||||
public void setPriority( Integer priority )
|
||||
{
|
||||
this.priority = priority;
|
||||
}
|
||||
|
||||
}
|
|
@ -3,81 +3,23 @@ package com.deepclone.lw.beans.bt.es.data;
|
|||
|
||||
import java.io.Serializable;
|
||||
|
||||
import com.thoughtworks.xstream.annotations.XStreamAlias;
|
||||
import com.thoughtworks.xstream.annotations.XStreamAsAttribute;
|
||||
|
||||
|
||||
|
||||
@XStreamAlias( "research-line" )
|
||||
public class ResearchInformation
|
||||
/**
|
||||
* Empty, base research record
|
||||
*
|
||||
* <p>
|
||||
* This class used to contain B6M1 research line entries; however, in order to support B6M2
|
||||
* technologies while maintaining XML compatibility, it has been replaced with an empty class which
|
||||
* servces as the base class for both old and new records.
|
||||
*
|
||||
* @author <a href="mailto:tseeker@legacyworlds.com">E. Benoît</a>
|
||||
*
|
||||
*/
|
||||
@SuppressWarnings( "serial" )
|
||||
public abstract class ResearchInformation
|
||||
implements Serializable
|
||||
|
||||
{
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@XStreamAsAttribute
|
||||
@XStreamAlias( "line")
|
||||
private int id;
|
||||
|
||||
@XStreamAsAttribute
|
||||
@XStreamAlias( "level")
|
||||
private int currentLevel;
|
||||
|
||||
@XStreamAsAttribute
|
||||
@XStreamAlias( "name")
|
||||
private String levelName;
|
||||
|
||||
@XStreamAsAttribute
|
||||
@XStreamAlias( "accumulated-points")
|
||||
private double accumulated;
|
||||
|
||||
|
||||
public int getId( )
|
||||
{
|
||||
return id;
|
||||
}
|
||||
|
||||
|
||||
public void setId( int id )
|
||||
{
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
|
||||
public int getCurrentLevel( )
|
||||
{
|
||||
return currentLevel;
|
||||
}
|
||||
|
||||
|
||||
public void setCurrentLevel( int currentLevel )
|
||||
{
|
||||
this.currentLevel = currentLevel;
|
||||
}
|
||||
|
||||
|
||||
public String getLevelName( )
|
||||
{
|
||||
return levelName;
|
||||
}
|
||||
|
||||
|
||||
public void setLevelName( String levelName )
|
||||
{
|
||||
this.levelName = levelName;
|
||||
}
|
||||
|
||||
|
||||
public double getAccumulated( )
|
||||
{
|
||||
return accumulated;
|
||||
}
|
||||
|
||||
|
||||
public void setAccumulated( double accumulated )
|
||||
{
|
||||
this.accumulated = accumulated;
|
||||
}
|
||||
|
||||
// EMPTY
|
||||
}
|
||||
|
|
|
@ -0,0 +1,137 @@
|
|||
package com.deepclone.lw.beans.bt.es.data;
|
||||
|
||||
|
||||
import com.thoughtworks.xstream.annotations.XStreamAlias;
|
||||
import com.thoughtworks.xstream.annotations.XStreamAsAttribute;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Research line information
|
||||
*
|
||||
* <p>
|
||||
* This class defines data stored in the dumps for B6M1 research lines. It is no longer actively
|
||||
* used as of B6M2, but is kept around so the XML files can still be used if necessary.
|
||||
*
|
||||
* @author <a href="mailto:tseeker@legacyworlds.com">E. Benoît</a>
|
||||
*/
|
||||
@XStreamAlias( "research-line" )
|
||||
public class ResearchLineInformation
|
||||
extends ResearchInformation
|
||||
{
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** Identifier of the technology line */
|
||||
@XStreamAsAttribute
|
||||
@XStreamAlias( "line" )
|
||||
private int id;
|
||||
|
||||
/** Current level for that line */
|
||||
@XStreamAsAttribute
|
||||
@XStreamAlias( "level" )
|
||||
private int currentLevel;
|
||||
|
||||
/** Name of the last level */
|
||||
@XStreamAsAttribute
|
||||
@XStreamAlias( "name" )
|
||||
private String levelName;
|
||||
|
||||
/** Accumulated points towards the next level */
|
||||
@XStreamAsAttribute
|
||||
@XStreamAlias( "accumulated-points" )
|
||||
private double accumulated;
|
||||
|
||||
|
||||
/**
|
||||
* Gets the identifier of the technology line.
|
||||
*
|
||||
* @return the identifier of the technology line
|
||||
*/
|
||||
public int getId( )
|
||||
{
|
||||
return this.id;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Sets the identifier of the technology line.
|
||||
*
|
||||
* @param id
|
||||
* the new identifier of the technology line
|
||||
*/
|
||||
public void setId( int id )
|
||||
{
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets the current level for that line.
|
||||
*
|
||||
* @return the current level for that line
|
||||
*/
|
||||
public int getCurrentLevel( )
|
||||
{
|
||||
return this.currentLevel;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Sets the current level for that line.
|
||||
*
|
||||
* @param currentLevel
|
||||
* the new level for that line
|
||||
*/
|
||||
public void setCurrentLevel( int currentLevel )
|
||||
{
|
||||
this.currentLevel = currentLevel;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets the name of the last level.
|
||||
*
|
||||
* @return the name of the last level
|
||||
*/
|
||||
public String getLevelName( )
|
||||
{
|
||||
return this.levelName;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Sets the name of the last level.
|
||||
*
|
||||
* @param levelName
|
||||
* the new name of the last level
|
||||
*/
|
||||
public void setLevelName( String levelName )
|
||||
{
|
||||
this.levelName = levelName;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets the accumulated points towards the next level.
|
||||
*
|
||||
* @return the accumulated points towards the next level
|
||||
*/
|
||||
public double getAccumulated( )
|
||||
{
|
||||
return this.accumulated;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Sets the accumulated points towards the next level.
|
||||
*
|
||||
* @param accumulated
|
||||
* the new accumulated points towards the next level
|
||||
*/
|
||||
public void setAccumulated( double accumulated )
|
||||
{
|
||||
this.accumulated = accumulated;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
package com.deepclone.lw.beans.bt.es.data;
|
||||
|
||||
|
||||
/**
|
||||
* State of a (B6M2+) technology
|
||||
*
|
||||
* @author <a href="mailto:tseeker@legacyworlds.com">E. Benoît</a>
|
||||
*/
|
||||
public enum TechnologyState {
|
||||
|
||||
/** The technology is being researched */
|
||||
RESEARCH ,
|
||||
|
||||
/** The technology needs to be implemented */
|
||||
PENDING ,
|
||||
|
||||
/** The technology has been researched and implemented */
|
||||
KNOWN
|
||||
|
||||
}
|
Reference in a new issue