Skip to content

Commit

Permalink
added lifecycleState column
Browse files Browse the repository at this point in the history
  • Loading branch information
1azyman committed Oct 26, 2016
1 parent 04f7b0a commit 53dff1a
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 6 deletions.
4 changes: 3 additions & 1 deletion repo/repo-sql-impl-test/src/test/resources/basic/objects.xml
Expand Up @@ -30,7 +30,9 @@

<user version="1" xmlns="http://midpoint.evolveum.com/xml/ns/public/common/common-3" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<c:name>atestuserX00002</c:name>


<lifecycleState>testLifecycleStatus</lifecycleState>

<trigger id="2">
<handlerUri>http://triggerUri</handlerUri>
<timestamp>2013-05-07T10:38:21.350+02:00</timestamp>
Expand Down
Expand Up @@ -37,7 +37,6 @@
import com.evolveum.midpoint.repo.sql.data.factory.MetadataFactory;
import com.evolveum.midpoint.repo.sql.query.definition.JaxbName;
import com.evolveum.midpoint.repo.sql.query.definition.JaxbPath;
import com.evolveum.midpoint.repo.sql.query.definition.VirtualEntity;
import com.evolveum.midpoint.repo.sql.query2.definition.IdQueryProperty;
import com.evolveum.midpoint.repo.sql.query2.definition.NotQueryable;
import com.evolveum.midpoint.repo.sql.query.definition.QueryEntity;
Expand All @@ -50,7 +49,6 @@
import com.evolveum.midpoint.repo.sql.util.RUtil;
import com.evolveum.midpoint.schema.GetOperationOptions;
import com.evolveum.midpoint.schema.SelectorOptions;
import com.evolveum.midpoint.xml.ns._public.common.common_3.MetadataType;
import com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectType;
import com.evolveum.midpoint.xml.ns._public.common.common_3.TriggerType;
import org.apache.commons.lang.StringUtils;
Expand All @@ -59,8 +57,6 @@
import org.hibernate.annotations.GenericGenerator;
import org.hibernate.annotations.NamedQueries;
import org.hibernate.annotations.NamedQuery;
import org.hibernate.annotations.NotFound;
import org.hibernate.annotations.NotFoundAction;
import org.hibernate.annotations.Persister;
import org.hibernate.annotations.Where;

Expand Down Expand Up @@ -142,7 +138,8 @@
@Index(name = "iObjectNameOrig", columnList = "name_orig"),
@Index(name = "iObjectNameNorm", columnList = "name_norm"),
@Index(name = "iObjectTypeClass", columnList = "objectTypeClass"),
@Index(name = "iObjectCreateTimestamp", columnList = "createTimestamp")})
@Index(name = "iObjectCreateTimestamp", columnList = "createTimestamp"),
@Index(name = "iObjectLifecycleState", columnList = "lifecycleState")})
@Inheritance(strategy = InheritanceType.JOINED)
@Persister(impl = MidPointJoinedPersister.class)
public abstract class RObject<T extends ObjectType> implements Metadata<RObjectReference<RFocus>>, EntityState, Serializable {
Expand All @@ -165,6 +162,7 @@ public abstract class RObject<T extends ObjectType> implements Metadata<RObjectR
private Set<RObjectReference<ROrg>> parentOrgRef;
private Set<RTrigger> trigger;
private REmbeddedReference tenantRef;
private String lifecycleState;
//Metadata
private XMLGregorianCalendar createTimestamp;
private REmbeddedReference creatorRef;
Expand Down Expand Up @@ -427,6 +425,14 @@ public Boolean isTransient() {
return trans;
}

public String getLifecycleState() {
return lifecycleState;
}

public void setLifecycleState(String lifecycleState) {
this.lifecycleState = lifecycleState;
}

@Override
public void setTransient(Boolean trans) {
this.trans = trans;
Expand Down Expand Up @@ -575,6 +581,8 @@ public boolean equals(Object o) {
return false;
if (tenantRef != null ? !tenantRef.equals(rObject.tenantRef) : rObject.tenantRef != null)
return false;
if (lifecycleState != null ? !lifecycleState.equals(rObject.lifecycleState) : rObject.lifecycleState != null)
return false;
if (!MetadataFactory.equals(this, rObject)) return false;

if (dates != null ? !dates.equals(rObject.dates) : rObject.dates != null) return false;
Expand Down Expand Up @@ -607,6 +615,7 @@ public int hashCode() {
result = 31 * result + (modifyTimestamp != null ? modifyTimestamp.hashCode() : 0);
result = 31 * result + (modifierRef != null ? modifierRef.hashCode() : 0);
result = 31 * result + (modifyChannel != null ? modifyChannel.hashCode() : 0);
result = 31 * result + (lifecycleState != null ? lifecycleState.hashCode() : 0);

return result;
}
Expand All @@ -621,6 +630,7 @@ protected static <T extends ObjectType> void copyToJAXB(RObject<T> repo, ObjectT
jaxb.setName(RPolyString.copyToJAXB(repo.getName()));
jaxb.setOid(repo.getOid());
jaxb.setVersion(Integer.toString(repo.getVersion()));
jaxb.setLifecycleState(repo.getLifecycleState());

if (SelectorOptions.hasToLoadPath(ObjectType.F_PARENT_ORG_REF, options)) {
List orgRefs = RUtil.safeSetReferencesToList(repo.getParentOrgRef(), prismContext);
Expand All @@ -641,6 +651,7 @@ public static <T extends ObjectType> void copyFromJAXB(ObjectType jaxb, RObject<

repo.setObjectTypeClass(RObjectType.getType(ClassMapper.getHQLTypeClass(jaxb.getClass())));
repo.setName(RPolyString.copyFromJAXB(jaxb.getName()));
repo.setLifecycleState(jaxb.getLifecycleState());

String strVersion = jaxb.getVersion();
int version = StringUtils.isNotEmpty(strVersion) && strVersion.matches("[0-9]*") ? Integer.parseInt(jaxb
Expand Down

0 comments on commit 53dff1a

Please sign in to comment.