Skip to content

Commit

Permalink
address code quality issues #EA-4079
Browse files Browse the repository at this point in the history
  • Loading branch information
GordeaS authored and GordeaS committed Feb 18, 2025
1 parent 7995b8d commit 63a2cdc
Show file tree
Hide file tree
Showing 8 changed files with 35 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ public String toString() {
+ id
+ '\''
+ ", type='"
+ getAggregationType()
+ type
+ '\''
+ ", rights='"
+ rights
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,12 @@ public static String getEuropeanaProxyId(String entityId) {
return entityId + "#proxy_europeana";
}

/**
* Instantiates a new Aggregation and fills the mandatory fields
* @param entityId the entity ID
* @param timestamp creation timestamp
* @return the Aggregation object
*/
public static Aggregation createNewAggregation(String entityId, Date timestamp) {
Aggregation isAggregatedBy = new Aggregation();
isAggregatedBy.setId(getIsAggregatedById(entityId));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,11 @@
XML_SAME_AS,
IS_AGGREGATED_BY
})

@SuppressWarnings("java:S2384")
/**
* class for xml serialization of Aggregators
*/
@SuppressWarnings("java:S2384")
public class XmlAggregatorImpl extends XmlBaseOrganizationImpl {

@XmlElement(namespace = NAMESPACE_FOAF, name = XML_MBOX)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@

@XmlAccessorType(XmlAccessType.FIELD)
@XmlTransient
/**
* Base class for XML serialization of organizations
*/
public abstract class XmlBaseOrganizationImpl extends XmlBaseEntityImpl<Organization> {

@XmlElement(namespace = NAMESPACE_OWL, name = XML_SAME_AS)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,23 @@
XML_SAME_AS,
IS_AGGREGATED_BY
})
/**
* Class for XML serialization and deserialization of Organizations
*/
public class XmlOrganizationImpl extends XmlBaseOrganizationImpl {

/**
* Constructor from organization
* @param organization pojo
*/
public XmlOrganizationImpl(Organization organization) {
super(organization);
}

/**
* Default constructor
*/
public XmlOrganizationImpl() {
super();
//default connstructor
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import static eu.europeana.entitymanagement.utils.EntityRecordUtils.getDatasourceAggregationId;
import static eu.europeana.entitymanagement.utils.EntityRecordUtils.getEuropeanaAggregationId;
import static eu.europeana.entitymanagement.utils.EntityRecordUtils.getEuropeanaProxyId;
import static eu.europeana.entitymanagement.utils.EntityRecordUtils.getIsAggregatedById;
import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
import java.util.ArrayList;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -875,7 +875,6 @@ private void updateEntityAggregation(EntityRecord entityRecord, Date timestamp)
Aggregation aggregation = entityRecord.getEntity().getIsAggregatedBy();
if (aggregation == null) {
aggregation = EntityRecordUtils.createNewAggregation(entityRecord.getEntityId(), timestamp);
System.out.println("");
entityRecord.getEntity().setIsAggregatedBy(aggregation);
} else {
aggregation.setModified(timestamp);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,17 @@ public class ZohoSyncService extends BaseZohoAccess {

private final JsonLdSerializer emJsonldSerializer;

/**
* Constructor using autowired beans
* @param entityRecordService the entity record service
* @param entityUpdateService the entity update service
* @param emConfiguration the app configuration
* @param datasources the datasources
* @param zohoConfiguration the zoho access configuration
* @param zohoSyncRepo the zoho sync repository
* @param zohoDereferenceService the zoho dereference service
* @param emJsonldSerializer the json serializer
*/
@Autowired
public ZohoSyncService(EntityRecordService entityRecordService,
EntityUpdateService entityUpdateService, EntityManagementConfiguration emConfiguration,
Expand Down Expand Up @@ -164,7 +175,7 @@ String buildSyncReportMessageForSlackWebHook(ZohoSyncReport zohoSyncReport) thro
//could use a proper object and json serializer later
Map<String, String> body = new ConcurrentHashMap<>();
body.put("text", slackMessage);
return emJsonldSerializer.serializeObject(slackMessage);
return emJsonldSerializer.serializeObject(body);
}


Expand Down

0 comments on commit 63a2cdc

Please sign in to comment.