Added more of the API JSON.
This commit is contained in:
parent
0fc5ebec08
commit
2286658446
|
@ -19,8 +19,8 @@ The *Company* represents most of the same properties as seen in the example JSON
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
compile 'biz.nellemann.libs:libcvrapi:1.0.0'
|
compile 'biz.nellemann.libs:libcvrapi:1.+'
|
||||||
runtime "org.slf4j:slf4j-simple:1.7.25"
|
runtime "org.slf4j:slf4j-simple:1.7.28"
|
||||||
}
|
}
|
||||||
|
|
||||||
## Development
|
## Development
|
||||||
|
|
13
build.gradle
13
build.gradle
|
@ -21,7 +21,7 @@ repositories {
|
||||||
dependencies {
|
dependencies {
|
||||||
|
|
||||||
implementation("org.slf4j:slf4j-api:${slf4jVersion}")
|
implementation("org.slf4j:slf4j-api:${slf4jVersion}")
|
||||||
implementation("org.slf4j:slf4j-simple:${slf4jVersion}")
|
//implementation("org.slf4j:slf4j-simple:${slf4jVersion}")
|
||||||
implementation('com.google.code.gson:gson:2.8.5')
|
implementation('com.google.code.gson:gson:2.8.5')
|
||||||
implementation("com.squareup.okhttp3:okhttp:4.1.0")
|
implementation("com.squareup.okhttp3:okhttp:4.1.0")
|
||||||
|
|
||||||
|
@ -35,6 +35,17 @@ dependencies {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
publishing {
|
||||||
|
publications {
|
||||||
|
mavenJava(MavenPublication) {
|
||||||
|
from components.java
|
||||||
|
}
|
||||||
|
}
|
||||||
|
repositories {
|
||||||
|
mavenLocal()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
bintray {
|
bintray {
|
||||||
user = System.getenv('BINTRAY_USER')
|
user = System.getenv('BINTRAY_USER')
|
||||||
key = System.getenv('BINTRAY_KEY')
|
key = System.getenv('BINTRAY_KEY')
|
||||||
|
|
28
src/main/java/biz/nellemann/libcvrapi/Accounting.java
Normal file
28
src/main/java/biz/nellemann/libcvrapi/Accounting.java
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
/*
|
||||||
|
* Licensed to the Apache Software Foundation (ASF) under one
|
||||||
|
* or more contributor license agreements. See the NOTICE file
|
||||||
|
* distributed with this work for additional information
|
||||||
|
* regarding copyright ownership. The ASF licenses this file
|
||||||
|
* to you under the Apache 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.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing,
|
||||||
|
* software distributed under the License is distributed on an
|
||||||
|
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
|
* KIND, either express or implied. See the License for the
|
||||||
|
* specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package biz.nellemann.libcvrapi;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class Accounting {
|
||||||
|
|
||||||
|
Boolean revision;
|
||||||
|
List<AccountingDocument> documents;
|
||||||
|
}
|
|
@ -0,0 +1,32 @@
|
||||||
|
/*
|
||||||
|
* Licensed to the Apache Software Foundation (ASF) under one
|
||||||
|
* or more contributor license agreements. See the NOTICE file
|
||||||
|
* distributed with this work for additional information
|
||||||
|
* regarding copyright ownership. The ASF licenses this file
|
||||||
|
* to you under the Apache 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.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing,
|
||||||
|
* software distributed under the License is distributed on an
|
||||||
|
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
|
* KIND, either express or implied. See the License for the
|
||||||
|
* specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package biz.nellemann.libcvrapi;
|
||||||
|
|
||||||
|
public class AccountingDocument {
|
||||||
|
|
||||||
|
String url;
|
||||||
|
String type;
|
||||||
|
String start;
|
||||||
|
String end;
|
||||||
|
String publicdate;
|
||||||
|
String extension;
|
||||||
|
AccountingDocumentSummary summary;
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,68 @@
|
||||||
|
/*
|
||||||
|
* Licensed to the Apache Software Foundation (ASF) under one
|
||||||
|
* or more contributor license agreements. See the NOTICE file
|
||||||
|
* distributed with this work for additional information
|
||||||
|
* regarding copyright ownership. The ASF licenses this file
|
||||||
|
* to you under the Apache 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.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing,
|
||||||
|
* software distributed under the License is distributed on an
|
||||||
|
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
|
* KIND, either express or implied. See the License for the
|
||||||
|
* specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package biz.nellemann.libcvrapi;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
public class AccountingDocumentSummary {
|
||||||
|
|
||||||
|
String start;
|
||||||
|
String end;
|
||||||
|
BigDecimal revenue;
|
||||||
|
BigDecimal grossprofitloss;
|
||||||
|
BigDecimal profitloss;
|
||||||
|
BigDecimal equity;
|
||||||
|
Integer averagenumberofemployees;
|
||||||
|
|
||||||
|
/* TODO: Add fields if needed
|
||||||
|
"employeebenefitsexpense": "-27446000",
|
||||||
|
"depreciationamortisationexpenseprofitorloss": null,
|
||||||
|
"profitlossfromordinaryoperatingactivities": null,
|
||||||
|
"incomefrominvestmentsingroupenterprises": null,
|
||||||
|
"otherfinanceincome": null,
|
||||||
|
"otherfinanceexpenses": null,
|
||||||
|
"profitlossfromordinaryactivitiesbeforetax": null,
|
||||||
|
"taxexpenseonordinaryactivities": null,
|
||||||
|
"taxexpense": null,
|
||||||
|
"assets": "47380000",
|
||||||
|
"proposeddividendrecognisedinequity": null,
|
||||||
|
"proposeddividend": null,
|
||||||
|
"dividend": null,
|
||||||
|
"noncurrentassets": "21387000",
|
||||||
|
"landandbuildings": null,
|
||||||
|
"currentassets": "25993000",
|
||||||
|
"inventories": null,
|
||||||
|
"shorttermtradereceivables": null,
|
||||||
|
"cashandcashequivalents": "12312000",
|
||||||
|
"equityloan": null,
|
||||||
|
"provisions": null,
|
||||||
|
"longtermliabilitiesotherthanprovisions": null,
|
||||||
|
"shorttermliabilitiesotherthanprovisions": null,
|
||||||
|
"liabilitiesandequity": null,
|
||||||
|
"coverage": null,
|
||||||
|
"operatingmargin": null,
|
||||||
|
"roi": null,
|
||||||
|
"liquidityratio": null,
|
||||||
|
"solvencyratio": 7.389193752638244,
|
||||||
|
"equityreturn": null,
|
||||||
|
*/
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -30,11 +30,11 @@ public class Company {
|
||||||
Address address;
|
Address address;
|
||||||
Contact contact;
|
Contact contact;
|
||||||
Industrycode industrycode;
|
Industrycode industrycode;
|
||||||
Companyform compantform;
|
Companyform companyform;
|
||||||
Companystatus companystatus;
|
Companystatus companystatus;
|
||||||
Status status;
|
Status status;
|
||||||
|
|
||||||
// Accounting accounting;
|
Accounting accounting;
|
||||||
// Tax tax;
|
// Tax tax;
|
||||||
|
|
||||||
Capital capital;
|
Capital capital;
|
||||||
|
|
|
@ -21,7 +21,7 @@ package biz.nellemann.libcvrapi;
|
||||||
|
|
||||||
public class Companyform {
|
public class Companyform {
|
||||||
|
|
||||||
String code;
|
Integer code;
|
||||||
String description;
|
String description;
|
||||||
String longdescription;
|
String longdescription;
|
||||||
Boolean holding;
|
Boolean holding;
|
||||||
|
|
|
@ -23,6 +23,7 @@ import java.io.IOException;
|
||||||
|
|
||||||
import com.google.gson.Gson;
|
import com.google.gson.Gson;
|
||||||
|
|
||||||
|
import com.google.gson.JsonSyntaxException;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
@ -82,16 +83,9 @@ public class CvrApi {
|
||||||
* @param json
|
* @param json
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
protected Company parseJsonIntoCompany(String json) {
|
protected Company parseJsonIntoCompany(String json) throws JsonSyntaxException {
|
||||||
|
Gson gson = new Gson();
|
||||||
Company company;
|
Company company = gson.fromJson(json, Company.class);
|
||||||
try {
|
|
||||||
company = new Company();
|
|
||||||
company = new Gson().fromJson(json, Company.class);
|
|
||||||
} catch (Exception e) {
|
|
||||||
log.error("Error deserializing json into Company", e);
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
return company;
|
return company;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -21,7 +21,7 @@ package biz.nellemann.libcvrapi;
|
||||||
|
|
||||||
public class Industrycode {
|
public class Industrycode {
|
||||||
|
|
||||||
String code;
|
Integer code;
|
||||||
String text;
|
String text;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,4 +32,6 @@ public class Info {
|
||||||
* "intervalAmountEmployees": "ANTAL_50_99", "amountEmployeesLow": "50",
|
* "intervalAmountEmployees": "ANTAL_50_99", "amountEmployeesLow": "50",
|
||||||
* "amountEmployeesHigh": "99", "year": "2019", "month": "2" }
|
* "amountEmployeesHigh": "99", "year": "2019", "month": "2" }
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
InfoEmployment employment;
|
||||||
}
|
}
|
||||||
|
|
30
src/main/java/biz/nellemann/libcvrapi/InfoEmployment.java
Normal file
30
src/main/java/biz/nellemann/libcvrapi/InfoEmployment.java
Normal file
|
@ -0,0 +1,30 @@
|
||||||
|
/*
|
||||||
|
* Licensed to the Apache Software Foundation (ASF) under one
|
||||||
|
* or more contributor license agreements. See the NOTICE file
|
||||||
|
* distributed with this work for additional information
|
||||||
|
* regarding copyright ownership. The ASF licenses this file
|
||||||
|
* to you under the Apache 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.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing,
|
||||||
|
* software distributed under the License is distributed on an
|
||||||
|
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
|
* KIND, either express or implied. See the License for the
|
||||||
|
* specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package biz.nellemann.libcvrapi;
|
||||||
|
|
||||||
|
public class InfoEmployment {
|
||||||
|
|
||||||
|
String intervalAmountEmployees;
|
||||||
|
Integer amountEmployeesLow;
|
||||||
|
Integer amountEmployeesHigh;
|
||||||
|
Integer year;
|
||||||
|
Integer month;
|
||||||
|
|
||||||
|
}
|
|
@ -21,7 +21,7 @@ package biz.nellemann.libcvrapi;
|
||||||
|
|
||||||
public class Status {
|
public class Status {
|
||||||
|
|
||||||
String code;
|
Integer code;
|
||||||
String creditcode;
|
String creditcode;
|
||||||
String start;
|
String start;
|
||||||
String end;
|
String end;
|
||||||
|
|
|
@ -26,6 +26,8 @@ class CvrApiSpec extends Specification {
|
||||||
company.vat == 25063864
|
company.vat == 25063864
|
||||||
company.life.name == 'AGILLIC A/S'
|
company.life.name == 'AGILLIC A/S'
|
||||||
company.secondarynames.contains('Wavetech A/S')
|
company.secondarynames.contains('Wavetech A/S')
|
||||||
|
company.info.employment.amountEmployeesLow == 50
|
||||||
|
company.info.employment.amountEmployeesHigh == 99
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue