public DynamicTypeImpl clone() { DynamicTypeImpl clone = new DynamicTypeImpl(); super.deepClone(clone); clone.permissions.clear(); for (PermissionImpl perm : permissions) { PermissionImpl permClone = perm.clone(); clone.permissions.add(permClone); } clone.lastChanged = lastChanged; clone.createDate = createDate; clone.name = (MultiLanguageName) name.clone(); clone.key = key; for (AttributeImpl att : clone.getSubEntities()) { ((AttributeImpl) att).setParent(clone); } clone.annotations = new LinkedHashMap<String, ParsedText>(); DynamicTypeParseContext parseContext = new DynamicTypeParseContext(clone); for (Map.Entry<String, ParsedText> entry : annotations.entrySet()) { String annotation = entry.getKey(); ParsedText parsedAnnotation = entry.getValue(); String parsedValue = parsedAnnotation.getExternalRepresentation(parseContext); try { clone.setAnnotation(annotation, parsedValue); } catch (IllegalAnnotationException e) { throw new IllegalStateException("Can't parse annotation back", e); } } return clone; }
@Override public int compareTo(Object r2) { if (!(r2 instanceof DynamicType)) { return super.compareTo(r2); } int result = SimpleEntity.timestampCompare(this, (DynamicType) r2); if (result != 0) { return result; } else { return super.compareTo(r2); } }
public void setResolver(EntityResolver resolver) { super.setResolver(resolver); for (AttributeImpl child : attributes) { child.setParent(this); } for (ParsedText annotation : annotations.values()) { try { annotation.init(parseContext); } catch (IllegalAnnotationException e) { } } for (PermissionImpl p : permissions) { p.setResolver(resolver); } }
public void setReadOnly() { super.setReadOnly(); name.setReadOnly(); }