Hello
my business has a "strange" request:
they would like that an administrator is able to change the author of a document until it reach a specific state.
I'm not such a big fan for tracability reason, but I'm wondering if it's possible nevertheless. I couldn't find a way with orgadmin.
we're using PDMLink 9.1
Can someone help me ?
Thank you
Benoit
Hi. You whant change attribute created by?
Hi,
here is the process:
1/ user ID123 create a new document
Data for this document:
CreatedBy = ID123
ModifiedBy = ID123
DateCreation = 02/03/2011
2/ An administrator change the authorId from ID123 to ID789
Data for this document:
CreatedBy = ID789
ModifiedBy = ID789
DateCreation = 02/03/2011
Do you think it's possible ?
I write sample java code, for change creator attribute, you can test them from eclipse
package wt.vc;
import wt.doc.WTDocument;
import wt.fc.Persistable;
import wt.fc.PersistenceHelper;
import wt.fc.ReferenceFactory;
import wt.fc.WTReference;
import wt.org.WTPrincipalReference;
import wt.util.WTException;
/**
* @author Feofilov Ivan created: 02.03.2011 fivig@mail.ru
* http://plmservice.ru
*
*/
public class CreatorModifier {
public static void main(String[] args) {
// document must be checkout
WTDocument doc = (WTDocument) getObjectByRefString("VR:wt.doc.WTDocument:16168148");
wt.org.WTUser p = (wt.org.WTUser) getObjectByRefString("OR:wt.org.WTUser:4287687");
assignIterationCreator(doc, (WTPrincipalReference) getRefObjByObj(p));
try {
PersistenceHelper.manager.save(doc);
} catch (WTException e) {
e.printStackTrace();
}
}
public static Iterated assignIterationCreator(Iterated iterated,
WTPrincipalReference wtprincipalreference)
{
try {
iterated.getIterationInfo().setCreator(wtprincipalreference);
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
public static Persistable getObjectByRefString(String refString) {
Persistable result = null;
try {
ReferenceFactory refFact = new wt.fc.ReferenceFactory();
WTReference ref = refFact.getReference(refString);
result = ref.getObject();
} catch (WTException e) {
e.printStackTrace();
}
return result;
}
public static WTReference getRefObjByObj(Persistable obj) {
try {
ReferenceFactory refFact = new wt.fc.ReferenceFactory();
return refFact.getReference(obj);
} catch (WTException e) {
e.printStackTrace();
return null;
}
}
}
It really a stange request, I don't know why the user want to do it! but everything is possible if you use customization.