cannot resolve symbol (class declaration) - c#-3.0

I created a class like this :
namespace Web.Models
{
public class TimeLineStep
{
public string Code { get; set; }
public string Title;
public string Description;
public string Url;
public string Status;
public string Category;
}
}
And I use this class in a model like this :
namespace Web.Models
{
public class TimelineList
{
private List<TimelineStep> _steps;
public List<TimelineStep> Steps
{
get
{
return this._steps ?? (this._steps = new List<TimelineStep>());
}
set
{
this._steps = value;
}
}
Both are under same namespace but the class TimeLineStep is underlined with red and it says cannot resolve symbol 'TimeLineStep'

Related

Trying to read values returned on jsp form submission in springboot project by setters and use the combination to call another java class

So, I have values in getter setter variables when I click on form submit but now want to have those values in variables and check combination of them to run code from another java class
I have tried using parametrized constructor or may be having a common setter but that did not help.
package com.grt.dto;
import java.util.Set;
public class WDPayrollRecon {
public Set<String> dataType;
public String planCountry;
public String payPeriod;
public String currentPeriod;
public String lastPayPeriod;
Set<String> test;
public Set<String> getdataType() {
return dataType;
}
public void setdataType(Set<String> dataType) {
this.dataType = dataType;
System.out.println("this is dataType" +dataType);
test = dataType;
}
public String getPlanCountry() {
return planCountry;
}
public void setPlanCountry(String planCountry) {
this.planCountry = planCountry;
}
public String getPayPeriod() {
return payPeriod;
}
public void setPayPeriod(String payPeriod) {
this.payPeriod = payPeriod;
}
public String getCurrentPeriod() {
return currentPeriod;
}
public void setCurrentPeriod(String currentPeriod) {
this.currentPeriod = currentPeriod;
}
public String getlastPayPeriod() {
return lastPayPeriod;
}
public void setlastPayPeriod(String lastPayPeriod) {
this.lastPayPeriod = lastPayPeriod;
}
public WDPayrollRecon()
{
}
public WDPayrollRecon(Set<String> dataType,String planCountry,String payPeriod,String currentPeriod,String lastPayPeriod)
{
this.dataType = dataType;
this.planCountry = planCountry;
this.payPeriod = payPeriod;
this.currentPeriod = currentPeriod;
this.lastPayPeriod = lastPayPeriod;
if(dataType.contains("GTLI")& planCountry.equals("USA")){
System.out.println("This is test");
}
else{
System.out.println("This is not test");
}
}
}

can't serialize class org.springframework.data.mongodb.core.geo.GeoJsonPoint

I am using MongoDB Near to find nearest points, getMills is method to find nearest points based on LatLng. It runs fine till fetching data and mapping. while mapping it returns following error. My question is that how can i serialize class to GeoJsonPoint???
It's returning this error : can't serialize class org.springframework.data.mongodb.core.geo.GeoJsonPoint.
private List<Mill> getMills(GetNearByMillsRequest getNearByMillsRequest, BasicResponse basicResponse) {
// get farmerPosition
LatLng fieldPosition = getNearByMillsRequest.getFieldPosition();
double Longitude = fieldPosition.getLongitude();
double Latitude = fieldPosition.getLatitude();
System.out.println("Longitude : " + Longitude + "Latitude : "+ Latitude);
// creating GeoJson Object for farmer field location...
Point point = new Point(Latitude,Longitude);
GeoJsonPoint farmerFieldPosition = new GeoJsonPoint(point);
Float distance = getNearByMillsRequest.getDistance();
// find crop by crop Name
Query query = new Query();
query.addCriteria(Criteria.where(Mill.Constants.MILL_CROP_REQUIRED).elemMatch(Criteria.where(MillCropRequired.Constants.CROP).is(getNearByMillsRequest.getCrop())));
query.addCriteria(Criteria.where(Mill.Constants.MILL_LOCATION).near(farmerFieldPosition));
// TODO Get radius from UserPreferences
NearQuery nearQuery = NearQuery.near(farmerFieldPosition).maxDistance(new Distance(distance, Metrics.KILOMETERS));
nearQuery.query(query);
nearQuery.spherical(true); // if using 2dsphere index, otherwise delete or set false
nearQuery.num(10);
// Problem occurs here, in mapping part...
GeoResults<Mill> results = millDAO.getMongoOperations().geoNear(nearQuery, Mill.class);
System.out.println("results : " + results.getContent().size());
if (results.getContent().isEmpty()) {
basicResponse.setErrorCode(ErrorCode.FORBIDDEN_ERROR);
basicResponse.setResponse("No Crop Found for this region.");
return null;
}
List<GeoResult<Mill>> geoResults = results.getContent();
// add nearBy Mills and return this list...
List<Mill> nearByMills = new ArrayList<>();
for (GeoResult<Mill> result : geoResults) {
Mill mill = result.getContent();
nearByMills.add(mill);
}
return nearByMills;
}
This is my Mill Entity.
public class Mill extends AbstractEntity {
private String vendorId;
private String name;
private String emailAddress;
private String countryCode;
private String phoneNumber;
private String postalAddress;
#GeoSpatialIndexed(type = GeoSpatialIndexType.GEO_2DSPHERE)
private GeoJsonPoint millLocation;
private String ginningCapacity;
private String storageCapacity;
private ArrayList<MillCropRequired> millCropRequired;
public String getVendorId() {
return vendorId;
}
public void setVendorId(String vendorId) {
this.vendorId = vendorId;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getEmailAddress() {
return emailAddress;
}
public void setEmailAddress(String emailAddress) {
this.emailAddress = emailAddress;
}
public String getCountryCode() {
return countryCode;
}
public void setCountryCode(String countryCode) {
this.countryCode = countryCode;
}
public String getPhoneNumber() {
return phoneNumber;
}
public void setPhoneNumber(String phoneNumber) {
this.phoneNumber = phoneNumber;
}
public String getPostalAddress() {
return postalAddress;
}
public void setPostalAddress(String postalAddress) {
this.postalAddress = postalAddress;
}
public GeoJsonPoint getMillLocation() {
return millLocation;
}
public void setMillLocation(GeoJsonPoint millLocation) {
this.millLocation = millLocation;
}
public String getGinningCapacity() {
return ginningCapacity;
}
public void setGinningCapacity(String ginningCapacity) {
this.ginningCapacity = ginningCapacity;
}
public ArrayList<MillCropRequired> getCropRequirnment() {
return millCropRequired;
}
public void setCropRequirnment(ArrayList<MillCropRequired> millCropRequired) {
this.millCropRequired = millCropRequired;
}
public String getStorageCapacity() {
return storageCapacity;
}
public void setStorageCapacity(String storageCapacity) {
this.storageCapacity = storageCapacity;
}
public static class Constants extends AbstractEntity.Constants {
public static final String PHONE_NUMBER = "phoneNumber";
public static final String VENDOR_ID = "vendorId";
public static final String MILL_CROP_REQUIRED = "millCropRequired";
public static final String MILL_LOCATION = "millLocation";
}
}

Error in annoting camel swagger Rest Service

I have created a rest Service using Apache Camel Swagger component. The rest service works fine but the request and response schema is not what i intended of.
The schema that i am trying to create is :
{
"GetStudentData": [
{
"RollNumber": "1",
"Name": "ABC",
"ClassName": "VII",
"Grade": "A"
}]
}
For this i have created a model as:
import java.util.List;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;
#XmlRootElement(name = "GetStudentData")
#XmlAccessorType(XmlAccessType.FIELD)
#XmlType(name="", propOrder={"studentInfo"})
public class StudentInfoWrapper {
#XmlElement(required=true)
private List<Student> studentInfo;
private double visiteddate;
public double getVisiteddate() {
return visiteddate;
}
public void setVisiteddate(double visiteddate) {
this.visiteddate = visiteddate;
}
public List<Student> getStudentInfo() {
return studentInfo;
}
public void setStudentInfo(List<Student> studentInfo) {
studentInfo = studentInfo;
}
}
And my student class is:
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlType;
#XmlAccessorType(XmlAccessType.FIELD)
#XmlType(name="", propOrder={"RollNumber", "Name", "ClassName", "Grade"})
public class Student {
private String RollNumber;
private String Name;
private String ClassName;
private String Grade;
public String getRollNumber() {
return RollNumber;
}
public void setRollNumber(String rollNumber) {
RollNumber = rollNumber;
}
public String getName() {
return Name;
}
public void setName(String name) {
Name = name;
}
public String getClassName() {
return ClassName;
}
public void setClassName(String className) {
ClassName = className;
}
public String getGrade() {
return Grade;
}
public void setGrade(String grade) {
Grade = grade;
}
}
So when i load the above service into the swaggerUI it doesn't show the schema that i want.
How can i i get the desired schema. Looking forward to your answers.
Thanks in advance.

MEF ImportMany simple plugin

IPlugin Calss Library
namespace IPlugin
{
public interface IPlugin
{
string Name { get; set; }
void Start();
void Stop();
}
[Export(typeof(IPlugin))]
public abstract class BasePlugin:IPlugin
{
private string _name;
public BasePlugin()
{
Name = "Base Plugin";
}
public string Name
{
get { return _name; }
set { _name = value; }
}
public virtual void Start()
{
fnDowWork();
}
protected abstract void fnDowWork();
public virtual void Stop()
{
}
}
}
Test Plugin Class Library
namespace TestPlugin
{
public class TestPlugin:IPlugin.BasePlugin
{
public TestPlugin()
{
Name = "Test Plugin";
}
protected override void fnDowWork()
{
Console.WriteLine("Do Work !");
}
}
}
Console Application
class Program
{
static void Main(string[] args)
{
var app = new MyApp();
foreach (var p in app._Plugins)
{
p.Start();
}
}
}
public class MyApp
{
[ImportMany(typeof(IPlugin.IPlugin))]
public IEnumerable<IPlugin.IPlugin> _Plugins;
public string _PluginFolder { get; set; }
public string _StartupPath { get; set; }
public MyApp()
{
_StartupPath = Environment.CurrentDirectory;
var pluginFolderName = System.Configuration.ConfigurationManager.AppSettings["PluginFolder"];
_PluginFolder = System.IO.Path.Combine(_StartupPath, pluginFolderName);
InitializeMEF();
}
private void InitializeMEF()
{
var dirCatalog = new DirectoryCatalog(_PluginFolder, "*.dll");
CompositionContainer container = new CompositionContainer(dirCatalog);
container.ComposeParts(this);
}
}
the DirectoryCatalog find tow Assembly IPlugin.dll and TestPlugin.dll and after Compose parts
the myApp._Plugins is not null but its empty , i don't know where i am doing wrong!
You will need to use the InheritedExportAttribute instead of the ExportAttribute:
[InheritedExport(typeof(IPlugin))]
public abstract class BasePlugin:IPlugin
Note that this will only work for plugins that derive from BasePlugin. Other implementations of IPlugin will not be marked for export. To do this you will have to decorate the interface instead.

Checkstyle, no JavaDoc for getter and setter only works for getters

I am using the Eclipse Checkstyleplugin (v5.5). I want JavaDoc comments on all public methods except getters and setters. I know there is the option "allowMissingPropertyJavadoc" which does exactly what I want. But in some cases it works and in some it does not.
This works, no JavaDoc required on gettes and setters:
public class Test {
private String name;
private int number;
public Test() {
System.out.println("Test");
}
public String getName() {
return this.name;
}
public int getNumber() {
return this.number;
}
public void setName(String name){
this.name = name;
}
public void setNumber(int number) {
this.number = number;
}
}
And this does not, JavaDoc required on setters:
public class Test2 {
private Test test;
public Test2() {
System.out.println("Test2");
this.test = new Test();
this.test.setName("thename");
this.test.setNumber(1337);
}
public String getName() {
return this.test.getName();
}
public int getNumber() {
return this.test.getNumber();
}
public void setName(String name) {
this.test.setName(name);
}
public void setNumber(int number) {
this.test.setNumber(number);
}
}
It seems as if setters without an assignment are not recognized as setters. Is how can I fix this?
That's because it requires the body to be exactly "this.name = name;"
You can see the exactly line here:
http://checkstyle.hg.sourceforge.net/hgweb/checkstyle/checkstyle/file/a485366ec8c3/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocMethodCheck.java#l819
Dumb, I know.