Skip to content
Snippets Groups Projects
Commit 6105ccd1 authored by jakubs's avatar jakubs
Browse files

LMS-2764: refactor material with Initializer

SVN: 24704
parent 0df502c3
No related branches found
No related tags found
No related merge requests found
...@@ -32,12 +32,78 @@ public class Material extends MaterialIdentifier ...@@ -32,12 +32,78 @@ public class Material extends MaterialIdentifier
private Map<String, Material> materialProperties; private Map<String, Material> materialProperties;
public Material(MaterialTypeIdentifier materialTypeIdentifier, String materialCode, private EntityRegistrationDetails registrationDetails;
Map<String, String> properties, Map<String, Material> materialProperties)
public static final class MaterialInitializer
{
private MaterialTypeIdentifier materialTypeIdentifier;
private String materialCode;
private Map<String, String> properties;
private Map<String, Material> materialProperties;
private EntityRegistrationDetails registrationDetails;
public MaterialTypeIdentifier getMaterialTypeIdentifier()
{
return materialTypeIdentifier;
}
public void setMaterialTypeIdentifier(MaterialTypeIdentifier materialTypeIdentifier)
{
this.materialTypeIdentifier = materialTypeIdentifier;
}
public String getMaterialCode()
{
return materialCode;
}
public void setMaterialCode(String materialCode)
{
this.materialCode = materialCode;
}
public Map<String, String> getProperties()
{
return properties;
}
public void setProperties(Map<String, String> properties)
{
this.properties = properties;
}
public Map<String, Material> getMaterialProperties()
{
return materialProperties;
}
public void setMaterialProperties(Map<String, Material> materialProperties)
{
this.materialProperties = materialProperties;
}
public EntityRegistrationDetails getRegistrationDetails()
{
return registrationDetails;
}
public void setRegistrationDetails(EntityRegistrationDetails registrationDetails)
{
this.registrationDetails = registrationDetails;
}
}
public Material(MaterialInitializer initializer)
{ {
super(materialTypeIdentifier, materialCode); super(initializer.getMaterialTypeIdentifier(), initializer.getMaterialCode());
this.properties = new HashMap<String, String>(properties); this.properties = initializer.getProperties();
this.materialProperties = new HashMap<String, Material>(materialProperties); this.materialProperties = initializer.getMaterialProperties();
this.registrationDetails = initializer.getRegistrationDetails();
} }
/** /**
...@@ -53,6 +119,11 @@ public class Material extends MaterialIdentifier ...@@ -53,6 +119,11 @@ public class Material extends MaterialIdentifier
return Collections.unmodifiableMap(materialProperties); return Collections.unmodifiableMap(materialProperties);
} }
public EntityRegistrationDetails getRegistrationDetails()
{
return registrationDetails;
}
// //
// JSON-RPC // JSON-RPC
// //
...@@ -72,4 +143,8 @@ public class Material extends MaterialIdentifier ...@@ -72,4 +143,8 @@ public class Material extends MaterialIdentifier
this.materialProperties = materialProperties; this.materialProperties = materialProperties;
} }
private void setRegistrationDetails(EntityRegistrationDetails registrationDetails)
{
this.registrationDetails = registrationDetails;
}
} }
...@@ -19,7 +19,7 @@ package ch.systemsx.cisd.openbis.generic.shared.api.v1.dto; ...@@ -19,7 +19,7 @@ package ch.systemsx.cisd.openbis.generic.shared.api.v1.dto;
import java.io.Serializable; import java.io.Serializable;
/** /**
* * duplicated from ch.systemsx.cisd.openbis.plugin.screening.shared.api.v1.dto.MaterialTypeIdentifier
* *
* @author jakubs * @author jakubs
*/ */
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment