Skip to content

Commit

Permalink
Merge pull request #53 from ericpinet/#52---Improve-find-processor
Browse files Browse the repository at this point in the history
#52   Improve find processor
  • Loading branch information
ericpinet committed Apr 16, 2016
2 parents 69cc218 + a626e98 commit 08ac039
Show file tree
Hide file tree
Showing 15 changed files with 366 additions and 140 deletions.
14 changes: 13 additions & 1 deletion clapi/src/main/java/com/clapi/data/Accessory.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
* @author ericpinet
* <br> 2015-11-08
*/
public class Accessory {
public class Accessory implements DataObj {

/**
* Enum AccessoryType
Expand Down Expand Up @@ -329,4 +329,16 @@ public void update(Accessory accessory) {
this.services = temp.services;
this.type = temp.type;
}

/**
* Return children of this class.
*
* @return Children of this class.
* @see com.clapi.data.DataObj#getChildren()
*/
@SuppressWarnings("unchecked")
@Override
public List<DataObj> getChildren() {
return (List<DataObj>)(Object)getServices();
}
}
15 changes: 14 additions & 1 deletion clapi/src/main/java/com/clapi/data/Address.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,15 @@
*/
package com.clapi.data;

import java.util.List;

/**
* Address.
*
* @author ericpinet
* <br> 2015-11-08
*/
public class Address {
public class Address implements DataObj {

/**
* Enum AddressType
Expand Down Expand Up @@ -196,4 +198,15 @@ public String getCountry() {
public void setCountry(String country) {
this.country = country;
}

/**
* Return children of this object.
*
* @return Children of this object.
* @see com.clapi.data.DataObj#getChildren()
*/
@Override
public List<DataObj> getChildren() {
return null;
}
}
13 changes: 12 additions & 1 deletion clapi/src/main/java/com/clapi/data/Characteristic.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* @author ericpinet
* <br> 2015-11-08
*/
public class Characteristic {
public class Characteristic implements DataObj {

/**
* Value of boolean true in string
Expand Down Expand Up @@ -409,5 +409,16 @@ public void setDataEnum(String data) throws Exception {
throw new Exception("This characteristic isn't string format.");
}
}

/**
* Return the children of this object.
*
* @return Children of this object.
* @see com.clapi.data.DataObj#getChildren()
*/
@Override
public List<DataObj> getChildren() {
return null;
}

}
23 changes: 1 addition & 22 deletions clapi/src/main/java/com/clapi/data/Data.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,6 @@
*/
public class Data {

/**
* Version of the data. Increment by one for each change.
*/
private int version;

/**
* List of the persons in data.
*/
Expand All @@ -36,13 +31,11 @@ public class Data {

/**
* Default constructor.
* @param version Version of the data.
* @param persons Persons of the data.
* @param homes Homes of the data.
*/
public Data(int version, List<Person> persons, List<Home> homes) {
public Data(List<Person> persons, List<Home> homes) {
super();
this.version = version;
this.persons = persons;
this.homes = homes;
}
Expand All @@ -56,20 +49,6 @@ public Data() {
this.homes = new ArrayList<Home>();
}

/**
* @return the version
*/
public int getVersion() {
return version;
}

/**
* @param version the version to set
*/
public void setVersion(int version) {
this.version = version;
}

/**
* @return the persons
*/
Expand Down
25 changes: 25 additions & 0 deletions clapi/src/main/java/com/clapi/data/DataObj.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/**
* DataObj.java
* clapi
*
* Created by ericpinet on 2016-04-09.
* Copyright (c) 2016 ConnectLife (Eric Pinet). All rights reserved.
*
*/
package com.clapi.data;

import java.util.List;

/**
* Generic interface for simplify the search.
*
* @author ericpinet
* <br> 2016-04-09
*/
public interface DataObj {

public String getUid();

public List<DataObj> getChildren();

}
15 changes: 14 additions & 1 deletion clapi/src/main/java/com/clapi/data/Email.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,15 @@
*/
package com.clapi.data;

import java.util.List;

/**
* Email address.
*
* @author ericpinet
* <br> 2015-11-08
*/
public class Email {
public class Email implements DataObj {

/**
* Enum EmailType
Expand Down Expand Up @@ -98,4 +100,15 @@ public EmailType getType() {
public void setType(EmailType type) {
this.type = type;
}

/**
* Return children of this object.
*
* @return Children of this object.
* @see com.clapi.data.DataObj#getChildren()
*/
@Override
public List<DataObj> getChildren() {
return null;
}
}
16 changes: 14 additions & 2 deletions clapi/src/main/java/com/clapi/data/Home.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* @author ericpinet
* <br> 2015-11-08
*/
public class Home {
public class Home implements DataObj {

/**
* UID of the home generated by the server.
Expand Down Expand Up @@ -121,4 +121,16 @@ public String getImageurl() {
public void setImageurl(String imageurl) {
this.imageurl = imageurl;
}
}

/**
* Return the children of this object.
*
* @return Children of this object.
* @see com.clapi.data.DataObj#getChildren()
*/
@SuppressWarnings("unchecked")
@Override
public List<DataObj> getChildren() {
return (List<DataObj>)(Object)getZones();
}
}
19 changes: 18 additions & 1 deletion clapi/src/main/java/com/clapi/data/Person.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,15 @@

import java.util.ArrayList;
import java.util.List;
import java.util.Vector;

/**
* Person.
*
* @author ericpinet
* <br> 2015-11-08
*/
public class Person {
public class Person implements DataObj {

/**
* UID of the person. This UID most be generator by the server.
Expand Down Expand Up @@ -245,4 +246,20 @@ public void updateInformation(Person _person){
setEmails(_person.getEmails());
setPhones(_person.getPhones());
}

/**
* Return children of this object.
*
* @return Children of this object.
* @see com.clapi.data.DataObj#getChildren()
*/
@SuppressWarnings("unchecked")
@Override
public List<DataObj> getChildren() {
List<DataObj> ret_obj = new Vector<DataObj>();
ret_obj.addAll(getPhones());
ret_obj.addAll(getAddresses());
ret_obj.addAll(getEmails());
return (List<DataObj>)(Object)ret_obj;
}
}
15 changes: 14 additions & 1 deletion clapi/src/main/java/com/clapi/data/Phone.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,15 @@
*/
package com.clapi.data;

import java.util.List;

/**
* Phone number.
*
* @author ericpinet
* <br> 2015-11-08
*/
public class Phone {
public class Phone implements DataObj {

/**
* Enum PhoneType
Expand Down Expand Up @@ -99,4 +101,15 @@ public PhoneType getType() {
public void setType(PhoneType type) {
this.type = type;
}

/**
* Return children of this object.
*
* @return Children of this object.
* @see com.clapi.data.DataObj#getChildren()
*/
@Override
public List<DataObj> getChildren() {
return null;
}
}
14 changes: 13 additions & 1 deletion clapi/src/main/java/com/clapi/data/Room.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* @author ericpinet
* <br> 2015-11-08
*/
public class Room {
public class Room implements DataObj {

/**
* UID of the room generated by the server.
Expand Down Expand Up @@ -121,4 +121,16 @@ public String getImageurl() {
public void setImageurl(String imageurl) {
this.imageurl = imageurl;
}

/**
* Return children of this object.
*
* @return Children of this object.
* @see com.clapi.data.DataObj#getChildren()
*/
@SuppressWarnings("unchecked")
@Override
public List<DataObj> getChildren() {
return (List<DataObj>)(Object)getAccessories();
}
}
14 changes: 13 additions & 1 deletion clapi/src/main/java/com/clapi/data/Service.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* @author ericpinet
* <br> 2015-11-08
*/
public class Service {
public class Service implements DataObj {

/**
* UID of the service generated by the server.
Expand Down Expand Up @@ -101,4 +101,16 @@ public List<Characteristic> getCharacteristics() {
public void setCharacteristics(List<Characteristic> characteristics) {
this.characteristics = characteristics;
}

/**
* Return the children of this object.
*
* @return Children of this object.
* @see com.clapi.data.DataObj#getChildren()
*/
@SuppressWarnings("unchecked")
@Override
public List<DataObj> getChildren() {
return (List<DataObj>)(Object)getCharacteristics();
}
}
14 changes: 13 additions & 1 deletion clapi/src/main/java/com/clapi/data/Zone.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* @author ericpinet
* <br> 2015-11-08
*/
public class Zone {
public class Zone implements DataObj {

/**
* UID of the zone generated by the server.
Expand Down Expand Up @@ -121,4 +121,16 @@ public String getImageurl() {
public void setImageurl(String imageurl) {
this.imageurl = imageurl;
}

/**
* Return the children of this object.
*
* @return Children of this object.
* @see com.clapi.data.DataObj#getChildren()
*/
@SuppressWarnings("unchecked")
@Override
public List<DataObj> getChildren() {
return (List<DataObj>)(Object)getRooms();
}
}
11 changes: 11 additions & 0 deletions coreserver/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,17 @@
</execution>
</executions>
</plugin>

<!-- Maven force java 1.8 -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.5.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>

</plugins>
</build>
Expand Down
Loading

0 comments on commit 08ac039

Please sign in to comment.